text stringlengths 1 1.05M |
|---|
; A251578: E.g.f.: exp(8*x*G(x)^7) / G(x)^7 where G(x) = 1 + x*G(x)^8 is the g.f. of A007556.
; Submitted by Christian Krause
; 1,1,8,176,6896,397888,30584128,2948178304,342418882688,46582810477568,7268517454045184,1279982790328858624,251155319283837571072,54344039464582833577984,12855960226911391575670784,3301167001281829056285458432,914476489427649778704952819712
lpb $0
sub $0,1
add $3,1
mov $1,$3
mul $1,6
add $1,$3
add $3,$1
mul $1,$0
add $2,$1
add $4,1
mul $3,$4
add $3,$2
lpe
mov $0,$2
add $0,1
|
/*
* Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#include <aws/health/model/DescribeEntityAggregatesResult.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <aws/core/AmazonWebServiceResult.h>
#include <aws/core/utils/UnreferencedParam.h>
#include <utility>
using namespace Aws::Health::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
using namespace Aws;
DescribeEntityAggregatesResult::DescribeEntityAggregatesResult()
{
}
DescribeEntityAggregatesResult::DescribeEntityAggregatesResult(const AmazonWebServiceResult<JsonValue>& result)
{
*this = result;
}
DescribeEntityAggregatesResult& DescribeEntityAggregatesResult::operator =(const AmazonWebServiceResult<JsonValue>& result)
{
const JsonValue& jsonValue = result.GetPayload();
if(jsonValue.ValueExists("entityAggregates"))
{
Array<JsonValue> entityAggregatesJsonList = jsonValue.GetArray("entityAggregates");
for(unsigned entityAggregatesIndex = 0; entityAggregatesIndex < entityAggregatesJsonList.GetLength(); ++entityAggregatesIndex)
{
m_entityAggregates.push_back(entityAggregatesJsonList[entityAggregatesIndex].AsObject());
}
}
return *this;
}
|
#include "utility.h"
#include <chrono>
#include <cstdint>
#include <memory>
#include <string>
#include "envoy/event/dispatcher.h"
#include "envoy/network/connection.h"
#include "common/api/api_impl.h"
#include "common/buffer/buffer_impl.h"
#include "common/common/assert.h"
#include "common/common/fmt.h"
#include "common/http/header_map_impl.h"
#include "common/http/headers.h"
#include "common/network/utility.h"
#include "common/upstream/upstream_impl.h"
#include "test/common/upstream/utility.h"
#include "test/mocks/upstream/mocks.h"
#include "test/test_common/network_utility.h"
#include "test/test_common/printers.h"
#include "test/test_common/utility.h"
namespace Envoy {
void BufferingStreamDecoder::decodeHeaders(Http::HeaderMapPtr&& headers, bool end_stream) {
ASSERT(!complete_);
complete_ = end_stream;
headers_ = std::move(headers);
if (complete_) {
onComplete();
}
}
void BufferingStreamDecoder::decodeData(Buffer::Instance& data, bool end_stream) {
ASSERT(!complete_);
complete_ = end_stream;
body_.append(data.toString());
if (complete_) {
onComplete();
}
}
void BufferingStreamDecoder::decodeTrailers(Http::HeaderMapPtr&&) {
NOT_IMPLEMENTED_GCOVR_EXCL_LINE;
}
void BufferingStreamDecoder::onComplete() {
ASSERT(complete_);
on_complete_cb_();
}
void BufferingStreamDecoder::onResetStream(Http::StreamResetReason) { ADD_FAILURE(); }
BufferingStreamDecoderPtr
IntegrationUtil::makeSingleRequest(const Network::Address::InstanceConstSharedPtr& addr,
const std::string& method, const std::string& url,
const std::string& body, Http::CodecClient::Type type,
const std::string& host, const std::string& content_type) {
Api::Impl api(std::chrono::milliseconds(9000));
Event::DispatcherPtr dispatcher(api.allocateDispatcher());
std::shared_ptr<Upstream::MockClusterInfo> cluster{new NiceMock<Upstream::MockClusterInfo>()};
Upstream::HostDescriptionConstSharedPtr host_description{
Upstream::makeTestHostDescription(cluster, "tcp://127.0.0.1:80")};
Http::CodecClientProd client(
type,
dispatcher->createClientConnection(addr, Network::Address::InstanceConstSharedPtr(),
Network::Test::createRawBufferSocket(), nullptr),
host_description, *dispatcher);
BufferingStreamDecoderPtr response(new BufferingStreamDecoder([&]() -> void {
client.close();
dispatcher->exit();
}));
Http::StreamEncoder& encoder = client.newStream(*response);
encoder.getStream().addCallbacks(*response);
Http::HeaderMapImpl headers;
headers.insertMethod().value(method);
headers.insertPath().value(url);
headers.insertHost().value(host);
headers.insertScheme().value(Http::Headers::get().SchemeValues.Http);
if (!content_type.empty()) {
headers.insertContentType().value(content_type);
}
encoder.encodeHeaders(headers, body.empty());
if (!body.empty()) {
Buffer::OwnedImpl body_buffer(body);
encoder.encodeData(body_buffer, true);
}
dispatcher->run(Event::Dispatcher::RunType::Block);
return response;
}
BufferingStreamDecoderPtr
IntegrationUtil::makeSingleRequest(uint32_t port, const std::string& method, const std::string& url,
const std::string& body, Http::CodecClient::Type type,
Network::Address::IpVersion ip_version, const std::string& host,
const std::string& content_type) {
auto addr = Network::Utility::resolveUrl(
fmt::format("tcp://{}:{}", Network::Test::getLoopbackAddressUrlString(ip_version), port));
return makeSingleRequest(addr, method, url, body, type, host, content_type);
}
RawConnectionDriver::RawConnectionDriver(uint32_t port, Buffer::Instance& initial_data,
ReadCallback data_callback,
Network::Address::IpVersion version) {
api_.reset(new Api::Impl(std::chrono::milliseconds(10000)));
dispatcher_ = api_->allocateDispatcher();
client_ = dispatcher_->createClientConnection(
Network::Utility::resolveUrl(
fmt::format("tcp://{}:{}", Network::Test::getLoopbackAddressUrlString(version), port)),
Network::Address::InstanceConstSharedPtr(), Network::Test::createRawBufferSocket(), nullptr);
client_->addReadFilter(Network::ReadFilterSharedPtr{new ForwardingFilter(*this, data_callback)});
client_->write(initial_data, false);
client_->connect();
}
RawConnectionDriver::~RawConnectionDriver() {}
void RawConnectionDriver::run() { dispatcher_->run(Event::Dispatcher::RunType::Block); }
void RawConnectionDriver::close() { client_->close(Network::ConnectionCloseType::FlushWrite); }
WaitForPayloadReader::WaitForPayloadReader(Event::Dispatcher& dispatcher)
: dispatcher_(dispatcher) {}
Network::FilterStatus WaitForPayloadReader::onData(Buffer::Instance& data, bool end_stream) {
data_.append(data.toString());
data.drain(data.length());
read_end_stream_ = end_stream;
if ((!data_to_wait_for_.empty() && data_.find(data_to_wait_for_) == 0) ||
(exact_match_ == false && data_.find(data_to_wait_for_) != std::string::npos) || end_stream) {
data_to_wait_for_.clear();
dispatcher_.exit();
}
return Network::FilterStatus::StopIteration;
}
} // namespace Envoy
|
GLOBAL _syscall
;_syscall(int id, int arg1, int arg2, int arg3)
_syscall:
push rbp
mov rbp, rsp
int 80h
leave
ret
|
<% from pwnlib.shellcraft import common %>
<% from pwnlib.shellcraft.i386 import linux %>
<%docstring>
Findpeer + stager
Args:
size, the size of the payload
port, the port given to findpeer (defaults to any)
</%docstring>
<%page args="size, port = None"/>
${linux.findpeer(port)}
${linux.stager("esi", size)}
|
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php.
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
; ZeroMem.Asm
;
; Abstract:
;
; ZeroMem function
;
; Notes:
;
;------------------------------------------------------------------------------
SECTION .text
;------------------------------------------------------------------------------
; VOID *
; InternalMemZeroMem (
; IN VOID *Buffer,
; IN UINTN Count
; );
;------------------------------------------------------------------------------
global ASM_PFX(InternalMemZeroMem)
ASM_PFX(InternalMemZeroMem):
push edi
xor eax, eax
mov edi, [esp + 8]
mov ecx, [esp + 12]
mov edx, ecx
shr ecx, 2
and edx, 3
push edi
rep stosd
mov ecx, edx
rep stosb
pop eax
pop edi
ret
|
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %r14
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x6b0a, %r14
nop
nop
nop
nop
and %r11, %r11
movw $0x6162, (%r14)
inc %rax
lea addresses_UC_ht+0x176ba, %rcx
cmp $29197, %r11
movl $0x61626364, (%rcx)
nop
nop
nop
cmp $48977, %r14
lea addresses_normal_ht+0x146ba, %rsi
lea addresses_WT_ht+0xc3ba, %rdi
nop
nop
nop
nop
nop
add $12831, %r13
mov $45, %rcx
rep movsl
nop
dec %rdi
lea addresses_WT_ht+0x15fba, %r11
nop
nop
nop
nop
sub %rdi, %rdi
mov $0x6162636465666768, %rsi
movq %rsi, %xmm1
movups %xmm1, (%r11)
nop
nop
and $30143, %rsi
lea addresses_D_ht+0x1b0da, %rax
clflush (%rax)
nop
nop
nop
xor $8047, %r14
mov (%rax), %si
nop
nop
nop
xor %rdi, %rdi
lea addresses_normal_ht+0x3eba, %rcx
nop
lfence
movw $0x6162, (%rcx)
nop
nop
nop
inc %r14
lea addresses_UC_ht+0x136ba, %rcx
nop
nop
nop
nop
nop
sub $10937, %rsi
movb $0x61, (%rcx)
nop
nop
nop
cmp $1438, %r11
lea addresses_A_ht+0x1c0fa, %rdi
inc %rax
mov (%rdi), %r13w
nop
dec %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r14
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r15
push %r9
push %rbp
push %rcx
push %rdi
push %rsi
// REPMOV
lea addresses_A+0x140ba, %rsi
lea addresses_WC+0xffe2, %rdi
inc %r9
mov $71, %rcx
rep movsq
nop
nop
nop
sub $44746, %rsi
// Faulty Load
lea addresses_PSE+0x7eba, %rbp
nop
cmp $62694, %r15
movb (%rbp), %r9b
lea oracles, %r12
and $0xff, %r9
shlq $12, %r9
mov (%r12,%r9,1), %r9
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r15
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_PSE', 'NT': True, 'AVXalign': False, 'size': 1, 'congruent': 0}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 9, 'type': 'addresses_A'}, 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_WC'}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_PSE', 'NT': True, 'AVXalign': False, 'size': 1, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 4}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 7}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_normal_ht'}, 'dst': {'same': False, 'congruent': 7, 'type': 'addresses_WT_ht'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 7}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 5}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 11}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 6}}
{'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
*/
|
/********************************************************************************
* Copyright 2015 The Robotics Group, The Maersk Mc-Kinney Moller Institute,
* Faculty of Engineering, University of Southern Denmark
*
* 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 RWSIMLIBS_TOOLS_SIMULATORLOGVIEWER_HPP_
#define RWSIMLIBS_TOOLS_SIMULATORLOGVIEWER_HPP_
/**
* @file SimulatorLogViewer.hpp
*
* \copydoc rwsimlibs::tools::SimulatorLogViewer
*/
#include <rw/core/Ptr.hpp>
#include <QMainWindow>
namespace Ui {
class SimulatorLogViewer;
}
namespace rwsim { namespace dynamics {
class DynamicWorkCell;
}} // namespace rwsim::dynamics
namespace rwsim { namespace log {
class SimulatorLogScope;
}} // namespace rwsim::log
namespace rwsimlibs { namespace gui {
class SimulatorLogWidget;
}} // namespace rwsimlibs::gui
namespace rwsimlibs { namespace tools {
//! @addtogroup rwsimlibs_tools
//! @{
/**
* @brief Stand-alone application for visualization of internal data from a Physics Engine.
*
* Primary use of this tool is for debugging of engines.
*/
class SimulatorLogViewer : public QMainWindow
{
Q_OBJECT
public:
//! @brief Constructor.
SimulatorLogViewer ();
//! @brief Destructor.
virtual ~SimulatorLogViewer ();
/**
* @brief Set the dynamic workcell.
* @param dwc [in] the dynamic workcell.
*/
void setDWC (rw::core::Ptr< const rwsim::dynamics::DynamicWorkCell > dwc);
/**
* @brief Set the log structure.
* @param log [in/out] the log structure - the statistics info might be updated if requested
* by user.
*/
void setLog (rw::core::Ptr< rwsim::log::SimulatorLogScope > log);
public slots:
//! @brief Open dialog for choosing a dynamic workcell.
void openDWC ();
//! @brief Close the currently open dynamic workcell.
void closeDWC ();
//! @brief Open dialog for choosing a log to compare with.
void openCompare ();
signals:
/**
* @brief Signal for a changed dynamic workcell.
* @param dwc [in] the new dynamic workcell, or NULL if no dynamic workcell.
*/
void dwcChanged (rw::core::Ptr< const rwsim::dynamics::DynamicWorkCell > dwc);
private:
Ui::SimulatorLogViewer* const _ui;
rw::core::Ptr< const rwsim::dynamics::DynamicWorkCell > _dwc;
rw::core::Ptr< rwsim::log::SimulatorLogScope > _log;
rwsimlibs::gui::SimulatorLogWidget* _widget;
};
//! @}
}} // namespace rwsimlibs::tools
#endif /* RWSIMLIBS_TOOLS_SIMULATORLOGVIEWER_HPP_ */
|
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %r14
push %r15
push %r9
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x13260, %rsi
lea addresses_D_ht+0x5860, %rdi
nop
nop
nop
nop
nop
sub $33162, %r14
mov $9, %rcx
rep movsw
nop
nop
cmp $46063, %r9
lea addresses_WC_ht+0x51b4, %rsi
lea addresses_WC_ht+0x2bbf, %rdi
nop
nop
inc %r11
mov $30, %rcx
rep movsl
add %rcx, %rcx
lea addresses_normal_ht+0x1e619, %rsi
lea addresses_UC_ht+0x70e0, %rdi
dec %r15
mov $25, %rcx
rep movsw
nop
nop
sub %r9, %r9
lea addresses_WT_ht+0x17460, %rcx
cmp $48194, %rdi
movl $0x61626364, (%rcx)
nop
sub $56234, %r15
lea addresses_WT_ht+0x1718, %rsi
nop
nop
nop
nop
nop
add %r14, %r14
mov $0x6162636465666768, %rdi
movq %rdi, %xmm4
movups %xmm4, (%rsi)
nop
nop
nop
nop
nop
inc %rcx
lea addresses_D_ht+0x19460, %r9
xor %r11, %r11
mov $0x6162636465666768, %r15
movq %r15, (%r9)
xor $50001, %rdi
lea addresses_UC_ht+0x36f0, %rsi
lea addresses_WT_ht+0x1ee80, %rdi
clflush (%rsi)
clflush (%rdi)
add %r13, %r13
mov $20, %rcx
rep movsb
nop
nop
cmp %r13, %r13
lea addresses_D_ht+0x19560, %r15
nop
nop
sub %r14, %r14
mov $0x6162636465666768, %rsi
movq %rsi, %xmm5
vmovups %ymm5, (%r15)
nop
add $52631, %r11
lea addresses_normal_ht+0xec60, %r9
clflush (%r9)
nop
sub %rsi, %rsi
mov (%r9), %di
xor $9534, %r9
pop %rsi
pop %rdi
pop %rcx
pop %r9
pop %r15
pop %r14
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r15
push %r9
push %rax
push %rbx
push %rdi
push %rsi
// Store
mov $0x6356040000000460, %rdi
add $4136, %rax
movb $0x51, (%rdi)
nop
sub %rdi, %rdi
// Store
lea addresses_US+0xc3e8, %rdi
nop
nop
nop
cmp $57474, %rbx
mov $0x5152535455565758, %r15
movq %r15, %xmm4
vmovaps %ymm4, (%rdi)
add $33890, %rbx
// Faulty Load
lea addresses_US+0x9460, %rbx
nop
nop
sub %rax, %rax
mov (%rbx), %edi
lea oracles, %r11
and $0xff, %rdi
shlq $12, %rdi
mov (%r11,%rdi,1), %rdi
pop %rsi
pop %rdi
pop %rbx
pop %rax
pop %r9
pop %r15
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_US', 'size': 32, 'AVXalign': True, 'NT': False, 'congruent': 3, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 10, 'same': True}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': True}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 7, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 4, 'AVXalign': True, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 4, 'same': True}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 2, 'AVXalign': True, 'NT': False, 'congruent': 11, 'same': True}}
{'51': 1371, '16': 718, '00': 1}
51 51 51 51 51 51 51 51 16 16 16 51 16 51 51 51 51 51 51 51 16 51 16 51 16 51 51 51 51 16 16 16 51 16 51 51 16 16 51 16 51 51 51 16 51 16 51 51 51 51 51 16 16 16 16 51 51 51 16 51 16 51 51 16 51 16 51 51 51 51 51 51 51 16 51 16 51 51 51 51 51 51 16 51 51 16 51 16 51 51 51 16 16 51 51 16 16 51 51 16 16 51 51 16 16 16 16 51 16 51 51 16 51 16 51 16 51 51 16 51 51 51 51 51 51 16 16 51 51 51 51 51 51 51 51 51 51 51 16 16 51 16 51 16 51 16 51 51 51 16 16 16 16 51 51 16 51 51 51 51 51 51 16 51 51 16 16 51 51 51 16 51 16 16 16 51 51 51 51 51 16 16 16 16 51 16 16 51 51 16 51 16 51 51 16 16 51 51 16 16 16 16 51 16 51 16 16 51 51 51 51 16 51 16 16 51 51 51 51 51 51 16 51 51 16 16 51 16 16 51 16 16 51 16 16 51 51 51 51 51 16 51 51 51 16 51 51 51 16 51 51 51 51 16 16 51 16 51 51 16 51 16 16 51 51 16 16 16 51 51 51 51 16 51 51 51 16 51 16 51 16 51 51 51 16 51 51 16 51 51 51 16 51 51 51 16 16 16 16 51 51 51 16 16 51 16 51 51 51 16 51 16 16 51 51 51 51 16 16 51 16 51 51 51 51 51 51 16 16 51 16 51 16 16 16 16 51 51 51 16 51 51 51 51 16 16 51 51 16 51 16 51 51 51 51 16 16 16 16 16 16 16 51 16 51 51 51 51 16 16 16 51 51 51 51 51 51 16 16 51 51 51 16 51 16 51 16 16 51 16 16 51 51 51 16 51 16 16 51 51 51 51 51 16 51 51 51 16 16 51 51 51 51 51 16 16 51 51 16 51 16 51 51 51 51 16 16 16 16 16 51 51 51 16 16 51 51 51 51 51 16 16 16 51 51 16 51 51 16 51 16 51 16 51 16 51 51 51 51 16 16 51 16 16 16 51 51 51 51 51 51 16 51 51 16 16 51 51 51 51 16 51 16 51 51 51 51 16 16 51 51 51 51 51 51 16 51 51 51 51 51 51 51 51 16 16 16 51 51 51 16 51 51 16 51 51 16 16 16 51 16 16 51 16 51 51 51 16 16 16 16 51 51 51 51 51 51 51 51 51 16 51 16 16 16 51 16 51 16 51 51 51 51 16 16 16 51 51 51 51 16 16 16 51 51 16 51 51 51 51 51 51 51 16 16 51 51 16 51 16 51 51 51 51 51 51 16 16 51 51 51 51 51 51 51 16 51 16 51 16 51 16 16 16 16 16 51 51 51 16 51 51 16 51 51 16 16 16 51 16 51 16 51 51 51 16 51 16 51 51 16 51 51 51 51 51 51 16 51 16 16 16 51 16 51 51 16 51 16 16 51 51 51 51 51 16 51 51 16 51 51 51 16 16 51 51 51 51 16 16 51 16 51 51 51 16 16 16 51 51 51 51 16 51 16 16 51 51 16 51 51 51 51 51 16 51 51 51 51 51 51 51 16 16 00 51 51 51 16 51 51 51 51 51 16 16 51 51 16 16 51 51 16 51 51 51 51 16 51 51 16 51 51 51 16 51 51 51 51 16 16 16 16 16 16 51 16 51 51 16 16 51 51 16 51 51 51 51 51 51 51 16 51 51 16 16 51 51 51 51 51 16 16 51 16 51 16 16 16 16 16 51 16 16 51 51 51 16 51 51 16 16 51 51 16 51 51 51 16 16 51 51 51 51 51 16 16 16 16 51 51 51 16 16 16 51 16 16 51 51 51 51 51 51 16 51 51 51 16 51 51 51 16 51 16 51 51 51 16 51 51 51 51 16 51 16 51 51 51 51 16 51 16 16 51 51 51 16 16 51 51 51 51 51 51 51 51 51 16 16 51 51 51 51 51 51 16 51 51 51 51 51 51 51 51 51 16 51 16 51 51 16 51 51 51 16 51 51 51 16 16 51 51 51 51 51 51 51 51 51 16 51 16 51 16 51 51 51 51 16 16 51 16 51 51 51 51 51 51 51 51 51 51 51 16 51 51 51 51 51 51 51 51 16 16 51 51 51 51 16 51 16 16 16 16 51 16 16 51 51 51 51 51 51 51 51 51 51 16 51 51 16 51 51 16 16 51 51 51 51 51 16 51 51 16 51 51 16 51 51 51 51 51 16 51 51 51 16 51 51
*/
|
_usertests: file format elf64-x86-64
Disassembly of section .text:
0000000000001000 <failexit>:
char name[3];
char *echoargv[] = { "echo", "ALL", "TESTS", "PASSED", 0 };
void
failexit(const char * const msg)
{
1000: f3 0f 1e fa endbr64
1004: 55 push %rbp
1005: 48 89 e5 mov %rsp,%rbp
1008: 48 83 ec 10 sub $0x10,%rsp
100c: 48 89 7d f8 mov %rdi,-0x8(%rbp)
printf(1, "!! FAILED %s\n", msg);
1010: 48 8b 45 f8 mov -0x8(%rbp),%rax
1014: 48 89 c2 mov %rax,%rdx
1017: 48 be 3e 6d 00 00 00 movabs $0x6d3e,%rsi
101e: 00 00 00
1021: bf 01 00 00 00 mov $0x1,%edi
1026: b8 00 00 00 00 mov $0x0,%eax
102b: 48 b9 11 66 00 00 00 movabs $0x6611,%rcx
1032: 00 00 00
1035: ff d1 callq *%rcx
exit();
1037: 48 b8 0d 63 00 00 00 movabs $0x630d,%rax
103e: 00 00 00
1041: ff d0 callq *%rax
0000000000001043 <iputtest>:
}
// does chdir() call iput(p->cwd) in a transaction?
void
iputtest(void)
{
1043: f3 0f 1e fa endbr64
1047: 55 push %rbp
1048: 48 89 e5 mov %rsp,%rbp
printf(1, "iput test\n");
104b: 48 be 4c 6d 00 00 00 movabs $0x6d4c,%rsi
1052: 00 00 00
1055: bf 01 00 00 00 mov $0x1,%edi
105a: b8 00 00 00 00 mov $0x0,%eax
105f: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
1066: 00 00 00
1069: ff d2 callq *%rdx
if(mkdir("iputdir") < 0){
106b: 48 bf 57 6d 00 00 00 movabs $0x6d57,%rdi
1072: 00 00 00
1075: 48 b8 b6 63 00 00 00 movabs $0x63b6,%rax
107c: 00 00 00
107f: ff d0 callq *%rax
1081: 85 c0 test %eax,%eax
1083: 79 16 jns 109b <iputtest+0x58>
failexit("mkdir");
1085: 48 bf 5f 6d 00 00 00 movabs $0x6d5f,%rdi
108c: 00 00 00
108f: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
1096: 00 00 00
1099: ff d0 callq *%rax
}
if(chdir("iputdir") < 0){
109b: 48 bf 57 6d 00 00 00 movabs $0x6d57,%rdi
10a2: 00 00 00
10a5: 48 b8 c3 63 00 00 00 movabs $0x63c3,%rax
10ac: 00 00 00
10af: ff d0 callq *%rax
10b1: 85 c0 test %eax,%eax
10b3: 79 16 jns 10cb <iputtest+0x88>
failexit("chdir iputdir");
10b5: 48 bf 65 6d 00 00 00 movabs $0x6d65,%rdi
10bc: 00 00 00
10bf: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
10c6: 00 00 00
10c9: ff d0 callq *%rax
}
if(unlink("../iputdir") < 0){
10cb: 48 bf 73 6d 00 00 00 movabs $0x6d73,%rdi
10d2: 00 00 00
10d5: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
10dc: 00 00 00
10df: ff d0 callq *%rax
10e1: 85 c0 test %eax,%eax
10e3: 79 16 jns 10fb <iputtest+0xb8>
failexit("unlink ../iputdir");
10e5: 48 bf 7e 6d 00 00 00 movabs $0x6d7e,%rdi
10ec: 00 00 00
10ef: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
10f6: 00 00 00
10f9: ff d0 callq *%rax
}
if(chdir("/") < 0){
10fb: 48 bf 90 6d 00 00 00 movabs $0x6d90,%rdi
1102: 00 00 00
1105: 48 b8 c3 63 00 00 00 movabs $0x63c3,%rax
110c: 00 00 00
110f: ff d0 callq *%rax
1111: 85 c0 test %eax,%eax
1113: 79 16 jns 112b <iputtest+0xe8>
failexit("chdir /");
1115: 48 bf 92 6d 00 00 00 movabs $0x6d92,%rdi
111c: 00 00 00
111f: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
1126: 00 00 00
1129: ff d0 callq *%rax
}
printf(1, "iput test ok\n");
112b: 48 be 9a 6d 00 00 00 movabs $0x6d9a,%rsi
1132: 00 00 00
1135: bf 01 00 00 00 mov $0x1,%edi
113a: b8 00 00 00 00 mov $0x0,%eax
113f: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
1146: 00 00 00
1149: ff d2 callq *%rdx
}
114b: 90 nop
114c: 5d pop %rbp
114d: c3 retq
000000000000114e <exitiputtest>:
// does exit() call iput(p->cwd) in a transaction?
void
exitiputtest(void)
{
114e: f3 0f 1e fa endbr64
1152: 55 push %rbp
1153: 48 89 e5 mov %rsp,%rbp
1156: 48 83 ec 10 sub $0x10,%rsp
int pid;
printf(1, "exitiput test\n");
115a: 48 be a8 6d 00 00 00 movabs $0x6da8,%rsi
1161: 00 00 00
1164: bf 01 00 00 00 mov $0x1,%edi
1169: b8 00 00 00 00 mov $0x0,%eax
116e: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
1175: 00 00 00
1178: ff d2 callq *%rdx
pid = fork();
117a: 48 b8 00 63 00 00 00 movabs $0x6300,%rax
1181: 00 00 00
1184: ff d0 callq *%rax
1186: 89 45 fc mov %eax,-0x4(%rbp)
if(pid < 0){
1189: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
118d: 79 16 jns 11a5 <exitiputtest+0x57>
failexit("fork");
118f: 48 bf b7 6d 00 00 00 movabs $0x6db7,%rdi
1196: 00 00 00
1199: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
11a0: 00 00 00
11a3: ff d0 callq *%rax
}
if(pid == 0){
11a5: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
11a9: 0f 85 9c 00 00 00 jne 124b <exitiputtest+0xfd>
if(mkdir("iputdir") < 0){
11af: 48 bf 57 6d 00 00 00 movabs $0x6d57,%rdi
11b6: 00 00 00
11b9: 48 b8 b6 63 00 00 00 movabs $0x63b6,%rax
11c0: 00 00 00
11c3: ff d0 callq *%rax
11c5: 85 c0 test %eax,%eax
11c7: 79 16 jns 11df <exitiputtest+0x91>
failexit("mkdir");
11c9: 48 bf 5f 6d 00 00 00 movabs $0x6d5f,%rdi
11d0: 00 00 00
11d3: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
11da: 00 00 00
11dd: ff d0 callq *%rax
}
if(chdir("iputdir") < 0){
11df: 48 bf 57 6d 00 00 00 movabs $0x6d57,%rdi
11e6: 00 00 00
11e9: 48 b8 c3 63 00 00 00 movabs $0x63c3,%rax
11f0: 00 00 00
11f3: ff d0 callq *%rax
11f5: 85 c0 test %eax,%eax
11f7: 79 16 jns 120f <exitiputtest+0xc1>
failexit("child chdir");
11f9: 48 bf bc 6d 00 00 00 movabs $0x6dbc,%rdi
1200: 00 00 00
1203: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
120a: 00 00 00
120d: ff d0 callq *%rax
}
if(unlink("../iputdir") < 0){
120f: 48 bf 73 6d 00 00 00 movabs $0x6d73,%rdi
1216: 00 00 00
1219: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
1220: 00 00 00
1223: ff d0 callq *%rax
1225: 85 c0 test %eax,%eax
1227: 79 16 jns 123f <exitiputtest+0xf1>
failexit("unlink ../iputdir");
1229: 48 bf 7e 6d 00 00 00 movabs $0x6d7e,%rdi
1230: 00 00 00
1233: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
123a: 00 00 00
123d: ff d0 callq *%rax
}
exit();
123f: 48 b8 0d 63 00 00 00 movabs $0x630d,%rax
1246: 00 00 00
1249: ff d0 callq *%rax
}
wait();
124b: 48 b8 1a 63 00 00 00 movabs $0x631a,%rax
1252: 00 00 00
1255: ff d0 callq *%rax
printf(1, "exitiput test ok\n");
1257: 48 be c8 6d 00 00 00 movabs $0x6dc8,%rsi
125e: 00 00 00
1261: bf 01 00 00 00 mov $0x1,%edi
1266: b8 00 00 00 00 mov $0x0,%eax
126b: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
1272: 00 00 00
1275: ff d2 callq *%rdx
}
1277: 90 nop
1278: c9 leaveq
1279: c3 retq
000000000000127a <openiputtest>:
// for(i = 0; i < 10000; i++)
// yield();
// }
void
openiputtest(void)
{
127a: f3 0f 1e fa endbr64
127e: 55 push %rbp
127f: 48 89 e5 mov %rsp,%rbp
1282: 48 83 ec 10 sub $0x10,%rsp
int pid;
printf(1, "openiput test\n");
1286: 48 be da 6d 00 00 00 movabs $0x6dda,%rsi
128d: 00 00 00
1290: bf 01 00 00 00 mov $0x1,%edi
1295: b8 00 00 00 00 mov $0x0,%eax
129a: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
12a1: 00 00 00
12a4: ff d2 callq *%rdx
if(mkdir("oidir") < 0){
12a6: 48 bf e9 6d 00 00 00 movabs $0x6de9,%rdi
12ad: 00 00 00
12b0: 48 b8 b6 63 00 00 00 movabs $0x63b6,%rax
12b7: 00 00 00
12ba: ff d0 callq *%rax
12bc: 85 c0 test %eax,%eax
12be: 79 16 jns 12d6 <openiputtest+0x5c>
failexit("mkdir oidir");
12c0: 48 bf ef 6d 00 00 00 movabs $0x6def,%rdi
12c7: 00 00 00
12ca: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
12d1: 00 00 00
12d4: ff d0 callq *%rax
}
pid = fork();
12d6: 48 b8 00 63 00 00 00 movabs $0x6300,%rax
12dd: 00 00 00
12e0: ff d0 callq *%rax
12e2: 89 45 fc mov %eax,-0x4(%rbp)
if(pid < 0){
12e5: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
12e9: 79 16 jns 1301 <openiputtest+0x87>
failexit("fork");
12eb: 48 bf b7 6d 00 00 00 movabs $0x6db7,%rdi
12f2: 00 00 00
12f5: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
12fc: 00 00 00
12ff: ff d0 callq *%rax
}
if(pid == 0){
1301: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
1305: 75 46 jne 134d <openiputtest+0xd3>
int fd = open("oidir", O_RDWR);
1307: be 02 00 00 00 mov $0x2,%esi
130c: 48 bf e9 6d 00 00 00 movabs $0x6de9,%rdi
1313: 00 00 00
1316: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
131d: 00 00 00
1320: ff d0 callq *%rax
1322: 89 45 f8 mov %eax,-0x8(%rbp)
if(fd >= 0){
1325: 83 7d f8 00 cmpl $0x0,-0x8(%rbp)
1329: 78 16 js 1341 <openiputtest+0xc7>
failexit("open directory for write succeeded");
132b: 48 bf 00 6e 00 00 00 movabs $0x6e00,%rdi
1332: 00 00 00
1335: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
133c: 00 00 00
133f: ff d0 callq *%rax
}
exit();
1341: 48 b8 0d 63 00 00 00 movabs $0x630d,%rax
1348: 00 00 00
134b: ff d0 callq *%rax
}
sleep(1);
134d: bf 01 00 00 00 mov $0x1,%edi
1352: 48 b8 f7 63 00 00 00 movabs $0x63f7,%rax
1359: 00 00 00
135c: ff d0 callq *%rax
if(unlink("oidir") != 0){
135e: 48 bf e9 6d 00 00 00 movabs $0x6de9,%rdi
1365: 00 00 00
1368: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
136f: 00 00 00
1372: ff d0 callq *%rax
1374: 85 c0 test %eax,%eax
1376: 74 16 je 138e <openiputtest+0x114>
failexit("unlink");
1378: 48 bf 23 6e 00 00 00 movabs $0x6e23,%rdi
137f: 00 00 00
1382: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
1389: 00 00 00
138c: ff d0 callq *%rax
}
wait();
138e: 48 b8 1a 63 00 00 00 movabs $0x631a,%rax
1395: 00 00 00
1398: ff d0 callq *%rax
printf(1, "openiput test ok\n");
139a: 48 be 2a 6e 00 00 00 movabs $0x6e2a,%rsi
13a1: 00 00 00
13a4: bf 01 00 00 00 mov $0x1,%edi
13a9: b8 00 00 00 00 mov $0x0,%eax
13ae: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
13b5: 00 00 00
13b8: ff d2 callq *%rdx
}
13ba: 90 nop
13bb: c9 leaveq
13bc: c3 retq
00000000000013bd <opentest>:
// simple file system tests
void
opentest(void)
{
13bd: f3 0f 1e fa endbr64
13c1: 55 push %rbp
13c2: 48 89 e5 mov %rsp,%rbp
13c5: 48 83 ec 10 sub $0x10,%rsp
int fd;
printf(1, "open test\n");
13c9: 48 be 3c 6e 00 00 00 movabs $0x6e3c,%rsi
13d0: 00 00 00
13d3: bf 01 00 00 00 mov $0x1,%edi
13d8: b8 00 00 00 00 mov $0x0,%eax
13dd: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
13e4: 00 00 00
13e7: ff d2 callq *%rdx
fd = open("echo", 0);
13e9: be 00 00 00 00 mov $0x0,%esi
13ee: 48 bf 28 6d 00 00 00 movabs $0x6d28,%rdi
13f5: 00 00 00
13f8: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
13ff: 00 00 00
1402: ff d0 callq *%rax
1404: 89 45 fc mov %eax,-0x4(%rbp)
if(fd < 0){
1407: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
140b: 79 16 jns 1423 <opentest+0x66>
failexit("open echo");
140d: 48 bf 47 6e 00 00 00 movabs $0x6e47,%rdi
1414: 00 00 00
1417: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
141e: 00 00 00
1421: ff d0 callq *%rax
}
close(fd);
1423: 8b 45 fc mov -0x4(%rbp),%eax
1426: 89 c7 mov %eax,%edi
1428: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
142f: 00 00 00
1432: ff d0 callq *%rax
fd = open("doesnotexist", 0);
1434: be 00 00 00 00 mov $0x0,%esi
1439: 48 bf 51 6e 00 00 00 movabs $0x6e51,%rdi
1440: 00 00 00
1443: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
144a: 00 00 00
144d: ff d0 callq *%rax
144f: 89 45 fc mov %eax,-0x4(%rbp)
if(fd >= 0){
1452: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
1456: 78 16 js 146e <opentest+0xb1>
failexit("open doesnotexist succeeded!");
1458: 48 bf 5e 6e 00 00 00 movabs $0x6e5e,%rdi
145f: 00 00 00
1462: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
1469: 00 00 00
146c: ff d0 callq *%rax
}
printf(1, "open test ok\n");
146e: 48 be 7b 6e 00 00 00 movabs $0x6e7b,%rsi
1475: 00 00 00
1478: bf 01 00 00 00 mov $0x1,%edi
147d: b8 00 00 00 00 mov $0x0,%eax
1482: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
1489: 00 00 00
148c: ff d2 callq *%rdx
}
148e: 90 nop
148f: c9 leaveq
1490: c3 retq
0000000000001491 <writetest>:
void
writetest(void)
{
1491: f3 0f 1e fa endbr64
1495: 55 push %rbp
1496: 48 89 e5 mov %rsp,%rbp
1499: 48 83 ec 10 sub $0x10,%rsp
int fd;
int i;
printf(1, "small file test\n");
149d: 48 be 89 6e 00 00 00 movabs $0x6e89,%rsi
14a4: 00 00 00
14a7: bf 01 00 00 00 mov $0x1,%edi
14ac: b8 00 00 00 00 mov $0x0,%eax
14b1: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
14b8: 00 00 00
14bb: ff d2 callq *%rdx
fd = open("small", O_CREATE|O_RDWR);
14bd: be 02 02 00 00 mov $0x202,%esi
14c2: 48 bf 9a 6e 00 00 00 movabs $0x6e9a,%rdi
14c9: 00 00 00
14cc: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
14d3: 00 00 00
14d6: ff d0 callq *%rax
14d8: 89 45 f8 mov %eax,-0x8(%rbp)
if(fd < 0){
14db: 83 7d f8 00 cmpl $0x0,-0x8(%rbp)
14df: 79 16 jns 14f7 <writetest+0x66>
failexit("error: creat small");
14e1: 48 bf a0 6e 00 00 00 movabs $0x6ea0,%rdi
14e8: 00 00 00
14eb: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
14f2: 00 00 00
14f5: ff d0 callq *%rax
}
for(i = 0; i < 100; i++){
14f7: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
14fe: e9 b0 00 00 00 jmpq 15b3 <writetest+0x122>
if(write(fd, "aaaaaaaaaa", 10) != 10){
1503: 8b 45 f8 mov -0x8(%rbp),%eax
1506: ba 0a 00 00 00 mov $0xa,%edx
150b: 48 be b3 6e 00 00 00 movabs $0x6eb3,%rsi
1512: 00 00 00
1515: 89 c7 mov %eax,%edi
1517: 48 b8 41 63 00 00 00 movabs $0x6341,%rax
151e: 00 00 00
1521: ff d0 callq *%rax
1523: 83 f8 0a cmp $0xa,%eax
1526: 74 31 je 1559 <writetest+0xc8>
printf(1, "error: write aa %d new file failed\n", i);
1528: 8b 45 fc mov -0x4(%rbp),%eax
152b: 89 c2 mov %eax,%edx
152d: 48 be c0 6e 00 00 00 movabs $0x6ec0,%rsi
1534: 00 00 00
1537: bf 01 00 00 00 mov $0x1,%edi
153c: b8 00 00 00 00 mov $0x0,%eax
1541: 48 b9 11 66 00 00 00 movabs $0x6611,%rcx
1548: 00 00 00
154b: ff d1 callq *%rcx
exit();
154d: 48 b8 0d 63 00 00 00 movabs $0x630d,%rax
1554: 00 00 00
1557: ff d0 callq *%rax
}
if(write(fd, "bbbbbbbbbb", 10) != 10){
1559: 8b 45 f8 mov -0x8(%rbp),%eax
155c: ba 0a 00 00 00 mov $0xa,%edx
1561: 48 be e4 6e 00 00 00 movabs $0x6ee4,%rsi
1568: 00 00 00
156b: 89 c7 mov %eax,%edi
156d: 48 b8 41 63 00 00 00 movabs $0x6341,%rax
1574: 00 00 00
1577: ff d0 callq *%rax
1579: 83 f8 0a cmp $0xa,%eax
157c: 74 31 je 15af <writetest+0x11e>
printf(1, "error: write bb %d new file failed\n", i);
157e: 8b 45 fc mov -0x4(%rbp),%eax
1581: 89 c2 mov %eax,%edx
1583: 48 be f0 6e 00 00 00 movabs $0x6ef0,%rsi
158a: 00 00 00
158d: bf 01 00 00 00 mov $0x1,%edi
1592: b8 00 00 00 00 mov $0x0,%eax
1597: 48 b9 11 66 00 00 00 movabs $0x6611,%rcx
159e: 00 00 00
15a1: ff d1 callq *%rcx
exit();
15a3: 48 b8 0d 63 00 00 00 movabs $0x630d,%rax
15aa: 00 00 00
15ad: ff d0 callq *%rax
for(i = 0; i < 100; i++){
15af: 83 45 fc 01 addl $0x1,-0x4(%rbp)
15b3: 83 7d fc 63 cmpl $0x63,-0x4(%rbp)
15b7: 0f 8e 46 ff ff ff jle 1503 <writetest+0x72>
}
}
close(fd);
15bd: 8b 45 f8 mov -0x8(%rbp),%eax
15c0: 89 c7 mov %eax,%edi
15c2: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
15c9: 00 00 00
15cc: ff d0 callq *%rax
fd = open("small", O_RDONLY);
15ce: be 00 00 00 00 mov $0x0,%esi
15d3: 48 bf 9a 6e 00 00 00 movabs $0x6e9a,%rdi
15da: 00 00 00
15dd: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
15e4: 00 00 00
15e7: ff d0 callq *%rax
15e9: 89 45 f8 mov %eax,-0x8(%rbp)
if(fd < 0){
15ec: 83 7d f8 00 cmpl $0x0,-0x8(%rbp)
15f0: 79 16 jns 1608 <writetest+0x177>
failexit("error: open small");
15f2: 48 bf 14 6f 00 00 00 movabs $0x6f14,%rdi
15f9: 00 00 00
15fc: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
1603: 00 00 00
1606: ff d0 callq *%rax
}
i = read(fd, buf, 2000);
1608: 8b 45 f8 mov -0x8(%rbp),%eax
160b: ba d0 07 00 00 mov $0x7d0,%edx
1610: 48 be 20 8c 00 00 00 movabs $0x8c20,%rsi
1617: 00 00 00
161a: 89 c7 mov %eax,%edi
161c: 48 b8 34 63 00 00 00 movabs $0x6334,%rax
1623: 00 00 00
1626: ff d0 callq *%rax
1628: 89 45 fc mov %eax,-0x4(%rbp)
if(i != 2000){
162b: 81 7d fc d0 07 00 00 cmpl $0x7d0,-0x4(%rbp)
1632: 74 16 je 164a <writetest+0x1b9>
failexit("read");
1634: 48 bf 26 6f 00 00 00 movabs $0x6f26,%rdi
163b: 00 00 00
163e: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
1645: 00 00 00
1648: ff d0 callq *%rax
}
close(fd);
164a: 8b 45 f8 mov -0x8(%rbp),%eax
164d: 89 c7 mov %eax,%edi
164f: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
1656: 00 00 00
1659: ff d0 callq *%rax
if(unlink("small") < 0){
165b: 48 bf 9a 6e 00 00 00 movabs $0x6e9a,%rdi
1662: 00 00 00
1665: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
166c: 00 00 00
166f: ff d0 callq *%rax
1671: 85 c0 test %eax,%eax
1673: 79 22 jns 1697 <writetest+0x206>
failexit("unlink small");
1675: 48 bf 2b 6f 00 00 00 movabs $0x6f2b,%rdi
167c: 00 00 00
167f: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
1686: 00 00 00
1689: ff d0 callq *%rax
exit();
168b: 48 b8 0d 63 00 00 00 movabs $0x630d,%rax
1692: 00 00 00
1695: ff d0 callq *%rax
}
printf(1, "small file test ok\n");
1697: 48 be 38 6f 00 00 00 movabs $0x6f38,%rsi
169e: 00 00 00
16a1: bf 01 00 00 00 mov $0x1,%edi
16a6: b8 00 00 00 00 mov $0x0,%eax
16ab: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
16b2: 00 00 00
16b5: ff d2 callq *%rdx
}
16b7: 90 nop
16b8: c9 leaveq
16b9: c3 retq
00000000000016ba <writetest1>:
void
writetest1(void)
{
16ba: f3 0f 1e fa endbr64
16be: 55 push %rbp
16bf: 48 89 e5 mov %rsp,%rbp
16c2: 48 83 ec 10 sub $0x10,%rsp
int i, fd, n;
printf(1, "big files test\n");
16c6: 48 be 4c 6f 00 00 00 movabs $0x6f4c,%rsi
16cd: 00 00 00
16d0: bf 01 00 00 00 mov $0x1,%edi
16d5: b8 00 00 00 00 mov $0x0,%eax
16da: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
16e1: 00 00 00
16e4: ff d2 callq *%rdx
fd = open("big", O_CREATE|O_RDWR);
16e6: be 02 02 00 00 mov $0x202,%esi
16eb: 48 bf 5c 6f 00 00 00 movabs $0x6f5c,%rdi
16f2: 00 00 00
16f5: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
16fc: 00 00 00
16ff: ff d0 callq *%rax
1701: 89 45 f4 mov %eax,-0xc(%rbp)
if(fd < 0){
1704: 83 7d f4 00 cmpl $0x0,-0xc(%rbp)
1708: 79 16 jns 1720 <writetest1+0x66>
failexit("error: creat big");
170a: 48 bf 60 6f 00 00 00 movabs $0x6f60,%rdi
1711: 00 00 00
1714: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
171b: 00 00 00
171e: ff d0 callq *%rax
}
for(i = 0; i < MAXFILE; i++){
1720: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
1727: eb 50 jmp 1779 <writetest1+0xbf>
((int*)buf)[0] = i;
1729: 48 ba 20 8c 00 00 00 movabs $0x8c20,%rdx
1730: 00 00 00
1733: 8b 45 fc mov -0x4(%rbp),%eax
1736: 89 02 mov %eax,(%rdx)
if(write(fd, buf, 512) != 512){
1738: 8b 45 f4 mov -0xc(%rbp),%eax
173b: ba 00 02 00 00 mov $0x200,%edx
1740: 48 be 20 8c 00 00 00 movabs $0x8c20,%rsi
1747: 00 00 00
174a: 89 c7 mov %eax,%edi
174c: 48 b8 41 63 00 00 00 movabs $0x6341,%rax
1753: 00 00 00
1756: ff d0 callq *%rax
1758: 3d 00 02 00 00 cmp $0x200,%eax
175d: 74 16 je 1775 <writetest1+0xbb>
failexit("error: write big file");
175f: 48 bf 71 6f 00 00 00 movabs $0x6f71,%rdi
1766: 00 00 00
1769: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
1770: 00 00 00
1773: ff d0 callq *%rax
for(i = 0; i < MAXFILE; i++){
1775: 83 45 fc 01 addl $0x1,-0x4(%rbp)
1779: 8b 45 fc mov -0x4(%rbp),%eax
177c: 3d 8b 00 00 00 cmp $0x8b,%eax
1781: 76 a6 jbe 1729 <writetest1+0x6f>
}
}
close(fd);
1783: 8b 45 f4 mov -0xc(%rbp),%eax
1786: 89 c7 mov %eax,%edi
1788: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
178f: 00 00 00
1792: ff d0 callq *%rax
fd = open("big", O_RDONLY);
1794: be 00 00 00 00 mov $0x0,%esi
1799: 48 bf 5c 6f 00 00 00 movabs $0x6f5c,%rdi
17a0: 00 00 00
17a3: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
17aa: 00 00 00
17ad: ff d0 callq *%rax
17af: 89 45 f4 mov %eax,-0xc(%rbp)
if(fd < 0){
17b2: 83 7d f4 00 cmpl $0x0,-0xc(%rbp)
17b6: 79 16 jns 17ce <writetest1+0x114>
failexit("error: open big");
17b8: 48 bf 87 6f 00 00 00 movabs $0x6f87,%rdi
17bf: 00 00 00
17c2: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
17c9: 00 00 00
17cc: ff d0 callq *%rax
}
n = 0;
17ce: c7 45 f8 00 00 00 00 movl $0x0,-0x8(%rbp)
for(;;){
i = read(fd, buf, 512);
17d5: 8b 45 f4 mov -0xc(%rbp),%eax
17d8: ba 00 02 00 00 mov $0x200,%edx
17dd: 48 be 20 8c 00 00 00 movabs $0x8c20,%rsi
17e4: 00 00 00
17e7: 89 c7 mov %eax,%edi
17e9: 48 b8 34 63 00 00 00 movabs $0x6334,%rax
17f0: 00 00 00
17f3: ff d0 callq *%rax
17f5: 89 45 fc mov %eax,-0x4(%rbp)
if(i == 0){
17f8: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
17fc: 75 3e jne 183c <writetest1+0x182>
if(n == MAXFILE - 1){
17fe: 81 7d f8 8b 00 00 00 cmpl $0x8b,-0x8(%rbp)
1805: 0f 85 c5 00 00 00 jne 18d0 <writetest1+0x216>
printf(1, "read only %d blocks from big. failed", n);
180b: 8b 45 f8 mov -0x8(%rbp),%eax
180e: 89 c2 mov %eax,%edx
1810: 48 be 98 6f 00 00 00 movabs $0x6f98,%rsi
1817: 00 00 00
181a: bf 01 00 00 00 mov $0x1,%edi
181f: b8 00 00 00 00 mov $0x0,%eax
1824: 48 b9 11 66 00 00 00 movabs $0x6611,%rcx
182b: 00 00 00
182e: ff d1 callq *%rcx
exit();
1830: 48 b8 0d 63 00 00 00 movabs $0x630d,%rax
1837: 00 00 00
183a: ff d0 callq *%rax
}
break;
} else if(i != 512){
183c: 81 7d fc 00 02 00 00 cmpl $0x200,-0x4(%rbp)
1843: 74 31 je 1876 <writetest1+0x1bc>
printf(1, "read failed %d\n", i);
1845: 8b 45 fc mov -0x4(%rbp),%eax
1848: 89 c2 mov %eax,%edx
184a: 48 be bd 6f 00 00 00 movabs $0x6fbd,%rsi
1851: 00 00 00
1854: bf 01 00 00 00 mov $0x1,%edi
1859: b8 00 00 00 00 mov $0x0,%eax
185e: 48 b9 11 66 00 00 00 movabs $0x6611,%rcx
1865: 00 00 00
1868: ff d1 callq *%rcx
exit();
186a: 48 b8 0d 63 00 00 00 movabs $0x630d,%rax
1871: 00 00 00
1874: ff d0 callq *%rax
}
if(((int*)buf)[0] != n){
1876: 48 b8 20 8c 00 00 00 movabs $0x8c20,%rax
187d: 00 00 00
1880: 8b 00 mov (%rax),%eax
1882: 39 45 f8 cmp %eax,-0x8(%rbp)
1885: 74 40 je 18c7 <writetest1+0x20d>
printf(1, "read content of block %d is %d. failed\n",
n, ((int*)buf)[0]);
1887: 48 b8 20 8c 00 00 00 movabs $0x8c20,%rax
188e: 00 00 00
printf(1, "read content of block %d is %d. failed\n",
1891: 8b 10 mov (%rax),%edx
1893: 8b 45 f8 mov -0x8(%rbp),%eax
1896: 89 d1 mov %edx,%ecx
1898: 89 c2 mov %eax,%edx
189a: 48 be d0 6f 00 00 00 movabs $0x6fd0,%rsi
18a1: 00 00 00
18a4: bf 01 00 00 00 mov $0x1,%edi
18a9: b8 00 00 00 00 mov $0x0,%eax
18ae: 49 b8 11 66 00 00 00 movabs $0x6611,%r8
18b5: 00 00 00
18b8: 41 ff d0 callq *%r8
exit();
18bb: 48 b8 0d 63 00 00 00 movabs $0x630d,%rax
18c2: 00 00 00
18c5: ff d0 callq *%rax
}
n++;
18c7: 83 45 f8 01 addl $0x1,-0x8(%rbp)
i = read(fd, buf, 512);
18cb: e9 05 ff ff ff jmpq 17d5 <writetest1+0x11b>
break;
18d0: 90 nop
}
close(fd);
18d1: 8b 45 f4 mov -0xc(%rbp),%eax
18d4: 89 c7 mov %eax,%edi
18d6: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
18dd: 00 00 00
18e0: ff d0 callq *%rax
if(unlink("big") < 0){
18e2: 48 bf 5c 6f 00 00 00 movabs $0x6f5c,%rdi
18e9: 00 00 00
18ec: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
18f3: 00 00 00
18f6: ff d0 callq *%rax
18f8: 85 c0 test %eax,%eax
18fa: 79 22 jns 191e <writetest1+0x264>
failexit("unlink big");
18fc: 48 bf f8 6f 00 00 00 movabs $0x6ff8,%rdi
1903: 00 00 00
1906: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
190d: 00 00 00
1910: ff d0 callq *%rax
exit();
1912: 48 b8 0d 63 00 00 00 movabs $0x630d,%rax
1919: 00 00 00
191c: ff d0 callq *%rax
}
printf(1, "big files ok\n");
191e: 48 be 03 70 00 00 00 movabs $0x7003,%rsi
1925: 00 00 00
1928: bf 01 00 00 00 mov $0x1,%edi
192d: b8 00 00 00 00 mov $0x0,%eax
1932: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
1939: 00 00 00
193c: ff d2 callq *%rdx
}
193e: 90 nop
193f: c9 leaveq
1940: c3 retq
0000000000001941 <createtest>:
void
createtest(void)
{
1941: f3 0f 1e fa endbr64
1945: 55 push %rbp
1946: 48 89 e5 mov %rsp,%rbp
1949: 48 83 ec 10 sub $0x10,%rsp
int i, fd;
printf(1, "many creates, followed by unlink test\n");
194d: 48 be 18 70 00 00 00 movabs $0x7018,%rsi
1954: 00 00 00
1957: bf 01 00 00 00 mov $0x1,%edi
195c: b8 00 00 00 00 mov $0x0,%eax
1961: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
1968: 00 00 00
196b: ff d2 callq *%rdx
name[0] = 'a';
196d: 48 b8 20 ac 00 00 00 movabs $0xac20,%rax
1974: 00 00 00
1977: c6 00 61 movb $0x61,(%rax)
name[2] = '\0';
197a: 48 b8 20 ac 00 00 00 movabs $0xac20,%rax
1981: 00 00 00
1984: c6 40 02 00 movb $0x0,0x2(%rax)
for(i = 0; i < 52; i++){
1988: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
198f: eb 48 jmp 19d9 <createtest+0x98>
name[1] = '0' + i;
1991: 8b 45 fc mov -0x4(%rbp),%eax
1994: 83 c0 30 add $0x30,%eax
1997: 89 c2 mov %eax,%edx
1999: 48 b8 20 ac 00 00 00 movabs $0xac20,%rax
19a0: 00 00 00
19a3: 88 50 01 mov %dl,0x1(%rax)
fd = open(name, O_CREATE|O_RDWR);
19a6: be 02 02 00 00 mov $0x202,%esi
19ab: 48 bf 20 ac 00 00 00 movabs $0xac20,%rdi
19b2: 00 00 00
19b5: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
19bc: 00 00 00
19bf: ff d0 callq *%rax
19c1: 89 45 f8 mov %eax,-0x8(%rbp)
close(fd);
19c4: 8b 45 f8 mov -0x8(%rbp),%eax
19c7: 89 c7 mov %eax,%edi
19c9: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
19d0: 00 00 00
19d3: ff d0 callq *%rax
for(i = 0; i < 52; i++){
19d5: 83 45 fc 01 addl $0x1,-0x4(%rbp)
19d9: 83 7d fc 33 cmpl $0x33,-0x4(%rbp)
19dd: 7e b2 jle 1991 <createtest+0x50>
}
for(i = 0; i < 52; i++){
19df: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
19e6: eb 2f jmp 1a17 <createtest+0xd6>
name[1] = '0' + i;
19e8: 8b 45 fc mov -0x4(%rbp),%eax
19eb: 83 c0 30 add $0x30,%eax
19ee: 89 c2 mov %eax,%edx
19f0: 48 b8 20 ac 00 00 00 movabs $0xac20,%rax
19f7: 00 00 00
19fa: 88 50 01 mov %dl,0x1(%rax)
unlink(name);
19fd: 48 bf 20 ac 00 00 00 movabs $0xac20,%rdi
1a04: 00 00 00
1a07: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
1a0e: 00 00 00
1a11: ff d0 callq *%rax
for(i = 0; i < 52; i++){
1a13: 83 45 fc 01 addl $0x1,-0x4(%rbp)
1a17: 83 7d fc 33 cmpl $0x33,-0x4(%rbp)
1a1b: 7e cb jle 19e8 <createtest+0xa7>
}
for(i = 0; i < 52; i++){
1a1d: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
1a24: eb 53 jmp 1a79 <createtest+0x138>
name[1] = '0' + i;
1a26: 8b 45 fc mov -0x4(%rbp),%eax
1a29: 83 c0 30 add $0x30,%eax
1a2c: 89 c2 mov %eax,%edx
1a2e: 48 b8 20 ac 00 00 00 movabs $0xac20,%rax
1a35: 00 00 00
1a38: 88 50 01 mov %dl,0x1(%rax)
fd = open(name, O_RDWR);
1a3b: be 02 00 00 00 mov $0x2,%esi
1a40: 48 bf 20 ac 00 00 00 movabs $0xac20,%rdi
1a47: 00 00 00
1a4a: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
1a51: 00 00 00
1a54: ff d0 callq *%rax
1a56: 89 45 f8 mov %eax,-0x8(%rbp)
if(fd >= 0) {
1a59: 83 7d f8 00 cmpl $0x0,-0x8(%rbp)
1a5d: 78 16 js 1a75 <createtest+0x134>
failexit("open should fail.");
1a5f: 48 bf 3f 70 00 00 00 movabs $0x703f,%rdi
1a66: 00 00 00
1a69: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
1a70: 00 00 00
1a73: ff d0 callq *%rax
for(i = 0; i < 52; i++){
1a75: 83 45 fc 01 addl $0x1,-0x4(%rbp)
1a79: 83 7d fc 33 cmpl $0x33,-0x4(%rbp)
1a7d: 7e a7 jle 1a26 <createtest+0xe5>
}
}
printf(1, "many creates, followed by unlink; ok\n");
1a7f: 48 be 58 70 00 00 00 movabs $0x7058,%rsi
1a86: 00 00 00
1a89: bf 01 00 00 00 mov $0x1,%edi
1a8e: b8 00 00 00 00 mov $0x0,%eax
1a93: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
1a9a: 00 00 00
1a9d: ff d2 callq *%rdx
}
1a9f: 90 nop
1aa0: c9 leaveq
1aa1: c3 retq
0000000000001aa2 <dirtest>:
void dirtest(void)
{
1aa2: f3 0f 1e fa endbr64
1aa6: 55 push %rbp
1aa7: 48 89 e5 mov %rsp,%rbp
printf(1, "mkdir test\n");
1aaa: 48 be 7e 70 00 00 00 movabs $0x707e,%rsi
1ab1: 00 00 00
1ab4: bf 01 00 00 00 mov $0x1,%edi
1ab9: b8 00 00 00 00 mov $0x0,%eax
1abe: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
1ac5: 00 00 00
1ac8: ff d2 callq *%rdx
if(mkdir("dir0") < 0){
1aca: 48 bf 8a 70 00 00 00 movabs $0x708a,%rdi
1ad1: 00 00 00
1ad4: 48 b8 b6 63 00 00 00 movabs $0x63b6,%rax
1adb: 00 00 00
1ade: ff d0 callq *%rax
1ae0: 85 c0 test %eax,%eax
1ae2: 79 16 jns 1afa <dirtest+0x58>
failexit("mkdir");
1ae4: 48 bf 5f 6d 00 00 00 movabs $0x6d5f,%rdi
1aeb: 00 00 00
1aee: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
1af5: 00 00 00
1af8: ff d0 callq *%rax
}
if(chdir("dir0") < 0){
1afa: 48 bf 8a 70 00 00 00 movabs $0x708a,%rdi
1b01: 00 00 00
1b04: 48 b8 c3 63 00 00 00 movabs $0x63c3,%rax
1b0b: 00 00 00
1b0e: ff d0 callq *%rax
1b10: 85 c0 test %eax,%eax
1b12: 79 16 jns 1b2a <dirtest+0x88>
failexit("chdir dir0");
1b14: 48 bf 8f 70 00 00 00 movabs $0x708f,%rdi
1b1b: 00 00 00
1b1e: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
1b25: 00 00 00
1b28: ff d0 callq *%rax
}
if(chdir("..") < 0){
1b2a: 48 bf 9a 70 00 00 00 movabs $0x709a,%rdi
1b31: 00 00 00
1b34: 48 b8 c3 63 00 00 00 movabs $0x63c3,%rax
1b3b: 00 00 00
1b3e: ff d0 callq *%rax
1b40: 85 c0 test %eax,%eax
1b42: 79 16 jns 1b5a <dirtest+0xb8>
failexit("chdir ..");
1b44: 48 bf 9d 70 00 00 00 movabs $0x709d,%rdi
1b4b: 00 00 00
1b4e: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
1b55: 00 00 00
1b58: ff d0 callq *%rax
}
if(unlink("dir0") < 0){
1b5a: 48 bf 8a 70 00 00 00 movabs $0x708a,%rdi
1b61: 00 00 00
1b64: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
1b6b: 00 00 00
1b6e: ff d0 callq *%rax
1b70: 85 c0 test %eax,%eax
1b72: 79 16 jns 1b8a <dirtest+0xe8>
failexit("unlink dir0");
1b74: 48 bf a6 70 00 00 00 movabs $0x70a6,%rdi
1b7b: 00 00 00
1b7e: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
1b85: 00 00 00
1b88: ff d0 callq *%rax
}
printf(1, "mkdir test ok\n");
1b8a: 48 be b2 70 00 00 00 movabs $0x70b2,%rsi
1b91: 00 00 00
1b94: bf 01 00 00 00 mov $0x1,%edi
1b99: b8 00 00 00 00 mov $0x0,%eax
1b9e: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
1ba5: 00 00 00
1ba8: ff d2 callq *%rdx
}
1baa: 90 nop
1bab: 5d pop %rbp
1bac: c3 retq
0000000000001bad <exectest>:
void
exectest(void)
{
1bad: f3 0f 1e fa endbr64
1bb1: 55 push %rbp
1bb2: 48 89 e5 mov %rsp,%rbp
printf(1, "exec test\n");
1bb5: 48 be c1 70 00 00 00 movabs $0x70c1,%rsi
1bbc: 00 00 00
1bbf: bf 01 00 00 00 mov $0x1,%edi
1bc4: b8 00 00 00 00 mov $0x0,%eax
1bc9: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
1bd0: 00 00 00
1bd3: ff d2 callq *%rdx
if(exec("echo", echoargv) < 0){
1bd5: 48 be c0 8b 00 00 00 movabs $0x8bc0,%rsi
1bdc: 00 00 00
1bdf: 48 bf 28 6d 00 00 00 movabs $0x6d28,%rdi
1be6: 00 00 00
1be9: 48 b8 68 63 00 00 00 movabs $0x6368,%rax
1bf0: 00 00 00
1bf3: ff d0 callq *%rax
1bf5: 85 c0 test %eax,%eax
1bf7: 79 16 jns 1c0f <exectest+0x62>
failexit("exec echo");
1bf9: 48 bf cc 70 00 00 00 movabs $0x70cc,%rdi
1c00: 00 00 00
1c03: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
1c0a: 00 00 00
1c0d: ff d0 callq *%rax
}
printf(1, "exec test ok\n");
1c0f: 48 be d6 70 00 00 00 movabs $0x70d6,%rsi
1c16: 00 00 00
1c19: bf 01 00 00 00 mov $0x1,%edi
1c1e: b8 00 00 00 00 mov $0x0,%eax
1c23: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
1c2a: 00 00 00
1c2d: ff d2 callq *%rdx
}
1c2f: 90 nop
1c30: 5d pop %rbp
1c31: c3 retq
0000000000001c32 <nullptr>:
void
nullptr(void)
{
1c32: f3 0f 1e fa endbr64
1c36: 55 push %rbp
1c37: 48 89 e5 mov %rsp,%rbp
1c3a: 48 83 ec 10 sub $0x10,%rsp
printf(1, "null pointer test\n");
1c3e: 48 be e4 70 00 00 00 movabs $0x70e4,%rsi
1c45: 00 00 00
1c48: bf 01 00 00 00 mov $0x1,%edi
1c4d: b8 00 00 00 00 mov $0x0,%eax
1c52: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
1c59: 00 00 00
1c5c: ff d2 callq *%rdx
printf(1, "expect one killed process\n");
1c5e: 48 be f7 70 00 00 00 movabs $0x70f7,%rsi
1c65: 00 00 00
1c68: bf 01 00 00 00 mov $0x1,%edi
1c6d: b8 00 00 00 00 mov $0x0,%eax
1c72: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
1c79: 00 00 00
1c7c: ff d2 callq *%rdx
int ppid = getpid();
1c7e: 48 b8 dd 63 00 00 00 movabs $0x63dd,%rax
1c85: 00 00 00
1c88: ff d0 callq *%rax
1c8a: 89 45 fc mov %eax,-0x4(%rbp)
if (fork() == 0) {
1c8d: 48 b8 00 63 00 00 00 movabs $0x6300,%rax
1c94: 00 00 00
1c97: ff d0 callq *%rax
1c99: 85 c0 test %eax,%eax
1c9b: 75 49 jne 1ce6 <nullptr+0xb4>
*(addr_t *)(0) = 10;
1c9d: b8 00 00 00 00 mov $0x0,%eax
1ca2: 48 c7 00 0a 00 00 00 movq $0xa,(%rax)
printf(1, "can write to unmapped page 0, failed");
1ca9: 48 be 18 71 00 00 00 movabs $0x7118,%rsi
1cb0: 00 00 00
1cb3: bf 01 00 00 00 mov $0x1,%edi
1cb8: b8 00 00 00 00 mov $0x0,%eax
1cbd: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
1cc4: 00 00 00
1cc7: ff d2 callq *%rdx
kill(ppid);
1cc9: 8b 45 fc mov -0x4(%rbp),%eax
1ccc: 89 c7 mov %eax,%edi
1cce: 48 b8 5b 63 00 00 00 movabs $0x635b,%rax
1cd5: 00 00 00
1cd8: ff d0 callq *%rax
exit();
1cda: 48 b8 0d 63 00 00 00 movabs $0x630d,%rax
1ce1: 00 00 00
1ce4: ff d0 callq *%rax
} else {
wait();
1ce6: 48 b8 1a 63 00 00 00 movabs $0x631a,%rax
1ced: 00 00 00
1cf0: ff d0 callq *%rax
}
printf(1, "null pointer test ok\n");
1cf2: 48 be 3d 71 00 00 00 movabs $0x713d,%rsi
1cf9: 00 00 00
1cfc: bf 01 00 00 00 mov $0x1,%edi
1d01: b8 00 00 00 00 mov $0x0,%eax
1d06: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
1d0d: 00 00 00
1d10: ff d2 callq *%rdx
}
1d12: 90 nop
1d13: c9 leaveq
1d14: c3 retq
0000000000001d15 <pipe1>:
// simple fork and pipe read/write
void
pipe1(void)
{
1d15: f3 0f 1e fa endbr64
1d19: 55 push %rbp
1d1a: 48 89 e5 mov %rsp,%rbp
1d1d: 48 83 ec 20 sub $0x20,%rsp
int fds[2], pid;
int seq, i, n, cc, total;
if(pipe(fds) != 0){
1d21: 48 8d 45 e0 lea -0x20(%rbp),%rax
1d25: 48 89 c7 mov %rax,%rdi
1d28: 48 b8 27 63 00 00 00 movabs $0x6327,%rax
1d2f: 00 00 00
1d32: ff d0 callq *%rax
1d34: 85 c0 test %eax,%eax
1d36: 74 16 je 1d4e <pipe1+0x39>
failexit("pipe()");
1d38: 48 bf 53 71 00 00 00 movabs $0x7153,%rdi
1d3f: 00 00 00
1d42: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
1d49: 00 00 00
1d4c: ff d0 callq *%rax
}
pid = fork();
1d4e: 48 b8 00 63 00 00 00 movabs $0x6300,%rax
1d55: 00 00 00
1d58: ff d0 callq *%rax
1d5a: 89 45 e8 mov %eax,-0x18(%rbp)
seq = 0;
1d5d: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
if(pid == 0){
1d64: 83 7d e8 00 cmpl $0x0,-0x18(%rbp)
1d68: 0f 85 a0 00 00 00 jne 1e0e <pipe1+0xf9>
close(fds[0]);
1d6e: 8b 45 e0 mov -0x20(%rbp),%eax
1d71: 89 c7 mov %eax,%edi
1d73: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
1d7a: 00 00 00
1d7d: ff d0 callq *%rax
for(n = 0; n < 5; n++){
1d7f: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%rbp)
1d86: eb 74 jmp 1dfc <pipe1+0xe7>
for(i = 0; i < 1033; i++)
1d88: c7 45 f8 00 00 00 00 movl $0x0,-0x8(%rbp)
1d8f: eb 21 jmp 1db2 <pipe1+0x9d>
buf[i] = seq++;
1d91: 8b 45 fc mov -0x4(%rbp),%eax
1d94: 8d 50 01 lea 0x1(%rax),%edx
1d97: 89 55 fc mov %edx,-0x4(%rbp)
1d9a: 89 c1 mov %eax,%ecx
1d9c: 48 ba 20 8c 00 00 00 movabs $0x8c20,%rdx
1da3: 00 00 00
1da6: 8b 45 f8 mov -0x8(%rbp),%eax
1da9: 48 98 cltq
1dab: 88 0c 02 mov %cl,(%rdx,%rax,1)
for(i = 0; i < 1033; i++)
1dae: 83 45 f8 01 addl $0x1,-0x8(%rbp)
1db2: 81 7d f8 08 04 00 00 cmpl $0x408,-0x8(%rbp)
1db9: 7e d6 jle 1d91 <pipe1+0x7c>
if(write(fds[1], buf, 1033) != 1033){
1dbb: 8b 45 e4 mov -0x1c(%rbp),%eax
1dbe: ba 09 04 00 00 mov $0x409,%edx
1dc3: 48 be 20 8c 00 00 00 movabs $0x8c20,%rsi
1dca: 00 00 00
1dcd: 89 c7 mov %eax,%edi
1dcf: 48 b8 41 63 00 00 00 movabs $0x6341,%rax
1dd6: 00 00 00
1dd9: ff d0 callq *%rax
1ddb: 3d 09 04 00 00 cmp $0x409,%eax
1de0: 74 16 je 1df8 <pipe1+0xe3>
failexit("pipe1 oops 1");
1de2: 48 bf 5a 71 00 00 00 movabs $0x715a,%rdi
1de9: 00 00 00
1dec: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
1df3: 00 00 00
1df6: ff d0 callq *%rax
for(n = 0; n < 5; n++){
1df8: 83 45 f4 01 addl $0x1,-0xc(%rbp)
1dfc: 83 7d f4 04 cmpl $0x4,-0xc(%rbp)
1e00: 7e 86 jle 1d88 <pipe1+0x73>
}
}
exit();
1e02: 48 b8 0d 63 00 00 00 movabs $0x630d,%rax
1e09: 00 00 00
1e0c: ff d0 callq *%rax
} else if(pid > 0){
1e0e: 83 7d e8 00 cmpl $0x0,-0x18(%rbp)
1e12: 0f 8e 17 01 00 00 jle 1f2f <pipe1+0x21a>
close(fds[1]);
1e18: 8b 45 e4 mov -0x1c(%rbp),%eax
1e1b: 89 c7 mov %eax,%edi
1e1d: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
1e24: 00 00 00
1e27: ff d0 callq *%rax
total = 0;
1e29: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%rbp)
cc = 1;
1e30: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%rbp)
while((n = read(fds[0], buf, cc)) > 0){
1e37: eb 72 jmp 1eab <pipe1+0x196>
for(i = 0; i < n; i++){
1e39: c7 45 f8 00 00 00 00 movl $0x0,-0x8(%rbp)
1e40: eb 47 jmp 1e89 <pipe1+0x174>
if((buf[i] & 0xff) != (seq++ & 0xff)){
1e42: 48 ba 20 8c 00 00 00 movabs $0x8c20,%rdx
1e49: 00 00 00
1e4c: 8b 45 f8 mov -0x8(%rbp),%eax
1e4f: 48 98 cltq
1e51: 0f b6 04 02 movzbl (%rdx,%rax,1),%eax
1e55: 0f be c8 movsbl %al,%ecx
1e58: 8b 45 fc mov -0x4(%rbp),%eax
1e5b: 8d 50 01 lea 0x1(%rax),%edx
1e5e: 89 55 fc mov %edx,-0x4(%rbp)
1e61: 31 c8 xor %ecx,%eax
1e63: 0f b6 c0 movzbl %al,%eax
1e66: 85 c0 test %eax,%eax
1e68: 74 1b je 1e85 <pipe1+0x170>
failexit("pipe1 oops 2");
1e6a: 48 bf 67 71 00 00 00 movabs $0x7167,%rdi
1e71: 00 00 00
1e74: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
1e7b: 00 00 00
1e7e: ff d0 callq *%rax
1e80: e9 e0 00 00 00 jmpq 1f65 <pipe1+0x250>
for(i = 0; i < n; i++){
1e85: 83 45 f8 01 addl $0x1,-0x8(%rbp)
1e89: 8b 45 f8 mov -0x8(%rbp),%eax
1e8c: 3b 45 f4 cmp -0xc(%rbp),%eax
1e8f: 7c b1 jl 1e42 <pipe1+0x12d>
return;
}
}
total += n;
1e91: 8b 45 f4 mov -0xc(%rbp),%eax
1e94: 01 45 ec add %eax,-0x14(%rbp)
cc = cc * 2;
1e97: d1 65 f0 shll -0x10(%rbp)
if(cc > sizeof(buf))
1e9a: 8b 45 f0 mov -0x10(%rbp),%eax
1e9d: 3d 00 20 00 00 cmp $0x2000,%eax
1ea2: 76 07 jbe 1eab <pipe1+0x196>
cc = sizeof(buf);
1ea4: c7 45 f0 00 20 00 00 movl $0x2000,-0x10(%rbp)
while((n = read(fds[0], buf, cc)) > 0){
1eab: 8b 45 e0 mov -0x20(%rbp),%eax
1eae: 8b 55 f0 mov -0x10(%rbp),%edx
1eb1: 48 be 20 8c 00 00 00 movabs $0x8c20,%rsi
1eb8: 00 00 00
1ebb: 89 c7 mov %eax,%edi
1ebd: 48 b8 34 63 00 00 00 movabs $0x6334,%rax
1ec4: 00 00 00
1ec7: ff d0 callq *%rax
1ec9: 89 45 f4 mov %eax,-0xc(%rbp)
1ecc: 83 7d f4 00 cmpl $0x0,-0xc(%rbp)
1ed0: 0f 8f 63 ff ff ff jg 1e39 <pipe1+0x124>
}
if(total != 5 * 1033){
1ed6: 81 7d ec 2d 14 00 00 cmpl $0x142d,-0x14(%rbp)
1edd: 74 31 je 1f10 <pipe1+0x1fb>
printf(1, "pipe1 oops 3 total %d\n", total);
1edf: 8b 45 ec mov -0x14(%rbp),%eax
1ee2: 89 c2 mov %eax,%edx
1ee4: 48 be 74 71 00 00 00 movabs $0x7174,%rsi
1eeb: 00 00 00
1eee: bf 01 00 00 00 mov $0x1,%edi
1ef3: b8 00 00 00 00 mov $0x0,%eax
1ef8: 48 b9 11 66 00 00 00 movabs $0x6611,%rcx
1eff: 00 00 00
1f02: ff d1 callq *%rcx
exit();
1f04: 48 b8 0d 63 00 00 00 movabs $0x630d,%rax
1f0b: 00 00 00
1f0e: ff d0 callq *%rax
}
close(fds[0]);
1f10: 8b 45 e0 mov -0x20(%rbp),%eax
1f13: 89 c7 mov %eax,%edi
1f15: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
1f1c: 00 00 00
1f1f: ff d0 callq *%rax
wait();
1f21: 48 b8 1a 63 00 00 00 movabs $0x631a,%rax
1f28: 00 00 00
1f2b: ff d0 callq *%rax
1f2d: eb 16 jmp 1f45 <pipe1+0x230>
} else {
failexit("fork()");
1f2f: 48 bf 8b 71 00 00 00 movabs $0x718b,%rdi
1f36: 00 00 00
1f39: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
1f40: 00 00 00
1f43: ff d0 callq *%rax
}
printf(1, "pipe1 ok\n");
1f45: 48 be 92 71 00 00 00 movabs $0x7192,%rsi
1f4c: 00 00 00
1f4f: bf 01 00 00 00 mov $0x1,%edi
1f54: b8 00 00 00 00 mov $0x0,%eax
1f59: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
1f60: 00 00 00
1f63: ff d2 callq *%rdx
}
1f65: c9 leaveq
1f66: c3 retq
0000000000001f67 <preempt>:
// meant to be run w/ at most two CPUs
void
preempt(void)
{
1f67: f3 0f 1e fa endbr64
1f6b: 55 push %rbp
1f6c: 48 89 e5 mov %rsp,%rbp
1f6f: 48 83 ec 20 sub $0x20,%rsp
int pid1, pid2, pid3;
int pfds[2];
printf(1, "preempt: ");
1f73: 48 be 9c 71 00 00 00 movabs $0x719c,%rsi
1f7a: 00 00 00
1f7d: bf 01 00 00 00 mov $0x1,%edi
1f82: b8 00 00 00 00 mov $0x0,%eax
1f87: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
1f8e: 00 00 00
1f91: ff d2 callq *%rdx
pid1 = fork();
1f93: 48 b8 00 63 00 00 00 movabs $0x6300,%rax
1f9a: 00 00 00
1f9d: ff d0 callq *%rax
1f9f: 89 45 fc mov %eax,-0x4(%rbp)
if(pid1 == 0)
1fa2: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
1fa6: 75 02 jne 1faa <preempt+0x43>
for(;;)
1fa8: eb fe jmp 1fa8 <preempt+0x41>
;
pid2 = fork();
1faa: 48 b8 00 63 00 00 00 movabs $0x6300,%rax
1fb1: 00 00 00
1fb4: ff d0 callq *%rax
1fb6: 89 45 f8 mov %eax,-0x8(%rbp)
if(pid2 == 0)
1fb9: 83 7d f8 00 cmpl $0x0,-0x8(%rbp)
1fbd: 75 02 jne 1fc1 <preempt+0x5a>
for(;;)
1fbf: eb fe jmp 1fbf <preempt+0x58>
;
pipe(pfds);
1fc1: 48 8d 45 ec lea -0x14(%rbp),%rax
1fc5: 48 89 c7 mov %rax,%rdi
1fc8: 48 b8 27 63 00 00 00 movabs $0x6327,%rax
1fcf: 00 00 00
1fd2: ff d0 callq *%rax
pid3 = fork();
1fd4: 48 b8 00 63 00 00 00 movabs $0x6300,%rax
1fdb: 00 00 00
1fde: ff d0 callq *%rax
1fe0: 89 45 f4 mov %eax,-0xc(%rbp)
if(pid3 == 0){
1fe3: 83 7d f4 00 cmpl $0x0,-0xc(%rbp)
1fe7: 75 69 jne 2052 <preempt+0xeb>
close(pfds[0]);
1fe9: 8b 45 ec mov -0x14(%rbp),%eax
1fec: 89 c7 mov %eax,%edi
1fee: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
1ff5: 00 00 00
1ff8: ff d0 callq *%rax
if(write(pfds[1], "x", 1) != 1)
1ffa: 8b 45 f0 mov -0x10(%rbp),%eax
1ffd: ba 01 00 00 00 mov $0x1,%edx
2002: 48 be a6 71 00 00 00 movabs $0x71a6,%rsi
2009: 00 00 00
200c: 89 c7 mov %eax,%edi
200e: 48 b8 41 63 00 00 00 movabs $0x6341,%rax
2015: 00 00 00
2018: ff d0 callq *%rax
201a: 83 f8 01 cmp $0x1,%eax
201d: 74 20 je 203f <preempt+0xd8>
printf(1, "preempt write error");
201f: 48 be a8 71 00 00 00 movabs $0x71a8,%rsi
2026: 00 00 00
2029: bf 01 00 00 00 mov $0x1,%edi
202e: b8 00 00 00 00 mov $0x0,%eax
2033: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
203a: 00 00 00
203d: ff d2 callq *%rdx
close(pfds[1]);
203f: 8b 45 f0 mov -0x10(%rbp),%eax
2042: 89 c7 mov %eax,%edi
2044: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
204b: 00 00 00
204e: ff d0 callq *%rax
for(;;)
2050: eb fe jmp 2050 <preempt+0xe9>
;
}
close(pfds[1]);
2052: 8b 45 f0 mov -0x10(%rbp),%eax
2055: 89 c7 mov %eax,%edi
2057: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
205e: 00 00 00
2061: ff d0 callq *%rax
if(read(pfds[0], buf, sizeof(buf)) != 1){
2063: 8b 45 ec mov -0x14(%rbp),%eax
2066: ba 00 20 00 00 mov $0x2000,%edx
206b: 48 be 20 8c 00 00 00 movabs $0x8c20,%rsi
2072: 00 00 00
2075: 89 c7 mov %eax,%edi
2077: 48 b8 34 63 00 00 00 movabs $0x6334,%rax
207e: 00 00 00
2081: ff d0 callq *%rax
2083: 83 f8 01 cmp $0x1,%eax
2086: 74 25 je 20ad <preempt+0x146>
printf(1, "preempt read error");
2088: 48 be bc 71 00 00 00 movabs $0x71bc,%rsi
208f: 00 00 00
2092: bf 01 00 00 00 mov $0x1,%edi
2097: b8 00 00 00 00 mov $0x0,%eax
209c: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
20a3: 00 00 00
20a6: ff d2 callq *%rdx
20a8: e9 c8 00 00 00 jmpq 2175 <preempt+0x20e>
return;
}
close(pfds[0]);
20ad: 8b 45 ec mov -0x14(%rbp),%eax
20b0: 89 c7 mov %eax,%edi
20b2: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
20b9: 00 00 00
20bc: ff d0 callq *%rax
printf(1, "kill... ");
20be: 48 be cf 71 00 00 00 movabs $0x71cf,%rsi
20c5: 00 00 00
20c8: bf 01 00 00 00 mov $0x1,%edi
20cd: b8 00 00 00 00 mov $0x0,%eax
20d2: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
20d9: 00 00 00
20dc: ff d2 callq *%rdx
kill(pid1);
20de: 8b 45 fc mov -0x4(%rbp),%eax
20e1: 89 c7 mov %eax,%edi
20e3: 48 b8 5b 63 00 00 00 movabs $0x635b,%rax
20ea: 00 00 00
20ed: ff d0 callq *%rax
kill(pid2);
20ef: 8b 45 f8 mov -0x8(%rbp),%eax
20f2: 89 c7 mov %eax,%edi
20f4: 48 b8 5b 63 00 00 00 movabs $0x635b,%rax
20fb: 00 00 00
20fe: ff d0 callq *%rax
kill(pid3);
2100: 8b 45 f4 mov -0xc(%rbp),%eax
2103: 89 c7 mov %eax,%edi
2105: 48 b8 5b 63 00 00 00 movabs $0x635b,%rax
210c: 00 00 00
210f: ff d0 callq *%rax
printf(1, "wait... ");
2111: 48 be d8 71 00 00 00 movabs $0x71d8,%rsi
2118: 00 00 00
211b: bf 01 00 00 00 mov $0x1,%edi
2120: b8 00 00 00 00 mov $0x0,%eax
2125: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
212c: 00 00 00
212f: ff d2 callq *%rdx
wait();
2131: 48 b8 1a 63 00 00 00 movabs $0x631a,%rax
2138: 00 00 00
213b: ff d0 callq *%rax
wait();
213d: 48 b8 1a 63 00 00 00 movabs $0x631a,%rax
2144: 00 00 00
2147: ff d0 callq *%rax
wait();
2149: 48 b8 1a 63 00 00 00 movabs $0x631a,%rax
2150: 00 00 00
2153: ff d0 callq *%rax
printf(1, "preempt ok\n");
2155: 48 be e1 71 00 00 00 movabs $0x71e1,%rsi
215c: 00 00 00
215f: bf 01 00 00 00 mov $0x1,%edi
2164: b8 00 00 00 00 mov $0x0,%eax
2169: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
2170: 00 00 00
2173: ff d2 callq *%rdx
}
2175: c9 leaveq
2176: c3 retq
0000000000002177 <exitwait>:
// try to find any races between exit and wait
void
exitwait(void)
{
2177: f3 0f 1e fa endbr64
217b: 55 push %rbp
217c: 48 89 e5 mov %rsp,%rbp
217f: 48 83 ec 10 sub $0x10,%rsp
int i, pid;
for(i = 0; i < 100; i++){
2183: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
218a: e9 80 00 00 00 jmpq 220f <exitwait+0x98>
pid = fork();
218f: 48 b8 00 63 00 00 00 movabs $0x6300,%rax
2196: 00 00 00
2199: ff d0 callq *%rax
219b: 89 45 f8 mov %eax,-0x8(%rbp)
if(pid < 0){
219e: 83 7d f8 00 cmpl $0x0,-0x8(%rbp)
21a2: 79 22 jns 21c6 <exitwait+0x4f>
printf(1, "fork");
21a4: 48 be b7 6d 00 00 00 movabs $0x6db7,%rsi
21ab: 00 00 00
21ae: bf 01 00 00 00 mov $0x1,%edi
21b3: b8 00 00 00 00 mov $0x0,%eax
21b8: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
21bf: 00 00 00
21c2: ff d2 callq *%rdx
return;
21c4: eb 73 jmp 2239 <exitwait+0xc2>
}
if(pid){
21c6: 83 7d f8 00 cmpl $0x0,-0x8(%rbp)
21ca: 74 33 je 21ff <exitwait+0x88>
if(wait() != pid){
21cc: 48 b8 1a 63 00 00 00 movabs $0x631a,%rax
21d3: 00 00 00
21d6: ff d0 callq *%rax
21d8: 39 45 f8 cmp %eax,-0x8(%rbp)
21db: 74 2e je 220b <exitwait+0x94>
printf(1, "wait wrong pid\n");
21dd: 48 be ed 71 00 00 00 movabs $0x71ed,%rsi
21e4: 00 00 00
21e7: bf 01 00 00 00 mov $0x1,%edi
21ec: b8 00 00 00 00 mov $0x0,%eax
21f1: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
21f8: 00 00 00
21fb: ff d2 callq *%rdx
return;
21fd: eb 3a jmp 2239 <exitwait+0xc2>
}
} else {
exit();
21ff: 48 b8 0d 63 00 00 00 movabs $0x630d,%rax
2206: 00 00 00
2209: ff d0 callq *%rax
for(i = 0; i < 100; i++){
220b: 83 45 fc 01 addl $0x1,-0x4(%rbp)
220f: 83 7d fc 63 cmpl $0x63,-0x4(%rbp)
2213: 0f 8e 76 ff ff ff jle 218f <exitwait+0x18>
}
}
printf(1, "exitwait ok\n");
2219: 48 be fd 71 00 00 00 movabs $0x71fd,%rsi
2220: 00 00 00
2223: bf 01 00 00 00 mov $0x1,%edi
2228: b8 00 00 00 00 mov $0x0,%eax
222d: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
2234: 00 00 00
2237: ff d2 callq *%rdx
}
2239: c9 leaveq
223a: c3 retq
000000000000223b <mem>:
void
mem(void)
{
223b: f3 0f 1e fa endbr64
223f: 55 push %rbp
2240: 48 89 e5 mov %rsp,%rbp
2243: 48 83 ec 20 sub $0x20,%rsp
void *m1, *m2;
int pid, ppid;
printf(1, "mem test\n");
2247: 48 be 0a 72 00 00 00 movabs $0x720a,%rsi
224e: 00 00 00
2251: bf 01 00 00 00 mov $0x1,%edi
2256: b8 00 00 00 00 mov $0x0,%eax
225b: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
2262: 00 00 00
2265: ff d2 callq *%rdx
ppid = getpid();
2267: 48 b8 dd 63 00 00 00 movabs $0x63dd,%rax
226e: 00 00 00
2271: ff d0 callq *%rax
2273: 89 45 f4 mov %eax,-0xc(%rbp)
if((pid = fork()) == 0){
2276: 48 b8 00 63 00 00 00 movabs $0x6300,%rax
227d: 00 00 00
2280: ff d0 callq *%rax
2282: 89 45 f0 mov %eax,-0x10(%rbp)
2285: 83 7d f0 00 cmpl $0x0,-0x10(%rbp)
2289: 0f 85 20 01 00 00 jne 23af <mem+0x174>
m1 = 0;
228f: 48 c7 45 f8 00 00 00 movq $0x0,-0x8(%rbp)
2296: 00
while((m2 = malloc(100001)) != 0){
2297: eb 13 jmp 22ac <mem+0x71>
//printf(1, "m2 %p\n", m2);
*(void**)m2 = m1;
2299: 48 8b 45 e8 mov -0x18(%rbp),%rax
229d: 48 8b 55 f8 mov -0x8(%rbp),%rdx
22a1: 48 89 10 mov %rdx,(%rax)
m1 = m2;
22a4: 48 8b 45 e8 mov -0x18(%rbp),%rax
22a8: 48 89 45 f8 mov %rax,-0x8(%rbp)
while((m2 = malloc(100001)) != 0){
22ac: bf a1 86 01 00 mov $0x186a1,%edi
22b1: 48 b8 d6 6b 00 00 00 movabs $0x6bd6,%rax
22b8: 00 00 00
22bb: ff d0 callq *%rax
22bd: 48 89 45 e8 mov %rax,-0x18(%rbp)
22c1: 48 83 7d e8 00 cmpq $0x0,-0x18(%rbp)
22c6: 75 d1 jne 2299 <mem+0x5e>
}
printf(1, "alloc ended\n");
22c8: 48 be 14 72 00 00 00 movabs $0x7214,%rsi
22cf: 00 00 00
22d2: bf 01 00 00 00 mov $0x1,%edi
22d7: b8 00 00 00 00 mov $0x0,%eax
22dc: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
22e3: 00 00 00
22e6: ff d2 callq *%rdx
while(m1){
22e8: eb 26 jmp 2310 <mem+0xd5>
m2 = *(void**)m1;
22ea: 48 8b 45 f8 mov -0x8(%rbp),%rax
22ee: 48 8b 00 mov (%rax),%rax
22f1: 48 89 45 e8 mov %rax,-0x18(%rbp)
free(m1);
22f5: 48 8b 45 f8 mov -0x8(%rbp),%rax
22f9: 48 89 c7 mov %rax,%rdi
22fc: 48 b8 21 6a 00 00 00 movabs $0x6a21,%rax
2303: 00 00 00
2306: ff d0 callq *%rax
m1 = m2;
2308: 48 8b 45 e8 mov -0x18(%rbp),%rax
230c: 48 89 45 f8 mov %rax,-0x8(%rbp)
while(m1){
2310: 48 83 7d f8 00 cmpq $0x0,-0x8(%rbp)
2315: 75 d3 jne 22ea <mem+0xaf>
}
m1 = malloc(1024*20);
2317: bf 00 50 00 00 mov $0x5000,%edi
231c: 48 b8 d6 6b 00 00 00 movabs $0x6bd6,%rax
2323: 00 00 00
2326: ff d0 callq *%rax
2328: 48 89 45 f8 mov %rax,-0x8(%rbp)
if(m1 == 0){
232c: 48 83 7d f8 00 cmpq $0x0,-0x8(%rbp)
2331: 75 3d jne 2370 <mem+0x135>
printf(1, "couldn't allocate mem?!!\n");
2333: 48 be 21 72 00 00 00 movabs $0x7221,%rsi
233a: 00 00 00
233d: bf 01 00 00 00 mov $0x1,%edi
2342: b8 00 00 00 00 mov $0x0,%eax
2347: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
234e: 00 00 00
2351: ff d2 callq *%rdx
kill(ppid);
2353: 8b 45 f4 mov -0xc(%rbp),%eax
2356: 89 c7 mov %eax,%edi
2358: 48 b8 5b 63 00 00 00 movabs $0x635b,%rax
235f: 00 00 00
2362: ff d0 callq *%rax
exit();
2364: 48 b8 0d 63 00 00 00 movabs $0x630d,%rax
236b: 00 00 00
236e: ff d0 callq *%rax
}
free(m1);
2370: 48 8b 45 f8 mov -0x8(%rbp),%rax
2374: 48 89 c7 mov %rax,%rdi
2377: 48 b8 21 6a 00 00 00 movabs $0x6a21,%rax
237e: 00 00 00
2381: ff d0 callq *%rax
printf(1, "mem ok\n");
2383: 48 be 3b 72 00 00 00 movabs $0x723b,%rsi
238a: 00 00 00
238d: bf 01 00 00 00 mov $0x1,%edi
2392: b8 00 00 00 00 mov $0x0,%eax
2397: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
239e: 00 00 00
23a1: ff d2 callq *%rdx
exit();
23a3: 48 b8 0d 63 00 00 00 movabs $0x630d,%rax
23aa: 00 00 00
23ad: ff d0 callq *%rax
} else {
wait();
23af: 48 b8 1a 63 00 00 00 movabs $0x631a,%rax
23b6: 00 00 00
23b9: ff d0 callq *%rax
}
}
23bb: 90 nop
23bc: c9 leaveq
23bd: c3 retq
00000000000023be <sharedfd>:
// two processes write to the same file descriptor
// is the offset shared? does inode locking work?
void
sharedfd(void)
{
23be: f3 0f 1e fa endbr64
23c2: 55 push %rbp
23c3: 48 89 e5 mov %rsp,%rbp
23c6: 48 83 ec 30 sub $0x30,%rsp
int fd, pid, i, n, nc, np;
char buf[10];
printf(1, "sharedfd test\n");
23ca: 48 be 43 72 00 00 00 movabs $0x7243,%rsi
23d1: 00 00 00
23d4: bf 01 00 00 00 mov $0x1,%edi
23d9: b8 00 00 00 00 mov $0x0,%eax
23de: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
23e5: 00 00 00
23e8: ff d2 callq *%rdx
unlink("sharedfd");
23ea: 48 bf 52 72 00 00 00 movabs $0x7252,%rdi
23f1: 00 00 00
23f4: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
23fb: 00 00 00
23fe: ff d0 callq *%rax
fd = open("sharedfd", O_CREATE|O_RDWR);
2400: be 02 02 00 00 mov $0x202,%esi
2405: 48 bf 52 72 00 00 00 movabs $0x7252,%rdi
240c: 00 00 00
240f: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
2416: 00 00 00
2419: ff d0 callq *%rax
241b: 89 45 f0 mov %eax,-0x10(%rbp)
if(fd < 0){
241e: 83 7d f0 00 cmpl $0x0,-0x10(%rbp)
2422: 79 25 jns 2449 <sharedfd+0x8b>
printf(1, "fstests: cannot open sharedfd for writing");
2424: 48 be 60 72 00 00 00 movabs $0x7260,%rsi
242b: 00 00 00
242e: bf 01 00 00 00 mov $0x1,%edi
2433: b8 00 00 00 00 mov $0x0,%eax
2438: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
243f: 00 00 00
2442: ff d2 callq *%rdx
return;
2444: e9 0d 02 00 00 jmpq 2656 <sharedfd+0x298>
}
pid = fork();
2449: 48 b8 00 63 00 00 00 movabs $0x6300,%rax
2450: 00 00 00
2453: ff d0 callq *%rax
2455: 89 45 ec mov %eax,-0x14(%rbp)
memset(buf, pid==0?'c':'p', sizeof(buf));
2458: 83 7d ec 00 cmpl $0x0,-0x14(%rbp)
245c: 75 07 jne 2465 <sharedfd+0xa7>
245e: b9 63 00 00 00 mov $0x63,%ecx
2463: eb 05 jmp 246a <sharedfd+0xac>
2465: b9 70 00 00 00 mov $0x70,%ecx
246a: 48 8d 45 de lea -0x22(%rbp),%rax
246e: ba 0a 00 00 00 mov $0xa,%edx
2473: 89 ce mov %ecx,%esi
2475: 48 89 c7 mov %rax,%rdi
2478: 48 b8 d8 60 00 00 00 movabs $0x60d8,%rax
247f: 00 00 00
2482: ff d0 callq *%rax
for(i = 0; i < 1000; i++){
2484: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
248b: eb 48 jmp 24d5 <sharedfd+0x117>
if(write(fd, buf, sizeof(buf)) != sizeof(buf)){
248d: 48 8d 4d de lea -0x22(%rbp),%rcx
2491: 8b 45 f0 mov -0x10(%rbp),%eax
2494: ba 0a 00 00 00 mov $0xa,%edx
2499: 48 89 ce mov %rcx,%rsi
249c: 89 c7 mov %eax,%edi
249e: 48 b8 41 63 00 00 00 movabs $0x6341,%rax
24a5: 00 00 00
24a8: ff d0 callq *%rax
24aa: 83 f8 0a cmp $0xa,%eax
24ad: 74 22 je 24d1 <sharedfd+0x113>
printf(1, "fstests: write sharedfd failed\n");
24af: 48 be 90 72 00 00 00 movabs $0x7290,%rsi
24b6: 00 00 00
24b9: bf 01 00 00 00 mov $0x1,%edi
24be: b8 00 00 00 00 mov $0x0,%eax
24c3: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
24ca: 00 00 00
24cd: ff d2 callq *%rdx
break;
24cf: eb 0d jmp 24de <sharedfd+0x120>
for(i = 0; i < 1000; i++){
24d1: 83 45 fc 01 addl $0x1,-0x4(%rbp)
24d5: 81 7d fc e7 03 00 00 cmpl $0x3e7,-0x4(%rbp)
24dc: 7e af jle 248d <sharedfd+0xcf>
}
}
if(pid == 0)
24de: 83 7d ec 00 cmpl $0x0,-0x14(%rbp)
24e2: 75 0c jne 24f0 <sharedfd+0x132>
exit();
24e4: 48 b8 0d 63 00 00 00 movabs $0x630d,%rax
24eb: 00 00 00
24ee: ff d0 callq *%rax
else
wait();
24f0: 48 b8 1a 63 00 00 00 movabs $0x631a,%rax
24f7: 00 00 00
24fa: ff d0 callq *%rax
close(fd);
24fc: 8b 45 f0 mov -0x10(%rbp),%eax
24ff: 89 c7 mov %eax,%edi
2501: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
2508: 00 00 00
250b: ff d0 callq *%rax
fd = open("sharedfd", 0);
250d: be 00 00 00 00 mov $0x0,%esi
2512: 48 bf 52 72 00 00 00 movabs $0x7252,%rdi
2519: 00 00 00
251c: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
2523: 00 00 00
2526: ff d0 callq *%rax
2528: 89 45 f0 mov %eax,-0x10(%rbp)
if(fd < 0){
252b: 83 7d f0 00 cmpl $0x0,-0x10(%rbp)
252f: 79 25 jns 2556 <sharedfd+0x198>
printf(1, "fstests: cannot open sharedfd for reading\n");
2531: 48 be b0 72 00 00 00 movabs $0x72b0,%rsi
2538: 00 00 00
253b: bf 01 00 00 00 mov $0x1,%edi
2540: b8 00 00 00 00 mov $0x0,%eax
2545: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
254c: 00 00 00
254f: ff d2 callq *%rdx
return;
2551: e9 00 01 00 00 jmpq 2656 <sharedfd+0x298>
}
nc = np = 0;
2556: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%rbp)
255d: 8b 45 f4 mov -0xc(%rbp),%eax
2560: 89 45 f8 mov %eax,-0x8(%rbp)
while((n = read(fd, buf, sizeof(buf))) > 0){
2563: eb 39 jmp 259e <sharedfd+0x1e0>
for(i = 0; i < sizeof(buf); i++){
2565: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
256c: eb 28 jmp 2596 <sharedfd+0x1d8>
if(buf[i] == 'c')
256e: 8b 45 fc mov -0x4(%rbp),%eax
2571: 48 98 cltq
2573: 0f b6 44 05 de movzbl -0x22(%rbp,%rax,1),%eax
2578: 3c 63 cmp $0x63,%al
257a: 75 04 jne 2580 <sharedfd+0x1c2>
nc++;
257c: 83 45 f8 01 addl $0x1,-0x8(%rbp)
if(buf[i] == 'p')
2580: 8b 45 fc mov -0x4(%rbp),%eax
2583: 48 98 cltq
2585: 0f b6 44 05 de movzbl -0x22(%rbp,%rax,1),%eax
258a: 3c 70 cmp $0x70,%al
258c: 75 04 jne 2592 <sharedfd+0x1d4>
np++;
258e: 83 45 f4 01 addl $0x1,-0xc(%rbp)
for(i = 0; i < sizeof(buf); i++){
2592: 83 45 fc 01 addl $0x1,-0x4(%rbp)
2596: 8b 45 fc mov -0x4(%rbp),%eax
2599: 83 f8 09 cmp $0x9,%eax
259c: 76 d0 jbe 256e <sharedfd+0x1b0>
while((n = read(fd, buf, sizeof(buf))) > 0){
259e: 48 8d 4d de lea -0x22(%rbp),%rcx
25a2: 8b 45 f0 mov -0x10(%rbp),%eax
25a5: ba 0a 00 00 00 mov $0xa,%edx
25aa: 48 89 ce mov %rcx,%rsi
25ad: 89 c7 mov %eax,%edi
25af: 48 b8 34 63 00 00 00 movabs $0x6334,%rax
25b6: 00 00 00
25b9: ff d0 callq *%rax
25bb: 89 45 e8 mov %eax,-0x18(%rbp)
25be: 83 7d e8 00 cmpl $0x0,-0x18(%rbp)
25c2: 7f a1 jg 2565 <sharedfd+0x1a7>
}
}
close(fd);
25c4: 8b 45 f0 mov -0x10(%rbp),%eax
25c7: 89 c7 mov %eax,%edi
25c9: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
25d0: 00 00 00
25d3: ff d0 callq *%rax
unlink("sharedfd");
25d5: 48 bf 52 72 00 00 00 movabs $0x7252,%rdi
25dc: 00 00 00
25df: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
25e6: 00 00 00
25e9: ff d0 callq *%rax
if(nc == 10000 && np == 10000){
25eb: 81 7d f8 10 27 00 00 cmpl $0x2710,-0x8(%rbp)
25f2: 75 2b jne 261f <sharedfd+0x261>
25f4: 81 7d f4 10 27 00 00 cmpl $0x2710,-0xc(%rbp)
25fb: 75 22 jne 261f <sharedfd+0x261>
printf(1, "sharedfd ok\n");
25fd: 48 be db 72 00 00 00 movabs $0x72db,%rsi
2604: 00 00 00
2607: bf 01 00 00 00 mov $0x1,%edi
260c: b8 00 00 00 00 mov $0x0,%eax
2611: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
2618: 00 00 00
261b: ff d2 callq *%rdx
261d: eb 37 jmp 2656 <sharedfd+0x298>
} else {
printf(1, "sharedfd oops %d %d\n", nc, np);
261f: 8b 55 f4 mov -0xc(%rbp),%edx
2622: 8b 45 f8 mov -0x8(%rbp),%eax
2625: 89 d1 mov %edx,%ecx
2627: 89 c2 mov %eax,%edx
2629: 48 be e8 72 00 00 00 movabs $0x72e8,%rsi
2630: 00 00 00
2633: bf 01 00 00 00 mov $0x1,%edi
2638: b8 00 00 00 00 mov $0x0,%eax
263d: 49 b8 11 66 00 00 00 movabs $0x6611,%r8
2644: 00 00 00
2647: 41 ff d0 callq *%r8
exit();
264a: 48 b8 0d 63 00 00 00 movabs $0x630d,%rax
2651: 00 00 00
2654: ff d0 callq *%rax
}
}
2656: c9 leaveq
2657: c3 retq
0000000000002658 <fourfiles>:
// four processes write different files at the same
// time, to test block allocation.
void
fourfiles(void)
{
2658: f3 0f 1e fa endbr64
265c: 55 push %rbp
265d: 48 89 e5 mov %rsp,%rbp
2660: 48 83 ec 50 sub $0x50,%rsp
int fd, pid, i, j, n, total, pi;
char *names[] = { "f0", "f1", "f2", "f3" };
2664: 48 b8 fd 72 00 00 00 movabs $0x72fd,%rax
266b: 00 00 00
266e: 48 89 45 b0 mov %rax,-0x50(%rbp)
2672: 48 b8 00 73 00 00 00 movabs $0x7300,%rax
2679: 00 00 00
267c: 48 89 45 b8 mov %rax,-0x48(%rbp)
2680: 48 b8 03 73 00 00 00 movabs $0x7303,%rax
2687: 00 00 00
268a: 48 89 45 c0 mov %rax,-0x40(%rbp)
268e: 48 b8 06 73 00 00 00 movabs $0x7306,%rax
2695: 00 00 00
2698: 48 89 45 c8 mov %rax,-0x38(%rbp)
char *fname;
printf(1, "fourfiles test\n");
269c: 48 be 09 73 00 00 00 movabs $0x7309,%rsi
26a3: 00 00 00
26a6: bf 01 00 00 00 mov $0x1,%edi
26ab: b8 00 00 00 00 mov $0x0,%eax
26b0: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
26b7: 00 00 00
26ba: ff d2 callq *%rdx
for(pi = 0; pi < 4; pi++){
26bc: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%rbp)
26c3: e9 30 01 00 00 jmpq 27f8 <fourfiles+0x1a0>
fname = names[pi];
26c8: 8b 45 f0 mov -0x10(%rbp),%eax
26cb: 48 98 cltq
26cd: 48 8b 44 c5 b0 mov -0x50(%rbp,%rax,8),%rax
26d2: 48 89 45 e8 mov %rax,-0x18(%rbp)
unlink(fname);
26d6: 48 8b 45 e8 mov -0x18(%rbp),%rax
26da: 48 89 c7 mov %rax,%rdi
26dd: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
26e4: 00 00 00
26e7: ff d0 callq *%rax
pid = fork();
26e9: 48 b8 00 63 00 00 00 movabs $0x6300,%rax
26f0: 00 00 00
26f3: ff d0 callq *%rax
26f5: 89 45 dc mov %eax,-0x24(%rbp)
if(pid < 0){
26f8: 83 7d dc 00 cmpl $0x0,-0x24(%rbp)
26fc: 79 16 jns 2714 <fourfiles+0xbc>
failexit("fork");
26fe: 48 bf b7 6d 00 00 00 movabs $0x6db7,%rdi
2705: 00 00 00
2708: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
270f: 00 00 00
2712: ff d0 callq *%rax
}
if(pid == 0){
2714: 83 7d dc 00 cmpl $0x0,-0x24(%rbp)
2718: 0f 85 d6 00 00 00 jne 27f4 <fourfiles+0x19c>
fd = open(fname, O_CREATE | O_RDWR);
271e: 48 8b 45 e8 mov -0x18(%rbp),%rax
2722: be 02 02 00 00 mov $0x202,%esi
2727: 48 89 c7 mov %rax,%rdi
272a: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
2731: 00 00 00
2734: ff d0 callq *%rax
2736: 89 45 e4 mov %eax,-0x1c(%rbp)
if(fd < 0){
2739: 83 7d e4 00 cmpl $0x0,-0x1c(%rbp)
273d: 79 16 jns 2755 <fourfiles+0xfd>
failexit("create");
273f: 48 bf 19 73 00 00 00 movabs $0x7319,%rdi
2746: 00 00 00
2749: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
2750: 00 00 00
2753: ff d0 callq *%rax
}
memset(buf, '0'+pi, 512);
2755: 8b 45 f0 mov -0x10(%rbp),%eax
2758: 83 c0 30 add $0x30,%eax
275b: ba 00 02 00 00 mov $0x200,%edx
2760: 89 c6 mov %eax,%esi
2762: 48 bf 20 8c 00 00 00 movabs $0x8c20,%rdi
2769: 00 00 00
276c: 48 b8 d8 60 00 00 00 movabs $0x60d8,%rax
2773: 00 00 00
2776: ff d0 callq *%rax
for(i = 0; i < 12; i++){
2778: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
277f: eb 61 jmp 27e2 <fourfiles+0x18a>
if((n = write(fd, buf, 500)) != 500){
2781: 8b 45 e4 mov -0x1c(%rbp),%eax
2784: ba f4 01 00 00 mov $0x1f4,%edx
2789: 48 be 20 8c 00 00 00 movabs $0x8c20,%rsi
2790: 00 00 00
2793: 89 c7 mov %eax,%edi
2795: 48 b8 41 63 00 00 00 movabs $0x6341,%rax
279c: 00 00 00
279f: ff d0 callq *%rax
27a1: 89 45 e0 mov %eax,-0x20(%rbp)
27a4: 81 7d e0 f4 01 00 00 cmpl $0x1f4,-0x20(%rbp)
27ab: 74 31 je 27de <fourfiles+0x186>
printf(1, "write failed %d\n", n);
27ad: 8b 45 e0 mov -0x20(%rbp),%eax
27b0: 89 c2 mov %eax,%edx
27b2: 48 be 20 73 00 00 00 movabs $0x7320,%rsi
27b9: 00 00 00
27bc: bf 01 00 00 00 mov $0x1,%edi
27c1: b8 00 00 00 00 mov $0x0,%eax
27c6: 48 b9 11 66 00 00 00 movabs $0x6611,%rcx
27cd: 00 00 00
27d0: ff d1 callq *%rcx
exit();
27d2: 48 b8 0d 63 00 00 00 movabs $0x630d,%rax
27d9: 00 00 00
27dc: ff d0 callq *%rax
for(i = 0; i < 12; i++){
27de: 83 45 fc 01 addl $0x1,-0x4(%rbp)
27e2: 83 7d fc 0b cmpl $0xb,-0x4(%rbp)
27e6: 7e 99 jle 2781 <fourfiles+0x129>
}
}
exit();
27e8: 48 b8 0d 63 00 00 00 movabs $0x630d,%rax
27ef: 00 00 00
27f2: ff d0 callq *%rax
for(pi = 0; pi < 4; pi++){
27f4: 83 45 f0 01 addl $0x1,-0x10(%rbp)
27f8: 83 7d f0 03 cmpl $0x3,-0x10(%rbp)
27fc: 0f 8e c6 fe ff ff jle 26c8 <fourfiles+0x70>
}
}
for(pi = 0; pi < 4; pi++){
2802: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%rbp)
2809: eb 10 jmp 281b <fourfiles+0x1c3>
wait();
280b: 48 b8 1a 63 00 00 00 movabs $0x631a,%rax
2812: 00 00 00
2815: ff d0 callq *%rax
for(pi = 0; pi < 4; pi++){
2817: 83 45 f0 01 addl $0x1,-0x10(%rbp)
281b: 83 7d f0 03 cmpl $0x3,-0x10(%rbp)
281f: 7e ea jle 280b <fourfiles+0x1b3>
}
for(i = 0; i < 2; i++){
2821: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
2828: e9 0e 01 00 00 jmpq 293b <fourfiles+0x2e3>
fname = names[i];
282d: 8b 45 fc mov -0x4(%rbp),%eax
2830: 48 98 cltq
2832: 48 8b 44 c5 b0 mov -0x50(%rbp,%rax,8),%rax
2837: 48 89 45 e8 mov %rax,-0x18(%rbp)
fd = open(fname, 0);
283b: 48 8b 45 e8 mov -0x18(%rbp),%rax
283f: be 00 00 00 00 mov $0x0,%esi
2844: 48 89 c7 mov %rax,%rdi
2847: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
284e: 00 00 00
2851: ff d0 callq *%rax
2853: 89 45 e4 mov %eax,-0x1c(%rbp)
total = 0;
2856: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%rbp)
while((n = read(fd, buf, sizeof(buf))) > 0){
285d: eb 51 jmp 28b0 <fourfiles+0x258>
for(j = 0; j < n; j++){
285f: c7 45 f8 00 00 00 00 movl $0x0,-0x8(%rbp)
2866: eb 3a jmp 28a2 <fourfiles+0x24a>
if(buf[j] != '0'+i){
2868: 48 ba 20 8c 00 00 00 movabs $0x8c20,%rdx
286f: 00 00 00
2872: 8b 45 f8 mov -0x8(%rbp),%eax
2875: 48 98 cltq
2877: 0f b6 04 02 movzbl (%rdx,%rax,1),%eax
287b: 0f be c0 movsbl %al,%eax
287e: 8b 55 fc mov -0x4(%rbp),%edx
2881: 83 c2 30 add $0x30,%edx
2884: 39 d0 cmp %edx,%eax
2886: 74 16 je 289e <fourfiles+0x246>
failexit("wrong char");
2888: 48 bf 31 73 00 00 00 movabs $0x7331,%rdi
288f: 00 00 00
2892: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
2899: 00 00 00
289c: ff d0 callq *%rax
for(j = 0; j < n; j++){
289e: 83 45 f8 01 addl $0x1,-0x8(%rbp)
28a2: 8b 45 f8 mov -0x8(%rbp),%eax
28a5: 3b 45 e0 cmp -0x20(%rbp),%eax
28a8: 7c be jl 2868 <fourfiles+0x210>
}
}
total += n;
28aa: 8b 45 e0 mov -0x20(%rbp),%eax
28ad: 01 45 f4 add %eax,-0xc(%rbp)
while((n = read(fd, buf, sizeof(buf))) > 0){
28b0: 8b 45 e4 mov -0x1c(%rbp),%eax
28b3: ba 00 20 00 00 mov $0x2000,%edx
28b8: 48 be 20 8c 00 00 00 movabs $0x8c20,%rsi
28bf: 00 00 00
28c2: 89 c7 mov %eax,%edi
28c4: 48 b8 34 63 00 00 00 movabs $0x6334,%rax
28cb: 00 00 00
28ce: ff d0 callq *%rax
28d0: 89 45 e0 mov %eax,-0x20(%rbp)
28d3: 83 7d e0 00 cmpl $0x0,-0x20(%rbp)
28d7: 7f 86 jg 285f <fourfiles+0x207>
}
close(fd);
28d9: 8b 45 e4 mov -0x1c(%rbp),%eax
28dc: 89 c7 mov %eax,%edi
28de: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
28e5: 00 00 00
28e8: ff d0 callq *%rax
if(total != 12*500){
28ea: 81 7d f4 70 17 00 00 cmpl $0x1770,-0xc(%rbp)
28f1: 74 31 je 2924 <fourfiles+0x2cc>
printf(1, "wrong length %d\n", total);
28f3: 8b 45 f4 mov -0xc(%rbp),%eax
28f6: 89 c2 mov %eax,%edx
28f8: 48 be 3c 73 00 00 00 movabs $0x733c,%rsi
28ff: 00 00 00
2902: bf 01 00 00 00 mov $0x1,%edi
2907: b8 00 00 00 00 mov $0x0,%eax
290c: 48 b9 11 66 00 00 00 movabs $0x6611,%rcx
2913: 00 00 00
2916: ff d1 callq *%rcx
exit();
2918: 48 b8 0d 63 00 00 00 movabs $0x630d,%rax
291f: 00 00 00
2922: ff d0 callq *%rax
}
unlink(fname);
2924: 48 8b 45 e8 mov -0x18(%rbp),%rax
2928: 48 89 c7 mov %rax,%rdi
292b: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
2932: 00 00 00
2935: ff d0 callq *%rax
for(i = 0; i < 2; i++){
2937: 83 45 fc 01 addl $0x1,-0x4(%rbp)
293b: 83 7d fc 01 cmpl $0x1,-0x4(%rbp)
293f: 0f 8e e8 fe ff ff jle 282d <fourfiles+0x1d5>
}
printf(1, "fourfiles ok\n");
2945: 48 be 4d 73 00 00 00 movabs $0x734d,%rsi
294c: 00 00 00
294f: bf 01 00 00 00 mov $0x1,%edi
2954: b8 00 00 00 00 mov $0x0,%eax
2959: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
2960: 00 00 00
2963: ff d2 callq *%rdx
}
2965: 90 nop
2966: c9 leaveq
2967: c3 retq
0000000000002968 <createdelete>:
// four processes create and delete different files in same directory
void
createdelete(void)
{
2968: f3 0f 1e fa endbr64
296c: 55 push %rbp
296d: 48 89 e5 mov %rsp,%rbp
2970: 48 83 ec 30 sub $0x30,%rsp
enum { N = 20 };
int pid, i, fd, pi;
char name[32];
printf(1, "createdelete test\n");
2974: 48 be 5b 73 00 00 00 movabs $0x735b,%rsi
297b: 00 00 00
297e: bf 01 00 00 00 mov $0x1,%edi
2983: b8 00 00 00 00 mov $0x0,%eax
2988: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
298f: 00 00 00
2992: ff d2 callq *%rdx
for(pi = 0; pi < 4; pi++){
2994: c7 45 f8 00 00 00 00 movl $0x0,-0x8(%rbp)
299b: e9 0c 01 00 00 jmpq 2aac <createdelete+0x144>
pid = fork();
29a0: 48 b8 00 63 00 00 00 movabs $0x6300,%rax
29a7: 00 00 00
29aa: ff d0 callq *%rax
29ac: 89 45 f0 mov %eax,-0x10(%rbp)
if(pid < 0){
29af: 83 7d f0 00 cmpl $0x0,-0x10(%rbp)
29b3: 79 16 jns 29cb <createdelete+0x63>
failexit("fork");
29b5: 48 bf b7 6d 00 00 00 movabs $0x6db7,%rdi
29bc: 00 00 00
29bf: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
29c6: 00 00 00
29c9: ff d0 callq *%rax
}
if(pid == 0){
29cb: 83 7d f0 00 cmpl $0x0,-0x10(%rbp)
29cf: 0f 85 d3 00 00 00 jne 2aa8 <createdelete+0x140>
name[0] = 'p' + pi;
29d5: 8b 45 f8 mov -0x8(%rbp),%eax
29d8: 83 c0 70 add $0x70,%eax
29db: 88 45 d0 mov %al,-0x30(%rbp)
name[2] = '\0';
29de: c6 45 d2 00 movb $0x0,-0x2e(%rbp)
for(i = 0; i < N; i++){
29e2: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
29e9: e9 a4 00 00 00 jmpq 2a92 <createdelete+0x12a>
name[1] = '0' + i;
29ee: 8b 45 fc mov -0x4(%rbp),%eax
29f1: 83 c0 30 add $0x30,%eax
29f4: 88 45 d1 mov %al,-0x2f(%rbp)
fd = open(name, O_CREATE | O_RDWR);
29f7: 48 8d 45 d0 lea -0x30(%rbp),%rax
29fb: be 02 02 00 00 mov $0x202,%esi
2a00: 48 89 c7 mov %rax,%rdi
2a03: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
2a0a: 00 00 00
2a0d: ff d0 callq *%rax
2a0f: 89 45 f4 mov %eax,-0xc(%rbp)
if(fd < 0){
2a12: 83 7d f4 00 cmpl $0x0,-0xc(%rbp)
2a16: 79 16 jns 2a2e <createdelete+0xc6>
failexit("create");
2a18: 48 bf 19 73 00 00 00 movabs $0x7319,%rdi
2a1f: 00 00 00
2a22: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
2a29: 00 00 00
2a2c: ff d0 callq *%rax
}
close(fd);
2a2e: 8b 45 f4 mov -0xc(%rbp),%eax
2a31: 89 c7 mov %eax,%edi
2a33: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
2a3a: 00 00 00
2a3d: ff d0 callq *%rax
if(i > 0 && (i % 2 ) == 0){
2a3f: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
2a43: 7e 49 jle 2a8e <createdelete+0x126>
2a45: 8b 45 fc mov -0x4(%rbp),%eax
2a48: 83 e0 01 and $0x1,%eax
2a4b: 85 c0 test %eax,%eax
2a4d: 75 3f jne 2a8e <createdelete+0x126>
name[1] = '0' + (i / 2);
2a4f: 8b 45 fc mov -0x4(%rbp),%eax
2a52: 89 c2 mov %eax,%edx
2a54: c1 ea 1f shr $0x1f,%edx
2a57: 01 d0 add %edx,%eax
2a59: d1 f8 sar %eax
2a5b: 83 c0 30 add $0x30,%eax
2a5e: 88 45 d1 mov %al,-0x2f(%rbp)
if(unlink(name) < 0){
2a61: 48 8d 45 d0 lea -0x30(%rbp),%rax
2a65: 48 89 c7 mov %rax,%rdi
2a68: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
2a6f: 00 00 00
2a72: ff d0 callq *%rax
2a74: 85 c0 test %eax,%eax
2a76: 79 16 jns 2a8e <createdelete+0x126>
failexit("unlink");
2a78: 48 bf 23 6e 00 00 00 movabs $0x6e23,%rdi
2a7f: 00 00 00
2a82: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
2a89: 00 00 00
2a8c: ff d0 callq *%rax
for(i = 0; i < N; i++){
2a8e: 83 45 fc 01 addl $0x1,-0x4(%rbp)
2a92: 83 7d fc 13 cmpl $0x13,-0x4(%rbp)
2a96: 0f 8e 52 ff ff ff jle 29ee <createdelete+0x86>
}
}
}
exit();
2a9c: 48 b8 0d 63 00 00 00 movabs $0x630d,%rax
2aa3: 00 00 00
2aa6: ff d0 callq *%rax
for(pi = 0; pi < 4; pi++){
2aa8: 83 45 f8 01 addl $0x1,-0x8(%rbp)
2aac: 83 7d f8 03 cmpl $0x3,-0x8(%rbp)
2ab0: 0f 8e ea fe ff ff jle 29a0 <createdelete+0x38>
}
}
for(pi = 0; pi < 4; pi++){
2ab6: c7 45 f8 00 00 00 00 movl $0x0,-0x8(%rbp)
2abd: eb 10 jmp 2acf <createdelete+0x167>
wait();
2abf: 48 b8 1a 63 00 00 00 movabs $0x631a,%rax
2ac6: 00 00 00
2ac9: ff d0 callq *%rax
for(pi = 0; pi < 4; pi++){
2acb: 83 45 f8 01 addl $0x1,-0x8(%rbp)
2acf: 83 7d f8 03 cmpl $0x3,-0x8(%rbp)
2ad3: 7e ea jle 2abf <createdelete+0x157>
}
name[0] = name[1] = name[2] = 0;
2ad5: c6 45 d2 00 movb $0x0,-0x2e(%rbp)
2ad9: 0f b6 45 d2 movzbl -0x2e(%rbp),%eax
2add: 88 45 d1 mov %al,-0x2f(%rbp)
2ae0: 0f b6 45 d1 movzbl -0x2f(%rbp),%eax
2ae4: 88 45 d0 mov %al,-0x30(%rbp)
for(i = 0; i < N; i++){
2ae7: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
2aee: e9 ec 00 00 00 jmpq 2bdf <createdelete+0x277>
for(pi = 0; pi < 4; pi++){
2af3: c7 45 f8 00 00 00 00 movl $0x0,-0x8(%rbp)
2afa: e9 d2 00 00 00 jmpq 2bd1 <createdelete+0x269>
name[0] = 'p' + pi;
2aff: 8b 45 f8 mov -0x8(%rbp),%eax
2b02: 83 c0 70 add $0x70,%eax
2b05: 88 45 d0 mov %al,-0x30(%rbp)
name[1] = '0' + i;
2b08: 8b 45 fc mov -0x4(%rbp),%eax
2b0b: 83 c0 30 add $0x30,%eax
2b0e: 88 45 d1 mov %al,-0x2f(%rbp)
fd = open(name, 0);
2b11: 48 8d 45 d0 lea -0x30(%rbp),%rax
2b15: be 00 00 00 00 mov $0x0,%esi
2b1a: 48 89 c7 mov %rax,%rdi
2b1d: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
2b24: 00 00 00
2b27: ff d0 callq *%rax
2b29: 89 45 f4 mov %eax,-0xc(%rbp)
if((i == 0 || i >= N/2) && fd < 0){
2b2c: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
2b30: 74 06 je 2b38 <createdelete+0x1d0>
2b32: 83 7d fc 09 cmpl $0x9,-0x4(%rbp)
2b36: 7e 39 jle 2b71 <createdelete+0x209>
2b38: 83 7d f4 00 cmpl $0x0,-0xc(%rbp)
2b3c: 79 33 jns 2b71 <createdelete+0x209>
printf(1, "oops createdelete %s didn't exist\n", name);
2b3e: 48 8d 45 d0 lea -0x30(%rbp),%rax
2b42: 48 89 c2 mov %rax,%rdx
2b45: 48 be 70 73 00 00 00 movabs $0x7370,%rsi
2b4c: 00 00 00
2b4f: bf 01 00 00 00 mov $0x1,%edi
2b54: b8 00 00 00 00 mov $0x0,%eax
2b59: 48 b9 11 66 00 00 00 movabs $0x6611,%rcx
2b60: 00 00 00
2b63: ff d1 callq *%rcx
exit();
2b65: 48 b8 0d 63 00 00 00 movabs $0x630d,%rax
2b6c: 00 00 00
2b6f: ff d0 callq *%rax
} else if((i >= 1 && i < N/2) && fd >= 0){
2b71: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
2b75: 7e 3f jle 2bb6 <createdelete+0x24e>
2b77: 83 7d fc 09 cmpl $0x9,-0x4(%rbp)
2b7b: 7f 39 jg 2bb6 <createdelete+0x24e>
2b7d: 83 7d f4 00 cmpl $0x0,-0xc(%rbp)
2b81: 78 33 js 2bb6 <createdelete+0x24e>
printf(1, "oops createdelete %s did exist\n", name);
2b83: 48 8d 45 d0 lea -0x30(%rbp),%rax
2b87: 48 89 c2 mov %rax,%rdx
2b8a: 48 be 98 73 00 00 00 movabs $0x7398,%rsi
2b91: 00 00 00
2b94: bf 01 00 00 00 mov $0x1,%edi
2b99: b8 00 00 00 00 mov $0x0,%eax
2b9e: 48 b9 11 66 00 00 00 movabs $0x6611,%rcx
2ba5: 00 00 00
2ba8: ff d1 callq *%rcx
exit();
2baa: 48 b8 0d 63 00 00 00 movabs $0x630d,%rax
2bb1: 00 00 00
2bb4: ff d0 callq *%rax
}
if(fd >= 0)
2bb6: 83 7d f4 00 cmpl $0x0,-0xc(%rbp)
2bba: 78 11 js 2bcd <createdelete+0x265>
close(fd);
2bbc: 8b 45 f4 mov -0xc(%rbp),%eax
2bbf: 89 c7 mov %eax,%edi
2bc1: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
2bc8: 00 00 00
2bcb: ff d0 callq *%rax
for(pi = 0; pi < 4; pi++){
2bcd: 83 45 f8 01 addl $0x1,-0x8(%rbp)
2bd1: 83 7d f8 03 cmpl $0x3,-0x8(%rbp)
2bd5: 0f 8e 24 ff ff ff jle 2aff <createdelete+0x197>
for(i = 0; i < N; i++){
2bdb: 83 45 fc 01 addl $0x1,-0x4(%rbp)
2bdf: 83 7d fc 13 cmpl $0x13,-0x4(%rbp)
2be3: 0f 8e 0a ff ff ff jle 2af3 <createdelete+0x18b>
}
}
for(i = 0; i < N; i++){
2be9: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
2bf0: eb 3c jmp 2c2e <createdelete+0x2c6>
for(pi = 0; pi < 4; pi++){
2bf2: c7 45 f8 00 00 00 00 movl $0x0,-0x8(%rbp)
2bf9: eb 29 jmp 2c24 <createdelete+0x2bc>
name[0] = 'p' + i;
2bfb: 8b 45 fc mov -0x4(%rbp),%eax
2bfe: 83 c0 70 add $0x70,%eax
2c01: 88 45 d0 mov %al,-0x30(%rbp)
name[1] = '0' + i;
2c04: 8b 45 fc mov -0x4(%rbp),%eax
2c07: 83 c0 30 add $0x30,%eax
2c0a: 88 45 d1 mov %al,-0x2f(%rbp)
unlink(name);
2c0d: 48 8d 45 d0 lea -0x30(%rbp),%rax
2c11: 48 89 c7 mov %rax,%rdi
2c14: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
2c1b: 00 00 00
2c1e: ff d0 callq *%rax
for(pi = 0; pi < 4; pi++){
2c20: 83 45 f8 01 addl $0x1,-0x8(%rbp)
2c24: 83 7d f8 03 cmpl $0x3,-0x8(%rbp)
2c28: 7e d1 jle 2bfb <createdelete+0x293>
for(i = 0; i < N; i++){
2c2a: 83 45 fc 01 addl $0x1,-0x4(%rbp)
2c2e: 83 7d fc 13 cmpl $0x13,-0x4(%rbp)
2c32: 7e be jle 2bf2 <createdelete+0x28a>
}
}
printf(1, "createdelete ok\n");
2c34: 48 be b8 73 00 00 00 movabs $0x73b8,%rsi
2c3b: 00 00 00
2c3e: bf 01 00 00 00 mov $0x1,%edi
2c43: b8 00 00 00 00 mov $0x0,%eax
2c48: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
2c4f: 00 00 00
2c52: ff d2 callq *%rdx
}
2c54: 90 nop
2c55: c9 leaveq
2c56: c3 retq
0000000000002c57 <unlinkread>:
// can I unlink a file and still read it?
void
unlinkread(void)
{
2c57: f3 0f 1e fa endbr64
2c5b: 55 push %rbp
2c5c: 48 89 e5 mov %rsp,%rbp
2c5f: 48 83 ec 10 sub $0x10,%rsp
int fd, fd1;
printf(1, "unlinkread test\n");
2c63: 48 be c9 73 00 00 00 movabs $0x73c9,%rsi
2c6a: 00 00 00
2c6d: bf 01 00 00 00 mov $0x1,%edi
2c72: b8 00 00 00 00 mov $0x0,%eax
2c77: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
2c7e: 00 00 00
2c81: ff d2 callq *%rdx
fd = open("unlinkread", O_CREATE | O_RDWR);
2c83: be 02 02 00 00 mov $0x202,%esi
2c88: 48 bf da 73 00 00 00 movabs $0x73da,%rdi
2c8f: 00 00 00
2c92: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
2c99: 00 00 00
2c9c: ff d0 callq *%rax
2c9e: 89 45 fc mov %eax,-0x4(%rbp)
if(fd < 0){
2ca1: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
2ca5: 79 16 jns 2cbd <unlinkread+0x66>
failexit("create unlinkread");
2ca7: 48 bf e5 73 00 00 00 movabs $0x73e5,%rdi
2cae: 00 00 00
2cb1: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
2cb8: 00 00 00
2cbb: ff d0 callq *%rax
}
write(fd, "hello", 5);
2cbd: 8b 45 fc mov -0x4(%rbp),%eax
2cc0: ba 05 00 00 00 mov $0x5,%edx
2cc5: 48 be f7 73 00 00 00 movabs $0x73f7,%rsi
2ccc: 00 00 00
2ccf: 89 c7 mov %eax,%edi
2cd1: 48 b8 41 63 00 00 00 movabs $0x6341,%rax
2cd8: 00 00 00
2cdb: ff d0 callq *%rax
close(fd);
2cdd: 8b 45 fc mov -0x4(%rbp),%eax
2ce0: 89 c7 mov %eax,%edi
2ce2: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
2ce9: 00 00 00
2cec: ff d0 callq *%rax
fd = open("unlinkread", O_RDWR);
2cee: be 02 00 00 00 mov $0x2,%esi
2cf3: 48 bf da 73 00 00 00 movabs $0x73da,%rdi
2cfa: 00 00 00
2cfd: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
2d04: 00 00 00
2d07: ff d0 callq *%rax
2d09: 89 45 fc mov %eax,-0x4(%rbp)
if(fd < 0){
2d0c: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
2d10: 79 16 jns 2d28 <unlinkread+0xd1>
failexit("open unlinkread");
2d12: 48 bf fd 73 00 00 00 movabs $0x73fd,%rdi
2d19: 00 00 00
2d1c: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
2d23: 00 00 00
2d26: ff d0 callq *%rax
}
if(unlink("unlinkread") != 0){
2d28: 48 bf da 73 00 00 00 movabs $0x73da,%rdi
2d2f: 00 00 00
2d32: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
2d39: 00 00 00
2d3c: ff d0 callq *%rax
2d3e: 85 c0 test %eax,%eax
2d40: 74 16 je 2d58 <unlinkread+0x101>
failexit("unlink unlinkread");
2d42: 48 bf 0d 74 00 00 00 movabs $0x740d,%rdi
2d49: 00 00 00
2d4c: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
2d53: 00 00 00
2d56: ff d0 callq *%rax
}
fd1 = open("unlinkread", O_CREATE | O_RDWR);
2d58: be 02 02 00 00 mov $0x202,%esi
2d5d: 48 bf da 73 00 00 00 movabs $0x73da,%rdi
2d64: 00 00 00
2d67: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
2d6e: 00 00 00
2d71: ff d0 callq *%rax
2d73: 89 45 f8 mov %eax,-0x8(%rbp)
write(fd1, "yyy", 3);
2d76: 8b 45 f8 mov -0x8(%rbp),%eax
2d79: ba 03 00 00 00 mov $0x3,%edx
2d7e: 48 be 1f 74 00 00 00 movabs $0x741f,%rsi
2d85: 00 00 00
2d88: 89 c7 mov %eax,%edi
2d8a: 48 b8 41 63 00 00 00 movabs $0x6341,%rax
2d91: 00 00 00
2d94: ff d0 callq *%rax
close(fd1);
2d96: 8b 45 f8 mov -0x8(%rbp),%eax
2d99: 89 c7 mov %eax,%edi
2d9b: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
2da2: 00 00 00
2da5: ff d0 callq *%rax
if(read(fd, buf, sizeof(buf)) != 5){
2da7: 8b 45 fc mov -0x4(%rbp),%eax
2daa: ba 00 20 00 00 mov $0x2000,%edx
2daf: 48 be 20 8c 00 00 00 movabs $0x8c20,%rsi
2db6: 00 00 00
2db9: 89 c7 mov %eax,%edi
2dbb: 48 b8 34 63 00 00 00 movabs $0x6334,%rax
2dc2: 00 00 00
2dc5: ff d0 callq *%rax
2dc7: 83 f8 05 cmp $0x5,%eax
2dca: 74 16 je 2de2 <unlinkread+0x18b>
failexit("unlinkread read failed");
2dcc: 48 bf 23 74 00 00 00 movabs $0x7423,%rdi
2dd3: 00 00 00
2dd6: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
2ddd: 00 00 00
2de0: ff d0 callq *%rax
}
if(buf[0] != 'h'){
2de2: 48 b8 20 8c 00 00 00 movabs $0x8c20,%rax
2de9: 00 00 00
2dec: 0f b6 00 movzbl (%rax),%eax
2def: 3c 68 cmp $0x68,%al
2df1: 74 16 je 2e09 <unlinkread+0x1b2>
failexit("unlinkread wrong data");
2df3: 48 bf 3a 74 00 00 00 movabs $0x743a,%rdi
2dfa: 00 00 00
2dfd: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
2e04: 00 00 00
2e07: ff d0 callq *%rax
}
if(write(fd, buf, 10) != 10){
2e09: 8b 45 fc mov -0x4(%rbp),%eax
2e0c: ba 0a 00 00 00 mov $0xa,%edx
2e11: 48 be 20 8c 00 00 00 movabs $0x8c20,%rsi
2e18: 00 00 00
2e1b: 89 c7 mov %eax,%edi
2e1d: 48 b8 41 63 00 00 00 movabs $0x6341,%rax
2e24: 00 00 00
2e27: ff d0 callq *%rax
2e29: 83 f8 0a cmp $0xa,%eax
2e2c: 74 16 je 2e44 <unlinkread+0x1ed>
failexit("unlinkread write");
2e2e: 48 bf 50 74 00 00 00 movabs $0x7450,%rdi
2e35: 00 00 00
2e38: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
2e3f: 00 00 00
2e42: ff d0 callq *%rax
}
close(fd);
2e44: 8b 45 fc mov -0x4(%rbp),%eax
2e47: 89 c7 mov %eax,%edi
2e49: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
2e50: 00 00 00
2e53: ff d0 callq *%rax
unlink("unlinkread");
2e55: 48 bf da 73 00 00 00 movabs $0x73da,%rdi
2e5c: 00 00 00
2e5f: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
2e66: 00 00 00
2e69: ff d0 callq *%rax
printf(1, "unlinkread ok\n");
2e6b: 48 be 61 74 00 00 00 movabs $0x7461,%rsi
2e72: 00 00 00
2e75: bf 01 00 00 00 mov $0x1,%edi
2e7a: b8 00 00 00 00 mov $0x0,%eax
2e7f: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
2e86: 00 00 00
2e89: ff d2 callq *%rdx
}
2e8b: 90 nop
2e8c: c9 leaveq
2e8d: c3 retq
0000000000002e8e <linktest>:
void
linktest(void)
{
2e8e: f3 0f 1e fa endbr64
2e92: 55 push %rbp
2e93: 48 89 e5 mov %rsp,%rbp
2e96: 48 83 ec 10 sub $0x10,%rsp
int fd;
printf(1, "linktest\n");
2e9a: 48 be 70 74 00 00 00 movabs $0x7470,%rsi
2ea1: 00 00 00
2ea4: bf 01 00 00 00 mov $0x1,%edi
2ea9: b8 00 00 00 00 mov $0x0,%eax
2eae: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
2eb5: 00 00 00
2eb8: ff d2 callq *%rdx
unlink("lf1");
2eba: 48 bf 7a 74 00 00 00 movabs $0x747a,%rdi
2ec1: 00 00 00
2ec4: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
2ecb: 00 00 00
2ece: ff d0 callq *%rax
unlink("lf2");
2ed0: 48 bf 7e 74 00 00 00 movabs $0x747e,%rdi
2ed7: 00 00 00
2eda: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
2ee1: 00 00 00
2ee4: ff d0 callq *%rax
fd = open("lf1", O_CREATE|O_RDWR);
2ee6: be 02 02 00 00 mov $0x202,%esi
2eeb: 48 bf 7a 74 00 00 00 movabs $0x747a,%rdi
2ef2: 00 00 00
2ef5: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
2efc: 00 00 00
2eff: ff d0 callq *%rax
2f01: 89 45 fc mov %eax,-0x4(%rbp)
if(fd < 0){
2f04: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
2f08: 79 16 jns 2f20 <linktest+0x92>
failexit("create lf1");
2f0a: 48 bf 82 74 00 00 00 movabs $0x7482,%rdi
2f11: 00 00 00
2f14: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
2f1b: 00 00 00
2f1e: ff d0 callq *%rax
}
if(write(fd, "hello", 5) != 5){
2f20: 8b 45 fc mov -0x4(%rbp),%eax
2f23: ba 05 00 00 00 mov $0x5,%edx
2f28: 48 be f7 73 00 00 00 movabs $0x73f7,%rsi
2f2f: 00 00 00
2f32: 89 c7 mov %eax,%edi
2f34: 48 b8 41 63 00 00 00 movabs $0x6341,%rax
2f3b: 00 00 00
2f3e: ff d0 callq *%rax
2f40: 83 f8 05 cmp $0x5,%eax
2f43: 74 16 je 2f5b <linktest+0xcd>
failexit("write lf1");
2f45: 48 bf 8d 74 00 00 00 movabs $0x748d,%rdi
2f4c: 00 00 00
2f4f: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
2f56: 00 00 00
2f59: ff d0 callq *%rax
}
close(fd);
2f5b: 8b 45 fc mov -0x4(%rbp),%eax
2f5e: 89 c7 mov %eax,%edi
2f60: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
2f67: 00 00 00
2f6a: ff d0 callq *%rax
if(link("lf1", "lf2") < 0){
2f6c: 48 be 7e 74 00 00 00 movabs $0x747e,%rsi
2f73: 00 00 00
2f76: 48 bf 7a 74 00 00 00 movabs $0x747a,%rdi
2f7d: 00 00 00
2f80: 48 b8 a9 63 00 00 00 movabs $0x63a9,%rax
2f87: 00 00 00
2f8a: ff d0 callq *%rax
2f8c: 85 c0 test %eax,%eax
2f8e: 79 16 jns 2fa6 <linktest+0x118>
failexit("link lf1 lf2");
2f90: 48 bf 97 74 00 00 00 movabs $0x7497,%rdi
2f97: 00 00 00
2f9a: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
2fa1: 00 00 00
2fa4: ff d0 callq *%rax
}
unlink("lf1");
2fa6: 48 bf 7a 74 00 00 00 movabs $0x747a,%rdi
2fad: 00 00 00
2fb0: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
2fb7: 00 00 00
2fba: ff d0 callq *%rax
if(open("lf1", 0) >= 0){
2fbc: be 00 00 00 00 mov $0x0,%esi
2fc1: 48 bf 7a 74 00 00 00 movabs $0x747a,%rdi
2fc8: 00 00 00
2fcb: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
2fd2: 00 00 00
2fd5: ff d0 callq *%rax
2fd7: 85 c0 test %eax,%eax
2fd9: 78 16 js 2ff1 <linktest+0x163>
failexit("unlinked lf1 but it is still there!");
2fdb: 48 bf a8 74 00 00 00 movabs $0x74a8,%rdi
2fe2: 00 00 00
2fe5: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
2fec: 00 00 00
2fef: ff d0 callq *%rax
}
fd = open("lf2", 0);
2ff1: be 00 00 00 00 mov $0x0,%esi
2ff6: 48 bf 7e 74 00 00 00 movabs $0x747e,%rdi
2ffd: 00 00 00
3000: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
3007: 00 00 00
300a: ff d0 callq *%rax
300c: 89 45 fc mov %eax,-0x4(%rbp)
if(fd < 0){
300f: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
3013: 79 16 jns 302b <linktest+0x19d>
failexit("open lf2");
3015: 48 bf cc 74 00 00 00 movabs $0x74cc,%rdi
301c: 00 00 00
301f: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
3026: 00 00 00
3029: ff d0 callq *%rax
}
if(read(fd, buf, sizeof(buf)) != 5){
302b: 8b 45 fc mov -0x4(%rbp),%eax
302e: ba 00 20 00 00 mov $0x2000,%edx
3033: 48 be 20 8c 00 00 00 movabs $0x8c20,%rsi
303a: 00 00 00
303d: 89 c7 mov %eax,%edi
303f: 48 b8 34 63 00 00 00 movabs $0x6334,%rax
3046: 00 00 00
3049: ff d0 callq *%rax
304b: 83 f8 05 cmp $0x5,%eax
304e: 74 16 je 3066 <linktest+0x1d8>
failexit("read lf2");
3050: 48 bf d5 74 00 00 00 movabs $0x74d5,%rdi
3057: 00 00 00
305a: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
3061: 00 00 00
3064: ff d0 callq *%rax
}
close(fd);
3066: 8b 45 fc mov -0x4(%rbp),%eax
3069: 89 c7 mov %eax,%edi
306b: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
3072: 00 00 00
3075: ff d0 callq *%rax
if(link("lf2", "lf2") >= 0){
3077: 48 be 7e 74 00 00 00 movabs $0x747e,%rsi
307e: 00 00 00
3081: 48 bf 7e 74 00 00 00 movabs $0x747e,%rdi
3088: 00 00 00
308b: 48 b8 a9 63 00 00 00 movabs $0x63a9,%rax
3092: 00 00 00
3095: ff d0 callq *%rax
3097: 85 c0 test %eax,%eax
3099: 78 16 js 30b1 <linktest+0x223>
failexit("link lf2 lf2 succeeded! oops");
309b: 48 bf de 74 00 00 00 movabs $0x74de,%rdi
30a2: 00 00 00
30a5: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
30ac: 00 00 00
30af: ff d0 callq *%rax
}
unlink("lf2");
30b1: 48 bf 7e 74 00 00 00 movabs $0x747e,%rdi
30b8: 00 00 00
30bb: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
30c2: 00 00 00
30c5: ff d0 callq *%rax
if(link("lf2", "lf1") >= 0){
30c7: 48 be 7a 74 00 00 00 movabs $0x747a,%rsi
30ce: 00 00 00
30d1: 48 bf 7e 74 00 00 00 movabs $0x747e,%rdi
30d8: 00 00 00
30db: 48 b8 a9 63 00 00 00 movabs $0x63a9,%rax
30e2: 00 00 00
30e5: ff d0 callq *%rax
30e7: 85 c0 test %eax,%eax
30e9: 78 16 js 3101 <linktest+0x273>
failexit("link non-existant succeeded! oops");
30eb: 48 bf 00 75 00 00 00 movabs $0x7500,%rdi
30f2: 00 00 00
30f5: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
30fc: 00 00 00
30ff: ff d0 callq *%rax
}
if(link(".", "lf1") >= 0){
3101: 48 be 7a 74 00 00 00 movabs $0x747a,%rsi
3108: 00 00 00
310b: 48 bf 22 75 00 00 00 movabs $0x7522,%rdi
3112: 00 00 00
3115: 48 b8 a9 63 00 00 00 movabs $0x63a9,%rax
311c: 00 00 00
311f: ff d0 callq *%rax
3121: 85 c0 test %eax,%eax
3123: 78 16 js 313b <linktest+0x2ad>
failexit("link . lf1 succeeded! oops");
3125: 48 bf 24 75 00 00 00 movabs $0x7524,%rdi
312c: 00 00 00
312f: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
3136: 00 00 00
3139: ff d0 callq *%rax
}
printf(1, "linktest ok\n");
313b: 48 be 3f 75 00 00 00 movabs $0x753f,%rsi
3142: 00 00 00
3145: bf 01 00 00 00 mov $0x1,%edi
314a: b8 00 00 00 00 mov $0x0,%eax
314f: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
3156: 00 00 00
3159: ff d2 callq *%rdx
}
315b: 90 nop
315c: c9 leaveq
315d: c3 retq
000000000000315e <concreate>:
// test concurrent create/link/unlink of the same file
void
concreate(void)
{
315e: f3 0f 1e fa endbr64
3162: 55 push %rbp
3163: 48 89 e5 mov %rsp,%rbp
3166: 48 83 ec 50 sub $0x50,%rsp
struct {
ushort inum;
char name[14];
} de;
printf(1, "concreate test\n");
316a: 48 be 4c 75 00 00 00 movabs $0x754c,%rsi
3171: 00 00 00
3174: bf 01 00 00 00 mov $0x1,%edi
3179: b8 00 00 00 00 mov $0x0,%eax
317e: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
3185: 00 00 00
3188: ff d2 callq *%rdx
file[0] = 'C';
318a: c6 45 ed 43 movb $0x43,-0x13(%rbp)
file[2] = '\0';
318e: c6 45 ef 00 movb $0x0,-0x11(%rbp)
for(i = 0; i < 40; i++){
3192: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
3199: e9 55 01 00 00 jmpq 32f3 <concreate+0x195>
file[1] = '0' + i;
319e: 8b 45 fc mov -0x4(%rbp),%eax
31a1: 83 c0 30 add $0x30,%eax
31a4: 88 45 ee mov %al,-0x12(%rbp)
unlink(file);
31a7: 48 8d 45 ed lea -0x13(%rbp),%rax
31ab: 48 89 c7 mov %rax,%rdi
31ae: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
31b5: 00 00 00
31b8: ff d0 callq *%rax
pid = fork();
31ba: 48 b8 00 63 00 00 00 movabs $0x6300,%rax
31c1: 00 00 00
31c4: ff d0 callq *%rax
31c6: 89 45 f0 mov %eax,-0x10(%rbp)
if(pid && (i % 3) == 1){
31c9: 83 7d f0 00 cmpl $0x0,-0x10(%rbp)
31cd: 74 4c je 321b <concreate+0xbd>
31cf: 8b 4d fc mov -0x4(%rbp),%ecx
31d2: 48 63 c1 movslq %ecx,%rax
31d5: 48 69 c0 56 55 55 55 imul $0x55555556,%rax,%rax
31dc: 48 c1 e8 20 shr $0x20,%rax
31e0: 48 89 c2 mov %rax,%rdx
31e3: 89 c8 mov %ecx,%eax
31e5: c1 f8 1f sar $0x1f,%eax
31e8: 29 c2 sub %eax,%edx
31ea: 89 d0 mov %edx,%eax
31ec: 01 c0 add %eax,%eax
31ee: 01 d0 add %edx,%eax
31f0: 29 c1 sub %eax,%ecx
31f2: 89 ca mov %ecx,%edx
31f4: 83 fa 01 cmp $0x1,%edx
31f7: 75 22 jne 321b <concreate+0xbd>
link("C0", file);
31f9: 48 8d 45 ed lea -0x13(%rbp),%rax
31fd: 48 89 c6 mov %rax,%rsi
3200: 48 bf 5c 75 00 00 00 movabs $0x755c,%rdi
3207: 00 00 00
320a: 48 b8 a9 63 00 00 00 movabs $0x63a9,%rax
3211: 00 00 00
3214: ff d0 callq *%rax
3216: e9 b6 00 00 00 jmpq 32d1 <concreate+0x173>
} else if(pid == 0 && (i % 5) == 1){
321b: 83 7d f0 00 cmpl $0x0,-0x10(%rbp)
321f: 75 4b jne 326c <concreate+0x10e>
3221: 8b 4d fc mov -0x4(%rbp),%ecx
3224: 48 63 c1 movslq %ecx,%rax
3227: 48 69 c0 67 66 66 66 imul $0x66666667,%rax,%rax
322e: 48 c1 e8 20 shr $0x20,%rax
3232: 89 c2 mov %eax,%edx
3234: d1 fa sar %edx
3236: 89 c8 mov %ecx,%eax
3238: c1 f8 1f sar $0x1f,%eax
323b: 29 c2 sub %eax,%edx
323d: 89 d0 mov %edx,%eax
323f: c1 e0 02 shl $0x2,%eax
3242: 01 d0 add %edx,%eax
3244: 29 c1 sub %eax,%ecx
3246: 89 ca mov %ecx,%edx
3248: 83 fa 01 cmp $0x1,%edx
324b: 75 1f jne 326c <concreate+0x10e>
link("C0", file);
324d: 48 8d 45 ed lea -0x13(%rbp),%rax
3251: 48 89 c6 mov %rax,%rsi
3254: 48 bf 5c 75 00 00 00 movabs $0x755c,%rdi
325b: 00 00 00
325e: 48 b8 a9 63 00 00 00 movabs $0x63a9,%rax
3265: 00 00 00
3268: ff d0 callq *%rax
326a: eb 65 jmp 32d1 <concreate+0x173>
} else {
fd = open(file, O_CREATE | O_RDWR);
326c: 48 8d 45 ed lea -0x13(%rbp),%rax
3270: be 02 02 00 00 mov $0x202,%esi
3275: 48 89 c7 mov %rax,%rdi
3278: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
327f: 00 00 00
3282: ff d0 callq *%rax
3284: 89 45 f4 mov %eax,-0xc(%rbp)
if(fd < 0){
3287: 83 7d f4 00 cmpl $0x0,-0xc(%rbp)
328b: 79 33 jns 32c0 <concreate+0x162>
printf(1, "concreate create %s failed\n", file);
328d: 48 8d 45 ed lea -0x13(%rbp),%rax
3291: 48 89 c2 mov %rax,%rdx
3294: 48 be 5f 75 00 00 00 movabs $0x755f,%rsi
329b: 00 00 00
329e: bf 01 00 00 00 mov $0x1,%edi
32a3: b8 00 00 00 00 mov $0x0,%eax
32a8: 48 b9 11 66 00 00 00 movabs $0x6611,%rcx
32af: 00 00 00
32b2: ff d1 callq *%rcx
exit();
32b4: 48 b8 0d 63 00 00 00 movabs $0x630d,%rax
32bb: 00 00 00
32be: ff d0 callq *%rax
}
close(fd);
32c0: 8b 45 f4 mov -0xc(%rbp),%eax
32c3: 89 c7 mov %eax,%edi
32c5: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
32cc: 00 00 00
32cf: ff d0 callq *%rax
}
if(pid == 0)
32d1: 83 7d f0 00 cmpl $0x0,-0x10(%rbp)
32d5: 75 0c jne 32e3 <concreate+0x185>
exit();
32d7: 48 b8 0d 63 00 00 00 movabs $0x630d,%rax
32de: 00 00 00
32e1: ff d0 callq *%rax
else
wait();
32e3: 48 b8 1a 63 00 00 00 movabs $0x631a,%rax
32ea: 00 00 00
32ed: ff d0 callq *%rax
for(i = 0; i < 40; i++){
32ef: 83 45 fc 01 addl $0x1,-0x4(%rbp)
32f3: 83 7d fc 27 cmpl $0x27,-0x4(%rbp)
32f7: 0f 8e a1 fe ff ff jle 319e <concreate+0x40>
}
memset(fa, 0, sizeof(fa));
32fd: 48 8d 45 c0 lea -0x40(%rbp),%rax
3301: ba 28 00 00 00 mov $0x28,%edx
3306: be 00 00 00 00 mov $0x0,%esi
330b: 48 89 c7 mov %rax,%rdi
330e: 48 b8 d8 60 00 00 00 movabs $0x60d8,%rax
3315: 00 00 00
3318: ff d0 callq *%rax
fd = open(".", 0);
331a: be 00 00 00 00 mov $0x0,%esi
331f: 48 bf 22 75 00 00 00 movabs $0x7522,%rdi
3326: 00 00 00
3329: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
3330: 00 00 00
3333: ff d0 callq *%rax
3335: 89 45 f4 mov %eax,-0xc(%rbp)
n = 0;
3338: c7 45 f8 00 00 00 00 movl $0x0,-0x8(%rbp)
while(read(fd, &de, sizeof(de)) > 0){
333f: e9 cb 00 00 00 jmpq 340f <concreate+0x2b1>
if(de.inum == 0)
3344: 0f b7 45 b0 movzwl -0x50(%rbp),%eax
3348: 66 85 c0 test %ax,%ax
334b: 75 05 jne 3352 <concreate+0x1f4>
continue;
334d: e9 bd 00 00 00 jmpq 340f <concreate+0x2b1>
if(de.name[0] == 'C' && de.name[2] == '\0'){
3352: 0f b6 45 b2 movzbl -0x4e(%rbp),%eax
3356: 3c 43 cmp $0x43,%al
3358: 0f 85 b1 00 00 00 jne 340f <concreate+0x2b1>
335e: 0f b6 45 b4 movzbl -0x4c(%rbp),%eax
3362: 84 c0 test %al,%al
3364: 0f 85 a5 00 00 00 jne 340f <concreate+0x2b1>
i = de.name[1] - '0';
336a: 0f b6 45 b3 movzbl -0x4d(%rbp),%eax
336e: 0f be c0 movsbl %al,%eax
3371: 83 e8 30 sub $0x30,%eax
3374: 89 45 fc mov %eax,-0x4(%rbp)
if(i < 0 || i >= sizeof(fa)){
3377: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
337b: 78 08 js 3385 <concreate+0x227>
337d: 8b 45 fc mov -0x4(%rbp),%eax
3380: 83 f8 27 cmp $0x27,%eax
3383: 76 37 jbe 33bc <concreate+0x25e>
printf(1, "concreate weird file %s\n", de.name);
3385: 48 8d 45 b0 lea -0x50(%rbp),%rax
3389: 48 83 c0 02 add $0x2,%rax
338d: 48 89 c2 mov %rax,%rdx
3390: 48 be 7b 75 00 00 00 movabs $0x757b,%rsi
3397: 00 00 00
339a: bf 01 00 00 00 mov $0x1,%edi
339f: b8 00 00 00 00 mov $0x0,%eax
33a4: 48 b9 11 66 00 00 00 movabs $0x6611,%rcx
33ab: 00 00 00
33ae: ff d1 callq *%rcx
exit();
33b0: 48 b8 0d 63 00 00 00 movabs $0x630d,%rax
33b7: 00 00 00
33ba: ff d0 callq *%rax
}
if(fa[i]){
33bc: 8b 45 fc mov -0x4(%rbp),%eax
33bf: 48 98 cltq
33c1: 0f b6 44 05 c0 movzbl -0x40(%rbp,%rax,1),%eax
33c6: 84 c0 test %al,%al
33c8: 74 37 je 3401 <concreate+0x2a3>
printf(1, "concreate duplicate file %s\n", de.name);
33ca: 48 8d 45 b0 lea -0x50(%rbp),%rax
33ce: 48 83 c0 02 add $0x2,%rax
33d2: 48 89 c2 mov %rax,%rdx
33d5: 48 be 94 75 00 00 00 movabs $0x7594,%rsi
33dc: 00 00 00
33df: bf 01 00 00 00 mov $0x1,%edi
33e4: b8 00 00 00 00 mov $0x0,%eax
33e9: 48 b9 11 66 00 00 00 movabs $0x6611,%rcx
33f0: 00 00 00
33f3: ff d1 callq *%rcx
exit();
33f5: 48 b8 0d 63 00 00 00 movabs $0x630d,%rax
33fc: 00 00 00
33ff: ff d0 callq *%rax
}
fa[i] = 1;
3401: 8b 45 fc mov -0x4(%rbp),%eax
3404: 48 98 cltq
3406: c6 44 05 c0 01 movb $0x1,-0x40(%rbp,%rax,1)
n++;
340b: 83 45 f8 01 addl $0x1,-0x8(%rbp)
while(read(fd, &de, sizeof(de)) > 0){
340f: 48 8d 4d b0 lea -0x50(%rbp),%rcx
3413: 8b 45 f4 mov -0xc(%rbp),%eax
3416: ba 10 00 00 00 mov $0x10,%edx
341b: 48 89 ce mov %rcx,%rsi
341e: 89 c7 mov %eax,%edi
3420: 48 b8 34 63 00 00 00 movabs $0x6334,%rax
3427: 00 00 00
342a: ff d0 callq *%rax
342c: 85 c0 test %eax,%eax
342e: 0f 8f 10 ff ff ff jg 3344 <concreate+0x1e6>
}
}
close(fd);
3434: 8b 45 f4 mov -0xc(%rbp),%eax
3437: 89 c7 mov %eax,%edi
3439: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
3440: 00 00 00
3443: ff d0 callq *%rax
if(n != 40){
3445: 83 7d f8 28 cmpl $0x28,-0x8(%rbp)
3449: 74 16 je 3461 <concreate+0x303>
failexit("concreate not enough files in directory listing");
344b: 48 bf b8 75 00 00 00 movabs $0x75b8,%rdi
3452: 00 00 00
3455: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
345c: 00 00 00
345f: ff d0 callq *%rax
}
for(i = 0; i < 40; i++){
3461: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
3468: e9 a7 01 00 00 jmpq 3614 <concreate+0x4b6>
file[1] = '0' + i;
346d: 8b 45 fc mov -0x4(%rbp),%eax
3470: 83 c0 30 add $0x30,%eax
3473: 88 45 ee mov %al,-0x12(%rbp)
pid = fork();
3476: 48 b8 00 63 00 00 00 movabs $0x6300,%rax
347d: 00 00 00
3480: ff d0 callq *%rax
3482: 89 45 f0 mov %eax,-0x10(%rbp)
if(pid < 0){
3485: 83 7d f0 00 cmpl $0x0,-0x10(%rbp)
3489: 79 16 jns 34a1 <concreate+0x343>
failexit("fork");
348b: 48 bf b7 6d 00 00 00 movabs $0x6db7,%rdi
3492: 00 00 00
3495: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
349c: 00 00 00
349f: ff d0 callq *%rax
}
if(((i % 3) == 0 && pid == 0) ||
34a1: 8b 4d fc mov -0x4(%rbp),%ecx
34a4: 48 63 c1 movslq %ecx,%rax
34a7: 48 69 c0 56 55 55 55 imul $0x55555556,%rax,%rax
34ae: 48 c1 e8 20 shr $0x20,%rax
34b2: 48 89 c2 mov %rax,%rdx
34b5: 89 c8 mov %ecx,%eax
34b7: c1 f8 1f sar $0x1f,%eax
34ba: 89 d6 mov %edx,%esi
34bc: 29 c6 sub %eax,%esi
34be: 89 f0 mov %esi,%eax
34c0: 89 c2 mov %eax,%edx
34c2: 01 d2 add %edx,%edx
34c4: 01 c2 add %eax,%edx
34c6: 89 c8 mov %ecx,%eax
34c8: 29 d0 sub %edx,%eax
34ca: 85 c0 test %eax,%eax
34cc: 75 06 jne 34d4 <concreate+0x376>
34ce: 83 7d f0 00 cmpl $0x0,-0x10(%rbp)
34d2: 74 38 je 350c <concreate+0x3ae>
((i % 3) == 1 && pid != 0)){
34d4: 8b 4d fc mov -0x4(%rbp),%ecx
34d7: 48 63 c1 movslq %ecx,%rax
34da: 48 69 c0 56 55 55 55 imul $0x55555556,%rax,%rax
34e1: 48 c1 e8 20 shr $0x20,%rax
34e5: 48 89 c2 mov %rax,%rdx
34e8: 89 c8 mov %ecx,%eax
34ea: c1 f8 1f sar $0x1f,%eax
34ed: 29 c2 sub %eax,%edx
34ef: 89 d0 mov %edx,%eax
34f1: 01 c0 add %eax,%eax
34f3: 01 d0 add %edx,%eax
34f5: 29 c1 sub %eax,%ecx
34f7: 89 ca mov %ecx,%edx
if(((i % 3) == 0 && pid == 0) ||
34f9: 83 fa 01 cmp $0x1,%edx
34fc: 0f 85 a4 00 00 00 jne 35a6 <concreate+0x448>
((i % 3) == 1 && pid != 0)){
3502: 83 7d f0 00 cmpl $0x0,-0x10(%rbp)
3506: 0f 84 9a 00 00 00 je 35a6 <concreate+0x448>
close(open(file, 0));
350c: 48 8d 45 ed lea -0x13(%rbp),%rax
3510: be 00 00 00 00 mov $0x0,%esi
3515: 48 89 c7 mov %rax,%rdi
3518: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
351f: 00 00 00
3522: ff d0 callq *%rax
3524: 89 c7 mov %eax,%edi
3526: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
352d: 00 00 00
3530: ff d0 callq *%rax
close(open(file, 0));
3532: 48 8d 45 ed lea -0x13(%rbp),%rax
3536: be 00 00 00 00 mov $0x0,%esi
353b: 48 89 c7 mov %rax,%rdi
353e: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
3545: 00 00 00
3548: ff d0 callq *%rax
354a: 89 c7 mov %eax,%edi
354c: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
3553: 00 00 00
3556: ff d0 callq *%rax
close(open(file, 0));
3558: 48 8d 45 ed lea -0x13(%rbp),%rax
355c: be 00 00 00 00 mov $0x0,%esi
3561: 48 89 c7 mov %rax,%rdi
3564: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
356b: 00 00 00
356e: ff d0 callq *%rax
3570: 89 c7 mov %eax,%edi
3572: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
3579: 00 00 00
357c: ff d0 callq *%rax
close(open(file, 0));
357e: 48 8d 45 ed lea -0x13(%rbp),%rax
3582: be 00 00 00 00 mov $0x0,%esi
3587: 48 89 c7 mov %rax,%rdi
358a: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
3591: 00 00 00
3594: ff d0 callq *%rax
3596: 89 c7 mov %eax,%edi
3598: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
359f: 00 00 00
35a2: ff d0 callq *%rax
35a4: eb 4c jmp 35f2 <concreate+0x494>
} else {
unlink(file);
35a6: 48 8d 45 ed lea -0x13(%rbp),%rax
35aa: 48 89 c7 mov %rax,%rdi
35ad: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
35b4: 00 00 00
35b7: ff d0 callq *%rax
unlink(file);
35b9: 48 8d 45 ed lea -0x13(%rbp),%rax
35bd: 48 89 c7 mov %rax,%rdi
35c0: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
35c7: 00 00 00
35ca: ff d0 callq *%rax
unlink(file);
35cc: 48 8d 45 ed lea -0x13(%rbp),%rax
35d0: 48 89 c7 mov %rax,%rdi
35d3: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
35da: 00 00 00
35dd: ff d0 callq *%rax
unlink(file);
35df: 48 8d 45 ed lea -0x13(%rbp),%rax
35e3: 48 89 c7 mov %rax,%rdi
35e6: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
35ed: 00 00 00
35f0: ff d0 callq *%rax
}
if(pid == 0)
35f2: 83 7d f0 00 cmpl $0x0,-0x10(%rbp)
35f6: 75 0c jne 3604 <concreate+0x4a6>
exit();
35f8: 48 b8 0d 63 00 00 00 movabs $0x630d,%rax
35ff: 00 00 00
3602: ff d0 callq *%rax
else
wait();
3604: 48 b8 1a 63 00 00 00 movabs $0x631a,%rax
360b: 00 00 00
360e: ff d0 callq *%rax
for(i = 0; i < 40; i++){
3610: 83 45 fc 01 addl $0x1,-0x4(%rbp)
3614: 83 7d fc 27 cmpl $0x27,-0x4(%rbp)
3618: 0f 8e 4f fe ff ff jle 346d <concreate+0x30f>
}
printf(1, "concreate ok\n");
361e: 48 be e8 75 00 00 00 movabs $0x75e8,%rsi
3625: 00 00 00
3628: bf 01 00 00 00 mov $0x1,%edi
362d: b8 00 00 00 00 mov $0x0,%eax
3632: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
3639: 00 00 00
363c: ff d2 callq *%rdx
}
363e: 90 nop
363f: c9 leaveq
3640: c3 retq
0000000000003641 <linkunlink>:
// another concurrent link/unlink/create test,
// to look for deadlocks.
void
linkunlink()
{
3641: f3 0f 1e fa endbr64
3645: 55 push %rbp
3646: 48 89 e5 mov %rsp,%rbp
3649: 48 83 ec 10 sub $0x10,%rsp
int pid, i;
printf(1, "linkunlink test\n");
364d: 48 be f6 75 00 00 00 movabs $0x75f6,%rsi
3654: 00 00 00
3657: bf 01 00 00 00 mov $0x1,%edi
365c: b8 00 00 00 00 mov $0x0,%eax
3661: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
3668: 00 00 00
366b: ff d2 callq *%rdx
unlink("x");
366d: 48 bf a6 71 00 00 00 movabs $0x71a6,%rdi
3674: 00 00 00
3677: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
367e: 00 00 00
3681: ff d0 callq *%rax
pid = fork();
3683: 48 b8 00 63 00 00 00 movabs $0x6300,%rax
368a: 00 00 00
368d: ff d0 callq *%rax
368f: 89 45 f4 mov %eax,-0xc(%rbp)
if(pid < 0){
3692: 83 7d f4 00 cmpl $0x0,-0xc(%rbp)
3696: 79 16 jns 36ae <linkunlink+0x6d>
failexit("fork");
3698: 48 bf b7 6d 00 00 00 movabs $0x6db7,%rdi
369f: 00 00 00
36a2: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
36a9: 00 00 00
36ac: ff d0 callq *%rax
}
unsigned int x = (pid ? 1 : 97);
36ae: 83 7d f4 00 cmpl $0x0,-0xc(%rbp)
36b2: 74 07 je 36bb <linkunlink+0x7a>
36b4: b8 01 00 00 00 mov $0x1,%eax
36b9: eb 05 jmp 36c0 <linkunlink+0x7f>
36bb: b8 61 00 00 00 mov $0x61,%eax
36c0: 89 45 f8 mov %eax,-0x8(%rbp)
for(i = 0; i < 100; i++){
36c3: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
36ca: e9 bf 00 00 00 jmpq 378e <linkunlink+0x14d>
x = x * 1103515245 + 12345;
36cf: 8b 45 f8 mov -0x8(%rbp),%eax
36d2: 69 c0 6d 4e c6 41 imul $0x41c64e6d,%eax,%eax
36d8: 05 39 30 00 00 add $0x3039,%eax
36dd: 89 45 f8 mov %eax,-0x8(%rbp)
if((x % 3) == 0){
36e0: 8b 4d f8 mov -0x8(%rbp),%ecx
36e3: 89 ca mov %ecx,%edx
36e5: b8 ab aa aa aa mov $0xaaaaaaab,%eax
36ea: 48 0f af c2 imul %rdx,%rax
36ee: 48 c1 e8 20 shr $0x20,%rax
36f2: d1 e8 shr %eax
36f4: 89 c2 mov %eax,%edx
36f6: 01 d2 add %edx,%edx
36f8: 01 c2 add %eax,%edx
36fa: 89 c8 mov %ecx,%eax
36fc: 29 d0 sub %edx,%eax
36fe: 85 c0 test %eax,%eax
3700: 75 2b jne 372d <linkunlink+0xec>
close(open("x", O_RDWR | O_CREATE));
3702: be 02 02 00 00 mov $0x202,%esi
3707: 48 bf a6 71 00 00 00 movabs $0x71a6,%rdi
370e: 00 00 00
3711: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
3718: 00 00 00
371b: ff d0 callq *%rax
371d: 89 c7 mov %eax,%edi
371f: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
3726: 00 00 00
3729: ff d0 callq *%rax
372b: eb 5d jmp 378a <linkunlink+0x149>
} else if((x % 3) == 1){
372d: 8b 4d f8 mov -0x8(%rbp),%ecx
3730: 89 ca mov %ecx,%edx
3732: b8 ab aa aa aa mov $0xaaaaaaab,%eax
3737: 48 0f af c2 imul %rdx,%rax
373b: 48 c1 e8 20 shr $0x20,%rax
373f: 89 c2 mov %eax,%edx
3741: d1 ea shr %edx
3743: 89 d0 mov %edx,%eax
3745: 01 c0 add %eax,%eax
3747: 01 d0 add %edx,%eax
3749: 29 c1 sub %eax,%ecx
374b: 89 ca mov %ecx,%edx
374d: 83 fa 01 cmp $0x1,%edx
3750: 75 22 jne 3774 <linkunlink+0x133>
link("cat", "x");
3752: 48 be a6 71 00 00 00 movabs $0x71a6,%rsi
3759: 00 00 00
375c: 48 bf 07 76 00 00 00 movabs $0x7607,%rdi
3763: 00 00 00
3766: 48 b8 a9 63 00 00 00 movabs $0x63a9,%rax
376d: 00 00 00
3770: ff d0 callq *%rax
3772: eb 16 jmp 378a <linkunlink+0x149>
} else {
unlink("x");
3774: 48 bf a6 71 00 00 00 movabs $0x71a6,%rdi
377b: 00 00 00
377e: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
3785: 00 00 00
3788: ff d0 callq *%rax
for(i = 0; i < 100; i++){
378a: 83 45 fc 01 addl $0x1,-0x4(%rbp)
378e: 83 7d fc 63 cmpl $0x63,-0x4(%rbp)
3792: 0f 8e 37 ff ff ff jle 36cf <linkunlink+0x8e>
}
}
if(pid)
3798: 83 7d f4 00 cmpl $0x0,-0xc(%rbp)
379c: 74 0e je 37ac <linkunlink+0x16b>
wait();
379e: 48 b8 1a 63 00 00 00 movabs $0x631a,%rax
37a5: 00 00 00
37a8: ff d0 callq *%rax
37aa: eb 0c jmp 37b8 <linkunlink+0x177>
else
exit();
37ac: 48 b8 0d 63 00 00 00 movabs $0x630d,%rax
37b3: 00 00 00
37b6: ff d0 callq *%rax
printf(1, "linkunlink ok\n");
37b8: 48 be 0b 76 00 00 00 movabs $0x760b,%rsi
37bf: 00 00 00
37c2: bf 01 00 00 00 mov $0x1,%edi
37c7: b8 00 00 00 00 mov $0x0,%eax
37cc: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
37d3: 00 00 00
37d6: ff d2 callq *%rdx
}
37d8: 90 nop
37d9: c9 leaveq
37da: c3 retq
00000000000037db <bigdir>:
// directory that uses indirect blocks
void
bigdir(void)
{
37db: f3 0f 1e fa endbr64
37df: 55 push %rbp
37e0: 48 89 e5 mov %rsp,%rbp
37e3: 48 83 ec 20 sub $0x20,%rsp
int i, fd;
char name[10];
printf(1, "bigdir test\n");
37e7: 48 be 1a 76 00 00 00 movabs $0x761a,%rsi
37ee: 00 00 00
37f1: bf 01 00 00 00 mov $0x1,%edi
37f6: b8 00 00 00 00 mov $0x0,%eax
37fb: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
3802: 00 00 00
3805: ff d2 callq *%rdx
unlink("bd");
3807: 48 bf 27 76 00 00 00 movabs $0x7627,%rdi
380e: 00 00 00
3811: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
3818: 00 00 00
381b: ff d0 callq *%rax
fd = open("bd", O_CREATE);
381d: be 00 02 00 00 mov $0x200,%esi
3822: 48 bf 27 76 00 00 00 movabs $0x7627,%rdi
3829: 00 00 00
382c: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
3833: 00 00 00
3836: ff d0 callq *%rax
3838: 89 45 f8 mov %eax,-0x8(%rbp)
if(fd < 0){
383b: 83 7d f8 00 cmpl $0x0,-0x8(%rbp)
383f: 79 16 jns 3857 <bigdir+0x7c>
failexit("bigdir create");
3841: 48 bf 2a 76 00 00 00 movabs $0x762a,%rdi
3848: 00 00 00
384b: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
3852: 00 00 00
3855: ff d0 callq *%rax
}
close(fd);
3857: 8b 45 f8 mov -0x8(%rbp),%eax
385a: 89 c7 mov %eax,%edi
385c: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
3863: 00 00 00
3866: ff d0 callq *%rax
for(i = 0; i < 500; i++){
3868: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
386f: eb 6b jmp 38dc <bigdir+0x101>
name[0] = 'x';
3871: c6 45 ee 78 movb $0x78,-0x12(%rbp)
name[1] = '0' + (i / 64);
3875: 8b 45 fc mov -0x4(%rbp),%eax
3878: 8d 50 3f lea 0x3f(%rax),%edx
387b: 85 c0 test %eax,%eax
387d: 0f 48 c2 cmovs %edx,%eax
3880: c1 f8 06 sar $0x6,%eax
3883: 83 c0 30 add $0x30,%eax
3886: 88 45 ef mov %al,-0x11(%rbp)
name[2] = '0' + (i % 64);
3889: 8b 45 fc mov -0x4(%rbp),%eax
388c: 99 cltd
388d: c1 ea 1a shr $0x1a,%edx
3890: 01 d0 add %edx,%eax
3892: 83 e0 3f and $0x3f,%eax
3895: 29 d0 sub %edx,%eax
3897: 83 c0 30 add $0x30,%eax
389a: 88 45 f0 mov %al,-0x10(%rbp)
name[3] = '\0';
389d: c6 45 f1 00 movb $0x0,-0xf(%rbp)
if(link("bd", name) != 0){
38a1: 48 8d 45 ee lea -0x12(%rbp),%rax
38a5: 48 89 c6 mov %rax,%rsi
38a8: 48 bf 27 76 00 00 00 movabs $0x7627,%rdi
38af: 00 00 00
38b2: 48 b8 a9 63 00 00 00 movabs $0x63a9,%rax
38b9: 00 00 00
38bc: ff d0 callq *%rax
38be: 85 c0 test %eax,%eax
38c0: 74 16 je 38d8 <bigdir+0xfd>
failexit("bigdir link");
38c2: 48 bf 38 76 00 00 00 movabs $0x7638,%rdi
38c9: 00 00 00
38cc: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
38d3: 00 00 00
38d6: ff d0 callq *%rax
for(i = 0; i < 500; i++){
38d8: 83 45 fc 01 addl $0x1,-0x4(%rbp)
38dc: 81 7d fc f3 01 00 00 cmpl $0x1f3,-0x4(%rbp)
38e3: 7e 8c jle 3871 <bigdir+0x96>
}
}
unlink("bd");
38e5: 48 bf 27 76 00 00 00 movabs $0x7627,%rdi
38ec: 00 00 00
38ef: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
38f6: 00 00 00
38f9: ff d0 callq *%rax
for(i = 0; i < 500; i++){
38fb: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
3902: eb 61 jmp 3965 <bigdir+0x18a>
name[0] = 'x';
3904: c6 45 ee 78 movb $0x78,-0x12(%rbp)
name[1] = '0' + (i / 64);
3908: 8b 45 fc mov -0x4(%rbp),%eax
390b: 8d 50 3f lea 0x3f(%rax),%edx
390e: 85 c0 test %eax,%eax
3910: 0f 48 c2 cmovs %edx,%eax
3913: c1 f8 06 sar $0x6,%eax
3916: 83 c0 30 add $0x30,%eax
3919: 88 45 ef mov %al,-0x11(%rbp)
name[2] = '0' + (i % 64);
391c: 8b 45 fc mov -0x4(%rbp),%eax
391f: 99 cltd
3920: c1 ea 1a shr $0x1a,%edx
3923: 01 d0 add %edx,%eax
3925: 83 e0 3f and $0x3f,%eax
3928: 29 d0 sub %edx,%eax
392a: 83 c0 30 add $0x30,%eax
392d: 88 45 f0 mov %al,-0x10(%rbp)
name[3] = '\0';
3930: c6 45 f1 00 movb $0x0,-0xf(%rbp)
if(unlink(name) != 0){
3934: 48 8d 45 ee lea -0x12(%rbp),%rax
3938: 48 89 c7 mov %rax,%rdi
393b: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
3942: 00 00 00
3945: ff d0 callq *%rax
3947: 85 c0 test %eax,%eax
3949: 74 16 je 3961 <bigdir+0x186>
failexit("bigdir unlink failed");
394b: 48 bf 44 76 00 00 00 movabs $0x7644,%rdi
3952: 00 00 00
3955: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
395c: 00 00 00
395f: ff d0 callq *%rax
for(i = 0; i < 500; i++){
3961: 83 45 fc 01 addl $0x1,-0x4(%rbp)
3965: 81 7d fc f3 01 00 00 cmpl $0x1f3,-0x4(%rbp)
396c: 7e 96 jle 3904 <bigdir+0x129>
}
}
printf(1, "bigdir ok\n");
396e: 48 be 59 76 00 00 00 movabs $0x7659,%rsi
3975: 00 00 00
3978: bf 01 00 00 00 mov $0x1,%edi
397d: b8 00 00 00 00 mov $0x0,%eax
3982: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
3989: 00 00 00
398c: ff d2 callq *%rdx
}
398e: 90 nop
398f: c9 leaveq
3990: c3 retq
0000000000003991 <subdir>:
void
subdir(void)
{
3991: f3 0f 1e fa endbr64
3995: 55 push %rbp
3996: 48 89 e5 mov %rsp,%rbp
3999: 48 83 ec 10 sub $0x10,%rsp
int fd, cc;
printf(1, "subdir test\n");
399d: 48 be 64 76 00 00 00 movabs $0x7664,%rsi
39a4: 00 00 00
39a7: bf 01 00 00 00 mov $0x1,%edi
39ac: b8 00 00 00 00 mov $0x0,%eax
39b1: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
39b8: 00 00 00
39bb: ff d2 callq *%rdx
unlink("ff");
39bd: 48 bf 71 76 00 00 00 movabs $0x7671,%rdi
39c4: 00 00 00
39c7: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
39ce: 00 00 00
39d1: ff d0 callq *%rax
if(mkdir("dd") != 0){
39d3: 48 bf 74 76 00 00 00 movabs $0x7674,%rdi
39da: 00 00 00
39dd: 48 b8 b6 63 00 00 00 movabs $0x63b6,%rax
39e4: 00 00 00
39e7: ff d0 callq *%rax
39e9: 85 c0 test %eax,%eax
39eb: 74 16 je 3a03 <subdir+0x72>
failexit("subdir mkdir dd");
39ed: 48 bf 77 76 00 00 00 movabs $0x7677,%rdi
39f4: 00 00 00
39f7: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
39fe: 00 00 00
3a01: ff d0 callq *%rax
}
fd = open("dd/ff", O_CREATE | O_RDWR);
3a03: be 02 02 00 00 mov $0x202,%esi
3a08: 48 bf 87 76 00 00 00 movabs $0x7687,%rdi
3a0f: 00 00 00
3a12: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
3a19: 00 00 00
3a1c: ff d0 callq *%rax
3a1e: 89 45 fc mov %eax,-0x4(%rbp)
if(fd < 0){
3a21: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
3a25: 79 16 jns 3a3d <subdir+0xac>
failexit("create dd/ff");
3a27: 48 bf 8d 76 00 00 00 movabs $0x768d,%rdi
3a2e: 00 00 00
3a31: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
3a38: 00 00 00
3a3b: ff d0 callq *%rax
}
write(fd, "ff", 2);
3a3d: 8b 45 fc mov -0x4(%rbp),%eax
3a40: ba 02 00 00 00 mov $0x2,%edx
3a45: 48 be 71 76 00 00 00 movabs $0x7671,%rsi
3a4c: 00 00 00
3a4f: 89 c7 mov %eax,%edi
3a51: 48 b8 41 63 00 00 00 movabs $0x6341,%rax
3a58: 00 00 00
3a5b: ff d0 callq *%rax
close(fd);
3a5d: 8b 45 fc mov -0x4(%rbp),%eax
3a60: 89 c7 mov %eax,%edi
3a62: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
3a69: 00 00 00
3a6c: ff d0 callq *%rax
if(unlink("dd") >= 0){
3a6e: 48 bf 74 76 00 00 00 movabs $0x7674,%rdi
3a75: 00 00 00
3a78: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
3a7f: 00 00 00
3a82: ff d0 callq *%rax
3a84: 85 c0 test %eax,%eax
3a86: 78 16 js 3a9e <subdir+0x10d>
failexit("unlink dd (non-empty dir) succeeded!");
3a88: 48 bf a0 76 00 00 00 movabs $0x76a0,%rdi
3a8f: 00 00 00
3a92: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
3a99: 00 00 00
3a9c: ff d0 callq *%rax
}
if(mkdir("/dd/dd") != 0){
3a9e: 48 bf c5 76 00 00 00 movabs $0x76c5,%rdi
3aa5: 00 00 00
3aa8: 48 b8 b6 63 00 00 00 movabs $0x63b6,%rax
3aaf: 00 00 00
3ab2: ff d0 callq *%rax
3ab4: 85 c0 test %eax,%eax
3ab6: 74 16 je 3ace <subdir+0x13d>
failexit("subdir mkdir dd/dd");
3ab8: 48 bf cc 76 00 00 00 movabs $0x76cc,%rdi
3abf: 00 00 00
3ac2: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
3ac9: 00 00 00
3acc: ff d0 callq *%rax
}
fd = open("dd/dd/ff", O_CREATE | O_RDWR);
3ace: be 02 02 00 00 mov $0x202,%esi
3ad3: 48 bf df 76 00 00 00 movabs $0x76df,%rdi
3ada: 00 00 00
3add: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
3ae4: 00 00 00
3ae7: ff d0 callq *%rax
3ae9: 89 45 fc mov %eax,-0x4(%rbp)
if(fd < 0){
3aec: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
3af0: 79 16 jns 3b08 <subdir+0x177>
failexit("create dd/dd/ff");
3af2: 48 bf e8 76 00 00 00 movabs $0x76e8,%rdi
3af9: 00 00 00
3afc: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
3b03: 00 00 00
3b06: ff d0 callq *%rax
}
write(fd, "FF", 2);
3b08: 8b 45 fc mov -0x4(%rbp),%eax
3b0b: ba 02 00 00 00 mov $0x2,%edx
3b10: 48 be f8 76 00 00 00 movabs $0x76f8,%rsi
3b17: 00 00 00
3b1a: 89 c7 mov %eax,%edi
3b1c: 48 b8 41 63 00 00 00 movabs $0x6341,%rax
3b23: 00 00 00
3b26: ff d0 callq *%rax
close(fd);
3b28: 8b 45 fc mov -0x4(%rbp),%eax
3b2b: 89 c7 mov %eax,%edi
3b2d: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
3b34: 00 00 00
3b37: ff d0 callq *%rax
fd = open("dd/dd/../ff", 0);
3b39: be 00 00 00 00 mov $0x0,%esi
3b3e: 48 bf fb 76 00 00 00 movabs $0x76fb,%rdi
3b45: 00 00 00
3b48: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
3b4f: 00 00 00
3b52: ff d0 callq *%rax
3b54: 89 45 fc mov %eax,-0x4(%rbp)
if(fd < 0){
3b57: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
3b5b: 79 16 jns 3b73 <subdir+0x1e2>
failexit("open dd/dd/../ff");
3b5d: 48 bf 07 77 00 00 00 movabs $0x7707,%rdi
3b64: 00 00 00
3b67: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
3b6e: 00 00 00
3b71: ff d0 callq *%rax
}
cc = read(fd, buf, sizeof(buf));
3b73: 8b 45 fc mov -0x4(%rbp),%eax
3b76: ba 00 20 00 00 mov $0x2000,%edx
3b7b: 48 be 20 8c 00 00 00 movabs $0x8c20,%rsi
3b82: 00 00 00
3b85: 89 c7 mov %eax,%edi
3b87: 48 b8 34 63 00 00 00 movabs $0x6334,%rax
3b8e: 00 00 00
3b91: ff d0 callq *%rax
3b93: 89 45 f8 mov %eax,-0x8(%rbp)
if(cc != 2 || buf[0] != 'f'){
3b96: 83 7d f8 02 cmpl $0x2,-0x8(%rbp)
3b9a: 75 11 jne 3bad <subdir+0x21c>
3b9c: 48 b8 20 8c 00 00 00 movabs $0x8c20,%rax
3ba3: 00 00 00
3ba6: 0f b6 00 movzbl (%rax),%eax
3ba9: 3c 66 cmp $0x66,%al
3bab: 74 16 je 3bc3 <subdir+0x232>
failexit("dd/dd/../ff wrong content");
3bad: 48 bf 18 77 00 00 00 movabs $0x7718,%rdi
3bb4: 00 00 00
3bb7: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
3bbe: 00 00 00
3bc1: ff d0 callq *%rax
}
close(fd);
3bc3: 8b 45 fc mov -0x4(%rbp),%eax
3bc6: 89 c7 mov %eax,%edi
3bc8: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
3bcf: 00 00 00
3bd2: ff d0 callq *%rax
if(link("dd/dd/ff", "dd/dd/ffff") != 0){
3bd4: 48 be 32 77 00 00 00 movabs $0x7732,%rsi
3bdb: 00 00 00
3bde: 48 bf df 76 00 00 00 movabs $0x76df,%rdi
3be5: 00 00 00
3be8: 48 b8 a9 63 00 00 00 movabs $0x63a9,%rax
3bef: 00 00 00
3bf2: ff d0 callq *%rax
3bf4: 85 c0 test %eax,%eax
3bf6: 74 16 je 3c0e <subdir+0x27d>
failexit("link dd/dd/ff dd/dd/ffff");
3bf8: 48 bf 3d 77 00 00 00 movabs $0x773d,%rdi
3bff: 00 00 00
3c02: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
3c09: 00 00 00
3c0c: ff d0 callq *%rax
}
if(unlink("dd/dd/ff") != 0){
3c0e: 48 bf df 76 00 00 00 movabs $0x76df,%rdi
3c15: 00 00 00
3c18: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
3c1f: 00 00 00
3c22: ff d0 callq *%rax
3c24: 85 c0 test %eax,%eax
3c26: 74 16 je 3c3e <subdir+0x2ad>
failexit("unlink dd/dd/ff");
3c28: 48 bf 56 77 00 00 00 movabs $0x7756,%rdi
3c2f: 00 00 00
3c32: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
3c39: 00 00 00
3c3c: ff d0 callq *%rax
}
if(open("dd/dd/ff", O_RDONLY) >= 0){
3c3e: be 00 00 00 00 mov $0x0,%esi
3c43: 48 bf df 76 00 00 00 movabs $0x76df,%rdi
3c4a: 00 00 00
3c4d: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
3c54: 00 00 00
3c57: ff d0 callq *%rax
3c59: 85 c0 test %eax,%eax
3c5b: 78 16 js 3c73 <subdir+0x2e2>
failexit("open (unlinked) dd/dd/ff succeeded");
3c5d: 48 bf 68 77 00 00 00 movabs $0x7768,%rdi
3c64: 00 00 00
3c67: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
3c6e: 00 00 00
3c71: ff d0 callq *%rax
}
if(chdir("dd") != 0){
3c73: 48 bf 74 76 00 00 00 movabs $0x7674,%rdi
3c7a: 00 00 00
3c7d: 48 b8 c3 63 00 00 00 movabs $0x63c3,%rax
3c84: 00 00 00
3c87: ff d0 callq *%rax
3c89: 85 c0 test %eax,%eax
3c8b: 74 16 je 3ca3 <subdir+0x312>
failexit("chdir dd");
3c8d: 48 bf 8b 77 00 00 00 movabs $0x778b,%rdi
3c94: 00 00 00
3c97: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
3c9e: 00 00 00
3ca1: ff d0 callq *%rax
}
if(chdir("dd/../../dd") != 0){
3ca3: 48 bf 94 77 00 00 00 movabs $0x7794,%rdi
3caa: 00 00 00
3cad: 48 b8 c3 63 00 00 00 movabs $0x63c3,%rax
3cb4: 00 00 00
3cb7: ff d0 callq *%rax
3cb9: 85 c0 test %eax,%eax
3cbb: 74 16 je 3cd3 <subdir+0x342>
failexit("chdir dd/../../dd");
3cbd: 48 bf a0 77 00 00 00 movabs $0x77a0,%rdi
3cc4: 00 00 00
3cc7: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
3cce: 00 00 00
3cd1: ff d0 callq *%rax
}
if(chdir("dd/../../../dd") != 0){
3cd3: 48 bf b2 77 00 00 00 movabs $0x77b2,%rdi
3cda: 00 00 00
3cdd: 48 b8 c3 63 00 00 00 movabs $0x63c3,%rax
3ce4: 00 00 00
3ce7: ff d0 callq *%rax
3ce9: 85 c0 test %eax,%eax
3ceb: 74 16 je 3d03 <subdir+0x372>
failexit("chdir dd/../../dd");
3ced: 48 bf a0 77 00 00 00 movabs $0x77a0,%rdi
3cf4: 00 00 00
3cf7: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
3cfe: 00 00 00
3d01: ff d0 callq *%rax
}
if(chdir("./..") != 0){
3d03: 48 bf c1 77 00 00 00 movabs $0x77c1,%rdi
3d0a: 00 00 00
3d0d: 48 b8 c3 63 00 00 00 movabs $0x63c3,%rax
3d14: 00 00 00
3d17: ff d0 callq *%rax
3d19: 85 c0 test %eax,%eax
3d1b: 74 16 je 3d33 <subdir+0x3a2>
failexit("chdir ./..");
3d1d: 48 bf c6 77 00 00 00 movabs $0x77c6,%rdi
3d24: 00 00 00
3d27: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
3d2e: 00 00 00
3d31: ff d0 callq *%rax
}
fd = open("dd/dd/ffff", 0);
3d33: be 00 00 00 00 mov $0x0,%esi
3d38: 48 bf 32 77 00 00 00 movabs $0x7732,%rdi
3d3f: 00 00 00
3d42: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
3d49: 00 00 00
3d4c: ff d0 callq *%rax
3d4e: 89 45 fc mov %eax,-0x4(%rbp)
if(fd < 0){
3d51: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
3d55: 79 16 jns 3d6d <subdir+0x3dc>
failexit("open dd/dd/ffff");
3d57: 48 bf d1 77 00 00 00 movabs $0x77d1,%rdi
3d5e: 00 00 00
3d61: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
3d68: 00 00 00
3d6b: ff d0 callq *%rax
}
if(read(fd, buf, sizeof(buf)) != 2){
3d6d: 8b 45 fc mov -0x4(%rbp),%eax
3d70: ba 00 20 00 00 mov $0x2000,%edx
3d75: 48 be 20 8c 00 00 00 movabs $0x8c20,%rsi
3d7c: 00 00 00
3d7f: 89 c7 mov %eax,%edi
3d81: 48 b8 34 63 00 00 00 movabs $0x6334,%rax
3d88: 00 00 00
3d8b: ff d0 callq *%rax
3d8d: 83 f8 02 cmp $0x2,%eax
3d90: 74 16 je 3da8 <subdir+0x417>
failexit("read dd/dd/ffff wrong len");
3d92: 48 bf e1 77 00 00 00 movabs $0x77e1,%rdi
3d99: 00 00 00
3d9c: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
3da3: 00 00 00
3da6: ff d0 callq *%rax
}
close(fd);
3da8: 8b 45 fc mov -0x4(%rbp),%eax
3dab: 89 c7 mov %eax,%edi
3dad: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
3db4: 00 00 00
3db7: ff d0 callq *%rax
if(open("dd/dd/ff", O_RDONLY) >= 0){
3db9: be 00 00 00 00 mov $0x0,%esi
3dbe: 48 bf df 76 00 00 00 movabs $0x76df,%rdi
3dc5: 00 00 00
3dc8: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
3dcf: 00 00 00
3dd2: ff d0 callq *%rax
3dd4: 85 c0 test %eax,%eax
3dd6: 78 16 js 3dee <subdir+0x45d>
failexit("open (unlinked) dd/dd/ff succeeded");
3dd8: 48 bf 68 77 00 00 00 movabs $0x7768,%rdi
3ddf: 00 00 00
3de2: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
3de9: 00 00 00
3dec: ff d0 callq *%rax
}
if(open("dd/ff/ff", O_CREATE|O_RDWR) >= 0){
3dee: be 02 02 00 00 mov $0x202,%esi
3df3: 48 bf fb 77 00 00 00 movabs $0x77fb,%rdi
3dfa: 00 00 00
3dfd: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
3e04: 00 00 00
3e07: ff d0 callq *%rax
3e09: 85 c0 test %eax,%eax
3e0b: 78 16 js 3e23 <subdir+0x492>
failexit("create dd/ff/ff succeeded");
3e0d: 48 bf 04 78 00 00 00 movabs $0x7804,%rdi
3e14: 00 00 00
3e17: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
3e1e: 00 00 00
3e21: ff d0 callq *%rax
}
if(open("dd/xx/ff", O_CREATE|O_RDWR) >= 0){
3e23: be 02 02 00 00 mov $0x202,%esi
3e28: 48 bf 1e 78 00 00 00 movabs $0x781e,%rdi
3e2f: 00 00 00
3e32: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
3e39: 00 00 00
3e3c: ff d0 callq *%rax
3e3e: 85 c0 test %eax,%eax
3e40: 78 16 js 3e58 <subdir+0x4c7>
failexit("create dd/xx/ff succeeded");
3e42: 48 bf 27 78 00 00 00 movabs $0x7827,%rdi
3e49: 00 00 00
3e4c: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
3e53: 00 00 00
3e56: ff d0 callq *%rax
}
if(open("dd", O_CREATE) >= 0){
3e58: be 00 02 00 00 mov $0x200,%esi
3e5d: 48 bf 74 76 00 00 00 movabs $0x7674,%rdi
3e64: 00 00 00
3e67: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
3e6e: 00 00 00
3e71: ff d0 callq *%rax
3e73: 85 c0 test %eax,%eax
3e75: 78 16 js 3e8d <subdir+0x4fc>
failexit("create dd succeeded");
3e77: 48 bf 41 78 00 00 00 movabs $0x7841,%rdi
3e7e: 00 00 00
3e81: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
3e88: 00 00 00
3e8b: ff d0 callq *%rax
}
if(open("dd", O_RDWR) >= 0){
3e8d: be 02 00 00 00 mov $0x2,%esi
3e92: 48 bf 74 76 00 00 00 movabs $0x7674,%rdi
3e99: 00 00 00
3e9c: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
3ea3: 00 00 00
3ea6: ff d0 callq *%rax
3ea8: 85 c0 test %eax,%eax
3eaa: 78 16 js 3ec2 <subdir+0x531>
failexit("open dd rdwr succeeded");
3eac: 48 bf 55 78 00 00 00 movabs $0x7855,%rdi
3eb3: 00 00 00
3eb6: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
3ebd: 00 00 00
3ec0: ff d0 callq *%rax
}
if(open("dd", O_WRONLY) >= 0){
3ec2: be 01 00 00 00 mov $0x1,%esi
3ec7: 48 bf 74 76 00 00 00 movabs $0x7674,%rdi
3ece: 00 00 00
3ed1: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
3ed8: 00 00 00
3edb: ff d0 callq *%rax
3edd: 85 c0 test %eax,%eax
3edf: 78 16 js 3ef7 <subdir+0x566>
failexit("open dd wronly succeeded");
3ee1: 48 bf 6c 78 00 00 00 movabs $0x786c,%rdi
3ee8: 00 00 00
3eeb: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
3ef2: 00 00 00
3ef5: ff d0 callq *%rax
}
if(link("dd/ff/ff", "dd/dd/xx") == 0){
3ef7: 48 be 85 78 00 00 00 movabs $0x7885,%rsi
3efe: 00 00 00
3f01: 48 bf fb 77 00 00 00 movabs $0x77fb,%rdi
3f08: 00 00 00
3f0b: 48 b8 a9 63 00 00 00 movabs $0x63a9,%rax
3f12: 00 00 00
3f15: ff d0 callq *%rax
3f17: 85 c0 test %eax,%eax
3f19: 75 16 jne 3f31 <subdir+0x5a0>
failexit("link dd/ff/ff dd/dd/xx succeeded");
3f1b: 48 bf 90 78 00 00 00 movabs $0x7890,%rdi
3f22: 00 00 00
3f25: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
3f2c: 00 00 00
3f2f: ff d0 callq *%rax
}
if(link("dd/xx/ff", "dd/dd/xx") == 0){
3f31: 48 be 85 78 00 00 00 movabs $0x7885,%rsi
3f38: 00 00 00
3f3b: 48 bf 1e 78 00 00 00 movabs $0x781e,%rdi
3f42: 00 00 00
3f45: 48 b8 a9 63 00 00 00 movabs $0x63a9,%rax
3f4c: 00 00 00
3f4f: ff d0 callq *%rax
3f51: 85 c0 test %eax,%eax
3f53: 75 16 jne 3f6b <subdir+0x5da>
failexit("link dd/xx/ff dd/dd/xx succeededn");
3f55: 48 bf b8 78 00 00 00 movabs $0x78b8,%rdi
3f5c: 00 00 00
3f5f: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
3f66: 00 00 00
3f69: ff d0 callq *%rax
}
if(link("dd/ff", "dd/dd/ffff") == 0){
3f6b: 48 be 32 77 00 00 00 movabs $0x7732,%rsi
3f72: 00 00 00
3f75: 48 bf 87 76 00 00 00 movabs $0x7687,%rdi
3f7c: 00 00 00
3f7f: 48 b8 a9 63 00 00 00 movabs $0x63a9,%rax
3f86: 00 00 00
3f89: ff d0 callq *%rax
3f8b: 85 c0 test %eax,%eax
3f8d: 75 16 jne 3fa5 <subdir+0x614>
failexit("link dd/ff dd/dd/ffff succeeded");
3f8f: 48 bf e0 78 00 00 00 movabs $0x78e0,%rdi
3f96: 00 00 00
3f99: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
3fa0: 00 00 00
3fa3: ff d0 callq *%rax
}
if(mkdir("dd/ff/ff") == 0){
3fa5: 48 bf fb 77 00 00 00 movabs $0x77fb,%rdi
3fac: 00 00 00
3faf: 48 b8 b6 63 00 00 00 movabs $0x63b6,%rax
3fb6: 00 00 00
3fb9: ff d0 callq *%rax
3fbb: 85 c0 test %eax,%eax
3fbd: 75 16 jne 3fd5 <subdir+0x644>
failexit("mkdir dd/ff/ff succeeded");
3fbf: 48 bf 00 79 00 00 00 movabs $0x7900,%rdi
3fc6: 00 00 00
3fc9: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
3fd0: 00 00 00
3fd3: ff d0 callq *%rax
}
if(mkdir("dd/xx/ff") == 0){
3fd5: 48 bf 1e 78 00 00 00 movabs $0x781e,%rdi
3fdc: 00 00 00
3fdf: 48 b8 b6 63 00 00 00 movabs $0x63b6,%rax
3fe6: 00 00 00
3fe9: ff d0 callq *%rax
3feb: 85 c0 test %eax,%eax
3fed: 75 16 jne 4005 <subdir+0x674>
failexit("mkdir dd/xx/ff succeeded");
3fef: 48 bf 19 79 00 00 00 movabs $0x7919,%rdi
3ff6: 00 00 00
3ff9: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
4000: 00 00 00
4003: ff d0 callq *%rax
}
if(mkdir("dd/dd/ffff") == 0){
4005: 48 bf 32 77 00 00 00 movabs $0x7732,%rdi
400c: 00 00 00
400f: 48 b8 b6 63 00 00 00 movabs $0x63b6,%rax
4016: 00 00 00
4019: ff d0 callq *%rax
401b: 85 c0 test %eax,%eax
401d: 75 16 jne 4035 <subdir+0x6a4>
failexit("mkdir dd/dd/ffff succeeded");
401f: 48 bf 32 79 00 00 00 movabs $0x7932,%rdi
4026: 00 00 00
4029: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
4030: 00 00 00
4033: ff d0 callq *%rax
}
if(unlink("dd/xx/ff") == 0){
4035: 48 bf 1e 78 00 00 00 movabs $0x781e,%rdi
403c: 00 00 00
403f: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
4046: 00 00 00
4049: ff d0 callq *%rax
404b: 85 c0 test %eax,%eax
404d: 75 16 jne 4065 <subdir+0x6d4>
failexit("unlink dd/xx/ff succeeded");
404f: 48 bf 4d 79 00 00 00 movabs $0x794d,%rdi
4056: 00 00 00
4059: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
4060: 00 00 00
4063: ff d0 callq *%rax
}
if(unlink("dd/ff/ff") == 0){
4065: 48 bf fb 77 00 00 00 movabs $0x77fb,%rdi
406c: 00 00 00
406f: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
4076: 00 00 00
4079: ff d0 callq *%rax
407b: 85 c0 test %eax,%eax
407d: 75 16 jne 4095 <subdir+0x704>
failexit("unlink dd/ff/ff succeeded");
407f: 48 bf 67 79 00 00 00 movabs $0x7967,%rdi
4086: 00 00 00
4089: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
4090: 00 00 00
4093: ff d0 callq *%rax
}
if(chdir("dd/ff") == 0){
4095: 48 bf 87 76 00 00 00 movabs $0x7687,%rdi
409c: 00 00 00
409f: 48 b8 c3 63 00 00 00 movabs $0x63c3,%rax
40a6: 00 00 00
40a9: ff d0 callq *%rax
40ab: 85 c0 test %eax,%eax
40ad: 75 16 jne 40c5 <subdir+0x734>
failexit("chdir dd/ff succeeded");
40af: 48 bf 81 79 00 00 00 movabs $0x7981,%rdi
40b6: 00 00 00
40b9: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
40c0: 00 00 00
40c3: ff d0 callq *%rax
}
if(chdir("dd/xx") == 0){
40c5: 48 bf 97 79 00 00 00 movabs $0x7997,%rdi
40cc: 00 00 00
40cf: 48 b8 c3 63 00 00 00 movabs $0x63c3,%rax
40d6: 00 00 00
40d9: ff d0 callq *%rax
40db: 85 c0 test %eax,%eax
40dd: 75 16 jne 40f5 <subdir+0x764>
failexit("chdir dd/xx succeeded");
40df: 48 bf 9d 79 00 00 00 movabs $0x799d,%rdi
40e6: 00 00 00
40e9: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
40f0: 00 00 00
40f3: ff d0 callq *%rax
}
if(unlink("dd/dd/ffff") != 0){
40f5: 48 bf 32 77 00 00 00 movabs $0x7732,%rdi
40fc: 00 00 00
40ff: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
4106: 00 00 00
4109: ff d0 callq *%rax
410b: 85 c0 test %eax,%eax
410d: 74 16 je 4125 <subdir+0x794>
failexit("unlink dd/dd/ff");
410f: 48 bf 56 77 00 00 00 movabs $0x7756,%rdi
4116: 00 00 00
4119: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
4120: 00 00 00
4123: ff d0 callq *%rax
}
if(unlink("dd/ff") != 0){
4125: 48 bf 87 76 00 00 00 movabs $0x7687,%rdi
412c: 00 00 00
412f: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
4136: 00 00 00
4139: ff d0 callq *%rax
413b: 85 c0 test %eax,%eax
413d: 74 16 je 4155 <subdir+0x7c4>
failexit("unlink dd/ff");
413f: 48 bf b3 79 00 00 00 movabs $0x79b3,%rdi
4146: 00 00 00
4149: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
4150: 00 00 00
4153: ff d0 callq *%rax
}
if(unlink("dd") == 0){
4155: 48 bf 74 76 00 00 00 movabs $0x7674,%rdi
415c: 00 00 00
415f: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
4166: 00 00 00
4169: ff d0 callq *%rax
416b: 85 c0 test %eax,%eax
416d: 75 16 jne 4185 <subdir+0x7f4>
failexit("unlink non-empty dd succeeded");
416f: 48 bf c0 79 00 00 00 movabs $0x79c0,%rdi
4176: 00 00 00
4179: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
4180: 00 00 00
4183: ff d0 callq *%rax
}
if(unlink("dd/dd") < 0){
4185: 48 bf de 79 00 00 00 movabs $0x79de,%rdi
418c: 00 00 00
418f: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
4196: 00 00 00
4199: ff d0 callq *%rax
419b: 85 c0 test %eax,%eax
419d: 79 16 jns 41b5 <subdir+0x824>
failexit("unlink dd/dd");
419f: 48 bf e4 79 00 00 00 movabs $0x79e4,%rdi
41a6: 00 00 00
41a9: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
41b0: 00 00 00
41b3: ff d0 callq *%rax
}
if(unlink("dd") < 0){
41b5: 48 bf 74 76 00 00 00 movabs $0x7674,%rdi
41bc: 00 00 00
41bf: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
41c6: 00 00 00
41c9: ff d0 callq *%rax
41cb: 85 c0 test %eax,%eax
41cd: 79 16 jns 41e5 <subdir+0x854>
failexit("unlink dd");
41cf: 48 bf f1 79 00 00 00 movabs $0x79f1,%rdi
41d6: 00 00 00
41d9: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
41e0: 00 00 00
41e3: ff d0 callq *%rax
}
printf(1, "subdir ok\n");
41e5: 48 be fb 79 00 00 00 movabs $0x79fb,%rsi
41ec: 00 00 00
41ef: bf 01 00 00 00 mov $0x1,%edi
41f4: b8 00 00 00 00 mov $0x0,%eax
41f9: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
4200: 00 00 00
4203: ff d2 callq *%rdx
}
4205: 90 nop
4206: c9 leaveq
4207: c3 retq
0000000000004208 <bigwrite>:
// test writes that are larger than the log.
void
bigwrite(void)
{
4208: f3 0f 1e fa endbr64
420c: 55 push %rbp
420d: 48 89 e5 mov %rsp,%rbp
4210: 48 83 ec 10 sub $0x10,%rsp
int fd, sz;
printf(1, "bigwrite test\n");
4214: 48 be 06 7a 00 00 00 movabs $0x7a06,%rsi
421b: 00 00 00
421e: bf 01 00 00 00 mov $0x1,%edi
4223: b8 00 00 00 00 mov $0x0,%eax
4228: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
422f: 00 00 00
4232: ff d2 callq *%rdx
unlink("bigwrite");
4234: 48 bf 15 7a 00 00 00 movabs $0x7a15,%rdi
423b: 00 00 00
423e: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
4245: 00 00 00
4248: ff d0 callq *%rax
for(sz = 499; sz < 12*512; sz += 471){
424a: c7 45 fc f3 01 00 00 movl $0x1f3,-0x4(%rbp)
4251: e9 db 00 00 00 jmpq 4331 <bigwrite+0x129>
fd = open("bigwrite", O_CREATE | O_RDWR);
4256: be 02 02 00 00 mov $0x202,%esi
425b: 48 bf 15 7a 00 00 00 movabs $0x7a15,%rdi
4262: 00 00 00
4265: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
426c: 00 00 00
426f: ff d0 callq *%rax
4271: 89 45 f4 mov %eax,-0xc(%rbp)
if(fd < 0){
4274: 83 7d f4 00 cmpl $0x0,-0xc(%rbp)
4278: 79 16 jns 4290 <bigwrite+0x88>
failexit("cannot create bigwrite");
427a: 48 bf 1e 7a 00 00 00 movabs $0x7a1e,%rdi
4281: 00 00 00
4284: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
428b: 00 00 00
428e: ff d0 callq *%rax
}
int i;
for(i = 0; i < 2; i++){
4290: c7 45 f8 00 00 00 00 movl $0x0,-0x8(%rbp)
4297: eb 64 jmp 42fd <bigwrite+0xf5>
int cc = write(fd, buf, sz);
4299: 8b 55 fc mov -0x4(%rbp),%edx
429c: 8b 45 f4 mov -0xc(%rbp),%eax
429f: 48 be 20 8c 00 00 00 movabs $0x8c20,%rsi
42a6: 00 00 00
42a9: 89 c7 mov %eax,%edi
42ab: 48 b8 41 63 00 00 00 movabs $0x6341,%rax
42b2: 00 00 00
42b5: ff d0 callq *%rax
42b7: 89 45 f0 mov %eax,-0x10(%rbp)
if(cc != sz){
42ba: 8b 45 f0 mov -0x10(%rbp),%eax
42bd: 3b 45 fc cmp -0x4(%rbp),%eax
42c0: 74 37 je 42f9 <bigwrite+0xf1>
printf(1, "write(%d) ret %d\n", sz, cc);
42c2: 8b 55 f0 mov -0x10(%rbp),%edx
42c5: 8b 45 fc mov -0x4(%rbp),%eax
42c8: 89 d1 mov %edx,%ecx
42ca: 89 c2 mov %eax,%edx
42cc: 48 be 35 7a 00 00 00 movabs $0x7a35,%rsi
42d3: 00 00 00
42d6: bf 01 00 00 00 mov $0x1,%edi
42db: b8 00 00 00 00 mov $0x0,%eax
42e0: 49 b8 11 66 00 00 00 movabs $0x6611,%r8
42e7: 00 00 00
42ea: 41 ff d0 callq *%r8
exit();
42ed: 48 b8 0d 63 00 00 00 movabs $0x630d,%rax
42f4: 00 00 00
42f7: ff d0 callq *%rax
for(i = 0; i < 2; i++){
42f9: 83 45 f8 01 addl $0x1,-0x8(%rbp)
42fd: 83 7d f8 01 cmpl $0x1,-0x8(%rbp)
4301: 7e 96 jle 4299 <bigwrite+0x91>
}
}
close(fd);
4303: 8b 45 f4 mov -0xc(%rbp),%eax
4306: 89 c7 mov %eax,%edi
4308: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
430f: 00 00 00
4312: ff d0 callq *%rax
unlink("bigwrite");
4314: 48 bf 15 7a 00 00 00 movabs $0x7a15,%rdi
431b: 00 00 00
431e: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
4325: 00 00 00
4328: ff d0 callq *%rax
for(sz = 499; sz < 12*512; sz += 471){
432a: 81 45 fc d7 01 00 00 addl $0x1d7,-0x4(%rbp)
4331: 81 7d fc ff 17 00 00 cmpl $0x17ff,-0x4(%rbp)
4338: 0f 8e 18 ff ff ff jle 4256 <bigwrite+0x4e>
}
printf(1, "bigwrite ok\n");
433e: 48 be 47 7a 00 00 00 movabs $0x7a47,%rsi
4345: 00 00 00
4348: bf 01 00 00 00 mov $0x1,%edi
434d: b8 00 00 00 00 mov $0x0,%eax
4352: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
4359: 00 00 00
435c: ff d2 callq *%rdx
}
435e: 90 nop
435f: c9 leaveq
4360: c3 retq
0000000000004361 <bigfile>:
void
bigfile(void)
{
4361: f3 0f 1e fa endbr64
4365: 55 push %rbp
4366: 48 89 e5 mov %rsp,%rbp
4369: 48 83 ec 10 sub $0x10,%rsp
int fd, i, total, cc;
printf(1, "bigfile test\n");
436d: 48 be 54 7a 00 00 00 movabs $0x7a54,%rsi
4374: 00 00 00
4377: bf 01 00 00 00 mov $0x1,%edi
437c: b8 00 00 00 00 mov $0x0,%eax
4381: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
4388: 00 00 00
438b: ff d2 callq *%rdx
unlink("bigfile");
438d: 48 bf 62 7a 00 00 00 movabs $0x7a62,%rdi
4394: 00 00 00
4397: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
439e: 00 00 00
43a1: ff d0 callq *%rax
fd = open("bigfile", O_CREATE | O_RDWR);
43a3: be 02 02 00 00 mov $0x202,%esi
43a8: 48 bf 62 7a 00 00 00 movabs $0x7a62,%rdi
43af: 00 00 00
43b2: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
43b9: 00 00 00
43bc: ff d0 callq *%rax
43be: 89 45 f4 mov %eax,-0xc(%rbp)
if(fd < 0){
43c1: 83 7d f4 00 cmpl $0x0,-0xc(%rbp)
43c5: 79 16 jns 43dd <bigfile+0x7c>
failexit("cannot create bigfile");
43c7: 48 bf 6a 7a 00 00 00 movabs $0x7a6a,%rdi
43ce: 00 00 00
43d1: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
43d8: 00 00 00
43db: ff d0 callq *%rax
}
for(i = 0; i < 20; i++){
43dd: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
43e4: eb 61 jmp 4447 <bigfile+0xe6>
memset(buf, i, 600);
43e6: 8b 45 fc mov -0x4(%rbp),%eax
43e9: ba 58 02 00 00 mov $0x258,%edx
43ee: 89 c6 mov %eax,%esi
43f0: 48 bf 20 8c 00 00 00 movabs $0x8c20,%rdi
43f7: 00 00 00
43fa: 48 b8 d8 60 00 00 00 movabs $0x60d8,%rax
4401: 00 00 00
4404: ff d0 callq *%rax
if(write(fd, buf, 600) != 600){
4406: 8b 45 f4 mov -0xc(%rbp),%eax
4409: ba 58 02 00 00 mov $0x258,%edx
440e: 48 be 20 8c 00 00 00 movabs $0x8c20,%rsi
4415: 00 00 00
4418: 89 c7 mov %eax,%edi
441a: 48 b8 41 63 00 00 00 movabs $0x6341,%rax
4421: 00 00 00
4424: ff d0 callq *%rax
4426: 3d 58 02 00 00 cmp $0x258,%eax
442b: 74 16 je 4443 <bigfile+0xe2>
failexit("write bigfile");
442d: 48 bf 80 7a 00 00 00 movabs $0x7a80,%rdi
4434: 00 00 00
4437: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
443e: 00 00 00
4441: ff d0 callq *%rax
for(i = 0; i < 20; i++){
4443: 83 45 fc 01 addl $0x1,-0x4(%rbp)
4447: 83 7d fc 13 cmpl $0x13,-0x4(%rbp)
444b: 7e 99 jle 43e6 <bigfile+0x85>
}
}
close(fd);
444d: 8b 45 f4 mov -0xc(%rbp),%eax
4450: 89 c7 mov %eax,%edi
4452: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
4459: 00 00 00
445c: ff d0 callq *%rax
fd = open("bigfile", 0);
445e: be 00 00 00 00 mov $0x0,%esi
4463: 48 bf 62 7a 00 00 00 movabs $0x7a62,%rdi
446a: 00 00 00
446d: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
4474: 00 00 00
4477: ff d0 callq *%rax
4479: 89 45 f4 mov %eax,-0xc(%rbp)
if(fd < 0){
447c: 83 7d f4 00 cmpl $0x0,-0xc(%rbp)
4480: 79 16 jns 4498 <bigfile+0x137>
failexit("cannot open bigfile");
4482: 48 bf 8e 7a 00 00 00 movabs $0x7a8e,%rdi
4489: 00 00 00
448c: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
4493: 00 00 00
4496: ff d0 callq *%rax
}
total = 0;
4498: c7 45 f8 00 00 00 00 movl $0x0,-0x8(%rbp)
for(i = 0; ; i++){
449f: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
cc = read(fd, buf, 300);
44a6: 8b 45 f4 mov -0xc(%rbp),%eax
44a9: ba 2c 01 00 00 mov $0x12c,%edx
44ae: 48 be 20 8c 00 00 00 movabs $0x8c20,%rsi
44b5: 00 00 00
44b8: 89 c7 mov %eax,%edi
44ba: 48 b8 34 63 00 00 00 movabs $0x6334,%rax
44c1: 00 00 00
44c4: ff d0 callq *%rax
44c6: 89 45 f0 mov %eax,-0x10(%rbp)
if(cc < 0){
44c9: 83 7d f0 00 cmpl $0x0,-0x10(%rbp)
44cd: 79 16 jns 44e5 <bigfile+0x184>
failexit("read bigfile");
44cf: 48 bf a2 7a 00 00 00 movabs $0x7aa2,%rdi
44d6: 00 00 00
44d9: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
44e0: 00 00 00
44e3: ff d0 callq *%rax
}
if(cc == 0)
44e5: 83 7d f0 00 cmpl $0x0,-0x10(%rbp)
44e9: 0f 84 88 00 00 00 je 4577 <bigfile+0x216>
break;
if(cc != 300){
44ef: 81 7d f0 2c 01 00 00 cmpl $0x12c,-0x10(%rbp)
44f6: 74 16 je 450e <bigfile+0x1ad>
failexit("short read bigfile");
44f8: 48 bf af 7a 00 00 00 movabs $0x7aaf,%rdi
44ff: 00 00 00
4502: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
4509: 00 00 00
450c: ff d0 callq *%rax
}
if(buf[0] != i/2 || buf[299] != i/2){
450e: 48 b8 20 8c 00 00 00 movabs $0x8c20,%rax
4515: 00 00 00
4518: 0f b6 00 movzbl (%rax),%eax
451b: 0f be d0 movsbl %al,%edx
451e: 8b 45 fc mov -0x4(%rbp),%eax
4521: 89 c1 mov %eax,%ecx
4523: c1 e9 1f shr $0x1f,%ecx
4526: 01 c8 add %ecx,%eax
4528: d1 f8 sar %eax
452a: 39 c2 cmp %eax,%edx
452c: 75 24 jne 4552 <bigfile+0x1f1>
452e: 48 b8 20 8c 00 00 00 movabs $0x8c20,%rax
4535: 00 00 00
4538: 0f b6 80 2b 01 00 00 movzbl 0x12b(%rax),%eax
453f: 0f be d0 movsbl %al,%edx
4542: 8b 45 fc mov -0x4(%rbp),%eax
4545: 89 c1 mov %eax,%ecx
4547: c1 e9 1f shr $0x1f,%ecx
454a: 01 c8 add %ecx,%eax
454c: d1 f8 sar %eax
454e: 39 c2 cmp %eax,%edx
4550: 74 16 je 4568 <bigfile+0x207>
failexit("read bigfile wrong data");
4552: 48 bf c2 7a 00 00 00 movabs $0x7ac2,%rdi
4559: 00 00 00
455c: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
4563: 00 00 00
4566: ff d0 callq *%rax
}
total += cc;
4568: 8b 45 f0 mov -0x10(%rbp),%eax
456b: 01 45 f8 add %eax,-0x8(%rbp)
for(i = 0; ; i++){
456e: 83 45 fc 01 addl $0x1,-0x4(%rbp)
cc = read(fd, buf, 300);
4572: e9 2f ff ff ff jmpq 44a6 <bigfile+0x145>
break;
4577: 90 nop
}
close(fd);
4578: 8b 45 f4 mov -0xc(%rbp),%eax
457b: 89 c7 mov %eax,%edi
457d: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
4584: 00 00 00
4587: ff d0 callq *%rax
if(total != 20*600){
4589: 81 7d f8 e0 2e 00 00 cmpl $0x2ee0,-0x8(%rbp)
4590: 74 16 je 45a8 <bigfile+0x247>
failexit("read bigfile wrong total");
4592: 48 bf da 7a 00 00 00 movabs $0x7ada,%rdi
4599: 00 00 00
459c: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
45a3: 00 00 00
45a6: ff d0 callq *%rax
}
unlink("bigfile");
45a8: 48 bf 62 7a 00 00 00 movabs $0x7a62,%rdi
45af: 00 00 00
45b2: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
45b9: 00 00 00
45bc: ff d0 callq *%rax
printf(1, "bigfile test ok\n");
45be: 48 be f3 7a 00 00 00 movabs $0x7af3,%rsi
45c5: 00 00 00
45c8: bf 01 00 00 00 mov $0x1,%edi
45cd: b8 00 00 00 00 mov $0x0,%eax
45d2: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
45d9: 00 00 00
45dc: ff d2 callq *%rdx
}
45de: 90 nop
45df: c9 leaveq
45e0: c3 retq
00000000000045e1 <fourteen>:
void
fourteen(void)
{
45e1: f3 0f 1e fa endbr64
45e5: 55 push %rbp
45e6: 48 89 e5 mov %rsp,%rbp
45e9: 48 83 ec 10 sub $0x10,%rsp
int fd;
// DIRSIZ is 14.
printf(1, "fourteen test\n");
45ed: 48 be 04 7b 00 00 00 movabs $0x7b04,%rsi
45f4: 00 00 00
45f7: bf 01 00 00 00 mov $0x1,%edi
45fc: b8 00 00 00 00 mov $0x0,%eax
4601: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
4608: 00 00 00
460b: ff d2 callq *%rdx
if(mkdir("12345678901234") != 0){
460d: 48 bf 13 7b 00 00 00 movabs $0x7b13,%rdi
4614: 00 00 00
4617: 48 b8 b6 63 00 00 00 movabs $0x63b6,%rax
461e: 00 00 00
4621: ff d0 callq *%rax
4623: 85 c0 test %eax,%eax
4625: 74 16 je 463d <fourteen+0x5c>
failexit("mkdir 12345678901234");
4627: 48 bf 22 7b 00 00 00 movabs $0x7b22,%rdi
462e: 00 00 00
4631: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
4638: 00 00 00
463b: ff d0 callq *%rax
}
if(mkdir("12345678901234/123456789012345") != 0){
463d: 48 bf 38 7b 00 00 00 movabs $0x7b38,%rdi
4644: 00 00 00
4647: 48 b8 b6 63 00 00 00 movabs $0x63b6,%rax
464e: 00 00 00
4651: ff d0 callq *%rax
4653: 85 c0 test %eax,%eax
4655: 74 16 je 466d <fourteen+0x8c>
failexit("mkdir 12345678901234/123456789012345");
4657: 48 bf 58 7b 00 00 00 movabs $0x7b58,%rdi
465e: 00 00 00
4661: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
4668: 00 00 00
466b: ff d0 callq *%rax
}
fd = open("123456789012345/123456789012345/123456789012345", O_CREATE);
466d: be 00 02 00 00 mov $0x200,%esi
4672: 48 bf 80 7b 00 00 00 movabs $0x7b80,%rdi
4679: 00 00 00
467c: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
4683: 00 00 00
4686: ff d0 callq *%rax
4688: 89 45 fc mov %eax,-0x4(%rbp)
if(fd < 0){
468b: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
468f: 79 16 jns 46a7 <fourteen+0xc6>
failexit("create 123456789012345/123456789012345/123456789012345");
4691: 48 bf b0 7b 00 00 00 movabs $0x7bb0,%rdi
4698: 00 00 00
469b: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
46a2: 00 00 00
46a5: ff d0 callq *%rax
}
close(fd);
46a7: 8b 45 fc mov -0x4(%rbp),%eax
46aa: 89 c7 mov %eax,%edi
46ac: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
46b3: 00 00 00
46b6: ff d0 callq *%rax
fd = open("12345678901234/12345678901234/12345678901234", 0);
46b8: be 00 00 00 00 mov $0x0,%esi
46bd: 48 bf e8 7b 00 00 00 movabs $0x7be8,%rdi
46c4: 00 00 00
46c7: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
46ce: 00 00 00
46d1: ff d0 callq *%rax
46d3: 89 45 fc mov %eax,-0x4(%rbp)
if(fd < 0){
46d6: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
46da: 79 16 jns 46f2 <fourteen+0x111>
failexit("open 12345678901234/12345678901234/12345678901234");
46dc: 48 bf 18 7c 00 00 00 movabs $0x7c18,%rdi
46e3: 00 00 00
46e6: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
46ed: 00 00 00
46f0: ff d0 callq *%rax
}
close(fd);
46f2: 8b 45 fc mov -0x4(%rbp),%eax
46f5: 89 c7 mov %eax,%edi
46f7: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
46fe: 00 00 00
4701: ff d0 callq *%rax
if(mkdir("12345678901234/12345678901234") == 0){
4703: 48 bf 4a 7c 00 00 00 movabs $0x7c4a,%rdi
470a: 00 00 00
470d: 48 b8 b6 63 00 00 00 movabs $0x63b6,%rax
4714: 00 00 00
4717: ff d0 callq *%rax
4719: 85 c0 test %eax,%eax
471b: 75 16 jne 4733 <fourteen+0x152>
failexit("mkdir 12345678901234/12345678901234 succeeded");
471d: 48 bf 68 7c 00 00 00 movabs $0x7c68,%rdi
4724: 00 00 00
4727: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
472e: 00 00 00
4731: ff d0 callq *%rax
}
if(mkdir("123456789012345/12345678901234") == 0){
4733: 48 bf 98 7c 00 00 00 movabs $0x7c98,%rdi
473a: 00 00 00
473d: 48 b8 b6 63 00 00 00 movabs $0x63b6,%rax
4744: 00 00 00
4747: ff d0 callq *%rax
4749: 85 c0 test %eax,%eax
474b: 75 16 jne 4763 <fourteen+0x182>
failexit("mkdir 12345678901234/123456789012345 succeeded");
474d: 48 bf b8 7c 00 00 00 movabs $0x7cb8,%rdi
4754: 00 00 00
4757: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
475e: 00 00 00
4761: ff d0 callq *%rax
}
printf(1, "fourteen ok\n");
4763: 48 be e7 7c 00 00 00 movabs $0x7ce7,%rsi
476a: 00 00 00
476d: bf 01 00 00 00 mov $0x1,%edi
4772: b8 00 00 00 00 mov $0x0,%eax
4777: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
477e: 00 00 00
4781: ff d2 callq *%rdx
}
4783: 90 nop
4784: c9 leaveq
4785: c3 retq
0000000000004786 <rmdot>:
void
rmdot(void)
{
4786: f3 0f 1e fa endbr64
478a: 55 push %rbp
478b: 48 89 e5 mov %rsp,%rbp
printf(1, "rmdot test\n");
478e: 48 be f4 7c 00 00 00 movabs $0x7cf4,%rsi
4795: 00 00 00
4798: bf 01 00 00 00 mov $0x1,%edi
479d: b8 00 00 00 00 mov $0x0,%eax
47a2: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
47a9: 00 00 00
47ac: ff d2 callq *%rdx
if(mkdir("dots") != 0){
47ae: 48 bf 00 7d 00 00 00 movabs $0x7d00,%rdi
47b5: 00 00 00
47b8: 48 b8 b6 63 00 00 00 movabs $0x63b6,%rax
47bf: 00 00 00
47c2: ff d0 callq *%rax
47c4: 85 c0 test %eax,%eax
47c6: 74 16 je 47de <rmdot+0x58>
failexit("mkdir dots");
47c8: 48 bf 05 7d 00 00 00 movabs $0x7d05,%rdi
47cf: 00 00 00
47d2: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
47d9: 00 00 00
47dc: ff d0 callq *%rax
}
if(chdir("dots") != 0){
47de: 48 bf 00 7d 00 00 00 movabs $0x7d00,%rdi
47e5: 00 00 00
47e8: 48 b8 c3 63 00 00 00 movabs $0x63c3,%rax
47ef: 00 00 00
47f2: ff d0 callq *%rax
47f4: 85 c0 test %eax,%eax
47f6: 74 16 je 480e <rmdot+0x88>
failexit("chdir dots");
47f8: 48 bf 10 7d 00 00 00 movabs $0x7d10,%rdi
47ff: 00 00 00
4802: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
4809: 00 00 00
480c: ff d0 callq *%rax
}
if(unlink(".") == 0){
480e: 48 bf 22 75 00 00 00 movabs $0x7522,%rdi
4815: 00 00 00
4818: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
481f: 00 00 00
4822: ff d0 callq *%rax
4824: 85 c0 test %eax,%eax
4826: 75 16 jne 483e <rmdot+0xb8>
failexit("rm . worked");
4828: 48 bf 1b 7d 00 00 00 movabs $0x7d1b,%rdi
482f: 00 00 00
4832: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
4839: 00 00 00
483c: ff d0 callq *%rax
}
if(unlink("..") == 0){
483e: 48 bf 9a 70 00 00 00 movabs $0x709a,%rdi
4845: 00 00 00
4848: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
484f: 00 00 00
4852: ff d0 callq *%rax
4854: 85 c0 test %eax,%eax
4856: 75 16 jne 486e <rmdot+0xe8>
failexit("rm .. worked");
4858: 48 bf 27 7d 00 00 00 movabs $0x7d27,%rdi
485f: 00 00 00
4862: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
4869: 00 00 00
486c: ff d0 callq *%rax
}
if(chdir("/") != 0){
486e: 48 bf 90 6d 00 00 00 movabs $0x6d90,%rdi
4875: 00 00 00
4878: 48 b8 c3 63 00 00 00 movabs $0x63c3,%rax
487f: 00 00 00
4882: ff d0 callq *%rax
4884: 85 c0 test %eax,%eax
4886: 74 16 je 489e <rmdot+0x118>
failexit("chdir /");
4888: 48 bf 92 6d 00 00 00 movabs $0x6d92,%rdi
488f: 00 00 00
4892: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
4899: 00 00 00
489c: ff d0 callq *%rax
}
if(unlink("dots/.") == 0){
489e: 48 bf 34 7d 00 00 00 movabs $0x7d34,%rdi
48a5: 00 00 00
48a8: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
48af: 00 00 00
48b2: ff d0 callq *%rax
48b4: 85 c0 test %eax,%eax
48b6: 75 16 jne 48ce <rmdot+0x148>
failexit("unlink dots/. worked");
48b8: 48 bf 3b 7d 00 00 00 movabs $0x7d3b,%rdi
48bf: 00 00 00
48c2: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
48c9: 00 00 00
48cc: ff d0 callq *%rax
}
if(unlink("dots/..") == 0){
48ce: 48 bf 50 7d 00 00 00 movabs $0x7d50,%rdi
48d5: 00 00 00
48d8: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
48df: 00 00 00
48e2: ff d0 callq *%rax
48e4: 85 c0 test %eax,%eax
48e6: 75 16 jne 48fe <rmdot+0x178>
failexit("unlink dots/.. worked");
48e8: 48 bf 58 7d 00 00 00 movabs $0x7d58,%rdi
48ef: 00 00 00
48f2: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
48f9: 00 00 00
48fc: ff d0 callq *%rax
}
if(unlink("dots") != 0){
48fe: 48 bf 00 7d 00 00 00 movabs $0x7d00,%rdi
4905: 00 00 00
4908: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
490f: 00 00 00
4912: ff d0 callq *%rax
4914: 85 c0 test %eax,%eax
4916: 74 16 je 492e <rmdot+0x1a8>
failexit("unlink dots");
4918: 48 bf 6e 7d 00 00 00 movabs $0x7d6e,%rdi
491f: 00 00 00
4922: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
4929: 00 00 00
492c: ff d0 callq *%rax
}
printf(1, "rmdot ok\n");
492e: 48 be 7a 7d 00 00 00 movabs $0x7d7a,%rsi
4935: 00 00 00
4938: bf 01 00 00 00 mov $0x1,%edi
493d: b8 00 00 00 00 mov $0x0,%eax
4942: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
4949: 00 00 00
494c: ff d2 callq *%rdx
}
494e: 90 nop
494f: 5d pop %rbp
4950: c3 retq
0000000000004951 <dirfile>:
void
dirfile(void)
{
4951: f3 0f 1e fa endbr64
4955: 55 push %rbp
4956: 48 89 e5 mov %rsp,%rbp
4959: 48 83 ec 10 sub $0x10,%rsp
int fd;
printf(1, "dir vs file\n");
495d: 48 be 84 7d 00 00 00 movabs $0x7d84,%rsi
4964: 00 00 00
4967: bf 01 00 00 00 mov $0x1,%edi
496c: b8 00 00 00 00 mov $0x0,%eax
4971: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
4978: 00 00 00
497b: ff d2 callq *%rdx
fd = open("dirfile", O_CREATE);
497d: be 00 02 00 00 mov $0x200,%esi
4982: 48 bf 91 7d 00 00 00 movabs $0x7d91,%rdi
4989: 00 00 00
498c: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
4993: 00 00 00
4996: ff d0 callq *%rax
4998: 89 45 fc mov %eax,-0x4(%rbp)
if(fd < 0){
499b: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
499f: 79 16 jns 49b7 <dirfile+0x66>
failexit("create dirfile");
49a1: 48 bf 99 7d 00 00 00 movabs $0x7d99,%rdi
49a8: 00 00 00
49ab: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
49b2: 00 00 00
49b5: ff d0 callq *%rax
}
close(fd);
49b7: 8b 45 fc mov -0x4(%rbp),%eax
49ba: 89 c7 mov %eax,%edi
49bc: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
49c3: 00 00 00
49c6: ff d0 callq *%rax
if(chdir("dirfile") == 0){
49c8: 48 bf 91 7d 00 00 00 movabs $0x7d91,%rdi
49cf: 00 00 00
49d2: 48 b8 c3 63 00 00 00 movabs $0x63c3,%rax
49d9: 00 00 00
49dc: ff d0 callq *%rax
49de: 85 c0 test %eax,%eax
49e0: 75 16 jne 49f8 <dirfile+0xa7>
failexit("chdir dirfile succeeded");
49e2: 48 bf a8 7d 00 00 00 movabs $0x7da8,%rdi
49e9: 00 00 00
49ec: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
49f3: 00 00 00
49f6: ff d0 callq *%rax
}
fd = open("dirfile/xx", 0);
49f8: be 00 00 00 00 mov $0x0,%esi
49fd: 48 bf c0 7d 00 00 00 movabs $0x7dc0,%rdi
4a04: 00 00 00
4a07: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
4a0e: 00 00 00
4a11: ff d0 callq *%rax
4a13: 89 45 fc mov %eax,-0x4(%rbp)
if(fd >= 0){
4a16: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
4a1a: 78 16 js 4a32 <dirfile+0xe1>
failexit("create dirfile/xx succeeded");
4a1c: 48 bf cb 7d 00 00 00 movabs $0x7dcb,%rdi
4a23: 00 00 00
4a26: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
4a2d: 00 00 00
4a30: ff d0 callq *%rax
}
fd = open("dirfile/xx", O_CREATE);
4a32: be 00 02 00 00 mov $0x200,%esi
4a37: 48 bf c0 7d 00 00 00 movabs $0x7dc0,%rdi
4a3e: 00 00 00
4a41: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
4a48: 00 00 00
4a4b: ff d0 callq *%rax
4a4d: 89 45 fc mov %eax,-0x4(%rbp)
if(fd >= 0){
4a50: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
4a54: 78 16 js 4a6c <dirfile+0x11b>
failexit("create dirfile/xx succeeded");
4a56: 48 bf cb 7d 00 00 00 movabs $0x7dcb,%rdi
4a5d: 00 00 00
4a60: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
4a67: 00 00 00
4a6a: ff d0 callq *%rax
}
if(mkdir("dirfile/xx") == 0){
4a6c: 48 bf c0 7d 00 00 00 movabs $0x7dc0,%rdi
4a73: 00 00 00
4a76: 48 b8 b6 63 00 00 00 movabs $0x63b6,%rax
4a7d: 00 00 00
4a80: ff d0 callq *%rax
4a82: 85 c0 test %eax,%eax
4a84: 75 16 jne 4a9c <dirfile+0x14b>
failexit("mkdir dirfile/xx succeeded");
4a86: 48 bf e7 7d 00 00 00 movabs $0x7de7,%rdi
4a8d: 00 00 00
4a90: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
4a97: 00 00 00
4a9a: ff d0 callq *%rax
}
if(unlink("dirfile/xx") == 0){
4a9c: 48 bf c0 7d 00 00 00 movabs $0x7dc0,%rdi
4aa3: 00 00 00
4aa6: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
4aad: 00 00 00
4ab0: ff d0 callq *%rax
4ab2: 85 c0 test %eax,%eax
4ab4: 75 16 jne 4acc <dirfile+0x17b>
failexit("unlink dirfile/xx succeeded");
4ab6: 48 bf 02 7e 00 00 00 movabs $0x7e02,%rdi
4abd: 00 00 00
4ac0: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
4ac7: 00 00 00
4aca: ff d0 callq *%rax
}
if(link("README", "dirfile/xx") == 0){
4acc: 48 be c0 7d 00 00 00 movabs $0x7dc0,%rsi
4ad3: 00 00 00
4ad6: 48 bf 1e 7e 00 00 00 movabs $0x7e1e,%rdi
4add: 00 00 00
4ae0: 48 b8 a9 63 00 00 00 movabs $0x63a9,%rax
4ae7: 00 00 00
4aea: ff d0 callq *%rax
4aec: 85 c0 test %eax,%eax
4aee: 75 16 jne 4b06 <dirfile+0x1b5>
failexit("link to dirfile/xx succeeded");
4af0: 48 bf 25 7e 00 00 00 movabs $0x7e25,%rdi
4af7: 00 00 00
4afa: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
4b01: 00 00 00
4b04: ff d0 callq *%rax
}
if(unlink("dirfile") != 0){
4b06: 48 bf 91 7d 00 00 00 movabs $0x7d91,%rdi
4b0d: 00 00 00
4b10: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
4b17: 00 00 00
4b1a: ff d0 callq *%rax
4b1c: 85 c0 test %eax,%eax
4b1e: 74 16 je 4b36 <dirfile+0x1e5>
failexit("unlink dirfile");
4b20: 48 bf 42 7e 00 00 00 movabs $0x7e42,%rdi
4b27: 00 00 00
4b2a: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
4b31: 00 00 00
4b34: ff d0 callq *%rax
}
fd = open(".", O_RDWR);
4b36: be 02 00 00 00 mov $0x2,%esi
4b3b: 48 bf 22 75 00 00 00 movabs $0x7522,%rdi
4b42: 00 00 00
4b45: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
4b4c: 00 00 00
4b4f: ff d0 callq *%rax
4b51: 89 45 fc mov %eax,-0x4(%rbp)
if(fd >= 0){
4b54: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
4b58: 78 16 js 4b70 <dirfile+0x21f>
failexit("open . for writing succeeded");
4b5a: 48 bf 51 7e 00 00 00 movabs $0x7e51,%rdi
4b61: 00 00 00
4b64: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
4b6b: 00 00 00
4b6e: ff d0 callq *%rax
}
fd = open(".", 0);
4b70: be 00 00 00 00 mov $0x0,%esi
4b75: 48 bf 22 75 00 00 00 movabs $0x7522,%rdi
4b7c: 00 00 00
4b7f: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
4b86: 00 00 00
4b89: ff d0 callq *%rax
4b8b: 89 45 fc mov %eax,-0x4(%rbp)
if(write(fd, "x", 1) > 0){
4b8e: 8b 45 fc mov -0x4(%rbp),%eax
4b91: ba 01 00 00 00 mov $0x1,%edx
4b96: 48 be a6 71 00 00 00 movabs $0x71a6,%rsi
4b9d: 00 00 00
4ba0: 89 c7 mov %eax,%edi
4ba2: 48 b8 41 63 00 00 00 movabs $0x6341,%rax
4ba9: 00 00 00
4bac: ff d0 callq *%rax
4bae: 85 c0 test %eax,%eax
4bb0: 7e 16 jle 4bc8 <dirfile+0x277>
failexit("write . succeeded");
4bb2: 48 bf 6e 7e 00 00 00 movabs $0x7e6e,%rdi
4bb9: 00 00 00
4bbc: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
4bc3: 00 00 00
4bc6: ff d0 callq *%rax
}
close(fd);
4bc8: 8b 45 fc mov -0x4(%rbp),%eax
4bcb: 89 c7 mov %eax,%edi
4bcd: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
4bd4: 00 00 00
4bd7: ff d0 callq *%rax
printf(1, "dir vs file OK\n");
4bd9: 48 be 80 7e 00 00 00 movabs $0x7e80,%rsi
4be0: 00 00 00
4be3: bf 01 00 00 00 mov $0x1,%edi
4be8: b8 00 00 00 00 mov $0x0,%eax
4bed: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
4bf4: 00 00 00
4bf7: ff d2 callq *%rdx
}
4bf9: 90 nop
4bfa: c9 leaveq
4bfb: c3 retq
0000000000004bfc <iref>:
// test that iput() is called at the end of _namei()
void
iref(void)
{
4bfc: f3 0f 1e fa endbr64
4c00: 55 push %rbp
4c01: 48 89 e5 mov %rsp,%rbp
4c04: 48 83 ec 10 sub $0x10,%rsp
int i, fd;
printf(1, "empty file name\n");
4c08: 48 be 90 7e 00 00 00 movabs $0x7e90,%rsi
4c0f: 00 00 00
4c12: bf 01 00 00 00 mov $0x1,%edi
4c17: b8 00 00 00 00 mov $0x0,%eax
4c1c: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
4c23: 00 00 00
4c26: ff d2 callq *%rdx
// the 50 is NINODE
for(i = 0; i < 50 + 1; i++){
4c28: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
4c2f: e9 1a 01 00 00 jmpq 4d4e <iref+0x152>
if(mkdir("irefd") != 0){
4c34: 48 bf a1 7e 00 00 00 movabs $0x7ea1,%rdi
4c3b: 00 00 00
4c3e: 48 b8 b6 63 00 00 00 movabs $0x63b6,%rax
4c45: 00 00 00
4c48: ff d0 callq *%rax
4c4a: 85 c0 test %eax,%eax
4c4c: 74 16 je 4c64 <iref+0x68>
failexit("mkdir irefd");
4c4e: 48 bf a7 7e 00 00 00 movabs $0x7ea7,%rdi
4c55: 00 00 00
4c58: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
4c5f: 00 00 00
4c62: ff d0 callq *%rax
}
if(chdir("irefd") != 0){
4c64: 48 bf a1 7e 00 00 00 movabs $0x7ea1,%rdi
4c6b: 00 00 00
4c6e: 48 b8 c3 63 00 00 00 movabs $0x63c3,%rax
4c75: 00 00 00
4c78: ff d0 callq *%rax
4c7a: 85 c0 test %eax,%eax
4c7c: 74 16 je 4c94 <iref+0x98>
failexit("chdir irefd");
4c7e: 48 bf b3 7e 00 00 00 movabs $0x7eb3,%rdi
4c85: 00 00 00
4c88: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
4c8f: 00 00 00
4c92: ff d0 callq *%rax
}
mkdir("");
4c94: 48 bf bf 7e 00 00 00 movabs $0x7ebf,%rdi
4c9b: 00 00 00
4c9e: 48 b8 b6 63 00 00 00 movabs $0x63b6,%rax
4ca5: 00 00 00
4ca8: ff d0 callq *%rax
link("README", "");
4caa: 48 be bf 7e 00 00 00 movabs $0x7ebf,%rsi
4cb1: 00 00 00
4cb4: 48 bf 1e 7e 00 00 00 movabs $0x7e1e,%rdi
4cbb: 00 00 00
4cbe: 48 b8 a9 63 00 00 00 movabs $0x63a9,%rax
4cc5: 00 00 00
4cc8: ff d0 callq *%rax
fd = open("", O_CREATE);
4cca: be 00 02 00 00 mov $0x200,%esi
4ccf: 48 bf bf 7e 00 00 00 movabs $0x7ebf,%rdi
4cd6: 00 00 00
4cd9: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
4ce0: 00 00 00
4ce3: ff d0 callq *%rax
4ce5: 89 45 f8 mov %eax,-0x8(%rbp)
if(fd >= 0)
4ce8: 83 7d f8 00 cmpl $0x0,-0x8(%rbp)
4cec: 78 11 js 4cff <iref+0x103>
close(fd);
4cee: 8b 45 f8 mov -0x8(%rbp),%eax
4cf1: 89 c7 mov %eax,%edi
4cf3: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
4cfa: 00 00 00
4cfd: ff d0 callq *%rax
fd = open("xx", O_CREATE);
4cff: be 00 02 00 00 mov $0x200,%esi
4d04: 48 bf c0 7e 00 00 00 movabs $0x7ec0,%rdi
4d0b: 00 00 00
4d0e: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
4d15: 00 00 00
4d18: ff d0 callq *%rax
4d1a: 89 45 f8 mov %eax,-0x8(%rbp)
if(fd >= 0)
4d1d: 83 7d f8 00 cmpl $0x0,-0x8(%rbp)
4d21: 78 11 js 4d34 <iref+0x138>
close(fd);
4d23: 8b 45 f8 mov -0x8(%rbp),%eax
4d26: 89 c7 mov %eax,%edi
4d28: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
4d2f: 00 00 00
4d32: ff d0 callq *%rax
unlink("xx");
4d34: 48 bf c0 7e 00 00 00 movabs $0x7ec0,%rdi
4d3b: 00 00 00
4d3e: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
4d45: 00 00 00
4d48: ff d0 callq *%rax
for(i = 0; i < 50 + 1; i++){
4d4a: 83 45 fc 01 addl $0x1,-0x4(%rbp)
4d4e: 83 7d fc 32 cmpl $0x32,-0x4(%rbp)
4d52: 0f 8e dc fe ff ff jle 4c34 <iref+0x38>
}
chdir("/");
4d58: 48 bf 90 6d 00 00 00 movabs $0x6d90,%rdi
4d5f: 00 00 00
4d62: 48 b8 c3 63 00 00 00 movabs $0x63c3,%rax
4d69: 00 00 00
4d6c: ff d0 callq *%rax
printf(1, "empty file name OK\n");
4d6e: 48 be c3 7e 00 00 00 movabs $0x7ec3,%rsi
4d75: 00 00 00
4d78: bf 01 00 00 00 mov $0x1,%edi
4d7d: b8 00 00 00 00 mov $0x0,%eax
4d82: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
4d89: 00 00 00
4d8c: ff d2 callq *%rdx
}
4d8e: 90 nop
4d8f: c9 leaveq
4d90: c3 retq
0000000000004d91 <forktest>:
// test that fork fails gracefully
// the forktest binary also does this, but it runs out of proc entries first.
// inside the bigger usertests binary, we run out of memory first.
void
forktest(void)
{
4d91: f3 0f 1e fa endbr64
4d95: 55 push %rbp
4d96: 48 89 e5 mov %rsp,%rbp
4d99: 48 83 ec 10 sub $0x10,%rsp
int n, pid;
printf(1, "fork test\n");
4d9d: 48 be d7 7e 00 00 00 movabs $0x7ed7,%rsi
4da4: 00 00 00
4da7: bf 01 00 00 00 mov $0x1,%edi
4dac: b8 00 00 00 00 mov $0x0,%eax
4db1: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
4db8: 00 00 00
4dbb: ff d2 callq *%rdx
for(n=0; n<1000; n++){
4dbd: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
4dc4: eb 2b jmp 4df1 <forktest+0x60>
pid = fork();
4dc6: 48 b8 00 63 00 00 00 movabs $0x6300,%rax
4dcd: 00 00 00
4dd0: ff d0 callq *%rax
4dd2: 89 45 f8 mov %eax,-0x8(%rbp)
if(pid < 0)
4dd5: 83 7d f8 00 cmpl $0x0,-0x8(%rbp)
4dd9: 78 21 js 4dfc <forktest+0x6b>
break;
if(pid == 0)
4ddb: 83 7d f8 00 cmpl $0x0,-0x8(%rbp)
4ddf: 75 0c jne 4ded <forktest+0x5c>
exit();
4de1: 48 b8 0d 63 00 00 00 movabs $0x630d,%rax
4de8: 00 00 00
4deb: ff d0 callq *%rax
for(n=0; n<1000; n++){
4ded: 83 45 fc 01 addl $0x1,-0x4(%rbp)
4df1: 81 7d fc e7 03 00 00 cmpl $0x3e7,-0x4(%rbp)
4df8: 7e cc jle 4dc6 <forktest+0x35>
4dfa: eb 01 jmp 4dfd <forktest+0x6c>
break;
4dfc: 90 nop
}
if(n == 1000){
4dfd: 81 7d fc e8 03 00 00 cmpl $0x3e8,-0x4(%rbp)
4e04: 75 42 jne 4e48 <forktest+0xb7>
failexit("fork claimed to work 1000 times");
4e06: 48 bf e8 7e 00 00 00 movabs $0x7ee8,%rdi
4e0d: 00 00 00
4e10: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
4e17: 00 00 00
4e1a: ff d0 callq *%rax
}
for(; n > 0; n--){
4e1c: eb 2a jmp 4e48 <forktest+0xb7>
if(wait() < 0){
4e1e: 48 b8 1a 63 00 00 00 movabs $0x631a,%rax
4e25: 00 00 00
4e28: ff d0 callq *%rax
4e2a: 85 c0 test %eax,%eax
4e2c: 79 16 jns 4e44 <forktest+0xb3>
failexit("wait stopped early");
4e2e: 48 bf 08 7f 00 00 00 movabs $0x7f08,%rdi
4e35: 00 00 00
4e38: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
4e3f: 00 00 00
4e42: ff d0 callq *%rax
for(; n > 0; n--){
4e44: 83 6d fc 01 subl $0x1,-0x4(%rbp)
4e48: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
4e4c: 7f d0 jg 4e1e <forktest+0x8d>
}
}
if(wait() != -1){
4e4e: 48 b8 1a 63 00 00 00 movabs $0x631a,%rax
4e55: 00 00 00
4e58: ff d0 callq *%rax
4e5a: 83 f8 ff cmp $0xffffffff,%eax
4e5d: 74 16 je 4e75 <forktest+0xe4>
failexit("wait got too many");
4e5f: 48 bf 1b 7f 00 00 00 movabs $0x7f1b,%rdi
4e66: 00 00 00
4e69: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
4e70: 00 00 00
4e73: ff d0 callq *%rax
}
printf(1, "fork test OK\n");
4e75: 48 be 2d 7f 00 00 00 movabs $0x7f2d,%rsi
4e7c: 00 00 00
4e7f: bf 01 00 00 00 mov $0x1,%edi
4e84: b8 00 00 00 00 mov $0x0,%eax
4e89: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
4e90: 00 00 00
4e93: ff d2 callq *%rdx
}
4e95: 90 nop
4e96: c9 leaveq
4e97: c3 retq
0000000000004e98 <sbrktest>:
void
sbrktest(void)
{
4e98: f3 0f 1e fa endbr64
4e9c: 55 push %rbp
4e9d: 48 89 e5 mov %rsp,%rbp
4ea0: 48 81 ec 90 00 00 00 sub $0x90,%rsp
int fds[2], pid, pids[10], ppid;
char *a, *b, *c, *lastaddr, *oldbrk, *p, scratch;
uint amt;
printf(1, "sbrk test\n");
4ea7: 48 be 3b 7f 00 00 00 movabs $0x7f3b,%rsi
4eae: 00 00 00
4eb1: bf 01 00 00 00 mov $0x1,%edi
4eb6: b8 00 00 00 00 mov $0x0,%eax
4ebb: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
4ec2: 00 00 00
4ec5: ff d2 callq *%rdx
oldbrk = sbrk(0);
4ec7: bf 00 00 00 00 mov $0x0,%edi
4ecc: 48 b8 ea 63 00 00 00 movabs $0x63ea,%rax
4ed3: 00 00 00
4ed6: ff d0 callq *%rax
4ed8: 48 89 45 e8 mov %rax,-0x18(%rbp)
// can one sbrk() less than a page?
a = sbrk(0);
4edc: bf 00 00 00 00 mov $0x0,%edi
4ee1: 48 b8 ea 63 00 00 00 movabs $0x63ea,%rax
4ee8: 00 00 00
4eeb: ff d0 callq *%rax
4eed: 48 89 45 f8 mov %rax,-0x8(%rbp)
int i;
for(i = 0; i < 5000; i++){
4ef1: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%rbp)
4ef8: eb 76 jmp 4f70 <sbrktest+0xd8>
b = sbrk(1);
4efa: bf 01 00 00 00 mov $0x1,%edi
4eff: 48 b8 ea 63 00 00 00 movabs $0x63ea,%rax
4f06: 00 00 00
4f09: ff d0 callq *%rax
4f0b: 48 89 45 b0 mov %rax,-0x50(%rbp)
if(b != a){
4f0f: 48 8b 45 b0 mov -0x50(%rbp),%rax
4f13: 48 3b 45 f8 cmp -0x8(%rbp),%rax
4f17: 74 40 je 4f59 <sbrktest+0xc1>
printf(1, "sbrk test failed %d %p %p\n", i, a, b);
4f19: 48 8b 4d b0 mov -0x50(%rbp),%rcx
4f1d: 48 8b 55 f8 mov -0x8(%rbp),%rdx
4f21: 8b 45 f4 mov -0xc(%rbp),%eax
4f24: 49 89 c8 mov %rcx,%r8
4f27: 48 89 d1 mov %rdx,%rcx
4f2a: 89 c2 mov %eax,%edx
4f2c: 48 be 46 7f 00 00 00 movabs $0x7f46,%rsi
4f33: 00 00 00
4f36: bf 01 00 00 00 mov $0x1,%edi
4f3b: b8 00 00 00 00 mov $0x0,%eax
4f40: 49 b9 11 66 00 00 00 movabs $0x6611,%r9
4f47: 00 00 00
4f4a: 41 ff d1 callq *%r9
exit();
4f4d: 48 b8 0d 63 00 00 00 movabs $0x630d,%rax
4f54: 00 00 00
4f57: ff d0 callq *%rax
}
*b = 1;
4f59: 48 8b 45 b0 mov -0x50(%rbp),%rax
4f5d: c6 00 01 movb $0x1,(%rax)
a = b + 1;
4f60: 48 8b 45 b0 mov -0x50(%rbp),%rax
4f64: 48 83 c0 01 add $0x1,%rax
4f68: 48 89 45 f8 mov %rax,-0x8(%rbp)
for(i = 0; i < 5000; i++){
4f6c: 83 45 f4 01 addl $0x1,-0xc(%rbp)
4f70: 81 7d f4 87 13 00 00 cmpl $0x1387,-0xc(%rbp)
4f77: 7e 81 jle 4efa <sbrktest+0x62>
}
pid = fork();
4f79: 48 b8 00 63 00 00 00 movabs $0x6300,%rax
4f80: 00 00 00
4f83: ff d0 callq *%rax
4f85: 89 45 e4 mov %eax,-0x1c(%rbp)
if(pid < 0){
4f88: 83 7d e4 00 cmpl $0x0,-0x1c(%rbp)
4f8c: 79 16 jns 4fa4 <sbrktest+0x10c>
failexit("sbrk test fork");
4f8e: 48 bf 61 7f 00 00 00 movabs $0x7f61,%rdi
4f95: 00 00 00
4f98: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
4f9f: 00 00 00
4fa2: ff d0 callq *%rax
}
c = sbrk(1);
4fa4: bf 01 00 00 00 mov $0x1,%edi
4fa9: 48 b8 ea 63 00 00 00 movabs $0x63ea,%rax
4fb0: 00 00 00
4fb3: ff d0 callq *%rax
4fb5: 48 89 45 d8 mov %rax,-0x28(%rbp)
c = sbrk(1);
4fb9: bf 01 00 00 00 mov $0x1,%edi
4fbe: 48 b8 ea 63 00 00 00 movabs $0x63ea,%rax
4fc5: 00 00 00
4fc8: ff d0 callq *%rax
4fca: 48 89 45 d8 mov %rax,-0x28(%rbp)
if(c != a + 1){
4fce: 48 8b 45 f8 mov -0x8(%rbp),%rax
4fd2: 48 83 c0 01 add $0x1,%rax
4fd6: 48 39 45 d8 cmp %rax,-0x28(%rbp)
4fda: 74 16 je 4ff2 <sbrktest+0x15a>
failexit("sbrk test failed post-fork");
4fdc: 48 bf 70 7f 00 00 00 movabs $0x7f70,%rdi
4fe3: 00 00 00
4fe6: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
4fed: 00 00 00
4ff0: ff d0 callq *%rax
}
if(pid == 0)
4ff2: 83 7d e4 00 cmpl $0x0,-0x1c(%rbp)
4ff6: 75 0c jne 5004 <sbrktest+0x16c>
exit();
4ff8: 48 b8 0d 63 00 00 00 movabs $0x630d,%rax
4fff: 00 00 00
5002: ff d0 callq *%rax
wait();
5004: 48 b8 1a 63 00 00 00 movabs $0x631a,%rax
500b: 00 00 00
500e: ff d0 callq *%rax
// can one grow address space to something big?
#define BIG (100*1024*1024)
a = sbrk(0);
5010: bf 00 00 00 00 mov $0x0,%edi
5015: 48 b8 ea 63 00 00 00 movabs $0x63ea,%rax
501c: 00 00 00
501f: ff d0 callq *%rax
5021: 48 89 45 f8 mov %rax,-0x8(%rbp)
amt = (BIG) - (addr_t)a;
5025: 48 8b 45 f8 mov -0x8(%rbp),%rax
5029: ba 00 00 40 06 mov $0x6400000,%edx
502e: 29 c2 sub %eax,%edx
5030: 89 d0 mov %edx,%eax
5032: 89 45 d4 mov %eax,-0x2c(%rbp)
p = sbrk(amt);
5035: 8b 45 d4 mov -0x2c(%rbp),%eax
5038: 48 89 c7 mov %rax,%rdi
503b: 48 b8 ea 63 00 00 00 movabs $0x63ea,%rax
5042: 00 00 00
5045: ff d0 callq *%rax
5047: 48 89 45 c8 mov %rax,-0x38(%rbp)
if (p != a) {
504b: 48 8b 45 c8 mov -0x38(%rbp),%rax
504f: 48 3b 45 f8 cmp -0x8(%rbp),%rax
5053: 74 16 je 506b <sbrktest+0x1d3>
failexit("sbrk test failed to grow big address space; enough phys mem?");
5055: 48 bf 90 7f 00 00 00 movabs $0x7f90,%rdi
505c: 00 00 00
505f: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
5066: 00 00 00
5069: ff d0 callq *%rax
}
lastaddr = (char*) (BIG-1);
506b: 48 c7 45 c0 ff ff 3f movq $0x63fffff,-0x40(%rbp)
5072: 06
*lastaddr = 99;
5073: 48 8b 45 c0 mov -0x40(%rbp),%rax
5077: c6 00 63 movb $0x63,(%rax)
// can one de-allocate?
a = sbrk(0);
507a: bf 00 00 00 00 mov $0x0,%edi
507f: 48 b8 ea 63 00 00 00 movabs $0x63ea,%rax
5086: 00 00 00
5089: ff d0 callq *%rax
508b: 48 89 45 f8 mov %rax,-0x8(%rbp)
c = sbrk(-4096);
508f: 48 c7 c7 00 f0 ff ff mov $0xfffffffffffff000,%rdi
5096: 48 b8 ea 63 00 00 00 movabs $0x63ea,%rax
509d: 00 00 00
50a0: ff d0 callq *%rax
50a2: 48 89 45 d8 mov %rax,-0x28(%rbp)
if(c == (char*)0xffffffff){
50a6: b8 ff ff ff ff mov $0xffffffff,%eax
50ab: 48 39 45 d8 cmp %rax,-0x28(%rbp)
50af: 75 16 jne 50c7 <sbrktest+0x22f>
failexit("sbrk could not deallocate");
50b1: 48 bf cd 7f 00 00 00 movabs $0x7fcd,%rdi
50b8: 00 00 00
50bb: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
50c2: 00 00 00
50c5: ff d0 callq *%rax
}
c = sbrk(0);
50c7: bf 00 00 00 00 mov $0x0,%edi
50cc: 48 b8 ea 63 00 00 00 movabs $0x63ea,%rax
50d3: 00 00 00
50d6: ff d0 callq *%rax
50d8: 48 89 45 d8 mov %rax,-0x28(%rbp)
if(c != a - 4096){
50dc: 48 8b 45 f8 mov -0x8(%rbp),%rax
50e0: 48 2d 00 10 00 00 sub $0x1000,%rax
50e6: 48 39 45 d8 cmp %rax,-0x28(%rbp)
50ea: 74 3b je 5127 <sbrktest+0x28f>
printf(1, "sbrk deallocation produced wrong address, a %p c %p\n", a, c);
50ec: 48 8b 55 d8 mov -0x28(%rbp),%rdx
50f0: 48 8b 45 f8 mov -0x8(%rbp),%rax
50f4: 48 89 d1 mov %rdx,%rcx
50f7: 48 89 c2 mov %rax,%rdx
50fa: 48 be e8 7f 00 00 00 movabs $0x7fe8,%rsi
5101: 00 00 00
5104: bf 01 00 00 00 mov $0x1,%edi
5109: b8 00 00 00 00 mov $0x0,%eax
510e: 49 b8 11 66 00 00 00 movabs $0x6611,%r8
5115: 00 00 00
5118: 41 ff d0 callq *%r8
exit();
511b: 48 b8 0d 63 00 00 00 movabs $0x630d,%rax
5122: 00 00 00
5125: ff d0 callq *%rax
}
// can one re-allocate that page?
a = sbrk(0);
5127: bf 00 00 00 00 mov $0x0,%edi
512c: 48 b8 ea 63 00 00 00 movabs $0x63ea,%rax
5133: 00 00 00
5136: ff d0 callq *%rax
5138: 48 89 45 f8 mov %rax,-0x8(%rbp)
c = sbrk(4096);
513c: bf 00 10 00 00 mov $0x1000,%edi
5141: 48 b8 ea 63 00 00 00 movabs $0x63ea,%rax
5148: 00 00 00
514b: ff d0 callq *%rax
514d: 48 89 45 d8 mov %rax,-0x28(%rbp)
if(c != a || sbrk(0) != a + 4096){
5151: 48 8b 45 d8 mov -0x28(%rbp),%rax
5155: 48 3b 45 f8 cmp -0x8(%rbp),%rax
5159: 75 21 jne 517c <sbrktest+0x2e4>
515b: bf 00 00 00 00 mov $0x0,%edi
5160: 48 b8 ea 63 00 00 00 movabs $0x63ea,%rax
5167: 00 00 00
516a: ff d0 callq *%rax
516c: 48 8b 55 f8 mov -0x8(%rbp),%rdx
5170: 48 81 c2 00 10 00 00 add $0x1000,%rdx
5177: 48 39 d0 cmp %rdx,%rax
517a: 74 3b je 51b7 <sbrktest+0x31f>
printf(1, "sbrk re-allocation failed, a %p c %p\n", a, c);
517c: 48 8b 55 d8 mov -0x28(%rbp),%rdx
5180: 48 8b 45 f8 mov -0x8(%rbp),%rax
5184: 48 89 d1 mov %rdx,%rcx
5187: 48 89 c2 mov %rax,%rdx
518a: 48 be 20 80 00 00 00 movabs $0x8020,%rsi
5191: 00 00 00
5194: bf 01 00 00 00 mov $0x1,%edi
5199: b8 00 00 00 00 mov $0x0,%eax
519e: 49 b8 11 66 00 00 00 movabs $0x6611,%r8
51a5: 00 00 00
51a8: 41 ff d0 callq *%r8
exit();
51ab: 48 b8 0d 63 00 00 00 movabs $0x630d,%rax
51b2: 00 00 00
51b5: ff d0 callq *%rax
}
if(*lastaddr == 99){
51b7: 48 8b 45 c0 mov -0x40(%rbp),%rax
51bb: 0f b6 00 movzbl (%rax),%eax
51be: 3c 63 cmp $0x63,%al
51c0: 75 16 jne 51d8 <sbrktest+0x340>
// should be zero
failexit("sbrk de-allocation didn't really deallocate");
51c2: 48 bf 48 80 00 00 00 movabs $0x8048,%rdi
51c9: 00 00 00
51cc: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
51d3: 00 00 00
51d6: ff d0 callq *%rax
}
a = sbrk(0);
51d8: bf 00 00 00 00 mov $0x0,%edi
51dd: 48 b8 ea 63 00 00 00 movabs $0x63ea,%rax
51e4: 00 00 00
51e7: ff d0 callq *%rax
51e9: 48 89 45 f8 mov %rax,-0x8(%rbp)
c = sbrk(-(sbrk(0) - oldbrk));
51ed: bf 00 00 00 00 mov $0x0,%edi
51f2: 48 b8 ea 63 00 00 00 movabs $0x63ea,%rax
51f9: 00 00 00
51fc: ff d0 callq *%rax
51fe: 48 8b 55 e8 mov -0x18(%rbp),%rdx
5202: 48 29 c2 sub %rax,%rdx
5205: 48 89 d0 mov %rdx,%rax
5208: 48 89 c7 mov %rax,%rdi
520b: 48 b8 ea 63 00 00 00 movabs $0x63ea,%rax
5212: 00 00 00
5215: ff d0 callq *%rax
5217: 48 89 45 d8 mov %rax,-0x28(%rbp)
if(c != a){
521b: 48 8b 45 d8 mov -0x28(%rbp),%rax
521f: 48 3b 45 f8 cmp -0x8(%rbp),%rax
5223: 74 3b je 5260 <sbrktest+0x3c8>
printf(1, "sbrk downsize failed, a %p c %p\n", a, c);
5225: 48 8b 55 d8 mov -0x28(%rbp),%rdx
5229: 48 8b 45 f8 mov -0x8(%rbp),%rax
522d: 48 89 d1 mov %rdx,%rcx
5230: 48 89 c2 mov %rax,%rdx
5233: 48 be 78 80 00 00 00 movabs $0x8078,%rsi
523a: 00 00 00
523d: bf 01 00 00 00 mov $0x1,%edi
5242: b8 00 00 00 00 mov $0x0,%eax
5247: 49 b8 11 66 00 00 00 movabs $0x6611,%r8
524e: 00 00 00
5251: 41 ff d0 callq *%r8
exit();
5254: 48 b8 0d 63 00 00 00 movabs $0x630d,%rax
525b: 00 00 00
525e: ff d0 callq *%rax
}
printf(1, "expecting 10 killed processes:\n");
5260: 48 be a0 80 00 00 00 movabs $0x80a0,%rsi
5267: 00 00 00
526a: bf 01 00 00 00 mov $0x1,%edi
526f: b8 00 00 00 00 mov $0x0,%eax
5274: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
527b: 00 00 00
527e: ff d2 callq *%rdx
// can we read the kernel's memory?
for(a = (char*)(KERNBASE); a < (char*) (KERNBASE+1000000); a += 100000){
5280: 48 b8 00 00 00 00 00 movabs $0xffff800000000000,%rax
5287: 80 ff ff
528a: 48 89 45 f8 mov %rax,-0x8(%rbp)
528e: e9 a5 00 00 00 jmpq 5338 <sbrktest+0x4a0>
ppid = getpid();
5293: 48 b8 dd 63 00 00 00 movabs $0x63dd,%rax
529a: 00 00 00
529d: ff d0 callq *%rax
529f: 89 45 b8 mov %eax,-0x48(%rbp)
pid = fork();
52a2: 48 b8 00 63 00 00 00 movabs $0x6300,%rax
52a9: 00 00 00
52ac: ff d0 callq *%rax
52ae: 89 45 e4 mov %eax,-0x1c(%rbp)
if(pid < 0){
52b1: 83 7d e4 00 cmpl $0x0,-0x1c(%rbp)
52b5: 79 16 jns 52cd <sbrktest+0x435>
failexit("fork");
52b7: 48 bf b7 6d 00 00 00 movabs $0x6db7,%rdi
52be: 00 00 00
52c1: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
52c8: 00 00 00
52cb: ff d0 callq *%rax
}
if(pid == 0){
52cd: 83 7d e4 00 cmpl $0x0,-0x1c(%rbp)
52d1: 75 51 jne 5324 <sbrktest+0x48c>
printf(1, "oops could read %p = %c\n", a, *a);
52d3: 48 8b 45 f8 mov -0x8(%rbp),%rax
52d7: 0f b6 00 movzbl (%rax),%eax
52da: 0f be d0 movsbl %al,%edx
52dd: 48 8b 45 f8 mov -0x8(%rbp),%rax
52e1: 89 d1 mov %edx,%ecx
52e3: 48 89 c2 mov %rax,%rdx
52e6: 48 be c0 80 00 00 00 movabs $0x80c0,%rsi
52ed: 00 00 00
52f0: bf 01 00 00 00 mov $0x1,%edi
52f5: b8 00 00 00 00 mov $0x0,%eax
52fa: 49 b8 11 66 00 00 00 movabs $0x6611,%r8
5301: 00 00 00
5304: 41 ff d0 callq *%r8
kill(ppid);
5307: 8b 45 b8 mov -0x48(%rbp),%eax
530a: 89 c7 mov %eax,%edi
530c: 48 b8 5b 63 00 00 00 movabs $0x635b,%rax
5313: 00 00 00
5316: ff d0 callq *%rax
exit();
5318: 48 b8 0d 63 00 00 00 movabs $0x630d,%rax
531f: 00 00 00
5322: ff d0 callq *%rax
}
wait();
5324: 48 b8 1a 63 00 00 00 movabs $0x631a,%rax
532b: 00 00 00
532e: ff d0 callq *%rax
for(a = (char*)(KERNBASE); a < (char*) (KERNBASE+1000000); a += 100000){
5330: 48 81 45 f8 a0 86 01 addq $0x186a0,-0x8(%rbp)
5337: 00
5338: 48 b8 3f 42 0f 00 00 movabs $0xffff8000000f423f,%rax
533f: 80 ff ff
5342: 48 39 45 f8 cmp %rax,-0x8(%rbp)
5346: 0f 86 47 ff ff ff jbe 5293 <sbrktest+0x3fb>
}
// if we run the system out of memory, does it clean up the last
// failed allocation?
if(pipe(fds) != 0){
534c: 48 8d 45 a8 lea -0x58(%rbp),%rax
5350: 48 89 c7 mov %rax,%rdi
5353: 48 b8 27 63 00 00 00 movabs $0x6327,%rax
535a: 00 00 00
535d: ff d0 callq *%rax
535f: 85 c0 test %eax,%eax
5361: 74 16 je 5379 <sbrktest+0x4e1>
failexit("pipe()");
5363: 48 bf 53 71 00 00 00 movabs $0x7153,%rdi
536a: 00 00 00
536d: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
5374: 00 00 00
5377: ff d0 callq *%rax
}
printf(1, "expecting failed sbrk()s:\n");
5379: 48 be d9 80 00 00 00 movabs $0x80d9,%rsi
5380: 00 00 00
5383: bf 01 00 00 00 mov $0x1,%edi
5388: b8 00 00 00 00 mov $0x0,%eax
538d: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
5394: 00 00 00
5397: ff d2 callq *%rdx
for(i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){
5399: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%rbp)
53a0: e9 e0 00 00 00 jmpq 5485 <sbrktest+0x5ed>
if((pids[i] = fork()) == 0){
53a5: 48 b8 00 63 00 00 00 movabs $0x6300,%rax
53ac: 00 00 00
53af: ff d0 callq *%rax
53b1: 8b 55 f4 mov -0xc(%rbp),%edx
53b4: 48 63 d2 movslq %edx,%rdx
53b7: 89 44 95 80 mov %eax,-0x80(%rbp,%rdx,4)
53bb: 8b 45 f4 mov -0xc(%rbp),%eax
53be: 48 98 cltq
53c0: 8b 44 85 80 mov -0x80(%rbp,%rax,4),%eax
53c4: 85 c0 test %eax,%eax
53c6: 0f 85 87 00 00 00 jne 5453 <sbrktest+0x5bb>
// allocate a lot of memory
int ret = (int)(addr_t)sbrk(BIG - (addr_t)sbrk(0));
53cc: bf 00 00 00 00 mov $0x0,%edi
53d1: 48 b8 ea 63 00 00 00 movabs $0x63ea,%rax
53d8: 00 00 00
53db: ff d0 callq *%rax
53dd: ba 00 00 40 06 mov $0x6400000,%edx
53e2: 48 29 c2 sub %rax,%rdx
53e5: 48 89 d0 mov %rdx,%rax
53e8: 48 89 c7 mov %rax,%rdi
53eb: 48 b8 ea 63 00 00 00 movabs $0x63ea,%rax
53f2: 00 00 00
53f5: ff d0 callq *%rax
53f7: 89 45 bc mov %eax,-0x44(%rbp)
if(ret < 0)
53fa: 83 7d bc 00 cmpl $0x0,-0x44(%rbp)
53fe: 79 20 jns 5420 <sbrktest+0x588>
printf(1, "sbrk returned -1 as expected\n");
5400: 48 be f4 80 00 00 00 movabs $0x80f4,%rsi
5407: 00 00 00
540a: bf 01 00 00 00 mov $0x1,%edi
540f: b8 00 00 00 00 mov $0x0,%eax
5414: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
541b: 00 00 00
541e: ff d2 callq *%rdx
write(fds[1], "x", 1);
5420: 8b 45 ac mov -0x54(%rbp),%eax
5423: ba 01 00 00 00 mov $0x1,%edx
5428: 48 be a6 71 00 00 00 movabs $0x71a6,%rsi
542f: 00 00 00
5432: 89 c7 mov %eax,%edi
5434: 48 b8 41 63 00 00 00 movabs $0x6341,%rax
543b: 00 00 00
543e: ff d0 callq *%rax
// sit around until killed
for(;;)
sleep(1000);
5440: bf e8 03 00 00 mov $0x3e8,%edi
5445: 48 b8 f7 63 00 00 00 movabs $0x63f7,%rax
544c: 00 00 00
544f: ff d0 callq *%rax
5451: eb ed jmp 5440 <sbrktest+0x5a8>
}
if(pids[i] != -1)
5453: 8b 45 f4 mov -0xc(%rbp),%eax
5456: 48 98 cltq
5458: 8b 44 85 80 mov -0x80(%rbp,%rax,4),%eax
545c: 83 f8 ff cmp $0xffffffff,%eax
545f: 74 20 je 5481 <sbrktest+0x5e9>
read(fds[0], &scratch, 1); // wait
5461: 8b 45 a8 mov -0x58(%rbp),%eax
5464: 48 8d 8d 7f ff ff ff lea -0x81(%rbp),%rcx
546b: ba 01 00 00 00 mov $0x1,%edx
5470: 48 89 ce mov %rcx,%rsi
5473: 89 c7 mov %eax,%edi
5475: 48 b8 34 63 00 00 00 movabs $0x6334,%rax
547c: 00 00 00
547f: ff d0 callq *%rax
for(i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){
5481: 83 45 f4 01 addl $0x1,-0xc(%rbp)
5485: 8b 45 f4 mov -0xc(%rbp),%eax
5488: 83 f8 09 cmp $0x9,%eax
548b: 0f 86 14 ff ff ff jbe 53a5 <sbrktest+0x50d>
}
// if those failed allocations freed up the pages they did allocate,
// we'll be able to allocate one here
c = sbrk(4096);
5491: bf 00 10 00 00 mov $0x1000,%edi
5496: 48 b8 ea 63 00 00 00 movabs $0x63ea,%rax
549d: 00 00 00
54a0: ff d0 callq *%rax
54a2: 48 89 45 d8 mov %rax,-0x28(%rbp)
for(i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){
54a6: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%rbp)
54ad: eb 38 jmp 54e7 <sbrktest+0x64f>
if(pids[i] == -1)
54af: 8b 45 f4 mov -0xc(%rbp),%eax
54b2: 48 98 cltq
54b4: 8b 44 85 80 mov -0x80(%rbp,%rax,4),%eax
54b8: 83 f8 ff cmp $0xffffffff,%eax
54bb: 74 25 je 54e2 <sbrktest+0x64a>
continue;
kill(pids[i]);
54bd: 8b 45 f4 mov -0xc(%rbp),%eax
54c0: 48 98 cltq
54c2: 8b 44 85 80 mov -0x80(%rbp,%rax,4),%eax
54c6: 89 c7 mov %eax,%edi
54c8: 48 b8 5b 63 00 00 00 movabs $0x635b,%rax
54cf: 00 00 00
54d2: ff d0 callq *%rax
wait();
54d4: 48 b8 1a 63 00 00 00 movabs $0x631a,%rax
54db: 00 00 00
54de: ff d0 callq *%rax
54e0: eb 01 jmp 54e3 <sbrktest+0x64b>
continue;
54e2: 90 nop
for(i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){
54e3: 83 45 f4 01 addl $0x1,-0xc(%rbp)
54e7: 8b 45 f4 mov -0xc(%rbp),%eax
54ea: 83 f8 09 cmp $0x9,%eax
54ed: 76 c0 jbe 54af <sbrktest+0x617>
}
if(c == (char*)0xffffffff){ // ?
54ef: b8 ff ff ff ff mov $0xffffffff,%eax
54f4: 48 39 45 d8 cmp %rax,-0x28(%rbp)
54f8: 75 16 jne 5510 <sbrktest+0x678>
failexit("failed sbrk leaked memory");
54fa: 48 bf 12 81 00 00 00 movabs $0x8112,%rdi
5501: 00 00 00
5504: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
550b: 00 00 00
550e: ff d0 callq *%rax
}
if(sbrk(0) > oldbrk)
5510: bf 00 00 00 00 mov $0x0,%edi
5515: 48 b8 ea 63 00 00 00 movabs $0x63ea,%rax
551c: 00 00 00
551f: ff d0 callq *%rax
5521: 48 39 45 e8 cmp %rax,-0x18(%rbp)
5525: 73 2a jae 5551 <sbrktest+0x6b9>
sbrk(-(sbrk(0) - oldbrk));
5527: bf 00 00 00 00 mov $0x0,%edi
552c: 48 b8 ea 63 00 00 00 movabs $0x63ea,%rax
5533: 00 00 00
5536: ff d0 callq *%rax
5538: 48 8b 55 e8 mov -0x18(%rbp),%rdx
553c: 48 29 c2 sub %rax,%rdx
553f: 48 89 d0 mov %rdx,%rax
5542: 48 89 c7 mov %rax,%rdi
5545: 48 b8 ea 63 00 00 00 movabs $0x63ea,%rax
554c: 00 00 00
554f: ff d0 callq *%rax
printf(1, "sbrk test OK\n");
5551: 48 be 2c 81 00 00 00 movabs $0x812c,%rsi
5558: 00 00 00
555b: bf 01 00 00 00 mov $0x1,%edi
5560: b8 00 00 00 00 mov $0x0,%eax
5565: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
556c: 00 00 00
556f: ff d2 callq *%rdx
}
5571: 90 nop
5572: c9 leaveq
5573: c3 retq
0000000000005574 <validatetest>:
void
validatetest(void)
{
5574: f3 0f 1e fa endbr64
5578: 55 push %rbp
5579: 48 89 e5 mov %rsp,%rbp
557c: 48 83 ec 10 sub $0x10,%rsp
int hi;
addr_t p;
printf(1, "validate test\n");
5580: 48 be 3a 81 00 00 00 movabs $0x813a,%rsi
5587: 00 00 00
558a: bf 01 00 00 00 mov $0x1,%edi
558f: b8 00 00 00 00 mov $0x0,%eax
5594: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
559b: 00 00 00
559e: ff d2 callq *%rdx
hi = 1100*1024;
55a0: c7 45 f4 00 30 11 00 movl $0x113000,-0xc(%rbp)
// first page not mapped
for(p = 4096; p <= (uint)hi; p += 4096){
55a7: 48 c7 45 f8 00 10 00 movq $0x1000,-0x8(%rbp)
55ae: 00
55af: eb 40 jmp 55f1 <validatetest+0x7d>
// try to crash the kernel by passing in a bad string pointer
if(link("nosuchfile", (char*)p) != -1){
55b1: 48 8b 45 f8 mov -0x8(%rbp),%rax
55b5: 48 89 c6 mov %rax,%rsi
55b8: 48 bf 49 81 00 00 00 movabs $0x8149,%rdi
55bf: 00 00 00
55c2: 48 b8 a9 63 00 00 00 movabs $0x63a9,%rax
55c9: 00 00 00
55cc: ff d0 callq *%rax
55ce: 83 f8 ff cmp $0xffffffff,%eax
55d1: 74 16 je 55e9 <validatetest+0x75>
failexit("link should not succeed.");
55d3: 48 bf 54 81 00 00 00 movabs $0x8154,%rdi
55da: 00 00 00
55dd: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
55e4: 00 00 00
55e7: ff d0 callq *%rax
for(p = 4096; p <= (uint)hi; p += 4096){
55e9: 48 81 45 f8 00 10 00 addq $0x1000,-0x8(%rbp)
55f0: 00
55f1: 8b 45 f4 mov -0xc(%rbp),%eax
55f4: 89 c0 mov %eax,%eax
55f6: 48 39 45 f8 cmp %rax,-0x8(%rbp)
55fa: 76 b5 jbe 55b1 <validatetest+0x3d>
}
}
printf(1, "validate ok\n");
55fc: 48 be 6d 81 00 00 00 movabs $0x816d,%rsi
5603: 00 00 00
5606: bf 01 00 00 00 mov $0x1,%edi
560b: b8 00 00 00 00 mov $0x0,%eax
5610: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
5617: 00 00 00
561a: ff d2 callq *%rdx
}
561c: 90 nop
561d: c9 leaveq
561e: c3 retq
000000000000561f <bsstest>:
// does unintialized data start out zero?
char uninit[10000];
void
bsstest(void)
{
561f: f3 0f 1e fa endbr64
5623: 55 push %rbp
5624: 48 89 e5 mov %rsp,%rbp
5627: 48 83 ec 10 sub $0x10,%rsp
int i;
printf(1, "bss test\n");
562b: 48 be 7a 81 00 00 00 movabs $0x817a,%rsi
5632: 00 00 00
5635: bf 01 00 00 00 mov $0x1,%edi
563a: b8 00 00 00 00 mov $0x0,%eax
563f: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
5646: 00 00 00
5649: ff d2 callq *%rdx
for(i = 0; i < sizeof(uninit); i++){
564b: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
5652: eb 31 jmp 5685 <bsstest+0x66>
if(uninit[i] != '\0'){
5654: 48 ba 40 ac 00 00 00 movabs $0xac40,%rdx
565b: 00 00 00
565e: 8b 45 fc mov -0x4(%rbp),%eax
5661: 48 98 cltq
5663: 0f b6 04 02 movzbl (%rdx,%rax,1),%eax
5667: 84 c0 test %al,%al
5669: 74 16 je 5681 <bsstest+0x62>
failexit("bss test");
566b: 48 bf 84 81 00 00 00 movabs $0x8184,%rdi
5672: 00 00 00
5675: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
567c: 00 00 00
567f: ff d0 callq *%rax
for(i = 0; i < sizeof(uninit); i++){
5681: 83 45 fc 01 addl $0x1,-0x4(%rbp)
5685: 8b 45 fc mov -0x4(%rbp),%eax
5688: 3d 0f 27 00 00 cmp $0x270f,%eax
568d: 76 c5 jbe 5654 <bsstest+0x35>
}
}
printf(1, "bss test ok\n");
568f: 48 be 8d 81 00 00 00 movabs $0x818d,%rsi
5696: 00 00 00
5699: bf 01 00 00 00 mov $0x1,%edi
569e: b8 00 00 00 00 mov $0x0,%eax
56a3: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
56aa: 00 00 00
56ad: ff d2 callq *%rdx
}
56af: 90 nop
56b0: c9 leaveq
56b1: c3 retq
00000000000056b2 <bigargtest>:
// does exec return an error if the arguments
// are larger than a page? or does it write
// below the stack and wreck the instructions/data?
void
bigargtest(void)
{
56b2: f3 0f 1e fa endbr64
56b6: 55 push %rbp
56b7: 48 89 e5 mov %rsp,%rbp
56ba: 48 83 ec 10 sub $0x10,%rsp
int pid, fd;
unlink("bigarg-ok");
56be: 48 bf 9a 81 00 00 00 movabs $0x819a,%rdi
56c5: 00 00 00
56c8: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
56cf: 00 00 00
56d2: ff d0 callq *%rax
pid = fork();
56d4: 48 b8 00 63 00 00 00 movabs $0x6300,%rax
56db: 00 00 00
56de: ff d0 callq *%rax
56e0: 89 45 f8 mov %eax,-0x8(%rbp)
if(pid == 0){
56e3: 83 7d f8 00 cmpl $0x0,-0x8(%rbp)
56e7: 0f 85 e0 00 00 00 jne 57cd <bigargtest+0x11b>
static char *args[MAXARG];
int i;
for(i = 0; i < MAXARG-1; i++)
56ed: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
56f4: eb 21 jmp 5717 <bigargtest+0x65>
args[i] = "bigargs test: failed\n ";
56f6: 48 ba 60 d3 00 00 00 movabs $0xd360,%rdx
56fd: 00 00 00
5700: 8b 45 fc mov -0x4(%rbp),%eax
5703: 48 98 cltq
5705: 48 b9 a8 81 00 00 00 movabs $0x81a8,%rcx
570c: 00 00 00
570f: 48 89 0c c2 mov %rcx,(%rdx,%rax,8)
for(i = 0; i < MAXARG-1; i++)
5713: 83 45 fc 01 addl $0x1,-0x4(%rbp)
5717: 83 7d fc 1e cmpl $0x1e,-0x4(%rbp)
571b: 7e d9 jle 56f6 <bigargtest+0x44>
args[MAXARG-1] = 0;
571d: 48 b8 60 d3 00 00 00 movabs $0xd360,%rax
5724: 00 00 00
5727: 48 c7 80 f8 00 00 00 movq $0x0,0xf8(%rax)
572e: 00 00 00 00
printf(1, "bigarg test\n");
5732: 48 be 85 82 00 00 00 movabs $0x8285,%rsi
5739: 00 00 00
573c: bf 01 00 00 00 mov $0x1,%edi
5741: b8 00 00 00 00 mov $0x0,%eax
5746: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
574d: 00 00 00
5750: ff d2 callq *%rdx
exec("echo", args);
5752: 48 be 60 d3 00 00 00 movabs $0xd360,%rsi
5759: 00 00 00
575c: 48 bf 28 6d 00 00 00 movabs $0x6d28,%rdi
5763: 00 00 00
5766: 48 b8 68 63 00 00 00 movabs $0x6368,%rax
576d: 00 00 00
5770: ff d0 callq *%rax
printf(1, "bigarg test ok\n");
5772: 48 be 92 82 00 00 00 movabs $0x8292,%rsi
5779: 00 00 00
577c: bf 01 00 00 00 mov $0x1,%edi
5781: b8 00 00 00 00 mov $0x0,%eax
5786: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
578d: 00 00 00
5790: ff d2 callq *%rdx
fd = open("bigarg-ok", O_CREATE);
5792: be 00 02 00 00 mov $0x200,%esi
5797: 48 bf 9a 81 00 00 00 movabs $0x819a,%rdi
579e: 00 00 00
57a1: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
57a8: 00 00 00
57ab: ff d0 callq *%rax
57ad: 89 45 f4 mov %eax,-0xc(%rbp)
close(fd);
57b0: 8b 45 f4 mov -0xc(%rbp),%eax
57b3: 89 c7 mov %eax,%edi
57b5: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
57bc: 00 00 00
57bf: ff d0 callq *%rax
exit();
57c1: 48 b8 0d 63 00 00 00 movabs $0x630d,%rax
57c8: 00 00 00
57cb: ff d0 callq *%rax
} else if(pid < 0){
57cd: 83 7d f8 00 cmpl $0x0,-0x8(%rbp)
57d1: 79 16 jns 57e9 <bigargtest+0x137>
failexit("bigargtest: fork");
57d3: 48 bf a2 82 00 00 00 movabs $0x82a2,%rdi
57da: 00 00 00
57dd: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
57e4: 00 00 00
57e7: ff d0 callq *%rax
}
wait();
57e9: 48 b8 1a 63 00 00 00 movabs $0x631a,%rax
57f0: 00 00 00
57f3: ff d0 callq *%rax
fd = open("bigarg-ok", 0);
57f5: be 00 00 00 00 mov $0x0,%esi
57fa: 48 bf 9a 81 00 00 00 movabs $0x819a,%rdi
5801: 00 00 00
5804: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
580b: 00 00 00
580e: ff d0 callq *%rax
5810: 89 45 f4 mov %eax,-0xc(%rbp)
if(fd < 0){
5813: 83 7d f4 00 cmpl $0x0,-0xc(%rbp)
5817: 79 16 jns 582f <bigargtest+0x17d>
failexit("bigarg test");
5819: 48 bf b3 82 00 00 00 movabs $0x82b3,%rdi
5820: 00 00 00
5823: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
582a: 00 00 00
582d: ff d0 callq *%rax
}
close(fd);
582f: 8b 45 f4 mov -0xc(%rbp),%eax
5832: 89 c7 mov %eax,%edi
5834: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
583b: 00 00 00
583e: ff d0 callq *%rax
unlink("bigarg-ok");
5840: 48 bf 9a 81 00 00 00 movabs $0x819a,%rdi
5847: 00 00 00
584a: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
5851: 00 00 00
5854: ff d0 callq *%rax
}
5856: 90 nop
5857: c9 leaveq
5858: c3 retq
0000000000005859 <fsfull>:
// what happens when the file system runs out of blocks?
// answer: balloc panics, so this test is not useful.
void
fsfull()
{
5859: f3 0f 1e fa endbr64
585d: 55 push %rbp
585e: 48 89 e5 mov %rsp,%rbp
5861: 48 83 ec 60 sub $0x60,%rsp
int nfiles;
int fsblocks = 0;
5865: c7 45 f8 00 00 00 00 movl $0x0,-0x8(%rbp)
printf(1, "fsfull test\n");
586c: 48 be bf 82 00 00 00 movabs $0x82bf,%rsi
5873: 00 00 00
5876: bf 01 00 00 00 mov $0x1,%edi
587b: b8 00 00 00 00 mov $0x0,%eax
5880: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
5887: 00 00 00
588a: ff d2 callq *%rdx
for(nfiles = 0; ; nfiles++){
588c: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
char name[64];
name[0] = 'f';
5893: c6 45 a0 66 movb $0x66,-0x60(%rbp)
name[1] = '0' + nfiles / 1000;
5897: 8b 45 fc mov -0x4(%rbp),%eax
589a: 48 63 d0 movslq %eax,%rdx
589d: 48 69 d2 d3 4d 62 10 imul $0x10624dd3,%rdx,%rdx
58a4: 48 c1 ea 20 shr $0x20,%rdx
58a8: c1 fa 06 sar $0x6,%edx
58ab: c1 f8 1f sar $0x1f,%eax
58ae: 29 c2 sub %eax,%edx
58b0: 89 d0 mov %edx,%eax
58b2: 83 c0 30 add $0x30,%eax
58b5: 88 45 a1 mov %al,-0x5f(%rbp)
name[2] = '0' + (nfiles % 1000) / 100;
58b8: 8b 55 fc mov -0x4(%rbp),%edx
58bb: 48 63 c2 movslq %edx,%rax
58be: 48 69 c0 d3 4d 62 10 imul $0x10624dd3,%rax,%rax
58c5: 48 c1 e8 20 shr $0x20,%rax
58c9: 89 c1 mov %eax,%ecx
58cb: c1 f9 06 sar $0x6,%ecx
58ce: 89 d0 mov %edx,%eax
58d0: c1 f8 1f sar $0x1f,%eax
58d3: 29 c1 sub %eax,%ecx
58d5: 89 c8 mov %ecx,%eax
58d7: 69 c0 e8 03 00 00 imul $0x3e8,%eax,%eax
58dd: 29 c2 sub %eax,%edx
58df: 89 d0 mov %edx,%eax
58e1: 48 63 d0 movslq %eax,%rdx
58e4: 48 69 d2 1f 85 eb 51 imul $0x51eb851f,%rdx,%rdx
58eb: 48 c1 ea 20 shr $0x20,%rdx
58ef: c1 fa 05 sar $0x5,%edx
58f2: c1 f8 1f sar $0x1f,%eax
58f5: 29 c2 sub %eax,%edx
58f7: 89 d0 mov %edx,%eax
58f9: 83 c0 30 add $0x30,%eax
58fc: 88 45 a2 mov %al,-0x5e(%rbp)
name[3] = '0' + (nfiles % 100) / 10;
58ff: 8b 55 fc mov -0x4(%rbp),%edx
5902: 48 63 c2 movslq %edx,%rax
5905: 48 69 c0 1f 85 eb 51 imul $0x51eb851f,%rax,%rax
590c: 48 c1 e8 20 shr $0x20,%rax
5910: 89 c1 mov %eax,%ecx
5912: c1 f9 05 sar $0x5,%ecx
5915: 89 d0 mov %edx,%eax
5917: c1 f8 1f sar $0x1f,%eax
591a: 29 c1 sub %eax,%ecx
591c: 89 c8 mov %ecx,%eax
591e: 6b c0 64 imul $0x64,%eax,%eax
5921: 29 c2 sub %eax,%edx
5923: 89 d0 mov %edx,%eax
5925: 48 63 d0 movslq %eax,%rdx
5928: 48 69 d2 67 66 66 66 imul $0x66666667,%rdx,%rdx
592f: 48 c1 ea 20 shr $0x20,%rdx
5933: c1 fa 02 sar $0x2,%edx
5936: c1 f8 1f sar $0x1f,%eax
5939: 29 c2 sub %eax,%edx
593b: 89 d0 mov %edx,%eax
593d: 83 c0 30 add $0x30,%eax
5940: 88 45 a3 mov %al,-0x5d(%rbp)
name[4] = '0' + (nfiles % 10);
5943: 8b 4d fc mov -0x4(%rbp),%ecx
5946: 48 63 c1 movslq %ecx,%rax
5949: 48 69 c0 67 66 66 66 imul $0x66666667,%rax,%rax
5950: 48 c1 e8 20 shr $0x20,%rax
5954: 89 c2 mov %eax,%edx
5956: c1 fa 02 sar $0x2,%edx
5959: 89 c8 mov %ecx,%eax
595b: c1 f8 1f sar $0x1f,%eax
595e: 29 c2 sub %eax,%edx
5960: 89 d0 mov %edx,%eax
5962: c1 e0 02 shl $0x2,%eax
5965: 01 d0 add %edx,%eax
5967: 01 c0 add %eax,%eax
5969: 29 c1 sub %eax,%ecx
596b: 89 ca mov %ecx,%edx
596d: 89 d0 mov %edx,%eax
596f: 83 c0 30 add $0x30,%eax
5972: 88 45 a4 mov %al,-0x5c(%rbp)
name[5] = '\0';
5975: c6 45 a5 00 movb $0x0,-0x5b(%rbp)
printf(1, "writing %s\n", name);
5979: 48 8d 45 a0 lea -0x60(%rbp),%rax
597d: 48 89 c2 mov %rax,%rdx
5980: 48 be cc 82 00 00 00 movabs $0x82cc,%rsi
5987: 00 00 00
598a: bf 01 00 00 00 mov $0x1,%edi
598f: b8 00 00 00 00 mov $0x0,%eax
5994: 48 b9 11 66 00 00 00 movabs $0x6611,%rcx
599b: 00 00 00
599e: ff d1 callq *%rcx
int fd = open(name, O_CREATE|O_RDWR);
59a0: 48 8d 45 a0 lea -0x60(%rbp),%rax
59a4: be 02 02 00 00 mov $0x202,%esi
59a9: 48 89 c7 mov %rax,%rdi
59ac: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
59b3: 00 00 00
59b6: ff d0 callq *%rax
59b8: 89 45 f0 mov %eax,-0x10(%rbp)
if(fd < 0){
59bb: 83 7d f0 00 cmpl $0x0,-0x10(%rbp)
59bf: 79 2c jns 59ed <fsfull+0x194>
printf(1, "open %s failed\n", name);
59c1: 48 8d 45 a0 lea -0x60(%rbp),%rax
59c5: 48 89 c2 mov %rax,%rdx
59c8: 48 be d8 82 00 00 00 movabs $0x82d8,%rsi
59cf: 00 00 00
59d2: bf 01 00 00 00 mov $0x1,%edi
59d7: b8 00 00 00 00 mov $0x0,%eax
59dc: 48 b9 11 66 00 00 00 movabs $0x6611,%rcx
59e3: 00 00 00
59e6: ff d1 callq *%rcx
break;
59e8: e9 86 00 00 00 jmpq 5a73 <fsfull+0x21a>
}
int total = 0;
59ed: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%rbp)
while(1){
int cc = write(fd, buf, 512);
59f4: 8b 45 f0 mov -0x10(%rbp),%eax
59f7: ba 00 02 00 00 mov $0x200,%edx
59fc: 48 be 20 8c 00 00 00 movabs $0x8c20,%rsi
5a03: 00 00 00
5a06: 89 c7 mov %eax,%edi
5a08: 48 b8 41 63 00 00 00 movabs $0x6341,%rax
5a0f: 00 00 00
5a12: ff d0 callq *%rax
5a14: 89 45 ec mov %eax,-0x14(%rbp)
if(cc < 512)
5a17: 81 7d ec ff 01 00 00 cmpl $0x1ff,-0x14(%rbp)
5a1e: 7e 0c jle 5a2c <fsfull+0x1d3>
break;
total += cc;
5a20: 8b 45 ec mov -0x14(%rbp),%eax
5a23: 01 45 f4 add %eax,-0xc(%rbp)
fsblocks++;
5a26: 83 45 f8 01 addl $0x1,-0x8(%rbp)
while(1){
5a2a: eb c8 jmp 59f4 <fsfull+0x19b>
break;
5a2c: 90 nop
}
printf(1, "wrote %d bytes\n", total);
5a2d: 8b 45 f4 mov -0xc(%rbp),%eax
5a30: 89 c2 mov %eax,%edx
5a32: 48 be e8 82 00 00 00 movabs $0x82e8,%rsi
5a39: 00 00 00
5a3c: bf 01 00 00 00 mov $0x1,%edi
5a41: b8 00 00 00 00 mov $0x0,%eax
5a46: 48 b9 11 66 00 00 00 movabs $0x6611,%rcx
5a4d: 00 00 00
5a50: ff d1 callq *%rcx
close(fd);
5a52: 8b 45 f0 mov -0x10(%rbp),%eax
5a55: 89 c7 mov %eax,%edi
5a57: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
5a5e: 00 00 00
5a61: ff d0 callq *%rax
if(total == 0)
5a63: 83 7d f4 00 cmpl $0x0,-0xc(%rbp)
5a67: 74 09 je 5a72 <fsfull+0x219>
for(nfiles = 0; ; nfiles++){
5a69: 83 45 fc 01 addl $0x1,-0x4(%rbp)
5a6d: e9 21 fe ff ff jmpq 5893 <fsfull+0x3a>
break;
5a72: 90 nop
}
while(nfiles >= 0){
5a73: e9 fd 00 00 00 jmpq 5b75 <fsfull+0x31c>
char name[64];
name[0] = 'f';
5a78: c6 45 a0 66 movb $0x66,-0x60(%rbp)
name[1] = '0' + nfiles / 1000;
5a7c: 8b 45 fc mov -0x4(%rbp),%eax
5a7f: 48 63 d0 movslq %eax,%rdx
5a82: 48 69 d2 d3 4d 62 10 imul $0x10624dd3,%rdx,%rdx
5a89: 48 c1 ea 20 shr $0x20,%rdx
5a8d: c1 fa 06 sar $0x6,%edx
5a90: c1 f8 1f sar $0x1f,%eax
5a93: 29 c2 sub %eax,%edx
5a95: 89 d0 mov %edx,%eax
5a97: 83 c0 30 add $0x30,%eax
5a9a: 88 45 a1 mov %al,-0x5f(%rbp)
name[2] = '0' + (nfiles % 1000) / 100;
5a9d: 8b 55 fc mov -0x4(%rbp),%edx
5aa0: 48 63 c2 movslq %edx,%rax
5aa3: 48 69 c0 d3 4d 62 10 imul $0x10624dd3,%rax,%rax
5aaa: 48 c1 e8 20 shr $0x20,%rax
5aae: 89 c1 mov %eax,%ecx
5ab0: c1 f9 06 sar $0x6,%ecx
5ab3: 89 d0 mov %edx,%eax
5ab5: c1 f8 1f sar $0x1f,%eax
5ab8: 29 c1 sub %eax,%ecx
5aba: 89 c8 mov %ecx,%eax
5abc: 69 c0 e8 03 00 00 imul $0x3e8,%eax,%eax
5ac2: 29 c2 sub %eax,%edx
5ac4: 89 d0 mov %edx,%eax
5ac6: 48 63 d0 movslq %eax,%rdx
5ac9: 48 69 d2 1f 85 eb 51 imul $0x51eb851f,%rdx,%rdx
5ad0: 48 c1 ea 20 shr $0x20,%rdx
5ad4: c1 fa 05 sar $0x5,%edx
5ad7: c1 f8 1f sar $0x1f,%eax
5ada: 29 c2 sub %eax,%edx
5adc: 89 d0 mov %edx,%eax
5ade: 83 c0 30 add $0x30,%eax
5ae1: 88 45 a2 mov %al,-0x5e(%rbp)
name[3] = '0' + (nfiles % 100) / 10;
5ae4: 8b 55 fc mov -0x4(%rbp),%edx
5ae7: 48 63 c2 movslq %edx,%rax
5aea: 48 69 c0 1f 85 eb 51 imul $0x51eb851f,%rax,%rax
5af1: 48 c1 e8 20 shr $0x20,%rax
5af5: 89 c1 mov %eax,%ecx
5af7: c1 f9 05 sar $0x5,%ecx
5afa: 89 d0 mov %edx,%eax
5afc: c1 f8 1f sar $0x1f,%eax
5aff: 29 c1 sub %eax,%ecx
5b01: 89 c8 mov %ecx,%eax
5b03: 6b c0 64 imul $0x64,%eax,%eax
5b06: 29 c2 sub %eax,%edx
5b08: 89 d0 mov %edx,%eax
5b0a: 48 63 d0 movslq %eax,%rdx
5b0d: 48 69 d2 67 66 66 66 imul $0x66666667,%rdx,%rdx
5b14: 48 c1 ea 20 shr $0x20,%rdx
5b18: c1 fa 02 sar $0x2,%edx
5b1b: c1 f8 1f sar $0x1f,%eax
5b1e: 29 c2 sub %eax,%edx
5b20: 89 d0 mov %edx,%eax
5b22: 83 c0 30 add $0x30,%eax
5b25: 88 45 a3 mov %al,-0x5d(%rbp)
name[4] = '0' + (nfiles % 10);
5b28: 8b 4d fc mov -0x4(%rbp),%ecx
5b2b: 48 63 c1 movslq %ecx,%rax
5b2e: 48 69 c0 67 66 66 66 imul $0x66666667,%rax,%rax
5b35: 48 c1 e8 20 shr $0x20,%rax
5b39: 89 c2 mov %eax,%edx
5b3b: c1 fa 02 sar $0x2,%edx
5b3e: 89 c8 mov %ecx,%eax
5b40: c1 f8 1f sar $0x1f,%eax
5b43: 29 c2 sub %eax,%edx
5b45: 89 d0 mov %edx,%eax
5b47: c1 e0 02 shl $0x2,%eax
5b4a: 01 d0 add %edx,%eax
5b4c: 01 c0 add %eax,%eax
5b4e: 29 c1 sub %eax,%ecx
5b50: 89 ca mov %ecx,%edx
5b52: 89 d0 mov %edx,%eax
5b54: 83 c0 30 add $0x30,%eax
5b57: 88 45 a4 mov %al,-0x5c(%rbp)
name[5] = '\0';
5b5a: c6 45 a5 00 movb $0x0,-0x5b(%rbp)
unlink(name);
5b5e: 48 8d 45 a0 lea -0x60(%rbp),%rax
5b62: 48 89 c7 mov %rax,%rdi
5b65: 48 b8 8f 63 00 00 00 movabs $0x638f,%rax
5b6c: 00 00 00
5b6f: ff d0 callq *%rax
nfiles--;
5b71: 83 6d fc 01 subl $0x1,-0x4(%rbp)
while(nfiles >= 0){
5b75: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
5b79: 0f 89 f9 fe ff ff jns 5a78 <fsfull+0x21f>
}
printf(1, "fsfull test finished\n");
5b7f: 48 be f8 82 00 00 00 movabs $0x82f8,%rsi
5b86: 00 00 00
5b89: bf 01 00 00 00 mov $0x1,%edi
5b8e: b8 00 00 00 00 mov $0x0,%eax
5b93: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
5b9a: 00 00 00
5b9d: ff d2 callq *%rdx
}
5b9f: 90 nop
5ba0: c9 leaveq
5ba1: c3 retq
0000000000005ba2 <uio>:
void
uio()
{
5ba2: f3 0f 1e fa endbr64
5ba6: 55 push %rbp
5ba7: 48 89 e5 mov %rsp,%rbp
5baa: 48 83 ec 10 sub $0x10,%rsp
#define RTC_ADDR 0x70
#define RTC_DATA 0x71
ushort port = 0;
5bae: 66 c7 45 fe 00 00 movw $0x0,-0x2(%rbp)
uchar val = 0;
5bb4: c6 45 fd 00 movb $0x0,-0x3(%rbp)
int pid;
printf(1, "uio test\n");
5bb8: 48 be 0e 83 00 00 00 movabs $0x830e,%rsi
5bbf: 00 00 00
5bc2: bf 01 00 00 00 mov $0x1,%edi
5bc7: b8 00 00 00 00 mov $0x0,%eax
5bcc: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
5bd3: 00 00 00
5bd6: ff d2 callq *%rdx
pid = fork();
5bd8: 48 b8 00 63 00 00 00 movabs $0x6300,%rax
5bdf: 00 00 00
5be2: ff d0 callq *%rax
5be4: 89 45 f8 mov %eax,-0x8(%rbp)
if(pid == 0){
5be7: 83 7d f8 00 cmpl $0x0,-0x8(%rbp)
5beb: 75 4f jne 5c3c <uio+0x9a>
port = RTC_ADDR;
5bed: 66 c7 45 fe 70 00 movw $0x70,-0x2(%rbp)
val = 0x09; /* year */
5bf3: c6 45 fd 09 movb $0x9,-0x3(%rbp)
/* http://wiki.osdev.org/Inline_Assembly/Examples */
asm volatile("outb %0,%1"::"a"(val), "d" (port));
5bf7: 0f b6 45 fd movzbl -0x3(%rbp),%eax
5bfb: 0f b7 55 fe movzwl -0x2(%rbp),%edx
5bff: ee out %al,(%dx)
port = RTC_DATA;
5c00: 66 c7 45 fe 71 00 movw $0x71,-0x2(%rbp)
asm volatile("inb %1,%0" : "=a" (val) : "d" (port));
5c06: 0f b7 45 fe movzwl -0x2(%rbp),%eax
5c0a: 89 c2 mov %eax,%edx
5c0c: ec in (%dx),%al
5c0d: 88 45 fd mov %al,-0x3(%rbp)
printf(1, "uio test succeeded\n");
5c10: 48 be 18 83 00 00 00 movabs $0x8318,%rsi
5c17: 00 00 00
5c1a: bf 01 00 00 00 mov $0x1,%edi
5c1f: b8 00 00 00 00 mov $0x0,%eax
5c24: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
5c2b: 00 00 00
5c2e: ff d2 callq *%rdx
exit();
5c30: 48 b8 0d 63 00 00 00 movabs $0x630d,%rax
5c37: 00 00 00
5c3a: ff d0 callq *%rax
} else if(pid < 0){
5c3c: 83 7d f8 00 cmpl $0x0,-0x8(%rbp)
5c40: 79 16 jns 5c58 <uio+0xb6>
failexit("fork");
5c42: 48 bf b7 6d 00 00 00 movabs $0x6db7,%rdi
5c49: 00 00 00
5c4c: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
5c53: 00 00 00
5c56: ff d0 callq *%rax
}
wait();
5c58: 48 b8 1a 63 00 00 00 movabs $0x631a,%rax
5c5f: 00 00 00
5c62: ff d0 callq *%rax
printf(1, "uio test done\n");
5c64: 48 be 2c 83 00 00 00 movabs $0x832c,%rsi
5c6b: 00 00 00
5c6e: bf 01 00 00 00 mov $0x1,%edi
5c73: b8 00 00 00 00 mov $0x0,%eax
5c78: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
5c7f: 00 00 00
5c82: ff d2 callq *%rdx
}
5c84: 90 nop
5c85: c9 leaveq
5c86: c3 retq
0000000000005c87 <argptest>:
void argptest()
{
5c87: f3 0f 1e fa endbr64
5c8b: 55 push %rbp
5c8c: 48 89 e5 mov %rsp,%rbp
5c8f: 48 83 ec 10 sub $0x10,%rsp
int fd;
fd = open("init", O_RDONLY);
5c93: be 00 00 00 00 mov $0x0,%esi
5c98: 48 bf 3b 83 00 00 00 movabs $0x833b,%rdi
5c9f: 00 00 00
5ca2: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
5ca9: 00 00 00
5cac: ff d0 callq *%rax
5cae: 89 45 fc mov %eax,-0x4(%rbp)
if (fd < 0) {
5cb1: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
5cb5: 79 16 jns 5ccd <argptest+0x46>
failexit("open");
5cb7: 48 bf 40 83 00 00 00 movabs $0x8340,%rdi
5cbe: 00 00 00
5cc1: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
5cc8: 00 00 00
5ccb: ff d0 callq *%rax
}
read(fd, sbrk(0) - 1, -1);
5ccd: bf 00 00 00 00 mov $0x0,%edi
5cd2: 48 b8 ea 63 00 00 00 movabs $0x63ea,%rax
5cd9: 00 00 00
5cdc: ff d0 callq *%rax
5cde: 48 8d 48 ff lea -0x1(%rax),%rcx
5ce2: 8b 45 fc mov -0x4(%rbp),%eax
5ce5: ba ff ff ff ff mov $0xffffffff,%edx
5cea: 48 89 ce mov %rcx,%rsi
5ced: 89 c7 mov %eax,%edi
5cef: 48 b8 34 63 00 00 00 movabs $0x6334,%rax
5cf6: 00 00 00
5cf9: ff d0 callq *%rax
close(fd);
5cfb: 8b 45 fc mov -0x4(%rbp),%eax
5cfe: 89 c7 mov %eax,%edi
5d00: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
5d07: 00 00 00
5d0a: ff d0 callq *%rax
printf(1, "arg test passed\n");
5d0c: 48 be 45 83 00 00 00 movabs $0x8345,%rsi
5d13: 00 00 00
5d16: bf 01 00 00 00 mov $0x1,%edi
5d1b: b8 00 00 00 00 mov $0x0,%eax
5d20: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
5d27: 00 00 00
5d2a: ff d2 callq *%rdx
}
5d2c: 90 nop
5d2d: c9 leaveq
5d2e: c3 retq
0000000000005d2f <rand>:
unsigned long randstate = 1;
unsigned int
rand()
{
5d2f: f3 0f 1e fa endbr64
5d33: 55 push %rbp
5d34: 48 89 e5 mov %rsp,%rbp
randstate = randstate * 1664525 + 1013904223;
5d37: 48 b8 e8 8b 00 00 00 movabs $0x8be8,%rax
5d3e: 00 00 00
5d41: 48 8b 00 mov (%rax),%rax
5d44: 48 69 c0 0d 66 19 00 imul $0x19660d,%rax,%rax
5d4b: 48 8d 90 5f f3 6e 3c lea 0x3c6ef35f(%rax),%rdx
5d52: 48 b8 e8 8b 00 00 00 movabs $0x8be8,%rax
5d59: 00 00 00
5d5c: 48 89 10 mov %rdx,(%rax)
return randstate;
5d5f: 48 b8 e8 8b 00 00 00 movabs $0x8be8,%rax
5d66: 00 00 00
5d69: 48 8b 00 mov (%rax),%rax
}
5d6c: 5d pop %rbp
5d6d: c3 retq
0000000000005d6e <main>:
int
main(int argc, char *argv[])
{
5d6e: f3 0f 1e fa endbr64
5d72: 55 push %rbp
5d73: 48 89 e5 mov %rsp,%rbp
5d76: 48 83 ec 10 sub $0x10,%rsp
5d7a: 89 7d fc mov %edi,-0x4(%rbp)
5d7d: 48 89 75 f0 mov %rsi,-0x10(%rbp)
printf(1, "usertests starting\n");
5d81: 48 be 56 83 00 00 00 movabs $0x8356,%rsi
5d88: 00 00 00
5d8b: bf 01 00 00 00 mov $0x1,%edi
5d90: b8 00 00 00 00 mov $0x0,%eax
5d95: 48 ba 11 66 00 00 00 movabs $0x6611,%rdx
5d9c: 00 00 00
5d9f: ff d2 callq *%rdx
if(open("usertests.ran", 0) >= 0){
5da1: be 00 00 00 00 mov $0x0,%esi
5da6: 48 bf 6a 83 00 00 00 movabs $0x836a,%rdi
5dad: 00 00 00
5db0: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
5db7: 00 00 00
5dba: ff d0 callq *%rax
5dbc: 85 c0 test %eax,%eax
5dbe: 78 16 js 5dd6 <main+0x68>
failexit("already ran user tests -- rebuild fs.img");
5dc0: 48 bf 78 83 00 00 00 movabs $0x8378,%rdi
5dc7: 00 00 00
5dca: 48 b8 00 10 00 00 00 movabs $0x1000,%rax
5dd1: 00 00 00
5dd4: ff d0 callq *%rax
}
close(open("usertests.ran", O_CREATE));
5dd6: be 00 02 00 00 mov $0x200,%esi
5ddb: 48 bf 6a 83 00 00 00 movabs $0x836a,%rdi
5de2: 00 00 00
5de5: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
5dec: 00 00 00
5def: ff d0 callq *%rax
5df1: 89 c7 mov %eax,%edi
5df3: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
5dfa: 00 00 00
5dfd: ff d0 callq *%rax
argptest();
5dff: b8 00 00 00 00 mov $0x0,%eax
5e04: 48 ba 87 5c 00 00 00 movabs $0x5c87,%rdx
5e0b: 00 00 00
5e0e: ff d2 callq *%rdx
createdelete();
5e10: 48 b8 68 29 00 00 00 movabs $0x2968,%rax
5e17: 00 00 00
5e1a: ff d0 callq *%rax
linkunlink();
5e1c: b8 00 00 00 00 mov $0x0,%eax
5e21: 48 ba 41 36 00 00 00 movabs $0x3641,%rdx
5e28: 00 00 00
5e2b: ff d2 callq *%rdx
concreate();
5e2d: 48 b8 5e 31 00 00 00 movabs $0x315e,%rax
5e34: 00 00 00
5e37: ff d0 callq *%rax
fourfiles();
5e39: 48 b8 58 26 00 00 00 movabs $0x2658,%rax
5e40: 00 00 00
5e43: ff d0 callq *%rax
sharedfd();
5e45: 48 b8 be 23 00 00 00 movabs $0x23be,%rax
5e4c: 00 00 00
5e4f: ff d0 callq *%rax
bigargtest();
5e51: 48 b8 b2 56 00 00 00 movabs $0x56b2,%rax
5e58: 00 00 00
5e5b: ff d0 callq *%rax
bigwrite();
5e5d: 48 b8 08 42 00 00 00 movabs $0x4208,%rax
5e64: 00 00 00
5e67: ff d0 callq *%rax
bigargtest();
5e69: 48 b8 b2 56 00 00 00 movabs $0x56b2,%rax
5e70: 00 00 00
5e73: ff d0 callq *%rax
bsstest();
5e75: 48 b8 1f 56 00 00 00 movabs $0x561f,%rax
5e7c: 00 00 00
5e7f: ff d0 callq *%rax
sbrktest();
5e81: 48 b8 98 4e 00 00 00 movabs $0x4e98,%rax
5e88: 00 00 00
5e8b: ff d0 callq *%rax
validatetest();
5e8d: 48 b8 74 55 00 00 00 movabs $0x5574,%rax
5e94: 00 00 00
5e97: ff d0 callq *%rax
opentest();
5e99: 48 b8 bd 13 00 00 00 movabs $0x13bd,%rax
5ea0: 00 00 00
5ea3: ff d0 callq *%rax
writetest();
5ea5: 48 b8 91 14 00 00 00 movabs $0x1491,%rax
5eac: 00 00 00
5eaf: ff d0 callq *%rax
writetest1();
5eb1: 48 b8 ba 16 00 00 00 movabs $0x16ba,%rax
5eb8: 00 00 00
5ebb: ff d0 callq *%rax
createtest();
5ebd: 48 b8 41 19 00 00 00 movabs $0x1941,%rax
5ec4: 00 00 00
5ec7: ff d0 callq *%rax
openiputtest();
5ec9: 48 b8 7a 12 00 00 00 movabs $0x127a,%rax
5ed0: 00 00 00
5ed3: ff d0 callq *%rax
exitiputtest();
5ed5: 48 b8 4e 11 00 00 00 movabs $0x114e,%rax
5edc: 00 00 00
5edf: ff d0 callq *%rax
iputtest();
5ee1: 48 b8 43 10 00 00 00 movabs $0x1043,%rax
5ee8: 00 00 00
5eeb: ff d0 callq *%rax
mem();
5eed: 48 b8 3b 22 00 00 00 movabs $0x223b,%rax
5ef4: 00 00 00
5ef7: ff d0 callq *%rax
pipe1();
5ef9: 48 b8 15 1d 00 00 00 movabs $0x1d15,%rax
5f00: 00 00 00
5f03: ff d0 callq *%rax
preempt();
5f05: 48 b8 67 1f 00 00 00 movabs $0x1f67,%rax
5f0c: 00 00 00
5f0f: ff d0 callq *%rax
exitwait();
5f11: 48 b8 77 21 00 00 00 movabs $0x2177,%rax
5f18: 00 00 00
5f1b: ff d0 callq *%rax
nullptr();
5f1d: 48 b8 32 1c 00 00 00 movabs $0x1c32,%rax
5f24: 00 00 00
5f27: ff d0 callq *%rax
rmdot();
5f29: 48 b8 86 47 00 00 00 movabs $0x4786,%rax
5f30: 00 00 00
5f33: ff d0 callq *%rax
fourteen();
5f35: 48 b8 e1 45 00 00 00 movabs $0x45e1,%rax
5f3c: 00 00 00
5f3f: ff d0 callq *%rax
bigfile();
5f41: 48 b8 61 43 00 00 00 movabs $0x4361,%rax
5f48: 00 00 00
5f4b: ff d0 callq *%rax
subdir();
5f4d: 48 b8 91 39 00 00 00 movabs $0x3991,%rax
5f54: 00 00 00
5f57: ff d0 callq *%rax
linktest();
5f59: 48 b8 8e 2e 00 00 00 movabs $0x2e8e,%rax
5f60: 00 00 00
5f63: ff d0 callq *%rax
unlinkread();
5f65: 48 b8 57 2c 00 00 00 movabs $0x2c57,%rax
5f6c: 00 00 00
5f6f: ff d0 callq *%rax
dirfile();
5f71: 48 b8 51 49 00 00 00 movabs $0x4951,%rax
5f78: 00 00 00
5f7b: ff d0 callq *%rax
iref();
5f7d: 48 b8 fc 4b 00 00 00 movabs $0x4bfc,%rax
5f84: 00 00 00
5f87: ff d0 callq *%rax
forktest();
5f89: 48 b8 91 4d 00 00 00 movabs $0x4d91,%rax
5f90: 00 00 00
5f93: ff d0 callq *%rax
bigdir(); // slow
5f95: 48 b8 db 37 00 00 00 movabs $0x37db,%rax
5f9c: 00 00 00
5f9f: ff d0 callq *%rax
uio();
5fa1: b8 00 00 00 00 mov $0x0,%eax
5fa6: 48 ba a2 5b 00 00 00 movabs $0x5ba2,%rdx
5fad: 00 00 00
5fb0: ff d2 callq *%rdx
exectest(); // will exit
5fb2: 48 b8 ad 1b 00 00 00 movabs $0x1bad,%rax
5fb9: 00 00 00
5fbc: ff d0 callq *%rax
exit();
5fbe: 48 b8 0d 63 00 00 00 movabs $0x630d,%rax
5fc5: 00 00 00
5fc8: ff d0 callq *%rax
0000000000005fca <stosb>:
"cc");
}
static inline void
stosb(void *addr, int data, int cnt)
{
5fca: f3 0f 1e fa endbr64
5fce: 55 push %rbp
5fcf: 48 89 e5 mov %rsp,%rbp
5fd2: 48 83 ec 10 sub $0x10,%rsp
5fd6: 48 89 7d f8 mov %rdi,-0x8(%rbp)
5fda: 89 75 f4 mov %esi,-0xc(%rbp)
5fdd: 89 55 f0 mov %edx,-0x10(%rbp)
asm volatile("cld; rep stosb" :
5fe0: 48 8b 4d f8 mov -0x8(%rbp),%rcx
5fe4: 8b 55 f0 mov -0x10(%rbp),%edx
5fe7: 8b 45 f4 mov -0xc(%rbp),%eax
5fea: 48 89 ce mov %rcx,%rsi
5fed: 48 89 f7 mov %rsi,%rdi
5ff0: 89 d1 mov %edx,%ecx
5ff2: fc cld
5ff3: f3 aa rep stos %al,%es:(%rdi)
5ff5: 89 ca mov %ecx,%edx
5ff7: 48 89 fe mov %rdi,%rsi
5ffa: 48 89 75 f8 mov %rsi,-0x8(%rbp)
5ffe: 89 55 f0 mov %edx,-0x10(%rbp)
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
6001: 90 nop
6002: c9 leaveq
6003: c3 retq
0000000000006004 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
6004: f3 0f 1e fa endbr64
6008: 55 push %rbp
6009: 48 89 e5 mov %rsp,%rbp
600c: 48 83 ec 20 sub $0x20,%rsp
6010: 48 89 7d e8 mov %rdi,-0x18(%rbp)
6014: 48 89 75 e0 mov %rsi,-0x20(%rbp)
char *os;
os = s;
6018: 48 8b 45 e8 mov -0x18(%rbp),%rax
601c: 48 89 45 f8 mov %rax,-0x8(%rbp)
while((*s++ = *t++) != 0)
6020: 90 nop
6021: 48 8b 55 e0 mov -0x20(%rbp),%rdx
6025: 48 8d 42 01 lea 0x1(%rdx),%rax
6029: 48 89 45 e0 mov %rax,-0x20(%rbp)
602d: 48 8b 45 e8 mov -0x18(%rbp),%rax
6031: 48 8d 48 01 lea 0x1(%rax),%rcx
6035: 48 89 4d e8 mov %rcx,-0x18(%rbp)
6039: 0f b6 12 movzbl (%rdx),%edx
603c: 88 10 mov %dl,(%rax)
603e: 0f b6 00 movzbl (%rax),%eax
6041: 84 c0 test %al,%al
6043: 75 dc jne 6021 <strcpy+0x1d>
;
return os;
6045: 48 8b 45 f8 mov -0x8(%rbp),%rax
}
6049: c9 leaveq
604a: c3 retq
000000000000604b <strcmp>:
int
strcmp(const char *p, const char *q)
{
604b: f3 0f 1e fa endbr64
604f: 55 push %rbp
6050: 48 89 e5 mov %rsp,%rbp
6053: 48 83 ec 10 sub $0x10,%rsp
6057: 48 89 7d f8 mov %rdi,-0x8(%rbp)
605b: 48 89 75 f0 mov %rsi,-0x10(%rbp)
while(*p && *p == *q)
605f: eb 0a jmp 606b <strcmp+0x20>
p++, q++;
6061: 48 83 45 f8 01 addq $0x1,-0x8(%rbp)
6066: 48 83 45 f0 01 addq $0x1,-0x10(%rbp)
while(*p && *p == *q)
606b: 48 8b 45 f8 mov -0x8(%rbp),%rax
606f: 0f b6 00 movzbl (%rax),%eax
6072: 84 c0 test %al,%al
6074: 74 12 je 6088 <strcmp+0x3d>
6076: 48 8b 45 f8 mov -0x8(%rbp),%rax
607a: 0f b6 10 movzbl (%rax),%edx
607d: 48 8b 45 f0 mov -0x10(%rbp),%rax
6081: 0f b6 00 movzbl (%rax),%eax
6084: 38 c2 cmp %al,%dl
6086: 74 d9 je 6061 <strcmp+0x16>
return (uchar)*p - (uchar)*q;
6088: 48 8b 45 f8 mov -0x8(%rbp),%rax
608c: 0f b6 00 movzbl (%rax),%eax
608f: 0f b6 d0 movzbl %al,%edx
6092: 48 8b 45 f0 mov -0x10(%rbp),%rax
6096: 0f b6 00 movzbl (%rax),%eax
6099: 0f b6 c0 movzbl %al,%eax
609c: 29 c2 sub %eax,%edx
609e: 89 d0 mov %edx,%eax
}
60a0: c9 leaveq
60a1: c3 retq
00000000000060a2 <strlen>:
uint
strlen(char *s)
{
60a2: f3 0f 1e fa endbr64
60a6: 55 push %rbp
60a7: 48 89 e5 mov %rsp,%rbp
60aa: 48 83 ec 18 sub $0x18,%rsp
60ae: 48 89 7d e8 mov %rdi,-0x18(%rbp)
int n;
for(n = 0; s[n]; n++)
60b2: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
60b9: eb 04 jmp 60bf <strlen+0x1d>
60bb: 83 45 fc 01 addl $0x1,-0x4(%rbp)
60bf: 8b 45 fc mov -0x4(%rbp),%eax
60c2: 48 63 d0 movslq %eax,%rdx
60c5: 48 8b 45 e8 mov -0x18(%rbp),%rax
60c9: 48 01 d0 add %rdx,%rax
60cc: 0f b6 00 movzbl (%rax),%eax
60cf: 84 c0 test %al,%al
60d1: 75 e8 jne 60bb <strlen+0x19>
;
return n;
60d3: 8b 45 fc mov -0x4(%rbp),%eax
}
60d6: c9 leaveq
60d7: c3 retq
00000000000060d8 <memset>:
void*
memset(void *dst, int c, uint n)
{
60d8: f3 0f 1e fa endbr64
60dc: 55 push %rbp
60dd: 48 89 e5 mov %rsp,%rbp
60e0: 48 83 ec 10 sub $0x10,%rsp
60e4: 48 89 7d f8 mov %rdi,-0x8(%rbp)
60e8: 89 75 f4 mov %esi,-0xc(%rbp)
60eb: 89 55 f0 mov %edx,-0x10(%rbp)
stosb(dst, c, n);
60ee: 8b 55 f0 mov -0x10(%rbp),%edx
60f1: 8b 4d f4 mov -0xc(%rbp),%ecx
60f4: 48 8b 45 f8 mov -0x8(%rbp),%rax
60f8: 89 ce mov %ecx,%esi
60fa: 48 89 c7 mov %rax,%rdi
60fd: 48 b8 ca 5f 00 00 00 movabs $0x5fca,%rax
6104: 00 00 00
6107: ff d0 callq *%rax
return dst;
6109: 48 8b 45 f8 mov -0x8(%rbp),%rax
}
610d: c9 leaveq
610e: c3 retq
000000000000610f <strchr>:
char*
strchr(const char *s, char c)
{
610f: f3 0f 1e fa endbr64
6113: 55 push %rbp
6114: 48 89 e5 mov %rsp,%rbp
6117: 48 83 ec 10 sub $0x10,%rsp
611b: 48 89 7d f8 mov %rdi,-0x8(%rbp)
611f: 89 f0 mov %esi,%eax
6121: 88 45 f4 mov %al,-0xc(%rbp)
for(; *s; s++)
6124: eb 17 jmp 613d <strchr+0x2e>
if(*s == c)
6126: 48 8b 45 f8 mov -0x8(%rbp),%rax
612a: 0f b6 00 movzbl (%rax),%eax
612d: 38 45 f4 cmp %al,-0xc(%rbp)
6130: 75 06 jne 6138 <strchr+0x29>
return (char*)s;
6132: 48 8b 45 f8 mov -0x8(%rbp),%rax
6136: eb 15 jmp 614d <strchr+0x3e>
for(; *s; s++)
6138: 48 83 45 f8 01 addq $0x1,-0x8(%rbp)
613d: 48 8b 45 f8 mov -0x8(%rbp),%rax
6141: 0f b6 00 movzbl (%rax),%eax
6144: 84 c0 test %al,%al
6146: 75 de jne 6126 <strchr+0x17>
return 0;
6148: b8 00 00 00 00 mov $0x0,%eax
}
614d: c9 leaveq
614e: c3 retq
000000000000614f <gets>:
char*
gets(char *buf, int max)
{
614f: f3 0f 1e fa endbr64
6153: 55 push %rbp
6154: 48 89 e5 mov %rsp,%rbp
6157: 48 83 ec 20 sub $0x20,%rsp
615b: 48 89 7d e8 mov %rdi,-0x18(%rbp)
615f: 89 75 e4 mov %esi,-0x1c(%rbp)
int i, cc;
char c;
for(i=0; i+1 < max; ){
6162: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
6169: eb 4f jmp 61ba <gets+0x6b>
cc = read(0, &c, 1);
616b: 48 8d 45 f7 lea -0x9(%rbp),%rax
616f: ba 01 00 00 00 mov $0x1,%edx
6174: 48 89 c6 mov %rax,%rsi
6177: bf 00 00 00 00 mov $0x0,%edi
617c: 48 b8 34 63 00 00 00 movabs $0x6334,%rax
6183: 00 00 00
6186: ff d0 callq *%rax
6188: 89 45 f8 mov %eax,-0x8(%rbp)
if(cc < 1)
618b: 83 7d f8 00 cmpl $0x0,-0x8(%rbp)
618f: 7e 36 jle 61c7 <gets+0x78>
break;
buf[i++] = c;
6191: 8b 45 fc mov -0x4(%rbp),%eax
6194: 8d 50 01 lea 0x1(%rax),%edx
6197: 89 55 fc mov %edx,-0x4(%rbp)
619a: 48 63 d0 movslq %eax,%rdx
619d: 48 8b 45 e8 mov -0x18(%rbp),%rax
61a1: 48 01 c2 add %rax,%rdx
61a4: 0f b6 45 f7 movzbl -0x9(%rbp),%eax
61a8: 88 02 mov %al,(%rdx)
if(c == '\n' || c == '\r')
61aa: 0f b6 45 f7 movzbl -0x9(%rbp),%eax
61ae: 3c 0a cmp $0xa,%al
61b0: 74 16 je 61c8 <gets+0x79>
61b2: 0f b6 45 f7 movzbl -0x9(%rbp),%eax
61b6: 3c 0d cmp $0xd,%al
61b8: 74 0e je 61c8 <gets+0x79>
for(i=0; i+1 < max; ){
61ba: 8b 45 fc mov -0x4(%rbp),%eax
61bd: 83 c0 01 add $0x1,%eax
61c0: 39 45 e4 cmp %eax,-0x1c(%rbp)
61c3: 7f a6 jg 616b <gets+0x1c>
61c5: eb 01 jmp 61c8 <gets+0x79>
break;
61c7: 90 nop
break;
}
buf[i] = '\0';
61c8: 8b 45 fc mov -0x4(%rbp),%eax
61cb: 48 63 d0 movslq %eax,%rdx
61ce: 48 8b 45 e8 mov -0x18(%rbp),%rax
61d2: 48 01 d0 add %rdx,%rax
61d5: c6 00 00 movb $0x0,(%rax)
return buf;
61d8: 48 8b 45 e8 mov -0x18(%rbp),%rax
}
61dc: c9 leaveq
61dd: c3 retq
00000000000061de <stat>:
int
stat(char *n, struct stat *st)
{
61de: f3 0f 1e fa endbr64
61e2: 55 push %rbp
61e3: 48 89 e5 mov %rsp,%rbp
61e6: 48 83 ec 20 sub $0x20,%rsp
61ea: 48 89 7d e8 mov %rdi,-0x18(%rbp)
61ee: 48 89 75 e0 mov %rsi,-0x20(%rbp)
int fd;
int r;
fd = open(n, O_RDONLY);
61f2: 48 8b 45 e8 mov -0x18(%rbp),%rax
61f6: be 00 00 00 00 mov $0x0,%esi
61fb: 48 89 c7 mov %rax,%rdi
61fe: 48 b8 75 63 00 00 00 movabs $0x6375,%rax
6205: 00 00 00
6208: ff d0 callq *%rax
620a: 89 45 fc mov %eax,-0x4(%rbp)
if(fd < 0)
620d: 83 7d fc 00 cmpl $0x0,-0x4(%rbp)
6211: 79 07 jns 621a <stat+0x3c>
return -1;
6213: b8 ff ff ff ff mov $0xffffffff,%eax
6218: eb 2f jmp 6249 <stat+0x6b>
r = fstat(fd, st);
621a: 48 8b 55 e0 mov -0x20(%rbp),%rdx
621e: 8b 45 fc mov -0x4(%rbp),%eax
6221: 48 89 d6 mov %rdx,%rsi
6224: 89 c7 mov %eax,%edi
6226: 48 b8 9c 63 00 00 00 movabs $0x639c,%rax
622d: 00 00 00
6230: ff d0 callq *%rax
6232: 89 45 f8 mov %eax,-0x8(%rbp)
close(fd);
6235: 8b 45 fc mov -0x4(%rbp),%eax
6238: 89 c7 mov %eax,%edi
623a: 48 b8 4e 63 00 00 00 movabs $0x634e,%rax
6241: 00 00 00
6244: ff d0 callq *%rax
return r;
6246: 8b 45 f8 mov -0x8(%rbp),%eax
}
6249: c9 leaveq
624a: c3 retq
000000000000624b <atoi>:
int
atoi(const char *s)
{
624b: f3 0f 1e fa endbr64
624f: 55 push %rbp
6250: 48 89 e5 mov %rsp,%rbp
6253: 48 83 ec 18 sub $0x18,%rsp
6257: 48 89 7d e8 mov %rdi,-0x18(%rbp)
int n;
n = 0;
625b: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
while('0' <= *s && *s <= '9')
6262: eb 28 jmp 628c <atoi+0x41>
n = n*10 + *s++ - '0';
6264: 8b 55 fc mov -0x4(%rbp),%edx
6267: 89 d0 mov %edx,%eax
6269: c1 e0 02 shl $0x2,%eax
626c: 01 d0 add %edx,%eax
626e: 01 c0 add %eax,%eax
6270: 89 c1 mov %eax,%ecx
6272: 48 8b 45 e8 mov -0x18(%rbp),%rax
6276: 48 8d 50 01 lea 0x1(%rax),%rdx
627a: 48 89 55 e8 mov %rdx,-0x18(%rbp)
627e: 0f b6 00 movzbl (%rax),%eax
6281: 0f be c0 movsbl %al,%eax
6284: 01 c8 add %ecx,%eax
6286: 83 e8 30 sub $0x30,%eax
6289: 89 45 fc mov %eax,-0x4(%rbp)
while('0' <= *s && *s <= '9')
628c: 48 8b 45 e8 mov -0x18(%rbp),%rax
6290: 0f b6 00 movzbl (%rax),%eax
6293: 3c 2f cmp $0x2f,%al
6295: 7e 0b jle 62a2 <atoi+0x57>
6297: 48 8b 45 e8 mov -0x18(%rbp),%rax
629b: 0f b6 00 movzbl (%rax),%eax
629e: 3c 39 cmp $0x39,%al
62a0: 7e c2 jle 6264 <atoi+0x19>
return n;
62a2: 8b 45 fc mov -0x4(%rbp),%eax
}
62a5: c9 leaveq
62a6: c3 retq
00000000000062a7 <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
62a7: f3 0f 1e fa endbr64
62ab: 55 push %rbp
62ac: 48 89 e5 mov %rsp,%rbp
62af: 48 83 ec 28 sub $0x28,%rsp
62b3: 48 89 7d e8 mov %rdi,-0x18(%rbp)
62b7: 48 89 75 e0 mov %rsi,-0x20(%rbp)
62bb: 89 55 dc mov %edx,-0x24(%rbp)
char *dst, *src;
dst = vdst;
62be: 48 8b 45 e8 mov -0x18(%rbp),%rax
62c2: 48 89 45 f8 mov %rax,-0x8(%rbp)
src = vsrc;
62c6: 48 8b 45 e0 mov -0x20(%rbp),%rax
62ca: 48 89 45 f0 mov %rax,-0x10(%rbp)
while(n-- > 0)
62ce: eb 1d jmp 62ed <memmove+0x46>
*dst++ = *src++;
62d0: 48 8b 55 f0 mov -0x10(%rbp),%rdx
62d4: 48 8d 42 01 lea 0x1(%rdx),%rax
62d8: 48 89 45 f0 mov %rax,-0x10(%rbp)
62dc: 48 8b 45 f8 mov -0x8(%rbp),%rax
62e0: 48 8d 48 01 lea 0x1(%rax),%rcx
62e4: 48 89 4d f8 mov %rcx,-0x8(%rbp)
62e8: 0f b6 12 movzbl (%rdx),%edx
62eb: 88 10 mov %dl,(%rax)
while(n-- > 0)
62ed: 8b 45 dc mov -0x24(%rbp),%eax
62f0: 8d 50 ff lea -0x1(%rax),%edx
62f3: 89 55 dc mov %edx,-0x24(%rbp)
62f6: 85 c0 test %eax,%eax
62f8: 7f d6 jg 62d0 <memmove+0x29>
return vdst;
62fa: 48 8b 45 e8 mov -0x18(%rbp),%rax
}
62fe: c9 leaveq
62ff: c3 retq
0000000000006300 <fork>:
mov $SYS_ ## name, %rax; \
mov %rcx, %r10 ;\
syscall ;\
ret
SYSCALL(fork)
6300: 48 c7 c0 01 00 00 00 mov $0x1,%rax
6307: 49 89 ca mov %rcx,%r10
630a: 0f 05 syscall
630c: c3 retq
000000000000630d <exit>:
SYSCALL(exit)
630d: 48 c7 c0 02 00 00 00 mov $0x2,%rax
6314: 49 89 ca mov %rcx,%r10
6317: 0f 05 syscall
6319: c3 retq
000000000000631a <wait>:
SYSCALL(wait)
631a: 48 c7 c0 03 00 00 00 mov $0x3,%rax
6321: 49 89 ca mov %rcx,%r10
6324: 0f 05 syscall
6326: c3 retq
0000000000006327 <pipe>:
SYSCALL(pipe)
6327: 48 c7 c0 04 00 00 00 mov $0x4,%rax
632e: 49 89 ca mov %rcx,%r10
6331: 0f 05 syscall
6333: c3 retq
0000000000006334 <read>:
SYSCALL(read)
6334: 48 c7 c0 05 00 00 00 mov $0x5,%rax
633b: 49 89 ca mov %rcx,%r10
633e: 0f 05 syscall
6340: c3 retq
0000000000006341 <write>:
SYSCALL(write)
6341: 48 c7 c0 10 00 00 00 mov $0x10,%rax
6348: 49 89 ca mov %rcx,%r10
634b: 0f 05 syscall
634d: c3 retq
000000000000634e <close>:
SYSCALL(close)
634e: 48 c7 c0 15 00 00 00 mov $0x15,%rax
6355: 49 89 ca mov %rcx,%r10
6358: 0f 05 syscall
635a: c3 retq
000000000000635b <kill>:
SYSCALL(kill)
635b: 48 c7 c0 06 00 00 00 mov $0x6,%rax
6362: 49 89 ca mov %rcx,%r10
6365: 0f 05 syscall
6367: c3 retq
0000000000006368 <exec>:
SYSCALL(exec)
6368: 48 c7 c0 07 00 00 00 mov $0x7,%rax
636f: 49 89 ca mov %rcx,%r10
6372: 0f 05 syscall
6374: c3 retq
0000000000006375 <open>:
SYSCALL(open)
6375: 48 c7 c0 0f 00 00 00 mov $0xf,%rax
637c: 49 89 ca mov %rcx,%r10
637f: 0f 05 syscall
6381: c3 retq
0000000000006382 <mknod>:
SYSCALL(mknod)
6382: 48 c7 c0 11 00 00 00 mov $0x11,%rax
6389: 49 89 ca mov %rcx,%r10
638c: 0f 05 syscall
638e: c3 retq
000000000000638f <unlink>:
SYSCALL(unlink)
638f: 48 c7 c0 12 00 00 00 mov $0x12,%rax
6396: 49 89 ca mov %rcx,%r10
6399: 0f 05 syscall
639b: c3 retq
000000000000639c <fstat>:
SYSCALL(fstat)
639c: 48 c7 c0 08 00 00 00 mov $0x8,%rax
63a3: 49 89 ca mov %rcx,%r10
63a6: 0f 05 syscall
63a8: c3 retq
00000000000063a9 <link>:
SYSCALL(link)
63a9: 48 c7 c0 13 00 00 00 mov $0x13,%rax
63b0: 49 89 ca mov %rcx,%r10
63b3: 0f 05 syscall
63b5: c3 retq
00000000000063b6 <mkdir>:
SYSCALL(mkdir)
63b6: 48 c7 c0 14 00 00 00 mov $0x14,%rax
63bd: 49 89 ca mov %rcx,%r10
63c0: 0f 05 syscall
63c2: c3 retq
00000000000063c3 <chdir>:
SYSCALL(chdir)
63c3: 48 c7 c0 09 00 00 00 mov $0x9,%rax
63ca: 49 89 ca mov %rcx,%r10
63cd: 0f 05 syscall
63cf: c3 retq
00000000000063d0 <dup>:
SYSCALL(dup)
63d0: 48 c7 c0 0a 00 00 00 mov $0xa,%rax
63d7: 49 89 ca mov %rcx,%r10
63da: 0f 05 syscall
63dc: c3 retq
00000000000063dd <getpid>:
SYSCALL(getpid)
63dd: 48 c7 c0 0b 00 00 00 mov $0xb,%rax
63e4: 49 89 ca mov %rcx,%r10
63e7: 0f 05 syscall
63e9: c3 retq
00000000000063ea <sbrk>:
SYSCALL(sbrk)
63ea: 48 c7 c0 0c 00 00 00 mov $0xc,%rax
63f1: 49 89 ca mov %rcx,%r10
63f4: 0f 05 syscall
63f6: c3 retq
00000000000063f7 <sleep>:
SYSCALL(sleep)
63f7: 48 c7 c0 0d 00 00 00 mov $0xd,%rax
63fe: 49 89 ca mov %rcx,%r10
6401: 0f 05 syscall
6403: c3 retq
0000000000006404 <uptime>:
SYSCALL(uptime)
6404: 48 c7 c0 0e 00 00 00 mov $0xe,%rax
640b: 49 89 ca mov %rcx,%r10
640e: 0f 05 syscall
6410: c3 retq
0000000000006411 <dedup>:
SYSCALL(dedup)
6411: 48 c7 c0 16 00 00 00 mov $0x16,%rax
6418: 49 89 ca mov %rcx,%r10
641b: 0f 05 syscall
641d: c3 retq
000000000000641e <freepages>:
SYSCALL(freepages)
641e: 48 c7 c0 17 00 00 00 mov $0x17,%rax
6425: 49 89 ca mov %rcx,%r10
6428: 0f 05 syscall
642a: c3 retq
000000000000642b <putc>:
#include <stdarg.h>
static void
putc(int fd, char c)
{
642b: f3 0f 1e fa endbr64
642f: 55 push %rbp
6430: 48 89 e5 mov %rsp,%rbp
6433: 48 83 ec 10 sub $0x10,%rsp
6437: 89 7d fc mov %edi,-0x4(%rbp)
643a: 89 f0 mov %esi,%eax
643c: 88 45 f8 mov %al,-0x8(%rbp)
write(fd, &c, 1);
643f: 48 8d 4d f8 lea -0x8(%rbp),%rcx
6443: 8b 45 fc mov -0x4(%rbp),%eax
6446: ba 01 00 00 00 mov $0x1,%edx
644b: 48 89 ce mov %rcx,%rsi
644e: 89 c7 mov %eax,%edi
6450: 48 b8 41 63 00 00 00 movabs $0x6341,%rax
6457: 00 00 00
645a: ff d0 callq *%rax
}
645c: 90 nop
645d: c9 leaveq
645e: c3 retq
000000000000645f <print_x64>:
static char digits[] = "0123456789abcdef";
static void
print_x64(int fd, addr_t x)
{
645f: f3 0f 1e fa endbr64
6463: 55 push %rbp
6464: 48 89 e5 mov %rsp,%rbp
6467: 48 83 ec 20 sub $0x20,%rsp
646b: 89 7d ec mov %edi,-0x14(%rbp)
646e: 48 89 75 e0 mov %rsi,-0x20(%rbp)
int i;
for (i = 0; i < (sizeof(addr_t) * 2); i++, x <<= 4)
6472: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
6479: eb 35 jmp 64b0 <print_x64+0x51>
putc(fd, digits[x >> (sizeof(addr_t) * 8 - 4)]);
647b: 48 8b 45 e0 mov -0x20(%rbp),%rax
647f: 48 c1 e8 3c shr $0x3c,%rax
6483: 48 ba f0 8b 00 00 00 movabs $0x8bf0,%rdx
648a: 00 00 00
648d: 0f b6 04 02 movzbl (%rdx,%rax,1),%eax
6491: 0f be d0 movsbl %al,%edx
6494: 8b 45 ec mov -0x14(%rbp),%eax
6497: 89 d6 mov %edx,%esi
6499: 89 c7 mov %eax,%edi
649b: 48 b8 2b 64 00 00 00 movabs $0x642b,%rax
64a2: 00 00 00
64a5: ff d0 callq *%rax
for (i = 0; i < (sizeof(addr_t) * 2); i++, x <<= 4)
64a7: 83 45 fc 01 addl $0x1,-0x4(%rbp)
64ab: 48 c1 65 e0 04 shlq $0x4,-0x20(%rbp)
64b0: 8b 45 fc mov -0x4(%rbp),%eax
64b3: 83 f8 0f cmp $0xf,%eax
64b6: 76 c3 jbe 647b <print_x64+0x1c>
}
64b8: 90 nop
64b9: 90 nop
64ba: c9 leaveq
64bb: c3 retq
00000000000064bc <print_x32>:
static void
print_x32(int fd, uint x)
{
64bc: f3 0f 1e fa endbr64
64c0: 55 push %rbp
64c1: 48 89 e5 mov %rsp,%rbp
64c4: 48 83 ec 20 sub $0x20,%rsp
64c8: 89 7d ec mov %edi,-0x14(%rbp)
64cb: 89 75 e8 mov %esi,-0x18(%rbp)
int i;
for (i = 0; i < (sizeof(uint) * 2); i++, x <<= 4)
64ce: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%rbp)
64d5: eb 36 jmp 650d <print_x32+0x51>
putc(fd, digits[x >> (sizeof(uint) * 8 - 4)]);
64d7: 8b 45 e8 mov -0x18(%rbp),%eax
64da: c1 e8 1c shr $0x1c,%eax
64dd: 89 c2 mov %eax,%edx
64df: 48 b8 f0 8b 00 00 00 movabs $0x8bf0,%rax
64e6: 00 00 00
64e9: 89 d2 mov %edx,%edx
64eb: 0f b6 04 10 movzbl (%rax,%rdx,1),%eax
64ef: 0f be d0 movsbl %al,%edx
64f2: 8b 45 ec mov -0x14(%rbp),%eax
64f5: 89 d6 mov %edx,%esi
64f7: 89 c7 mov %eax,%edi
64f9: 48 b8 2b 64 00 00 00 movabs $0x642b,%rax
6500: 00 00 00
6503: ff d0 callq *%rax
for (i = 0; i < (sizeof(uint) * 2); i++, x <<= 4)
6505: 83 45 fc 01 addl $0x1,-0x4(%rbp)
6509: c1 65 e8 04 shll $0x4,-0x18(%rbp)
650d: 8b 45 fc mov -0x4(%rbp),%eax
6510: 83 f8 07 cmp $0x7,%eax
6513: 76 c2 jbe 64d7 <print_x32+0x1b>
}
6515: 90 nop
6516: 90 nop
6517: c9 leaveq
6518: c3 retq
0000000000006519 <print_d>:
static void
print_d(int fd, int v)
{
6519: f3 0f 1e fa endbr64
651d: 55 push %rbp
651e: 48 89 e5 mov %rsp,%rbp
6521: 48 83 ec 30 sub $0x30,%rsp
6525: 89 7d dc mov %edi,-0x24(%rbp)
6528: 89 75 d8 mov %esi,-0x28(%rbp)
char buf[16];
int64 x = v;
652b: 8b 45 d8 mov -0x28(%rbp),%eax
652e: 48 98 cltq
6530: 48 89 45 f8 mov %rax,-0x8(%rbp)
if (v < 0)
6534: 83 7d d8 00 cmpl $0x0,-0x28(%rbp)
6538: 79 04 jns 653e <print_d+0x25>
x = -x;
653a: 48 f7 5d f8 negq -0x8(%rbp)
int i = 0;
653e: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%rbp)
do {
buf[i++] = digits[x % 10];
6545: 48 8b 4d f8 mov -0x8(%rbp),%rcx
6549: 48 ba 67 66 66 66 66 movabs $0x6666666666666667,%rdx
6550: 66 66 66
6553: 48 89 c8 mov %rcx,%rax
6556: 48 f7 ea imul %rdx
6559: 48 c1 fa 02 sar $0x2,%rdx
655d: 48 89 c8 mov %rcx,%rax
6560: 48 c1 f8 3f sar $0x3f,%rax
6564: 48 29 c2 sub %rax,%rdx
6567: 48 89 d0 mov %rdx,%rax
656a: 48 c1 e0 02 shl $0x2,%rax
656e: 48 01 d0 add %rdx,%rax
6571: 48 01 c0 add %rax,%rax
6574: 48 29 c1 sub %rax,%rcx
6577: 48 89 ca mov %rcx,%rdx
657a: 8b 45 f4 mov -0xc(%rbp),%eax
657d: 8d 48 01 lea 0x1(%rax),%ecx
6580: 89 4d f4 mov %ecx,-0xc(%rbp)
6583: 48 b9 f0 8b 00 00 00 movabs $0x8bf0,%rcx
658a: 00 00 00
658d: 0f b6 14 11 movzbl (%rcx,%rdx,1),%edx
6591: 48 98 cltq
6593: 88 54 05 e0 mov %dl,-0x20(%rbp,%rax,1)
x /= 10;
6597: 48 8b 4d f8 mov -0x8(%rbp),%rcx
659b: 48 ba 67 66 66 66 66 movabs $0x6666666666666667,%rdx
65a2: 66 66 66
65a5: 48 89 c8 mov %rcx,%rax
65a8: 48 f7 ea imul %rdx
65ab: 48 c1 fa 02 sar $0x2,%rdx
65af: 48 89 c8 mov %rcx,%rax
65b2: 48 c1 f8 3f sar $0x3f,%rax
65b6: 48 29 c2 sub %rax,%rdx
65b9: 48 89 d0 mov %rdx,%rax
65bc: 48 89 45 f8 mov %rax,-0x8(%rbp)
} while(x != 0);
65c0: 48 83 7d f8 00 cmpq $0x0,-0x8(%rbp)
65c5: 0f 85 7a ff ff ff jne 6545 <print_d+0x2c>
if (v < 0)
65cb: 83 7d d8 00 cmpl $0x0,-0x28(%rbp)
65cf: 79 32 jns 6603 <print_d+0xea>
buf[i++] = '-';
65d1: 8b 45 f4 mov -0xc(%rbp),%eax
65d4: 8d 50 01 lea 0x1(%rax),%edx
65d7: 89 55 f4 mov %edx,-0xc(%rbp)
65da: 48 98 cltq
65dc: c6 44 05 e0 2d movb $0x2d,-0x20(%rbp,%rax,1)
while (--i >= 0)
65e1: eb 20 jmp 6603 <print_d+0xea>
putc(fd, buf[i]);
65e3: 8b 45 f4 mov -0xc(%rbp),%eax
65e6: 48 98 cltq
65e8: 0f b6 44 05 e0 movzbl -0x20(%rbp,%rax,1),%eax
65ed: 0f be d0 movsbl %al,%edx
65f0: 8b 45 dc mov -0x24(%rbp),%eax
65f3: 89 d6 mov %edx,%esi
65f5: 89 c7 mov %eax,%edi
65f7: 48 b8 2b 64 00 00 00 movabs $0x642b,%rax
65fe: 00 00 00
6601: ff d0 callq *%rax
while (--i >= 0)
6603: 83 6d f4 01 subl $0x1,-0xc(%rbp)
6607: 83 7d f4 00 cmpl $0x0,-0xc(%rbp)
660b: 79 d6 jns 65e3 <print_d+0xca>
}
660d: 90 nop
660e: 90 nop
660f: c9 leaveq
6610: c3 retq
0000000000006611 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
6611: f3 0f 1e fa endbr64
6615: 55 push %rbp
6616: 48 89 e5 mov %rsp,%rbp
6619: 48 81 ec f0 00 00 00 sub $0xf0,%rsp
6620: 89 bd 1c ff ff ff mov %edi,-0xe4(%rbp)
6626: 48 89 b5 10 ff ff ff mov %rsi,-0xf0(%rbp)
662d: 48 89 95 60 ff ff ff mov %rdx,-0xa0(%rbp)
6634: 48 89 8d 68 ff ff ff mov %rcx,-0x98(%rbp)
663b: 4c 89 85 70 ff ff ff mov %r8,-0x90(%rbp)
6642: 4c 89 8d 78 ff ff ff mov %r9,-0x88(%rbp)
6649: 84 c0 test %al,%al
664b: 74 20 je 666d <printf+0x5c>
664d: 0f 29 45 80 movaps %xmm0,-0x80(%rbp)
6651: 0f 29 4d 90 movaps %xmm1,-0x70(%rbp)
6655: 0f 29 55 a0 movaps %xmm2,-0x60(%rbp)
6659: 0f 29 5d b0 movaps %xmm3,-0x50(%rbp)
665d: 0f 29 65 c0 movaps %xmm4,-0x40(%rbp)
6661: 0f 29 6d d0 movaps %xmm5,-0x30(%rbp)
6665: 0f 29 75 e0 movaps %xmm6,-0x20(%rbp)
6669: 0f 29 7d f0 movaps %xmm7,-0x10(%rbp)
va_list ap;
int i, c;
char *s;
va_start(ap, fmt);
666d: c7 85 20 ff ff ff 10 movl $0x10,-0xe0(%rbp)
6674: 00 00 00
6677: c7 85 24 ff ff ff 30 movl $0x30,-0xdc(%rbp)
667e: 00 00 00
6681: 48 8d 45 10 lea 0x10(%rbp),%rax
6685: 48 89 85 28 ff ff ff mov %rax,-0xd8(%rbp)
668c: 48 8d 85 50 ff ff ff lea -0xb0(%rbp),%rax
6693: 48 89 85 30 ff ff ff mov %rax,-0xd0(%rbp)
for (i = 0; (c = fmt[i] & 0xff) != 0; i++) {
669a: c7 85 4c ff ff ff 00 movl $0x0,-0xb4(%rbp)
66a1: 00 00 00
66a4: e9 41 03 00 00 jmpq 69ea <printf+0x3d9>
if (c != '%') {
66a9: 83 bd 3c ff ff ff 25 cmpl $0x25,-0xc4(%rbp)
66b0: 74 24 je 66d6 <printf+0xc5>
putc(fd, c);
66b2: 8b 85 3c ff ff ff mov -0xc4(%rbp),%eax
66b8: 0f be d0 movsbl %al,%edx
66bb: 8b 85 1c ff ff ff mov -0xe4(%rbp),%eax
66c1: 89 d6 mov %edx,%esi
66c3: 89 c7 mov %eax,%edi
66c5: 48 b8 2b 64 00 00 00 movabs $0x642b,%rax
66cc: 00 00 00
66cf: ff d0 callq *%rax
continue;
66d1: e9 0d 03 00 00 jmpq 69e3 <printf+0x3d2>
}
c = fmt[++i] & 0xff;
66d6: 83 85 4c ff ff ff 01 addl $0x1,-0xb4(%rbp)
66dd: 8b 85 4c ff ff ff mov -0xb4(%rbp),%eax
66e3: 48 63 d0 movslq %eax,%rdx
66e6: 48 8b 85 10 ff ff ff mov -0xf0(%rbp),%rax
66ed: 48 01 d0 add %rdx,%rax
66f0: 0f b6 00 movzbl (%rax),%eax
66f3: 0f be c0 movsbl %al,%eax
66f6: 25 ff 00 00 00 and $0xff,%eax
66fb: 89 85 3c ff ff ff mov %eax,-0xc4(%rbp)
if (c == 0)
6701: 83 bd 3c ff ff ff 00 cmpl $0x0,-0xc4(%rbp)
6708: 0f 84 0f 03 00 00 je 6a1d <printf+0x40c>
break;
switch(c) {
670e: 83 bd 3c ff ff ff 25 cmpl $0x25,-0xc4(%rbp)
6715: 0f 84 74 02 00 00 je 698f <printf+0x37e>
671b: 83 bd 3c ff ff ff 25 cmpl $0x25,-0xc4(%rbp)
6722: 0f 8c 82 02 00 00 jl 69aa <printf+0x399>
6728: 83 bd 3c ff ff ff 78 cmpl $0x78,-0xc4(%rbp)
672f: 0f 8f 75 02 00 00 jg 69aa <printf+0x399>
6735: 83 bd 3c ff ff ff 63 cmpl $0x63,-0xc4(%rbp)
673c: 0f 8c 68 02 00 00 jl 69aa <printf+0x399>
6742: 8b 85 3c ff ff ff mov -0xc4(%rbp),%eax
6748: 83 e8 63 sub $0x63,%eax
674b: 83 f8 15 cmp $0x15,%eax
674e: 0f 87 56 02 00 00 ja 69aa <printf+0x399>
6754: 89 c0 mov %eax,%eax
6756: 48 8d 14 c5 00 00 00 lea 0x0(,%rax,8),%rdx
675d: 00
675e: 48 b8 b0 83 00 00 00 movabs $0x83b0,%rax
6765: 00 00 00
6768: 48 01 d0 add %rdx,%rax
676b: 48 8b 00 mov (%rax),%rax
676e: 3e ff e0 notrack jmpq *%rax
case 'c':
putc(fd, va_arg(ap, int));
6771: 8b 85 20 ff ff ff mov -0xe0(%rbp),%eax
6777: 83 f8 2f cmp $0x2f,%eax
677a: 77 23 ja 679f <printf+0x18e>
677c: 48 8b 85 30 ff ff ff mov -0xd0(%rbp),%rax
6783: 8b 95 20 ff ff ff mov -0xe0(%rbp),%edx
6789: 89 d2 mov %edx,%edx
678b: 48 01 d0 add %rdx,%rax
678e: 8b 95 20 ff ff ff mov -0xe0(%rbp),%edx
6794: 83 c2 08 add $0x8,%edx
6797: 89 95 20 ff ff ff mov %edx,-0xe0(%rbp)
679d: eb 12 jmp 67b1 <printf+0x1a0>
679f: 48 8b 85 28 ff ff ff mov -0xd8(%rbp),%rax
67a6: 48 8d 50 08 lea 0x8(%rax),%rdx
67aa: 48 89 95 28 ff ff ff mov %rdx,-0xd8(%rbp)
67b1: 8b 00 mov (%rax),%eax
67b3: 0f be d0 movsbl %al,%edx
67b6: 8b 85 1c ff ff ff mov -0xe4(%rbp),%eax
67bc: 89 d6 mov %edx,%esi
67be: 89 c7 mov %eax,%edi
67c0: 48 b8 2b 64 00 00 00 movabs $0x642b,%rax
67c7: 00 00 00
67ca: ff d0 callq *%rax
break;
67cc: e9 12 02 00 00 jmpq 69e3 <printf+0x3d2>
case 'd':
print_d(fd, va_arg(ap, int));
67d1: 8b 85 20 ff ff ff mov -0xe0(%rbp),%eax
67d7: 83 f8 2f cmp $0x2f,%eax
67da: 77 23 ja 67ff <printf+0x1ee>
67dc: 48 8b 85 30 ff ff ff mov -0xd0(%rbp),%rax
67e3: 8b 95 20 ff ff ff mov -0xe0(%rbp),%edx
67e9: 89 d2 mov %edx,%edx
67eb: 48 01 d0 add %rdx,%rax
67ee: 8b 95 20 ff ff ff mov -0xe0(%rbp),%edx
67f4: 83 c2 08 add $0x8,%edx
67f7: 89 95 20 ff ff ff mov %edx,-0xe0(%rbp)
67fd: eb 12 jmp 6811 <printf+0x200>
67ff: 48 8b 85 28 ff ff ff mov -0xd8(%rbp),%rax
6806: 48 8d 50 08 lea 0x8(%rax),%rdx
680a: 48 89 95 28 ff ff ff mov %rdx,-0xd8(%rbp)
6811: 8b 10 mov (%rax),%edx
6813: 8b 85 1c ff ff ff mov -0xe4(%rbp),%eax
6819: 89 d6 mov %edx,%esi
681b: 89 c7 mov %eax,%edi
681d: 48 b8 19 65 00 00 00 movabs $0x6519,%rax
6824: 00 00 00
6827: ff d0 callq *%rax
break;
6829: e9 b5 01 00 00 jmpq 69e3 <printf+0x3d2>
case 'x':
print_x32(fd, va_arg(ap, uint));
682e: 8b 85 20 ff ff ff mov -0xe0(%rbp),%eax
6834: 83 f8 2f cmp $0x2f,%eax
6837: 77 23 ja 685c <printf+0x24b>
6839: 48 8b 85 30 ff ff ff mov -0xd0(%rbp),%rax
6840: 8b 95 20 ff ff ff mov -0xe0(%rbp),%edx
6846: 89 d2 mov %edx,%edx
6848: 48 01 d0 add %rdx,%rax
684b: 8b 95 20 ff ff ff mov -0xe0(%rbp),%edx
6851: 83 c2 08 add $0x8,%edx
6854: 89 95 20 ff ff ff mov %edx,-0xe0(%rbp)
685a: eb 12 jmp 686e <printf+0x25d>
685c: 48 8b 85 28 ff ff ff mov -0xd8(%rbp),%rax
6863: 48 8d 50 08 lea 0x8(%rax),%rdx
6867: 48 89 95 28 ff ff ff mov %rdx,-0xd8(%rbp)
686e: 8b 10 mov (%rax),%edx
6870: 8b 85 1c ff ff ff mov -0xe4(%rbp),%eax
6876: 89 d6 mov %edx,%esi
6878: 89 c7 mov %eax,%edi
687a: 48 b8 bc 64 00 00 00 movabs $0x64bc,%rax
6881: 00 00 00
6884: ff d0 callq *%rax
break;
6886: e9 58 01 00 00 jmpq 69e3 <printf+0x3d2>
case 'p':
print_x64(fd, va_arg(ap, addr_t));
688b: 8b 85 20 ff ff ff mov -0xe0(%rbp),%eax
6891: 83 f8 2f cmp $0x2f,%eax
6894: 77 23 ja 68b9 <printf+0x2a8>
6896: 48 8b 85 30 ff ff ff mov -0xd0(%rbp),%rax
689d: 8b 95 20 ff ff ff mov -0xe0(%rbp),%edx
68a3: 89 d2 mov %edx,%edx
68a5: 48 01 d0 add %rdx,%rax
68a8: 8b 95 20 ff ff ff mov -0xe0(%rbp),%edx
68ae: 83 c2 08 add $0x8,%edx
68b1: 89 95 20 ff ff ff mov %edx,-0xe0(%rbp)
68b7: eb 12 jmp 68cb <printf+0x2ba>
68b9: 48 8b 85 28 ff ff ff mov -0xd8(%rbp),%rax
68c0: 48 8d 50 08 lea 0x8(%rax),%rdx
68c4: 48 89 95 28 ff ff ff mov %rdx,-0xd8(%rbp)
68cb: 48 8b 10 mov (%rax),%rdx
68ce: 8b 85 1c ff ff ff mov -0xe4(%rbp),%eax
68d4: 48 89 d6 mov %rdx,%rsi
68d7: 89 c7 mov %eax,%edi
68d9: 48 b8 5f 64 00 00 00 movabs $0x645f,%rax
68e0: 00 00 00
68e3: ff d0 callq *%rax
break;
68e5: e9 f9 00 00 00 jmpq 69e3 <printf+0x3d2>
case 's':
if ((s = va_arg(ap, char*)) == 0)
68ea: 8b 85 20 ff ff ff mov -0xe0(%rbp),%eax
68f0: 83 f8 2f cmp $0x2f,%eax
68f3: 77 23 ja 6918 <printf+0x307>
68f5: 48 8b 85 30 ff ff ff mov -0xd0(%rbp),%rax
68fc: 8b 95 20 ff ff ff mov -0xe0(%rbp),%edx
6902: 89 d2 mov %edx,%edx
6904: 48 01 d0 add %rdx,%rax
6907: 8b 95 20 ff ff ff mov -0xe0(%rbp),%edx
690d: 83 c2 08 add $0x8,%edx
6910: 89 95 20 ff ff ff mov %edx,-0xe0(%rbp)
6916: eb 12 jmp 692a <printf+0x319>
6918: 48 8b 85 28 ff ff ff mov -0xd8(%rbp),%rax
691f: 48 8d 50 08 lea 0x8(%rax),%rdx
6923: 48 89 95 28 ff ff ff mov %rdx,-0xd8(%rbp)
692a: 48 8b 00 mov (%rax),%rax
692d: 48 89 85 40 ff ff ff mov %rax,-0xc0(%rbp)
6934: 48 83 bd 40 ff ff ff cmpq $0x0,-0xc0(%rbp)
693b: 00
693c: 75 41 jne 697f <printf+0x36e>
s = "(null)";
693e: 48 b8 a8 83 00 00 00 movabs $0x83a8,%rax
6945: 00 00 00
6948: 48 89 85 40 ff ff ff mov %rax,-0xc0(%rbp)
while (*s)
694f: eb 2e jmp 697f <printf+0x36e>
putc(fd, *(s++));
6951: 48 8b 85 40 ff ff ff mov -0xc0(%rbp),%rax
6958: 48 8d 50 01 lea 0x1(%rax),%rdx
695c: 48 89 95 40 ff ff ff mov %rdx,-0xc0(%rbp)
6963: 0f b6 00 movzbl (%rax),%eax
6966: 0f be d0 movsbl %al,%edx
6969: 8b 85 1c ff ff ff mov -0xe4(%rbp),%eax
696f: 89 d6 mov %edx,%esi
6971: 89 c7 mov %eax,%edi
6973: 48 b8 2b 64 00 00 00 movabs $0x642b,%rax
697a: 00 00 00
697d: ff d0 callq *%rax
while (*s)
697f: 48 8b 85 40 ff ff ff mov -0xc0(%rbp),%rax
6986: 0f b6 00 movzbl (%rax),%eax
6989: 84 c0 test %al,%al
698b: 75 c4 jne 6951 <printf+0x340>
break;
698d: eb 54 jmp 69e3 <printf+0x3d2>
case '%':
putc(fd, '%');
698f: 8b 85 1c ff ff ff mov -0xe4(%rbp),%eax
6995: be 25 00 00 00 mov $0x25,%esi
699a: 89 c7 mov %eax,%edi
699c: 48 b8 2b 64 00 00 00 movabs $0x642b,%rax
69a3: 00 00 00
69a6: ff d0 callq *%rax
break;
69a8: eb 39 jmp 69e3 <printf+0x3d2>
default:
// Print unknown % sequence to draw attention.
putc(fd, '%');
69aa: 8b 85 1c ff ff ff mov -0xe4(%rbp),%eax
69b0: be 25 00 00 00 mov $0x25,%esi
69b5: 89 c7 mov %eax,%edi
69b7: 48 b8 2b 64 00 00 00 movabs $0x642b,%rax
69be: 00 00 00
69c1: ff d0 callq *%rax
putc(fd, c);
69c3: 8b 85 3c ff ff ff mov -0xc4(%rbp),%eax
69c9: 0f be d0 movsbl %al,%edx
69cc: 8b 85 1c ff ff ff mov -0xe4(%rbp),%eax
69d2: 89 d6 mov %edx,%esi
69d4: 89 c7 mov %eax,%edi
69d6: 48 b8 2b 64 00 00 00 movabs $0x642b,%rax
69dd: 00 00 00
69e0: ff d0 callq *%rax
break;
69e2: 90 nop
for (i = 0; (c = fmt[i] & 0xff) != 0; i++) {
69e3: 83 85 4c ff ff ff 01 addl $0x1,-0xb4(%rbp)
69ea: 8b 85 4c ff ff ff mov -0xb4(%rbp),%eax
69f0: 48 63 d0 movslq %eax,%rdx
69f3: 48 8b 85 10 ff ff ff mov -0xf0(%rbp),%rax
69fa: 48 01 d0 add %rdx,%rax
69fd: 0f b6 00 movzbl (%rax),%eax
6a00: 0f be c0 movsbl %al,%eax
6a03: 25 ff 00 00 00 and $0xff,%eax
6a08: 89 85 3c ff ff ff mov %eax,-0xc4(%rbp)
6a0e: 83 bd 3c ff ff ff 00 cmpl $0x0,-0xc4(%rbp)
6a15: 0f 85 8e fc ff ff jne 66a9 <printf+0x98>
}
}
}
6a1b: eb 01 jmp 6a1e <printf+0x40d>
break;
6a1d: 90 nop
}
6a1e: 90 nop
6a1f: c9 leaveq
6a20: c3 retq
0000000000006a21 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
6a21: f3 0f 1e fa endbr64
6a25: 55 push %rbp
6a26: 48 89 e5 mov %rsp,%rbp
6a29: 48 83 ec 18 sub $0x18,%rsp
6a2d: 48 89 7d e8 mov %rdi,-0x18(%rbp)
Header *bp, *p;
bp = (Header*)ap - 1;
6a31: 48 8b 45 e8 mov -0x18(%rbp),%rax
6a35: 48 83 e8 10 sub $0x10,%rax
6a39: 48 89 45 f0 mov %rax,-0x10(%rbp)
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
6a3d: 48 b8 70 d4 00 00 00 movabs $0xd470,%rax
6a44: 00 00 00
6a47: 48 8b 00 mov (%rax),%rax
6a4a: 48 89 45 f8 mov %rax,-0x8(%rbp)
6a4e: eb 2f jmp 6a7f <free+0x5e>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
6a50: 48 8b 45 f8 mov -0x8(%rbp),%rax
6a54: 48 8b 00 mov (%rax),%rax
6a57: 48 39 45 f8 cmp %rax,-0x8(%rbp)
6a5b: 72 17 jb 6a74 <free+0x53>
6a5d: 48 8b 45 f0 mov -0x10(%rbp),%rax
6a61: 48 3b 45 f8 cmp -0x8(%rbp),%rax
6a65: 77 2f ja 6a96 <free+0x75>
6a67: 48 8b 45 f8 mov -0x8(%rbp),%rax
6a6b: 48 8b 00 mov (%rax),%rax
6a6e: 48 39 45 f0 cmp %rax,-0x10(%rbp)
6a72: 72 22 jb 6a96 <free+0x75>
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
6a74: 48 8b 45 f8 mov -0x8(%rbp),%rax
6a78: 48 8b 00 mov (%rax),%rax
6a7b: 48 89 45 f8 mov %rax,-0x8(%rbp)
6a7f: 48 8b 45 f0 mov -0x10(%rbp),%rax
6a83: 48 3b 45 f8 cmp -0x8(%rbp),%rax
6a87: 76 c7 jbe 6a50 <free+0x2f>
6a89: 48 8b 45 f8 mov -0x8(%rbp),%rax
6a8d: 48 8b 00 mov (%rax),%rax
6a90: 48 39 45 f0 cmp %rax,-0x10(%rbp)
6a94: 73 ba jae 6a50 <free+0x2f>
break;
if(bp + bp->s.size == p->s.ptr){
6a96: 48 8b 45 f0 mov -0x10(%rbp),%rax
6a9a: 8b 40 08 mov 0x8(%rax),%eax
6a9d: 89 c0 mov %eax,%eax
6a9f: 48 c1 e0 04 shl $0x4,%rax
6aa3: 48 89 c2 mov %rax,%rdx
6aa6: 48 8b 45 f0 mov -0x10(%rbp),%rax
6aaa: 48 01 c2 add %rax,%rdx
6aad: 48 8b 45 f8 mov -0x8(%rbp),%rax
6ab1: 48 8b 00 mov (%rax),%rax
6ab4: 48 39 c2 cmp %rax,%rdx
6ab7: 75 2d jne 6ae6 <free+0xc5>
bp->s.size += p->s.ptr->s.size;
6ab9: 48 8b 45 f0 mov -0x10(%rbp),%rax
6abd: 8b 50 08 mov 0x8(%rax),%edx
6ac0: 48 8b 45 f8 mov -0x8(%rbp),%rax
6ac4: 48 8b 00 mov (%rax),%rax
6ac7: 8b 40 08 mov 0x8(%rax),%eax
6aca: 01 c2 add %eax,%edx
6acc: 48 8b 45 f0 mov -0x10(%rbp),%rax
6ad0: 89 50 08 mov %edx,0x8(%rax)
bp->s.ptr = p->s.ptr->s.ptr;
6ad3: 48 8b 45 f8 mov -0x8(%rbp),%rax
6ad7: 48 8b 00 mov (%rax),%rax
6ada: 48 8b 10 mov (%rax),%rdx
6add: 48 8b 45 f0 mov -0x10(%rbp),%rax
6ae1: 48 89 10 mov %rdx,(%rax)
6ae4: eb 0e jmp 6af4 <free+0xd3>
} else
bp->s.ptr = p->s.ptr;
6ae6: 48 8b 45 f8 mov -0x8(%rbp),%rax
6aea: 48 8b 10 mov (%rax),%rdx
6aed: 48 8b 45 f0 mov -0x10(%rbp),%rax
6af1: 48 89 10 mov %rdx,(%rax)
if(p + p->s.size == bp){
6af4: 48 8b 45 f8 mov -0x8(%rbp),%rax
6af8: 8b 40 08 mov 0x8(%rax),%eax
6afb: 89 c0 mov %eax,%eax
6afd: 48 c1 e0 04 shl $0x4,%rax
6b01: 48 89 c2 mov %rax,%rdx
6b04: 48 8b 45 f8 mov -0x8(%rbp),%rax
6b08: 48 01 d0 add %rdx,%rax
6b0b: 48 39 45 f0 cmp %rax,-0x10(%rbp)
6b0f: 75 27 jne 6b38 <free+0x117>
p->s.size += bp->s.size;
6b11: 48 8b 45 f8 mov -0x8(%rbp),%rax
6b15: 8b 50 08 mov 0x8(%rax),%edx
6b18: 48 8b 45 f0 mov -0x10(%rbp),%rax
6b1c: 8b 40 08 mov 0x8(%rax),%eax
6b1f: 01 c2 add %eax,%edx
6b21: 48 8b 45 f8 mov -0x8(%rbp),%rax
6b25: 89 50 08 mov %edx,0x8(%rax)
p->s.ptr = bp->s.ptr;
6b28: 48 8b 45 f0 mov -0x10(%rbp),%rax
6b2c: 48 8b 10 mov (%rax),%rdx
6b2f: 48 8b 45 f8 mov -0x8(%rbp),%rax
6b33: 48 89 10 mov %rdx,(%rax)
6b36: eb 0b jmp 6b43 <free+0x122>
} else
p->s.ptr = bp;
6b38: 48 8b 45 f8 mov -0x8(%rbp),%rax
6b3c: 48 8b 55 f0 mov -0x10(%rbp),%rdx
6b40: 48 89 10 mov %rdx,(%rax)
freep = p;
6b43: 48 ba 70 d4 00 00 00 movabs $0xd470,%rdx
6b4a: 00 00 00
6b4d: 48 8b 45 f8 mov -0x8(%rbp),%rax
6b51: 48 89 02 mov %rax,(%rdx)
}
6b54: 90 nop
6b55: c9 leaveq
6b56: c3 retq
0000000000006b57 <morecore>:
static Header*
morecore(uint nu)
{
6b57: f3 0f 1e fa endbr64
6b5b: 55 push %rbp
6b5c: 48 89 e5 mov %rsp,%rbp
6b5f: 48 83 ec 20 sub $0x20,%rsp
6b63: 89 7d ec mov %edi,-0x14(%rbp)
char *p;
Header *hp;
if(nu < 4096)
6b66: 81 7d ec ff 0f 00 00 cmpl $0xfff,-0x14(%rbp)
6b6d: 77 07 ja 6b76 <morecore+0x1f>
nu = 4096;
6b6f: c7 45 ec 00 10 00 00 movl $0x1000,-0x14(%rbp)
p = sbrk(nu * sizeof(Header));
6b76: 8b 45 ec mov -0x14(%rbp),%eax
6b79: 48 c1 e0 04 shl $0x4,%rax
6b7d: 48 89 c7 mov %rax,%rdi
6b80: 48 b8 ea 63 00 00 00 movabs $0x63ea,%rax
6b87: 00 00 00
6b8a: ff d0 callq *%rax
6b8c: 48 89 45 f8 mov %rax,-0x8(%rbp)
if(p == (char*)-1)
6b90: 48 83 7d f8 ff cmpq $0xffffffffffffffff,-0x8(%rbp)
6b95: 75 07 jne 6b9e <morecore+0x47>
return 0;
6b97: b8 00 00 00 00 mov $0x0,%eax
6b9c: eb 36 jmp 6bd4 <morecore+0x7d>
hp = (Header*)p;
6b9e: 48 8b 45 f8 mov -0x8(%rbp),%rax
6ba2: 48 89 45 f0 mov %rax,-0x10(%rbp)
hp->s.size = nu;
6ba6: 48 8b 45 f0 mov -0x10(%rbp),%rax
6baa: 8b 55 ec mov -0x14(%rbp),%edx
6bad: 89 50 08 mov %edx,0x8(%rax)
free((void*)(hp + 1));
6bb0: 48 8b 45 f0 mov -0x10(%rbp),%rax
6bb4: 48 83 c0 10 add $0x10,%rax
6bb8: 48 89 c7 mov %rax,%rdi
6bbb: 48 b8 21 6a 00 00 00 movabs $0x6a21,%rax
6bc2: 00 00 00
6bc5: ff d0 callq *%rax
return freep;
6bc7: 48 b8 70 d4 00 00 00 movabs $0xd470,%rax
6bce: 00 00 00
6bd1: 48 8b 00 mov (%rax),%rax
}
6bd4: c9 leaveq
6bd5: c3 retq
0000000000006bd6 <malloc>:
void*
malloc(uint nbytes)
{
6bd6: f3 0f 1e fa endbr64
6bda: 55 push %rbp
6bdb: 48 89 e5 mov %rsp,%rbp
6bde: 48 83 ec 30 sub $0x30,%rsp
6be2: 89 7d dc mov %edi,-0x24(%rbp)
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
6be5: 8b 45 dc mov -0x24(%rbp),%eax
6be8: 48 83 c0 0f add $0xf,%rax
6bec: 48 c1 e8 04 shr $0x4,%rax
6bf0: 83 c0 01 add $0x1,%eax
6bf3: 89 45 ec mov %eax,-0x14(%rbp)
if((prevp = freep) == 0){
6bf6: 48 b8 70 d4 00 00 00 movabs $0xd470,%rax
6bfd: 00 00 00
6c00: 48 8b 00 mov (%rax),%rax
6c03: 48 89 45 f0 mov %rax,-0x10(%rbp)
6c07: 48 83 7d f0 00 cmpq $0x0,-0x10(%rbp)
6c0c: 75 4a jne 6c58 <malloc+0x82>
base.s.ptr = freep = prevp = &base;
6c0e: 48 b8 60 d4 00 00 00 movabs $0xd460,%rax
6c15: 00 00 00
6c18: 48 89 45 f0 mov %rax,-0x10(%rbp)
6c1c: 48 ba 70 d4 00 00 00 movabs $0xd470,%rdx
6c23: 00 00 00
6c26: 48 8b 45 f0 mov -0x10(%rbp),%rax
6c2a: 48 89 02 mov %rax,(%rdx)
6c2d: 48 b8 70 d4 00 00 00 movabs $0xd470,%rax
6c34: 00 00 00
6c37: 48 8b 00 mov (%rax),%rax
6c3a: 48 ba 60 d4 00 00 00 movabs $0xd460,%rdx
6c41: 00 00 00
6c44: 48 89 02 mov %rax,(%rdx)
base.s.size = 0;
6c47: 48 b8 60 d4 00 00 00 movabs $0xd460,%rax
6c4e: 00 00 00
6c51: c7 40 08 00 00 00 00 movl $0x0,0x8(%rax)
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
6c58: 48 8b 45 f0 mov -0x10(%rbp),%rax
6c5c: 48 8b 00 mov (%rax),%rax
6c5f: 48 89 45 f8 mov %rax,-0x8(%rbp)
if(p->s.size >= nunits){
6c63: 48 8b 45 f8 mov -0x8(%rbp),%rax
6c67: 8b 40 08 mov 0x8(%rax),%eax
6c6a: 39 45 ec cmp %eax,-0x14(%rbp)
6c6d: 77 65 ja 6cd4 <malloc+0xfe>
if(p->s.size == nunits)
6c6f: 48 8b 45 f8 mov -0x8(%rbp),%rax
6c73: 8b 40 08 mov 0x8(%rax),%eax
6c76: 39 45 ec cmp %eax,-0x14(%rbp)
6c79: 75 10 jne 6c8b <malloc+0xb5>
prevp->s.ptr = p->s.ptr;
6c7b: 48 8b 45 f8 mov -0x8(%rbp),%rax
6c7f: 48 8b 10 mov (%rax),%rdx
6c82: 48 8b 45 f0 mov -0x10(%rbp),%rax
6c86: 48 89 10 mov %rdx,(%rax)
6c89: eb 2e jmp 6cb9 <malloc+0xe3>
else {
p->s.size -= nunits;
6c8b: 48 8b 45 f8 mov -0x8(%rbp),%rax
6c8f: 8b 40 08 mov 0x8(%rax),%eax
6c92: 2b 45 ec sub -0x14(%rbp),%eax
6c95: 89 c2 mov %eax,%edx
6c97: 48 8b 45 f8 mov -0x8(%rbp),%rax
6c9b: 89 50 08 mov %edx,0x8(%rax)
p += p->s.size;
6c9e: 48 8b 45 f8 mov -0x8(%rbp),%rax
6ca2: 8b 40 08 mov 0x8(%rax),%eax
6ca5: 89 c0 mov %eax,%eax
6ca7: 48 c1 e0 04 shl $0x4,%rax
6cab: 48 01 45 f8 add %rax,-0x8(%rbp)
p->s.size = nunits;
6caf: 48 8b 45 f8 mov -0x8(%rbp),%rax
6cb3: 8b 55 ec mov -0x14(%rbp),%edx
6cb6: 89 50 08 mov %edx,0x8(%rax)
}
freep = prevp;
6cb9: 48 ba 70 d4 00 00 00 movabs $0xd470,%rdx
6cc0: 00 00 00
6cc3: 48 8b 45 f0 mov -0x10(%rbp),%rax
6cc7: 48 89 02 mov %rax,(%rdx)
return (void*)(p + 1);
6cca: 48 8b 45 f8 mov -0x8(%rbp),%rax
6cce: 48 83 c0 10 add $0x10,%rax
6cd2: eb 4e jmp 6d22 <malloc+0x14c>
}
if(p == freep)
6cd4: 48 b8 70 d4 00 00 00 movabs $0xd470,%rax
6cdb: 00 00 00
6cde: 48 8b 00 mov (%rax),%rax
6ce1: 48 39 45 f8 cmp %rax,-0x8(%rbp)
6ce5: 75 23 jne 6d0a <malloc+0x134>
if((p = morecore(nunits)) == 0)
6ce7: 8b 45 ec mov -0x14(%rbp),%eax
6cea: 89 c7 mov %eax,%edi
6cec: 48 b8 57 6b 00 00 00 movabs $0x6b57,%rax
6cf3: 00 00 00
6cf6: ff d0 callq *%rax
6cf8: 48 89 45 f8 mov %rax,-0x8(%rbp)
6cfc: 48 83 7d f8 00 cmpq $0x0,-0x8(%rbp)
6d01: 75 07 jne 6d0a <malloc+0x134>
return 0;
6d03: b8 00 00 00 00 mov $0x0,%eax
6d08: eb 18 jmp 6d22 <malloc+0x14c>
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
6d0a: 48 8b 45 f8 mov -0x8(%rbp),%rax
6d0e: 48 89 45 f0 mov %rax,-0x10(%rbp)
6d12: 48 8b 45 f8 mov -0x8(%rbp),%rax
6d16: 48 8b 00 mov (%rax),%rax
6d19: 48 89 45 f8 mov %rax,-0x8(%rbp)
if(p->s.size >= nunits){
6d1d: e9 41 ff ff ff jmpq 6c63 <malloc+0x8d>
}
}
6d22: c9 leaveq
6d23: c3 retq
|
; A166977: Jacobsthal-Lucas numbers A014551, except a(0) = 0.
; 0,1,5,7,17,31,65,127,257,511,1025,2047,4097,8191,16385,32767,65537,131071,262145,524287,1048577,2097151,4194305,8388607,16777217,33554431,67108865,134217727,268435457,536870911,1073741825,2147483647,4294967297,8589934591,17179869185,34359738367,68719476737,137438953471,274877906945,549755813887,1099511627777,2199023255551,4398046511105,8796093022207,17592186044417,35184372088831,70368744177665,140737488355327,281474976710657,562949953421311,1125899906842625,2251799813685247,4503599627370497,9007199254740991
lpb $0,1
mov $1,$0
sub $0,1
add $4,1
add $2,$4
add $3,2
add $5,1
mov $4,$5
trn $4,$3
trn $3,4
mul $4,2
add $1,$4
mov $6,2
add $6,$2
mov $5,$6
lpe
|
; A071840: Number of primes == 3 mod 8 <= n.
; 0,0,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7
mov $2,$0
mov $3,$0
lpb $3,1
mov $0,$2
sub $3,1
sub $0,$3
mov $4,$0
div $4,2
add $4,$0
add $4,1
gcd $4,4
cal $0,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
mul $4,2
div $4,6
add $4,$0
trn $4,1
add $1,$4
lpe
|
/****************************************************************************
*
* Copyright (C) 2019 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name PX4 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.
*
****************************************************************************/
/*
* @file NotchFilter.hpp
*
* @brief Notch filter with array input/output
*
* @author Mathieu Bresciani <brescianimathieu@gmail.com>
* @author Samuel Garcin <samuel.garcin@wecorpindustries.com>
*/
#pragma once
#include "NotchFilter.hpp"
namespace math
{
template<typename T>
class NotchFilterArray : public NotchFilter<T>
{
using NotchFilter<T>::_delay_element_1;
using NotchFilter<T>::_delay_element_2;
using NotchFilter<T>::_delay_element_output_1;
using NotchFilter<T>::_delay_element_output_2;
using NotchFilter<T>::_a1;
using NotchFilter<T>::_a2;
using NotchFilter<T>::_b0;
using NotchFilter<T>::_b1;
using NotchFilter<T>::_b2;
public:
NotchFilterArray() = default;
~NotchFilterArray() = default;
/**
* Add new raw values to the filter using the Direct form II.
*
* @return retrieve the filtered result
*/
inline void apply(T samples[], uint8_t num_samples)
{
for (int n = 0; n < num_samples; n++) {
// Direct Form II implementation
T delay_element_0{samples[n] - _delay_element_1 *_a1 - _delay_element_2 * _a2};
// don't allow bad values to propagate via the filter
if (!isFinite(delay_element_0)) {
delay_element_0 = samples[n];
}
samples[n] = delay_element_0 * _b0 + _delay_element_1 * _b1 + _delay_element_2 * _b2;
_delay_element_2 = _delay_element_1;
_delay_element_1 = delay_element_0;
}
}
/**
* Add new raw values to the filter using the Direct form I.
*
* @return retrieve the filtered result
*/
inline void applyDF1(T samples[], uint8_t num_samples)
{
for (int n = 0; n < num_samples; n++) {
// Direct Form II implementation
const T output = _b0 * samples[n] + _b1 * _delay_element_1 + _b2 * _delay_element_2 - _a1 * _delay_element_output_1 -
_a2 * _delay_element_output_2;
// don't allow bad values to propagate via the filter
if (!isFinite(output)) {
output = samples[n];
}
// shift inputs
_delay_element_2 = _delay_element_1;
_delay_element_1 = samples[n];
// shift outputs
_delay_element_output_2 = _delay_element_output_1;
_delay_element_output_1 = output;
// writes value to array
samples[n] = output;
}
}
};
} // namespace math
|
; A345176: a(n) = Sum_{k=1..n} floor(n/k)^k.
; Submitted by Jamie Morken(s3)
; 1,3,5,10,12,26,28,52,73,115,117,295,297,439,713,1160,1162,2448,2450,4644,6832,8902,8904,23536,25639,33857,53247,84961,84963,192237,192239,318477,493909,625015,695789,1761668,1761670,2285996,3872598,6255230,6255232,13392362,13392364,21608510,37642544,46031198,46031200,123475726,124019335,166331817,295341727,427973009,427973011,957743925,1002438799,1539895447,2701633655,3238504625,3238504627,9136008903,9136008905,11283492615,21774711657,30332626918,31486343642,71767885484,71767885486,105998501744
mov $4,2
lpb $4
sub $4,1
add $0,$4
sub $0,1
lpb $0
mov $2,$0
sub $0,1
add $3,1
div $2,$3
add $2,1
pow $2,$3
add $5,$2
lpe
sub $4,1
lpe
mov $0,$5
add $0,1
|
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r14
push %rax
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0xe56, %rbx
clflush (%rbx)
nop
add %rcx, %rcx
mov $0x6162636465666768, %rax
movq %rax, %xmm2
movups %xmm2, (%rbx)
nop
add $26187, %rbp
lea addresses_D_ht+0x105f6, %r11
clflush (%r11)
nop
cmp %r12, %r12
mov (%r11), %r14
nop
cmp $57022, %rbx
lea addresses_normal_ht+0xed16, %rbp
nop
nop
sub %r14, %r14
mov $0x6162636465666768, %rcx
movq %rcx, (%rbp)
nop
dec %r11
lea addresses_A_ht+0x7856, %r14
inc %rbx
mov $0x6162636465666768, %r12
movq %r12, (%r14)
nop
nop
nop
inc %rax
lea addresses_A_ht+0x13bd6, %r11
xor %rax, %rax
movl $0x61626364, (%r11)
nop
sub $58095, %r14
lea addresses_UC_ht+0x16816, %r14
nop
nop
nop
nop
nop
cmp $12047, %r11
mov $0x6162636465666768, %r12
movq %r12, (%r14)
nop
nop
nop
nop
xor $39265, %rbx
lea addresses_WT_ht+0x1ab56, %rsi
lea addresses_WC_ht+0x5596, %rdi
nop
cmp $48832, %rax
mov $17, %rcx
rep movsq
nop
nop
nop
xor %rax, %rax
lea addresses_UC_ht+0xd54a, %rbx
nop
nop
nop
and $9910, %rsi
mov $0x6162636465666768, %r11
movq %r11, %xmm2
vmovups %ymm2, (%rbx)
nop
nop
nop
nop
xor $27899, %r14
lea addresses_normal_ht+0x3716, %rbx
sub %rsi, %rsi
and $0xffffffffffffffc0, %rbx
vmovaps (%rbx), %ymm4
vextracti128 $1, %ymm4, %xmm4
vpextrq $0, %xmm4, %rax
nop
nop
nop
nop
xor $65270, %rcx
lea addresses_UC_ht+0x17ed6, %rsi
nop
and $14724, %rbp
movl $0x61626364, (%rsi)
and %rcx, %rcx
lea addresses_WC_ht+0xe3a6, %rsi
lea addresses_normal_ht+0x5326, %rdi
nop
nop
nop
nop
nop
dec %r12
mov $124, %rcx
rep movsb
nop
nop
nop
cmp $34272, %rbp
lea addresses_A_ht+0x6b74, %rsi
nop
nop
nop
nop
and %rax, %rax
movb (%rsi), %r12b
nop
nop
nop
inc %rbp
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %rax
pop %r14
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r15
push %r8
push %r9
push %rbp
push %rdx
push %rsi
// Store
lea addresses_D+0x170e, %r11
clflush (%r11)
nop
nop
nop
xor $30078, %rdx
mov $0x5152535455565758, %rbp
movq %rbp, %xmm3
vmovups %ymm3, (%r11)
nop
nop
nop
and $44943, %rdx
// Store
lea addresses_PSE+0xe0b6, %r8
nop
nop
nop
nop
add %r9, %r9
movl $0x51525354, (%r8)
nop
nop
cmp $58265, %r11
// Store
mov $0x214, %r15
nop
add $15128, %r8
movb $0x51, (%r15)
nop
nop
nop
nop
add $52190, %rsi
// Store
lea addresses_RW+0xf056, %rsi
nop
nop
cmp $56667, %r11
mov $0x5152535455565758, %r15
movq %r15, (%rsi)
and %r15, %r15
// Faulty Load
mov $0x5bf8d70000000056, %rbp
nop
nop
nop
nop
nop
and %r9, %r9
vmovups (%rbp), %ymm1
vextracti128 $0, %ymm1, %xmm1
vpextrq $1, %xmm1, %rsi
lea oracles, %r9
and $0xff, %rsi
shlq $12, %rsi
mov (%r9,%rsi,1), %rsi
pop %rsi
pop %rdx
pop %rbp
pop %r9
pop %r8
pop %r15
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_NC', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 2}}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 4, 'NT': True, 'same': False, 'congruent': 2}}
{'OP': 'STOR', 'dst': {'type': 'addresses_P', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 9}}
[Faulty Load]
{'src': {'type': 'addresses_NC', 'AVXalign': False, 'size': 32, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 9}}
{'src': {'type': 'addresses_D_ht', 'AVXalign': True, 'size': 8, 'NT': False, 'same': False, 'congruent': 4}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 6}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 9}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 4, 'NT': True, 'same': False, 'congruent': 6}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': True, 'size': 8, 'NT': False, 'same': False, 'congruent': 6}}
{'src': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 2}}
{'src': {'type': 'addresses_normal_ht', 'AVXalign': True, 'size': 32, 'NT': False, 'same': False, 'congruent': 2}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 4, 'NT': True, 'same': False, 'congruent': 7}}
{'src': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': False}}
{'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'48': 594, '40': 10, 'b4': 1, 'ab': 1, 'cd': 3, '42': 5, '85': 2, 'cb': 1, 'ac': 1, 'df': 1, '65': 1, '0e': 1, 'a1': 1, '39': 1, '25': 1, '00': 21179, '07': 1, '57': 3, 'ff': 22}
00 25 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 b4 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 42 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 48 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 48 48 00 00 00 00 00 00 00 00 00 ac 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ab 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00
*/
|
; A069996: Number of spanning trees on the bipartite graph K_{3,n}.
; 1,12,81,432,2025,8748,35721,139968,531441,1968300,7144929,25509168,89813529,312487308,1076168025,3673320192,12440502369,41841412812,139858796529,464904586800,1537671920841,5062810950252,16600580533161
add $0,1
mov $1,$0
pow $0,2
lpb $1
mul $0,3
sub $1,1
lpe
div $0,3
|
COMMENT @----------------------------------------------------------------------
Copyright (c) GeoWorks 1990 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: CommonUI/CMain
FILE: cmainDocPhysical.asm
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 1/90 Initial version
DESCRIPTION:
MSG_GEN_DOCUMENT_PHYSICAL_***
$Id: cmainDocPhysical.asm,v 1.1 97/04/07 10:52:32 newdeal Exp $
------------------------------------------------------------------------------@
DocNewOpen segment resource
COMMENT @----------------------------------------------------------------------
MESSAGE: OLDocumentComputeAccessFlags --
MSG_GEN_DOCUMENT_COMPUTE_ACCESS_FLAGS for OLDocumentClass
DESCRIPTION: ...
PASS:
*ds:si - instance data
es - segment of OLDocumentClass
ax - The message
ss:bp - DocumentCommonParams
RETURN:
al - VMAccessFlags (or FileAccessFlags)
ah - destroyed
cx, dx, bp - unchanged
DESTROYED:
bx, si, di, ds, es (message handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 8/ 5/91 Initial version
------------------------------------------------------------------------------@
OLDocumentComputeAccessFlags method dynamic OLDocumentClass,
MSG_GEN_DOCUMENT_COMPUTE_ACCESS_FLAGS
call GetParentAttrs
mov_trash di, ax ; di = GDGA_*
call GetUIParentAttrs
mov bx, ax ; bx = GDCI_*
and ax, mask GDCA_MODE
test bx, mask GDCA_VM_FILE
jz dosFile
; its a VM file
tst ax
jz viewerMode
cmp ax, GDCM_SHARED_SINGLE shl offset GDCA_MODE
mov al, mask VMAF_DISALLOW_SHARED_MULTIPLE
jz sharedCommon
clr al ;no flags if SHARED_MULTIPLE
sharedCommon:
; look for read-only or read-write
test ss:[bp].DCP_docAttrs, mask GDA_READ_ONLY
jz notReadOnly
or al, mask VMAF_FORCE_READ_ONLY
notReadOnly:
test ss:[bp].DCP_docAttrs, mask GDA_READ_WRITE
jz notReadWrite
or al, mask VMAF_FORCE_READ_WRITE
notReadWrite:
test bx, mask GDCA_FORCE_DEMAND_PAGING
jnz keepDemandPaging
;
; Turn off demand paging for all document control documents.
;
or al, mask VMAF_NO_DEMAND_PAGING
keepDemandPaging:
ret
viewerMode:
mov al, mask VMAF_FORCE_READ_ONLY or \
mask VMAF_DISALLOW_SHARED_MULTIPLE
jmp sharedCommon
dosFile:
tst ax
jz dosViewer
cmp ax, GDCM_SHARED_SINGLE shl offset GDCA_MODE
mov al, FileAccessFlags <FE_DENY_WRITE, FA_READ_WRITE>
jz dosCommon
mov al, FileAccessFlags <FE_NONE, FA_READ_WRITE>
dosCommon:
; look for read-only or read-write
test ss:[bp].DCP_docAttrs, mask GDA_READ_ONLY
jz notDosReadOnly
and al, not mask FAF_MODE
or al, FA_READ_ONLY shl offset FAF_MODE
notDosReadOnly:
test ss:[bp].DCP_docAttrs, mask GDA_READ_WRITE
jz notDosReadWrite
and al, not mask FAF_MODE
or al, FA_READ_WRITE shl offset FAF_MODE
notDosReadWrite:
test bx, mask GDCA_DOS_FILE_DENY_WRITE
jz notDosDenyWrite
and al, not mask FAF_EXCLUDE
or al, FE_DENY_WRITE shl offset FAF_EXCLUDE
notDosDenyWrite:
ret
dosViewer:
mov al, FileAccessFlags <FE_NONE, FA_READ_ONLY>
jmp dosCommon
OLDocumentComputeAccessFlags endm
COMMENT @----------------------------------------------------------------------
MESSAGE: OLDocumentPhysicalOpen -- MSG_GEN_DOCUMENT_PHYSICAL_OPEN
for OLDocumentClass
DESCRIPTION: Really open a file
PASS:
*ds:si - instance data
es - segment of OLDocumentClass
ax - The message
ss:bp - DocumentCommonParams
RETURN:
carry - set if error
ax - file handle (if successful) or error code (if error)
cx - non-zero if template document opened
dx - non-zero if a new file was created
bp - unchanged
DESTROYED:
bx, si, di, ds, es (message handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 7/22/91 Initial version
------------------------------------------------------------------------------@
OLDocumentPhysicalOpen method dynamic OLDocumentClass,
MSG_GEN_DOCUMENT_PHYSICAL_OPEN
call GetParentAttrs
mov_trash cx, ax ;cx = attrs
mov ax, MSG_GEN_DOCUMENT_COMPUTE_ACCESS_FLAGS
call ObjCallInstanceNoLock
push ds
segmov ds, ss ;ds:dx = filename
lea dx, ss:[bp].DCP_name
mov ah, VMO_OPEN ;assume no create
test ss:[bp].DCP_flags, mask DOF_CREATE_FILE_IF_FILE_DOES_NOT_EXIST
jz 10$
mov ah, VMO_CREATE
10$:
test cx, mask GDGA_VM_FILE
jz notVM
clr cx ;use default compression
call VMOpen
pop ds
jc done
; ax = VMStatus, bx = file handle
; check for wrong file type
cmp ax, VM_CREATE_OK
jz noFileTypeCheck
call CheckFileType
jc closeError
noFileTypeCheck:
; check for a password
call CheckPassword
jnc passwordOK
closeError:
push ax
mov al, FILE_NO_ERRORS
call VMClose
pop ax
stc
jmp done
passwordOK:
clr cx ;assume no template
mov dx, 1 ;assume file created
cmp ax, VM_CREATE_OK
jz notReadOnly
dec dx
cmp ax, VM_OPEN_OK_TEMPLATE
jnz notTemplate
dec cx ; flag template opened
jmp vmDone
notTemplate:
cmp ax, VM_OPEN_OK_READ_WRITE_SINGLE
jnz notSharedSingle
ornf ss:[bp].DCP_docAttrs, mask GDA_SHARED_SINGLE
notSharedSingle:
cmp ax, VM_OPEN_OK_READ_WRITE_MULTIPLE
jnz notSharedMultiple
ornf ss:[bp].DCP_docAttrs, mask GDA_SHARED_MULTIPLE
notSharedMultiple:
cmp ax, VM_OPEN_OK_READ_ONLY
jnz notReadOnly
ornf ss:[bp].DCP_docAttrs, mask GDA_READ_ONLY
jmp vmDone
notReadOnly:
ornf ss:[bp].DCP_docAttrs, mask GDA_READ_WRITE
vmDone:
clc
mov_trash ax, bx
done:
ret
notVM:
CheckHack <VMO_OPEN eq 0> ; also relies on AH being only
; VMO_OPEN, or VMO_CREATE
test ah, VMO_CREATE
jnz createNormal
call FileOpen
pop ds
jc regularOpen
mov bx, ax ; bx = file handle
call CheckPassword
jnc regularOpen
push ax
clr ax
call FileClose
pop ax
stc
regularOpen:
mov cx, 0
mov dx, cx
ret
createNormal:
mov ah, FILE_CREATE_NO_TRUNCATE
test cx, mask GDGA_NATIVE
jz 90$
ornf ah, mask FCF_NATIVE
90$:
mov cx, FILE_ATTR_NORMAL
call FileCreate
pop ds
jc done
; see if the file was actually created. If it's 0 bytes, it was, for
; all intents and purposes
mov bx, ax
call FileSize
or ax, dx ; (clears carry)
mov_tr ax, bx
jnz regularOpen ; => file has bytes so it existed before
mov cx, dx ; cx <- 0 => not template
dec dx ; flag file created
ret
OLDocumentPhysicalOpen endm
COMMENT @----------------------------------------------------------------------
FUNCTION: CheckPassword
DESCRIPTION: If the given file has a password then ask the user for it
CALLED BY: INTERNAL
PASS:
*ds:si - document object
bx - file handle
ss:bp - DocumentCommonParams
RETURN:
carry - set if error
ax - error code
DESTROYED:
none
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 8/ 7/92 Initial version
------------------------------------------------------------------------------@
CheckPassword proc near uses bx, cx, dx, si, di, bp, ds, es
test ss:[bp].DCP_flags, mask DOF_REOPEN
jz 5$
ret
5$:
passedAX local word push ax
documentChunk local word push si
if DBCS_PCGEOS
filePassword local FILE_PASSWORD_SIZE dup (byte)
userPassword local MAX_PASSWORD_SOURCE_LENGTH + 1 dup (wchar)
userEncryptedPassword local FILE_PASSWORD_SIZE dup (byte)
else
filePassword local FILE_PASSWORD_SIZE dup (char)
userPassword local MAX_PASSWORD_SOURCE_SIZE + 1 dup (char)
userEncryptedPassword local FILE_PASSWORD_SIZE dup (char)
endif
.enter
segmov es, ss
lea di, filePassword
mov ax, FEA_PASSWORD
mov cx, FILE_PASSWORD_SIZE
call FileGetHandleExtAttributes
jnc gotPassword
cmp ax, ERROR_ATTR_NOT_FOUND
jz doneGood
cmp ax, ERROR_ATTR_NOT_SUPPORTED
stc
jnz done
doneGood:
clc
mov ax, passedAX
done:
.leave
ret
gotPassword:
SBCS < cmp {char} es:[di], 0 >
DBCS < cmp {wchar} es:[di], 0 >
jz doneGood
tryAgain:
; duplicate the password dialog and add it as a child of the application
mov bx, handle GetPasswordDialog
mov si, offset GetPasswordDialog
call UserCreateDialog
; set help file for this dialog to be same as the document
sub sp, size FileLongName
movdw cxdx, sssp
push si, bp ;save dialog, locals
mov si, documentChunk ;si = GenDocument
mov ax, MSG_META_GET_HELP_FILE
call ObjCallInstanceNoLock
pop si, bp ;^lbx:si = dialog
jnc fixupStack
mov ax, MSG_META_SET_HELP_FILE
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage
fixupStack:
add sp, size FileLongName
; display dialog box to get document password
call UserDoDialog
push ax ;save response
; get text from text object
push bp
mov dx, ss
lea bp, userPassword
SBCS < mov cx, size userPassword >
DBCS < mov cx, length userPassword >
mov si, offset GetPasswordText
mov ax, MSG_VIS_TEXT_GET_ALL_PTR
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage
pop bp
mov si, offset GetPasswordDialog
call UserDestroyDialog
pop ax
cmp ax, IC_OK
mov ax, 0
stc
jnz done
; encrypt the password
push ds
segmov ds, ss
lea si, userPassword
lea di, userEncryptedPassword
call UserEncryptPassword
; compare passwords
lea si, filePassword
mov cx, FILE_PASSWORD_SIZE
repe cmpsb
pop ds
LONG jz doneGood
mov ax, SDBT_BAD_PASSWORD
call CallUserStandardDialog
jmp tryAgain ;better not be hit in Redwood
CheckPassword endp
COMMENT @----------------------------------------------------------------------
FUNCTION: CheckFileType
DESCRIPTION: Ensure that the opened file has the correct token characters
CALLED BY: INTERNAL
PASS:
*ds:si - document object
bx - file handle
ss:bp - DocumentCommonParams
RETURN:
carry - set if error
ax - error code
DESTROYED:
none
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 8/ 7/92 Initial version
------------------------------------------------------------------------------@
CheckFileType proc near uses bx, cx, dx, si, di, bp, ds, es
test ss:[bp].DCP_flags, mask DOF_REOPEN
jz 5$
ret
5$:
passedAX local word push ax
objToken local GeodeToken
fileToken local GeodeToken
.enter
EC < call AssertIsGenDocument >
push bp
mov cx, ss
lea dx, objToken
mov ax, MSG_GEN_DOCUMENT_GROUP_GET_TOKEN
call GenCallParent
pop bp
segmov es, ss
lea di, fileToken
mov ax, FEA_TOKEN
mov cx, size fileToken
call FileGetHandleExtAttributes
jc done
segmov ds, ss
lea si, objToken
mov cx, size objToken
repe cmpsb
mov ax, ERROR_FILE_FORMAT_MISMATCH
stc
jnz done
clc
mov ax, passedAX
done:
.leave
ret
CheckFileType endp
COMMENT @----------------------------------------------------------------------
MESSAGE: OLDocumentCreateUIForDocument --
MSG_GEN_DOCUMENT_CREATE_UI_FOR_DOCUMENT for OLDocumentClass
DESCRIPTION: ...
PASS:
*ds:si - instance data
es - segment of OLDocumentClass
ax - The message
RETURN:
DESTROYED:
bx, si, di, ds, es (message handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 7/23/91 Initial version
Cassie 10/14/92 Added code to set display block output.
------------------------------------------------------------------------------@
OLDocumentCreateUIForDocument method dynamic OLDocumentClass,
MSG_GEN_DOCUMENT_CREATE_UI_FOR_DOCUMENT
; if we have a GenDisplay to duplicate, do so
mov ax, MSG_GEN_DOCUMENT_GROUP_GET_DISPLAY
call GenCallParent
jcxz noDisplay
; duplicate the sucker and store the handle of the duplicated block
push cx
mov bx, cx
; Duplicated block needs to be run by the same thread as is running
; the rest of the UI for this application. We'll figure this out
; by fetching the thread running the application object.
;
push bx, si
clr bx
call GeodeGetAppObject
mov ax, MGIT_EXEC_THREAD
call MemGetInfo
pop bx, si
mov cx, ax ; pass thread to run in cx
clr ax ; have current geode own block
call ObjDuplicateResource ;bx = new block
pop cx
EC < call GenCheckGenAssumption >
mov di, ds:[si]
add di, ds:[di].Gen_offset
mov ds:[di].GDI_display, bx
; add the display to the display control
push si
push bx, dx ;save display's OD
mov ax, MSG_GEN_DOCUMENT_GROUP_GET_DISPLAY_GROUP
call GenCallParent ;cx:dx = display control
mov bx, cx
mov si, dx ;bx:si = display control
pop cx, dx ;cx:dx = display to add
mov ax, MSG_GEN_ADD_CHILD
mov bp, CCO_LAST or mask CCF_MARK_DIRTY
mov di, mask MF_FIXUP_DS
call ObjMessage
; set the display usable
pop si
push si
mov di, ds:[si]
add di, ds:[di].Vis_offset
mov bx, cx ;bx:si = display
mov si, dx
test ds:[di].OLDI_attrs, mask OLDA_USER_OPENED
jz setOutput
mov dl, VUM_NOW
mov ax, MSG_GEN_SET_USABLE
mov di, mask MF_FIXUP_DS
call ObjMessage
setOutput:
; Set the output of the duplicated display block
; to be this document
;
mov cx, ds:[LMBH_handle]
pop dx ;^lcx:dx = document
mov ax, MSG_META_SET_OBJ_BLOCK_OUTPUT
mov di, mask MF_FIXUP_DS
call ObjMessage
mov si, dx ;*ds:si = document
noDisplay:
mov ax, MSG_META_DOC_OUTPUT_CREATE_UI_FOR_DOCUMENT
EC < call AssertIsGenDocument >
call SendNotificationToOutput
Destroy cx, dx, bp
ret
OLDocumentCreateUIForDocument endm
COMMENT @----------------------------------------------------------------------
MESSAGE: OLDocumentAttachUIToDocument --
MSG_GEN_DOCUMENT_ATTACH_UI_TO_DOCUMENT for OLDocumentClass
DESCRIPTION: ...
PASS:
*ds:si - instance data
es - segment of OLDocumentClass
ax - The message
RETURN:
DESTROYED:
bx, si, di, ds, es (message handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 7/23/91 Initial version
------------------------------------------------------------------------------@
OLDocumentAttachUIToDocument method dynamic OLDocumentClass,
MSG_GEN_DOCUMENT_ATTACH_UI_TO_DOCUMENT
; if we have a view to connect to, connect to it
mov di, ds:[LMBH_handle] ;di:bp = data to send to
mov bp, si ;SET_CONTENT if view exists
call CallSetContent
mov ax, MSG_META_DOC_OUTPUT_ATTACH_UI_TO_DOCUMENT
EC < call AssertIsGenDocument >
call SendNotificationToOutput
Destroy cx, dx, bp
ret
OLDocumentAttachUIToDocument endm
COMMENT @----------------------------------------------------------------------
FUNCTION: CallSetContent
DESCRIPTION: Handle default UI interaction for document (if any)
CALLED BY: OLDocumentAttachUIToDocument, OLDocumentDetachUIFromDocument
PASS:
*ds:si - document object
di:bp - data to send to view in cx:dx
RETURN:
none
DESTROYED:
ax, bx, cx, dx, di, bp
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 7/25/91 Initial version
------------------------------------------------------------------------------@
CallSetContent proc far
class OLDocumentClass
EC < call AssertIsGenDocument >
mov ax, MSG_GEN_DOCUMENT_GROUP_GET_VIEW
call GenCallParent
jcxz noView
; if a display exists then use that handle (assume that the view
; was duplicated along with the display)
push di
EC < call GenCheckGenAssumption >
mov di, ds:[si]
add di, ds:[di].Gen_offset
mov ax, ds:[di].GDI_display
tst ax
jz noDisplay
mov_trash cx, ax
noDisplay:
pop di
push si
mov bx, cx ;bx:si = view
mov si, dx
mov cx, di
mov dx, bp ;cx:dx = data
mov ax, MSG_GEN_VIEW_SET_CONTENT
; use MF_CALL to force the set content to complete before we
; do anything else (like queuing a message to close/delete ourself)
mov di, mask MF_FIXUP_DS or mask MF_CALL
call ObjMessage
pop si
noView:
ret
CallSetContent endp
COMMENT @----------------------------------------------------------------------
MESSAGE: OLDocumentReadCachedDataFromFile --
MSG_GEN_DOCUMENT_READ_CACHED_DATA_FROM_FILE for OLDocumentClass
DESCRIPTION: ...
PASS:
*ds:si - instance data
es - segment of OLDocumentClass
ax - The message
RETURN:
DESTROYED:
bx, si, di, ds, es (message handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 7/23/91 Initial version
------------------------------------------------------------------------------@
OLDocumentReadCachedDataFromFile method dynamic OLDocumentClass,
MSG_GEN_DOCUMENT_READ_CACHED_DATA_FROM_FILE
mov ax, MSG_META_DOC_OUTPUT_READ_CACHED_DATA_FROM_FILE
EC < call AssertIsGenDocument >
call SendNotificationToOutput
Destroy cx, dx, bp
ret
OLDocumentReadCachedDataFromFile endm
DocNewOpen ends
;---
DocNew segment resource
COMMENT @----------------------------------------------------------------------
MESSAGE: OLDocumentPhysicalCreate --
MSG_GEN_DOCUMENT_PHYSICAL_CREATE for OLDocumentClass
DESCRIPTION: Really create the file
PASS:
*ds:si - instance data
es - segment of OLDocumentClass
ax - The message
ss:bp - DocumentCommonParams with DCP_name being the
name of the file to create and thread's current directory
already set appropriately.
RETURN:
carry - set if error
bp - unchanged
ax - file handle (if successful) or error code (if error)
DESTROYED:
bx, si, di, ds, es (message handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 7/22/91 Initial version
------------------------------------------------------------------------------@
OLDocumentPhysicalCreate method dynamic OLDocumentClass,
MSG_GEN_DOCUMENT_PHYSICAL_CREATE
if DC_DISALLOW_SPACES_FILENAME
;
; check for trailing or leading spaces
;
.assert (offset DCP_name eq 0)
call CheckSpacesFilename
jc exit
endif
; call correct create routine
call GetParentAttrs ;ax = attributes
mov_trash bx, ax
; compute access flags
mov ax, MSG_GEN_DOCUMENT_COMPUTE_ACCESS_FLAGS
call ObjCallInstanceNoLock ;al = access flags
segmov ds, ss ;ds:dx = filename
lea dx, ss:[bp].DCP_name
; assume VM file
mov ah, VMO_CREATE_ONLY
clr cx ;default threshhold
test bx, mask GDGA_VM_FILE
jz notVM
call VMOpen
jc exit ;if error then return ax (error code)
mov_trash ax, bx ;else return file handle
ornf ss:[bp].DCP_docAttrs, mask GDA_READ_WRITE
exit:
Destroy cx, dx
ret
notVM:
mov ah, FILE_CREATE_ONLY
test bx, mask GDGA_NATIVE
jz 90$
ornf ah, mask FCF_NATIVE
90$:
mov cx, FILE_ATTR_NORMAL
call FileCreate
Destroy cx, dx
ret
OLDocumentPhysicalCreate endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CheckSpacesFilename
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: check for leading and trailing spaces in filename
CALLED BY: INTERNAL
OLDocumentPhysicalCreate
OLDocumentContinueRename
OLFileSelectorContinueRename
PASS: ss:bp = filename
RETURN: carry clear of filename okay
ax destroyed
carry set if error
ax = ERROR_ILLEGAL_FILENAME
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 12/16/96 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if DC_DISALLOW_SPACES_FILENAME
CheckSpacesFilename proc far
uses cx, es, di
.enter
segmov es, ss, di
lea di, ss:[bp].DCP_name
LocalCmpChar es:[di], C_SPACE ; leading space?
je spaceCheck
LocalLoadChar ax, C_NULL
mov cx, length DCP_name
LocalFindChar
LocalPrevChar esdi ; point to null
LocalPrevChar esdi ; point to last char
LocalCmpChar es:[di], C_SPACE
spaceCheck:
mov ax, ERROR_INVALID_NAME ; assume error
stc ; assume error
je done ; trail/lead space, error
clc ; else, indicate no error
done:
.leave
ret
CheckSpacesFilename endp
endif
COMMENT @----------------------------------------------------------------------
FUNCTION: ConvertErrorCode
DESCRIPTION: Convert VM errors to normal file errors
CALLED BY: INTERNAL
PASS:
ax - error code
RETURN:
ax - new error code
DESTROYED:
none
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 7/22/91 Initial version
------------------------------------------------------------------------------@
ConvertErrorCode proc far uses cx, di, es
.enter
segmov es, cs
mov di, offset vmErrorList
mov cx, length vmErrorList
repne scasw
jnz done
mov ax, cs:[di][(errorList-vmErrorList)-2]
done:
.leave
ret
vmErrorList word \
VM_FILE_NOT_FOUND,
VM_SHARING_DENIED,
VM_WRITE_PROTECTED,
VM_FILE_EXISTS,
VM_UPDATE_INSUFFICIENT_DISK_SPACE,
VM_CANNOT_CREATE,
VM_FILE_FORMAT_MISMATCH
errorList word \
ERROR_FILE_NOT_FOUND,
ERROR_ACCESS_DENIED,
ERROR_WRITE_PROTECTED,
ERROR_FILE_EXISTS,
ERROR_SHORT_READ_WRITE,
ERROR_ACCESS_DENIED,
ERROR_FILE_FORMAT_MISMATCH
ConvertErrorCode endp
COMMENT @----------------------------------------------------------------------
MESSAGE: OLDocumentPhysicalCopyTemplate --
MSG_GEN_DOCUMENT_PHYSICAL_COPY_TEMPLATE for OLDocumentClass
DESCRIPTION: Copy document to an untitled file
PASS:
*ds:si - instance data
es - segment of OLDocumentClass
ax - The message
RETURN:
carry - set if error
ax - error code
DESTROYED:
bx, si, di, ds, es (message handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 8/13/91 Initial version
------------------------------------------------------------------------------@
OLDocumentPhysicalCopyTemplate method dynamic OLDocumentClass,
MSG_GEN_DOCUMENT_PHYSICAL_COPY_TEMPLATE
mov di, 1200
call ThreadBorrowStackSpace
push di
sub sp, size DocumentCommonParams
mov bp, sp
mov ss:[bp].DCP_docAttrs, mask GDA_UNTITLED
mov ss:[bp].DCP_flags, 0
if UNTITLED_DOCS_ON_SP_TOP
mov ss:[bp].DCP_diskHandle, SP_TOP
else
mov ss:[bp].DCP_diskHandle, SP_DOCUMENT
endif
mov {TCHAR}ss:[bp].DCP_path[0], 0
if CUSTOM_DOCUMENT_PATH
call OLDocumentInitDocCommonParams
endif ; CUSTOM_DOCUMENT_PATH
call PushAndSetPath
jc error
clr cx
createLoop:
mov dx, ss
mov ax, MSG_GEN_DOCUMENT_GENERATE_NAME_FOR_NEW
call ObjCallInstanceNoLock ;returns ss:bp = name
mov ax, ERROR_FILE_NOT_FOUND
cmp cx, GEN_DOCUMENT_GENERATE_NAME_ERROR
jz error
clr ax
cmp cx, GEN_DOCUMENT_GENERATE_NAME_CANCEL
jz error
push cx
mov ax, MSG_GEN_DOCUMENT_PHYSICAL_SAVE_AS
call ObjCallInstanceNoLock
pop cx
jnc noError
call ConvertErrorCode
inc cx
cmp ax, ERROR_FILE_EXISTS
jz tryAgain
cmp ax, ERROR_ACCESS_DENIED
jz tryAgain
cmp ax, ERROR_SHARING_VIOLATION
je tryAgain
error:
stc
jmp done
tryAgain:
call GetDocOptions
test ax, mask DCO_TRANSPARENT_DOC
jz createLoop
mov ax, SDBT_TRANSPARENT_NEW_FILE_EXISTS
call FarCallStandardDialogSS_BP
jmp createLoop
noError:
call StoreNewDocumentName
; clear template bit
clr ax
push ax ;push word of zero to write
call OLDocumentGetFileHandle
mov di, sp ;es:di = zero GeosFileHeaderFlags
segmov es, ss
mov cx, size GeosFileHeaderFlags
mov ax, FEA_FLAGS
call FileSetHandleExtAttributes
; clear user notes
mov cx, GFH_USER_NOTES_BUFFER_SIZE ; cx <- size of same
mov ax, FEA_USER_NOTES ; ax <- attr to set
call FileSetHandleExtAttributes
pop cx ;pop word to write
done:
call FilePopDir
lea sp, ss:[bp+(size DocumentCommonParams)]
pop di
call ThreadReturnStackSpace
ret
OLDocumentPhysicalCopyTemplate endm
if CUSTOM_DOCUMENT_PATH
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OLDocumentInitDocCommonParams
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Initializes the passed DocumentCommonParams with the
parent's GenPath
CALLED BY: (INTERNAL) OLDocumentPhysicalCopyTemplate
PASS: *ds:si - GenDocumentClass object
ss:bp - DocumentCommonParams
RETURN: DocumentCommonParams structure modified.
DESTROYED: nothing
SIDE EFFECTS: none
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ptrinh 12/16/96 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
OLDocumentInitDocCommonParams proc near
uses ax,cx,dx
.enter
push bp ; DocumentCommonParams
;
; Get the path from the parent
;
lea bp, ss:[bp].DCP_path
mov dx, ss ; dx:bp - buffer
mov cx, size PathName
mov ax, MSG_GEN_PATH_GET
call GenCallParent
pop bp ; DocumentCommonParams
jc nullifyPath
mov ss:[bp].DCP_diskHandle, cx
done:
.leave
ret
nullifyPath:
mov {TCHAR}ss:[bp].DCP_path[0], 0
jmp done
OLDocumentInitDocCommonParams endp
endif ; CUSTOM_DOCUMENT_PATH
COMMENT @----------------------------------------------------------------------
MESSAGE: OLDocumentInitializeDocumentFile --
MSG_GEN_DOCUMENT_INITIALIZE_DOCUMENT_FILE for OLDocumentClass
DESCRIPTION: ...
PASS:
*ds:si - instance data
es - segment of OLDocumentClass
ax - The message
RETURN:
DESTROYED:
bx, si, di, ds, es (message handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 7/23/91 Initial version
------------------------------------------------------------------------------@
OLDocumentInitializeDocumentFile method dynamic OLDocumentClass,
MSG_GEN_DOCUMENT_INITIALIZE_DOCUMENT_FILE
mov ax, MSG_META_DOC_OUTPUT_INITIALIZE_DOCUMENT_FILE
EC < call AssertIsGenDocument >
call SendNotificationToOutput
Destroy cx, dx, bp
ret
OLDocumentInitializeDocumentFile endm
COMMENT @----------------------------------------------------------------------
METHOD: OLDocumentGroupNewDoc --
MSG_GEN_DOCUMENT_GROUP_NEW_DOC for OLDocumentGroupClass
DESCRIPTION: Create a new file
PASS:
*ds:si - instance data
es - segment of OLDocumentGroupClass
ax - MSG_GEN_DOCUMENT_GROUP_NEW_DOC
dx - size DocumentCommonParams
ss:bp - DocumentCommonParams
RETURN:
cx:dx - new Document object created
carry - set if error
DESTROYED:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 1/90 Initial version
------------------------------------------------------------------------------@
OLDocumentGroupNewDoc method dynamic OLDocumentGroupClass,
MSG_GEN_DOCUMENT_GROUP_NEW_DOC
if FLOPPY_BASED_DOCUMENTS
;
; Don't allow opening if we've exceeded the maximum size already.
;
push ax, cx, dx, bp
mov ax, MSG_OLDG_GET_TOTAL_SIZE
call ObjCallInstanceNoLock
cmpdw dxcx, MAX_TOTAL_FILE_SIZE
pop ax, cx, dx, bp
jb continueNew
mov ax, SDBT_CANT_CREATE_TOTAL_FILES_TOO_LARGE
call CallUserStandardDialog
stc
ret
continueNew:
endif
if not VOLATILE_SYSTEM_STATE
;
; Ignore input
;
if CUSTOM_DOCUMENT_PATH
;
; We don't use passed diskHandle and path.
;
mov ss:[bp].DCP_diskHandle, 0
mov {TCHAR}ss:[bp].DCP_path[0], 0
endif ; CUSTOM_DOCUMENT_PATH
mov ax, MSG_GEN_DOCUMENT_NEW
call CreateDocObject
;
; Accept input
;
Destroy ax
ret
else
;
; Record our true message and send out a query now to our parent,
; so opened apps will be saved.
;
mov bx, ds:[LMBH_handle]
mov ax, MSG_OLDG_REALLY_NEW_DOC
mov di, mask MF_RECORD or mask MF_STACK
call ObjMessage
mov cx, di ;pass in cx to MSG_META_QUERY_DOCUMENTS
mov ax, MSG_META_QUERY_SAVE_DOCUMENTS
GOTO ObjCallInstanceNoLock
endif
OLDocumentGroupNewDoc endm
COMMENT @----------------------------------------------------------------------
METHOD: OLDocumentGroupReallyNewDoc --
MSG_OLDG_REALLY_NEW_DOC for OLDocumentGroupClass
DESCRIPTION: Create a new file
PASS:
*ds:si - instance data
es - segment of OLDocumentGroupClass
ax - MSG_GEN_DOCUMENT_GROUP_NEW_DOC
dx - size DocumentCommonParams
ss:bp - DocumentCommonParams
RETURN:
cx:dx - new Document object created
carry - set if error
DESTROYED:
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 1/90 Initial version
------------------------------------------------------------------------------@
if VOLATILE_SYSTEM_STATE
OLDocumentGroupReallyNewDoc method dynamic OLDocumentGroupClass,
MSG_OLDG_REALLY_NEW_DOC
mov ax, MSG_GEN_DOCUMENT_NEW
call CreateDocObject
Destroy ax
ret
OLDocumentGroupReallyNewDoc endm
endif
DocNew ends
;---
DocSaveAsClose segment resource
COMMENT @----------------------------------------------------------------------
MESSAGE: OLDocumentPhysicalSaveAs -- MSG_GEN_DOCUMENT_PHYSICAL_SAVE_AS
for OLDocumentClass
DESCRIPTION: Really do save as
PASS:
*ds:si - instance data
es - segment of OLDocumentClass
ax - The message
ss:bp - DocumentCommonParams
DOF_SAVE_AS_OVERWRITE_EXISTING_FILE - important
RETURN:
carry - set if error
bp - unchanged
ax - file handle (if successful) or error code (if error)
DESTROYED:
bx, si, di, ds, es (message handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 7/23/91 Initial version
------------------------------------------------------------------------------@
OLDocumentPhysicalSaveAs method dynamic OLDocumentClass,
MSG_GEN_DOCUMENT_PHYSICAL_SAVE_AS
if DISPLAY_SAVING_MESSAGE
call CreateSaveDialogCheckParams ;hold the user's hand,
; if DCP_diskHandle = SP_TOP
pushdw cxdx
endif
mov ax, MSG_GEN_PROCESS_UNDO_FLUSH_ACTIONS
call SendUndoMessage
call OLDocumentUnregisterDoc
call OLDocumentGetFileHandle ;bx = old file handle
call GetParentAttrs ;ax = attributes, ZF = is VM
mov_trash cx, ax
push ds
lea dx, ss:[bp].DCP_name
jz regularFile
mov ax, MSG_GEN_DOCUMENT_COMPUTE_ACCESS_FLAGS
call ObjCallInstanceNoLock ; al <- access flags
mov ah, VMO_CREATE_ONLY
test ss:[bp].DCP_flags, mask DOF_SAVE_AS_OVERWRITE_EXISTING_FILE
jz 10$
mov ah, VMO_CREATE_TRUNCATE
10$:
segmov ds, ss ;ds:dx = filename
clr cx ;default threshhold
call VMSaveAs
pop ds
jc exit
mov_trash ax, bx ;ax = file handle
ornf ss:[bp].DCP_docAttrs, mask GDA_READ_WRITE
exit:
jnc fileClosed
; reregister file that couldn't be save-ased, as it were.
call OLDocumentRegisterOpenDoc
fileClosed:
if DISPLAY_SAVING_MESSAGE
popdw cxdx
call DestroySaveDialog ;destroy dialog
endif
Destroy cx, dx
ret
; normal file -- open new file before sending notification
regularFile:
segmov ds, ss ;ds:dx = filename
mov ah, FILE_CREATE_ONLY
test ss:[bp].DCP_flags, mask DOF_SAVE_AS_OVERWRITE_EXISTING_FILE
jz 20$
mov ah, FILE_CREATE_TRUNCATE
20$:
test cx, mask GDGA_NATIVE
jz 21$
ornf ah, mask FCF_NATIVE
21$:
mov al, FILE_ACCESS_RW or FILE_DENY_RW
mov cx, FILE_ATTR_NORMAL
call FileCreate
pop ds
jc exit
; actually save the data
mov_trash cx, ax ;save file handle
push cx, bp
mov ax, MSG_GEN_DOCUMENT_PHYSICAL_SAVE_AS_FILE_HANDLE
call ObjCallInstanceNoLock
pop cx, bp
jc saveError
mov bx, cx
mov al, FILE_NO_ERRORS
call FileCommit
call OLDocumentGetFileHandle
clr ax
call FileClose
mov_trash ax, cx ;return file handle
jmp exit
; if error then close file and delete it
saveError:
push ax ;save error code
mov bx, cx
mov al, FILE_NO_ERRORS
call FileClose
push ds
segmov ds, ss
lea dx, ss:[bp].DCP_name
call FileDelete
pop ds
pop ax
stc
jmp exit
OLDocumentPhysicalSaveAs endm
COMMENT @----------------------------------------------------------------------
ROUTINE: CreateSaveDialog
SYNOPSIS: Creates a dialog box for saving, if ATTR_GEN_PATH isn't
set to SP_TOP.
CALLED BY: OLDocumentPhysicalSaveAs
PASS: *ds:si -- GenDocument
RETURN: ^lcx:dx -- created dialog
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Chris 8/ 4/93 Initial version
------------------------------------------------------------------------------@
if DISPLAY_SAVING_MESSAGE
CreateSaveDialogCheckVardata proc far uses bx, si, bp, ax
.enter
if UNTITLED_DOCS_ON_SP_TOP
;
; If saving to the ramdisk, forget this box and return zeroes.
; (5/8/94 cbh)
;
clrdw cxdx
call DocCheckIfOnRamdisk ;if on RAM disk, forget it.
jz exit
endif
call DoSaveDialog
exit:
.leave
ret
CreateSaveDialogCheckVardata endp
endif
COMMENT @----------------------------------------------------------------------
ROUTINE: CreateSaveDialogCheckParams
SYNOPSIS: Creates a dialog box for saving, is DCP_diskHandle != SP_TOP.
CALLED BY: OLDocumentPhysicalSaveAs
PASS: *ds:si -- GenDocument
ss:bp -- DocumentCommonParams
RETURN: ^lcx:dx -- created dialog
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Chris 8/ 4/93 Initial version
------------------------------------------------------------------------------@
if DISPLAY_SAVING_MESSAGE
CreateSaveDialogCheckParams proc far uses bx, si, bp, ax
.enter
;
; If saving to the ramdisk, forget this box and return zeroes.
; (5/8/94 cbh)
;
clrdw cxdx
cmp ss:[bp].DCP_diskHandle, SP_TOP
je exit
call DoSaveDialog
exit:
.leave
ret
CreateSaveDialogCheckParams endp
endif
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DoSaveDialog
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Low level save dialog stuff.
CALLED BY: CreateSaveDialogCheckVardata, CreateSaveDialogCheckParams
PASS: *ds:si -- GenDocument
RETURN: ^lcx:dx -- created dialog
DESTROYED: ax, bx, si, di
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Chris 5/ 9/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if DISPLAY_SAVING_MESSAGE
DoSaveDialog proc near
.enter
mov bx, handle SaveDialog
mov si, offset SaveDialog
call UserCreateDialog
mov ax, MSG_GEN_INTERACTION_INITIATE
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage
movdw cxdx, bxsi
.leave
ret
DoSaveDialog endp
endif
COMMENT @----------------------------------------------------------------------
ROUTINE: DestroySaveDialog
SYNOPSIS: Creates a dialog box for saving.
CALLED BY: OLDocumentPhysicalSaveAs
PASS: ^lcx:dx -- dialog box to destroy (null if none)
RETURN: nothing (flags preserved)
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Chris 8/ 4/93 Initial version
------------------------------------------------------------------------------@
if DISPLAY_SAVING_MESSAGE
DestroySaveDialog proc far uses bx, si
.enter
pushf
tst cx ;no dialog up, exit
jz exit
movdw bxsi, cxdx
call UserDestroyDialog
exit:
popf
.leave
ret
DestroySaveDialog endp
endif
COMMENT @----------------------------------------------------------------------
MESSAGE: OLDocumentPhysicalClose -- MSG_GEN_DOCUMENT_PHYSICAL_CLOSE
for OLDocumentClass
DESCRIPTION: Physically close the file
PASS:
*ds:si - instance data
es - segment of OLDocumentClass
ax - The message
RETURN:
none
DESTROYED:
bx, si, di, ds, es (message handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 7/23/91 Initial version
------------------------------------------------------------------------------@
OLDocumentPhysicalClose method dynamic OLDocumentClass,
MSG_GEN_DOCUMENT_PHYSICAL_CLOSE
call OLDocumentUnregisterDoc
call OLDocumentGetFileHandle ;bx = file handle
EC < call GenCheckGenAssumption >
mov di, ds:[si]
add di, ds:[di].Gen_offset
mov ds:[di].GDI_fileHandle, 0
; call correct close routine
call GetParentAttrs ;ax = attribute, ZF = is VM
jz notVM
mov al, FILE_NO_ERRORS ;allow errors
call VMClose
if 0
EC < ERROR_C OL_ERROR >
endif
jmp common
notVM:
mov al, FILE_NO_ERRORS
call FileClose
common:
Destroy ax, cx, dx, bp
ret
OLDocumentPhysicalClose endm
COMMENT @----------------------------------------------------------------------
MESSAGE: OLDocumentPhysicalDelete -- MSG_GEN_DOCUMENT_PHYSICAL_DELETE
for OLDocumentClass
DESCRIPTION: Really delete the file
PASS:
*ds:si - instance data
es - segment of OLDocumentClass
ax - The message
RETURN:
DESTROYED:
bx, si, di, ds, es (message handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 7/23/91 Initial version
------------------------------------------------------------------------------@
OLDocumentPhysicalDelete method dynamic OLDocumentClass,
MSG_GEN_DOCUMENT_PHYSICAL_DELETE
call FilePushDir
mov ax, ATTR_GEN_PATH_DATA
mov dx, TEMP_GEN_PATH_SAVED_DISK_HANDLE
call GenPathSetCurrentPathFromObjectPath
EC < ERROR_C OL_ERROR >
NEC < jc done >
mov_tr bx, ax ; bx <- disk handle
EC < call GenCheckGenAssumption >
mov di, ds:[si]
add di, ds:[di].Gen_offset
lea dx, ds:[di].GDI_fileName ;ds:dx = file name
call FileDelete
EC < ERROR_C CANNOT_DELETE_FILE_JUST_CLOSED >
call FilePopDir
Destroy ax, cx, dx, bp
NEC <done: >
ret
OLDocumentPhysicalDelete endm
COMMENT @----------------------------------------------------------------------
MESSAGE: OLDocumentPhysicalSaveAsFileHandle --
MSG_GEN_DOCUMENT_PHYSICAL_SAVE_AS_FILE_HANDLE
for OLDocumentClass
DESCRIPTION: Save DOS file
PASS:
*ds:si - instance data
es - segment of OLDocumentClass
ax - The message
cx - new file handle
RETURN:
carry - set if error
ax - error code (if error)
DESTROYED:
bx, si, di, ds, es (message handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 7/23/91 Initial version
------------------------------------------------------------------------------@
OLDocumentPhysicalSaveAsFileHandle method dynamic OLDocumentClass,
MSG_GEN_DOCUMENT_PHYSICAL_SAVE_AS_FILE_HANDLE
; get OD to send to
push cx
mov ax, MSG_GEN_DOCUMENT_GROUP_GET_OUTPUT
call GenCallParent ;cx:dx = output
pop bp
mov bx, cx
mov cx, ds:[LMBH_handle]
xchg dx, si ;bx:si = output
;cx:dx = document
mov ax, MSG_META_DOC_OUTPUT_PHYSICAL_SAVE_AS_FILE_HANDLE
mov di, mask MF_FIXUP_DS or mask MF_CALL
GOTO ObjMessage
OLDocumentPhysicalSaveAsFileHandle endm
COMMENT @----------------------------------------------------------------------
MESSAGE: OLDocumentDestroyUIForDocument --
MSG_GEN_DOCUMENT_DESTROY_UI_FOR_DOCUMENT for OLDocumentClass
DESCRIPTION: ...
PASS:
*ds:si - instance data
es - segment of OLDocumentClass
ax - The message
RETURN:
DESTROYED:
bx, si, di, ds, es (message handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 7/23/91 Initial version
------------------------------------------------------------------------------@
OLDocumentDestroyUIForDocument method dynamic OLDocumentClass,
MSG_GEN_DOCUMENT_DESTROY_UI_FOR_DOCUMENT
; if we have a GenDisplay to biff, do so
mov ax, MSG_GEN_DOCUMENT_GROUP_GET_DISPLAY
call GenCallParent
jcxz noDisplay
push si
EC < call GenCheckGenAssumption >
mov di, ds:[si]
add di, ds:[di].Gen_offset
clr bx
xchg bx, ds:[di].GDI_display
mov si, dx ;bx:si = display
; nuke the display
if (1)
; Let's give the 'ol Display the same treatment as we do dialogs
; residing in a single block which we wish to get rid of --
; Dismiss it, change the linkage to one-way upward only,
; remove it from any window list it is on, & NUKE it. The
; slow, non-optimized approach will be taken if any objects
; within the block are on the active list.
; -- Doug 1/93
;
mov ax, MSG_GEN_DESTROY_AND_FREE_BLOCK
mov di, mask MF_FIXUP_DS
call ObjMessage
else
; set the display not usable
mov dl, VUM_NOW
mov ax, MSG_GEN_SET_NOT_USABLE
call DocOperations_ObjMessage_fixupDS
; remove the display from the display control
mov ax, MSG_GEN_FIND_PARENT
mov di, mask MF_CALL or mask MF_FIXUP_DS
call DocOperations_ObjMessage ;cx:dx = display control
xchg bx, cx ;bx:si = display control
xchg dx, si ;cx:dx = display
mov bp, mask CCF_MARK_DIRTY
mov ax, MSG_GEN_REMOVE_CHILD
clr bp
call DocOperations_ObjMessage_fixupDS
; free the UI block
mov bx, cx
mov si, dx ;bx:si = display
mov ax, MSG_META_BLOCK_FREE
call DocOperations_ObjMessage_fixupDS
endif
pop si
noDisplay:
mov ax, MSG_META_DOC_OUTPUT_DESTROY_UI_FOR_DOCUMENT
EC < call AssertIsGenDocument >
call SendNotificationToOutput
Destroy cx, dx, bp
ret
OLDocumentDestroyUIForDocument endm
COMMENT @----------------------------------------------------------------------
MESSAGE: OLDocumentDetachUIFromDocument --
MSG_GEN_DOCUMENT_DETACH_UI_FROM_DOCUMENT for OLDocumentClass
DESCRIPTION: Handle default UI interaaction for document (if any)
PASS:
*ds:si - instance data
es - segment of OLDocumentClass
ax - The message
RETURN:
DESTROYED:
bx, si, di, ds, es (message handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 7/23/91 Initial version
------------------------------------------------------------------------------@
OLDocumentDetachUIFromDocument method dynamic OLDocumentClass,
MSG_GEN_DOCUMENT_DETACH_UI_FROM_DOCUMENT
; if we have a view to connect to, connect to it
clr di ;di:bp = data to send to
clr bp ;SET_CONTENT if view exists
call CallSetContent
mov ax, MSG_GEN_PROCESS_UNDO_FLUSH_ACTIONS
call SendUndoMessage
mov ax, MSG_META_DOC_OUTPUT_DETACH_UI_FROM_DOCUMENT
EC < call AssertIsGenDocument >
call SendNotificationToOutput
Destroy cx, dx, bp
ret
OLDocumentDetachUIFromDocument endm
COMMENT @----------------------------------------------------------------------
MESSAGE: OLDocumentSaveAsCompleted --
MSG_GEN_DOCUMENT_SAVE_AS_COMPLETED for OLDocumentClass
DESCRIPTION: ...
PASS:
*ds:si - instance data
es - segment of OLDocumentClass
ax - The message
RETURN:
DESTROYED:
bx, si, di, ds, es (message handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 7/23/91 Initial version
------------------------------------------------------------------------------@
OLDocumentSaveAsCompleted method dynamic OLDocumentClass,
MSG_GEN_DOCUMENT_SAVE_AS_COMPLETED
mov ax, MSG_META_DOC_OUTPUT_SAVE_AS_COMPLETED
EC < call AssertIsGenDocument >
call SendNotificationToOutput
Destroy cx, dx, bp
ret
OLDocumentSaveAsCompleted endm
DocSaveAsClose ends
;---
DocCommon segment resource
COMMENT @----------------------------------------------------------------------
MESSAGE: OLDocumentPhysicalSave -- MSG_GEN_DOCUMENT_PHYSICAL_SAVE
for OLDocumentClass
DESCRIPTION: Really save the document
PASS:
*ds:si - instance data
es - segment of OLDocumentClass
ax - The message
RETURN:
carry - set if error
ax - file handle (if successful) or error code (if error)
DESTROYED:
bx, si, di, ds, es (message handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 7/23/91 Initial version
------------------------------------------------------------------------------@
OLDocumentPhysicalSave method dynamic OLDocumentClass,
MSG_GEN_DOCUMENT_PHYSICAL_SAVE
if DISPLAY_SAVING_MESSAGE
call CreateSaveDialogCheckVardata ;hold the user's hand, if
; ATTR_GEN_PATH != SP_TOP
pushdw cxdx
endif
mov ax, MSG_GEN_PROCESS_UNDO_FLUSH_ACTIONS
call SendUndoMessage
mov ax, MSG_META_DOC_OUTPUT_PHYSICAL_SAVE
call SendNotificationToOutput
jc common
; call correct save routine
call OLDocumentGetFileHandle ;bx = file handle
call GetParentAttrs ;ax = attribute, ZF = is VM
jz commit
call VMSave
jnc common
; Eat VM_UPDATE_BLOCK_WAS_LOCKED and VM_UPDATE_NOTHING_DIRTY, which
; should not be reported to the user. We will display a warning
; to the programmer though, so he can be aware that this is happening.
;
; This is done so autosaves (or saves) on files that can be accessed
; by multiple apps will not put up errors if by some chance one of the
; blocks is locked when we try to save.
;
cmp ax, VM_UPDATE_BLOCK_WAS_LOCKED
EC < WARNING_Z SAVE_FAILED_DUE_TO_BLOCK_LOCKED_BY_ANOTHER_THREAD>
jz ignore
cmp ax, VM_UPDATE_NOTHING_DIRTY
EC < WARNING_Z SAVE_ATTEMPTED_WHEN_NO_BLOCKS_WERE_DIRTY >
stc
jnz common
ignore:
clc
jmp common
commit:
clr al
call FileCommit
common:
if DISPLAY_SAVING_MESSAGE
popdw cxdx
call DestroySaveDialog ;destroy dialog
endif
Destroy cx, dx, bp
ret
OLDocumentPhysicalSave endm
COMMENT @----------------------------------------------------------------------
MESSAGE: OLDocumentPhysicalUpdate --
MSG_GEN_DOCUMENT_PHYSICAL_UPDATE for OLDocumentClass
DESCRIPTION: Update changes to the file
PASS:
*ds:si - instance data
es - segment of OLDocumentClass
ax - The message
RETURN:
carry - set if error
ax - file handle (if successful) or error code (if error)
DESTROYED:
bx, si, di, ds, es (message handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 7/23/91 Initial version
------------------------------------------------------------------------------@
OLDocumentPhysicalUpdate method dynamic OLDocumentClass,
MSG_GEN_DOCUMENT_PHYSICAL_UPDATE
mov ax, MSG_META_DOC_OUTPUT_PHYSICAL_UPDATE
call SendNotificationToOutput
jc done
call OLDocumentGetFileHandle
call GetParentAttrs ; ax <- attrs, ZF <- is VM
jz done
call VMUpdate
jc err
noErr:
clr al
call FileCommit
done:
Destroy cx, dx, bp
ret
err:
; Eat VM_UPDATE_BLOCK_WAS_LOCKED and VM_UPDATE_NOTHING_DIRTY, which
; should not be reported to the user. We will display a warning
; to the programmer though, so he can be aware that this is happening.
cmp ax, VM_UPDATE_BLOCK_WAS_LOCKED
EC < WARNING_Z SAVE_FAILED_DUE_TO_BLOCK_LOCKED_BY_ANOTHER_THREAD>
jz ignore
cmp ax, VM_UPDATE_NOTHING_DIRTY
EC < WARNING_Z SAVE_ATTEMPTED_WHEN_NO_BLOCKS_WERE_DIRTY >
stc
jnz done
ignore:
clc
jmp done
OLDocumentPhysicalUpdate endm
COMMENT @----------------------------------------------------------------------
MESSAGE: OLDocumentPhysicalCheckForModifications --
MSG_GEN_DOCUMENT_PHYSICAL_CHECK_FOR_MODIFICATIONS
for OLDocumentClass
DESCRIPTION: Check to see if a "shared multiple" file is modified
PASS:
*ds:si - instance data
es - segment of OLDocumentClass
ax - The message
RETURN:
carry - set if file modified
ax, cx, dx, bp - destroyed
DESTROYED:
bx, si, di, ds, es (message handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 8/ 7/91 Initial version
------------------------------------------------------------------------------@
OLDocumentPhysicalCheckForModifications method dynamic OLDocumentClass,
MSG_GEN_DOCUMENT_PHYSICAL_CHECK_FOR_MODIFICATIONS
call OLDocumentGetFileHandle ;bx = file handle
call VMCheckForModifications
Destroy ax, cx, dx, bp
ret
OLDocumentPhysicalCheckForModifications endm
COMMENT @----------------------------------------------------------------------
FUNCTION: SendNotificationToOutput
DESCRIPTION: Load file handle and call OLDocSendNotification
CALLED BY: INTERNAL
PASS:
*ds:si - GenDocument
ax - method to send
RETURN:
ax - from notification
carry - from notification (clear if no notification)
DESTROYED:
none
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 1/90 Initial version
------------------------------------------------------------------------------@
SendNotificationToOutput proc far uses cx, dx, si, bp
.enter
EC < call AssertIsGenDocument >
; get OD to send to
push ax
mov ax, MSG_GEN_DOCUMENT_GROUP_GET_OUTPUT
call GenCallParent ;cx:dx = output
call OLDocumentGetFileHandle
mov_trash bp, ax
pop ax
mov bx, cx
mov cx, ds:[LMBH_handle]
xchg dx, si ;bx:si = output
;cx:dx = document
mov di, mask MF_FIXUP_DS or mask MF_CALL
call ObjMessage
.leave
ret
SendNotificationToOutput endp
COMMENT @----------------------------------------------------------------------
MESSAGE: OLDocumentWriteCachedDataToFile --
MSG_GEN_DOCUMENT_WRITE_CACHED_DATA_TO_FILE for OLDocumentClass
DESCRIPTION: ...
PASS:
*ds:si - instance data
es - segment of OLDocumentClass
ax - The message
RETURN:
DESTROYED:
bx, si, di, ds, es (message handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 7/23/91 Initial version
------------------------------------------------------------------------------@
OLDocumentWriteCachedDataToFile method dynamic OLDocumentClass,
MSG_GEN_DOCUMENT_WRITE_CACHED_DATA_TO_FILE
mov ax, MSG_META_DOC_OUTPUT_WRITE_CACHED_DATA_TO_FILE
EC < call AssertIsGenDocument >
call SendNotificationToOutput
Destroy cx, dx, bp
ret
OLDocumentWriteCachedDataToFile endm
COMMENT @----------------------------------------------------------------------
MESSAGE: OLDocumentDocumentHasChanged --
MSG_GEN_DOCUMENT_DOCUMENT_HAS_CHANGED for OLDocumentClass
DESCRIPTION: ...
PASS:
*ds:si - instance data
es - segment of OLDocumentClass
ax - The message
RETURN:
DESTROYED:
bx, si, di, ds, es (message handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 8/ 7/91 Initial version
------------------------------------------------------------------------------@
OLDocumentDocumentHasChanged method dynamic OLDocumentClass,
MSG_GEN_DOCUMENT_DOCUMENT_HAS_CHANGED
mov ax, MSG_META_DOC_OUTPUT_DOCUMENT_HAS_CHANGED
EC < call AssertIsGenDocument >
call SendNotificationToOutput
Destroy cx, dx, bp
ret
OLDocumentDocumentHasChanged endm
DocCommon ends
;---
DocMisc segment resource
COMMENT @----------------------------------------------------------------------
MESSAGE: OLDocumentPhysicalRevert -- MSG_GEN_DOCUMENT_PHYSICAL_REVERT
for OLDocumentClass
DESCRIPTION: ...
PASS:
*ds:si - instance data
es - segment of OLDocumentClass
ax - The message
RETURN:
carry - set if error
DESTROYED:
bx, si, di, ds, es (message handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 7/23/91 Initial version
------------------------------------------------------------------------------@
OLDocumentPhysicalRevert method dynamic OLDocumentClass,
MSG_GEN_DOCUMENT_PHYSICAL_REVERT
mov ax, MSG_META_DOC_OUTPUT_PHYSICAL_REVERT
call SendNotificationToOutput
jc common ;return carry set if error
; call correct revert routine
call OLDocumentGetFileHandle ;bx = file handle
call GetParentAttrs ;ax = attribute, ZF = is VM
jz common ;carry is clear
call VMGetAttributes ;al = VMAttributes
test al, mask VMA_BACKUP
jnz revert
call VMDiscardDirtyBlocks
jmp short common ;return error, if any
revert:
call VMRevert
done:
clc
common:
Destroy ax, cx, dx, bp
ret
OLDocumentPhysicalRevert endm
COMMENT @----------------------------------------------------------------------
MESSAGE: OLDocumentPhysicalRevertToAutoSave --
MSG_GEN_DOCUMENT_PHYSICAL_REVERT_TO_AUTO_SAVE
for OLDocumentClass
DESCRIPTION: ...
PASS:
*ds:si - instance data
es - segment of OLDocumentClass
ax - The message
RETURN:
carry - set if error
DESTROYED:
bx, si, di, ds, es (message handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 7/23/91 Initial version
------------------------------------------------------------------------------@
OLDocumentPhysicalRevertToAutoSave method dynamic OLDocumentClass,
MSG_GEN_DOCUMENT_PHYSICAL_REVERT_TO_AUTO_SAVE
mov ax, MSG_META_DOC_OUTPUT_PHYSICAL_REVERT_TO_AUTO_SAVE
call SendNotificationToOutput
jc common ;return carry set if error
; call correct revert routine
call OLDocumentGetFileHandle ;bx = file handle
call GetParentAttrs ;ax = attribute, ZF = is VM
jz common ;carry is clear
call VMDiscardDirtyBlocks
common:
Destroy ax, cx, dx, bp
ret
OLDocumentPhysicalRevertToAutoSave endm
COMMENT @----------------------------------------------------------------------
MESSAGE: OLDocumentUpdateEarlierCompatibleDocument --
MSG_GEN_DOCUMENT_UPDATE_EARLIER_COMPATIBLE_DOCUMENT
for OLDocumentClass
DESCRIPTION: ...
PASS:
*ds:si - instance data
es - segment of OLDocumentClass
ax - The message
RETURN:
carry - set if error
ax - error code (if error) or 0 if no error
DESTROYED:
bx, si, di, ds, es (message handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 7/23/91 Initial version
------------------------------------------------------------------------------@
OLDocumentUpdateEarlierCompatibleDocument method dynamic OLDocumentClass,
MSG_GEN_DOCUMENT_UPDATE_EARLIER_COMPATIBLE_DOCUMENT
mov ax, MSG_META_DOC_OUTPUT_UPDATE_EARLIER_COMPATIBLE_DOCUMENT
call SendNotificationToOutput
Destroy cx, dx, bp
ret
OLDocumentUpdateEarlierCompatibleDocument endm
COMMENT @----------------------------------------------------------------------
MESSAGE: OLDocumentUpdateEarlierIncompatibleDocument --
MSG_GEN_DOCUMENT_UPDATE_EARLIER_INCOMPATIBLE_DOCUMENT
for OLDocumentClass
DESCRIPTION: ...
PASS:
*ds:si - instance data
es - segment of OLDocumentClass
ax - The message
RETURN:
carry - set if error
ax - file handle (if no error) or error code (if error)
DESTROYED:
bx, si, di, ds, es (message handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 7/23/91 Initial version
------------------------------------------------------------------------------@
OLDocumentUpdateEarlierIncompatibleDocument method dynamic OLDocumentClass,
MSG_GEN_DOCUMENT_UPDATE_EARLIER_INCOMPATIBLE_DOCUMENT
mov ax, MSG_META_DOC_OUTPUT_UPDATE_EARLIER_INCOMPATIBLE_DOCUMENT
EC < call AssertIsGenDocument >
call SendNotificationToOutput
Destroy cx, dx, bp
ret
OLDocumentUpdateEarlierIncompatibleDocument endm
DocMisc ends
;---
DocObscure segment resource
COMMENT @----------------------------------------------------------------------
MESSAGE: OLDocumentAttachFailed --
MSG_GEN_DOCUMENT_ATTACH_FAILED for OLDocumentClass
DESCRIPTION: ...
PASS:
*ds:si - instance data
es - segment of OLDocumentClass
ax - The message
RETURN:
DESTROYED:
bx, si, di, ds, es (message handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 7/23/91 Initial version
------------------------------------------------------------------------------@
OLDocumentAttachFailed method dynamic OLDocumentClass,
MSG_GEN_DOCUMENT_ATTACH_FAILED
mov ax, MSG_META_DOC_OUTPUT_ATTACH_FAILED
EC < call AssertIsGenDocument >
call SendNotificationToOutput
Destroy cx, dx, bp
ret
OLDocumentAttachFailed endm
DocObscure ends
|
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; loader.asm
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; Forrest Yu, 2005
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
org 0100h
jmp LABEL_START ; Start
; 下面是 FAT12 磁盘的头, 之所以包含它是因为下面用到了磁盘的一些信息
%include "fat12hdr.inc"
%include "load.inc"
%include "pm.inc"
; GDT ------------------------------------------------------------------------------------------------------------------------------------------------------------
; 段基址 段界限 , 属性
LABEL_GDT: Descriptor 0, 0, 0 ; 空描述符
LABEL_DESC_FLAT_C: Descriptor 0, 0fffffh, DA_CR | DA_32 | DA_LIMIT_4K ; 0 ~ 4G
LABEL_DESC_FLAT_RW: Descriptor 0, 0fffffh, DA_DRW | DA_32 | DA_LIMIT_4K ; 0 ~ 4G
LABEL_DESC_VIDEO: Descriptor 0B8000h, 0ffffh, DA_DRW | DA_DPL3 ; 显存首地址
; GDT ------------------------------------------------------------------------------------------------------------------------------------------------------------
GdtLen equ $ - LABEL_GDT
GdtPtr dw GdtLen - 1 ; 段界限
dd BaseOfLoaderPhyAddr + LABEL_GDT ; 基地址
; GDT 选择子 ----------------------------------------------------------------------------------
SelectorFlatC equ LABEL_DESC_FLAT_C - LABEL_GDT
SelectorFlatRW equ LABEL_DESC_FLAT_RW - LABEL_GDT
SelectorVideo equ LABEL_DESC_VIDEO - LABEL_GDT + SA_RPL3
; GDT 选择子 ----------------------------------------------------------------------------------
BaseOfStack equ 0100h
LABEL_START: ; <--- 从这里开始 *************
mov ax, cs
mov ds, ax
mov es, ax
mov ss, ax
mov sp, BaseOfStack
mov dh, 0 ; "Loading "
call DispStrRealMode ; 显示字符串
; 得到内存数
mov ebx, 0 ; ebx = 后续值, 开始时需为 0
mov di, _MemChkBuf ; es:di 指向一个地址范围描述符结构(Address Range Descriptor Structure)
.MemChkLoop:
mov eax, 0E820h ; eax = 0000E820h
mov ecx, 20 ; ecx = 地址范围描述符结构的大小
mov edx, 0534D4150h ; edx = 'SMAP'
int 15h ; int 15h
jc .MemChkFail
add di, 20
inc dword [_dwMCRNumber] ; dwMCRNumber = ARDS 的个数
cmp ebx, 0
jne .MemChkLoop
jmp .MemChkOK
.MemChkFail:
mov dword [_dwMCRNumber], 0
.MemChkOK:
; 下面在 A 盘的根目录寻找 KERNEL.BIN
mov word [wSectorNo], SectorNoOfRootDirectory
xor ah, ah ; ┓
xor dl, dl ; ┣ 软驱复位
int 13h ; ┛
LABEL_SEARCH_IN_ROOT_DIR_BEGIN:
cmp word [wRootDirSizeForLoop], 0 ; ┓
jz LABEL_NO_KERNELBIN ; ┣ 判断根目录区是不是已经读完, 如果读完表示没有找到 KERNEL.BIN
dec word [wRootDirSizeForLoop] ; ┛
mov ax, BaseOfKernelFile
mov es, ax ; es <- BaseOfKernelFile
mov bx, OffsetOfKernelFile ; bx <- OffsetOfKernelFile 于是, es:bx = BaseOfKernelFile:OffsetOfKernelFile = BaseOfKernelFile * 10h + OffsetOfKernelFile
mov ax, [wSectorNo] ; ax <- Root Directory 中的某 Sector 号
mov cl, 1
call ReadSector
mov si, KernelFileName ; ds:si -> "KERNEL BIN"
mov di, OffsetOfKernelFile ; es:di -> BaseOfKernelFile:???? = BaseOfKernelFile*10h+????
cld
mov dx, 10h
LABEL_SEARCH_FOR_KERNELBIN:
cmp dx, 0 ; ┓
jz LABEL_GOTO_NEXT_SECTOR_IN_ROOT_DIR ; ┣ 循环次数控制, 如果已经读完了一个 Sector, 就跳到下一个 Sector
dec dx ; ┛
mov cx, 11
LABEL_CMP_FILENAME:
cmp cx, 0 ; ┓
jz LABEL_FILENAME_FOUND ; ┣ 循环次数控制, 如果比较了 11 个字符都相等, 表示找到
dec cx ; ┛
lodsb ; ds:si -> al
cmp al, byte [es:di] ; if al == es:di
jz LABEL_GO_ON
jmp LABEL_DIFFERENT
LABEL_GO_ON:
inc di
jmp LABEL_CMP_FILENAME ; 继续循环
LABEL_DIFFERENT:
and di, 0FFE0h ; else┓ 这时di的值不知道是什么, di &= e0 为了让它是 20h 的倍数
add di, 20h ; ┃
mov si, KernelFileName ; ┣ di += 20h 下一个目录条目
jmp LABEL_SEARCH_FOR_KERNELBIN; ┛
LABEL_GOTO_NEXT_SECTOR_IN_ROOT_DIR:
add word [wSectorNo], 1
jmp LABEL_SEARCH_IN_ROOT_DIR_BEGIN
LABEL_NO_KERNELBIN:
mov dh, 2 ; "No KERNEL."
call DispStrRealMode ; 显示字符串
jmp $ ; 没有找到 KERNEL.BIN, 死循环在这里
LABEL_FILENAME_FOUND: ; 找到 KERNEL.BIN 后便来到这里继续
mov ax, RootDirSectors
and di, 0FFF0h ; di -> 当前条目的开始
push eax
mov eax, [es : di + 01Ch] ; ┓
mov dword [dwKernelSize], eax ; ┛保存 KERNEL.BIN 文件大小
pop eax
add di, 01Ah ; di -> 首 Sector
mov cx, word [es:di]
push cx ; 保存此 Sector 在 FAT 中的序号
add cx, ax
add cx, DeltaSectorNo ; 这时 cl 里面是 LOADER.BIN 的起始扇区号 (从 0 开始数的序号)
mov ax, BaseOfKernelFile
mov es, ax ; es <- BaseOfKernelFile
mov bx, OffsetOfKernelFile ; bx <- OffsetOfKernelFile 于是, es:bx = BaseOfKernelFile:OffsetOfKernelFile = BaseOfKernelFile * 10h + OffsetOfKernelFile
mov ax, cx ; ax <- Sector 号
LABEL_GOON_LOADING_FILE:
push ax ; ┓
push bx ; ┃
mov ah, 0Eh ; ┃ 每读一个扇区就在 "Loading " 后面打一个点, 形成这样的效果:
mov al, '.' ; ┃
mov bl, 0Fh ; ┃ Loading ......
int 10h ; ┃
pop bx ; ┃
pop ax ; ┛
mov cl, 1
call ReadSector
pop ax ; 取出此 Sector 在 FAT 中的序号
call GetFATEntry
cmp ax, 0FFFh
jz LABEL_FILE_LOADED
push ax ; 保存 Sector 在 FAT 中的序号
mov dx, RootDirSectors
add ax, dx
add ax, DeltaSectorNo
add bx, [BPB_BytsPerSec]
jmp LABEL_GOON_LOADING_FILE
LABEL_FILE_LOADED:
call KillMotor ; 关闭软驱马达
mov dh, 1 ; "Ready."
call DispStrRealMode ; 显示字符串
; 下面准备跳入保护模式 -------------------------------------------
; 加载 GDTR
lgdt [GdtPtr]
; 关中断
cli
; 打开地址线A20
in al, 92h
or al, 00000010b
out 92h, al
; 准备切换到保护模式
mov eax, cr0
or eax, 1
mov cr0, eax
; 真正进入保护模式
jmp dword SelectorFlatC:(BaseOfLoaderPhyAddr+LABEL_PM_START)
;============================================================================
;变量
;----------------------------------------------------------------------------
wRootDirSizeForLoop dw RootDirSectors ; Root Directory 占用的扇区数
wSectorNo dw 0 ; 要读取的扇区号
bOdd db 0 ; 奇数还是偶数
dwKernelSize dd 0 ; KERNEL.BIN 文件大小
;============================================================================
;字符串
;----------------------------------------------------------------------------
KernelFileName db "KERNEL BIN", 0 ; KERNEL.BIN 之文件名
; 为简化代码, 下面每个字符串的长度均为 MessageLength
MessageLength equ 9
LoadMessage: db "Loading "
Message1 db "Ready. "
Message2 db "No KERNEL"
;============================================================================
;----------------------------------------------------------------------------
; 函数名: DispStrRealMode
;----------------------------------------------------------------------------
; 运行环境:
; 实模式(保护模式下显示字符串由函数 DispStr 完成)
; 作用:
; 显示一个字符串, 函数开始时 dh 中应该是字符串序号(0-based)
DispStrRealMode:
mov ax, MessageLength
mul dh
add ax, LoadMessage
mov bp, ax ; ┓
mov ax, ds ; ┣ ES:BP = 串地址
mov es, ax ; ┛
mov cx, MessageLength ; CX = 串长度
mov ax, 01301h ; AH = 13, AL = 01h
mov bx, 0007h ; 页号为0(BH = 0) 黑底白字(BL = 07h)
mov dl, 0
add dh, 3 ; 从第 3 行往下显示
int 10h ; int 10h
ret
;----------------------------------------------------------------------------
; 函数名: ReadSector
;----------------------------------------------------------------------------
; 作用:
; 从序号(Directory Entry 中的 Sector 号)为 ax 的的 Sector 开始, 将 cl 个 Sector 读入 es:bx 中
ReadSector:
; -----------------------------------------------------------------------
; 怎样由扇区号求扇区在磁盘中的位置 (扇区号 -> 柱面号, 起始扇区, 磁头号)
; -----------------------------------------------------------------------
; 设扇区号为 x
; ┌ 柱面号 = y >> 1
; x ┌ 商 y ┤
; -------------- => ┤ └ 磁头号 = y & 1
; 每磁道扇区数 │
; └ 余 z => 起始扇区号 = z + 1
push bp
mov bp, sp
sub esp, 2 ; 辟出两个字节的堆栈区域保存要读的扇区数: byte [bp-2]
mov byte [bp-2], cl
push bx ; 保存 bx
mov bl, [BPB_SecPerTrk] ; bl: 除数
div bl ; y 在 al 中, z 在 ah 中
inc ah ; z ++
mov cl, ah ; cl <- 起始扇区号
mov dh, al ; dh <- y
shr al, 1 ; y >> 1 (其实是 y/BPB_NumHeads, 这里BPB_NumHeads=2)
mov ch, al ; ch <- 柱面号
and dh, 1 ; dh & 1 = 磁头号
pop bx ; 恢复 bx
; 至此, "柱面号, 起始扇区, 磁头号" 全部得到 ^^^^^^^^^^^^^^^^^^^^^^^^
mov dl, [BS_DrvNum] ; 驱动器号 (0 表示 A 盘)
.GoOnReading:
mov ah, 2 ; 读
mov al, byte [bp-2] ; 读 al 个扇区
int 13h
jc .GoOnReading ; 如果读取错误 CF 会被置为 1, 这时就不停地读, 直到正确为止
add esp, 2
pop bp
ret
;----------------------------------------------------------------------------
; 函数名: GetFATEntry
;----------------------------------------------------------------------------
; 作用:
; 找到序号为 ax 的 Sector 在 FAT 中的条目, 结果放在 ax 中
; 需要注意的是, 中间需要读 FAT 的扇区到 es:bx 处, 所以函数一开始保存了 es 和 bx
GetFATEntry:
push es
push bx
push ax
mov ax, BaseOfKernelFile ; ┓
sub ax, 0100h ; ┣ 在 BaseOfKernelFile 后面留出 4K 空间用于存放 FAT
mov es, ax ; ┛
pop ax
mov byte [bOdd], 0
mov bx, 3
mul bx ; dx:ax = ax * 3
mov bx, 2
div bx ; dx:ax / 2 ==> ax <- 商, dx <- 余数
cmp dx, 0
jz LABEL_EVEN
mov byte [bOdd], 1
LABEL_EVEN:;偶数
xor dx, dx ; 现在 ax 中是 FATEntry 在 FAT 中的偏移量. 下面来计算 FATEntry 在哪个扇区中(FAT占用不止一个扇区)
mov bx, [BPB_BytsPerSec]
div bx ; dx:ax / BPB_BytsPerSec ==> ax <- 商 (FATEntry 所在的扇区相对于 FAT 来说的扇区号)
; dx <- 余数 (FATEntry 在扇区内的偏移)。
push dx
mov bx, 0 ; bx <- 0 于是, es:bx = (BaseOfKernelFile - 100):00 = (BaseOfKernelFile - 100) * 10h
add ax, SectorNoOfFAT1 ; 此句执行之后的 ax 就是 FATEntry 所在的扇区号
mov cl, 2
call ReadSector ; 读取 FATEntry 所在的扇区, 一次读两个, 避免在边界发生错误, 因为一个 FATEntry 可能跨越两个扇区
pop dx
add bx, dx
mov ax, [es:bx]
cmp byte [bOdd], 1
jnz LABEL_EVEN_2
shr ax, 4
LABEL_EVEN_2:
and ax, 0FFFh
LABEL_GET_FAT_ENRY_OK:
pop bx
pop es
ret
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
; 函数名: KillMotor
;----------------------------------------------------------------------------
; 作用:
; 关闭软驱马达
KillMotor:
push dx
mov dx, 03F2h
mov al, 0
out dx, al
pop dx
ret
;----------------------------------------------------------------------------
; 从此以后的代码在保护模式下执行 ----------------------------------------------------
; 32 位代码段. 由实模式跳入 ---------------------------------------------------------
[SECTION .s32]
ALIGN 32
[BITS 32]
LABEL_PM_START:
mov ax, SelectorVideo
mov gs, ax
mov ax, SelectorFlatRW
mov ds, ax
mov es, ax
mov fs, ax
mov ss, ax
mov esp, TopOfStack
push szMemChkTitle
call DispStr
add esp, 4
call DispMemInfo
call SetupPaging
;mov ah, 0Fh ; 0000: 黑底 1111: 白字
;mov al, 'P'
;mov [gs:((80 * 0 + 39) * 2)], ax ; 屏幕第 0 行, 第 39 列。
call InitKernel
;jmp $
;***************************************************************
jmp SelectorFlatC:KernelEntryPointPhyAddr ; 正式进入内核 *
;***************************************************************
; 内存看上去是这样的:
; ┃ ┃
; ┃ . ┃
; ┃ . ┃
; ┃ . ┃
; ┣━━━━━━━━━━━━━━━━━━┫
; ┃■■■■■■■■■■■■■■■■■■┃
; ┃■■■■■■Page Tables■■■■■■┃
; ┃■■■■■(大小由LOADER决定)■■■■┃
; 00101000h ┃■■■■■■■■■■■■■■■■■■┃ PageTblBase
; ┣━━━━━━━━━━━━━━━━━━┫
; ┃■■■■■■■■■■■■■■■■■■┃
; 00100000h ┃■■■■Page Directory Table■■■■┃ PageDirBase <- 1M
; ┣━━━━━━━━━━━━━━━━━━┫
; ┃□□□□□□□□□□□□□□□□□□┃
; F0000h ┃□□□□□□□System ROM□□□□□□┃
; ┣━━━━━━━━━━━━━━━━━━┫
; ┃□□□□□□□□□□□□□□□□□□┃
; E0000h ┃□□□□Expansion of system ROM □□┃
; ┣━━━━━━━━━━━━━━━━━━┫
; ┃□□□□□□□□□□□□□□□□□□┃
; C0000h ┃□□□Reserved for ROM expansion□□┃
; ┣━━━━━━━━━━━━━━━━━━┫
; ┃□□□□□□□□□□□□□□□□□□┃ B8000h ← gs
; A0000h ┃□□□Display adapter reserved□□□┃
; ┣━━━━━━━━━━━━━━━━━━┫
; ┃□□□□□□□□□□□□□□□□□□┃
; 9FC00h ┃□□extended BIOS data area (EBDA)□┃
; ┣━━━━━━━━━━━━━━━━━━┫
; ┃■■■■■■■■■■■■■■■■■■┃
; 90000h ┃■■■■■■■LOADER.BIN■■■■■■┃ somewhere in LOADER ← esp
; ┣━━━━━━━━━━━━━━━━━━┫
; ┃■■■■■■■■■■■■■■■■■■┃
; 80000h ┃■■■■■■■KERNEL.BIN■■■■■■┃
; ┣━━━━━━━━━━━━━━━━━━┫
; ┃■■■■■■■■■■■■■■■■■■┃
; 30000h ┃■■■■■■■■KERNEL■■■■■■■┃ 30400h ← KERNEL 入口 (KernelEntryPointPhyAddr)
; ┣━━━━━━━━━━━━━━━━━━┫
; ┃ ┃
; 7E00h ┃ F R E E ┃
; ┣━━━━━━━━━━━━━━━━━━┫
; ┃■■■■■■■■■■■■■■■■■■┃
; 7C00h ┃■■■■■■BOOT SECTOR■■■■■■┃
; ┣━━━━━━━━━━━━━━━━━━┫
; ┃ ┃
; 500h ┃ F R E E ┃
; ┣━━━━━━━━━━━━━━━━━━┫
; ┃□□□□□□□□□□□□□□□□□□┃
; 400h ┃□□□□ROM BIOS parameter area □□┃
; ┣━━━━━━━━━━━━━━━━━━┫
; ┃◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇◇┃
; 0h ┃◇◇◇◇◇◇Int Vectors◇◇◇◇◇◇┃
; ┗━━━━━━━━━━━━━━━━━━┛ ← cs, ds, es, fs, ss
;
;
; ┏━━━┓ ┏━━━┓
; ┃■■■┃ 我们使用 ┃□□□┃ 不能使用的内存
; ┗━━━┛ ┗━━━┛
; ┏━━━┓ ┏━━━┓
; ┃ ┃ 未使用空间 ┃◇◇◇┃ 可以覆盖的内存
; ┗━━━┛ ┗━━━┛
;
; 注:KERNEL 的位置实际上是很灵活的,可以通过同时改变 LOAD.INC 中的 KernelEntryPointPhyAddr 和 MAKEFILE 中参数 -Ttext 的值来改变。
; 比如,如果把 KernelEntryPointPhyAddr 和 -Ttext 的值都改为 0x400400,则 KERNEL 就会被加载到内存 0x400000(4M) 处,入口在 0x400400。
;
; ------------------------------------------------------------------------
; 显示 AL 中的数字
; ------------------------------------------------------------------------
DispAL:
push ecx
push edx
push edi
mov edi, [dwDispPos]
mov ah, 0Fh ; 0000b: 黑底 1111b: 白字
mov dl, al
shr al, 4
mov ecx, 2
.begin:
and al, 01111b
cmp al, 9
ja .1
add al, '0'
jmp .2
.1:
sub al, 0Ah
add al, 'A'
.2:
mov [gs:edi], ax
add edi, 2
mov al, dl
loop .begin
;add edi, 2
mov [dwDispPos], edi
pop edi
pop edx
pop ecx
ret
; DispAL 结束-------------------------------------------------------------
; ------------------------------------------------------------------------
; 显示一个整形数
; ------------------------------------------------------------------------
DispInt:
mov eax, [esp + 4]
shr eax, 24
call DispAL
mov eax, [esp + 4]
shr eax, 16
call DispAL
mov eax, [esp + 4]
shr eax, 8
call DispAL
mov eax, [esp + 4]
call DispAL
mov ah, 07h ; 0000b: 黑底 0111b: 灰字
mov al, 'h'
push edi
mov edi, [dwDispPos]
mov [gs:edi], ax
add edi, 4
mov [dwDispPos], edi
pop edi
ret
; DispInt 结束------------------------------------------------------------
; ------------------------------------------------------------------------
; 显示一个字符串
; ------------------------------------------------------------------------
DispStr:
push ebp
mov ebp, esp
push ebx
push esi
push edi
mov esi, [ebp + 8] ; pszInfo
mov edi, [dwDispPos]
mov ah, 0Fh
.1:
lodsb
test al, al
jz .2
cmp al, 0Ah ; 是回车吗?
jnz .3
push eax
mov eax, edi
mov bl, 160
div bl
and eax, 0FFh
inc eax
mov bl, 160
mul bl
mov edi, eax
pop eax
jmp .1
.3:
mov [gs:edi], ax
add edi, 2
jmp .1
.2:
mov [dwDispPos], edi
pop edi
pop esi
pop ebx
pop ebp
ret
; DispStr 结束------------------------------------------------------------
; ------------------------------------------------------------------------
; 换行
; ------------------------------------------------------------------------
DispReturn:
push szReturn
call DispStr ;printf("\n");
add esp, 4
ret
; DispReturn 结束---------------------------------------------------------
; ------------------------------------------------------------------------
; 内存拷贝,仿 memcpy
; ------------------------------------------------------------------------
; void* MemCpy(void* es:pDest, void* ds:pSrc, int iSize);
; ------------------------------------------------------------------------
MemCpy:
push ebp
mov ebp, esp
push esi
push edi
push ecx
mov edi, [ebp + 8] ; Destination
mov esi, [ebp + 12] ; Source
mov ecx, [ebp + 16] ; Counter
.1:
cmp ecx, 0 ; 判断计数器
jz .2 ; 计数器为零时跳出
mov al, [ds:esi] ; ┓
inc esi ; ┃
; ┣ 逐字节移动
mov byte [es:edi], al ; ┃
inc edi ; ┛
dec ecx ; 计数器减一
jmp .1 ; 循环
.2:
mov eax, [ebp + 8] ; 返回值
pop ecx
pop edi
pop esi
mov esp, ebp
pop ebp
ret ; 函数结束,返回
; MemCpy 结束-------------------------------------------------------------
; 显示内存信息 --------------------------------------------------------------
DispMemInfo:
push esi
push edi
push ecx
mov esi, MemChkBuf
mov ecx, [dwMCRNumber] ;for(int i=0;i<[MCRNumber];i++) // 每次得到一个ARDS(Address Range Descriptor Structure)结构
.loop: ;{
mov edx, 5 ; for(int j=0;j<5;j++) // 每次得到一个ARDS中的成员,共5个成员
mov edi, ARDStruct ; { // 依次显示:BaseAddrLow,BaseAddrHigh,LengthLow,LengthHigh,Type
.1: ;
push dword [esi] ;
call DispInt ; DispInt(MemChkBuf[j*4]); // 显示一个成员
pop eax ;
stosd ; ARDStruct[j*4] = MemChkBuf[j*4];
add esi, 4 ;
dec edx ;
cmp edx, 0 ;
jnz .1 ; }
call DispReturn ; printf("\n");
cmp dword [dwType], 1 ; if(Type == AddressRangeMemory) // AddressRangeMemory : 1, AddressRangeReserved : 2
jne .2 ; {
mov eax, [dwBaseAddrLow] ;
add eax, [dwLengthLow] ;
cmp eax, [dwMemSize] ; if(BaseAddrLow + LengthLow > MemSize)
jb .2 ;
mov [dwMemSize], eax ; MemSize = BaseAddrLow + LengthLow;
.2: ; }
loop .loop ;}
;
call DispReturn ;printf("\n");
push szRAMSize ;
call DispStr ;printf("RAM size:");
add esp, 4 ;
;
push dword [dwMemSize] ;
call DispInt ;DispInt(MemSize);
add esp, 4 ;
pop ecx
pop edi
pop esi
ret
; ---------------------------------------------------------------------------
; 启动分页机制 --------------------------------------------------------------
SetupPaging:
; 根据内存大小计算应初始化多少PDE以及多少页表
xor edx, edx
mov eax, [dwMemSize]
mov ebx, 400000h ; 400000h = 4M = 4096 * 1024, 一个页表对应的内存大小
div ebx
mov ecx, eax ; 此时 ecx 为页表的个数,也即 PDE 应该的个数
test edx, edx
jz .no_remainder
inc ecx ; 如果余数不为 0 就需增加一个页表
.no_remainder:
push ecx ; 暂存页表个数
; 为简化处理, 所有线性地址对应相等的物理地址. 并且不考虑内存空洞.
; 首先初始化页目录
mov ax, SelectorFlatRW
mov es, ax
mov edi, PageDirBase ; 此段首地址为 PageDirBase
xor eax, eax
mov eax, PageTblBase | PG_P | PG_USU | PG_RWW
.1:
stosd
add eax, 4096 ; 为了简化, 所有页表在内存中是连续的.
loop .1
; 再初始化所有页表
pop eax ; 页表个数
mov ebx, 1024 ; 每个页表 1024 个 PTE
mul ebx
mov ecx, eax ; PTE个数 = 页表个数 * 1024
mov edi, PageTblBase ; 此段首地址为 PageTblBase
xor eax, eax
mov eax, PG_P | PG_USU | PG_RWW
.2:
stosd
add eax, 4096 ; 每一页指向 4K 的空间
loop .2
mov eax, PageDirBase
mov cr3, eax
mov eax, cr0
or eax, 80000000h
mov cr0, eax
jmp short .3
.3:
nop
ret
; 分页机制启动完毕 ----------------------------------------------------------
; InitKernel ---------------------------------------------------------------------------------
; 将 KERNEL.BIN 的内容经过整理对齐后放到新的位置
; --------------------------------------------------------------------------------------------
InitKernel: ; 遍历每一个 Program Header,根据 Program Header 中的信息来确定把什么放进内存,放到什么位置,以及放多少。
xor esi, esi
mov cx, word [BaseOfKernelFilePhyAddr + 2Ch]; ┓ ecx <- pELFHdr->e_phnum
movzx ecx, cx ; ┛
mov esi, [BaseOfKernelFilePhyAddr + 1Ch] ; esi <- pELFHdr->e_phoff
add esi, BaseOfKernelFilePhyAddr ; esi <- OffsetOfKernel + pELFHdr->e_phoff
.Begin:
mov eax, [esi + 0]
cmp eax, 0 ; PT_NULL
jz .NoAction
push dword [esi + 010h] ; size ┓
mov eax, [esi + 04h] ; ┃
add eax, BaseOfKernelFilePhyAddr ; ┣ ::memcpy( (void*)(pPHdr->p_vaddr),
push eax ; src ┃ uchCode + pPHdr->p_offset,
push dword [esi + 08h] ; dst ┃ pPHdr->p_filesz;
call MemCpy ; ┃
add esp, 12 ; ┛
.NoAction:
add esi, 020h ; esi += pELFHdr->e_phentsize
dec ecx
jnz .Begin
ret
; InitKernel ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
; SECTION .data1 之开始 ---------------------------------------------------------------------------------------------
[SECTION .data1]
ALIGN 32
LABEL_DATA:
; 实模式下使用这些符号
; 字符串
_szMemChkTitle: db "BaseAddrL BaseAddrH LengthLow LengthHigh Type", 0Ah, 0
_szRAMSize: db "RAM size:", 0
_szReturn: db 0Ah, 0
;; 变量
_dwMCRNumber: dd 0 ; Memory Check Result
_dwDispPos: dd (80 * 6 + 0) * 2 ; 屏幕第 6 行, 第 0 列。
_dwMemSize: dd 0
_ARDStruct: ; Address Range Descriptor Structure
_dwBaseAddrLow: dd 0
_dwBaseAddrHigh: dd 0
_dwLengthLow: dd 0
_dwLengthHigh: dd 0
_dwType: dd 0
_MemChkBuf: times 256 db 0
;
;; 保护模式下使用这些符号
szMemChkTitle equ BaseOfLoaderPhyAddr + _szMemChkTitle
szRAMSize equ BaseOfLoaderPhyAddr + _szRAMSize
szReturn equ BaseOfLoaderPhyAddr + _szReturn
dwDispPos equ BaseOfLoaderPhyAddr + _dwDispPos
dwMemSize equ BaseOfLoaderPhyAddr + _dwMemSize
dwMCRNumber equ BaseOfLoaderPhyAddr + _dwMCRNumber
ARDStruct equ BaseOfLoaderPhyAddr + _ARDStruct
dwBaseAddrLow equ BaseOfLoaderPhyAddr + _dwBaseAddrLow
dwBaseAddrHigh equ BaseOfLoaderPhyAddr + _dwBaseAddrHigh
dwLengthLow equ BaseOfLoaderPhyAddr + _dwLengthLow
dwLengthHigh equ BaseOfLoaderPhyAddr + _dwLengthHigh
dwType equ BaseOfLoaderPhyAddr + _dwType
MemChkBuf equ BaseOfLoaderPhyAddr + _MemChkBuf
; 堆栈就在数据段的末尾
StackSpace: times 1000h db 0
TopOfStack equ BaseOfLoaderPhyAddr + $ ; 栈顶
; SECTION .data1 之结束 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
// 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 "content/browser/loader/async_revalidation_driver.h"
#include <utility>
#include "base/callback_helpers.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/sparse_histogram.h"
#include "base/single_thread_task_runner.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/time/time.h"
#include "net/base/net_errors.h"
#include "net/url_request/url_request_status.h"
namespace content {
namespace {
// This matches the maximum allocation size of AsyncResourceHandler.
const int kReadBufSize = 32 * 1024;
// The time to wait for a response. Since this includes the time taken to
// connect, this has been set to match the connect timeout
// kTransportConnectJobTimeoutInSeconds.
const int kResponseTimeoutInSeconds = 240; // 4 minutes.
// This value should not be too large, as this request may be tying up a socket
// that could be used for something better. However, if it is too small, the
// cache entry will be truncated for no good reason.
// TODO(ricea): Find a more scientific way to set this timeout.
const int kReadTimeoutInSeconds = 30;
} // namespace
AsyncRevalidationDriver::AsyncRevalidationDriver(
std::unique_ptr<net::URLRequest> request,
std::unique_ptr<ResourceThrottle> throttle,
const base::Closure& completion_callback)
: request_(std::move(request)),
throttle_(std::move(throttle)),
completion_callback_(completion_callback),
weak_ptr_factory_(this) {
request_->set_delegate(this);
throttle_->set_controller(this);
}
AsyncRevalidationDriver::~AsyncRevalidationDriver() {}
void AsyncRevalidationDriver::StartRequest() {
// Give the handler a chance to delay the URLRequest from being started.
bool defer_start = false;
throttle_->WillStartRequest(&defer_start);
if (defer_start) {
RecordDefer();
} else {
StartRequestInternal();
}
}
void AsyncRevalidationDriver::OnReceivedRedirect(
net::URLRequest* request,
const net::RedirectInfo& redirect_info,
bool* defer) {
DCHECK_EQ(request_.get(), request);
// The async revalidation should not follow redirects, because caching is
// a property of an individual HTTP resource.
DVLOG(1) << "OnReceivedRedirect: " << request_->url().spec();
CancelRequestInternal(net::ERR_ABORTED, RESULT_GOT_REDIRECT);
}
void AsyncRevalidationDriver::OnAuthRequired(
net::URLRequest* request,
net::AuthChallengeInfo* auth_info) {
DCHECK_EQ(request_.get(), request);
// This error code doesn't have exactly the right semantics, but it should
// be sufficient to narrow down the problem in net logs.
CancelRequestInternal(net::ERR_ACCESS_DENIED, RESULT_AUTH_FAILED);
}
void AsyncRevalidationDriver::OnBeforeNetworkStart(net::URLRequest* request,
bool* defer) {
DCHECK_EQ(request_.get(), request);
// Verify that the ResourceScheduler does not defer here.
throttle_->WillStartUsingNetwork(defer);
DCHECK(!*defer);
// Start the response timer. This use of base::Unretained() is guaranteed safe
// by the semantics of base::OneShotTimer.
timer_.Start(FROM_HERE,
base::TimeDelta::FromSeconds(kResponseTimeoutInSeconds),
base::Bind(&AsyncRevalidationDriver::OnTimeout,
base::Unretained(this), RESULT_RESPONSE_TIMEOUT));
}
void AsyncRevalidationDriver::OnResponseStarted(net::URLRequest* request) {
DCHECK_EQ(request_.get(), request);
DVLOG(1) << "OnResponseStarted: " << request_->url().spec();
// We have the response. No need to wait any longer.
timer_.Stop();
if (!request_->status().is_success()) {
UMA_HISTOGRAM_SPARSE_SLOWLY("Net.AsyncRevalidation.ResponseError",
-request_->status().ToNetError());
ResponseCompleted(RESULT_NET_ERROR);
// |this| may be deleted after this point.
return;
}
const net::HttpResponseInfo& response_info = request_->response_info();
if (!response_info.response_time.is_null() && response_info.was_cached) {
// The cached entry was revalidated. No need to read it in.
ResponseCompleted(RESULT_REVALIDATED);
// |this| may be deleted after this point.
return;
}
bool defer = false;
throttle_->WillProcessResponse(&defer);
DCHECK(!defer);
// Set up the timer for reading the body. This use of base::Unretained() is
// guaranteed safe by the semantics of base::OneShotTimer.
timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(kReadTimeoutInSeconds),
base::Bind(&AsyncRevalidationDriver::OnTimeout,
base::Unretained(this), RESULT_BODY_TIMEOUT));
StartReading(false); // Read the first chunk.
}
void AsyncRevalidationDriver::OnReadCompleted(net::URLRequest* request,
int bytes_read) {
// request_ could be NULL if a timeout happened while OnReadCompleted() was
// queued to run asynchronously.
if (!request_)
return;
DCHECK_EQ(request_.get(), request);
DCHECK(!is_deferred_);
DVLOG(1) << "OnReadCompleted: \"" << request_->url().spec() << "\""
<< " bytes_read = " << bytes_read;
// bytes_read == 0 is EOF.
if (bytes_read == 0) {
ResponseCompleted(RESULT_LOADED);
return;
}
// bytes_read == -1 is an error.
if (bytes_read == -1 || !request_->status().is_success()) {
UMA_HISTOGRAM_SPARSE_SLOWLY("Net.AsyncRevalidation.ReadError",
-request_->status().ToNetError());
ResponseCompleted(RESULT_READ_ERROR);
// |this| may be deleted after this point.
return;
}
DCHECK_GT(bytes_read, 0);
StartReading(true); // Read the next chunk.
}
void AsyncRevalidationDriver::Resume() {
DCHECK(is_deferred_);
DCHECK(request_);
is_deferred_ = false;
request_->LogUnblocked();
StartRequestInternal();
}
void AsyncRevalidationDriver::Cancel() {
NOTREACHED();
}
void AsyncRevalidationDriver::CancelAndIgnore() {
NOTREACHED();
}
void AsyncRevalidationDriver::CancelWithError(int error_code) {
NOTREACHED();
}
void AsyncRevalidationDriver::StartRequestInternal() {
DCHECK(request_);
DCHECK(!request_->is_pending());
request_->Start();
}
void AsyncRevalidationDriver::CancelRequestInternal(
int error,
AsyncRevalidationResult result) {
DVLOG(1) << "CancelRequestInternal: " << request_->url().spec();
// Set the error code since this will be reported to the NetworkDelegate and
// recorded in the NetLog.
request_->CancelWithError(error);
// The ResourceScheduler needs to be able to examine the request when the
// ResourceThrottle is destroyed, so delete it first.
throttle_.reset();
// Destroy the request so that it doesn't try to send an asynchronous
// notification of completion.
request_.reset();
// Cancel timer to prevent OnTimeout() being called.
timer_.Stop();
ResponseCompleted(result);
// |this| may deleted after this point.
}
void AsyncRevalidationDriver::StartReading(bool is_continuation) {
int bytes_read = 0;
ReadMore(&bytes_read);
// If IO is pending, wait for the URLRequest to call OnReadCompleted.
if (request_->status().is_io_pending())
return;
if (!is_continuation || bytes_read <= 0) {
OnReadCompleted(request_.get(), bytes_read);
} else {
// Else, trigger OnReadCompleted asynchronously to avoid starving the IO
// thread in case the URLRequest can provide data synchronously.
scoped_refptr<base::SingleThreadTaskRunner> single_thread_task_runner =
base::ThreadTaskRunnerHandle::Get();
single_thread_task_runner->PostTask(
FROM_HERE,
base::Bind(&AsyncRevalidationDriver::OnReadCompleted,
weak_ptr_factory_.GetWeakPtr(), request_.get(), bytes_read));
}
}
void AsyncRevalidationDriver::ReadMore(int* bytes_read) {
DCHECK(!is_deferred_);
if (!read_buffer_)
read_buffer_ = new net::IOBuffer(kReadBufSize);
timer_.Reset();
request_->Read(read_buffer_.get(), kReadBufSize, bytes_read);
// No need to check the return value here as we'll detect errors by
// inspecting the URLRequest's status.
}
void AsyncRevalidationDriver::ResponseCompleted(
AsyncRevalidationResult result) {
DVLOG(1) << "ResponseCompleted: "
<< (request_ ? request_->url().spec() : "(request deleted)")
<< "result = " << result;
UMA_HISTOGRAM_ENUMERATION("Net.AsyncRevalidation.Result", result, RESULT_MAX);
DCHECK(!completion_callback_.is_null());
base::ResetAndReturn(&completion_callback_).Run();
// |this| may be deleted after this point.
}
void AsyncRevalidationDriver::OnTimeout(AsyncRevalidationResult result) {
CancelRequestInternal(net::ERR_TIMED_OUT, result);
}
void AsyncRevalidationDriver::RecordDefer() {
request_->LogBlockedBy(throttle_->GetNameForLogging());
DCHECK(!is_deferred_);
is_deferred_ = true;
}
} // namespace content
|
;
; Copyright (c) 2016, Alliance for Open Media. All rights reserved
;
; This source code is subject to the terms of the BSD 2 Clause License and
; the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
; was not distributed with this source code in the LICENSE file, you can
; obtain it at https://www.aomedia.org/license/software-license. If the Alliance for Open
; Media Patent License 1.0 was not distributed with this source code in the
; PATENTS file, you can obtain it at https://www.aomedia.org/license/patent-license.
;
;
%include "x86inc.asm"
SECTION_RODATA
pw_4: times 8 dw 4
pw_8: times 8 dw 8
pw_16: times 4 dd 16
pw_32: times 4 dd 32
SECTION .text
INIT_XMM sse2
cglobal highbd_dc_predictor_4x4, 4, 5, 4, dst, stride, above, left, goffset
GET_GOT goffsetq
movq m0, [aboveq]
movq m2, [leftq]
paddw m0, m2
pshuflw m1, m0, 0xe
paddw m0, m1
pshuflw m1, m0, 0x1
paddw m0, m1
paddw m0, [GLOBAL(pw_4)]
psraw m0, 3
pshuflw m0, m0, 0x0
movq [dstq ], m0
movq [dstq+strideq*2], m0
lea dstq, [dstq+strideq*4]
movq [dstq ], m0
movq [dstq+strideq*2], m0
RESTORE_GOT
RET
INIT_XMM sse2
cglobal highbd_dc_predictor_8x8, 4, 5, 4, dst, stride, above, left, goffset
GET_GOT goffsetq
pxor m1, m1
movu m0, [aboveq]
movu m2, [leftq]
DEFINE_ARGS dst, stride, stride3, one
mov oned, 0x00010001
lea stride3q, [strideq*3]
movd m3, oned
pshufd m3, m3, 0x0
paddw m0, m2
pmaddwd m0, m3
packssdw m0, m1
pmaddwd m0, m3
packssdw m0, m1
pmaddwd m0, m3
paddw m0, [GLOBAL(pw_8)]
psrlw m0, 4
pshuflw m0, m0, 0x0
punpcklqdq m0, m0
movu [dstq ], m0
movu [dstq+strideq*2 ], m0
movu [dstq+strideq*4 ], m0
movu [dstq+stride3q*2], m0
lea dstq, [dstq+strideq*8]
movu [dstq ], m0
movu [dstq+strideq*2 ], m0
movu [dstq+strideq*4 ], m0
movu [dstq+stride3q*2], m0
RESTORE_GOT
RET
INIT_XMM sse2
cglobal highbd_v_predictor_4x4, 3, 3, 1, dst, stride, above
movq m0, [aboveq]
movq [dstq ], m0
movq [dstq+strideq*2], m0
lea dstq, [dstq+strideq*4]
movq [dstq ], m0
movq [dstq+strideq*2], m0
RET
INIT_XMM sse2
cglobal highbd_v_predictor_8x8, 3, 3, 1, dst, stride, above
movu m0, [aboveq]
DEFINE_ARGS dst, stride, stride3
lea stride3q, [strideq*3]
movu [dstq ], m0
movu [dstq+strideq*2 ], m0
movu [dstq+strideq*4 ], m0
movu [dstq+stride3q*2], m0
lea dstq, [dstq+strideq*8]
movu [dstq ], m0
movu [dstq+strideq*2 ], m0
movu [dstq+strideq*4 ], m0
movu [dstq+stride3q*2], m0
RET
|
// sol2
// The MIT License (MIT)
// Copyright (c) 2013-2021 Rapptz, ThePhD and contributors
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "sol_test.hpp"
#include <catch2/catch.hpp>
#include <set>
#include <map>
template <typename T>
void ordered_container_check(sol::state& lua, T& items) {
{
auto r1 = lua.safe_script(R"(
for i=1,#c do
v = c[(i + 10)]
assert(v == (i + 10))
end
)",
sol::script_pass_on_error);
REQUIRE(r1.valid());
}
{
auto r1 = lua.safe_script("i1 = c:find(11)", sol::script_pass_on_error);
REQUIRE(r1.valid());
auto r2 = lua.safe_script("i2 = c:find(14)", sol::script_pass_on_error);
REQUIRE(r2.valid());
}
{
auto r1 = lua.safe_script("io1 = c:index_of(12)", sol::script_pass_on_error);
REQUIRE(r1.valid());
auto r2 = lua.safe_script("io2 = c:index_of(13)", sol::script_pass_on_error);
REQUIRE(r2.valid());
}
{
auto r1 = lua.safe_script("v1 = c:get(11)", sol::script_pass_on_error);
REQUIRE(r1.valid());
auto r2 = lua.safe_script("v2 = c:get(13)", sol::script_pass_on_error);
REQUIRE(r2.valid());
}
{
auto r1 = lua.safe_script("c:set(20)", sol::script_pass_on_error);
REQUIRE(r1.valid());
auto r2 = lua.safe_script("c:set(16)", sol::script_pass_on_error);
REQUIRE(r2.valid());
}
{
auto r5 = lua.safe_script("s1 = #c", sol::script_pass_on_error);
REQUIRE(r5.valid());
auto r1 = lua.safe_script("c:erase(i1)", sol::script_pass_on_error);
REQUIRE(r1.valid());
auto r3 = lua.safe_script("s2 = #c", sol::script_pass_on_error);
REQUIRE(r3.valid());
auto r2 = lua.safe_script("c:erase(i2)", sol::script_pass_on_error);
REQUIRE(r2.valid());
auto r4 = lua.safe_script("s3 = #c", sol::script_pass_on_error);
REQUIRE(r4.valid());
}
{
auto r = lua.safe_script("c:add(17)", sol::script_pass_on_error);
REQUIRE(r.valid());
}
{
auto r = lua.safe_script("c[18] = true", sol::script_pass_on_error);
REQUIRE(r.valid());
}
{
auto r = lua.safe_script("v3 = c[20]", sol::script_pass_on_error);
REQUIRE(r.valid());
}
auto backit = items.begin();
std::size_t len = 0;
{
auto e = items.end();
auto last = backit;
for (; backit != e; ++backit, ++len) {
if (backit == e) {
break;
}
last = backit;
}
backit = last;
}
const int& first = *items.begin();
const int& last = *backit;
int i1 = lua["i1"];
int i2 = lua["i2"];
int io1 = lua["io1"];
int io2 = lua["io2"];
std::size_t s1 = lua["s1"];
std::size_t s2 = lua["s2"];
std::size_t s3 = lua["s3"];
int v1 = lua["v1"];
int v2 = lua["v2"];
int v3 = lua["v3"];
int values[] = { 12, 13, 15, 16, 17, 18, 20 };
{
std::size_t idx = 0;
for (const auto& i : items) {
const auto& v = values[idx];
REQUIRE((i == v));
++idx;
}
}
REQUIRE((s1 == 7));
REQUIRE((s2 == 6));
REQUIRE((s3 == 5));
REQUIRE((len == 7));
REQUIRE((first == 12));
REQUIRE((last == 20));
REQUIRE((i1 == 11));
REQUIRE((i2 == 14));
REQUIRE((io1 == 2));
REQUIRE((io2 == 3));
REQUIRE((v1 == 11));
REQUIRE((v2 == 13));
REQUIRE((v3 == 20));
}
template <typename T>
void associative_ordered_container_check(sol::state& lua, T& items) {
{
auto r1 = lua.safe_script(R"(
for i=1,#c do
v = c[(i + 10)]
assert(v == (i + 20))
end
)",
sol::script_pass_on_error);
REQUIRE(r1.valid());
}
{
auto r1 = lua.safe_script("i1 = c:find(11)", sol::script_pass_on_error);
REQUIRE(r1.valid());
auto r2 = lua.safe_script("i2 = c:find(14)", sol::script_pass_on_error);
REQUIRE(r2.valid());
}
{
auto r1 = lua.safe_script("io1 = c:index_of(12)", sol::script_pass_on_error);
REQUIRE(r1.valid());
auto r2 = lua.safe_script("io2 = c:index_of(13)", sol::script_pass_on_error);
REQUIRE(r2.valid());
}
{
auto r1 = lua.safe_script("v1 = c:get(11)", sol::script_pass_on_error);
REQUIRE(r1.valid());
auto r2 = lua.safe_script("v2 = c:get(13)", sol::script_pass_on_error);
REQUIRE(r2.valid());
}
{
auto r1 = lua.safe_script("c:set(20, 30)", sol::script_pass_on_error);
REQUIRE(r1.valid());
auto r2 = lua.safe_script("c:set(16, 26)", sol::script_pass_on_error);
REQUIRE(r2.valid());
auto r3 = lua.safe_script("c:set(12, 31)", sol::script_pass_on_error);
REQUIRE(r3.valid());
}
{
auto r5 = lua.safe_script("s1 = #c", sol::script_pass_on_error);
REQUIRE(r5.valid());
auto r1 = lua.safe_script("c:erase(11)", sol::script_pass_on_error);
REQUIRE(r1.valid());
auto r3 = lua.safe_script("s2 = #c", sol::script_pass_on_error);
REQUIRE(r3.valid());
auto r2 = lua.safe_script("c:erase(14)", sol::script_pass_on_error);
REQUIRE(r2.valid());
auto r4 = lua.safe_script("s3 = #c", sol::script_pass_on_error);
REQUIRE(r4.valid());
}
{
auto r = lua.safe_script("c:add(17, 27)", sol::script_pass_on_error);
REQUIRE(r.valid());
}
{
auto r = lua.safe_script("c[18] = 28", sol::script_pass_on_error);
REQUIRE(r.valid());
}
{
auto r = lua.safe_script("v3 = c[20]", sol::script_pass_on_error);
REQUIRE(r.valid());
}
auto backit = items.begin();
std::size_t len = 0;
{
auto e = items.end();
auto last = backit;
for (; backit != e; ++backit, ++len) {
if (backit == e) {
break;
}
last = backit;
}
backit = last;
}
const std::pair<const short, int>& first = *items.begin();
const std::pair<const short, int>& last = *backit;
int i1 = lua["i1"];
int i2 = lua["i2"];
int io1 = lua["io1"];
int io2 = lua["io2"];
std::size_t s1 = lua["s1"];
std::size_t s2 = lua["s2"];
std::size_t s3 = lua["s3"];
int v1 = lua["v1"];
int v2 = lua["v2"];
int v3 = lua["v3"];
std::pair<const short, int> values[]
= { { (short)12, 31 }, { (short)13, 23 }, { (short)15, 25 }, { (short)16, 26 }, { (short)17, 27 }, { (short)18, 28 }, { (short)20, 30 } };
{
std::size_t idx = 0;
for (const auto& i : items) {
const auto& v = values[idx];
REQUIRE((i == v));
++idx;
}
}
REQUIRE((s1 == 7));
REQUIRE((s2 == 6));
REQUIRE((s3 == 5));
REQUIRE((len == 7));
REQUIRE((first.first == 12));
REQUIRE((last.first == 20));
REQUIRE((first.second == 31));
REQUIRE((last.second == 30));
REQUIRE((i1 == 21));
REQUIRE((i2 == 24));
REQUIRE((io1 == 2));
REQUIRE((io2 == 3));
REQUIRE((v1 == 21));
REQUIRE((v2 == 23));
REQUIRE((v3 == 30));
}
template <typename T>
void associative_ordered_container_key_value_check(sol::state& lua, T& data, T& reflect) {
typedef typename T::key_type K;
typedef typename T::mapped_type V;
lua["collect"] = [&reflect](K k, V v) { reflect.insert({ k, v }); };
#if SOL_LUA_VERSION_I_ > 502
lua["val"] = data;
auto r = lua.safe_script(R"(
for k, v in pairs(val) do
collect(k, v)
end
print()
)",
sol::script_pass_on_error);
REQUIRE(r.valid());
#else
reflect = data;
#endif
REQUIRE((data == reflect));
}
template <typename T>
void ordered_lookup_container_check(sol::state& lua, T&) {
auto result0 = lua.safe_script("assert(c['a'] == 'a')", sol::script_default_on_error);
REQUIRE(result0.valid());
auto result1 = lua.safe_script("assert(c['b'] == 'b')", sol::script_default_on_error);
REQUIRE(result1.valid());
auto result2 = lua.safe_script("assert(c['c'] == 'c')", sol::script_default_on_error);
REQUIRE(result2.valid());
}
TEST_CASE("containers/ordered lookup containers", "check ordered container types") {
SECTION("set") {
sol::state lua;
lua.open_libraries(sol::lib::base);
std::set<int> items { 11, 12, 13, 14, 15 };
lua["c"] = &items;
ordered_container_check(lua, items);
}
SECTION("set string") {
sol::state lua;
lua.open_libraries(sol::lib::base);
std::set<std::string> items({ "a", "b", "c" });
lua["c"] = &items;
ordered_lookup_container_check(lua, items);
}
SECTION("multiset") {
sol::state lua;
lua.open_libraries(sol::lib::base);
std::multiset<int> items { 11, 12, 13, 14, 15 };
lua["c"] = &items;
ordered_container_check(lua, items);
}
SECTION("multiset string") {
sol::state lua;
lua.open_libraries(sol::lib::base);
std::multiset<std::string> items({ "a", "b", "c" });
lua["c"] = &items;
ordered_lookup_container_check(lua, items);
}
}
TEST_CASE("containers/associative ordered containers", "check associative (map) containers that are ordered fulfill basic functionality requirements") {
SECTION("map") {
sol::state lua;
lua.open_libraries(sol::lib::base);
std::map<short, int> items { { (short)11, 21 }, { (short)12, 22 }, { (short)13, 23 }, { (short)14, 24 }, { (short)15, 25 } };
lua["c"] = &items;
associative_ordered_container_check(lua, items);
}
SECTION("map string") {
sol::state lua;
lua.open_libraries(sol::lib::base);
std::map<std::string, std::string> items { { "a", "a" }, { "b", "b" }, { "c", "c" } };
lua["c"] = &items;
ordered_lookup_container_check(lua, items);
}
SECTION("multimap") {
sol::state lua;
lua.open_libraries(sol::lib::base);
std::multimap<short, int> items { { (short)11, 21 }, { (short)12, 22 }, { (short)13, 23 }, { (short)14, 24 }, { (short)15, 25 } };
lua["c"] = &items;
associative_ordered_container_check(lua, items);
}
SECTION("multimap string") {
sol::state lua;
lua.open_libraries(sol::lib::base);
std::multimap<std::string, std::string> items { { "a", "a" }, { "b", "b" }, { "c", "c" } };
lua["c"] = &items;
ordered_lookup_container_check(lua, items);
}
}
TEST_CASE("containers/associative ordered pairs", "check to make sure pairs works properly for key-value types") {
struct bar { };
std::unique_ptr<bar> ua(new bar()), ub(new bar()), uc(new bar());
bar* a = ua.get();
bar* b = ub.get();
bar* c = uc.get();
SECTION("map") {
sol::state lua;
lua.open_libraries(sol::lib::base);
std::map<std::string, bar*> data({ { "a", a }, { "b", b }, { "c", c } });
std::map<std::string, bar*> reflect;
associative_ordered_container_key_value_check(lua, data, reflect);
}
SECTION("multimap") {
sol::state lua;
lua.open_libraries(sol::lib::base);
std::multimap<std::string, bar*> data({ { "a", a }, { "b", b }, { "c", c } });
std::multimap<std::string, bar*> reflect;
associative_ordered_container_key_value_check(lua, data, reflect);
}
}
|
// Author - Dvir Sadon
#include "Soldier.hpp"
namespace WarGame
{
class ParamedicCommander : public Soldier
{
public:
ParamedicCommander(){ this->hp = 200;}
ParamedicCommander(int player) { this->player = player;}
};
} |
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
* Copyright (C) 1999-2015, International Business Machines Corporation and
* others. All Rights Reserved.
******************************************************************************
*/
#include "uvectr64.h"
#include "cmemory.h"
#include "putilimp.h"
U_NAMESPACE_BEGIN
#define DEFAULT_CAPACITY 8
/*
* Constants for hinting whether a key is an integer
* or a pointer. If a hint bit is zero, then the associated
* token is assumed to be an integer. This is needed for iSeries
*/
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(UVector64)
UVector64::UVector64(UErrorCode &status) :
count(0),
capacity(0),
maxCapacity(0),
elements(NULL)
{
_init(DEFAULT_CAPACITY, status);
}
UVector64::UVector64(int32_t initialCapacity, UErrorCode &status) :
count(0),
capacity(0),
maxCapacity(0),
elements(0)
{
_init(initialCapacity, status);
}
void UVector64::_init(int32_t initialCapacity, UErrorCode &status) {
// Fix bogus initialCapacity values; avoid malloc(0)
if (initialCapacity < 1) {
initialCapacity = DEFAULT_CAPACITY;
}
if (maxCapacity>0 && maxCapacity<initialCapacity) {
initialCapacity = maxCapacity;
}
if (initialCapacity > (int32_t)(INT32_MAX / sizeof(int64_t))) {
initialCapacity = uprv_min(DEFAULT_CAPACITY, maxCapacity);
}
elements = (int64_t *)uprv_malloc(sizeof(int64_t)*initialCapacity);
if (elements == 0) {
status = U_MEMORY_ALLOCATION_ERROR;
} else {
capacity = initialCapacity;
}
}
UVector64::~UVector64() {
uprv_free(elements);
elements = 0;
}
/**
* Assign this object to another (make this a copy of 'other').
*/
void UVector64::assign(const UVector64& other, UErrorCode &ec) {
if (ensureCapacity(other.count, ec)) {
setSize(other.count);
for (int32_t i=0; i<other.count; ++i) {
elements[i] = other.elements[i];
}
}
}
UBool UVector64::operator==(const UVector64& other) {
int32_t i;
if (count != other.count) return FALSE;
for (i=0; i<count; ++i) {
if (elements[i] != other.elements[i]) {
return FALSE;
}
}
return TRUE;
}
void UVector64::setElementAt(int64_t elem, int32_t index) {
if (0 <= index && index < count) {
elements[index] = elem;
}
/* else index out of range */
}
void UVector64::insertElementAt(int64_t elem, int32_t index, UErrorCode &status) {
// must have 0 <= index <= count
if (0 <= index && index <= count && ensureCapacity(count + 1, status)) {
for (int32_t i=count; i>index; --i) {
elements[i] = elements[i-1];
}
elements[index] = elem;
++count;
}
/* else index out of range */
}
void UVector64::removeAllElements(void) {
count = 0;
}
UBool UVector64::expandCapacity(int32_t minimumCapacity, UErrorCode &status) {
if (U_FAILURE(status)) {
return FALSE;
}
if (minimumCapacity < 0) {
status = U_ILLEGAL_ARGUMENT_ERROR;
return FALSE;
}
if (capacity >= minimumCapacity) {
return TRUE;
}
if (maxCapacity>0 && minimumCapacity>maxCapacity) {
status = U_BUFFER_OVERFLOW_ERROR;
return FALSE;
}
if (capacity > (INT32_MAX - 1) / 2) { // integer overflow check
status = U_ILLEGAL_ARGUMENT_ERROR;
return FALSE;
}
int32_t newCap = capacity * 2;
if (newCap < minimumCapacity) {
newCap = minimumCapacity;
}
if (maxCapacity > 0 && newCap > maxCapacity) {
newCap = maxCapacity;
}
if (newCap > (int32_t)(INT32_MAX / sizeof(int64_t))) { // integer overflow check
// We keep the original memory contents on bad minimumCapacity/maxCapacity.
status = U_ILLEGAL_ARGUMENT_ERROR;
return FALSE;
}
int64_t* newElems = (int64_t *)uprv_realloc(elements, sizeof(int64_t)*newCap);
if (newElems == NULL) {
// We keep the original contents on the memory failure on realloc.
status = U_MEMORY_ALLOCATION_ERROR;
return FALSE;
}
elements = newElems;
capacity = newCap;
return TRUE;
}
void UVector64::setMaxCapacity(int32_t limit) {
U_ASSERT(limit >= 0);
if (limit < 0) {
limit = 0;
}
if (limit > (int32_t)(INT32_MAX / sizeof(int64_t))) { // integer overflow check for realloc
// Something is very wrong, don't realloc, leave capacity and maxCapacity unchanged
return;
}
maxCapacity = limit;
if (capacity <= maxCapacity || maxCapacity == 0) {
// Current capacity is within the new limit.
return;
}
// New maximum capacity is smaller than the current size.
// Realloc the storage to the new, smaller size.
int64_t* newElems = (int64_t *)uprv_realloc(elements, sizeof(int64_t)*maxCapacity);
if (newElems == NULL) {
// Realloc to smaller failed.
// Just keep what we had. No need to call it a failure.
return;
}
elements = newElems;
capacity = maxCapacity;
if (count > capacity) {
count = capacity;
}
}
/**
* Change the size of this vector as follows: If newSize is smaller,
* then truncate the array, possibly deleting held elements for i >=
* newSize. If newSize is larger, grow the array, filling in new
* slots with NULL.
*/
void UVector64::setSize(int32_t newSize) {
int32_t i;
if (newSize < 0) {
return;
}
if (newSize > count) {
UErrorCode ec = U_ZERO_ERROR;
if (!ensureCapacity(newSize, ec)) {
return;
}
for (i=count; i<newSize; ++i) {
elements[i] = 0;
}
}
count = newSize;
}
U_NAMESPACE_END
|
; A211266: Number of integer pairs (x,y) such that 0<x<y<=n and x*y<=2n.
; 0,1,3,5,7,10,12,15,18,21,24,28,30,34,38,41,44,49,51,56,60,63,67,72,75,79,83,88,91,97,99,104,109,112,117,123,125,130,135,140,143,149,152,157,163,167,170,177,180,186,190,194,199,205,209,215,219,223
mov $6,$0
mov $8,$0
lpb $8
clr $0,6
mov $0,$6
sub $8,1
sub $0,$8
add $3,$0
mul $3,2
cal $3,92405 ; a(n) = tau(n) + tau(n+1), where tau(n) = A000005(n), the number of divisors of n.
div $3,2
mov $1,$3
sub $1,1
add $7,$1
lpe
mov $1,$7
|
;
; Old School Computer Architecture - SD Card driver
; Taken from the OSCA Bootcode by Phil Ruston 2011
; Port by Stefano Bodrato, 2012
;
; int sd_read_sector(struct SD_INFO descriptor, long sector, unsigned char *address);
;
; sd_card_info and card_select must be accessible,
; a good place to put them is in the vars declared in the CRT0 stub
;
; on exit: 0 if all OK or error code
;
; $Id: sd_read_sector_callee.asm,v 1.6 2017-01-03 00:27:43 aralbrec Exp $
;
PUBLIC sd_read_sector_callee
PUBLIC _sd_read_sector_callee
PUBLIC ASMDISP_SD_READ_SECTOR_CALLEE
EXTERN sd_card_info
EXTERN card_select
EXTERN sd_read_sector_main
EXTERN sd_set_sector_addr_regs
EXTERN sd_send_command_current_args
EXTERN sd_wait_data_token
EXTERN sd_deselect_card
INCLUDE "sdcard.def"
INCLUDE "osca.def"
sd_read_sector_callee:
_sd_read_sector_callee:
pop af ; ret addr
pop hl ; dst addr
exx
pop hl ; sector pos lsb
pop de ; sector pos msb
pop ix ; SD_INFO struct
push af
.asmentry
; ptr to MMC mask to be used to select port
ld a,(ix+1) ; or any other hw dependent reference to current slot
ld (card_select), a
ld a,(ix+2)
ld (sd_card_info), a
scf
call sd_set_sector_addr_regs
ld a,CMD17 ; Send CMD17 read sector command
call sd_send_command_current_args
ld a,sd_error_bad_command_response
jr nz,read_end ; if ZF set command response is $00
call sd_wait_data_token ; wait for the data token
ld a,sd_error_data_token_timeout
jr nz,read_end ; ZF set if data token reeceived
;..............................................................................................
exx
call sd_read_sector_main
;..............................................................................................
read_end:
call sd_deselect_card ; Routines always deselect card on return
ld h,0
ld l,a
ret
DEFC ASMDISP_SD_READ_SECTOR_CALLEE = # asmentry - sd_read_sector_callee
|
org 00100000h
jmp start
_c db ?
_max proc
push ebp
mov ebp,esp
sub esp,1
_max_a equ byte ptr [ebp+9]
_max_b equ byte ptr [ebp+8]
_max_t0 equ byte ptr [ebp-1]
mov al,_max_a
mov bl,_max_b
cmp al,bl
jg _max_1
mov al,0
jmp short _max_2
_max_1:
mov al,1
_max_2:
mov _max_t0,al
mov al,_max_t0
cmp al,0
jne _max_3
jmp _max_4
_max_3:
mov al,_max_a
jmp _max_0
jmp _max_5
_max_4:
mov al,_max_b
jmp _max_0
_max_5:
_max_0:
mov esp,ebp
pop ebp
ret
_max endp
_main proc
push ebp
mov ebp,esp
sub esp,6
_main_t0 equ byte ptr [ebp-2]
_main_t1 equ byte ptr [ebp-4]
_main_t2 equ byte ptr [ebp-5]
_main_t3 equ byte ptr [ebp-6]
_main_a equ byte ptr [ebp-1]
mov al,97
mov _main_a,al
mov _main_t0,al
_main_b equ byte ptr [ebp-3]
mov al,10
mov _main_b,al
mov _main_t1,al
mov al,_main_a
push al
mov al,_main_b
push al
call _max
add esp,2
mov _main_t2,al
mov al,_main_t2
mov _c,al
mov _main_t3,al
_main_0:
mov esp,ebp
pop ebp
ret
_main endp
init proc
mov al,50
mov _c,al
ret
init endp
start:
mov esp,00200000h
call init
call _main
hlt
|
; float __fssub (float left, float right) __z88dk_callee
SECTION code_clib
SECTION code_math
PUBLIC asm_fssub
EXTERN m32_fssub_callee
; subtract sccz80 float from sccz80 float
;
; enter : stack = sccz80_float left, ret
; DEHL = sccz80_float right
;
; exit : DEHL = sccz80_float(left+right)
;
; uses : af, bc, de, hl, af', bc', de', hl'
DEFC asm_fssub = m32_fssub_callee ; enter stack = d32_float left
; DEHL = d32_float right
; return DEHL = d32_float
|
;代码清单5-1
;文件名:c05_mbr.asm
;文件说明:硬盘主引导扇区代码
;创建日期:2011-3-31 21:15
mov ax,0xb800 ;指向文本模式的显示缓冲区
mov es,ax
;以下显示字符串"Label offset:"
mov byte [es:0x00],'L'
mov byte [es:0x01],0x07
mov byte [es:0x02],'a'
mov byte [es:0x03],0x07
mov byte [es:0x04],'b'
mov byte [es:0x05],0x07
mov byte [es:0x06],'e'
mov byte [es:0x07],0x07
mov byte [es:0x08],'l'
mov byte [es:0x09],0x07
mov byte [es:0x0a],' '
mov byte [es:0x0b],0x07
mov byte [es:0x0c],"o"
mov byte [es:0x0d],0x07
mov byte [es:0x0e],'f'
mov byte [es:0x0f],0x07
mov byte [es:0x10],'f'
mov byte [es:0x11],0x07
mov byte [es:0x12],'s'
mov byte [es:0x13],0x07
mov byte [es:0x14],'e'
mov byte [es:0x15],0x07
mov byte [es:0x16],'t'
mov byte [es:0x17],0x07
mov byte [es:0x18],':'
mov byte [es:0x19],0x07
mov ax,number ;取得标号number的偏移地址
mov bx,10
;设置数据段的基地址
mov cx,cs
mov ds,cx
;求个位上的数字
mov dx,0
div bx
mov [0x7c00+number+0x00],dl ;保存个位上的数字
;求十位上的数字
xor dx,dx
div bx
mov [0x7c00+number+0x01],dl ;保存十位上的数字
;求百位上的数字
xor dx,dx
div bx
mov [0x7c00+number+0x02],dl ;保存百位上的数字
;求千位上的数字
xor dx,dx
div bx
mov [0x7c00+number+0x03],dl ;保存千位上的数字
;求万位上的数字
xor dx,dx
div bx
mov [0x7c00+number+0x04],dl ;保存万位上的数字
;以下用十进制显示标号的偏移地址
mov al,[0x7c00+number+0x04]
add al,0x30
mov [es:0x1a],al
mov byte [es:0x1b],0x04
mov al,[0x7c00+number+0x03]
add al,0x30
mov [es:0x1c],al
mov byte [es:0x1d],0x04
mov al,[0x7c00+number+0x02]
add al,0x30
mov [es:0x1e],al
mov byte [es:0x1f],0x04
mov al,[0x7c00+number+0x01]
add al,0x30
mov [es:0x20],al
mov byte [es:0x21],0x04
mov al,[0x7c00+number+0x00]
add al,0x30
mov [es:0x22],al
mov byte [es:0x23],0x04
mov byte [es:0x24],'D'
mov byte [es:0x25],0x07
infi: jmp near infi ;无限循环
number db 0,0,0,0,0
times 203 db 0
db 0x55,0xaa |
.code
ALIGN 16
add_scalar_e proc
push rdi
push rsi
mov rdi, rcx
mov rsi, rdx
mov rdx, r8
;# Clear registers to propagate the carry bit
xor r8d, r8d
xor r9d, r9d
xor r10d, r10d
xor r11d, r11d
xor eax, eax
;# Begin addition chain
add rdx, qword ptr [rsi + 0]
mov qword ptr [rdi + 0], rdx
adcx r8, qword ptr [rsi + 8]
mov qword ptr [rdi + 8], r8
adcx r9, qword ptr [rsi + 16]
mov qword ptr [rdi + 16], r9
adcx r10, qword ptr [rsi + 24]
mov qword ptr [rdi + 24], r10
;# Return the carry bit in a register
adcx rax, r11
pop rsi
pop rdi
ret
add_scalar_e endp
ALIGN 16
fadd_e proc
push rdi
push rsi
mov rdi, rcx
mov rsi, rdx
mov rdx, r8
;# Compute the raw addition of f1 + f2
mov r8, qword ptr [rdx + 0]
add r8, qword ptr [rsi + 0]
mov r9, qword ptr [rdx + 8]
adcx r9, qword ptr [rsi + 8]
mov r10, qword ptr [rdx + 16]
adcx r10, qword ptr [rsi + 16]
mov r11, qword ptr [rdx + 24]
adcx r11, qword ptr [rsi + 24]
;# Wrap the result back into the field
;# Step 1: Compute carry*38
mov rax, 0
mov rdx, 38
cmovc rax, rdx
;# Step 2: Add carry*38 to the original sum
xor ecx, ecx
add r8, rax
adcx r9, rcx
mov qword ptr [rdi + 8], r9
adcx r10, rcx
mov qword ptr [rdi + 16], r10
adcx r11, rcx
mov qword ptr [rdi + 24], r11
;# Step 3: Fold the carry bit back in; guaranteed not to carry at this point
mov rax, 0
cmovc rax, rdx
add r8, rax
mov qword ptr [rdi + 0], r8
pop rsi
pop rdi
ret
fadd_e endp
ALIGN 16
fsub_e proc
push rdi
push rsi
mov rdi, rcx
mov rsi, rdx
mov rdx, r8
;# Compute the raw substraction of f1-f2
mov r8, qword ptr [rsi + 0]
sub r8, qword ptr [rdx + 0]
mov r9, qword ptr [rsi + 8]
sbb r9, qword ptr [rdx + 8]
mov r10, qword ptr [rsi + 16]
sbb r10, qword ptr [rdx + 16]
mov r11, qword ptr [rsi + 24]
sbb r11, qword ptr [rdx + 24]
;# Wrap the result back into the field
;# Step 1: Compute carry*38
mov rax, 0
mov rcx, 38
cmovc rax, rcx
;# Step 2: Substract carry*38 from the original difference
sub r8, rax
sbb r9, 0
sbb r10, 0
sbb r11, 0
;# Step 3: Fold the carry bit back in; guaranteed not to carry at this point
mov rax, 0
cmovc rax, rcx
sub r8, rax
;# Store the result
mov qword ptr [rdi + 0], r8
mov qword ptr [rdi + 8], r9
mov qword ptr [rdi + 16], r10
mov qword ptr [rdi + 24], r11
pop rsi
pop rdi
ret
fsub_e endp
ALIGN 16
fmul_scalar_e proc
push rdi
push r13
push rbx
push rsi
mov rdi, rcx
mov rsi, rdx
mov rdx, r8
;# Compute the raw multiplication of f1*f2
mulx rcx, r8, qword ptr [rsi + 0]
;# f1[0]*f2
mulx rbx, r9, qword ptr [rsi + 8]
;# f1[1]*f2
add r9, rcx
mov rcx, 0
mulx r13, r10, qword ptr [rsi + 16]
;# f1[2]*f2
adcx r10, rbx
mulx rax, r11, qword ptr [rsi + 24]
;# f1[3]*f2
adcx r11, r13
adcx rax, rcx
;# Wrap the result back into the field
;# Step 1: Compute carry*38
mov rdx, 38
imul rax, rdx
;# Step 2: Fold the carry back into dst
add r8, rax
adcx r9, rcx
mov qword ptr [rdi + 8], r9
adcx r10, rcx
mov qword ptr [rdi + 16], r10
adcx r11, rcx
mov qword ptr [rdi + 24], r11
;# Step 3: Fold the carry bit back in; guaranteed not to carry at this point
mov rax, 0
cmovc rax, rdx
add r8, rax
mov qword ptr [rdi + 0], r8
pop rsi
pop rbx
pop r13
pop rdi
ret
fmul_scalar_e endp
ALIGN 16
fmul_e proc
push r13
push r14
push r15
push rbx
push rsi
push rdi
mov rdi, rcx
mov rsi, rdx
mov r15, r8
mov rcx, r9
;# Compute the raw multiplication: tmp <- src1 * src2
;# Compute src1[0] * src2
mov rdx, qword ptr [rsi + 0]
mulx r9, r8, qword ptr [rcx + 0]
xor r10d, r10d
mov qword ptr [rdi + 0], r8
mulx r11, r10, qword ptr [rcx + 8]
adox r10, r9
mov qword ptr [rdi + 8], r10
mulx r13, rbx, qword ptr [rcx + 16]
adox rbx, r11
mulx rdx, r14, qword ptr [rcx + 24]
adox r14, r13
mov rax, 0
adox rax, rdx
;# Compute src1[1] * src2
mov rdx, qword ptr [rsi + 8]
mulx r9, r8, qword ptr [rcx + 0]
xor r10d, r10d
adcx r8, qword ptr [rdi + 8]
mov qword ptr [rdi + 8], r8
mulx r11, r10, qword ptr [rcx + 8]
adox r10, r9
adcx r10, rbx
mov qword ptr [rdi + 16], r10
mulx r13, rbx, qword ptr [rcx + 16]
adox rbx, r11
adcx rbx, r14
mov r8, 0
mulx rdx, r14, qword ptr [rcx + 24]
adox r14, r13
adcx r14, rax
mov rax, 0
adox rax, rdx
adcx rax, r8
;# Compute src1[2] * src2
mov rdx, qword ptr [rsi + 16]
mulx r9, r8, qword ptr [rcx + 0]
xor r10d, r10d
adcx r8, qword ptr [rdi + 16]
mov qword ptr [rdi + 16], r8
mulx r11, r10, qword ptr [rcx + 8]
adox r10, r9
adcx r10, rbx
mov qword ptr [rdi + 24], r10
mulx r13, rbx, qword ptr [rcx + 16]
adox rbx, r11
adcx rbx, r14
mov r8, 0
mulx rdx, r14, qword ptr [rcx + 24]
adox r14, r13
adcx r14, rax
mov rax, 0
adox rax, rdx
adcx rax, r8
;# Compute src1[3] * src2
mov rdx, qword ptr [rsi + 24]
mulx r9, r8, qword ptr [rcx + 0]
xor r10d, r10d
adcx r8, qword ptr [rdi + 24]
mov qword ptr [rdi + 24], r8
mulx r11, r10, qword ptr [rcx + 8]
adox r10, r9
adcx r10, rbx
mov qword ptr [rdi + 32], r10
mulx r13, rbx, qword ptr [rcx + 16]
adox rbx, r11
adcx rbx, r14
mov qword ptr [rdi + 40], rbx
mov r8, 0
mulx rdx, r14, qword ptr [rcx + 24]
adox r14, r13
adcx r14, rax
mov qword ptr [rdi + 48], r14
mov rax, 0
adox rax, rdx
adcx rax, r8
mov qword ptr [rdi + 56], rax
;# Line up pointers
mov rsi, rdi
mov rdi, r15
;# Wrap the result back into the field
;# Step 1: Compute dst + carry == tmp_hi * 38 + tmp_lo
mov rdx, 38
mulx r13, r8, qword ptr [rsi + 32]
xor ecx, ecx
adox r8, qword ptr [rsi + 0]
mulx rbx, r9, qword ptr [rsi + 40]
adcx r9, r13
adox r9, qword ptr [rsi + 8]
mulx r13, r10, qword ptr [rsi + 48]
adcx r10, rbx
adox r10, qword ptr [rsi + 16]
mulx rax, r11, qword ptr [rsi + 56]
adcx r11, r13
adox r11, qword ptr [rsi + 24]
adcx rax, rcx
adox rax, rcx
imul rax, rdx
;# Step 2: Fold the carry back into dst
add r8, rax
adcx r9, rcx
mov qword ptr [rdi + 8], r9
adcx r10, rcx
mov qword ptr [rdi + 16], r10
adcx r11, rcx
mov qword ptr [rdi + 24], r11
;# Step 3: Fold the carry bit back in; guaranteed not to carry at this point
mov rax, 0
cmovc rax, rdx
add r8, rax
mov qword ptr [rdi + 0], r8
pop rdi
pop rsi
pop rbx
pop r15
pop r14
pop r13
ret
fmul_e endp
ALIGN 16
fmul2_e proc
push r13
push r14
push r15
push rbx
push rsi
push rdi
mov rdi, rcx
mov rsi, rdx
mov r15, r8
mov rcx, r9
;# Compute the raw multiplication tmp[0] <- f1[0] * f2[0]
;# Compute src1[0] * src2
mov rdx, qword ptr [rsi + 0]
mulx r9, r8, qword ptr [rcx + 0]
xor r10d, r10d
mov qword ptr [rdi + 0], r8
mulx r11, r10, qword ptr [rcx + 8]
adox r10, r9
mov qword ptr [rdi + 8], r10
mulx r13, rbx, qword ptr [rcx + 16]
adox rbx, r11
mulx rdx, r14, qword ptr [rcx + 24]
adox r14, r13
mov rax, 0
adox rax, rdx
;# Compute src1[1] * src2
mov rdx, qword ptr [rsi + 8]
mulx r9, r8, qword ptr [rcx + 0]
xor r10d, r10d
adcx r8, qword ptr [rdi + 8]
mov qword ptr [rdi + 8], r8
mulx r11, r10, qword ptr [rcx + 8]
adox r10, r9
adcx r10, rbx
mov qword ptr [rdi + 16], r10
mulx r13, rbx, qword ptr [rcx + 16]
adox rbx, r11
adcx rbx, r14
mov r8, 0
mulx rdx, r14, qword ptr [rcx + 24]
adox r14, r13
adcx r14, rax
mov rax, 0
adox rax, rdx
adcx rax, r8
;# Compute src1[2] * src2
mov rdx, qword ptr [rsi + 16]
mulx r9, r8, qword ptr [rcx + 0]
xor r10d, r10d
adcx r8, qword ptr [rdi + 16]
mov qword ptr [rdi + 16], r8
mulx r11, r10, qword ptr [rcx + 8]
adox r10, r9
adcx r10, rbx
mov qword ptr [rdi + 24], r10
mulx r13, rbx, qword ptr [rcx + 16]
adox rbx, r11
adcx rbx, r14
mov r8, 0
mulx rdx, r14, qword ptr [rcx + 24]
adox r14, r13
adcx r14, rax
mov rax, 0
adox rax, rdx
adcx rax, r8
;# Compute src1[3] * src2
mov rdx, qword ptr [rsi + 24]
mulx r9, r8, qword ptr [rcx + 0]
xor r10d, r10d
adcx r8, qword ptr [rdi + 24]
mov qword ptr [rdi + 24], r8
mulx r11, r10, qword ptr [rcx + 8]
adox r10, r9
adcx r10, rbx
mov qword ptr [rdi + 32], r10
mulx r13, rbx, qword ptr [rcx + 16]
adox rbx, r11
adcx rbx, r14
mov qword ptr [rdi + 40], rbx
mov r8, 0
mulx rdx, r14, qword ptr [rcx + 24]
adox r14, r13
adcx r14, rax
mov qword ptr [rdi + 48], r14
mov rax, 0
adox rax, rdx
adcx rax, r8
mov qword ptr [rdi + 56], rax
;# Compute the raw multiplication tmp[1] <- f1[1] * f2[1]
;# Compute src1[0] * src2
mov rdx, qword ptr [rsi + 32]
mulx r9, r8, qword ptr [rcx + 32]
xor r10d, r10d
mov qword ptr [rdi + 64], r8
mulx r11, r10, qword ptr [rcx + 40]
adox r10, r9
mov qword ptr [rdi + 72], r10
mulx r13, rbx, qword ptr [rcx + 48]
adox rbx, r11
mulx rdx, r14, qword ptr [rcx + 56]
adox r14, r13
mov rax, 0
adox rax, rdx
;# Compute src1[1] * src2
mov rdx, qword ptr [rsi + 40]
mulx r9, r8, qword ptr [rcx + 32]
xor r10d, r10d
adcx r8, qword ptr [rdi + 72]
mov qword ptr [rdi + 72], r8
mulx r11, r10, qword ptr [rcx + 40]
adox r10, r9
adcx r10, rbx
mov qword ptr [rdi + 80], r10
mulx r13, rbx, qword ptr [rcx + 48]
adox rbx, r11
adcx rbx, r14
mov r8, 0
mulx rdx, r14, qword ptr [rcx + 56]
adox r14, r13
adcx r14, rax
mov rax, 0
adox rax, rdx
adcx rax, r8
;# Compute src1[2] * src2
mov rdx, qword ptr [rsi + 48]
mulx r9, r8, qword ptr [rcx + 32]
xor r10d, r10d
adcx r8, qword ptr [rdi + 80]
mov qword ptr [rdi + 80], r8
mulx r11, r10, qword ptr [rcx + 40]
adox r10, r9
adcx r10, rbx
mov qword ptr [rdi + 88], r10
mulx r13, rbx, qword ptr [rcx + 48]
adox rbx, r11
adcx rbx, r14
mov r8, 0
mulx rdx, r14, qword ptr [rcx + 56]
adox r14, r13
adcx r14, rax
mov rax, 0
adox rax, rdx
adcx rax, r8
;# Compute src1[3] * src2
mov rdx, qword ptr [rsi + 56]
mulx r9, r8, qword ptr [rcx + 32]
xor r10d, r10d
adcx r8, qword ptr [rdi + 88]
mov qword ptr [rdi + 88], r8
mulx r11, r10, qword ptr [rcx + 40]
adox r10, r9
adcx r10, rbx
mov qword ptr [rdi + 96], r10
mulx r13, rbx, qword ptr [rcx + 48]
adox rbx, r11
adcx rbx, r14
mov qword ptr [rdi + 104], rbx
mov r8, 0
mulx rdx, r14, qword ptr [rcx + 56]
adox r14, r13
adcx r14, rax
mov qword ptr [rdi + 112], r14
mov rax, 0
adox rax, rdx
adcx rax, r8
mov qword ptr [rdi + 120], rax
;# Line up pointers
mov rsi, rdi
mov rdi, r15
;# Wrap the results back into the field
;# Step 1: Compute dst + carry == tmp_hi * 38 + tmp_lo
mov rdx, 38
mulx r13, r8, qword ptr [rsi + 32]
xor ecx, ecx
adox r8, qword ptr [rsi + 0]
mulx rbx, r9, qword ptr [rsi + 40]
adcx r9, r13
adox r9, qword ptr [rsi + 8]
mulx r13, r10, qword ptr [rsi + 48]
adcx r10, rbx
adox r10, qword ptr [rsi + 16]
mulx rax, r11, qword ptr [rsi + 56]
adcx r11, r13
adox r11, qword ptr [rsi + 24]
adcx rax, rcx
adox rax, rcx
imul rax, rdx
;# Step 2: Fold the carry back into dst
add r8, rax
adcx r9, rcx
mov qword ptr [rdi + 8], r9
adcx r10, rcx
mov qword ptr [rdi + 16], r10
adcx r11, rcx
mov qword ptr [rdi + 24], r11
;# Step 3: Fold the carry bit back in; guaranteed not to carry at this point
mov rax, 0
cmovc rax, rdx
add r8, rax
mov qword ptr [rdi + 0], r8
;# Step 1: Compute dst + carry == tmp_hi * 38 + tmp_lo
mov rdx, 38
mulx r13, r8, qword ptr [rsi + 96]
xor ecx, ecx
adox r8, qword ptr [rsi + 64]
mulx rbx, r9, qword ptr [rsi + 104]
adcx r9, r13
adox r9, qword ptr [rsi + 72]
mulx r13, r10, qword ptr [rsi + 112]
adcx r10, rbx
adox r10, qword ptr [rsi + 80]
mulx rax, r11, qword ptr [rsi + 120]
adcx r11, r13
adox r11, qword ptr [rsi + 88]
adcx rax, rcx
adox rax, rcx
imul rax, rdx
;# Step 2: Fold the carry back into dst
add r8, rax
adcx r9, rcx
mov qword ptr [rdi + 40], r9
adcx r10, rcx
mov qword ptr [rdi + 48], r10
adcx r11, rcx
mov qword ptr [rdi + 56], r11
;# Step 3: Fold the carry bit back in; guaranteed not to carry at this point
mov rax, 0
cmovc rax, rdx
add r8, rax
mov qword ptr [rdi + 32], r8
pop rdi
pop rsi
pop rbx
pop r15
pop r14
pop r13
ret
fmul2_e endp
ALIGN 16
fsqr_e proc
push r15
push r13
push r14
push r12
push rbx
push rsi
push rdi
mov rdi, rcx
mov rsi, rdx
mov r12, r8
;# Compute the raw multiplication: tmp <- f * f
;# Step 1: Compute all partial products
mov rdx, qword ptr [rsi + 0]
;# f[0]
mulx r14, r8, qword ptr [rsi + 8]
xor r15d, r15d
;# f[1]*f[0]
mulx r10, r9, qword ptr [rsi + 16]
adcx r9, r14
;# f[2]*f[0]
mulx rcx, rax, qword ptr [rsi + 24]
adcx r10, rax
;# f[3]*f[0]
mov rdx, qword ptr [rsi + 24]
;# f[3]
mulx rbx, r11, qword ptr [rsi + 8]
adcx r11, rcx
;# f[1]*f[3]
mulx r13, rax, qword ptr [rsi + 16]
adcx rbx, rax
;# f[2]*f[3]
mov rdx, qword ptr [rsi + 8]
adcx r13, r15
;# f1
mulx rcx, rax, qword ptr [rsi + 16]
mov r14, 0
;# f[2]*f[1]
;# Step 2: Compute two parallel carry chains
xor r15d, r15d
adox r10, rax
adcx r8, r8
adox r11, rcx
adcx r9, r9
adox rbx, r15
adcx r10, r10
adox r13, r15
adcx r11, r11
adox r14, r15
adcx rbx, rbx
adcx r13, r13
adcx r14, r14
;# Step 3: Compute intermediate squares
mov rdx, qword ptr [rsi + 0]
mulx rcx, rax, rdx
;# f[0]^2
mov qword ptr [rdi + 0], rax
add r8, rcx
mov qword ptr [rdi + 8], r8
mov rdx, qword ptr [rsi + 8]
mulx rcx, rax, rdx
;# f[1]^2
adcx r9, rax
mov qword ptr [rdi + 16], r9
adcx r10, rcx
mov qword ptr [rdi + 24], r10
mov rdx, qword ptr [rsi + 16]
mulx rcx, rax, rdx
;# f[2]^2
adcx r11, rax
mov qword ptr [rdi + 32], r11
adcx rbx, rcx
mov qword ptr [rdi + 40], rbx
mov rdx, qword ptr [rsi + 24]
mulx rcx, rax, rdx
;# f[3]^2
adcx r13, rax
mov qword ptr [rdi + 48], r13
adcx r14, rcx
mov qword ptr [rdi + 56], r14
;# Line up pointers
mov rsi, rdi
mov rdi, r12
;# Wrap the result back into the field
;# Step 1: Compute dst + carry == tmp_hi * 38 + tmp_lo
mov rdx, 38
mulx r13, r8, qword ptr [rsi + 32]
xor ecx, ecx
adox r8, qword ptr [rsi + 0]
mulx rbx, r9, qword ptr [rsi + 40]
adcx r9, r13
adox r9, qword ptr [rsi + 8]
mulx r13, r10, qword ptr [rsi + 48]
adcx r10, rbx
adox r10, qword ptr [rsi + 16]
mulx rax, r11, qword ptr [rsi + 56]
adcx r11, r13
adox r11, qword ptr [rsi + 24]
adcx rax, rcx
adox rax, rcx
imul rax, rdx
;# Step 2: Fold the carry back into dst
add r8, rax
adcx r9, rcx
mov qword ptr [rdi + 8], r9
adcx r10, rcx
mov qword ptr [rdi + 16], r10
adcx r11, rcx
mov qword ptr [rdi + 24], r11
;# Step 3: Fold the carry bit back in; guaranteed not to carry at this point
mov rax, 0
cmovc rax, rdx
add r8, rax
mov qword ptr [rdi + 0], r8
pop rdi
pop rsi
pop rbx
pop r12
pop r14
pop r13
pop r15
ret
fsqr_e endp
ALIGN 16
fsqr2_e proc
push r15
push r13
push r14
push r12
push rbx
push rsi
push rdi
mov rdi, rcx
mov rsi, rdx
mov r12, r8
;# Step 1: Compute all partial products
mov rdx, qword ptr [rsi + 0]
;# f[0]
mulx r14, r8, qword ptr [rsi + 8]
xor r15d, r15d
;# f[1]*f[0]
mulx r10, r9, qword ptr [rsi + 16]
adcx r9, r14
;# f[2]*f[0]
mulx rcx, rax, qword ptr [rsi + 24]
adcx r10, rax
;# f[3]*f[0]
mov rdx, qword ptr [rsi + 24]
;# f[3]
mulx rbx, r11, qword ptr [rsi + 8]
adcx r11, rcx
;# f[1]*f[3]
mulx r13, rax, qword ptr [rsi + 16]
adcx rbx, rax
;# f[2]*f[3]
mov rdx, qword ptr [rsi + 8]
adcx r13, r15
;# f1
mulx rcx, rax, qword ptr [rsi + 16]
mov r14, 0
;# f[2]*f[1]
;# Step 2: Compute two parallel carry chains
xor r15d, r15d
adox r10, rax
adcx r8, r8
adox r11, rcx
adcx r9, r9
adox rbx, r15
adcx r10, r10
adox r13, r15
adcx r11, r11
adox r14, r15
adcx rbx, rbx
adcx r13, r13
adcx r14, r14
;# Step 3: Compute intermediate squares
mov rdx, qword ptr [rsi + 0]
mulx rcx, rax, rdx
;# f[0]^2
mov qword ptr [rdi + 0], rax
add r8, rcx
mov qword ptr [rdi + 8], r8
mov rdx, qword ptr [rsi + 8]
mulx rcx, rax, rdx
;# f[1]^2
adcx r9, rax
mov qword ptr [rdi + 16], r9
adcx r10, rcx
mov qword ptr [rdi + 24], r10
mov rdx, qword ptr [rsi + 16]
mulx rcx, rax, rdx
;# f[2]^2
adcx r11, rax
mov qword ptr [rdi + 32], r11
adcx rbx, rcx
mov qword ptr [rdi + 40], rbx
mov rdx, qword ptr [rsi + 24]
mulx rcx, rax, rdx
;# f[3]^2
adcx r13, rax
mov qword ptr [rdi + 48], r13
adcx r14, rcx
mov qword ptr [rdi + 56], r14
;# Step 1: Compute all partial products
mov rdx, qword ptr [rsi + 32]
;# f[0]
mulx r14, r8, qword ptr [rsi + 40]
xor r15d, r15d
;# f[1]*f[0]
mulx r10, r9, qword ptr [rsi + 48]
adcx r9, r14
;# f[2]*f[0]
mulx rcx, rax, qword ptr [rsi + 56]
adcx r10, rax
;# f[3]*f[0]
mov rdx, qword ptr [rsi + 56]
;# f[3]
mulx rbx, r11, qword ptr [rsi + 40]
adcx r11, rcx
;# f[1]*f[3]
mulx r13, rax, qword ptr [rsi + 48]
adcx rbx, rax
;# f[2]*f[3]
mov rdx, qword ptr [rsi + 40]
adcx r13, r15
;# f1
mulx rcx, rax, qword ptr [rsi + 48]
mov r14, 0
;# f[2]*f[1]
;# Step 2: Compute two parallel carry chains
xor r15d, r15d
adox r10, rax
adcx r8, r8
adox r11, rcx
adcx r9, r9
adox rbx, r15
adcx r10, r10
adox r13, r15
adcx r11, r11
adox r14, r15
adcx rbx, rbx
adcx r13, r13
adcx r14, r14
;# Step 3: Compute intermediate squares
mov rdx, qword ptr [rsi + 32]
mulx rcx, rax, rdx
;# f[0]^2
mov qword ptr [rdi + 64], rax
add r8, rcx
mov qword ptr [rdi + 72], r8
mov rdx, qword ptr [rsi + 40]
mulx rcx, rax, rdx
;# f[1]^2
adcx r9, rax
mov qword ptr [rdi + 80], r9
adcx r10, rcx
mov qword ptr [rdi + 88], r10
mov rdx, qword ptr [rsi + 48]
mulx rcx, rax, rdx
;# f[2]^2
adcx r11, rax
mov qword ptr [rdi + 96], r11
adcx rbx, rcx
mov qword ptr [rdi + 104], rbx
mov rdx, qword ptr [rsi + 56]
mulx rcx, rax, rdx
;# f[3]^2
adcx r13, rax
mov qword ptr [rdi + 112], r13
adcx r14, rcx
mov qword ptr [rdi + 120], r14
;# Line up pointers
mov rsi, rdi
mov rdi, r12
;# Step 1: Compute dst + carry == tmp_hi * 38 + tmp_lo
mov rdx, 38
mulx r13, r8, qword ptr [rsi + 32]
xor ecx, ecx
adox r8, qword ptr [rsi + 0]
mulx rbx, r9, qword ptr [rsi + 40]
adcx r9, r13
adox r9, qword ptr [rsi + 8]
mulx r13, r10, qword ptr [rsi + 48]
adcx r10, rbx
adox r10, qword ptr [rsi + 16]
mulx rax, r11, qword ptr [rsi + 56]
adcx r11, r13
adox r11, qword ptr [rsi + 24]
adcx rax, rcx
adox rax, rcx
imul rax, rdx
;# Step 2: Fold the carry back into dst
add r8, rax
adcx r9, rcx
mov qword ptr [rdi + 8], r9
adcx r10, rcx
mov qword ptr [rdi + 16], r10
adcx r11, rcx
mov qword ptr [rdi + 24], r11
;# Step 3: Fold the carry bit back in; guaranteed not to carry at this point
mov rax, 0
cmovc rax, rdx
add r8, rax
mov qword ptr [rdi + 0], r8
;# Step 1: Compute dst + carry == tmp_hi * 38 + tmp_lo
mov rdx, 38
mulx r13, r8, qword ptr [rsi + 96]
xor ecx, ecx
adox r8, qword ptr [rsi + 64]
mulx rbx, r9, qword ptr [rsi + 104]
adcx r9, r13
adox r9, qword ptr [rsi + 72]
mulx r13, r10, qword ptr [rsi + 112]
adcx r10, rbx
adox r10, qword ptr [rsi + 80]
mulx rax, r11, qword ptr [rsi + 120]
adcx r11, r13
adox r11, qword ptr [rsi + 88]
adcx rax, rcx
adox rax, rcx
imul rax, rdx
;# Step 2: Fold the carry back into dst
add r8, rax
adcx r9, rcx
mov qword ptr [rdi + 40], r9
adcx r10, rcx
mov qword ptr [rdi + 48], r10
adcx r11, rcx
mov qword ptr [rdi + 56], r11
;# Step 3: Fold the carry bit back in; guaranteed not to carry at this point
mov rax, 0
cmovc rax, rdx
add r8, rax
mov qword ptr [rdi + 32], r8
pop rdi
pop rsi
pop rbx
pop r12
pop r14
pop r13
pop r15
ret
fsqr2_e endp
ALIGN 16
cswap2_e proc
push rdi
push rsi
mov rdi, rcx
mov rsi, rdx
mov rdx, r8
;# Transfer bit into CF flag
add rdi, 18446744073709551615
;# cswap p1[0], p2[0]
mov r8, qword ptr [rsi + 0]
mov r9, qword ptr [rdx + 0]
mov r10, r8
cmovc r8, r9
cmovc r9, r10
mov qword ptr [rsi + 0], r8
mov qword ptr [rdx + 0], r9
;# cswap p1[1], p2[1]
mov r8, qword ptr [rsi + 8]
mov r9, qword ptr [rdx + 8]
mov r10, r8
cmovc r8, r9
cmovc r9, r10
mov qword ptr [rsi + 8], r8
mov qword ptr [rdx + 8], r9
;# cswap p1[2], p2[2]
mov r8, qword ptr [rsi + 16]
mov r9, qword ptr [rdx + 16]
mov r10, r8
cmovc r8, r9
cmovc r9, r10
mov qword ptr [rsi + 16], r8
mov qword ptr [rdx + 16], r9
;# cswap p1[3], p2[3]
mov r8, qword ptr [rsi + 24]
mov r9, qword ptr [rdx + 24]
mov r10, r8
cmovc r8, r9
cmovc r9, r10
mov qword ptr [rsi + 24], r8
mov qword ptr [rdx + 24], r9
;# cswap p1[4], p2[4]
mov r8, qword ptr [rsi + 32]
mov r9, qword ptr [rdx + 32]
mov r10, r8
cmovc r8, r9
cmovc r9, r10
mov qword ptr [rsi + 32], r8
mov qword ptr [rdx + 32], r9
;# cswap p1[5], p2[5]
mov r8, qword ptr [rsi + 40]
mov r9, qword ptr [rdx + 40]
mov r10, r8
cmovc r8, r9
cmovc r9, r10
mov qword ptr [rsi + 40], r8
mov qword ptr [rdx + 40], r9
;# cswap p1[6], p2[6]
mov r8, qword ptr [rsi + 48]
mov r9, qword ptr [rdx + 48]
mov r10, r8
cmovc r8, r9
cmovc r9, r10
mov qword ptr [rsi + 48], r8
mov qword ptr [rdx + 48], r9
;# cswap p1[7], p2[7]
mov r8, qword ptr [rsi + 56]
mov r9, qword ptr [rdx + 56]
mov r10, r8
cmovc r8, r9
cmovc r9, r10
mov qword ptr [rsi + 56], r8
mov qword ptr [rdx + 56], r9
pop rsi
pop rdi
ret
cswap2_e endp
end
|
; float acosh(float x) __z88dk_fastcall
SECTION code_fp_math48
PUBLIC cm48_sdcciy_acosh_fastcall
EXTERN cm48_sdcciyp_dx2m48, am48_acosh, cm48_sdcciyp_m482d
cm48_sdcciy_acosh_fastcall:
call cm48_sdcciyp_dx2m48
call am48_acosh
jp cm48_sdcciyp_m482d
|
; A206641: Fibonacci sequence beginning 14, 9.
; 14,9,23,32,55,87,142,229,371,600,971,1571,2542,4113,6655,10768,17423,28191,45614,73805,119419,193224,312643,505867,818510,1324377,2142887,3467264,5610151,9077415,14687566,23764981,38452547,62217528,100670075,162887603,263557678,426445281,690002959,1116448240,1806451199,2922899439,4729350638,7652250077,12381600715,20033850792,32415451507,52449302299,84864753806,137314056105,222178809911,359492866016,581671675927,941164541943,1522836217870,2464000759813,3986836977683,6450837737496,10437674715179,16888512452675,27326187167854,44214699620529,71540886788383,115755586408912,187296473197295,303052059606207,490348532803502,793400592409709,1283749125213211,2077149717622920,3360898842836131,5438048560459051,8798947403295182
mov $1,6
mov $2,1
lpb $0,1
sub $0,1
add $1,5
add $3,$2
mov $2,$1
mov $1,$3
sub $2,1
add $3,4
lpe
add $1,8
|
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "atom/common/native_mate_converters/v8_value_converter.h"
#include <map>
#include <string>
#include <utility>
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/values.h"
#include "native_mate/dictionary.h"
#include "vendor/node/src/node_buffer.h"
namespace atom {
namespace {
const int kMaxRecursionDepth = 100;
} // namespace
// The state of a call to FromV8Value.
class V8ValueConverter::FromV8ValueState {
public:
// Level scope which updates the current depth of some FromV8ValueState.
class Level {
public:
explicit Level(FromV8ValueState* state) : state_(state) {
state_->max_recursion_depth_--;
}
~Level() {
state_->max_recursion_depth_++;
}
private:
FromV8ValueState* state_;
};
FromV8ValueState() : max_recursion_depth_(kMaxRecursionDepth) {}
// If |handle| is not in |unique_map_|, then add it to |unique_map_| and
// return true.
//
// Otherwise do nothing and return false. Here "A is unique" means that no
// other handle B in the map points to the same object as A. Note that A can
// be unique even if there already is another handle with the same identity
// hash (key) in the map, because two objects can have the same hash.
bool UpdateAndCheckUniqueness(v8::Local<v8::Object> handle) {
typedef HashToHandleMap::const_iterator Iterator;
int hash = handle->GetIdentityHash();
// We only compare using == with handles to objects with the same identity
// hash. Different hash obviously means different objects, but two objects
// in a couple of thousands could have the same identity hash.
std::pair<Iterator, Iterator> range = unique_map_.equal_range(hash);
for (Iterator it = range.first; it != range.second; ++it) {
// Operator == for handles actually compares the underlying objects.
if (it->second == handle)
return false;
}
unique_map_.insert(std::make_pair(hash, handle));
return true;
}
bool HasReachedMaxRecursionDepth() {
return max_recursion_depth_ < 0;
}
private:
typedef std::multimap<int, v8::Local<v8::Object> > HashToHandleMap;
HashToHandleMap unique_map_;
int max_recursion_depth_;
};
V8ValueConverter::V8ValueConverter()
: reg_exp_allowed_(false),
function_allowed_(false),
strip_null_from_objects_(false) {}
void V8ValueConverter::SetRegExpAllowed(bool val) {
reg_exp_allowed_ = val;
}
void V8ValueConverter::SetFunctionAllowed(bool val) {
function_allowed_ = val;
}
void V8ValueConverter::SetStripNullFromObjects(bool val) {
strip_null_from_objects_ = val;
}
v8::Local<v8::Value> V8ValueConverter::ToV8Value(
const base::Value* value, v8::Local<v8::Context> context) const {
v8::Context::Scope context_scope(context);
v8::EscapableHandleScope handle_scope(context->GetIsolate());
return handle_scope.Escape(ToV8ValueImpl(context->GetIsolate(), value));
}
base::Value* V8ValueConverter::FromV8Value(
v8::Local<v8::Value> val,
v8::Local<v8::Context> context) const {
v8::Context::Scope context_scope(context);
v8::HandleScope handle_scope(context->GetIsolate());
FromV8ValueState state;
return FromV8ValueImpl(&state, val, context->GetIsolate());
}
v8::Local<v8::Value> V8ValueConverter::ToV8ValueImpl(
v8::Isolate* isolate, const base::Value* value) const {
CHECK(value);
switch (value->GetType()) {
case base::Value::TYPE_NULL:
return v8::Null(isolate);
case base::Value::TYPE_BOOLEAN: {
bool val = false;
CHECK(value->GetAsBoolean(&val));
return v8::Boolean::New(isolate, val);
}
case base::Value::TYPE_INTEGER: {
int val = 0;
CHECK(value->GetAsInteger(&val));
return v8::Integer::New(isolate, val);
}
case base::Value::TYPE_DOUBLE: {
double val = 0.0;
CHECK(value->GetAsDouble(&val));
return v8::Number::New(isolate, val);
}
case base::Value::TYPE_STRING: {
std::string val;
CHECK(value->GetAsString(&val));
return v8::String::NewFromUtf8(
isolate, val.c_str(), v8::String::kNormalString, val.length());
}
case base::Value::TYPE_LIST:
return ToV8Array(isolate, static_cast<const base::ListValue*>(value));
case base::Value::TYPE_DICTIONARY:
return ToV8Object(isolate,
static_cast<const base::DictionaryValue*>(value));
case base::Value::TYPE_BINARY:
return ToArrayBuffer(isolate,
static_cast<const base::BinaryValue*>(value));
default:
LOG(ERROR) << "Unexpected value type: " << value->GetType();
return v8::Null(isolate);
}
}
v8::Local<v8::Value> V8ValueConverter::ToV8Array(
v8::Isolate* isolate, const base::ListValue* val) const {
v8::Local<v8::Array> result(v8::Array::New(isolate, val->GetSize()));
for (size_t i = 0; i < val->GetSize(); ++i) {
const base::Value* child = NULL;
CHECK(val->Get(i, &child));
v8::Local<v8::Value> child_v8 = ToV8ValueImpl(isolate, child);
CHECK(!child_v8.IsEmpty());
v8::TryCatch try_catch;
result->Set(static_cast<uint32_t>(i), child_v8);
if (try_catch.HasCaught())
LOG(ERROR) << "Setter for index " << i << " threw an exception.";
}
return result;
}
v8::Local<v8::Value> V8ValueConverter::ToV8Object(
v8::Isolate* isolate, const base::DictionaryValue* val) const {
mate::Dictionary result = mate::Dictionary::CreateEmpty(isolate);
result.SetHidden("simple", true);
for (base::DictionaryValue::Iterator iter(*val);
!iter.IsAtEnd(); iter.Advance()) {
const std::string& key = iter.key();
v8::Local<v8::Value> child_v8 = ToV8ValueImpl(isolate, &iter.value());
CHECK(!child_v8.IsEmpty());
v8::TryCatch try_catch;
result.Set(key, child_v8);
if (try_catch.HasCaught()) {
LOG(ERROR) << "Setter for property " << key.c_str() << " threw an "
<< "exception.";
}
}
return result.GetHandle();
}
v8::Local<v8::Value> V8ValueConverter::ToArrayBuffer(
v8::Isolate* isolate, const base::BinaryValue* value) const {
return node::Buffer::Copy(isolate,
value->GetBuffer(),
value->GetSize()).ToLocalChecked();
}
base::Value* V8ValueConverter::FromV8ValueImpl(
FromV8ValueState* state,
v8::Local<v8::Value> val,
v8::Isolate* isolate) const {
CHECK(!val.IsEmpty());
FromV8ValueState::Level state_level(state);
if (state->HasReachedMaxRecursionDepth())
return NULL;
if (val->IsNull())
return base::Value::CreateNullValue().release();
if (val->IsBoolean())
return new base::FundamentalValue(val->ToBoolean()->Value());
if (val->IsInt32())
return new base::FundamentalValue(val->ToInt32()->Value());
if (val->IsNumber())
return new base::FundamentalValue(val->ToNumber()->Value());
if (val->IsString()) {
v8::String::Utf8Value utf8(val->ToString());
return new base::StringValue(std::string(*utf8, utf8.length()));
}
if (val->IsUndefined())
// JSON.stringify ignores undefined.
return NULL;
if (val->IsDate()) {
v8::Date* date = v8::Date::Cast(*val);
v8::Local<v8::Value> toISOString =
date->Get(v8::String::NewFromUtf8(isolate, "toISOString"));
if (toISOString->IsFunction()) {
v8::Local<v8::Value> result =
toISOString.As<v8::Function>()->Call(val, 0, nullptr);
if (!result.IsEmpty()) {
v8::String::Utf8Value utf8(result->ToString());
return new base::StringValue(std::string(*utf8, utf8.length()));
}
}
}
if (val->IsRegExp()) {
if (!reg_exp_allowed_)
// JSON.stringify converts to an object.
return FromV8Object(val->ToObject(), state, isolate);
return new base::StringValue(*v8::String::Utf8Value(val->ToString()));
}
// v8::Value doesn't have a ToArray() method for some reason.
if (val->IsArray())
return FromV8Array(val.As<v8::Array>(), state, isolate);
if (val->IsFunction()) {
if (!function_allowed_)
// JSON.stringify refuses to convert function(){}.
return NULL;
return FromV8Object(val->ToObject(), state, isolate);
}
if (node::Buffer::HasInstance(val)) {
return FromNodeBuffer(val, state, isolate);
}
if (val->IsObject()) {
return FromV8Object(val->ToObject(), state, isolate);
}
LOG(ERROR) << "Unexpected v8 value type encountered.";
return NULL;
}
base::Value* V8ValueConverter::FromV8Array(
v8::Local<v8::Array> val,
FromV8ValueState* state,
v8::Isolate* isolate) const {
if (!state->UpdateAndCheckUniqueness(val))
return base::Value::CreateNullValue().release();
std::unique_ptr<v8::Context::Scope> scope;
// If val was created in a different context than our current one, change to
// that context, but change back after val is converted.
if (!val->CreationContext().IsEmpty() &&
val->CreationContext() != isolate->GetCurrentContext())
scope.reset(new v8::Context::Scope(val->CreationContext()));
base::ListValue* result = new base::ListValue();
// Only fields with integer keys are carried over to the ListValue.
for (uint32_t i = 0; i < val->Length(); ++i) {
v8::TryCatch try_catch;
v8::Local<v8::Value> child_v8 = val->Get(i);
if (try_catch.HasCaught()) {
LOG(ERROR) << "Getter for index " << i << " threw an exception.";
child_v8 = v8::Null(isolate);
}
if (!val->HasRealIndexedProperty(i))
continue;
base::Value* child = FromV8ValueImpl(state, child_v8, isolate);
if (child)
result->Append(child);
else
// JSON.stringify puts null in places where values don't serialize, for
// example undefined and functions. Emulate that behavior.
result->Append(base::Value::CreateNullValue());
}
return result;
}
base::Value* V8ValueConverter::FromNodeBuffer(
v8::Local<v8::Value> value,
FromV8ValueState* state,
v8::Isolate* isolate) const {
return base::BinaryValue::CreateWithCopiedBuffer(
node::Buffer::Data(value), node::Buffer::Length(value));
}
base::Value* V8ValueConverter::FromV8Object(
v8::Local<v8::Object> val,
FromV8ValueState* state,
v8::Isolate* isolate) const {
if (!state->UpdateAndCheckUniqueness(val))
return base::Value::CreateNullValue().release();
std::unique_ptr<v8::Context::Scope> scope;
// If val was created in a different context than our current one, change to
// that context, but change back after val is converted.
if (!val->CreationContext().IsEmpty() &&
val->CreationContext() != isolate->GetCurrentContext())
scope.reset(new v8::Context::Scope(val->CreationContext()));
std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue());
v8::Local<v8::Array> property_names(val->GetOwnPropertyNames());
for (uint32_t i = 0; i < property_names->Length(); ++i) {
v8::Local<v8::Value> key(property_names->Get(i));
// Extend this test to cover more types as necessary and if sensible.
if (!key->IsString() &&
!key->IsNumber()) {
NOTREACHED() << "Key \"" << *v8::String::Utf8Value(key) << "\" "
"is neither a string nor a number";
continue;
}
// Skip all callbacks: crbug.com/139933
if (val->HasRealNamedCallbackProperty(key->ToString()))
continue;
v8::String::Utf8Value name_utf8(key->ToString());
v8::TryCatch try_catch;
v8::Local<v8::Value> child_v8 = val->Get(key);
if (try_catch.HasCaught()) {
LOG(ERROR) << "Getter for property " << *name_utf8
<< " threw an exception.";
child_v8 = v8::Null(isolate);
}
std::unique_ptr<base::Value> child(
FromV8ValueImpl(state, child_v8, isolate));
if (!child.get())
// JSON.stringify skips properties whose values don't serialize, for
// example undefined and functions. Emulate that behavior.
continue;
// Strip null if asked (and since undefined is turned into null, undefined
// too). The use case for supporting this is JSON-schema support,
// specifically for extensions, where "optional" JSON properties may be
// represented as null, yet due to buggy legacy code elsewhere isn't
// treated as such (potentially causing crashes). For example, the
// "tabs.create" function takes an object as its first argument with an
// optional "windowId" property.
//
// Given just
//
// tabs.create({})
//
// this will work as expected on code that only checks for the existence of
// a "windowId" property (such as that legacy code). However given
//
// tabs.create({windowId: null})
//
// there *is* a "windowId" property, but since it should be an int, code
// on the browser which doesn't additionally check for null will fail.
// We can avoid all bugs related to this by stripping null.
if (strip_null_from_objects_ && child->IsType(base::Value::TYPE_NULL))
continue;
result->SetWithoutPathExpansion(std::string(*name_utf8, name_utf8.length()),
child.release());
}
return result.release();
}
} // namespace atom
|
format PE64 console
entry start
include 'win64w.inc'
section '.data' data readable writeable
stdout dq ?
section '.text' code readable executable
start:
fastcall setStdout
mov ecx, 90
sub ecx, 9
fastcall iprintLF
fastcall quitProgram
include 'procs.inc'
section '.idata' import data readable
library kernel32, 'kernel32.dll'
include 'api\kernel32.inc'
|
; A011843: a(n) = floor(binomial(n,5)/6).
; 0,0,0,0,0,0,1,3,9,21,42,77,132,214,333,500,728,1031,1428,1938,2584,3391,4389,5608,7084,8855,10963,13455,16380,19792,23751,28318,33562,39556,46376,54105,62832,72649,83657
mov $1,$0
bin $1,5
div $1,6
|
#ifndef PVL_GRAPHS_MST_PRIM_HPP_
#define PVL_GRAPHS_MST_PRIM_HPP_ 1
#include <queue>
#include <vector>
#include <utility>
#include "./graphs/weighted_graphs.hpp"
namespace pvl {
graph_edge_list_weighted<int> prim(
const graph_adj_list_weighted<int>& g, int s = 0) {
graph_edge_list_weighted<int> res(0);
using Tii = std::pair<int,
graph_edge_list_weighted<int>::ii>;
std::priority_queue<Tii, std::vector<Tii>,
std::greater<Tii>> pq;
std::vector<bool> vis(g.adj.size());
vis[s] = true;
for (auto &[v, w] : g.adj[s])
if (!vis[v])
pq.push({w, {s, v}});
while (!pq.empty()) {
auto [w, ii] = pq.top();
auto [v, u] = ii;
pq.pop();
if (vis[u]) continue;
vis[u] = true;
res.add_edge(v, u, w);
for (auto &[v, w] : g.adj[u])
if (!vis[v])
pq.push({w, {u, v}});
}
return res;
}
} // namespace pvl
#endif // PVL_GRAPHS_MST_PRIM_HPP_
|
/**
* Copyright (C) 2015 Dato, Inc.
* All rights reserved.
*
* This software may be modified and distributed under the terms
* of the BSD license. See the LICENSE file for details.
*/
#include <sframe/csv_writer.hpp>
#include <flexible_type/string_escape.hpp>
#include <logger/logger.hpp>
namespace graphlab {
void csv_writer::write_verbatim(std::ostream& out,
const std::vector<std::string>& row) {
for (size_t i = 0;i < row.size(); ++i) {
out << row[i];
// put a delimiter after every element except for the last element.
if (i + 1 < row.size()) out << delimiter;
}
out << line_terminator;
}
void csv_writer::csv_print_internal(std::string& out, const flexible_type& val) {
switch(val.get_type()) {
case flex_type_enum::INTEGER:
case flex_type_enum::FLOAT:
out += std::string(val);
break;
case flex_type_enum::DATETIME:
case flex_type_enum::VECTOR:
out += std::string(val);
break;
case flex_type_enum::STRING:
escape_string(val.get<flex_string>(), escape_char,
quote_char, true, false,
m_string_escape_buffer, m_string_escape_buffer_len);
out += std::string(m_string_escape_buffer.c_str(), m_string_escape_buffer_len);
break;
case flex_type_enum::LIST:
out += '[';
for(size_t i = 0;i < val.get<flex_list>().size(); ++i) {
csv_print_internal(out, val.get<flex_list>()[i]);
if (i + 1 < val.get<flex_list>().size()) out += ',';
}
out += ']';
break;
case flex_type_enum::DICT:
out += '{';
for(size_t i = 0;i < val.get<flex_dict>().size(); ++i) {
csv_print_internal(out, val.get<flex_dict>()[i].first);
out += ':';
csv_print_internal(out, val.get<flex_dict>()[i].second);
if (i + 1 < val.get<flex_dict>().size()) out += ',';
}
out += '}';
break;
case flex_type_enum::UNDEFINED:
break;
default:
out += (std::string)val;
break;
}
}
void csv_writer::csv_print(std::ostream& out, const flexible_type& val) {
switch(val.get_type()) {
case flex_type_enum::INTEGER:
case flex_type_enum::FLOAT:
if (quote_level == csv_quote_level::QUOTE_ALL) {
out << quote_char << std::string(val) << quote_char; // quote numbers only at QUOTE_ALL
} else {
out << std::string(val);
}
break;
case flex_type_enum::DATETIME:
case flex_type_enum::VECTOR:
if (quote_level != csv_quote_level::QUOTE_NONE) {
// quote this field at any level higher than QUOTE_NONE
out << quote_char << std::string(val) << quote_char;
} else {
out << std::string(val);
}
break;
case flex_type_enum::STRING:
if (quote_level != csv_quote_level::QUOTE_NONE) {
escape_string(val.get<flex_string>(), escape_char,
quote_char,
true,
double_quote,
m_string_escape_buffer, m_string_escape_buffer_len);
out.write(m_string_escape_buffer.c_str(), m_string_escape_buffer_len);
} else {
escape_string(val.get<flex_string>(), escape_char,
quote_char,
false,
false,
m_string_escape_buffer, m_string_escape_buffer_len);
out.write(m_string_escape_buffer.c_str(), m_string_escape_buffer_len);
}
break;
case flex_type_enum::LIST:
case flex_type_enum::DICT:
if (quote_level != csv_quote_level::QUOTE_NONE) {
m_complex_type_temporary.clear();
csv_print_internal(m_complex_type_temporary, val);
escape_string(m_complex_type_temporary, escape_char,
quote_char,
true,
double_quote,
m_complex_type_escape_buffer,
m_complex_type_escape_buffer_len);
out.write(m_complex_type_escape_buffer.c_str(), m_complex_type_escape_buffer_len);
} else {
m_complex_type_temporary.clear();
csv_print_internal(m_complex_type_temporary, val);
out.write(m_complex_type_temporary.c_str(), m_complex_type_temporary.length());
}
break;
case flex_type_enum::UNDEFINED:
if (quote_level != csv_quote_level::QUOTE_ALL) {
out.write(na_value.c_str(), na_value.length());
} else {
out << quote_char << na_value << quote_char;
}
break;
default:
if (quote_level != csv_quote_level::QUOTE_NONE) {
// quote this field at any level higher than QUOTE_NONE
out << quote_char << std::string(val) << quote_char;
} else {
out << std::string(val);
}
break;
}
}
void csv_writer::write(std::ostream& out,
const std::vector<flexible_type>& row) {
for (size_t i = 0;i < row.size(); ++i) {
csv_print(out, row[i]);
// put a delimiter after every element except for the last element.
if (i + 1 < row.size()) out << delimiter;
}
out << line_terminator;
}
} // namespace graphlab
|
; A015249: Gaussian binomial coefficient [ n,2 ] for q = -2.
; 1,3,15,55,231,903,3655,14535,58311,232903,932295,3727815,14913991,59650503,238612935,954429895,3817763271,15270965703,61084037575,244335800775,977343902151,3909374210503,15637499638215,62549992960455,250199983026631,1000799909736903,4003199683686855,16012798645268935,64051194760032711,256204778682216903,1024819115444695495,4099276460347126215,16397105844251816391,65588423371280642503,262353693496575816135,1049414773963396772295,4197659095899400073671,16790636383505974325703,67162545534207149240775,268650182136462093087175,1074600728546581380100551,4298402914184859504898503,17193611656742370050601415,68774446626963616140390855,275097786507866192685593031,1100391146031441314494312903,4401564584125812170473370055,17606258336503154856901243335,70425033346012807077589447111,281700133384050853010388840903,1126800533536204162641493258695,4507202134144815149366097244615,18028808536579263599864140558791,72115234146317048394657059074503,288460936585268205588227242619335,1153843746341072798333710957834695,4615374985364291241373239856624071,18461499941457164869416167375925703,73845999765828659669818253604843975,295383999063314638294965846217093575
add $0,3
mov $3,-2
pow $3,$0
sub $3,1
mov $1,$3
mov $2,$3
add $2,$3
mul $1,$2
div $1,144
mov $0,$1
|
; A171892: 0, 1 and all numbers >= 9.
; 0,1,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77
mov $1,1
bin $1,$0
cmp $1,0
mul $1,7
add $1,$0
mov $0,$1
|
/*=============================================================================
Copyright (c) 2001-2008 Joel de Guzman
Copyright (c) 2001-2008 Hartmut Kaiser
http://spirit.sourceforge.net/
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#ifndef BOOST_SPIRIT_INCLUDE_PHOENIX
#define BOOST_SPIRIT_INCLUDE_PHOENIX
#include <boost/spirit/home/classic/phoenix.hpp>
#endif
|
; ************************************************************************************************
; ************************************************************************************************
;
; Name: substring.asm
; Purpose: Substring code for mid$ left$ right$
; Created: 28th February 2021
; Reviewed: 8th March 2021
; Author: Paul Robson (paul@robsons.org.uk)
;
; ************************************************************************************************
; ************************************************************************************************
.section code
; ************************************************************************************************
;
; Create substring of (p1,p2,p3) MID$ format for stack A
; (e.g. indices from 1)
;
; ************************************************************************************************
StringSubstring: ;; <substring>
pha
tax ; access stack.
.pshy ; save Y
jsr CopyStringTop ; point temp0 to the string.
ldy #0 ; get length.
lda (temp0),Y
sta temp1
lda esInt0+1,x ; get the initial offset
cmp temp1 ; return "" if > length.
beq _SSBOkay
bcs _SSBReturnNull
_SSBOkay:
lda temp1 ; get the total length +1
clc
adc #1
sec
sbc esInt0+1,x ; the anything >= this is bad - max size
cmp esInt0+2,x ; check bad >= required
bcc _SSBTrunc
lda esInt0+2,x
_SSBTrunc:
sta temp1+1 ; characters to copy.
clc
adc #1 ; add 1
jsr AllocateSoftString ; allocate soft string memory, set pointer.
jsr CopySoftToStack ; copy that to the stack.
ldy esInt0+1,x ; get initial position of char to copy
_SSBCopyLoop:
lda temp1+1 ; done them all
beq _SSBExit
dec temp1+1
lda (temp0),y ; get and write character
jsr WriteSoftString
iny
jmp _SSBCopyLoop
_SSBReturnNull:
jsr ReturnNull
_SSBExit:
.puly ; restore Y
pla
rts
; ************************************************************************************************
;
; Return NULL string ""
;
; ************************************************************************************************
ReturnNull:
lda #0 ; clear null string
sta NullString
lda #NullString & $FF ; set a pointer to it
sta esInt0,x
lda #NullString >> 8
sta esInt1,x
rts
.send code
; ************************************************************************************************
;
; Changes and Updates
;
; ************************************************************************************************
;
; Date Notes
; ==== =====
; 07-Mar-21 Pre code read v0.01
;
; ************************************************************************************************
|
Sound_95_Header:
smpsHeaderStartSong 3
smpsHeaderVoice Sound_95_Voices
smpsHeaderTempoSFX $01
smpsHeaderChanSFX $01
smpsHeaderSFXChannel cFM5, Sound_95_FM5, $00, $02
; FM5 Data
Sound_95_FM5:
smpsSetvoice $00
dc.b nBb0, $13
smpsFMAlterVol $14
smpsLoop $00, $02, Sound_95_FM5
smpsStop
Sound_95_Voices:
; Voice $00
; $FA
; $00, $02, $00, $00, $19, $0C, $1F, $1F, $00, $00, $00, $00
; $10, $10, $10, $00, $FF, $FF, $FF, $FF, $64, $25, $05, $80
smpsVcAlgorithm $02
smpsVcFeedback $07
smpsVcUnusedBits $03
smpsVcDetune $00, $00, $00, $00
smpsVcCoarseFreq $00, $00, $02, $00
smpsVcRateScale $00, $00, $00, $00
smpsVcAttackRate $1F, $1F, $0C, $19
smpsVcAmpMod $00, $00, $00, $00
smpsVcDecayRate1 $00, $00, $00, $00
smpsVcDecayRate2 $00, $10, $10, $10
smpsVcDecayLevel $0F, $0F, $0F, $0F
smpsVcReleaseRate $0F, $0F, $0F, $0F
smpsVcTotalLevel $00, $05, $25, $64
|
; A195241: Expansion of (1-x+19*x^3-3*x^4)/(1-x)^3.
; 1,2,3,23,59,111,179,263,363,479,611,759,923,1103,1299,1511,1739,1983,2243,2519,2811,3119,3443,3783,4139,4511,4899,5303,5723,6159,6611,7079,7563,8063,8579,9111,9659,10223,10803,11399,12011,12639,13283,13943,14619,15311,16019,16743,17483,18239,19011,19799,20603,21423,22259,23111,23979,24863,25763,26679,27611,28559,29523,30503,31499,32511,33539,34583,35643,36719,37811,38919,40043,41183,42339,43511,44699,45903,47123,48359,49611,50879,52163,53463,54779,56111,57459,58823,60203,61599,63011,64439,65883,67343,68819,70311,71819,73343,74883,76439,78011,79599,81203,82823,84459,86111,87779,89463,91163,92879,94611,96359,98123,99903,101699,103511,105339,107183,109043,110919,112811,114719,116643,118583,120539,122511,124499,126503,128523,130559,132611,134679,136763,138863,140979,143111,145259,147423,149603,151799,154011,156239,158483,160743,163019,165311,167619,169943,172283,174639,177011,179399,181803,184223,186659,189111,191579,194063,196563,199079,201611,204159,206723,209303,211899,214511,217139,219783,222443,225119,227811,230519,233243,235983,238739,241511,244299,247103,249923,252759,255611,258479,261363,264263,267179,270111,273059,276023,279003,281999,285011,288039,291083,294143,297219,300311,303419,306543,309683,312839,316011,319199,322403,325623,328859,332111,335379,338663,341963,345279,348611,351959,355323,358703,362099,365511,368939,372383,375843,379319,382811,386319,389843,393383,396939,400511,404099,407703,411323,414959,418611,422279,425963,429663,433379,437111,440859,444623,448403,452199,456011,459839,463683,467543,471419,475311,479219,483143,487083,491039
mov $1,$0
trn $1,2
mov $2,$0
add $2,$1
add $2,2
mov $0,$2
sub $0,4
mov $1,$2
mov $3,$2
add $3,$2
sub $3,3
lpb $0,1
sub $0,1
add $1,$3
lpe
sub $1,1
|
.text
.syntax unified
.eabi_attribute 67, "2.09" @ Tag_conformance
.cpu arm1156t2f-s
.eabi_attribute 6, 8 @ Tag_CPU_arch
.eabi_attribute 8, 1 @ Tag_ARM_ISA_use
.eabi_attribute 9, 2 @ Tag_THUMB_ISA_use
.fpu vfpv2
.eabi_attribute 17, 1 @ Tag_ABI_PCS_GOT_use
.eabi_attribute 20, 1 @ Tag_ABI_FP_denormal
.eabi_attribute 21, 1 @ Tag_ABI_FP_exceptions
.eabi_attribute 23, 3 @ Tag_ABI_FP_number_model
.eabi_attribute 34, 1 @ Tag_CPU_unaligned_access
.eabi_attribute 24, 1 @ Tag_ABI_align_needed
.eabi_attribute 25, 1 @ Tag_ABI_align_preserved
.eabi_attribute 38, 1 @ Tag_ABI_FP_16bit_format
.eabi_attribute 18, 4 @ Tag_ABI_PCS_wchar_t
.eabi_attribute 26, 2 @ Tag_ABI_enum_size
.eabi_attribute 14, 0 @ Tag_ABI_PCS_R9_use
.file "mesa.api.glIndexd.ll"
.globl glIndexd
.align 1
.type glIndexd,%function
.code 16 @ @glIndexd
.thumb_func
glIndexd:
.fnstart
@ BB#0:
vmov d0, r0, r1
vcvt.f32.f64 s0, d0
vmov r1, s0
movw r0, :lower16:CC
movt r0, :upper16:CC
ldr r0, [r0]
ldr.w r2, [r0, #380]
bx r2
.Lfunc_end0:
.size glIndexd, .Lfunc_end0-glIndexd
.cantunwind
.fnend
.ident "clang version 3.8.0 (http://llvm.org/git/clang.git 2d49f0a0ae8366964a93e3b7b26e29679bee7160) (http://llvm.org/git/llvm.git 60bc66b44837125843b58ed3e0fd2e6bb948d839)"
.section ".note.GNU-stack","",%progbits
.eabi_attribute 30, 2 @ Tag_ABI_optimization_goals
|
[BITS 32]
section .text
extern handle_irq
extern hang
idtr DW 0 ;limit
DD 0 ;base
global loadidt
loadidt:
mov eax, [esp + 4]
mov [idtr + 2], eax
mov ax, [esp + 8]
mov [idtr], ax
lidt [idtr]
ret
%macro IDTES 1 ;exception handler irq no parameter
global _idtx%1
_idtx%1:
pushad ;save registers
push dword [esp+0x20] ;push eip
push 0 ;push data
push %1 ;push irq number
call handle_irq ;call c++ irq handler
add esp,12 ;pop 12 bytes (function arguments)
popad ;return
iret
%endmacro
%macro IDTEP 1 ;exception handler irq, with error code on top of stack
global _idtx%1
_idtx%1:
pushad ;save registers
push dword [esp+0x24] ;push eip
push dword [esp+0x24] ;push data
push %1 ;push irq number
call handle_irq ;call c++ irq handler
add esp,12 ;pop 12 bytes (function arguments)
popad ;restore registers
add esp,4 ;pop 4 bytes (data)
iret ;return
%endmacro
%macro IDTX 1 ;general-purpose interrupt, takes parameter in eax
global _idtx%1
_idtx%1:
pushad ;save registers
push dword [esp+0x20] ;push eip
push eax ;push data
push %1 ;push irq number
call handle_irq ;call c++ irq handler
add esp,12 ;pop 12 bytes (function arguments)
popad ;restore registers
iret ;return
%endmacro
%assign i 0
%rep 8
IDTES i ;0-7 no error code
%assign i i+1
%endrep
IDTEP i ;8 error code
%assign i i+1
IDTES i ;9 no error code
%assign i i+1
%rep 5
IDTEP i ;10-14 error code
%assign i i+1
%endrep
%rep 2
IDTES i ;15-16 no error code, 15 reserved
%assign i i+1
%endrep
IDTEP i ;17 error code
%assign i i+1
%rep 12
IDTES i ;18-29 no error code, 21-29 reserved
%assign i i+1
%endrep
IDTEP i ;30 error code
%assign i i+1
IDTES i ;31 no error code
%assign i i+1
%rep 224
IDTX i
%assign i i+1
%endrep
|
/**
* Copyright Soramitsu Co., Ltd. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
#include <gtest/gtest-param-test.h>
#include <gtest/gtest.h>
#include <boost/algorithm/string.hpp>
#include <cctype>
#include <functional>
#include <iterator>
#include <utility>
#include "backend/protobuf/query_responses/proto_query_response.hpp"
#include "backend/protobuf/transaction.hpp"
#include "cryptography/keypair.hpp"
#include "datetime/time.hpp"
#include "framework/integration_framework/integration_test_framework.hpp"
#include "integration/acceptance/acceptance_fixture.hpp"
#include "interfaces/common_objects/string_view_types.hpp"
#include "interfaces/common_objects/types.hpp"
#include "interfaces/permissions.hpp"
#include "interfaces/query_responses/account_response.hpp"
#include "module/shared_model/builders/protobuf/test_transaction_builder.hpp"
#include "module/shared_model/cryptography/crypto_defaults.hpp"
using namespace shared_model;
using namespace shared_model::crypto;
using namespace shared_model::interface::types;
using namespace integration_framework;
namespace {
using Transformer = int (*)(int);
static auto kUpperLowerTransformers{
::testing::Values<Transformer, Transformer>(&std::tolower,
&std::toupper)};
std::string transformHexPublicKey(PublicKeyHexStringView public_key,
Transformer transformer) {
std::string_view const &original_pubkey = public_key;
std::string transformed_pubkey;
std::transform(original_pubkey.begin(),
original_pubkey.end(),
std::back_inserter(transformed_pubkey),
*transformer);
return transformed_pubkey;
}
Keypair transformHexPublicKey(Keypair keypair, Transformer transformer) {
return Keypair{
PublicKeyHexStringView{transformHexPublicKey(
PublicKeyHexStringView{keypair.publicKey()}, transformer)},
crypto::PrivateKey(keypair.privateKey())};
}
} // namespace
struct HexKeys : public AcceptanceFixture,
public ::testing::WithParamInterface<
std::tuple<Transformer, Transformer>> {
HexKeys() : kNow(iroha::time::now()) {}
void SetUp() override {}
template <typename F>
void executeForItf(F &&f) {
for (auto const type : {iroha::StorageType::kPostgres}) {
IntegrationTestFramework itf(1, type);
using Role = interface::permissions::Role;
const interface::RolePermissionSet permissions = {Role::kAddSignatory,
Role::kRemoveSignatory,
Role::kAddPeer,
Role::kCreateAccount,
Role::kAppendRole,
Role::kGetMyAccount};
itf.setInitialState(common_constants::kAdminKeypair)
.sendTxAwait(AcceptanceFixture::makeUserWithPerms(permissions),
CHECK_TXS_QUANTITY(1));
std::forward<F>(f)(itf);
}
}
auto addSignatory(
PublicKeyHexStringView key,
interface::types::TimestampType time,
interface::types::AccountIdType user_id = common_constants::kUserId) {
return AcceptanceFixture::baseTx().createdTime(time).addSignatory(user_id,
key);
}
auto removeSignatory(
PublicKeyHexStringView key,
interface::types::TimestampType time,
interface::types::AccountIdType user_id = common_constants::kUserId) {
return AcceptanceFixture::baseTx().createdTime(time).removeSignatory(
user_id, key);
}
auto createAccount(PublicKeyHexStringView key,
interface::types::TimestampType time) {
return AcceptanceFixture::baseTx().createdTime(time).createAccount(
common_constants::kSecondUser, common_constants::kDomain, key);
}
auto addPeer(PublicKeyHexStringView key,
interface::types::TimestampType time) {
const auto imaginary_address = "192.168.23.149:50051";
return AcceptanceFixture::baseTx().createdTime(time).addPeer(
imaginary_address, key);
}
Keypair keypair = DefaultCryptoAlgorithmType::generateKeypair();
Keypair keypair_v1 = transformHexPublicKey(keypair, std::get<0>(GetParam()));
Keypair keypair_v2 = transformHexPublicKey(keypair, std::get<1>(GetParam()));
PublicKeyHexStringView public_key_v1{keypair_v1.publicKey()};
PublicKeyHexStringView public_key_v2{keypair_v2.publicKey()};
Keypair another_keypair = DefaultCryptoAlgorithmType::generateKeypair();
const interface::types::TimestampType kNow;
};
/**
* @given an account with kAddSignatory permission
* @when the same public key is used twice but written in different case
* @then only first attempt to add the key succeeds
*/
TEST_P(HexKeys, AddSignatory) {
executeForItf([&](auto &itf) {
auto tx1 = complete(addSignatory(public_key_v1, kNow));
auto tx2 = complete(addSignatory(public_key_v2, kNow + 1));
auto hash1 = tx1.hash();
auto hash2 = tx2.hash();
itf.sendTxAwait(tx1, CHECK_TXS_QUANTITY(1))
.sendTxAwait(tx2, CHECK_TXS_QUANTITY(0));
});
}
/**
* @given a user with kAddSignatory and kRemoveSignatory permissions
* @when a user adds a signatory using uppercased key string
* @then the signatory can be removed using lowercased key string
*/
TEST_P(HexKeys, RemoveSignatory) {
executeForItf([&](auto &itf) {
auto tx1 = complete(addSignatory(public_key_v1, kNow));
auto tx2 = complete(removeSignatory(public_key_v2, kNow + 1));
auto hash2 = tx2.hash();
itf.sendTxAwait(tx1, CHECK_TXS_QUANTITY(1))
.sendTxAwait(tx2, CHECK_TXS_QUANTITY(1));
});
}
/**
* @given a user created with uppercased public key
* @when some additional key is added to the user
* @then the first key can be removed even when it passed in lower case to a
* command
*/
TEST_P(HexKeys, CreateAccount) {
executeForItf([&](auto &itf) {
auto user = common_constants::kSameDomainUserId;
// kUserId creates kSameDomainUserId and appends the role with test
// permissions
auto tx1 = complete(createAccount(public_key_v1, kNow)
.appendRole(user, common_constants::kRole));
// kSameDomainUserId adds one more key to own account
auto tx2 = complete(
addSignatory(
PublicKeyHexStringView{another_keypair.publicKey()}, kNow + 1, user)
.creatorAccountId(user),
keypair_v2);
// kSameDomainUserId removes the initial key specifing it in other font case
auto tx3 = complete(
removeSignatory(public_key_v2, kNow + 2, user).creatorAccountId(user),
keypair_v2);
itf.sendTxAwait(tx1, CHECK_TXS_QUANTITY(1))
.sendTxAwait(tx2, CHECK_TXS_QUANTITY(1))
.sendTxAwait(tx3, CHECK_TXS_QUANTITY(1));
});
}
/**
* @given an initialized peer
* @when a user tries to add another peer with the same key as the first peer
* has, but written in a different font case
* @then the transaction is considered as stateful invalid
*/
TEST_P(HexKeys, AddPeerSameKeyDifferentCase) {
executeForItf([&](auto &itf) {
std::string original_key{common_constants::kAdminKeypair.publicKey()};
std::string same_key_transformed = transformHexPublicKey(
PublicKeyHexStringView{original_key}, std::get<0>(GetParam()));
auto tx =
complete(addPeer(PublicKeyHexStringView{same_key_transformed}, kNow));
auto hash = tx.hash();
itf.sendTxAwait(tx, CHECK_TXS_QUANTITY(0));
});
}
/**
* @given a user with kGetMyAccount permission
* @when query their account with transformed signatures
* @then query succeeds
*/
TEST_P(HexKeys, QuerySignature) {
executeForItf([&](auto &itf) {
using namespace shared_model::interface;
itf.sendQuery(
complete(baseQry().getAccount(common_constants::kUserId),
transformHexPublicKey(common_constants::kUserKeypair,
std::get<0>(GetParam()))),
[](auto const &general_response) {
AccountResponse const *account_response =
boost::get<AccountResponse const &>(&general_response.get());
ASSERT_NE(account_response, nullptr);
EXPECT_EQ(account_response->account().accountId(),
common_constants::kUserId);
});
});
}
INSTANTIATE_TEST_SUITE_P(LowerAndUpper,
HexKeys,
::testing::Combine(kUpperLowerTransformers,
kUpperLowerTransformers));
|
; struct adt_Stack *adt_StackCreate(void)
; 09.2005, 11.2006 aralbrec
SECTION code_clib
PUBLIC adt_StackCreate
PUBLIC _adt_StackCreate
EXTERN l_setmem
EXTERN _u_malloc
; create an empty stack
;
; exit : if fail HL = 0 and carry reset
; if successful HL = new stack handle and carry set
.adt_StackCreate
._adt_StackCreate
ld hl,4 ; sizeof(struct adt_Stack)
push hl
call _u_malloc
pop de
ret nc ; mem alloc failed, hl = 0
ld e,l
ld d,h
xor a
call l_setmem-7
ex de,hl
scf
ret
|
@111
D=A
@0
A=M
M=D
@0
M=M+1
@333
D=A
@0
A=M
M=D
@0
M=M+1
@888
D=A
@0
A=M
M=D
@0
M=M+1
@0
M=M-1
@16
D=A
@8
D=D+A
@13
M=D
@0
A=M
D=M
@13
A=M
M=D
@0
M=M-1
@16
D=A
@3
D=D+A
@13
M=D
@0
A=M
D=M
@13
A=M
M=D
@0
M=M-1
@16
D=A
@1
D=D+A
@13
M=D
@0
A=M
D=M
@13
A=M
M=D
@16
D=A
@3
A=D+A
D=M
@0
A=M
M=D
@0
M=M+1
@16
D=A
@1
A=D+A
D=M
@0
A=M
M=D
@0
M=M+1
@0
M=M-1
A=M
D=M
@0
M=M-1
A=M
D=M-D
M=D
@0
M=M+1
@16
D=A
@8
A=D+A
D=M
@0
A=M
M=D
@0
M=M+1
@0
M=M-1
A=M
D=M
@0
M=M-1
A=M
D=D+M
M=D
@0
M=M+1
(END)
@END
0;JMP |
/*------------------------------------------------------------------------------
Copyright © 2016 by Nicola Bombieri
Mangrove is provided under the terms of The MIT License (MIT):
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
------------------------------------------------------------------------------*/
/**
* @author Alessandro Danese
* Univerity of Verona, Dept. of Computer Science
* alessandro.danese@univr.it
*/
#include <iostream>
#include "Inference/Generator.hpp"
// binary Inference
#include "Inference/RecursiveMatchRanges.cuh"
// ternary inference
#include "Inference/RecursiveMatchRangesTernary.cuh"
using namespace std;
namespace mangrove
{
// /////////////////////////////////////////////////////////////////////////////
// specialization of the class Generator for the BOOLEAN variables
// /////////////////////////////////////////////////////////////////////////////
Generator<numeric_t>::Generator(int vars)
: GeneratorGuide(vars),
_forwardDirection(true) {
// ntd
}
Generator<numeric_t>::~Generator() {
// ntd
}
void Generator<numeric_t>::setForwardDirection(bool direction) {
_forwardDirection = direction;
}
#ifndef NUMERIC_INFERENCE
template <>
int Generator<numeric_t>::generator<2>(ResultCollector<numeric_t> &results) {
num2_t* unaryResult = static_cast<num2_t*>(
results.getVectorResult<1>());
// index of the dictionary array
int index = 0;
for (int first = 0; first < _vars; ++first) {
#ifdef NOCONSTANT
if (unaryResult[first][0] == unaryResult[first][1]) continue;
#endif
for (int second = first + 1; second < _vars; ++second) {
#ifdef NOCONSTANT
if (unaryResult[second][0] == unaryResult[second][1]) continue;
#endif
if (_forwardDirection) {
dictionary[index] = static_cast<entry_t>(first);
dictionary[index + 1] = static_cast<entry_t>(second);
}
else {
dictionary[halfNumericDictionary + index] = static_cast<entry_t>(second);
dictionary[halfNumericDictionary + index + 1] = static_cast<entry_t>(first);
}
index = index + 2;
}
}
return index / 2;
}
template <>
int Generator<numeric_t>::generator<3>(ResultCollector<numeric_t> & results) {
num2_t* unaryResult = static_cast<num2_t*>(
results.getVectorResult<1>());
// index of the dictionary array
int index = 0;
// iterator for the variable left
for (int left = 0; left < _vars; ++left) {
#ifdef NOCONSTANT
if (unaryResult[left][0] == unaryResult[left][1]) continue;
#endif
// iterator for the variable right_1
for (int right_1 = 0; right_1 < _vars; ++right_1) {
if (right_1 == left) continue;
#ifdef NOCONSTANT
if (unaryResult[right_1][0] == unaryResult[right_1][1]) continue;
#endif
// iterator for the variable right_2
for (int right_2 = right_1 + 1; right_2 < _vars; ++right_2) {
if (right_2 == left) continue;
#ifdef NOCONSTANT
if (unaryResult[right_2][0] == unaryResult[right_2][1]) continue;
#endif
// A op f(b,c)
dictionary[index++] = static_cast<entry_t>(left);
dictionary[index++] = static_cast<entry_t>(right_1);
dictionary[index++] = static_cast<entry_t>(right_2);
// A op f(c,b)
dictionary[index++] = static_cast<entry_t>(left);
dictionary[index++] = static_cast<entry_t>(right_2);
dictionary[index++] = static_cast<entry_t>(right_1);
}
}
}
return index / 3;
}
#else
// this function considers forwards and backwards
template <>
int Generator<numeric_t>::generator<2>(ResultCollector<numeric_t> & results) {
num2_t* unaryResult = static_cast<num2_t*>(
results.getVectorResult<1>());
results.setForwardDirection(true);
result_t *binaryResult = static_cast<result_t *>(results.getVectorResult<2>());
// index of the dictionary array
int index = 0;
// first op inv(second)
for (int first = 0; first < _vars; ++first) {
#ifdef NOCONSTANT
if (unaryResult[first][0] == unaryResult[first][1]) continue;
#endif
for (int second = first + 1; second < _vars; ++second) {
#ifdef NOCONSTANT
if (unaryResult[second][0] == unaryResult[second][1]) continue;
#endif
// FORWARD INFERENCE
//--------------------------------------------------------------
if (_forwardDirection &&
!RecursiveMatchRanges<NBtemplate::size>::ApplyT(results, first, second))
continue;
// BACKWARD INFERENCE
//--------------------------------------------------------------
int trip2two = results.getIndexFromTriplet2Pair(first, second);
int resultIndex = results.associativeArrayForBinaryResult[trip2two];
result_t result = binaryResult[resultIndex];
const result_t EQ_Idx = GET_POSITION<NBtemplate,
mangrove::equal>::value;
if (!_forwardDirection &&
( (result & EQ_Idx) ||
(!RecursiveMatchRanges<NBtemplate::size>::ApplyT(results, second, first)) )
) continue;
if (_forwardDirection) {
results.associativeArrayForBinaryResult[trip2two] = index / 2;
dictionary[index] = static_cast<entry_t>(first);
dictionary[index + 1] = static_cast<entry_t>(second);
}
else {
results.associativeArrayForBinaryResult[halfNumericResult + trip2two] = halfNumericResult + (index / 2);
dictionary[halfNumericDictionary + index] = static_cast<entry_t>(second);
dictionary[halfNumericDictionary + index + 1] = static_cast<entry_t>(first);
}
index = index + 2;
}
}
return index / 2;
}
template <>
int Generator<numeric_t>::generator<3>(ResultCollector<numeric_t> & results) {
num2_t* unaryResult = static_cast<num2_t*>(results.getVectorResult<1>());
int* ternaryCommutative = results.getTernaryCommutative();
int* equivalence_sets = results.getEquivalenceSets();
bool areAllCommutativeInvs = true;
for (int i = 0; i < NTtemplate::size; ++i)
areAllCommutativeInvs &= (ternaryCommutative[i] == CommutativeProperty::YES);
// index of the dictionary array
int index = 0;
// iterator for the variable left
for (int left = 0; left < _vars; ++left) {
#ifdef NOCONSTANT
if (unaryResult[left][0] == unaryResult[left][1]) continue;
#endif
// iterator for the variable right_1
for (int right_1 = 0; right_1 < _vars; ++right_1) {
if (right_1 == left) continue;
#ifdef NOCONSTANT
if (unaryResult[right_1][0] == unaryResult[right_1][1]) continue;
#endif
// iterator for the variable right_2
for (int right_2 = right_1 + 1; right_2 < _vars; ++right_2) {
if (right_2 == left) continue;
#ifdef NOCONSTANT
if (unaryResult[right_2][0] == unaryResult[right_2][1]) continue;
#endif
int left_p = equivalence_sets[left];
int right_1_p = equivalence_sets[right_1];
int right_2_p = equivalence_sets[right_2];
int indexAssoc = results.getTAindex(left_p, right_1_p, right_2_p);
if (results.ternaryAssociativeArray[indexAssoc] != -1) continue;
results.ternaryAssociativeArray[indexAssoc] = index / 3;
// A op f(b,c)?
if (RecursiveMatchRangesTernary<NTtemplate::size>::ApplyT(results, left, right_1, right_2))
{
dictionary[index++] = static_cast<entry_t>(left);
dictionary[index++] = static_cast<entry_t>(right_1);
dictionary[index++] = static_cast<entry_t>(right_2);
}
if (areAllCommutativeInvs) continue;
indexAssoc = results.getTAindex(left_p, right_2_p, right_1_p);
results.ternaryAssociativeArray[indexAssoc] = index / 3;
// A op f(c,b)?
if (RecursiveMatchRangesTernary<NTtemplate::size>::ApplyT(results, left, right_2, right_1))
{
dictionary[index++] = static_cast<entry_t>(left);
dictionary[index++] = static_cast<entry_t>(right_2);
dictionary[index++] = static_cast<entry_t>(right_1);
}
}
}
}
return index / 3;
}
#endif
}
|
format PE GUI
entry Start
macro GetFunc lib*,name* {
push name#$
push [lib]
call [w32GetProcAddress]
mov [name],eax
}
section '.text' code readable executable
CreateShader:
push ebx esi
push 0 ; hTemplateFile
push 0x00000080 ; dwFlagsAndAttributes = FILE_ATTRIBUTE_NORMAL
push 3 ; dwCreationAndDesposition = OPEN_EXISTING
push 0 ; lpSecurityAttributes
push 0 ; dwShareMode
push 0x80000000 ; dwDesiredAccess = GENERIC_READ
push ShaderFileName ; lpFileName
call [w32CreateFile]
cmp eax,0xFFFFFFFF
je .skip
mov ebx,eax ; ebx = fileHandle
push 0 ; lpFileHighSize
push ebx ; hFile = fileHandle
call [w32GetFileSize]
mov esi,eax ; esi = fileSize
push 0 ; lpOverlapped
push BytesRead ; lpNumberOfBytesRead
push esi ; nNumberOfBytesToRead = fileSize
push [ShaderCode] ; lpBuffer
push ebx ; hFile = fileHandle
call [w32ReadFile]
push ebx ; fileHandle
call [w32CloseHandle]
push 20
call [w32Sleep]
mov eax,[ShaderCode]
mov byte [eax+esi],0 ; store 0 to mark end of string
push [Shader]
call [glDeleteProgram] ; delete old shader
push 0
call [glUseProgram]
push ShaderCode ; pointer to pointer of shader code
push 1 ; number of source strings
push 0x8B30 ; GL_FRAGMENT_SHADER
call [glCreateShaderProgramv]
mov [Shader],eax
push [Shader] ; GL program to use
call [glUseProgram]
.skip: pop esi ebx
ret
Main: push 0x04 ; flProtect = PAGE_READWRITE
push 0x00003000 ; flAllocationType = MEM_COMMIT|MEM_RESERVE
push 64*1024 ; dwSize = 64KB
push 0 ; lpAddress
call [w32VirtualAlloc]
mov [ShaderCode],eax
push 0 ; lpParam
push 0 ; hInstance
push 0 ; hMenu
push 0 ; hWndParent
push 720 ; nHeight
push 1280 ; nWidth
push 41 ; y
push 0 ; x
push 0x90000000 ; dwStyle = WS_POPUP|WS_VISIBLE
push 0 ; lpWindowName
push WinClassName ; lpClassName
push 0x00000008 ; dwExStyle = WS_EX_TOPMOST
call [w32CreateWindowEx]
push eax ; hwnd
call [w32GetDC]
mov ebx,eax ; ebx = hdc
push PixelFormatDesc
push ebx ; hdc
call [w32ChoosePixelFormat]
push PixelFormatDesc
push eax ; pixel format id
push ebx ; hdc
call [w32SetPixelFormat]
push ebx ; hdc
call [wglCreateContext]
push eax ; GL context
push ebx ; hdc
call [wglMakeCurrent]
push glUseProgram$
call [wglGetProcAddress]
mov [glUseProgram],eax
push glCreateShaderProgramv$
call [wglGetProcAddress]
mov [glCreateShaderProgramv],eax
push glDeleteProgram$
call [wglGetProcAddress]
mov [glDeleteProgram],eax
call CreateShader
push 1 ; ask for 1 ms timer resolution
call [w32timeBeginPeriod]
call [w32timeGetTime]
mov edi,eax ; edi = beginTime
.mainLoop:
push 0x0001 ; PM_REMOVE
push 0
push 0
push 0
push Message
call [w32PeekMessage]
push 'S'
call [w32GetAsyncKeyState]
push eax
push 0x11 ; VK_CONTROL
call [w32GetAsyncKeyState]
pop ecx
and eax,0x8000
and ecx,0x8000
and eax,ecx
jz .1
call CreateShader
.1: call [w32timeGetTime]
sub eax,edi ; currentTime = time - beginTime
push eax
fild dword [esp]
fstp dword [esp]
call [glTexCoord1f]
push 1
push 1
push -1
push -1
call [glRecti]
push ebx ; hdc
call [w32SwapBuffers]
push 'Q'
call [w32GetAsyncKeyState]
push eax
push 0x11 ; VK_CONTROL
call [w32GetAsyncKeyState]
pop ecx
and eax,0x8000
and ecx,0x8000
and eax,ecx
jnz .exit
jmp .mainLoop
.exit: ret
Start: push Kernel32$
call [w32LoadLibrary]
mov [Kernel32],eax
push User32$
call [w32LoadLibrary]
mov [User32],eax
push Gdi32$
call [w32LoadLibrary]
mov [Gdi32],eax
push OpenGL32$
call [w32LoadLibrary]
mov [OpenGL32],eax
push WinMM$
call [w32LoadLibrary]
mov [WinMM],eax
push w32ExitProcess$
push Kernel32
call [w32GetProcAddress]
GetFunc Kernel32,w32ExitProcess
GetFunc Kernel32,w32VirtualAlloc
GetFunc Kernel32,w32Sleep
GetFunc Kernel32,w32CreateFile
GetFunc Kernel32,w32ReadFile
GetFunc Kernel32,w32GetFileSize
GetFunc Kernel32,w32CloseHandle
GetFunc User32,w32GetAsyncKeyState
GetFunc User32,w32CreateWindowEx
GetFunc User32,w32GetDC
GetFunc User32,w32PeekMessage
GetFunc User32,w32DispatchMessage
GetFunc User32,w32SetProcessDPIAware
GetFunc Gdi32,w32SwapBuffers
GetFunc Gdi32,w32SetPixelFormat
GetFunc Gdi32,w32ChoosePixelFormat
GetFunc WinMM,w32timeGetTime
GetFunc WinMM,w32timeBeginPeriod
GetFunc OpenGL32,wglGetProcAddress
GetFunc OpenGL32,wglMakeCurrent
GetFunc OpenGL32,wglCreateContext
GetFunc OpenGL32,glTexCoord1f
GetFunc OpenGL32,glRecti
call [w32SetProcessDPIAware]
call Main
push 0
call [w32ExitProcess]
ret
section '.data' data readable writeable
Shader dd 0
ShaderCode dd 0
BytesRead:
Message:
PixelFormatDesc:
dd 0
dd 0x00000021 ; PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER
db 32 dup 0
Kernel32 dd 0
User32 dd 0
Gdi32 dd 0
OpenGL32 dd 0
WinMM dd 0
w32ExitProcess dd 0
w32VirtualAlloc dd 0
w32Sleep dd 0
w32CreateFile dd 0
w32ReadFile dd 0
w32GetFileSize dd 0
w32CloseHandle dd 0
w32CreateWindowEx dd 0
w32GetDC dd 0
w32ChoosePixelFormat dd 0
w32SetPixelFormat dd 0
w32timeGetTime dd 0
w32timeBeginPeriod dd 0
w32PeekMessage dd 0
w32DispatchMessage dd 0
w32SwapBuffers dd 0
w32GetAsyncKeyState dd 0
w32SetProcessDPIAware dd 0
wglGetProcAddress dd 0
wglMakeCurrent dd 0
wglCreateContext dd 0
glUseProgram dd 0
glCreateShaderProgramv dd 0
glDeleteProgram dd 0
glTexCoord1f dd 0
glRecti dd 0
WinClassName db 'static',0
ShaderFileName db 'ShaderV.c',0
Kernel32$ db 'Kernel32.dll',0
User32$ db 'User32.dll',0
Gdi32$ db 'Gdi32.dll',0
OpenGL32$ db 'OpenGL32.dll',0
WinMM$ db 'WinMM.dll',0
w32ExitProcess$ db 'ExitProcess',0
w32VirtualAlloc$ db 'VirtualAlloc',0
w32Sleep$ db 'Sleep',0
w32CreateFile$ db 'CreateFileA',0
w32ReadFile$ db 'ReadFile',0
w32GetFileSize$ db 'GetFileSize',0
w32CloseHandle$ db 'CloseHandle',0
w32CreateWindowEx$ db 'CreateWindowExA',0
w32GetDC$ db 'GetDC',0
w32ChoosePixelFormat$ db 'ChoosePixelFormat',0
w32SetPixelFormat$ db 'SetPixelFormat',0
w32timeGetTime$ db 'timeGetTime',0
w32timeBeginPeriod$ db 'timeBeginPeriod',0
w32PeekMessage$ db 'PeekMessageA',0
w32DispatchMessage$ db 'DispatchMessageA',0
w32SetProcessDPIAware$ db 'SetProcessDPIAware',0
w32SwapBuffers$ db 'SwapBuffers',0
w32GetAsyncKeyState$ db 'GetAsyncKeyState',0
wglCreateContext$ db 'wglCreateContext',0
wglMakeCurrent$ db 'wglMakeCurrent',0
wglGetProcAddress$ db 'wglGetProcAddress',0
glUseProgram$ db 'glUseProgram',0
glCreateShaderProgramv$ db 'glCreateShaderProgramv',0
glDeleteProgram$ db 'glDeleteProgram',0
glTexCoord1f$ db 'glTexCoord1f',0
glRecti$ db 'glRecti',0
section '.idata' import data readable writeable
dd 0,0,0
dd rva Kernel32$
dd rva w32LoadLibrary
dd 0,0,0,0,0
w32LoadLibrary dd rva LoadLibrary$
w32GetProcAddress dd rva GetProcAddress$
dd 0
LoadLibrary$ dw 0
db 'LoadLibraryA',0
GetProcAddress$ dw 0
db 'GetProcAddress',0
section '.reloc' fixups data readable discardable
|
; ************************************************************************************************
; ************************************************************************************************
;
; Name: vramprocess.asm
; Purpose: Load VRAM format data
; Created: 13th March 2021
; Reviewed: 27th April 2021
; Author: Paul Robson (paul@robsons.org.uk)
;
; ************************************************************************************************
; ************************************************************************************************
.section storage
compressMode:
.fill 1
imageInfo: ; image info (the first byte) for sprites
.fill X16MaxImages
imageAddr32Low: ; image VRAM address divided by 32
.fill X16MaxImages
imageAddr32High:
.fill X16MaxImages
.send storage
.section code
; ************************************************************************************************
;
; Load VRAM Data from temp0
;
; ************************************************************************************************
LoadVRAMFile:
.pshx
.pshy
;
; VRAM Load loop. Defaults removed so VRAM files can be split up arbitrarily.
;
_LVRLoop:
jsr LVFGet ; get the next (never access direct)
cmp #$80 ; exit ?
beq _LVRExit
bcs _LVRLoad ; load data in ?
cmp #$08 ; is it set address ?
bcc _LVRSetAddress
cmp #$0F ; is it define palette
beq _LVRSetPalette
cmp #$10 ; is it set compression type ?
bcc _LVRSetCompress
cmp #$64 ; is it set sprite type.
bcc _LVRSetSprite
.throw missing
;
; Set address
;
_LVRSetAddress:
sta temp1+1 ; 24 bit in temp1+1/temp1/A
jsr LVFGet
sta temp1
lda #0
;
lsr temp1+1 ; / 2 twice.
ror temp1
ror a
lsr temp1+1
ror temp1
ror a
;
sta X16VeraAddLow ; set write address with +1 increment
lda temp1
sta X16VeraAddMed
lda temp1+1
ora #$10
sta X16VeraAddHigh
bne _LVRLoop
;
; Set compression to low 3 bits of A
;
_LVRSetCompress:
and #7
sta compressMode
bpl _LVRLoop
;
; End decoding
;
_LVRExit:
.puly
.pulx
rts
;
; Set palette
;
_LVRSetPalette:
jsr LVFGet ; get palette id.
jsr PointToPaletteA ; in palette.asm
;
jsr LVFGet ; copy 12 bit palette data in.
sta X16VeraData0 ; and send to Vera
jsr LVFGet
and #$0F
sta X16VeraData0
jmp _LVRLoop
;
; Load data in, which may or may not be compressed.
;
_LVRLoad:
ldx compressMode
bne _LVRNotMode0
;
; Mode 0 :Load A & 7F bytes of data in , uncompressed
;
and #$7F ; count in X (is > 0)
_LVRLCopyX:
tax
_LVRLCopy:
jsr LVFGet ; write to data.
sta X16VeraData0
dex
bne _LVRLCopy
jmp _LVRLoop
;
; Set sprite to current address
;
_LVRSetSprite:
pha ; save on stack
jsr LVFGet ; get the sprite number into X
tax
cmp #X16MaxImages ; too high ?
bcs _LVRSSValue
pla ; restore the data held in the first byte
sta imageInfo,x ; and write into the sprite image table.
_LVRAlignVRAM:
lda X16VeraAddLow ; check VRAM on 32 byte boundary
and #$1F ; sprite image addresses are limited to this.
beq _LVRAligned
lda #$00
sta X16VeraData0
beq _LVRAlignVRAM
;
; Now aligned correctly, copy the address in the table converting from 17 bits
; to 12, which is the Vera internal format.
;
_LVRAligned:
lda X16VeraAddHigh ; put address/32 in sprite image table
lsr a ; first halve into temp1
lda X16VeraAddMed
ror a
sta temp1+1
lda X16VeraAddLow
ror a
sta temp1
;
ldy #4 ; divide it by 16 in temp1
_LVRShift:
lsr temp1+1
ror temp1
dey
bne _LVRShift
;
lda temp1+1 ; copy result.
sta imageAddr32High,x
lda temp1
sta imageAddr32Low,x
jmp _LVRLoop
_LVRSSValue:
.throw BadValue
;
; Mode 1 : Simple RLE compression.
;
_LVRNotMode0:
cpx #1
bne _LVRNotMode1
;
; Mode 1 : A & $3F elements of data, could be uncompressed (00-3F) or
; compressed (00-3F) see vram.txt
;
and #$7F ; drop bit 7
cmp #$40
bcc _LVRLCopyX ; 00-3F use mode 0's copying code.
_LVRRLEGroup:
and #$3F ; the number of copies of the following byte.
tax
jsr LVFGet ; get the byte to copy
_LVRLEGroupLoop:
sta X16VeraData0 ; write it out X times
dex
bne _LVRLEGroupLoop
jmp _LVRLoop
_LVRNotMode1:
.debug
jmp _LVRNotMode1
; ************************************************************************************************
;
; Read one byte from VRAM source. This MUST go through here, so we can use
; Paged RAM if required. temp0 points to the VRAM.
;
; ************************************************************************************************
LVFGet: sty tempShort
ldy #0
lda (temp0),y
ldy tempShort
inc temp0
bne _LVFGExit
inc temp0+1
_LVFGExit:
rts
.send code
|
## Alunos:
## Amadeus Dabela - 1621101005
## Mateus Koppe - 1821101023
.globl main
.data
msg_menu_header: .string "\n -- List manager --\n"
msg_menu_insert: .string "\t [1] Insert value\n"
msg_menu_remove_value: .string "\t [2] Remove by value\n"
msg_menu_remove_index: .string "\t [3] Remove by index\n"
msg_menu_list: .string "\t [4] List values\n"
msg_menu_exit: .string "\t [0] Exit\n"
breakln: .string "\n"
space: .string " "
msg_menu_created_item_index: .string "\ncreated in index:"
msg_menu_removed_item_index: .string "\nremoved in index:"
msg_menu_removed_item_value: .string "\nremoved in value:"
msg_number_inserted: .string "\nnumber of items inserted:"
msg_number_removed: .string "\nnumber of items removed:"
.text
main:
nop
add s0, zero, sp # pointer to head of the linked list
li t0, 0
sw t0 0(sp)
sw t0 -4(sp) ## Inserted items
sw t0 -8(sp) ## Removed items
addi sp, sp, -12
menu:
la a0, msg_menu_header
jal print_str
la a0, msg_menu_insert
jal print_str
la a0, msg_menu_remove_value
jal print_str
la a0, msg_menu_remove_index
jal print_str
la a0, msg_menu_list
jal print_str
la a0, msg_menu_exit
jal print_str
jal read_int
li t0, 1
beq a0, t0, menu_insert
li t0, 2
beq a0, t0, menu_remove_value
li t0, 3
beq a0, t0, menu_remove_index
li t0, 4
beq a0, t0, menu_print_list
li t0, 0
beq a0, t0, menu_exit
j menu
#
# Menu methods
#
menu_insert:
jal read_int
add a1 zero a0
add a0 zero s0
jal lkdlist_insert
add t0 zero a0
la a0, msg_menu_created_item_index
jal print_str
add a0 zero t0
jal print_int
j menu
menu_remove_value:
jal read_int
add a1 zero a0
add a0 zero s0
jal lkdlist_remove_value
add t0 zero a0
la a0, msg_menu_removed_item_index
jal print_str
add a0 zero t0
jal print_int
j menu
menu_remove_index:
jal read_int
add a1 zero a0
add a0 zero s0
jal lkdlist_remove_index
add t0 zero a0
la a0, msg_menu_removed_item_value
jal print_str
add a0 zero t0
jal print_int
j menu
menu_print_list:
add a0 zero s0
jal lkdlist_print
j menu
menu_exit:
la a0, msg_number_inserted
jal print_str
lw a0, -4(s0)
jal print_int
la a0, msg_number_removed
jal print_str
lw a0, -8(s0)
jal print_int
jal print_break_line
li a7, 10
ecall
#
# Linked List Functions
#
## Insert
# Receives:
# - a0 -> linked list
# - a1 -> value to insert
#
# Returns:
# - a0 -> added items index
lkdlist_insert:
li t4 0
lw t0, 0(a0)
beqz t0, _lkdlist_insert_head
lw t1, 0(t0)
blt a1, t1, _lkdlist_insert_head
j _lkdlist_insert_loop
_lkdlist_insert_head:
lw t1, 0(a0)
sw a1, 0(sp)
sw t1, -4(sp)
sw sp 0(a0)
addi sp, sp, -8
lw t0 -4(a0)
addi t0, t0, 1
sw t0 -4(a0)
add a0 zero t4
ret
_lkdlist_insert_loop:
addi t4 t4 1
lw t1, -4(t0)
beqz t1, _lkdlist_insert_node
lw t2, -0(t1)
blt a1, t2, _lkdlist_insert_node
add t0, zero, t1
j _lkdlist_insert_loop
_lkdlist_insert_node:
lw t1, -4(t0)
sw a1, 0(sp)
sw t1, -4(sp)
sw sp, -4(t0)
addi sp, sp, -8
lw t0 -4(a0)
addi t0, t0, 1
sw t0 -4(a0)
add a0 zero t4
ret
## Print
# Receives:
# - a0 -> linked list
lkdlist_print:
lw t0, 0(a0)
add t6, zero, ra # Save return address
_lkdlist_print_loop:
beqz t0, _lkdlist_print_finish
lw a0, 0(t0)
jal print_int
jal print_space
lw t0, -4(t0)
j _lkdlist_print_loop
_lkdlist_print_finish:
add ra, zero, t6
ret
## Remove by value
# Receives:
# - a0 -> linked list
# - a1 -> value to remove
#
# Returns:
# - a0 -> removed index
lkdlist_remove_value:
li t4, 0
lw t0, 0(a0)
beqz t0, _lkdlist_remove_value_return
lw t1, 0(t0)
bne t1, a1, _lkdlist_remove_value_loop
lw t1, -4(t0)
sw t1, 0(a0)
lw t0 -8(a0)
addi t0, t0, 1
sw t0 -8(a0)
add a0, zero, t4
ret
_lkdlist_remove_value_loop:
addi t4, t4, 1
lw t1, -4(t0) # Get next node
beqz t1, _lkdlist_remove_value_return # if node is zero go back to menu
lw t2, 0(t1)
bne t2, a1, _lkdlist_remove_value_loop_next # If diferent next iteration
lw t3, -4(t1)
sw t3, -4(t0)
lw t0 -8(a0)
addi t0, t0, 1
sw t0 -8(a0)
add a0, zero, t4
ret
_lkdlist_remove_value_loop_next:
add t0, zero, t1
j _lkdlist_remove_value_loop
_lkdlist_remove_value_return:
addi a0, zero, -1
ret
## Remove by index
# Receives:
# - a0 -> linked list
# - a1 -> index to remove
#
# Returns:
# - a0 -> removed value
lkdlist_remove_index:
li t4, 0
_lkdlist_remove_index_start:
lw t0 0(a0)
beqz t0, _lkdlist_remove_index_return
bne t4, a1, _lkdlist_remove_index_loop
lw t3 0(t0)
lw t1, -4(t0)
sw t1, 0(a0)
lw t0 -8(a0)
addi t0, t0, 1
sw t0 -8(a0)
add a0 zero t3
ret
_lkdlist_remove_index_loop:
lw t1, -4(t0) # Get next node
beqz t1, _lkdlist_remove_index_return # if not found go back to menu
addi t4, t4, 1
bne t4, a1, _lkdlist_remove_index_loop_next # If diferent next iteration
lw t3 0(t1)
lw t2, -4(t1)
sw t2, -4(t0)
lw t0 -8(a0)
addi t0, t0, 1
sw t0 -8(a0)
add a0 zero t3
ret
_lkdlist_remove_index_loop_next:
add t0, zero, t1
j _lkdlist_remove_index_loop
_lkdlist_remove_index_return:
addi a0 zero -1
ret
###############################
# Helpers Section #
###############################
read_int: # label to read input from the user to a0
li a7, 5
ecall
ret
print_str: # auxiliary function to print string loaded to a0
li a7, 4
ecall
ret
print_break_line:
la a0, breakln
li a7, 4
ecall
ret
print_space:
la a0, space
li a7, 4
ecall
ret
print_int:
li a7, 1
ecall
ret
|
#include <iostream>
using namespace std;
int main(int argc, char const *argv[])
{
int num,a[100],sum=0,c;
cout << "Enter the no. of numbers you want to add";
cin >> num;
cout << "Enter the numbers";
for( c=1;c<=num;c++ )
{
cin >> a[c];
sum=sum+a[c];
}
cout << "Sum is"<<sum;
return 0;
} |
offsets:
dd 0x0000d134, 0x0000d137, 0x0000d13d, 0x0000d140, 0x0000d146, 0x0000d148
dd 0x0000d14f, 0x0000d152, 0x0000d158, 0x0000d15b, 0x0000d498, 0x0000d49f
dd 0x0000d4a6, 0x0000d4ad, 0x0000d4b4, 0x0000d4bb, 0x0000d4be, 0x0000d4c4
dd 0x0000d4cb, 0x0000d4ce, 0x0000d4d4, 0x000a3e18, 0x000a3e1f, 0x000ae729
dd 0x000ae738, 0x000ae750, 0x000ae755, 0x000ae773, 0x000ae778, 0x000ae783
dd 0x000ae78c, 0x000ae795, 0x000ae79c, 0x000b5753, 0x0014a2f4, 0x00202f68
offsets_end equ $
lengths:
db 0x01, 0x02, 0x01, 0x03, 0x01, 0x04, 0x01, 0x03, 0x01, 0x03, 0x01, 0x01
db 0x01, 0x01, 0x01, 0x01, 0x03, 0x01, 0x01, 0x03, 0x01, 0x06, 0x02, 0x0d
db 0x17, 0x04, 0x1d, 0x04, 0x0a, 0x08, 0x08, 0x06, 0x19, 0x01, 0x0b, 0x01
orig_data:
db 0x2f, 0xe3, 0x05, 0x43, 0xe5, 0x05, 0x0b, 0x57, 0x02, 0xe1, 0x05, 0x0b
db 0x6b, 0xe7, 0x05, 0x0b, 0x7f, 0xc0, 0x46, 0x0c, 0x34, 0x48, 0x5c, 0x70
db 0x84, 0x93, 0x3a, 0x03, 0x05, 0x98, 0xa7, 0x36, 0x03, 0x05, 0xac, 0x81
db 0xec, 0x00, 0x00, 0x00, 0x00, 0x35, 0x57, 0x66, 0xba, 0x0a, 0x00, 0x66
db 0xa1, 0xe3, 0x05, 0x0b, 0x00, 0xbe, 0xe0, 0xac, 0xe8, 0xf6, 0x02, 0x00
db 0x00, 0x66, 0xba, 0x14, 0x00, 0x66, 0xa1, 0xe5, 0x05, 0x0b, 0x00, 0xbe
db 0xe0, 0xac, 0x00, 0x00, 0xe8, 0xe2, 0x02, 0x00, 0x66, 0xba, 0x1e, 0x66
db 0xa1, 0xe1, 0x05, 0x0b, 0x00, 0xbe, 0xe0, 0xac, 0x00, 0x00, 0xe8, 0xce
db 0x02, 0x00, 0x00, 0x66, 0xba, 0x28, 0x00, 0x66, 0xa1, 0xe7, 0x05, 0x0b
db 0x00, 0xbe, 0xe0, 0xac, 0x00, 0xe8, 0xba, 0x02, 0x00, 0x66, 0xba, 0x32
db 0x00, 0x66, 0xa1, 0xc0, 0x46, 0x0c, 0xbe, 0xe0, 0xac, 0x00, 0x00, 0xe8
db 0xa6, 0x02, 0x00, 0x66, 0xba, 0x3c, 0x00, 0x66, 0xa1, 0x3a, 0x05, 0x00
db 0xbe, 0xe0, 0xac, 0x00, 0xe8, 0x92, 0x02, 0x00, 0x00, 0x66, 0xba, 0x46
db 0x00, 0x66, 0xa1, 0x36, 0x03, 0x05, 0x00, 0xbe, 0xe0, 0xac, 0x00, 0x00
db 0xe8, 0x7e, 0x02, 0x00, 0x00, 0x01, 0x53, 0x41, 0x56, 0x45, 0x20, 0x44
db 0x49, 0x53, 0x4b, 0x20, 0x46, 0x01
patch_data:
db 0x2d, 0xeb, 0x16, 0x34, 0x00, 0x00, 0x00, 0x82, 0x01, 0x00, 0x00, 0x00
db 0x92, 0x91, 0x14, 0x03, 0x98, 0x8d, 0x14, 0x03, 0xc0, 0xc0, 0xc0, 0xc0
db 0xc0, 0x9e, 0x71, 0x14, 0x03, 0xc0, 0xa4, 0x6d, 0x14, 0x03, 0xc0, 0x90
db 0x90, 0x90, 0x90, 0x90, 0x90, 0x06, 0xa9, 0x90, 0x90, 0x89, 0x25, 0xeb
db 0x16, 0x0b, 0x00, 0x9c, 0x60, 0xbb, 0x00, 0x00, 0xff, 0xb3, 0x6d, 0x14
db 0x03, 0x00, 0xff, 0xb3, 0x71, 0x14, 0x03, 0x00, 0xff, 0xb3, 0x8d, 0x14
db 0x03, 0x00, 0xff, 0xb3, 0x91, 0x14, 0x03, 0x8d, 0x83, 0xf4, 0x54, 0x00
db 0x89, 0x83, 0x8d, 0x14, 0x03, 0x00, 0x8d, 0x83, 0x5e, 0x53, 0x05, 0x00
db 0x89, 0x83, 0x91, 0x14, 0x03, 0x00, 0xe8, 0x3b, 0xf8, 0xff, 0xff, 0x8b
db 0x83, 0x71, 0x14, 0x03, 0x3d, 0x32, 0x00, 0x01, 0x76, 0x03, 0xcc, 0xeb
db 0xfd, 0x8b, 0xcb, 0x8b, 0xc3, 0xbb, 0x00, 0x00, 0x00, 0x81, 0xc1, 0x5e
db 0x53, 0x05, 0x90, 0x90, 0xff, 0xd1, 0x8f, 0x05, 0x91, 0x14, 0x00, 0x8f
db 0x05, 0x8d, 0x14, 0x03, 0x8f, 0x05, 0x71, 0x14, 0x03, 0x00, 0x8f, 0x05
db 0x6d, 0x14, 0x03, 0x00, 0x61, 0x9d, 0x90, 0x90, 0xe9, 0xa7, 0xad, 0xff
db 0xff, 0xc3, 0xc3, 0xc3, 0xc3, 0x00, 0x4c, 0x4f, 0x41, 0x44, 0x45, 0x52
db 0x2e, 0x42, 0x49, 0x4e, 0x00, 0x00 |
; A017234: a(n) = (9*n + 6)^2.
; 36,225,576,1089,1764,2601,3600,4761,6084,7569,9216,11025,12996,15129,17424,19881,22500,25281,28224,31329,34596,38025,41616,45369,49284,53361,57600,62001,66564,71289,76176,81225,86436,91809,97344,103041,108900,114921,121104,127449,133956,140625,147456,154449,161604,168921,176400,184041,191844,199809,207936,216225,224676,233289,242064,251001,260100,269361,278784,288369,298116,308025,318096,328329,338724,349281,360000,370881,381924,393129,404496,416025,427716,439569,451584,463761,476100,488601
mul $0,9
add $0,6
pow $0,2
|
; A077651: Initial digit of phi(n), where phi is Euler totient function, A000010.
; 1,1,2,2,4,2,6,4,6,4,1,4,1,6,8,8,1,6,1,8,1,1,2,8,2,1,1,1,2,8,3,1,2,1,2,1,3,1,2,1,4,1,4,2,2,2,4,1,4,2,3,2,5,1,4,2,3,2,5,1,6,3,3,3,4,2,6,3,4,2,7,2,7,3,4,3,6,2,7,3,5,4,8,2,6,4,5,4,8,2,7,4,6,4,7,3,9,4,6,4
seq $0,10 ; Euler totient function phi(n): count numbers <= n and prime to n.
lpb $0
mov $1,$0
div $0,10
lpe
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.
;; ==++==
;;
;;
;; ==--==
#include "ksarm.h"
#include "asmconstants.h"
#include "asmmacros.h"
IMPORT JIT_InternalThrow
IMPORT JIT_WriteBarrier
IMPORT TheUMEntryPrestubWorker
IMPORT PreStubWorker
IMPORT PreStubGetMethodDescForCompactEntryPoint
IMPORT NDirectImportWorker
IMPORT VSD_ResolveWorker
#ifdef WRITE_BARRIER_CHECK
SETALIAS g_GCShadow, ?g_GCShadow@@3PAEA
SETALIAS g_GCShadowEnd, ?g_GCShadowEnd@@3PAEA
IMPORT g_lowest_address
IMPORT $g_GCShadow
IMPORT $g_GCShadowEnd
#endif // WRITE_BARRIER_CHECK
#ifdef FEATURE_COMINTEROP
IMPORT CLRToCOMWorker
IMPORT ComPreStubWorker
IMPORT COMToCLRWorker
#endif
IMPORT CallDescrWorkerUnwindFrameChainHandler
IMPORT UMEntryPrestubUnwindFrameChainHandler
#ifdef FEATURE_COMINTEROP
IMPORT ReverseComUnwindFrameChainHandler
#endif
#ifdef FEATURE_HIJACK
IMPORT OnHijackWorker
#endif ;FEATURE_HIJACK
IMPORT GetCurrentSavedRedirectContext
;; Import to support cross-moodule external method invocation in ngen images
IMPORT ExternalMethodFixupWorker
#ifdef FEATURE_PREJIT
;; Imports to support virtual import fixup for ngen images
IMPORT VirtualMethodFixupWorker
IMPORT StubDispatchFixupWorker
#endif
#ifdef FEATURE_READYTORUN
IMPORT DynamicHelperWorker
#endif
IMPORT JIT_RareDisableHelperWorker
;; Imports for singleDomain statics helpers
IMPORT JIT_GetSharedNonGCStaticBase_Helper
IMPORT JIT_GetSharedGCStaticBase_Helper
TEXTAREA
;; LPVOID __stdcall GetCurrentIP(void);
LEAF_ENTRY GetCurrentIP
mov r0, lr
bx lr
LEAF_END
;; LPVOID __stdcall GetCurrentSP(void);
LEAF_ENTRY GetCurrentSP
mov r0, sp
bx lr
LEAF_END
;;-----------------------------------------------------------------------------
;; This helper routine enregisters the appropriate arguments and makes the
;; actual call.
;;-----------------------------------------------------------------------------
;;void CallDescrWorkerInternal(CallDescrData * pCallDescrData);
NESTED_ENTRY CallDescrWorkerInternal,,CallDescrWorkerUnwindFrameChainHandler
PROLOG_PUSH {r4,r5,r7,lr}
PROLOG_STACK_SAVE r7
mov r5,r0 ; save pCallDescrData in r5
ldr r1, [r5,#CallDescrData__numStackSlots]
cbz r1, Ldonestack
;; Add frame padding to ensure frame size is a multiple of 8 (a requirement of the OS ABI).
;; We push four registers (above) and numStackSlots arguments (below). If this comes to an odd number
;; of slots we must pad with another. This simplifies to "if the low bit of numStackSlots is set,
;; extend the stack another four bytes".
lsls r2, r1, #2
and r3, r2, #4
sub sp, sp, r3
;; This loop copies numStackSlots words
;; from [pSrcEnd-4,pSrcEnd-8,...] to [sp-4,sp-8,...]
ldr r0, [r5,#CallDescrData__pSrc]
add r0,r0,r2
Lstackloop
ldr r2, [r0,#-4]!
str r2, [sp,#-4]!
subs r1, r1, #1
bne Lstackloop
Ldonestack
;; If FP arguments are supplied in registers (r3 != NULL) then initialize all of them from the pointer
;; given in r3. Do not use "it" since it faults in floating point even when the instruction is not executed.
ldr r3, [r5,#CallDescrData__pFloatArgumentRegisters]
cbz r3, LNoFloatingPoint
vldm r3, {s0-s15}
LNoFloatingPoint
;; Copy [pArgumentRegisters, ..., pArgumentRegisters + 12]
;; into r0, ..., r3
ldr r4, [r5,#CallDescrData__pArgumentRegisters]
ldm r4, {r0-r3}
CHECK_STACK_ALIGNMENT
;; call pTarget
;; Note that remoting expect target in r4.
ldr r4, [r5,#CallDescrData__pTarget]
blx r4
ldr r3, [r5,#CallDescrData__fpReturnSize]
;; Save FP return value if appropriate
cbz r3, LFloatingPointReturnDone
;; Float return case
;; Do not use "it" since it faults in floating point even when the instruction is not executed.
cmp r3, #4
bne LNoFloatReturn
vmov r0, s0
b LFloatingPointReturnDone
LNoFloatReturn
;; Double return case
;; Do not use "it" since it faults in floating point even when the instruction is not executed.
cmp r3, #8
bne LNoDoubleReturn
vmov r0, r1, s0, s1
b LFloatingPointReturnDone
LNoDoubleReturn
add r2, r5, #CallDescrData__returnValue
cmp r3, #16
bne LNoFloatHFAReturn
vstm r2, {s0-s3}
b LReturnDone
LNoFloatHFAReturn
cmp r3, #32
bne LNoDoubleHFAReturn
vstm r2, {d0-d3}
b LReturnDone
LNoDoubleHFAReturn
EMIT_BREAKPOINT ; Unreachable
LFloatingPointReturnDone
;; Save return value into retbuf
str r0, [r5, #(CallDescrData__returnValue + 0)]
str r1, [r5, #(CallDescrData__returnValue + 4)]
LReturnDone
#ifdef _DEBUG
;; trash the floating point registers to ensure that the HFA return values
;; won't survive by accident
vldm sp, {d0-d3}
#endif
EPILOG_STACK_RESTORE r7
EPILOG_POP {r4,r5,r7,pc}
NESTED_END
; ------------------------------------------------------------------
; void LazyMachStateCaptureState(struct LazyMachState *pState);
LEAF_ENTRY LazyMachStateCaptureState
;; marks that this is not yet valid
mov r1, #0
str r1, [r0, #MachState__isValid]
str lr, [r0, #LazyMachState_captureIp]
str sp, [r0, #LazyMachState_captureSp]
add r1, r0, #LazyMachState_captureR4_R11
stm r1, {r4-r11}
mov pc, lr
LEAF_END
; void SinglecastDelegateInvokeStub(Delegate *pThis)
LEAF_ENTRY SinglecastDelegateInvokeStub
cmp r0, #0
beq LNullThis
ldr r12, [r0, #DelegateObject___methodPtr]
ldr r0, [r0, #DelegateObject___target]
bx r12
LNullThis
mov r0, #CORINFO_NullReferenceException_ASM
b JIT_InternalThrow
LEAF_END
;
; r12 = UMEntryThunk*
;
NESTED_ENTRY TheUMEntryPrestub,,UMEntryPrestubUnwindFrameChainHandler
PROLOG_PUSH {r0-r4,lr}
PROLOG_VPUSH {d0-d7}
CHECK_STACK_ALIGNMENT
mov r0, r12
bl TheUMEntryPrestubWorker
; Record real target address in r12.
mov r12, r0
; Epilog
EPILOG_VPOP {d0-d7}
EPILOG_POP {r0-r4,lr}
EPILOG_BRANCH_REG r12
NESTED_END
; ------------------------------------------------------------------
NESTED_ENTRY ThePreStub
PROLOG_WITH_TRANSITION_BLOCK
add r0, sp, #__PWTB_TransitionBlock ; pTransitionBlock
mov r1, r12 ; pMethodDesc
bl PreStubWorker
mov r12, r0
EPILOG_WITH_TRANSITION_BLOCK_TAILCALL
EPILOG_BRANCH_REG r12
NESTED_END
; ------------------------------------------------------------------
NESTED_ENTRY ThePreStubCompactARM
; r12 - address of compact entry point + PC_REG_RELATIVE_OFFSET
PROLOG_WITH_TRANSITION_BLOCK
mov r0, r12
bl PreStubGetMethodDescForCompactEntryPoint
mov r12, r0 ; pMethodDesc
EPILOG_WITH_TRANSITION_BLOCK_TAILCALL
b ThePreStub
NESTED_END
; ------------------------------------------------------------------
; This method does nothing. It's just a fixed function for the debugger to put a breakpoint on.
LEAF_ENTRY ThePreStubPatch
nop
ThePreStubPatchLabel
EXPORT ThePreStubPatchLabel
bx lr
LEAF_END
; ------------------------------------------------------------------
; The call in ndirect import precode points to this function.
NESTED_ENTRY NDirectImportThunk
PROLOG_PUSH {r0-r4,lr} ; Spill general argument registers, return address and
; arbitrary register to keep stack aligned
PROLOG_VPUSH {d0-d7} ; Spill floating point argument registers
CHECK_STACK_ALIGNMENT
mov r0, r12
bl NDirectImportWorker
mov r12, r0
EPILOG_VPOP {d0-d7}
EPILOG_POP {r0-r4,lr}
; If we got back from NDirectImportWorker, the MD has been successfully
; linked. Proceed to execute the original DLL call.
EPILOG_BRANCH_REG r12
NESTED_END
; ------------------------------------------------------------------
; The call in fixup precode initally points to this function.
; The pupose of this function is to load the MethodDesc and forward the call the prestub.
NESTED_ENTRY PrecodeFixupThunk
; r12 = FixupPrecode *
PROLOG_PUSH {r0-r1}
; Inline computation done by FixupPrecode::GetMethodDesc()
ldrb r0, [r12, #3] ; m_PrecodeChunkIndex
ldrb r1, [r12, #2] ; m_MethodDescChunkIndex
add r12,r12,r0,lsl #3
add r0,r12,r0,lsl #2
ldr r0, [r0,#8]
add r12,r0,r1,lsl #2
EPILOG_POP {r0-r1}
EPILOG_BRANCH ThePreStub
NESTED_END
; ------------------------------------------------------------------
; void ResolveWorkerAsmStub(r0, r1, r2, r3, r4:IndirectionCellAndFlags, r12:DispatchToken)
;
; The stub dispatch thunk which transfers control to VSD_ResolveWorker.
NESTED_ENTRY ResolveWorkerAsmStub
PROLOG_WITH_TRANSITION_BLOCK
add r0, sp, #__PWTB_TransitionBlock ; pTransitionBlock
mov r2, r12 ; token
; indirection cell in r4 - should be consistent with REG_ARM_STUB_SPECIAL
bic r1, r4, #3 ; indirection cell
and r3, r4, #3 ; flags
bl VSD_ResolveWorker
mov r12, r0
EPILOG_WITH_TRANSITION_BLOCK_TAILCALL
EPILOG_BRANCH_REG r12
NESTED_END
; ------------------------------------------------------------------
; void ResolveWorkerChainLookupAsmStub(r0, r1, r2, r3, r4:IndirectionCellAndFlags, r12:DispatchToken)
NESTED_ENTRY ResolveWorkerChainLookupAsmStub
; ARMSTUB TODO: implement chained lookup
b ResolveWorkerAsmStub
NESTED_END
#if defined(FEATURE_COMINTEROP)
; ------------------------------------------------------------------
; setStubReturnValue
; r0 - size of floating point return value (MetaSig::GetFPReturnSize())
; r1 - pointer to the return buffer in the stub frame
LEAF_ENTRY setStubReturnValue
cbz r0, NoFloatingPointRetVal
;; Float return case
;; Do not use "it" since it faults in floating point even when the instruction is not executed.
cmp r0, #4
bne LNoFloatRetVal
vldr s0, [r1]
bx lr
LNoFloatRetVal
;; Double return case
;; Do not use "it" since it faults in floating point even when the instruction is not executed.
cmp r0, #8
bne LNoDoubleRetVal
vldr d0, [r1]
bx lr
LNoDoubleRetVal
cmp r0, #16
bne LNoFloatHFARetVal
vldm r1, {s0-s3}
bx lr
LNoFloatHFARetVal
cmp r0, #32
bne LNoDoubleHFARetVal
vldm r1, {d0-d3}
bx lr
LNoDoubleHFARetVal
EMIT_BREAKPOINT ; Unreachable
NoFloatingPointRetVal
;; Restore the return value from retbuf
ldr r0, [r1]
ldr r1, [r1, #4]
bx lr
LEAF_END
#endif // FEATURE_COMINTEROP
#if defined(FEATURE_COMINTEROP)
; ------------------------------------------------------------------
; Function used by remoting/COM interop to get floating point return value (since it's not in the same
; register(s) as non-floating point values).
;
; On entry;
; r0 : size of the FP result (4 or 8 bytes)
; r1 : pointer to 64-bit buffer to receive result
;
; On exit:
; buffer pointed to by r1 on entry contains the float or double argument as appropriate
;
LEAF_ENTRY getFPReturn
cmp r0, #4
bne LgetFP8
vmov r2, s0
str r2, [r1]
bx lr
LgetFP8
vmov r2, r3, d0
strd r2, r3, [r1]
bx lr
LEAF_END
; ------------------------------------------------------------------
; Function used by remoting/COM interop to set floating point return value (since it's not in the same
; register(s) as non-floating point values).
;
; On entry:
; r0 : size of the FP result (4 or 8 bytes)
; r2/r3 : 32-bit or 64-bit FP result
;
; On exit:
; s0 : float result if r0 == 4
; d0 : double result if r0 == 8
;
LEAF_ENTRY setFPReturn
cmp r0, #4
bne LsetFP8
vmov s0, r2
bx lr
LsetFP8
vmov d0, r2, r3
bx lr
LEAF_END
#endif defined(FEATURE_COMINTEROP)
#ifdef FEATURE_COMINTEROP
; ------------------------------------------------------------------
; GenericComPlusCallStub that erects a ComPlusMethodFrame and calls into the runtime
; (CLRToCOMWorker) to dispatch rare cases of the interface call.
;
; On entry:
; r0 : 'this' object
; r12 : Interface MethodDesc*
; plus user arguments in registers and on the stack
;
; On exit:
; r0/r1/s0/d0 set to return value of the call as appropriate
;
NESTED_ENTRY GenericComPlusCallStub
PROLOG_WITH_TRANSITION_BLOCK ASM_ENREGISTERED_RETURNTYPE_MAXSIZE
add r0, sp, #__PWTB_TransitionBlock ; pTransitionBlock
mov r1, r12 ; pMethodDesc
; Call CLRToCOMWorker(pFrame). This call will set up the rest of the frame (including the vfptr,
; the GS cookie and linking to the thread), make the client call and return with correct registers set
; (r0/r1/s0-s3/d0-d3 as appropriate).
bl CLRToCOMWorker
; r0 = fpRetSize
; return value is stored before float argument registers
add r1, sp, #(__PWTB_FloatArgumentRegisters - ASM_ENREGISTERED_RETURNTYPE_MAXSIZE)
bl setStubReturnValue
EPILOG_WITH_TRANSITION_BLOCK_RETURN
NESTED_END
; ------------------------------------------------------------------
; COM to CLR stub called the first time a particular method is invoked.
;
; On entry:
; r12 : (MethodDesc* - ComCallMethodDesc_Offset_FromR12) provided by prepad thunk
; plus user arguments in registers and on the stack
;
; On exit:
; tail calls to real method
;
NESTED_ENTRY ComCallPreStub
GBLA ComCallPreStub_FrameSize
GBLA ComCallPreStub_FramePad
GBLA ComCallPreStub_StackAlloc
GBLA ComCallPreStub_Frame
GBLA ComCallPreStub_ErrorReturn
; Set the defaults
ComCallPreStub_FramePad SETA 8 ; error return
ComCallPreStub_FrameSize SETA (ComCallPreStub_FramePad + SIZEOF__GSCookie + SIZEOF__ComMethodFrame)
IF ComCallPreStub_FrameSize:MOD:8 != 0
ComCallPreStub_FramePad SETA ComCallPreStub_FramePad + 4
ComCallPreStub_FrameSize SETA ComCallPreStub_FrameSize + 4
ENDIF
ComCallPreStub_StackAlloc SETA ComCallPreStub_FrameSize - SIZEOF__ArgumentRegisters - 2 * 4
ComCallPreStub_Frame SETA SIZEOF__FloatArgumentRegisters + ComCallPreStub_FramePad + SIZEOF__GSCookie
ComCallPreStub_ErrorReturn SETA SIZEOF__FloatArgumentRegisters
PROLOG_PUSH {r0-r3} ; Spill general argument registers
PROLOG_PUSH {r11,lr} ; Save return address
PROLOG_STACK_ALLOC ComCallPreStub_StackAlloc ; Alloc non-spill portion of stack frame
PROLOG_VPUSH {d0-d7} ; Spill floating point argument registers
CHECK_STACK_ALIGNMENT
; Finish initializing the frame. The C++ helper will fill in the GS cookie and vfptr and link us to
; the Thread frame chain (see ComPrestubMethodFrame::Push). That leaves us with m_pFuncDesc.
; The prepad thunk passes us a value which is the MethodDesc* - ComCallMethodDesc_Offset_FromR12 (due to encoding limitations in the
; thunk). So we must correct this by adding 4 before storing the pointer.
add r12, #(ComCallMethodDesc_Offset_FromR12)
str r12, [sp, #(ComCallPreStub_Frame + UnmanagedToManagedFrame__m_pvDatum)]
; Call the C++ worker: ComPreStubWorker(&Frame)
add r0, sp, #(ComCallPreStub_Frame)
add r1, sp, #(ComCallPreStub_ErrorReturn)
bl ComPreStubWorker
; Handle failure case.
cbz r0, ErrorExit
; Stash real target address where it won't be overwritten by restoring the calling state.
mov r12, r0
EPILOG_VPOP {d0-d7} ; Restore floating point argument registers
EPILOG_STACK_FREE ComCallPreStub_StackAlloc
EPILOG_POP {r11,lr}
EPILOG_POP {r0-r3} ; Restore argument registers
; Tail call the real target. Actually ComPreStubWorker returns the address of the prepad thunk on ARM,
; that way we don't run out of volatile registers trying to remember both the new target address and
; the hidden MethodDesc* argument. ComPreStubWorker patched the prepad though so the second time
; through we won't end up here again.
EPILOG_BRANCH_REG r12
ErrorExit
; Failed to find a stub to call. Retrieve the return value ComPreStubWorker set for us.
ldr r0, [sp, #(ComCallPreStub_ErrorReturn)]
ldr r1, [sp, #(ComCallPreStub_ErrorReturn+4)]
EPILOG_STACK_FREE ComCallPreStub_StackAlloc + SIZEOF__FloatArgumentRegisters
EPILOG_POP {r11,lr}
EPILOG_STACK_FREE SIZEOF__ArgumentRegisters
EPILOG_RETURN
NESTED_END
; ------------------------------------------------------------------
; COM to CLR stub which sets up a ComMethodFrame and calls COMToCLRWorker.
;
; On entry:
; r12 : (MethodDesc* - ComCallMethodDesc_Offset_FromR12) provided by prepad thunk
; plus user arguments in registers and on the stack
;
; On exit:
; Result in r0/r1/s0/d0 as per the real method being called
;
NESTED_ENTRY GenericComCallStub,,ReverseComUnwindFrameChainHandler
; Calculate space needed on stack for alignment padding, a GS cookie and a ComMethodFrame (minus the last
; field, m_ReturnAddress, which we'll push explicitly).
GBLA GenericComCallStub_FrameSize
GBLA GenericComCallStub_FramePad
GBLA GenericComCallStub_StackAlloc
GBLA GenericComCallStub_Frame
; Set the defaults
GenericComCallStub_FramePad SETA 0
GenericComCallStub_FrameSize SETA (GenericComCallStub_FramePad + SIZEOF__GSCookie + SIZEOF__ComMethodFrame)
IF GenericComCallStub_FrameSize:MOD:8 != 0
GenericComCallStub_FramePad SETA 4
GenericComCallStub_FrameSize SETA GenericComCallStub_FrameSize + GenericComCallStub_FramePad
ENDIF
GenericComCallStub_StackAlloc SETA GenericComCallStub_FrameSize - SIZEOF__ArgumentRegisters - 2 * 4
GenericComCallStub_Frame SETA SIZEOF__FloatArgumentRegisters + GenericComCallStub_FramePad + SIZEOF__GSCookie
PROLOG_PUSH {r0-r3} ; Spill general argument registers
PROLOG_PUSH {r11,lr} ; Save return address
PROLOG_STACK_ALLOC GenericComCallStub_StackAlloc ; Alloc non-spill portion of stack frame
PROLOG_VPUSH {d0-d7} ; Spill floating point argument registers
CHECK_STACK_ALIGNMENT
; Store MethodDesc* in frame. Due to a limitation of the prepad, r12 actually contains a value
; "ComCallMethodDesc_Offset_FromR12" less than the pointer we want, so fix that up.
add r12, r12, #(ComCallMethodDesc_Offset_FromR12)
str r12, [sp, #(GenericComCallStub_Frame + UnmanagedToManagedFrame__m_pvDatum)]
; Call COMToCLRWorker(pThread, pFrame). Note that pThread is computed inside the method so we don't
; need to set it up here.
;
; Setup R1 to point to the start of the explicit frame. We account for alignment padding and
; space for GSCookie.
add r1, sp, #(GenericComCallStub_Frame)
bl COMToCLRWorker
EPILOG_STACK_FREE GenericComCallStub_StackAlloc + SIZEOF__FloatArgumentRegisters
EPILOG_POP {r11,lr}
EPILOG_STACK_FREE SIZEOF__ArgumentRegisters
EPILOG_RETURN
NESTED_END
; ------------------------------------------------------------------
; COM to CLR stub called from COMToCLRWorker that actually dispatches to the real managed method.
;
; On entry:
; r0 : dwStackSlots, count of argument stack slots to copy
; r1 : pFrame, ComMethodFrame pushed by GenericComCallStub above
; r2 : pTarget, address of code to call
; r3 : pSecretArg, hidden argument passed to target above in r12
; [sp, #0] : pDangerousThis, managed 'this' reference
;
; On exit:
; Result in r0/r1/s0/d0 as per the real method being called
;
NESTED_ENTRY COMToCLRDispatchHelper,,CallDescrWorkerUnwindFrameChainHandler
PROLOG_PUSH {r4-r5,r7,lr}
PROLOG_STACK_SAVE r7
; Copy stack-based arguments. Make sure the eventual SP ends up 8-byte aligned. Note that the
; following calculations assume that the prolog has left the stack already aligned.
CHECK_STACK_ALIGNMENT
cbz r0, COMToCLRDispatchHelper_ArgumentsSetup
lsl r4, r0, #2 ; r4 = (dwStackSlots * 4)
and r5, r4, #4 ; Align the stack
sub sp, sp, r5
add r5, r1, #SIZEOF__ComMethodFrame
add r5, r5, r4
COMToCLRDispatchHelper_StackLoop
ldr r4, [r5,#-4]!
str r4, [sp,#-4]!
subs r0, r0, #1
bne COMToCLRDispatchHelper_StackLoop
CHECK_STACK_ALIGNMENT
COMToCLRDispatchHelper_ArgumentsSetup
; Load floating point argument registers.
sub r4, r1, #(GenericComCallStub_Frame)
vldm r4, {d0-d7}
; Prepare the call target and hidden argument prior to overwriting r0-r3.
mov r12, r3 ; r12 = hidden argument
mov lr, r2 ; lr = target code
; Load general argument registers except r0.
add r4, r1, #(SIZEOF__ComMethodFrame - SIZEOF__ArgumentRegisters + 4)
ldm r4, {r1-r3}
; Load r0 from the managed this, not the original incoming IUnknown*.
ldr r0, [r7, #(4 * 4)]
; Make the call.
blx lr
EPILOG_STACK_RESTORE r7
EPILOG_POP {r4-r5,r7,pc}
NESTED_END
#endif // FEATURE_COMINTEROP
#ifdef PROFILING_SUPPORTED
PROFILE_ENTER equ 1
PROFILE_LEAVE equ 2
PROFILE_TAILCALL equ 4
; ------------------------------------------------------------------
; void JIT_ProfilerEnterLeaveTailcallStub(UINT_PTR ProfilerHandle)
LEAF_ENTRY JIT_ProfilerEnterLeaveTailcallStub
bx lr
LEAF_END
; Define the layout of the PROFILE_PLATFORM_SPECIFIC_DATA we push on the stack for all profiler
; helpers.
map 0
field 4 ; r0
field 4 ; r1
field 4 ; r11
field 4 ; Pc (caller's PC, i.e. LR)
field SIZEOF__FloatArgumentRegisters ; spilled floating point argument registers
functionId field 4
probeSp field 4
profiledSp field 4
hiddenArg field 4
flags field 4
SIZEOF__PROFILE_PLATFORM_SPECIFIC_DATA field 0
; ------------------------------------------------------------------
; Macro used to generate profiler helpers. In all cases we push a partially initialized
; PROFILE_PLATFORM_SPECIFIC_DATA structure on the stack and call into a C++ helper to continue processing.
;
; On entry:
; r0 : clientInfo
; r1/r2 : return values (in case of leave)
; frame pointer(r11) must be set (in case of enter)
; all arguments are on stack at frame pointer (r11) + 8bytes (save lr & prev r11).
;
; On exit:
; All register values are preserved including volatile registers
;
MACRO
DefineProfilerHelper $HelperName, $Flags
GBLS __ProfilerHelperFunc
__ProfilerHelperFunc SETS "$HelperName":CC:"Naked"
NESTED_ENTRY $__ProfilerHelperFunc
IMPORT $HelperName ; The C++ helper which does most of the work
PROLOG_PUSH {r0,r3,r9,r12} ; save volatile general purpose registers. remaining r1 & r2 are saved below...saving r9 as it is required for virtualunwinding
PROLOG_STACK_ALLOC (6*4) ; Reserve space for tail end of structure (5*4 bytes) and extra 4 bytes is for aligning the stack at 8-byte boundary
PROLOG_VPUSH {d0-d7} ; Spill floting point argument registers
PROLOG_PUSH {r1,r11,lr} ; Save possible return value in r1, frame pointer and return address
PROLOG_PUSH {r2} ; Save possible return value in r0. Before calling Leave Hook Jit moves contents of r0 to r2
; so pushing r2 instead of r0. This push statement cannot be combined with the above push
; as r2 gets pushed before r1.
CHECK_STACK_ALIGNMENT
; Zero r1 for use clearing fields in the PROFILE_PLATFORM_SPECIFIC_DATA.
eor r1, r1
; Clear functionId.
str r1, [sp, #functionId]
; Save caller's SP (at the point this helper was called).
add r2, sp, #(SIZEOF__PROFILE_PLATFORM_SPECIFIC_DATA + 20)
str r2, [sp, #probeSp]
; Save caller's SP (at the point where only argument registers have been spilled).
ldr r2, [r11]
add r2, r2, #8 ; location of arguments is at frame pointer(r11) + 8 (lr & prev frame ptr is saved before changing
str r2, [sp, #profiledSp]
; Clear hiddenArg.
str r1, [sp, #hiddenArg]
; Set flags to indicate type of helper called.
mov r1, #($Flags)
str r1, [sp, #flags]
; Call C++ portion of helper (<$HelperName>(clientInfo, &profilePlatformSpecificData)).
mov r1, sp
bl $HelperName
EPILOG_POP {r2}
EPILOG_POP {r1,r11,lr}
EPILOG_VPOP {d0-d7}
EPILOG_STACK_FREE (6*4)
EPILOG_POP {r0,r3,r9,r12}
EPILOG_RETURN
NESTED_END
MEND
DefineProfilerHelper ProfileEnter, PROFILE_ENTER
DefineProfilerHelper ProfileLeave, PROFILE_LEAVE
DefineProfilerHelper ProfileTailcall, PROFILE_TAILCALL
#endif // PROFILING_SUPPORTED
;
; If a preserved register were pushed onto the stack between
; the managed caller and the H_M_F, _R4_R11 will point to its
; location on the stack and it would have been updated on the
; stack by the GC already and it will be popped back into the
; appropriate register when the appropriate epilog is run.
;
; Otherwise, the register is preserved across all the code
; in this HCALL or FCALL, so we need to update those registers
; here because the GC will have updated our copies in the
; frame.
;
; So, if _R4_R11 points into the MachState, we need to update
; the register here. That's what this macro does.
;
MACRO
RestoreRegMS $regIndex, $reg
; Incoming:
;
; R0 = address of MachState
;
; $regIndex: Index of the register (R4-R11). For R4, index is 4.
; For R5, index is 5, and so on.
;
; $reg: Register name (e.g. R4, R5, etc)
;
; Get the address of the specified captured register from machine state
add r2, r0, #(MachState__captureR4_R11 + (($regIndex-4)*4))
; Get the address of the specified preserved register from machine state
ldr r3, [r0, #(MachState___R4_R11 + (($regIndex-4)*4))]
cmp r2, r3
bne %FT0
ldr $reg, [r2]
0
MEND
; EXTERN_C int __fastcall HelperMethodFrameRestoreState(
; INDEBUG_COMMA(HelperMethodFrame *pFrame)
; MachState *pState
; )
LEAF_ENTRY HelperMethodFrameRestoreState
#ifdef _DEBUG
mov r0, r1
#endif
; If machine state is invalid, then simply exit
ldr r1, [r0, #MachState__isValid]
cmp r1, #0
beq Done
RestoreRegMS 4, R4
RestoreRegMS 5, R5
RestoreRegMS 6, R6
RestoreRegMS 7, R7
RestoreRegMS 8, R8
RestoreRegMS 9, R9
RestoreRegMS 10, R10
RestoreRegMS 11, R11
Done
; Its imperative that the return value of HelperMethodFrameRestoreState is zero
; as it is used in the state machine to loop until it becomes zero.
; Refer to HELPER_METHOD_FRAME_END macro for details.
mov r0,#0
bx lr
LEAF_END
#ifdef FEATURE_HIJACK
; ------------------------------------------------------------------
; Hijack function for functions which return a value type
NESTED_ENTRY OnHijackTripThread
PROLOG_PUSH {r0,r4-r11,lr}
PROLOG_VPUSH {d0-d3} ; saving as d0-d3 can have the floating point return value
PROLOG_PUSH {r1} ; saving as r1 can have partial return value when return is > 32 bits
PROLOG_STACK_ALLOC 4 ; 8 byte align
CHECK_STACK_ALIGNMENT
add r0, sp, #40
bl OnHijackWorker
EPILOG_STACK_FREE 4
EPILOG_POP {r1}
EPILOG_VPOP {d0-d3}
EPILOG_POP {r0,r4-r11,pc}
NESTED_END
#endif ; FEATURE_HIJACK
; ------------------------------------------------------------------
; Macro to generate Redirection Stubs
;
; $reason : reason for redirection
; Eg. GCThreadControl
; NOTE: If you edit this macro, make sure you update GetCONTEXTFromRedirectedStubStackFrame.
; This function is used by both the personality routine and the debugger to retrieve the original CONTEXT.
MACRO
GenerateRedirectedHandledJITCaseStub $reason
GBLS __RedirectionStubFuncName
GBLS __RedirectionStubEndFuncName
GBLS __RedirectionFuncName
__RedirectionStubFuncName SETS "RedirectedHandledJITCaseFor":CC:"$reason":CC:"_Stub"
__RedirectionStubEndFuncName SETS "RedirectedHandledJITCaseFor":CC:"$reason":CC:"_StubEnd"
__RedirectionFuncName SETS "|?RedirectedHandledJITCaseFor":CC:"$reason":CC:"@Thread@@CAXXZ|"
IMPORT $__RedirectionFuncName
NESTED_ENTRY $__RedirectionStubFuncName
PROLOG_PUSH {r7,lr} ; return address
PROLOG_STACK_ALLOC 4 ; stack slot to save the CONTEXT *
PROLOG_STACK_SAVE r7
;REDIRECTSTUB_SP_OFFSET_CONTEXT is defined in asmconstants.h
;If CONTEXT is not saved at 0 offset from SP it must be changed as well.
ASSERT REDIRECTSTUB_SP_OFFSET_CONTEXT == 0
; Runtime check for 8-byte alignment. This check is necessary as this function can be
; entered before complete execution of the prolog of another function.
and r0, r7, #4
sub sp, sp, r0
; stack must be 8 byte aligned
CHECK_STACK_ALIGNMENT
;
; Save a copy of the redirect CONTEXT*.
; This is needed for the debugger to unwind the stack.
;
bl GetCurrentSavedRedirectContext
str r0, [r7]
;
; Fetch the interrupted pc and save it as our return address.
;
ldr r1, [r0, #CONTEXT_Pc]
str r1, [r7, #8]
;
; Call target, which will do whatever we needed to do in the context
; of the target thread, and will RtlRestoreContext when it is done.
;
bl $__RedirectionFuncName
EMIT_BREAKPOINT ; Unreachable
; Put a label here to tell the debugger where the end of this function is.
$__RedirectionStubEndFuncName
EXPORT $__RedirectionStubEndFuncName
NESTED_END
MEND
; ------------------------------------------------------------------
; Redirection Stub for GC in fully interruptible method
GenerateRedirectedHandledJITCaseStub GCThreadControl
; ------------------------------------------------------------------
GenerateRedirectedHandledJITCaseStub DbgThreadControl
; ------------------------------------------------------------------
GenerateRedirectedHandledJITCaseStub UserSuspend
#ifdef _DEBUG
; ------------------------------------------------------------------
; Redirection Stub for GC Stress
GenerateRedirectedHandledJITCaseStub GCStress
#endif
; ------------------------------------------------------------------
; Functions to probe for stack space
; Input reg r4 = amount of stack to probe for
; value of reg r4 is preserved on exit from function
; r12 is trashed
; The below two functions were copied from vctools\crt\crtw32\startup\arm\chkstk.asm
NESTED_ENTRY checkStack
subs r12,sp,r4
mrc p15,#0,r4,c13,c0,#2 ; get TEB *
ldr r4,[r4,#8] ; get Stack limit
bcc checkStack_neg ; if r12 is less then 0 set it to 0
checkStack_label1
cmp r12, r4
bcc stackProbe ; must probe to extend guardpage if r12 is beyond stackLimit
sub r4, sp, r12 ; restore value of r4
EPILOG_RETURN
checkStack_neg
mov r12, #0
b checkStack_label1
NESTED_END
NESTED_ENTRY stackProbe
PROLOG_PUSH {r5,r6}
mov r6, r12
bfc r6, #0, #0xc ; align down (4K)
stackProbe_loop
sub r4,r4,#0x1000 ; dec stack Limit by 4K as page size is 4K
ldr r5,[r4] ; try to read ... this should move the guard page
cmp r4,r6
bne stackProbe_loop
EPILOG_POP {r5,r6}
EPILOG_NOP sub r4,sp,r12
EPILOG_RETURN
NESTED_END
#ifdef FEATURE_PREJIT
;------------------------------------------------
; VirtualMethodFixupStub
;
; In NGEN images, virtual slots inherited from cross-module dependencies
; point to a jump thunk that calls into the following function that will
; call into a VM helper. The VM helper is responsible for patching up
; thunk, upon executing the precode, so that all subsequent calls go directly
; to the actual method body.
;
; This is done lazily for performance reasons.
;
; On entry:
;
; R0 = "this" pointer
; R12 = Address of thunk + 4
NESTED_ENTRY VirtualMethodFixupStub
; Save arguments and return address
PROLOG_PUSH {r0-r3, lr}
; Align stack
PROLOG_STACK_ALLOC SIZEOF__FloatArgumentRegisters + 4
vstm sp, {d0-d7}
CHECK_STACK_ALIGNMENT
; R12 contains an address that is 4 bytes ahead of
; where the thunk starts. Refer to ZapImportVirtualThunk::Save
; for details on this.
;
; Move the correct thunk start address in R1
sub r1, r12, #4
; Call the helper in the VM to perform the actual fixup
; and tell us where to tail call. R0 already contains
; the this pointer.
bl VirtualMethodFixupWorker
; On return, R0 contains the target to tailcall to
mov r12, r0
; pop the stack and restore original register state
vldm sp, {d0-d7}
EPILOG_STACK_FREE SIZEOF__FloatArgumentRegisters + 4
EPILOG_POP {r0-r3, lr}
PATCH_LABEL VirtualMethodFixupPatchLabel
; and tailcall to the actual method
EPILOG_BRANCH_REG r12
NESTED_END
#endif // FEATURE_PREJIT
;------------------------------------------------
; ExternalMethodFixupStub
;
; In NGEN images, calls to cross-module external methods initially
; point to a jump thunk that calls into the following function that will
; call into a VM helper. The VM helper is responsible for patching up the
; thunk, upon executing the precode, so that all subsequent calls go directly
; to the actual method body.
;
; This is done lazily for performance reasons.
;
; On entry:
;
; R12 = Address of thunk + 4
NESTED_ENTRY ExternalMethodFixupStub
PROLOG_WITH_TRANSITION_BLOCK
add r0, sp, #__PWTB_TransitionBlock ; pTransitionBlock
; Adjust (read comment above for details) and pass the address of the thunk
sub r1, r12, #4 ; pThunk
mov r2, #0 ; sectionIndex
mov r3, #0 ; pModule
bl ExternalMethodFixupWorker
; mov the address we patched to in R12 so that we can tail call to it
mov r12, r0
EPILOG_WITH_TRANSITION_BLOCK_TAILCALL
PATCH_LABEL ExternalMethodFixupPatchLabel
EPILOG_BRANCH_REG r12
NESTED_END
#ifdef FEATURE_PREJIT
;------------------------------------------------
; StubDispatchFixupStub
;
; In NGEN images, calls to interface methods initially
; point to a jump thunk that calls into the following function that will
; call into a VM helper. The VM helper is responsible for patching up the
; thunk with actual stub dispatch stub.
;
; On entry:
;
; R4 = Address of indirection cell
NESTED_ENTRY StubDispatchFixupStub
PROLOG_WITH_TRANSITION_BLOCK
; address of StubDispatchFrame
add r0, sp, #__PWTB_TransitionBlock ; pTransitionBlock
mov r1, r4 ; siteAddrForRegisterIndirect
mov r2, #0 ; sectionIndex
mov r3, #0 ; pModule
bl StubDispatchFixupWorker
; mov the address we patched to in R12 so that we can tail call to it
mov r12, r0
EPILOG_WITH_TRANSITION_BLOCK_TAILCALL
PATCH_LABEL StubDispatchFixupPatchLabel
EPILOG_BRANCH_REG r12
NESTED_END
#endif // FEATURE_PREJIT
;------------------------------------------------
; JIT_RareDisableHelper
;
; The JIT expects this helper to preserve registers used for return values
;
NESTED_ENTRY JIT_RareDisableHelper
PROLOG_PUSH {r0-r1, r11, lr} ; save integer return value
PROLOG_VPUSH {d0-d3} ; floating point return value
CHECK_STACK_ALIGNMENT
bl JIT_RareDisableHelperWorker
EPILOG_VPOP {d0-d3}
EPILOG_POP {r0-r1, r11, pc}
NESTED_END
;
; JIT Static access helpers for single appdomain case
;
; ------------------------------------------------------------------
; void* JIT_GetSharedNonGCStaticBase(SIZE_T moduleDomainID, DWORD dwClassDomainID)
LEAF_ENTRY JIT_GetSharedNonGCStaticBase_SingleAppDomain
; If class is not initialized, bail to C++ helper
add r2, r0, #DomainLocalModule__m_pDataBlob
ldrb r2, [r2, r1]
tst r2, #1
beq CallCppHelper1
bx lr
CallCppHelper1
; Tail call JIT_GetSharedNonGCStaticBase_Helper
b JIT_GetSharedNonGCStaticBase_Helper
LEAF_END
; ------------------------------------------------------------------
; void* JIT_GetSharedNonGCStaticBaseNoCtor(SIZE_T moduleDomainID, DWORD dwClassDomainID)
LEAF_ENTRY JIT_GetSharedNonGCStaticBaseNoCtor_SingleAppDomain
bx lr
LEAF_END
; ------------------------------------------------------------------
; void* JIT_GetSharedGCStaticBase(SIZE_T moduleDomainID, DWORD dwClassDomainID)
LEAF_ENTRY JIT_GetSharedGCStaticBase_SingleAppDomain
; If class is not initialized, bail to C++ helper
add r2, r0, #DomainLocalModule__m_pDataBlob
ldrb r2, [r2, r1]
tst r2, #1
beq CallCppHelper3
ldr r0, [r0, #DomainLocalModule__m_pGCStatics]
bx lr
CallCppHelper3
; Tail call Jit_GetSharedGCStaticBase_Helper
b JIT_GetSharedGCStaticBase_Helper
LEAF_END
; ------------------------------------------------------------------
; void* JIT_GetSharedGCStaticBaseNoCtor(SIZE_T moduleDomainID, DWORD dwClassDomainID)
LEAF_ENTRY JIT_GetSharedGCStaticBaseNoCtor_SingleAppDomain
ldr r0, [r0, #DomainLocalModule__m_pGCStatics]
bx lr
LEAF_END
; ------------------------------------------------------------------
; GC write barrier support.
;
; There's some complexity here for a couple of reasons:
;
; Firstly, there are a few variations of barrier types (input registers, checked vs unchecked, UP vs MP etc.).
; So first we define a number of helper macros that perform fundamental pieces of a barrier and then we define
; the final barrier functions by assembling these macros in various combinations.
;
; Secondly, for performance reasons we believe it's advantageous to be able to modify the barrier functions
; over the lifetime of the CLR. Specifically ARM has real problems reading the values of external globals (we
; need two memory indirections to do this) so we'd like to be able to directly set the current values of
; various GC globals (e.g. g_lowest_address and g_card_table) into the barrier code itself and then reset them
; every time they change (the GC already calls the VM to inform it of these changes). To handle this without
; creating too much fragility such as hardcoding instruction offsets in the VM update code, we wrap write
; barrier creation and GC globals access in a set of macros that create a table of descriptors describing each
; offset that must be patched.
;
; Many of the following macros need a scratch register. Define a name for it here so it's easy to modify this
; in the future.
GBLS __wbscratch
__wbscratch SETS "r3"
;
; First define the meta-macros used to support dynamically patching write barriers.
;
; WRITEBARRIERAREA
;
; As we assemble each write barrier function we build a descriptor for the offsets within that function
; that need to be patched at runtime. We write these descriptors into a read-only portion of memory. Use a
; specially-named linker section for this to ensure all the descriptors are contiguous and form a table.
; During the final link of the CLR this section should be merged into the regular read-only data section.
;
; This macro handles switching assembler output to the above section (similar to the TEXTAREA or
; RODATAAREA macros defined by kxarm.h).
;
MACRO
WRITEBARRIERAREA
AREA |.clrwb|,DATA,READONLY
MEND
; BEGIN_WRITE_BARRIERS
;
; This macro must be invoked before any write barriers are defined. It sets up and exports a symbol,
; g_rgWriteBarrierDescriptors, used by the VM to locate the start of the table describing the offsets in
; each write barrier that need to be modified dynamically.
;
MACRO
BEGIN_WRITE_BARRIERS
; Define a global boolean to track whether we're currently in a BEGIN_WRITE_BARRIERS section. This is
; used purely to catch incorrect attempts to define a write barrier outside the section.
GBLL __defining_write_barriers
__defining_write_barriers SETL {true}
; Switch to the descriptor table section.
WRITEBARRIERAREA
; Define and export a symbol pointing to the start of the descriptor table.
g_rgWriteBarrierDescriptors
EXPORT g_rgWriteBarrierDescriptors
; Switch back to the code section.
TEXTAREA
MEND
; END_WRITE_BARRIERS
;
; This macro must be invoked after all write barriers have been defined. It finalizes the creation of the
; barrier descriptor table by writing a sentinel value at the end.
;
MACRO
END_WRITE_BARRIERS
ASSERT __defining_write_barriers
__defining_write_barriers SETL {false}
; Switch to the descriptor table section.
WRITEBARRIERAREA
; Write the sentinel value to the end of the descriptor table (a function entrypoint address of zero).
DCD 0
; Switch back to the code section.
TEXTAREA
MEND
; WRITE_BARRIER_ENTRY
;
; Declare the start of a write barrier function. Use similarly to NESTED_ENTRY. This is the only legal way
; to declare a write barrier function.
;
MACRO
WRITE_BARRIER_ENTRY $name
; Ensure we're called inside a BEGIN_WRITE_BARRIERS section.
ASSERT __defining_write_barriers
; Do the standard function declaration logic. Must use a NESTED_ENTRY since we require unwind info to
; be registered (for the case where the barrier AVs and the runtime needs to recover).
LEAF_ENTRY $name
; Record the function name as it's used as the basis for unique label name creation in some of the
; macros below.
GBLS __write_barrier_name
__write_barrier_name SETS "$name"
; Declare globals to collect the values of the offsets of instructions that load GC global values.
GBLA __g_lowest_address_offset
GBLA __g_highest_address_offset
GBLA __g_ephemeral_low_offset
GBLA __g_ephemeral_high_offset
GBLA __g_card_table_offset
; Initialize the above offsets to 0xffff. The default of zero is unsatisfactory because we could
; legally have an offset of zero and we need some way to distinguish unset values (both for debugging
; and because some write barriers don't use all the globals).
__g_lowest_address_offset SETA 0xffff
__g_highest_address_offset SETA 0xffff
__g_ephemeral_low_offset SETA 0xffff
__g_ephemeral_high_offset SETA 0xffff
__g_card_table_offset SETA 0xffff
MEND
; WRITE_BARRIER_END
;
; The partner to WRITE_BARRIER_ENTRY, used like NESTED_END.
;
MACRO
WRITE_BARRIER_END
LTORG ; force the literal pool to be emitted here so that copy code picks it up
; Use the standard macro to end the function definition.
LEAF_END_MARKED $__write_barrier_name
; Define a local string to hold the name of a label identifying the end of the write barrier function.
LCLS __EndLabelName
__EndLabelName SETS "$__write_barrier_name":CC:"_End"
; Switch to the descriptor table section.
WRITEBARRIERAREA
; Emit the descripter for this write barrier. The order of these datums must be kept in sync with the
; definition of the WriteBarrierDescriptor structure in vm\arm\stubs.cpp.
DCD $__write_barrier_name
DCD $__EndLabelName
DCD __g_lowest_address_offset
DCD __g_highest_address_offset
DCD __g_ephemeral_low_offset
DCD __g_ephemeral_high_offset
DCD __g_card_table_offset
; Switch back to the code section.
TEXTAREA
MEND
; LOAD_GC_GLOBAL
;
; Used any time we want to load the value of one of the supported GC globals into a register. This records
; the offset of the instructions used to do this (a movw/movt pair) so we can modify the actual value
; loaded at runtime.
;
; Note that a given write barrier can only load a given global once (which will be compile-time asserted
; below).
;
MACRO
LOAD_GC_GLOBAL $regName, $globalName
; Map the GC global name to the name of the variable tracking the offset for this function.
LCLS __offset_name
__offset_name SETS "__$globalName._offset"
; Ensure that we only attempt to load this global at most once in the current barrier function (we
; have this limitation purely because we only record one offset for each GC global).
ASSERT $__offset_name == 0xffff
; Define a unique name for a label we're about to define used in the calculation of the current
; function offset.
LCLS __offset_label_name
__offset_label_name SETS "$__write_barrier_name$__offset_name"
; Define the label.
$__offset_label_name
; Write the current function offset into the tracking variable.
$__offset_name SETA ($__offset_label_name - $__FuncStartLabel)
; Emit the instructions which will be patched to provide the value of the GC global (we start with a
; value of zero, so the write barriers have to be patched at least once before first use).
movw $regName, #0
movt $regName, #0
MEND
;
; Now define the macros used in the bodies of write barrier implementations.
;
; UPDATE_GC_SHADOW
;
; Update the GC shadow heap to aid debugging (no-op unless WRITE_BARRIER_CHECK is defined). Assumes the
; location being written lies on the GC heap (either we've already performed the dynamic check or this is
; statically asserted by the JIT by calling the unchecked version of the write barrier).
;
; Input:
; $ptrReg : register containing the location (in the real heap) to be updated
; $valReg : register containing the value (an objref) to be written to the location above
;
; Output:
; $__wbscratch : trashed
;
MACRO
UPDATE_GC_SHADOW $ptrReg, $valReg
#ifdef WRITE_BARRIER_CHECK
; Need one additional temporary register to hold the shadow pointer. Assume r7 is OK for now (and
; assert it). If this becomes a problem in the future the register choice can be parameterized.
LCLS pShadow
pShadow SETS "r7"
ASSERT "$ptrReg" != "$pShadow"
ASSERT "$valReg" != "$pShadow"
push {$pShadow}
; Compute address of shadow heap location:
; pShadow = g_GCShadow + ($ptrReg - g_lowest_address)
ldr $__wbscratch, =g_lowest_address
ldr $__wbscratch, [$__wbscratch]
sub $pShadow, $ptrReg, $__wbscratch
ldr $__wbscratch, =$g_GCShadow
ldr $__wbscratch, [$__wbscratch]
add $pShadow, $__wbscratch
; if (pShadow >= g_GCShadow) goto end
ldr $__wbscratch, =$g_GCShadowEnd
ldr $__wbscratch, [$__wbscratch]
cmp $pShadow, $__wbscratch
bhs %FT0
; *pShadow = $valReg
str $valReg, [$pShadow]
; Ensure that the write to the shadow heap occurs before the read from the GC heap so that race
; conditions are caught by INVALIDGCVALUE.
dmb
; if (*$ptrReg == $valReg) goto end
ldr $__wbscratch, [$ptrReg]
cmp $__wbscratch, $valReg
beq %FT0
; *pShadow = INVALIDGCVALUE (0xcccccccd)
movw $__wbscratch, #0xcccd
movt $__wbscratch, #0xcccc
str $__wbscratch, [$pShadow]
0
pop {$pShadow}
#endif // WRITE_BARRIER_CHECK
MEND
; UPDATE_CARD_TABLE
;
; Update the card table as necessary (if the object reference being assigned in the barrier refers to an
; object in the ephemeral generation). Otherwise this macro is a no-op. Assumes the location being written
; lies on the GC heap (either we've already performed the dynamic check or this is statically asserted by
; the JIT by calling the unchecked version of the write barrier).
;
; Additionally this macro can produce a uni-proc or multi-proc variant of the code. This governs whether
; we bother to check if the card table has been updated before making our own update (on an MP system it
; can be helpful to perform this check to avoid cache line thrashing, on an SP system the code path length
; is more important).
;
; Input:
; $ptrReg : register containing the location to be updated
; $valReg : register containing the value (an objref) to be written to the location above
; $mp : boolean indicating whether the code will run on an MP system
; $postGrow : boolean: {true} for post-grow version, {false} otherwise
; $tmpReg : additional register that can be trashed (can alias $ptrReg or $valReg if needed)
;
; Output:
; $tmpReg : trashed (defaults to $ptrReg)
; $__wbscratch : trashed
;
MACRO
UPDATE_CARD_TABLE $ptrReg, $valReg, $mp, $postGrow, $tmpReg
ASSERT "$ptrReg" != "$__wbscratch"
ASSERT "$valReg" != "$__wbscratch"
ASSERT "$tmpReg" != "$__wbscratch"
; In most cases the callers of this macro are fine with scratching $ptrReg, the exception being the
; ref write barrier, which wants to scratch $valReg instead. Ideally we could set $ptrReg as the
; default for the $tmpReg parameter, but limitations in armasm won't allow that. Similarly it doesn't
; seem to like us trying to redefine $tmpReg in the body of the macro. Instead we define a new local
; string variable and set that either with the value of $tmpReg or $ptrReg if $tmpReg wasn't
; specified.
LCLS tempReg
IF "$tmpReg" == ""
tempReg SETS "$ptrReg"
ELSE
tempReg SETS "$tmpReg"
ENDIF
; Check whether the value object lies in the ephemeral generations. If not we don't have to update the
; card table.
LOAD_GC_GLOBAL $__wbscratch, g_ephemeral_low
cmp $valReg, $__wbscratch
blo %FT0
; Only in post grow higher generation can be beyond ephemeral segment
IF $postGrow
LOAD_GC_GLOBAL $__wbscratch, g_ephemeral_high
cmp $valReg, $__wbscratch
bhs %FT0
ENDIF
; Update the card table.
LOAD_GC_GLOBAL $__wbscratch, g_card_table
add $__wbscratch, $__wbscratch, $ptrReg, lsr #10
; On MP systems make sure the card hasn't already been set first to avoid thrashing cache lines
; between CPUs.
; @ARMTODO: Check that the conditional store doesn't unconditionally gain exclusive access to the
; cache line anyway. Compare perf with a branch over and verify that omitting the compare on uniproc
; machines really is a perf win.
IF $mp
ldrb $tempReg, [$__wbscratch]
cmp $tempReg, #0xff
movne $tempReg, #0xff
strbne $tempReg, [$__wbscratch]
ELSE
mov $tempReg, #0xff
strb $tempReg, [$__wbscratch]
ENDIF
0
MEND
; CHECK_GC_HEAP_RANGE
;
; Verifies that the given value points into the GC heap range. If so the macro will fall through to the
; following code. Otherwise (if the value points outside the GC heap) a branch to the supplied label will
; be made.
;
; Input:
; $ptrReg : register containing the location to be updated
; $label : label branched to on a range check failure
;
; Output:
; $__wbscratch : trashed
;
MACRO
CHECK_GC_HEAP_RANGE $ptrReg, $label
ASSERT "$ptrReg" != "$__wbscratch"
LOAD_GC_GLOBAL $__wbscratch, g_lowest_address
cmp $ptrReg, $__wbscratch
blo $label
LOAD_GC_GLOBAL $__wbscratch, g_highest_address
cmp $ptrReg, $__wbscratch
bhs $label
MEND
;
; Finally define the write barrier functions themselves. Currently we don't provide variations that use
; different input registers. If the JIT wants this at a later stage in order to improve code quality it would
; be a relatively simple change to implement via an additional macro parameter to WRITE_BARRIER_ENTRY.
;
; The calling convention for the first batch of write barriers is:
;
; On entry:
; r0 : the destination address (LHS of the assignment)
; r1 : the object reference (RHS of the assignment)
;
; On exit:
; r0 : trashed
; $__wbscratch : trashed
;
; If you update any of the writebarrier be sure to update the sizes of patchable
; writebarriers in
; see ValidateWriteBarriers()
; The write barriers are macro taking arguments like
; $name: Name of the write barrier
; $mp: {true} for multi-proc, {false} otherwise
; $post: {true} for post-grow version, {false} otherwise
MACRO
JIT_WRITEBARRIER $name, $mp, $post
WRITE_BARRIER_ENTRY $name
IF $mp
dmb ; Perform a memory barrier
ENDIF
str r1, [r0] ; Write the reference
UPDATE_GC_SHADOW r0, r1 ; Update the shadow GC heap for debugging
UPDATE_CARD_TABLE r0, r1, $mp, $post ; Update the card table if necessary
bx lr
WRITE_BARRIER_END
MEND
MACRO
JIT_CHECKEDWRITEBARRIER_SP $name, $post
WRITE_BARRIER_ENTRY $name
str r1, [r0] ; Write the reference
CHECK_GC_HEAP_RANGE r0, %F1 ; Check whether the destination is in the GC heap
UPDATE_GC_SHADOW r0, r1 ; Update the shadow GC heap for debugging
UPDATE_CARD_TABLE r0, r1, {false}, $post; Update the card table if necessary
1
bx lr
WRITE_BARRIER_END
MEND
MACRO
JIT_CHECKEDWRITEBARRIER_MP $name, $post
WRITE_BARRIER_ENTRY $name
CHECK_GC_HEAP_RANGE r0, %F1 ; Check whether the destination is in the GC heap
dmb ; Perform a memory barrier
str r1, [r0] ; Write the reference
UPDATE_GC_SHADOW r0, r1 ; Update the shadow GC heap for debugging
UPDATE_CARD_TABLE r0, r1, {true}, $post ; Update the card table if necessary
bx lr
1
str r1, [r0] ; Write the reference
bx lr
WRITE_BARRIER_END
MEND
; The ByRef write barriers have a slightly different interface:
;
; On entry:
; r0 : the destination address (object reference written here)
; r1 : the source address (points to object reference to write)
;
; On exit:
; r0 : incremented by 4
; r1 : incremented by 4
; r2 : trashed
; $__wbscratch : trashed
;
MACRO
JIT_BYREFWRITEBARRIER $name, $mp, $post
WRITE_BARRIER_ENTRY $name
IF $mp
dmb ; Perform a memory barrier
ENDIF
ldr r2, [r1] ; Load target object ref from source pointer
str r2, [r0] ; Write the reference to the destination pointer
CHECK_GC_HEAP_RANGE r0, %F1 ; Check whether the destination is in the GC heap
UPDATE_GC_SHADOW r0, r2 ; Update the shadow GC heap for debugging
UPDATE_CARD_TABLE r0, r2, $mp, $post, r2 ; Update the card table if necessary (trash r2 rather than r0)
1
add r0, #4 ; Increment the destination pointer by 4
add r1, #4 ; Increment the source pointer by 4
bx lr
WRITE_BARRIER_END
MEND
BEGIN_WRITE_BARRIERS
; There 4 versions of each write barriers. A 2x2 combination of multi-proc/single-proc and pre/post grow version
JIT_WRITEBARRIER JIT_WriteBarrier_SP_Pre, {false}, {false}
JIT_WRITEBARRIER JIT_WriteBarrier_SP_Post, {false}, {true}
JIT_WRITEBARRIER JIT_WriteBarrier_MP_Pre, {true}, {false}
JIT_WRITEBARRIER JIT_WriteBarrier_MP_Post, {true}, {true}
JIT_CHECKEDWRITEBARRIER_SP JIT_CheckedWriteBarrier_SP_Pre, {false}
JIT_CHECKEDWRITEBARRIER_SP JIT_CheckedWriteBarrier_SP_Post, {true}
JIT_CHECKEDWRITEBARRIER_MP JIT_CheckedWriteBarrier_MP_Pre, {false}
JIT_CHECKEDWRITEBARRIER_MP JIT_CheckedWriteBarrier_MP_Post, {true}
JIT_BYREFWRITEBARRIER JIT_ByRefWriteBarrier_SP_Pre, {false}, {false}
JIT_BYREFWRITEBARRIER JIT_ByRefWriteBarrier_SP_Post, {false}, {true}
JIT_BYREFWRITEBARRIER JIT_ByRefWriteBarrier_MP_Pre, {true}, {false}
JIT_BYREFWRITEBARRIER JIT_ByRefWriteBarrier_MP_Post, {true}, {true}
END_WRITE_BARRIERS
#ifdef FEATURE_READYTORUN
NESTED_ENTRY DelayLoad_MethodCall_FakeProlog
; Match what the lazy thunk has pushed. The actual method arguments will be spilled later.
PROLOG_PUSH {r1-r3}
; This is where execution really starts.
DelayLoad_MethodCall
EXPORT DelayLoad_MethodCall
PROLOG_PUSH {r0}
PROLOG_WITH_TRANSITION_BLOCK 0x0, {true}, DoNotPushArgRegs
; Load the helper arguments
ldr r5, [sp,#(__PWTB_TransitionBlock+10*4)] ; pModule
ldr r6, [sp,#(__PWTB_TransitionBlock+11*4)] ; sectionIndex
ldr r7, [sp,#(__PWTB_TransitionBlock+12*4)] ; indirection
; Spill the actual method arguments
str r1, [sp,#(__PWTB_TransitionBlock+10*4)]
str r2, [sp,#(__PWTB_TransitionBlock+11*4)]
str r3, [sp,#(__PWTB_TransitionBlock+12*4)]
add r0, sp, #__PWTB_TransitionBlock ; pTransitionBlock
mov r1, r7 ; pIndirection
mov r2, r6 ; sectionIndex
mov r3, r5 ; pModule
bl ExternalMethodFixupWorker
; mov the address we patched to in R12 so that we can tail call to it
mov r12, r0
EPILOG_WITH_TRANSITION_BLOCK_TAILCALL
; Share the patch label
EPILOG_BRANCH ExternalMethodFixupPatchLabel
NESTED_END
MACRO
DynamicHelper $frameFlags, $suffix
GBLS __FakePrologName
__FakePrologName SETS "DelayLoad_Helper":CC:"$suffix":CC:"_FakeProlog"
NESTED_ENTRY $__FakePrologName
; Match what the lazy thunk has pushed. The actual method arguments will be spilled later.
PROLOG_PUSH {r1-r3}
GBLS __RealName
__RealName SETS "DelayLoad_Helper":CC:"$suffix"
; This is where execution really starts.
$__RealName
EXPORT $__RealName
PROLOG_PUSH {r0}
PROLOG_WITH_TRANSITION_BLOCK 0x4, {false}, DoNotPushArgRegs
; Load the helper arguments
ldr r5, [sp,#(__PWTB_TransitionBlock+10*4)] ; pModule
ldr r6, [sp,#(__PWTB_TransitionBlock+11*4)] ; sectionIndex
ldr r7, [sp,#(__PWTB_TransitionBlock+12*4)] ; indirection
; Spill the actual method arguments
str r1, [sp,#(__PWTB_TransitionBlock+10*4)]
str r2, [sp,#(__PWTB_TransitionBlock+11*4)]
str r3, [sp,#(__PWTB_TransitionBlock+12*4)]
add r0, sp, #__PWTB_TransitionBlock ; pTransitionBlock
mov r1, r7 ; pIndirection
mov r2, r6 ; sectionIndex
mov r3, r5 ; pModule
mov r4, $frameFlags
str r4, [sp,#0]
bl DynamicHelperWorker
cbnz r0, %FT0
ldr r0, [sp,#(__PWTB_TransitionBlock+9*4)] ; The result is stored in the argument area of the transition block
EPILOG_WITH_TRANSITION_BLOCK_RETURN
0
mov r12, r0
EPILOG_WITH_TRANSITION_BLOCK_TAILCALL
EPILOG_BRANCH_REG r12
NESTED_END
MEND
DynamicHelper DynamicHelperFrameFlags_Default
DynamicHelper DynamicHelperFrameFlags_ObjectArg, _Obj
DynamicHelper DynamicHelperFrameFlags_ObjectArg | DynamicHelperFrameFlags_ObjectArg2, _ObjObj
#endif // FEATURE_READYTORUN
;;-----------------------------------------------------------------------------
;; The following helper will access ("probe") a word on each page of the stack
;; starting with the page right beneath sp down to the one pointed to by r4.
;; The procedure is needed to make sure that the "guard" page is pushed down below the allocated stack frame.
;; The call to the helper will be emitted by JIT in the function/funclet prolog when large (larger than 0x3000 bytes) stack frame is required.
;;-----------------------------------------------------------------------------
; On entry:
; r4 - points to the lowest address on the stack frame being allocated (i.e. [InitialSp - FrameSize])
; sp - points to some byte on the last probed page
; On exit:
; r4 - is preserved
; r5 - is not preserved
;
; NOTE: this helper will probe at least one page below the one pointed to by sp.
#define PAGE_SIZE_LOG2 12
LEAF_ENTRY JIT_StackProbe
PROLOG_PUSH {r7}
PROLOG_STACK_SAVE r7
mov r5, sp ; r5 points to some byte on the last probed page
bfc r5, #0, #PAGE_SIZE_LOG2 ; r5 points to the **lowest address** on the last probed page
mov sp, r5
ProbeLoop
; Immediate operand for the following instruction can not be greater than 4095.
sub sp, #(PAGE_SIZE - 4) ; sp points to the **fourth** byte on the **next page** to probe
ldr r5, [sp, #-4]! ; sp points to the lowest address on the **last probed** page
cmp sp, r4
bhi ProbeLoop ; if (sp > r4), then we need to probe at least one more page.
EPILOG_STACK_RESTORE r7
EPILOG_POP {r7}
EPILOG_BRANCH_REG lr
LEAF_END_MARKED JIT_StackProbe
#ifdef FEATURE_TIERED_COMPILATION
IMPORT OnCallCountThresholdReached
NESTED_ENTRY OnCallCountThresholdReachedStub
PROLOG_WITH_TRANSITION_BLOCK
add r0, sp, #__PWTB_TransitionBlock ; TransitionBlock *
mov r1, r12 ; stub-identifying token
bl OnCallCountThresholdReached
mov r12, r0
EPILOG_WITH_TRANSITION_BLOCK_TAILCALL
EPILOG_BRANCH_REG r12
NESTED_END
#endif ; FEATURE_TIERED_COMPILATION
; Must be at very end of file
END
|
; Listing generated by Microsoft (R) Optimizing Compiler Version 19.16.27026.1
include listing.inc
INCLUDELIB MSVCRT
INCLUDELIB OLDNAMES
PUBLIC DllMain
EXTRN AllocateHeapArea:PROC
EXTRN DeallocateHeapArea:PROC
; COMDAT pdata
pdata SEGMENT
$pdata$DllMain DD imagerel $LN15
DD imagerel $LN15+59
DD imagerel $unwind$DllMain
pdata ENDS
; COMDAT xdata
xdata SEGMENT
$unwind$DllMain DD 010401H
DD 04204H
xdata ENDS
; Function compile flags: /Ogtpy
; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\dllmain.c
; COMDAT DllMain
_TEXT SEGMENT
hinstDLL$ = 48
dwReason$ = 56
lpvReserved$ = 64
DllMain PROC ; COMDAT
; 42 : {
$LN15:
sub rsp, 40 ; 00000028H
; 43 : BOOL result = TRUE;
; 44 : switch (dwReason)
test edx, edx
je SHORT $LN8@DllMain
sub edx, 1
je SHORT $LN4@DllMain
sub edx, 1
je SHORT $LN13@DllMain
cmp edx, 1
je SHORT $LN13@DllMain
; 59 : break;
; 60 : default:
; 61 : result = FALSE;
; 62 : break;
; 63 : }
; 64 : return (result);
xor eax, eax
; 65 : }
add rsp, 40 ; 00000028H
ret 0
$LN4@DllMain:
; 45 : {
; 46 : case DLL_PROCESS_ATTACH: // DLLがプロセスのアドレス空間にマッピングされた。
; 47 : if (!AllocateHeapArea())
call AllocateHeapArea
test eax, eax
jne SHORT $LN13@DllMain
; 65 : }
add rsp, 40 ; 00000028H
ret 0
$LN8@DllMain:
; 48 : result = FALSE;
; 49 : break;
; 50 :
; 51 : case DLL_THREAD_ATTACH: // スレッドが作成されようとしている。
; 52 : break;
; 53 :
; 54 : case DLL_THREAD_DETACH: // スレッドが破棄されようとしている。
; 55 : break;
; 56 :
; 57 : case DLL_PROCESS_DETACH: // DLLのマッピングが解除されようとしている。
; 58 : DeallocateHeapArea();
call DeallocateHeapArea
$LN13@DllMain:
; 65 : }
mov eax, 1
add rsp, 40 ; 00000028H
ret 0
DllMain ENDP
_TEXT ENDS
END
|
; A006357: Number of distributive lattices; also number of paths with n turns when light is reflected from 4 glass plates.
; 1,4,10,30,85,246,707,2037,5864,16886,48620,139997,403104,1160693,3342081,9623140,27708726,79784098,229729153,661478734,1904652103,5484227157,15791202736,45468956106,130922641160,376976720745,1085461206128,3125460977225,8999406210929,25912757426660,74612811302754,214839027697334,618604325665341,1781200165693270,5128761469382475,14767680082482085,42521840081752984,122436758775876478,352542596245147348,1015105948653689061,2922881087185190704,8416100665310424765,24233196047277585233
add $0,1
mov $1,1
lpb $0
mov $2,$0
sub $0,2
seq $2,123941 ; The (1,2)-entry in the 3 X 3 matrix M^n, where M = {{2, 1, 1}, {1, 1, 0}, {1, 0, 0}}.
add $1,$2
lpe
mov $0,$1
|
; A269161: Formula for Wolfram's Rule 86 cellular automaton: a(n) = 4n XOR (2n OR n).
; Submitted by Simon Strandgaard
; 0,7,14,11,28,27,22,19,56,63,54,51,44,43,38,35,112,119,126,123,108,107,102,99,88,95,86,83,76,75,70,67,224,231,238,235,252,251,246,243,216,223,214,211,204,203,198,195,176,183,190,187,172,171,166,163,152,159,150,147,140,139,134,131,448,455,462,459,476,475,470,467,504,511,502,499,492,491,486,483,432,439,446,443,428,427,422,419,408,415,406,403,396,395,390,387,352,359,366,363
mov $2,$0
mul $0,4
seq $2,163617 ; a(2*n) = 2*a(n), a(2*n + 1) = 2*a(n) + 2 + (-1)^n, for all n in Z.
mov $4,1
lpb $0
mov $3,$0
div $0,2
add $3,$2
mod $3,2
mul $3,$4
add $1,$3
div $2,2
mul $4,2
lpe
mov $0,$1
|
/*
* Copyright 2004 The WebRTC Project Authors. All rights reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "rtc_base/stringencode.h"
#include "rtc_base/arraysize.h"
#include "rtc_base/gunit.h"
#include "rtc_base/stringutils.h"
namespace rtc {
class HexEncodeTest : public testing::Test {
public:
HexEncodeTest() : enc_res_(0), dec_res_(0) {
for (size_t i = 0; i < sizeof(data_); ++i) {
data_[i] = (i + 128) & 0xff;
}
memset(decoded_, 0x7f, sizeof(decoded_));
}
char data_[10];
char encoded_[31];
char decoded_[11];
size_t enc_res_;
size_t dec_res_;
};
// Test that we can convert to/from hex with no delimiter.
TEST_F(HexEncodeTest, TestWithNoDelimiter) {
enc_res_ = hex_encode(encoded_, sizeof(encoded_), data_, sizeof(data_));
ASSERT_EQ(sizeof(data_) * 2, enc_res_);
ASSERT_STREQ("80818283848586878889", encoded_);
dec_res_ = hex_decode(decoded_, sizeof(decoded_), encoded_, enc_res_);
ASSERT_EQ(sizeof(data_), dec_res_);
ASSERT_EQ(0, memcmp(data_, decoded_, dec_res_));
}
// Test that we can convert to/from hex with a colon delimiter.
TEST_F(HexEncodeTest, TestWithDelimiter) {
enc_res_ = hex_encode_with_delimiter(encoded_, sizeof(encoded_), data_,
sizeof(data_), ':');
ASSERT_EQ(sizeof(data_) * 3 - 1, enc_res_);
ASSERT_STREQ("80:81:82:83:84:85:86:87:88:89", encoded_);
dec_res_ = hex_decode_with_delimiter(decoded_, sizeof(decoded_), encoded_,
enc_res_, ':');
ASSERT_EQ(sizeof(data_), dec_res_);
ASSERT_EQ(0, memcmp(data_, decoded_, dec_res_));
}
// Test that encoding with one delimiter and decoding with another fails.
TEST_F(HexEncodeTest, TestWithWrongDelimiter) {
enc_res_ = hex_encode_with_delimiter(encoded_, sizeof(encoded_), data_,
sizeof(data_), ':');
ASSERT_EQ(sizeof(data_) * 3 - 1, enc_res_);
dec_res_ = hex_decode_with_delimiter(decoded_, sizeof(decoded_), encoded_,
enc_res_, '/');
ASSERT_EQ(0U, dec_res_);
}
// Test that encoding without a delimiter and decoding with one fails.
TEST_F(HexEncodeTest, TestExpectedDelimiter) {
enc_res_ = hex_encode(encoded_, sizeof(encoded_), data_, sizeof(data_));
ASSERT_EQ(sizeof(data_) * 2, enc_res_);
dec_res_ = hex_decode_with_delimiter(decoded_, sizeof(decoded_), encoded_,
enc_res_, ':');
ASSERT_EQ(0U, dec_res_);
}
// Test that encoding with a delimiter and decoding without one fails.
TEST_F(HexEncodeTest, TestExpectedNoDelimiter) {
enc_res_ = hex_encode_with_delimiter(encoded_, sizeof(encoded_), data_,
sizeof(data_), ':');
ASSERT_EQ(sizeof(data_) * 3 - 1, enc_res_);
dec_res_ = hex_decode(decoded_, sizeof(decoded_), encoded_, enc_res_);
ASSERT_EQ(0U, dec_res_);
}
// Test that we handle a zero-length buffer with no delimiter.
TEST_F(HexEncodeTest, TestZeroLengthNoDelimiter) {
enc_res_ = hex_encode(encoded_, sizeof(encoded_), "", 0);
ASSERT_EQ(0U, enc_res_);
dec_res_ = hex_decode(decoded_, sizeof(decoded_), encoded_, enc_res_);
ASSERT_EQ(0U, dec_res_);
}
// Test that we handle a zero-length buffer with a delimiter.
TEST_F(HexEncodeTest, TestZeroLengthWithDelimiter) {
enc_res_ = hex_encode_with_delimiter(encoded_, sizeof(encoded_), "", 0, ':');
ASSERT_EQ(0U, enc_res_);
dec_res_ = hex_decode_with_delimiter(decoded_, sizeof(decoded_), encoded_,
enc_res_, ':');
ASSERT_EQ(0U, dec_res_);
}
// Test the std::string variants that take no delimiter.
TEST_F(HexEncodeTest, TestHelpersNoDelimiter) {
std::string result = hex_encode(data_, sizeof(data_));
ASSERT_EQ("80818283848586878889", result);
dec_res_ = hex_decode(decoded_, sizeof(decoded_), result);
ASSERT_EQ(sizeof(data_), dec_res_);
ASSERT_EQ(0, memcmp(data_, decoded_, dec_res_));
}
// Test the std::string variants that use a delimiter.
TEST_F(HexEncodeTest, TestHelpersWithDelimiter) {
std::string result = hex_encode_with_delimiter(data_, sizeof(data_), ':');
ASSERT_EQ("80:81:82:83:84:85:86:87:88:89", result);
dec_res_ = hex_decode_with_delimiter(decoded_, sizeof(decoded_), result, ':');
ASSERT_EQ(sizeof(data_), dec_res_);
ASSERT_EQ(0, memcmp(data_, decoded_, dec_res_));
}
// Test that encoding into a too-small output buffer (without delimiter) fails.
TEST_F(HexEncodeTest, TestEncodeTooShort) {
enc_res_ = hex_encode_with_delimiter(encoded_, sizeof(data_) * 2, data_,
sizeof(data_), 0);
ASSERT_EQ(0U, enc_res_);
}
// Test that encoding into a too-small output buffer (with delimiter) fails.
TEST_F(HexEncodeTest, TestEncodeWithDelimiterTooShort) {
enc_res_ = hex_encode_with_delimiter(encoded_, sizeof(data_) * 3 - 1, data_,
sizeof(data_), ':');
ASSERT_EQ(0U, enc_res_);
}
// Test that decoding into a too-small output buffer fails.
TEST_F(HexEncodeTest, TestDecodeTooShort) {
dec_res_ = hex_decode_with_delimiter(decoded_, 4, "0123456789", 10, 0);
ASSERT_EQ(0U, dec_res_);
ASSERT_EQ(0x7f, decoded_[4]);
}
// Test that decoding non-hex data fails.
TEST_F(HexEncodeTest, TestDecodeBogusData) {
dec_res_ = hex_decode_with_delimiter(decoded_, sizeof(decoded_), "xyz", 3, 0);
ASSERT_EQ(0U, dec_res_);
}
// Test that decoding an odd number of hex characters fails.
TEST_F(HexEncodeTest, TestDecodeOddHexDigits) {
dec_res_ = hex_decode_with_delimiter(decoded_, sizeof(decoded_), "012", 3, 0);
ASSERT_EQ(0U, dec_res_);
}
// Test that decoding a string with too many delimiters fails.
TEST_F(HexEncodeTest, TestDecodeWithDelimiterTooManyDelimiters) {
dec_res_ = hex_decode_with_delimiter(decoded_, 4, "01::23::45::67", 14, ':');
ASSERT_EQ(0U, dec_res_);
}
// Test that decoding a string with a leading delimiter fails.
TEST_F(HexEncodeTest, TestDecodeWithDelimiterLeadingDelimiter) {
dec_res_ = hex_decode_with_delimiter(decoded_, 4, ":01:23:45:67", 12, ':');
ASSERT_EQ(0U, dec_res_);
}
// Test that decoding a string with a trailing delimiter fails.
TEST_F(HexEncodeTest, TestDecodeWithDelimiterTrailingDelimiter) {
dec_res_ = hex_decode_with_delimiter(decoded_, 4, "01:23:45:67:", 12, ':');
ASSERT_EQ(0U, dec_res_);
}
// Tests counting substrings.
TEST(TokenizeTest, CountSubstrings) {
std::vector<std::string> fields;
EXPECT_EQ(5ul, tokenize("one two three four five", ' ', &fields));
fields.clear();
EXPECT_EQ(1ul, tokenize("one", ' ', &fields));
// Extra spaces should be ignored.
fields.clear();
EXPECT_EQ(5ul, tokenize(" one two three four five ", ' ', &fields));
fields.clear();
EXPECT_EQ(1ul, tokenize(" one ", ' ', &fields));
fields.clear();
EXPECT_EQ(0ul, tokenize(" ", ' ', &fields));
}
// Tests comparing substrings.
TEST(TokenizeTest, CompareSubstrings) {
std::vector<std::string> fields;
tokenize("find middle one", ' ', &fields);
ASSERT_EQ(3ul, fields.size());
ASSERT_STREQ("middle", fields.at(1).c_str());
fields.clear();
// Extra spaces should be ignored.
tokenize(" find middle one ", ' ', &fields);
ASSERT_EQ(3ul, fields.size());
ASSERT_STREQ("middle", fields.at(1).c_str());
fields.clear();
tokenize(" ", ' ', &fields);
ASSERT_EQ(0ul, fields.size());
}
TEST(TokenizeTest, TokenizeAppend) {
ASSERT_EQ(0ul, tokenize_append("A B C", ' ', nullptr));
std::vector<std::string> fields;
tokenize_append("A B C", ' ', &fields);
ASSERT_EQ(3ul, fields.size());
ASSERT_STREQ("B", fields.at(1).c_str());
tokenize_append("D E", ' ', &fields);
ASSERT_EQ(5ul, fields.size());
ASSERT_STREQ("B", fields.at(1).c_str());
ASSERT_STREQ("E", fields.at(4).c_str());
}
TEST(TokenizeTest, TokenizeWithMarks) {
ASSERT_EQ(0ul, tokenize("D \"A B", ' ', '(', ')', nullptr));
std::vector<std::string> fields;
tokenize("A B C", ' ', '"', '"', &fields);
ASSERT_EQ(3ul, fields.size());
ASSERT_STREQ("C", fields.at(2).c_str());
tokenize("\"A B\" C", ' ', '"', '"', &fields);
ASSERT_EQ(2ul, fields.size());
ASSERT_STREQ("A B", fields.at(0).c_str());
tokenize("D \"A B\" C", ' ', '"', '"', &fields);
ASSERT_EQ(3ul, fields.size());
ASSERT_STREQ("D", fields.at(0).c_str());
ASSERT_STREQ("A B", fields.at(1).c_str());
tokenize("D \"A B\" C \"E F\"", ' ', '"', '"', &fields);
ASSERT_EQ(4ul, fields.size());
ASSERT_STREQ("D", fields.at(0).c_str());
ASSERT_STREQ("A B", fields.at(1).c_str());
ASSERT_STREQ("E F", fields.at(3).c_str());
// No matching marks.
tokenize("D \"A B", ' ', '"', '"', &fields);
ASSERT_EQ(3ul, fields.size());
ASSERT_STREQ("D", fields.at(0).c_str());
ASSERT_STREQ("\"A", fields.at(1).c_str());
tokenize("D (A B) C (E F) G", ' ', '(', ')', &fields);
ASSERT_EQ(5ul, fields.size());
ASSERT_STREQ("D", fields.at(0).c_str());
ASSERT_STREQ("A B", fields.at(1).c_str());
ASSERT_STREQ("E F", fields.at(3).c_str());
}
TEST(TokenizeTest, TokenizeWithEmptyTokens) {
std::vector<std::string> fields;
EXPECT_EQ(3ul, tokenize_with_empty_tokens("a.b.c", '.', &fields));
EXPECT_EQ("a", fields[0]);
EXPECT_EQ("b", fields[1]);
EXPECT_EQ("c", fields[2]);
EXPECT_EQ(3ul, tokenize_with_empty_tokens("..c", '.', &fields));
EXPECT_TRUE(fields[0].empty());
EXPECT_TRUE(fields[1].empty());
EXPECT_EQ("c", fields[2]);
EXPECT_EQ(1ul, tokenize_with_empty_tokens("", '.', &fields));
EXPECT_TRUE(fields[0].empty());
}
TEST(TokenizeFirstTest, NoLeadingSpaces) {
std::string token;
std::string rest;
ASSERT_TRUE(tokenize_first("A &*${}", ' ', &token, &rest));
ASSERT_STREQ("A", token.c_str());
ASSERT_STREQ("&*${}", rest.c_str());
ASSERT_TRUE(tokenize_first("A B& *${}", ' ', &token, &rest));
ASSERT_STREQ("A", token.c_str());
ASSERT_STREQ("B& *${}", rest.c_str());
ASSERT_TRUE(tokenize_first("A B& *${} ", ' ', &token, &rest));
ASSERT_STREQ("A", token.c_str());
ASSERT_STREQ("B& *${} ", rest.c_str());
}
TEST(TokenizeFirstTest, LeadingSpaces) {
std::string token;
std::string rest;
ASSERT_TRUE(tokenize_first(" A B C", ' ', &token, &rest));
ASSERT_STREQ("", token.c_str());
ASSERT_STREQ("A B C", rest.c_str());
ASSERT_TRUE(tokenize_first(" A B C ", ' ', &token, &rest));
ASSERT_STREQ("", token.c_str());
ASSERT_STREQ("A B C ", rest.c_str());
}
TEST(TokenizeFirstTest, SingleToken) {
std::string token;
std::string rest;
// In the case where we cannot find delimiter the whole string is a token.
ASSERT_FALSE(tokenize_first("ABC", ' ', &token, &rest));
ASSERT_TRUE(tokenize_first("ABC ", ' ', &token, &rest));
ASSERT_STREQ("ABC", token.c_str());
ASSERT_STREQ("", rest.c_str());
ASSERT_TRUE(tokenize_first(" ABC ", ' ', &token, &rest));
ASSERT_STREQ("", token.c_str());
ASSERT_STREQ("ABC ", rest.c_str());
}
// Tests counting substrings.
TEST(SplitTest, CountSubstrings) {
std::vector<std::string> fields;
EXPECT_EQ(5ul, split("one,two,three,four,five", ',', &fields));
fields.clear();
EXPECT_EQ(1ul, split("one", ',', &fields));
// Empty fields between commas count.
fields.clear();
EXPECT_EQ(5ul, split("one,,three,four,five", ',', &fields));
fields.clear();
EXPECT_EQ(3ul, split(",three,", ',', &fields));
fields.clear();
EXPECT_EQ(1ul, split("", ',', &fields));
}
// Tests comparing substrings.
TEST(SplitTest, CompareSubstrings) {
std::vector<std::string> fields;
split("find,middle,one", ',', &fields);
ASSERT_EQ(3ul, fields.size());
ASSERT_STREQ("middle", fields.at(1).c_str());
fields.clear();
// Empty fields between commas count.
split("find,,middle,one", ',', &fields);
ASSERT_EQ(4ul, fields.size());
ASSERT_STREQ("middle", fields.at(2).c_str());
fields.clear();
split("", ',', &fields);
ASSERT_EQ(1ul, fields.size());
ASSERT_STREQ("", fields.at(0).c_str());
}
TEST(BoolTest, DecodeValid) {
bool value;
EXPECT_TRUE(FromString("true", &value));
EXPECT_TRUE(value);
EXPECT_TRUE(FromString("true,", &value));
EXPECT_TRUE(value);
EXPECT_TRUE(FromString("true , true", &value));
EXPECT_TRUE(value);
EXPECT_TRUE(FromString("true ,\n false", &value));
EXPECT_TRUE(value);
EXPECT_TRUE(FromString(" true \n", &value));
EXPECT_TRUE(value);
EXPECT_TRUE(FromString("false", &value));
EXPECT_FALSE(value);
EXPECT_TRUE(FromString(" false ", &value));
EXPECT_FALSE(value);
EXPECT_TRUE(FromString(" false, ", &value));
EXPECT_FALSE(value);
EXPECT_TRUE(FromString<bool>("true\n"));
EXPECT_FALSE(FromString<bool>("false\n"));
}
TEST(BoolTest, DecodeInvalid) {
bool value;
EXPECT_FALSE(FromString("True", &value));
EXPECT_FALSE(FromString("TRUE", &value));
EXPECT_FALSE(FromString("False", &value));
EXPECT_FALSE(FromString("FALSE", &value));
EXPECT_FALSE(FromString("0", &value));
EXPECT_FALSE(FromString("1", &value));
EXPECT_FALSE(FromString("0,", &value));
EXPECT_FALSE(FromString("1,", &value));
EXPECT_FALSE(FromString("1,0", &value));
EXPECT_FALSE(FromString("1.", &value));
EXPECT_FALSE(FromString("1.0", &value));
EXPECT_FALSE(FromString("", &value));
EXPECT_FALSE(FromString<bool>("false\nfalse"));
}
TEST(BoolTest, RoundTrip) {
bool value;
EXPECT_TRUE(FromString(ToString(true), &value));
EXPECT_TRUE(value);
EXPECT_TRUE(FromString(ToString(false), &value));
EXPECT_FALSE(value);
}
} // namespace rtc
|
; A315738: Coordination sequence Gal.6.343.6 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings.
; Submitted by Simon Strandgaard
; 1,6,12,18,23,27,32,37,41,46,52,58,64,70,76,82,87,91,96,101,105,110,116,122,128,134,140,146,151,155,160,165,169,174,180,186,192,198,204,210,215,219,224,229,233,238,244,250,256,262
mov $1,$0
seq $0,315741 ; Coordination sequence Gal.6.210.5 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings.
mul $0,4
add $0,1
div $0,3
mul $1,2
sub $0,$1
|
; $Id: VBoxHlp.asm $
;; @file
; VBox Qt GUI - Implementation of OS/2-specific helpers that require to reside in a DLL.
;
; This stub is used to avoid linking the helper DLL to the C runtime.
;
;
; Copyright (C) 2008-2017 Oracle Corporation
;
; This file is part of VirtualBox Open Source Edition (OSE), as
; available from http://www.virtualbox.org. This file is free software;
; you can redistribute it and/or modify it under the terms of the GNU
; General Public License (GPL) as published by the Free Software
; Foundation, in version 2 as it comes in the "COPYING" file of the
; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
;
;; @todo BEGINCODE gives us this:
;
; 02-03-2008 22:19:37 SYS3175 PID 4383 TID 0001 Slot 0076
; D:\CODING\INNOTEK\VBOX\OUT\OS2.X86\RELEASE\BIN\VIRTUALBOX.EXE
; c0000005
; 17d40000
; P1=00000008 P2=0000bea4 P3=XXXXXXXX P4=XXXXXXXX
; EAX=00001489 EBX=00000000 ECX=00000000 EDX=00000000
; ESI=00000000 EDI=00001489
; DS=be7f DSACC=00f3 DSLIM=0000003f
; ES=0053 ESACC=f0f3 ESLIM=ffffffff
; FS=150b FSACC=00f3 FSLIM=00000030
; GS=0000 GSACC=**** GSLIM=********
; CS:EIP=bea7:00000000 CSACC=00f2 CSLIM=00000002
; SS:ESP=01d7:0000ffe8 SSACC=00f3 SSLIM=0000ffff
; EBP=00000000 FLG=00012202
;
; VBOXHLP.DLL 0003:00000000
;
; Looks like the previous 'segment TEXT32 ...' definition in asmdefs.mac
; is ignored and the segment is redefined as if it had no 'CLASS=CODE...'
; attributes...
;%include "iprt/asmdefs.mac"
;
;BEGINCODE
segment TEXT32 public CLASS=CODE align=16 use32 flat
extern _DLL_InitTerm
; Low-level DLL entry point - Forward to the C code.
..start:
jmp _DLL_InitTerm
; emxomfld may generate references to this for weak symbols. It is usually
; found in in libend.lib.
ABSOLUTE 0
global WEAK$ZERO
WEAK$ZERO:
|
; A070379: a(n) = 5^n mod 29.
; 1,5,25,9,16,22,23,28,24,4,20,13,7,6,1,5,25,9,16,22,23,28,24,4,20,13,7,6,1,5,25,9,16,22,23,28,24,4,20,13,7,6,1,5,25,9,16,22,23,28,24,4,20,13,7,6,1,5,25,9,16,22,23,28,24,4,20,13,7,6,1,5,25,9,16,22,23,28,24,4,20,13,7,6,1,5,25,9,16,22,23,28,24,4,20,13,7,6,1,5,25,9,16,22,23,28,24,4,20,13,7,6,1,5,25,9,16,22,23,28,24,4,20,13,7,6,1,5,25,9,16,22,23,28,24,4,20,13,7,6,1,5,25,9,16,22,23,28,24,4,20,13,7,6,1,5,25,9,16,22,23,28,24,4,20,13,7,6,1,5,25,9,16,22,23,28,24,4,20,13,7,6,1,5,25,9,16,22,23,28,24,4,20,13,7,6,1,5,25,9,16,22,23,28,24,4,20,13,7,6,1,5,25,9,16,22,23,28,24,4,20,13,7,6,1,5,25,9,16,22,23,28,24,4,20,13,7,6,1,5,25,9,16,22,23,28,24,4,20,13
mov $1,1
mov $2,$0
lpb $2,1
mul $1,5
mod $1,29
sub $2,1
lpe
|
db 0 ; species ID placeholder
db 144, 120, 60, 50, 40, 60
; hp atk def spd sat sdf
db FIGHTING, FIGHTING ; type
db 200 ; catch rate
db 184 ; base exp
db NO_ITEM, KINGS_ROCK ; items
db GENDER_F25 ; gender ratio
db 100 ; unknown 1
db 20 ; step cycles to hatch
db 5 ; unknown 2
INCBIN "gfx/pokemon/hariyama/front.dimensions"
db 0, 0, 0, 0 ; padding
db GROWTH_FLUCTUATING
dn EGG_HUMANSHAPE, EGG_HUMANSHAPE
; tm/hm learneset
tmhm DYNAMICPUNCH, HEADBUTT, CURSE, TOXIC, ROCK_SMASH, HIDDEN_POWER, SUNNY_DAY, SNORE, HYPER_BEAM, PROTECT, RAIN_DANCE, ENDURE, FRUSTRATION, EARTHQUAKE, RETURN, DIG, MUD_SLAP, DOUBLE_TEAM, ICE_PUNCH, SWAGGER, SLEEP_TALK, THUNDERPUNCH, DETECT, REST, ATTRACT, FIRE_PUNCH, SURF, STRENGTH, WHIRLPOOL
; end
|
;
; NewBrain driver support file, used by "open" and "close"
;
; Stefano - 29/5/2007
;
; $Id: nbhandl.asm,v 1.3 2016/06/19 20:26:58 dom Exp $
SECTION bss_clib
PUBLIC nbhandl
; handles:
; 10 files open at once should be enough.
; we use stream numbers startimg from 100
;
; 100 101 102 103 104 105 106 107 108 109
.nbhandl defs 10
|
/*
* Copyright 2016 The Cartographer Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <turtlebot3_slam/flat_world_imu_node.h>
FlatWorldImuNode::FlatWorldImuNode()
{
bool init_result = init();
ROS_ASSERT(init_result);
}
FlatWorldImuNode::~FlatWorldImuNode()
{
}
bool FlatWorldImuNode::init()
{
publisher_ = nh_.advertise<sensor_msgs::Imu>("imu_out", 10);
subscriber_ = nh_.subscribe("imu_in", 150, &FlatWorldImuNode::msgCallback, this);
return true;
}
void FlatWorldImuNode::msgCallback(const sensor_msgs::ImuConstPtr imu_in)
{
if (last_published_time_.isZero() || imu_in->header.stamp > last_published_time_)
{
last_published_time_ = imu_in->header.stamp;
sensor_msgs::Imu imu_out = *imu_in;
imu_out.linear_acceleration.x = 0.0;
imu_out.linear_acceleration.y = 0.0;
imu_out.linear_acceleration.z = GRAVITY;
publisher_.publish(imu_out);
}
}
int main(int argc, char* argv[])
{
ros::init(argc, argv, "flat_world_imu_node");
FlatWorldImuNode flat_world_imu_node;
ros::spin();
return 0;
}
|
;
; long fdtell(int fd, long posn, int whence)
;
; Set position in file
;
; Not written as yet!
;
; $Id: lseek.asm,v 1.2 2015/01/21 08:09:27 stefano Exp $
PUBLIC lseek
.lseek
ld hl,-1
ld d,h
ld e,l
ret
|
// Copyright (c) 2020 The Orbit 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 "ClientData/ModuleManager.h"
#include <absl/container/flat_hash_map.h>
#include <algorithm>
#include <filesystem>
#include <map>
#include <utility>
#include <vector>
#include "ClientData/ModuleData.h"
#include "ObjectUtils/Address.h"
#include "OrbitBase/Logging.h"
#include "absl/synchronization/mutex.h"
#include "capture_data.pb.h"
using orbit_client_protos::FunctionInfo;
namespace orbit_client_data {
std::vector<ModuleData*> ModuleManager::AddOrUpdateModules(
absl::Span<const orbit_grpc_protos::ModuleInfo> module_infos) {
absl::MutexLock lock(&mutex_);
std::vector<ModuleData*> unloaded_modules;
for (const auto& module_info : module_infos) {
auto module_id = std::make_pair(module_info.file_path(), module_info.build_id());
auto module_it = module_map_.find(module_id);
if (module_it == module_map_.end()) {
const bool success = module_map_.try_emplace(module_id, module_info).second;
CHECK(success);
} else {
ModuleData& module = module_it->second;
if (module.UpdateIfChangedAndUnload(module_info)) {
unloaded_modules.push_back(&module);
}
}
}
return unloaded_modules;
}
std::vector<ModuleData*> ModuleManager::AddOrUpdateNotLoadedModules(
absl::Span<const orbit_grpc_protos::ModuleInfo> module_infos) {
absl::MutexLock lock(&mutex_);
std::vector<ModuleData*> not_updated_modules;
for (const auto& module_info : module_infos) {
auto module_id = std::make_pair(module_info.file_path(), module_info.build_id());
auto module_it = module_map_.find(module_id);
if (module_it == module_map_.end()) {
const bool success = module_map_.try_emplace(module_id, module_info).second;
CHECK(success);
} else {
ModuleData& module = module_it->second;
if (!module.UpdateIfChangedAndNotLoaded(module_info)) {
not_updated_modules.push_back(&module);
}
}
}
return not_updated_modules;
}
const ModuleData* ModuleManager::GetModuleByModuleInMemoryAndAbsoluteAddress(
const ModuleInMemory& module_in_memory, uint64_t absolute_address) const {
absl::MutexLock lock(&mutex_);
auto it =
module_map_.find(std::make_pair(module_in_memory.file_path(), module_in_memory.build_id()));
if (it == module_map_.end()) return nullptr;
// The valid absolute address should be >=
// module_base_address + (executable_segment_offset % kPageSize)
if (absolute_address < module_in_memory.start() + (it->second.executable_segment_offset() %
orbit_object_utils::kPageSize)) {
return nullptr;
}
return &it->second;
}
ModuleData* ModuleManager::GetMutableModuleByModuleInMemoryAndAbsoluteAddress(
const ModuleInMemory& module_in_memory, uint64_t absolute_address) {
absl::MutexLock lock(&mutex_);
auto it =
module_map_.find(std::make_pair(module_in_memory.file_path(), module_in_memory.build_id()));
if (it == module_map_.end()) return nullptr;
// The valid absolute address should be >=
// module_base_address + (executable_segment_offset % kPageSize)
if (absolute_address < module_in_memory.start() + (it->second.executable_segment_offset() %
orbit_object_utils::kPageSize)) {
return nullptr;
}
return &it->second;
}
const ModuleData* ModuleManager::GetModuleByPathAndBuildId(const std::string& path,
const std::string& build_id) const {
absl::MutexLock lock(&mutex_);
auto it = module_map_.find(std::make_pair(path, build_id));
if (it == module_map_.end()) return nullptr;
return &it->second;
}
ModuleData* ModuleManager::GetMutableModuleByPathAndBuildId(const std::string& path,
const std::string& build_id) {
absl::MutexLock lock(&mutex_);
auto it = module_map_.find(std::make_pair(path, build_id));
if (it == module_map_.end()) return nullptr;
return &it->second;
}
std::vector<const ModuleData*> ModuleManager::GetAllModuleData() const {
absl::MutexLock lock(&mutex_);
std::vector<const ModuleData*> result;
for (const auto& [unused_pair, module_data] : module_map_) {
result.push_back(&module_data);
}
return result;
}
std::vector<const ModuleData*> ModuleManager::GetModulesByFilename(
const std::string& filename) const {
absl::MutexLock lock(&mutex_);
std::vector<const ModuleData*> result;
for (const auto& [path_build_id_pair, module_data] : module_map_) {
const std::string& file_path = path_build_id_pair.first;
if (std::filesystem::path(file_path).filename().string() == filename) {
result.push_back(&module_data);
}
}
return result;
}
} // namespace orbit_client_data
|
;0x215336C
MenuKartIDOrder:
dcd 0x02, 0x00, 0x01, 0x16, 0x15,\
0x17, 0x0E, 0x0C, 0x0D, 0x13, \
0x12, 0x14, 0x07, 0x06, 0x08, \
0x05, 0x03, 0x04, 0x10, 0x0F, \
0x11, 0x0B, 0x09, 0x0A, 0x1D, \
0x1B, 0x1C, 0x1A, 0x18, 0x19, \
0x1F, 0x1E, 0x20, 0x22, 0x21, \
0x23, 0x24 |
; float atan2(float y, float x) __z88dk_callee
SECTION code_clib
SECTION code_fp_math48
PUBLIC cm48_sdccix_atan2_callee, l0_cm48_sdccix_atan2_callee
EXTERN am48_atan2, cm48_sdccixp_dcallee2, cm48_sdccixp_m482d
cm48_sdccix_atan2_callee:
call cm48_sdccixp_dcallee2
; AC'= y
; AC = x
l0_cm48_sdccix_atan2_callee:
exx
call am48_atan2
jp cm48_sdccixp_m482d
|
###############################################################################
# Copyright 2019 Intel Corporation
# All Rights Reserved.
#
# If this software was obtained under the Intel Simplified Software License,
# the following terms apply:
#
# The source code, information and material ("Material") contained herein is
# owned by Intel Corporation or its suppliers or licensors, and title to such
# Material remains with Intel Corporation or its suppliers or licensors. The
# Material contains proprietary information of Intel or its suppliers and
# licensors. The Material is protected by worldwide copyright laws and treaty
# provisions. No part of the Material may be used, copied, reproduced,
# modified, published, uploaded, posted, transmitted, distributed or disclosed
# in any way without Intel's prior express written permission. No license under
# any patent, copyright or other intellectual property rights in the Material
# is granted to or conferred upon you, either expressly, by implication,
# inducement, estoppel or otherwise. Any license under such intellectual
# property rights must be express and approved by Intel in writing.
#
# Unless otherwise agreed by Intel in writing, you may not remove or alter this
# notice or any other notice embedded in Materials by Intel or Intel's
# suppliers or licensors in any way.
#
#
# If this software was obtained under the Apache License, Version 2.0 (the
# "License"), the following terms apply:
#
# You may not use this file except in compliance with the License. You may
# obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
# See the License for the specific language governing permissions and
# limitations under the License.
###############################################################################
.text
.p2align 4, 0x90
.globl _UpdateSHA1
_UpdateSHA1:
push %ebp
mov %esp, %ebp
push %ebx
push %esi
push %edi
push %ebp
movl (20)(%ebp), %eax
movl (12)(%ebp), %esi
movl (16)(%ebp), %eax
movl (8)(%ebp), %edi
sub $(76), %esp
mov %edi, (64)(%esp)
.Lsha1_block_loopgas_1:
mov %esi, (68)(%esp)
mov %eax, (72)(%esp)
xor %ecx, %ecx
.Lloop1gas_1:
mov (%esi,%ecx,4), %eax
mov (4)(%esi,%ecx,4), %edx
bswap %eax
bswap %edx
mov %eax, (%esp,%ecx,4)
mov %edx, (4)(%esp,%ecx,4)
add $(2), %ecx
cmp $(16), %ecx
jl .Lloop1gas_1
mov (%edi), %eax
mov (4)(%edi), %ebx
mov (8)(%edi), %ecx
mov (12)(%edi), %edx
mov (16)(%edi), %ebp
mov %ecx, %edi
xor %edx, %edi
and %ebx, %edi
xor %edx, %edi
ror $(2), %ebx
mov %eax, %esi
rol $(5), %esi
add (%esp), %ebp
lea (1518500249)(%ebp,%edi), %ebp
add %esi, %ebp
mov (%esp), %esi
xor (8)(%esp), %esi
xor (32)(%esp), %esi
xor (52)(%esp), %esi
rol $(1), %esi
mov %esi, (%esp)
mov %ebx, %edi
xor %ecx, %edi
and %eax, %edi
xor %ecx, %edi
ror $(2), %eax
mov %ebp, %esi
rol $(5), %esi
add (4)(%esp), %edx
lea (1518500249)(%edi,%edx), %edx
add %esi, %edx
mov (4)(%esp), %esi
xor (12)(%esp), %esi
xor (36)(%esp), %esi
xor (56)(%esp), %esi
rol $(1), %esi
mov %esi, (4)(%esp)
mov %eax, %edi
xor %ebx, %edi
and %ebp, %edi
xor %ebx, %edi
ror $(2), %ebp
mov %edx, %esi
rol $(5), %esi
add (8)(%esp), %ecx
lea (1518500249)(%edi,%ecx), %ecx
add %esi, %ecx
mov (8)(%esp), %esi
xor (16)(%esp), %esi
xor (40)(%esp), %esi
xor (60)(%esp), %esi
rol $(1), %esi
mov %esi, (8)(%esp)
mov %ebp, %edi
xor %eax, %edi
and %edx, %edi
xor %eax, %edi
ror $(2), %edx
mov %ecx, %esi
rol $(5), %esi
add (12)(%esp), %ebx
lea (1518500249)(%edi,%ebx), %ebx
add %esi, %ebx
mov (12)(%esp), %esi
xor (20)(%esp), %esi
xor (44)(%esp), %esi
xor (%esp), %esi
rol $(1), %esi
mov %esi, (12)(%esp)
mov %edx, %edi
xor %ebp, %edi
and %ecx, %edi
xor %ebp, %edi
ror $(2), %ecx
mov %ebx, %esi
rol $(5), %esi
add (16)(%esp), %eax
lea (1518500249)(%edi,%eax), %eax
add %esi, %eax
mov (16)(%esp), %esi
xor (24)(%esp), %esi
xor (48)(%esp), %esi
xor (4)(%esp), %esi
rol $(1), %esi
mov %esi, (16)(%esp)
mov %ecx, %edi
xor %edx, %edi
and %ebx, %edi
xor %edx, %edi
ror $(2), %ebx
mov %eax, %esi
rol $(5), %esi
add (20)(%esp), %ebp
lea (1518500249)(%ebp,%edi), %ebp
add %esi, %ebp
mov (20)(%esp), %esi
xor (28)(%esp), %esi
xor (52)(%esp), %esi
xor (8)(%esp), %esi
rol $(1), %esi
mov %esi, (20)(%esp)
mov %ebx, %edi
xor %ecx, %edi
and %eax, %edi
xor %ecx, %edi
ror $(2), %eax
mov %ebp, %esi
rol $(5), %esi
add (24)(%esp), %edx
lea (1518500249)(%edi,%edx), %edx
add %esi, %edx
mov (24)(%esp), %esi
xor (32)(%esp), %esi
xor (56)(%esp), %esi
xor (12)(%esp), %esi
rol $(1), %esi
mov %esi, (24)(%esp)
mov %eax, %edi
xor %ebx, %edi
and %ebp, %edi
xor %ebx, %edi
ror $(2), %ebp
mov %edx, %esi
rol $(5), %esi
add (28)(%esp), %ecx
lea (1518500249)(%edi,%ecx), %ecx
add %esi, %ecx
mov (28)(%esp), %esi
xor (36)(%esp), %esi
xor (60)(%esp), %esi
xor (16)(%esp), %esi
rol $(1), %esi
mov %esi, (28)(%esp)
mov %ebp, %edi
xor %eax, %edi
and %edx, %edi
xor %eax, %edi
ror $(2), %edx
mov %ecx, %esi
rol $(5), %esi
add (32)(%esp), %ebx
lea (1518500249)(%edi,%ebx), %ebx
add %esi, %ebx
mov (32)(%esp), %esi
xor (40)(%esp), %esi
xor (%esp), %esi
xor (20)(%esp), %esi
rol $(1), %esi
mov %esi, (32)(%esp)
mov %edx, %edi
xor %ebp, %edi
and %ecx, %edi
xor %ebp, %edi
ror $(2), %ecx
mov %ebx, %esi
rol $(5), %esi
add (36)(%esp), %eax
lea (1518500249)(%edi,%eax), %eax
add %esi, %eax
mov (36)(%esp), %esi
xor (44)(%esp), %esi
xor (4)(%esp), %esi
xor (24)(%esp), %esi
rol $(1), %esi
mov %esi, (36)(%esp)
mov %ecx, %edi
xor %edx, %edi
and %ebx, %edi
xor %edx, %edi
ror $(2), %ebx
mov %eax, %esi
rol $(5), %esi
add (40)(%esp), %ebp
lea (1518500249)(%ebp,%edi), %ebp
add %esi, %ebp
mov (40)(%esp), %esi
xor (48)(%esp), %esi
xor (8)(%esp), %esi
xor (28)(%esp), %esi
rol $(1), %esi
mov %esi, (40)(%esp)
mov %ebx, %edi
xor %ecx, %edi
and %eax, %edi
xor %ecx, %edi
ror $(2), %eax
mov %ebp, %esi
rol $(5), %esi
add (44)(%esp), %edx
lea (1518500249)(%edi,%edx), %edx
add %esi, %edx
mov (44)(%esp), %esi
xor (52)(%esp), %esi
xor (12)(%esp), %esi
xor (32)(%esp), %esi
rol $(1), %esi
mov %esi, (44)(%esp)
mov %eax, %edi
xor %ebx, %edi
and %ebp, %edi
xor %ebx, %edi
ror $(2), %ebp
mov %edx, %esi
rol $(5), %esi
add (48)(%esp), %ecx
lea (1518500249)(%edi,%ecx), %ecx
add %esi, %ecx
mov (48)(%esp), %esi
xor (56)(%esp), %esi
xor (16)(%esp), %esi
xor (36)(%esp), %esi
rol $(1), %esi
mov %esi, (48)(%esp)
mov %ebp, %edi
xor %eax, %edi
and %edx, %edi
xor %eax, %edi
ror $(2), %edx
mov %ecx, %esi
rol $(5), %esi
add (52)(%esp), %ebx
lea (1518500249)(%edi,%ebx), %ebx
add %esi, %ebx
mov (52)(%esp), %esi
xor (60)(%esp), %esi
xor (20)(%esp), %esi
xor (40)(%esp), %esi
rol $(1), %esi
mov %esi, (52)(%esp)
mov %edx, %edi
xor %ebp, %edi
and %ecx, %edi
xor %ebp, %edi
ror $(2), %ecx
mov %ebx, %esi
rol $(5), %esi
add (56)(%esp), %eax
lea (1518500249)(%edi,%eax), %eax
add %esi, %eax
mov (56)(%esp), %esi
xor (%esp), %esi
xor (24)(%esp), %esi
xor (44)(%esp), %esi
rol $(1), %esi
mov %esi, (56)(%esp)
mov %ecx, %edi
xor %edx, %edi
and %ebx, %edi
xor %edx, %edi
ror $(2), %ebx
mov %eax, %esi
rol $(5), %esi
add (60)(%esp), %ebp
lea (1518500249)(%ebp,%edi), %ebp
add %esi, %ebp
mov (60)(%esp), %esi
xor (4)(%esp), %esi
xor (28)(%esp), %esi
xor (48)(%esp), %esi
rol $(1), %esi
mov %esi, (60)(%esp)
mov %ebx, %edi
xor %ecx, %edi
and %eax, %edi
xor %ecx, %edi
ror $(2), %eax
mov %ebp, %esi
rol $(5), %esi
add (%esp), %edx
lea (1518500249)(%edi,%edx), %edx
add %esi, %edx
mov (%esp), %esi
xor (8)(%esp), %esi
xor (32)(%esp), %esi
xor (52)(%esp), %esi
rol $(1), %esi
mov %esi, (%esp)
mov %eax, %edi
xor %ebx, %edi
and %ebp, %edi
xor %ebx, %edi
ror $(2), %ebp
mov %edx, %esi
rol $(5), %esi
add (4)(%esp), %ecx
lea (1518500249)(%edi,%ecx), %ecx
add %esi, %ecx
mov (4)(%esp), %esi
xor (12)(%esp), %esi
xor (36)(%esp), %esi
xor (56)(%esp), %esi
rol $(1), %esi
mov %esi, (4)(%esp)
mov %ebp, %edi
xor %eax, %edi
and %edx, %edi
xor %eax, %edi
ror $(2), %edx
mov %ecx, %esi
rol $(5), %esi
add (8)(%esp), %ebx
lea (1518500249)(%edi,%ebx), %ebx
add %esi, %ebx
mov (8)(%esp), %esi
xor (16)(%esp), %esi
xor (40)(%esp), %esi
xor (60)(%esp), %esi
rol $(1), %esi
mov %esi, (8)(%esp)
mov %edx, %edi
xor %ebp, %edi
and %ecx, %edi
xor %ebp, %edi
ror $(2), %ecx
mov %ebx, %esi
rol $(5), %esi
add (12)(%esp), %eax
lea (1518500249)(%edi,%eax), %eax
add %esi, %eax
mov (12)(%esp), %esi
xor (20)(%esp), %esi
xor (44)(%esp), %esi
xor (%esp), %esi
rol $(1), %esi
mov %esi, (12)(%esp)
mov %edx, %edi
xor %ecx, %edi
xor %ebx, %edi
ror $(2), %ebx
mov %eax, %esi
rol $(5), %esi
add (16)(%esp), %ebp
lea (1859775393)(%ebp,%edi), %ebp
add %esi, %ebp
mov (16)(%esp), %esi
xor (24)(%esp), %esi
xor (48)(%esp), %esi
xor (4)(%esp), %esi
rol $(1), %esi
mov %esi, (16)(%esp)
mov %ecx, %edi
xor %ebx, %edi
xor %eax, %edi
ror $(2), %eax
mov %ebp, %esi
rol $(5), %esi
add (20)(%esp), %edx
lea (1859775393)(%edi,%edx), %edx
add %esi, %edx
mov (20)(%esp), %esi
xor (28)(%esp), %esi
xor (52)(%esp), %esi
xor (8)(%esp), %esi
rol $(1), %esi
mov %esi, (20)(%esp)
mov %ebx, %edi
xor %eax, %edi
xor %ebp, %edi
ror $(2), %ebp
mov %edx, %esi
rol $(5), %esi
add (24)(%esp), %ecx
lea (1859775393)(%edi,%ecx), %ecx
add %esi, %ecx
mov (24)(%esp), %esi
xor (32)(%esp), %esi
xor (56)(%esp), %esi
xor (12)(%esp), %esi
rol $(1), %esi
mov %esi, (24)(%esp)
mov %eax, %edi
xor %ebp, %edi
xor %edx, %edi
ror $(2), %edx
mov %ecx, %esi
rol $(5), %esi
add (28)(%esp), %ebx
lea (1859775393)(%edi,%ebx), %ebx
add %esi, %ebx
mov (28)(%esp), %esi
xor (36)(%esp), %esi
xor (60)(%esp), %esi
xor (16)(%esp), %esi
rol $(1), %esi
mov %esi, (28)(%esp)
mov %ebp, %edi
xor %edx, %edi
xor %ecx, %edi
ror $(2), %ecx
mov %ebx, %esi
rol $(5), %esi
add (32)(%esp), %eax
lea (1859775393)(%edi,%eax), %eax
add %esi, %eax
mov (32)(%esp), %esi
xor (40)(%esp), %esi
xor (%esp), %esi
xor (20)(%esp), %esi
rol $(1), %esi
mov %esi, (32)(%esp)
mov %edx, %edi
xor %ecx, %edi
xor %ebx, %edi
ror $(2), %ebx
mov %eax, %esi
rol $(5), %esi
add (36)(%esp), %ebp
lea (1859775393)(%ebp,%edi), %ebp
add %esi, %ebp
mov (36)(%esp), %esi
xor (44)(%esp), %esi
xor (4)(%esp), %esi
xor (24)(%esp), %esi
rol $(1), %esi
mov %esi, (36)(%esp)
mov %ecx, %edi
xor %ebx, %edi
xor %eax, %edi
ror $(2), %eax
mov %ebp, %esi
rol $(5), %esi
add (40)(%esp), %edx
lea (1859775393)(%edi,%edx), %edx
add %esi, %edx
mov (40)(%esp), %esi
xor (48)(%esp), %esi
xor (8)(%esp), %esi
xor (28)(%esp), %esi
rol $(1), %esi
mov %esi, (40)(%esp)
mov %ebx, %edi
xor %eax, %edi
xor %ebp, %edi
ror $(2), %ebp
mov %edx, %esi
rol $(5), %esi
add (44)(%esp), %ecx
lea (1859775393)(%edi,%ecx), %ecx
add %esi, %ecx
mov (44)(%esp), %esi
xor (52)(%esp), %esi
xor (12)(%esp), %esi
xor (32)(%esp), %esi
rol $(1), %esi
mov %esi, (44)(%esp)
mov %eax, %edi
xor %ebp, %edi
xor %edx, %edi
ror $(2), %edx
mov %ecx, %esi
rol $(5), %esi
add (48)(%esp), %ebx
lea (1859775393)(%edi,%ebx), %ebx
add %esi, %ebx
mov (48)(%esp), %esi
xor (56)(%esp), %esi
xor (16)(%esp), %esi
xor (36)(%esp), %esi
rol $(1), %esi
mov %esi, (48)(%esp)
mov %ebp, %edi
xor %edx, %edi
xor %ecx, %edi
ror $(2), %ecx
mov %ebx, %esi
rol $(5), %esi
add (52)(%esp), %eax
lea (1859775393)(%edi,%eax), %eax
add %esi, %eax
mov (52)(%esp), %esi
xor (60)(%esp), %esi
xor (20)(%esp), %esi
xor (40)(%esp), %esi
rol $(1), %esi
mov %esi, (52)(%esp)
mov %edx, %edi
xor %ecx, %edi
xor %ebx, %edi
ror $(2), %ebx
mov %eax, %esi
rol $(5), %esi
add (56)(%esp), %ebp
lea (1859775393)(%ebp,%edi), %ebp
add %esi, %ebp
mov (56)(%esp), %esi
xor (%esp), %esi
xor (24)(%esp), %esi
xor (44)(%esp), %esi
rol $(1), %esi
mov %esi, (56)(%esp)
mov %ecx, %edi
xor %ebx, %edi
xor %eax, %edi
ror $(2), %eax
mov %ebp, %esi
rol $(5), %esi
add (60)(%esp), %edx
lea (1859775393)(%edi,%edx), %edx
add %esi, %edx
mov (60)(%esp), %esi
xor (4)(%esp), %esi
xor (28)(%esp), %esi
xor (48)(%esp), %esi
rol $(1), %esi
mov %esi, (60)(%esp)
mov %ebx, %edi
xor %eax, %edi
xor %ebp, %edi
ror $(2), %ebp
mov %edx, %esi
rol $(5), %esi
add (%esp), %ecx
lea (1859775393)(%edi,%ecx), %ecx
add %esi, %ecx
mov (%esp), %esi
xor (8)(%esp), %esi
xor (32)(%esp), %esi
xor (52)(%esp), %esi
rol $(1), %esi
mov %esi, (%esp)
mov %eax, %edi
xor %ebp, %edi
xor %edx, %edi
ror $(2), %edx
mov %ecx, %esi
rol $(5), %esi
add (4)(%esp), %ebx
lea (1859775393)(%edi,%ebx), %ebx
add %esi, %ebx
mov (4)(%esp), %esi
xor (12)(%esp), %esi
xor (36)(%esp), %esi
xor (56)(%esp), %esi
rol $(1), %esi
mov %esi, (4)(%esp)
mov %ebp, %edi
xor %edx, %edi
xor %ecx, %edi
ror $(2), %ecx
mov %ebx, %esi
rol $(5), %esi
add (8)(%esp), %eax
lea (1859775393)(%edi,%eax), %eax
add %esi, %eax
mov (8)(%esp), %esi
xor (16)(%esp), %esi
xor (40)(%esp), %esi
xor (60)(%esp), %esi
rol $(1), %esi
mov %esi, (8)(%esp)
mov %edx, %edi
xor %ecx, %edi
xor %ebx, %edi
ror $(2), %ebx
mov %eax, %esi
rol $(5), %esi
add (12)(%esp), %ebp
lea (1859775393)(%ebp,%edi), %ebp
add %esi, %ebp
mov (12)(%esp), %esi
xor (20)(%esp), %esi
xor (44)(%esp), %esi
xor (%esp), %esi
rol $(1), %esi
mov %esi, (12)(%esp)
mov %ecx, %edi
xor %ebx, %edi
xor %eax, %edi
ror $(2), %eax
mov %ebp, %esi
rol $(5), %esi
add (16)(%esp), %edx
lea (1859775393)(%edi,%edx), %edx
add %esi, %edx
mov (16)(%esp), %esi
xor (24)(%esp), %esi
xor (48)(%esp), %esi
xor (4)(%esp), %esi
rol $(1), %esi
mov %esi, (16)(%esp)
mov %ebx, %edi
xor %eax, %edi
xor %ebp, %edi
ror $(2), %ebp
mov %edx, %esi
rol $(5), %esi
add (20)(%esp), %ecx
lea (1859775393)(%edi,%ecx), %ecx
add %esi, %ecx
mov (20)(%esp), %esi
xor (28)(%esp), %esi
xor (52)(%esp), %esi
xor (8)(%esp), %esi
rol $(1), %esi
mov %esi, (20)(%esp)
mov %eax, %edi
xor %ebp, %edi
xor %edx, %edi
ror $(2), %edx
mov %ecx, %esi
rol $(5), %esi
add (24)(%esp), %ebx
lea (1859775393)(%edi,%ebx), %ebx
add %esi, %ebx
mov (24)(%esp), %esi
xor (32)(%esp), %esi
xor (56)(%esp), %esi
xor (12)(%esp), %esi
rol $(1), %esi
mov %esi, (24)(%esp)
mov %ebp, %edi
xor %edx, %edi
xor %ecx, %edi
ror $(2), %ecx
mov %ebx, %esi
rol $(5), %esi
add (28)(%esp), %eax
lea (1859775393)(%edi,%eax), %eax
add %esi, %eax
mov (28)(%esp), %esi
xor (36)(%esp), %esi
xor (60)(%esp), %esi
xor (16)(%esp), %esi
rol $(1), %esi
mov %esi, (28)(%esp)
mov %ebx, %edi
mov %ebx, %esi
or %ecx, %edi
and %ecx, %esi
and %edx, %edi
or %esi, %edi
ror $(2), %ebx
mov %eax, %esi
rol $(5), %esi
add (32)(%esp), %ebp
lea (2400959708)(%ebp,%edi), %ebp
add %esi, %ebp
mov (32)(%esp), %esi
xor (40)(%esp), %esi
xor (%esp), %esi
xor (20)(%esp), %esi
rol $(1), %esi
mov %esi, (32)(%esp)
mov %eax, %edi
mov %eax, %esi
or %ebx, %edi
and %ebx, %esi
and %ecx, %edi
or %esi, %edi
ror $(2), %eax
mov %ebp, %esi
rol $(5), %esi
add (36)(%esp), %edx
lea (2400959708)(%edi,%edx), %edx
add %esi, %edx
mov (36)(%esp), %esi
xor (44)(%esp), %esi
xor (4)(%esp), %esi
xor (24)(%esp), %esi
rol $(1), %esi
mov %esi, (36)(%esp)
mov %ebp, %edi
mov %ebp, %esi
or %eax, %edi
and %eax, %esi
and %ebx, %edi
or %esi, %edi
ror $(2), %ebp
mov %edx, %esi
rol $(5), %esi
add (40)(%esp), %ecx
lea (2400959708)(%edi,%ecx), %ecx
add %esi, %ecx
mov (40)(%esp), %esi
xor (48)(%esp), %esi
xor (8)(%esp), %esi
xor (28)(%esp), %esi
rol $(1), %esi
mov %esi, (40)(%esp)
mov %edx, %edi
mov %edx, %esi
or %ebp, %edi
and %ebp, %esi
and %eax, %edi
or %esi, %edi
ror $(2), %edx
mov %ecx, %esi
rol $(5), %esi
add (44)(%esp), %ebx
lea (2400959708)(%edi,%ebx), %ebx
add %esi, %ebx
mov (44)(%esp), %esi
xor (52)(%esp), %esi
xor (12)(%esp), %esi
xor (32)(%esp), %esi
rol $(1), %esi
mov %esi, (44)(%esp)
mov %ecx, %edi
mov %ecx, %esi
or %edx, %edi
and %edx, %esi
and %ebp, %edi
or %esi, %edi
ror $(2), %ecx
mov %ebx, %esi
rol $(5), %esi
add (48)(%esp), %eax
lea (2400959708)(%edi,%eax), %eax
add %esi, %eax
mov (48)(%esp), %esi
xor (56)(%esp), %esi
xor (16)(%esp), %esi
xor (36)(%esp), %esi
rol $(1), %esi
mov %esi, (48)(%esp)
mov %ebx, %edi
mov %ebx, %esi
or %ecx, %edi
and %ecx, %esi
and %edx, %edi
or %esi, %edi
ror $(2), %ebx
mov %eax, %esi
rol $(5), %esi
add (52)(%esp), %ebp
lea (2400959708)(%ebp,%edi), %ebp
add %esi, %ebp
mov (52)(%esp), %esi
xor (60)(%esp), %esi
xor (20)(%esp), %esi
xor (40)(%esp), %esi
rol $(1), %esi
mov %esi, (52)(%esp)
mov %eax, %edi
mov %eax, %esi
or %ebx, %edi
and %ebx, %esi
and %ecx, %edi
or %esi, %edi
ror $(2), %eax
mov %ebp, %esi
rol $(5), %esi
add (56)(%esp), %edx
lea (2400959708)(%edi,%edx), %edx
add %esi, %edx
mov (56)(%esp), %esi
xor (%esp), %esi
xor (24)(%esp), %esi
xor (44)(%esp), %esi
rol $(1), %esi
mov %esi, (56)(%esp)
mov %ebp, %edi
mov %ebp, %esi
or %eax, %edi
and %eax, %esi
and %ebx, %edi
or %esi, %edi
ror $(2), %ebp
mov %edx, %esi
rol $(5), %esi
add (60)(%esp), %ecx
lea (2400959708)(%edi,%ecx), %ecx
add %esi, %ecx
mov (60)(%esp), %esi
xor (4)(%esp), %esi
xor (28)(%esp), %esi
xor (48)(%esp), %esi
rol $(1), %esi
mov %esi, (60)(%esp)
mov %edx, %edi
mov %edx, %esi
or %ebp, %edi
and %ebp, %esi
and %eax, %edi
or %esi, %edi
ror $(2), %edx
mov %ecx, %esi
rol $(5), %esi
add (%esp), %ebx
lea (2400959708)(%edi,%ebx), %ebx
add %esi, %ebx
mov (%esp), %esi
xor (8)(%esp), %esi
xor (32)(%esp), %esi
xor (52)(%esp), %esi
rol $(1), %esi
mov %esi, (%esp)
mov %ecx, %edi
mov %ecx, %esi
or %edx, %edi
and %edx, %esi
and %ebp, %edi
or %esi, %edi
ror $(2), %ecx
mov %ebx, %esi
rol $(5), %esi
add (4)(%esp), %eax
lea (2400959708)(%edi,%eax), %eax
add %esi, %eax
mov (4)(%esp), %esi
xor (12)(%esp), %esi
xor (36)(%esp), %esi
xor (56)(%esp), %esi
rol $(1), %esi
mov %esi, (4)(%esp)
mov %ebx, %edi
mov %ebx, %esi
or %ecx, %edi
and %ecx, %esi
and %edx, %edi
or %esi, %edi
ror $(2), %ebx
mov %eax, %esi
rol $(5), %esi
add (8)(%esp), %ebp
lea (2400959708)(%ebp,%edi), %ebp
add %esi, %ebp
mov (8)(%esp), %esi
xor (16)(%esp), %esi
xor (40)(%esp), %esi
xor (60)(%esp), %esi
rol $(1), %esi
mov %esi, (8)(%esp)
mov %eax, %edi
mov %eax, %esi
or %ebx, %edi
and %ebx, %esi
and %ecx, %edi
or %esi, %edi
ror $(2), %eax
mov %ebp, %esi
rol $(5), %esi
add (12)(%esp), %edx
lea (2400959708)(%edi,%edx), %edx
add %esi, %edx
mov (12)(%esp), %esi
xor (20)(%esp), %esi
xor (44)(%esp), %esi
xor (%esp), %esi
rol $(1), %esi
mov %esi, (12)(%esp)
mov %ebp, %edi
mov %ebp, %esi
or %eax, %edi
and %eax, %esi
and %ebx, %edi
or %esi, %edi
ror $(2), %ebp
mov %edx, %esi
rol $(5), %esi
add (16)(%esp), %ecx
lea (2400959708)(%edi,%ecx), %ecx
add %esi, %ecx
mov (16)(%esp), %esi
xor (24)(%esp), %esi
xor (48)(%esp), %esi
xor (4)(%esp), %esi
rol $(1), %esi
mov %esi, (16)(%esp)
mov %edx, %edi
mov %edx, %esi
or %ebp, %edi
and %ebp, %esi
and %eax, %edi
or %esi, %edi
ror $(2), %edx
mov %ecx, %esi
rol $(5), %esi
add (20)(%esp), %ebx
lea (2400959708)(%edi,%ebx), %ebx
add %esi, %ebx
mov (20)(%esp), %esi
xor (28)(%esp), %esi
xor (52)(%esp), %esi
xor (8)(%esp), %esi
rol $(1), %esi
mov %esi, (20)(%esp)
mov %ecx, %edi
mov %ecx, %esi
or %edx, %edi
and %edx, %esi
and %ebp, %edi
or %esi, %edi
ror $(2), %ecx
mov %ebx, %esi
rol $(5), %esi
add (24)(%esp), %eax
lea (2400959708)(%edi,%eax), %eax
add %esi, %eax
mov (24)(%esp), %esi
xor (32)(%esp), %esi
xor (56)(%esp), %esi
xor (12)(%esp), %esi
rol $(1), %esi
mov %esi, (24)(%esp)
mov %ebx, %edi
mov %ebx, %esi
or %ecx, %edi
and %ecx, %esi
and %edx, %edi
or %esi, %edi
ror $(2), %ebx
mov %eax, %esi
rol $(5), %esi
add (28)(%esp), %ebp
lea (2400959708)(%ebp,%edi), %ebp
add %esi, %ebp
mov (28)(%esp), %esi
xor (36)(%esp), %esi
xor (60)(%esp), %esi
xor (16)(%esp), %esi
rol $(1), %esi
mov %esi, (28)(%esp)
mov %eax, %edi
mov %eax, %esi
or %ebx, %edi
and %ebx, %esi
and %ecx, %edi
or %esi, %edi
ror $(2), %eax
mov %ebp, %esi
rol $(5), %esi
add (32)(%esp), %edx
lea (2400959708)(%edi,%edx), %edx
add %esi, %edx
mov (32)(%esp), %esi
xor (40)(%esp), %esi
xor (%esp), %esi
xor (20)(%esp), %esi
rol $(1), %esi
mov %esi, (32)(%esp)
mov %ebp, %edi
mov %ebp, %esi
or %eax, %edi
and %eax, %esi
and %ebx, %edi
or %esi, %edi
ror $(2), %ebp
mov %edx, %esi
rol $(5), %esi
add (36)(%esp), %ecx
lea (2400959708)(%edi,%ecx), %ecx
add %esi, %ecx
mov (36)(%esp), %esi
xor (44)(%esp), %esi
xor (4)(%esp), %esi
xor (24)(%esp), %esi
rol $(1), %esi
mov %esi, (36)(%esp)
mov %edx, %edi
mov %edx, %esi
or %ebp, %edi
and %ebp, %esi
and %eax, %edi
or %esi, %edi
ror $(2), %edx
mov %ecx, %esi
rol $(5), %esi
add (40)(%esp), %ebx
lea (2400959708)(%edi,%ebx), %ebx
add %esi, %ebx
mov (40)(%esp), %esi
xor (48)(%esp), %esi
xor (8)(%esp), %esi
xor (28)(%esp), %esi
rol $(1), %esi
mov %esi, (40)(%esp)
mov %ecx, %edi
mov %ecx, %esi
or %edx, %edi
and %edx, %esi
and %ebp, %edi
or %esi, %edi
ror $(2), %ecx
mov %ebx, %esi
rol $(5), %esi
add (44)(%esp), %eax
lea (2400959708)(%edi,%eax), %eax
add %esi, %eax
mov (44)(%esp), %esi
xor (52)(%esp), %esi
xor (12)(%esp), %esi
xor (32)(%esp), %esi
rol $(1), %esi
mov %esi, (44)(%esp)
mov %edx, %edi
xor %ecx, %edi
xor %ebx, %edi
ror $(2), %ebx
mov %eax, %esi
rol $(5), %esi
add (48)(%esp), %ebp
lea (3395469782)(%ebp,%edi), %ebp
add %esi, %ebp
mov (48)(%esp), %esi
xor (56)(%esp), %esi
xor (16)(%esp), %esi
xor (36)(%esp), %esi
rol $(1), %esi
mov %esi, (48)(%esp)
mov %ecx, %edi
xor %ebx, %edi
xor %eax, %edi
ror $(2), %eax
mov %ebp, %esi
rol $(5), %esi
add (52)(%esp), %edx
lea (3395469782)(%edi,%edx), %edx
add %esi, %edx
mov (52)(%esp), %esi
xor (60)(%esp), %esi
xor (20)(%esp), %esi
xor (40)(%esp), %esi
rol $(1), %esi
mov %esi, (52)(%esp)
mov %ebx, %edi
xor %eax, %edi
xor %ebp, %edi
ror $(2), %ebp
mov %edx, %esi
rol $(5), %esi
add (56)(%esp), %ecx
lea (3395469782)(%edi,%ecx), %ecx
add %esi, %ecx
mov (56)(%esp), %esi
xor (%esp), %esi
xor (24)(%esp), %esi
xor (44)(%esp), %esi
rol $(1), %esi
mov %esi, (56)(%esp)
mov %eax, %edi
xor %ebp, %edi
xor %edx, %edi
ror $(2), %edx
mov %ecx, %esi
rol $(5), %esi
add (60)(%esp), %ebx
lea (3395469782)(%edi,%ebx), %ebx
add %esi, %ebx
mov (60)(%esp), %esi
xor (4)(%esp), %esi
xor (28)(%esp), %esi
xor (48)(%esp), %esi
rol $(1), %esi
mov %esi, (60)(%esp)
mov %ebp, %edi
xor %edx, %edi
xor %ecx, %edi
ror $(2), %ecx
mov %ebx, %esi
rol $(5), %esi
add (%esp), %eax
lea (3395469782)(%edi,%eax), %eax
add %esi, %eax
mov %edx, %edi
xor %ecx, %edi
xor %ebx, %edi
ror $(2), %ebx
mov %eax, %esi
rol $(5), %esi
add (4)(%esp), %ebp
lea (3395469782)(%ebp,%edi), %ebp
add %esi, %ebp
mov %ecx, %edi
xor %ebx, %edi
xor %eax, %edi
ror $(2), %eax
mov %ebp, %esi
rol $(5), %esi
add (8)(%esp), %edx
lea (3395469782)(%edi,%edx), %edx
add %esi, %edx
mov %ebx, %edi
xor %eax, %edi
xor %ebp, %edi
ror $(2), %ebp
mov %edx, %esi
rol $(5), %esi
add (12)(%esp), %ecx
lea (3395469782)(%edi,%ecx), %ecx
add %esi, %ecx
mov %eax, %edi
xor %ebp, %edi
xor %edx, %edi
ror $(2), %edx
mov %ecx, %esi
rol $(5), %esi
add (16)(%esp), %ebx
lea (3395469782)(%edi,%ebx), %ebx
add %esi, %ebx
mov %ebp, %edi
xor %edx, %edi
xor %ecx, %edi
ror $(2), %ecx
mov %ebx, %esi
rol $(5), %esi
add (20)(%esp), %eax
lea (3395469782)(%edi,%eax), %eax
add %esi, %eax
mov %edx, %edi
xor %ecx, %edi
xor %ebx, %edi
ror $(2), %ebx
mov %eax, %esi
rol $(5), %esi
add (24)(%esp), %ebp
lea (3395469782)(%ebp,%edi), %ebp
add %esi, %ebp
mov %ecx, %edi
xor %ebx, %edi
xor %eax, %edi
ror $(2), %eax
mov %ebp, %esi
rol $(5), %esi
add (28)(%esp), %edx
lea (3395469782)(%edi,%edx), %edx
add %esi, %edx
mov %ebx, %edi
xor %eax, %edi
xor %ebp, %edi
ror $(2), %ebp
mov %edx, %esi
rol $(5), %esi
add (32)(%esp), %ecx
lea (3395469782)(%edi,%ecx), %ecx
add %esi, %ecx
mov %eax, %edi
xor %ebp, %edi
xor %edx, %edi
ror $(2), %edx
mov %ecx, %esi
rol $(5), %esi
add (36)(%esp), %ebx
lea (3395469782)(%edi,%ebx), %ebx
add %esi, %ebx
mov %ebp, %edi
xor %edx, %edi
xor %ecx, %edi
ror $(2), %ecx
mov %ebx, %esi
rol $(5), %esi
add (40)(%esp), %eax
lea (3395469782)(%edi,%eax), %eax
add %esi, %eax
mov %edx, %edi
xor %ecx, %edi
xor %ebx, %edi
ror $(2), %ebx
mov %eax, %esi
rol $(5), %esi
add (44)(%esp), %ebp
lea (3395469782)(%ebp,%edi), %ebp
add %esi, %ebp
mov %ecx, %edi
xor %ebx, %edi
xor %eax, %edi
ror $(2), %eax
mov %ebp, %esi
rol $(5), %esi
add (48)(%esp), %edx
lea (3395469782)(%edi,%edx), %edx
add %esi, %edx
mov %ebx, %edi
xor %eax, %edi
xor %ebp, %edi
ror $(2), %ebp
mov %edx, %esi
rol $(5), %esi
add (52)(%esp), %ecx
lea (3395469782)(%edi,%ecx), %ecx
add %esi, %ecx
mov %eax, %edi
xor %ebp, %edi
xor %edx, %edi
ror $(2), %edx
mov %ecx, %esi
rol $(5), %esi
add (56)(%esp), %ebx
lea (3395469782)(%edi,%ebx), %ebx
add %esi, %ebx
mov %ebp, %edi
xor %edx, %edi
xor %ecx, %edi
ror $(2), %ecx
mov %ebx, %esi
rol $(5), %esi
add (60)(%esp), %eax
lea (3395469782)(%edi,%eax), %eax
add %esi, %eax
mov (64)(%esp), %edi
mov (68)(%esp), %esi
add %eax, (%edi)
mov (72)(%esp), %eax
add %ebx, (4)(%edi)
add %ecx, (8)(%edi)
add %edx, (12)(%edi)
add %ebp, (16)(%edi)
add $(64), %esi
sub $(64), %eax
jg .Lsha1_block_loopgas_1
add $(76), %esp
pop %ebp
pop %edi
pop %esi
pop %ebx
pop %ebp
ret
|
/*
* Copyright information and license terms for this software can be
* found in the file LICENSE that is included with the distribution
*/
/**
* @author mrk
* @date 2016.06.17
*/
/* Author: Marty Kraimer */
#include <cstddef>
#include <cstdlib>
#include <cstddef>
#include <string>
#include <cstdio>
#include <memory>
#include <iostream>
#include <cantProceed.h>
#include <epicsStdio.h>
#include <epicsMutex.h>
#include <epicsEvent.h>
#include <epicsThread.h>
#include <iocsh.h>
#include <pv/pvIntrospect.h>
#include <pv/pvData.h>
#include <pv/standardField.h>
#include <pv/standardPVField.h>
#include <pv/pvAccess.h>
#include <pv/ntscalarArray.h>
#include <pv/pvaClient.h>
#include <pv/pvDatabase.h>
#include <epicsExport.h>
#include <pv/exampleMonitorLinkRecord.h>
using namespace epics::pvData;
using namespace epics::nt;
using namespace epics::pvAccess;
using namespace epics::pvaClient;
using namespace epics::pvDatabase;
using namespace epics::exampleCPP::exampleLink;
using std::cout;
using std::endl;
using std::string;
static StandardPVFieldPtr standardPVField = getStandardPVField();
static const iocshArg testArg0 = { "provider", iocshArgString };
static const iocshArg testArg1 = { "exampleMonitorLinkRecordName", iocshArgString };
static const iocshArg testArg2 = { "linkedRecordName", iocshArgString };
static const iocshArg testArg3 = { "providerNames", iocshArgString };
static const iocshArg *testArgs[] = {
&testArg0,&testArg1,&testArg2,&testArg3};
static const iocshFuncDef exampleMonitorLinkFuncDef = {
"exampleMonitorLinkCreateRecord", 4, testArgs};
static void exampleMonitorLinkCallFunc(const iocshArgBuf *args)
{
string provider("pva");
string exampleMonitorLinkRecord("exampleMonitorLink");
string linkedRecordName("doubleArray");
char *sval = args[0].sval;
if(sval) provider = string(sval);
string providerNames(provider);
sval = args[1].sval;
if(sval) exampleMonitorLinkRecord = string(sval);
sval = args[2].sval;
if(sval) linkedRecordName = string(sval);
sval = args[3].sval;
if(sval) providerNames = string(sval);
PVDatabasePtr master = PVDatabase::getMaster();
bool result(false);
PvaClientPtr pva= PvaClient::get(providerNames);
ExampleMonitorLinkRecordPtr record = ExampleMonitorLinkRecord::create(pva,exampleMonitorLinkRecord,provider,linkedRecordName);
if(record)
result = master->addRecord(record);
if(!result) cout << "recordname" << " not added" << endl;
}
static void exampleMonitorLinkRegister(void)
{
static int firstTime = 1;
if (firstTime) {
firstTime = 0;
iocshRegister(&exampleMonitorLinkFuncDef, exampleMonitorLinkCallFunc);
}
}
extern "C" {
epicsExportRegistrar(exampleMonitorLinkRegister);
}
|
TITLE LZ-EXPANDER Copyright (c) SLR Systems 1989
INCLUDE MACROS
PUBLIC QUIKPACK_PARAS
PUBLIC QUIK_STACK_ADR,QUIK_START_ADR,QUIK_PACK_LEN,QUIK_SKIP_PARAS
PUBLIC QUIK_UNPACK,QUIK_FIX_INT21
PACK_QUIK SEGMENT PARA PUBLIC 'UNPACK_DATA'
ASSUME NOTHING,CS:PACK_QUIK
QUIK_UNPACK:
DB 87H,0C0H
JMP SHORT QUIKUNPACK1
DW QUIK_START_JMP
DB 02 ;COMPRESSION TYPE
QUIK_STACK_ADR DD ?
QUIK_START_ADR DD ?
QUIKUNPACK1:
;
;STACK IS WHERE I WANT IT...
;
CLD
MOV DX,DS ;PSP
ADD DX,10H
PUSH DX
PUSH SS
POP ES
PUSH CS
POP DS
ASSUME DS:PACK_QUIK
ADD QUIK_STACK_ADR.SEGM,DX
ADD QUIK_START_ADR.SEGM,DX
XOR SI,SI
XOR DI,DI
MOV CX,QUIK_PACK_LEN/2+1
REP MOVSW
PUSH ES
MOV AX,OFF QUIK_MOVE_REST
PUSH AX
RETF
QUIK_MOVE_REST PROC NEAR
;
;MOVE COMPRESSED DATA UP SO WE CAN EXPAND DOWN...
;
STD
MOV BX,QUIKPACK_PARAS ;# OF PARAGRAPHS TO MOVE...
ASSUME DS:NOTHING
1$:
;
;MOVE SMALLER OF BX AND 1000H PARAS
;
MOV CX,1000H ;ASSUME 64K
CMP BX,CX
JA 2$
MOV CX,BX
2$:
SUB BX,CX
MOV AX,DS
SUB AX,CX
MOV DS,AX
MOV AX,ES
SUB AX,CX
MOV ES,AX
ADD CX,CX
ADD CX,CX
ADD CX,CX ;# OF WORDS TO MOVE
MOV DI,CX
DEC DI
ADD DI,DI ;ADDRESS OF FIRST WORD TO MOVE
MOV SI,DI
REP MOVSW
OR BX,BX
JNZ 1$
CLD
PUSH ES
POP DS
LEA SI,2[DI]
QUIK_MOVE_REST ENDP
QUIK_1 PROC NEAR
;
;INITIALIZATION
;
XOR DI,DI ;# OF BYTES NOT PACKED...
ADD DX,8080H
QUIK_SKIP_PARAS EQU $-2
MOV ES,DX
QUIK_1 ENDP
MEAT PROC NEAR
;
;DECOMPRESSOR
;
LODSW
XCHG AX,BP
MOV DX,0010H ;16 BITS LEFT TO ROTATE
JMP 1$
25$:
LODSW
XCHG AX,BP
MOV DL,16
JMP 251$
26$:
LODSW
XCHG AX,BP
MOV DL,16
JMP 261$
51$:
LODSW
XCHG AX,BP
MOV DL,16
JMP 511$
52$:
LODSW
XCHG AX,BP
MOV DL,16
JMP 521$
ALIGN 4,,1
15$:
LODSW
XCHG AX,BP
MOV DL,16
JNC 2$
0$:
;
;STRAIGHT BYTE
;
MOVSB
1$:
ADD BP,BP
DEC DX
JZ 15$
JC 0$
2$:
;
;0
;
ADD BP,BP
DEC DX
JZ 25$
251$:
JC 3$
;
;00x 2 or 3, these are most likely
;
XOR BH,BH
252$:
INC CX ;CX = 1
ADD BP,BP
DEC DX
JZ 26$
261$:
ADC CX,CX ;CX = 2 OR 3
CMP CX,2
JZ 27$
5$:
;
;GET HIGH BYTE OF OFFSET
;
XOR BH,BH
PUSH CX
ADD BP,BP
DEC DX
JZ 51$
511$:
JC 6$
;
;0
;
ADD BP,BP
DEC DX
JZ 52$
521$:
JC 55$
;
;00 IS 0
;
RANGE_DONE:
POP CX
27$:
LODSB ;LOW BYTE OF RANGE
MOV BL,AL
NOT BX
XCHG AX,SI ;02
LEA SI,[BX+DI] ;03
CLI ;02
REP MOVS [DI],ES:BPTR [SI] ;05+04 PER
STI ;02
XCHG SI,AX ;02 =
JMP 1$
EVEN
55$:
;
;01
;
INC BH
ADD BP,BP
DEC DX
JZ 56$
561$:
JNC RANGE_DONE ;010 IS 1
;
;011X IS 2 OR 3
;
MOV CX,201H
GET_RANGE_CX:
XOR BH,BH
58$:
ADD BP,BP
DEC DX
JZ 59$
591$:
ADC BH,BH
DEC CL
JNZ 58$
ADD BH,CH
JMP RANGE_DONE
56$:
LODSW
XCHG AX,BP
MOV DL,16
JMP 561$
59$:
LODSW
XCHG AX,BP
MOV DL,16
JMP 591$
3$:
;
;1
;
INC CX ;1
ADD BP,BP
DEC DX
JZ 31$
311$:
JNC 252$
;
;11
;
INC CX ;2
ADD BP,BP
DEC DX
JZ 32$
321$:
JNC 252$
;
;111
;
CALL GET_BIT
MOV BX,802H
JNC GET_BX ;1110XX IS 8-11
4$:
;
;1111
;
CALL GET_BIT
MOV BX,0C03H
JNC GET_BX ;11110XXX IS 12-19
;
;11111
;
LODSB
MOV AH,0
CMP AL,81H
XCHG AX,CX
JB 5$
JNZ 9$
CALL TRY_FIX_DOT
XOR CX,CX
JMP 1$
6$:
;
;1
;
CALL GET_BIT
JC 7$
;
;10
;
CALL GET_BIT
MOV CX,402H
JNC GET_RANGE_CX ;100XX IS 4-7
;
;101XXX IS 8-F
;
MOV CX,803H
JMP GET_RANGE_CX
31$:
LODSW
XCHG AX,BP
MOV DL,16
JMP 311$
7$:
;
;11
;
CALL GET_BIT
MOV CX,1004H
JNC GET_RANGE_CX ;110XXXX IS 10H-1FH
;
;111
;
CALL GET_BIT
MOV CX,2004H
JNC GET_RANGE_CX ;1110XXXX IS 20H-2FH
;
;1111
;
CALL GET_BIT
MOV CX,3004H
JNC GET_RANGE_CX
MOV CX,4006H
JMP GET_RANGE_CX
32$:
LODSW
XCHG AX,BP
MOV DL,10H
JMP 321$
GET_BX:
;
;
;
XOR CX,CX
8$:
ADD BP,BP
DEC DX
JZ 81$
811$:
ADC CX,CX
DEC BL
JNZ 8$
ADD CL,BH
JMP 5$
81$:
LODSW
XCHG AX,BP
MOV DL,10H
JMP 811$
9$:
MEAT ENDP
QUIK_STARTUP:
;
;SET UP REGS AND SUCH FOR STARTING UP...
;
MOV AL,0DH
CALL QUIK_FIX_DOT1
MOV AL,0AH
CALL QUIK_FIX_DOT1
POP DX
SUB DX,10H
MOV BX,ES ;FOR EXTERNAL UNPACKER
MOV DS,DX ;DS & ES ARE PSP
MOV ES,DX
MOV AX,QUIK_STACK_ADR.SEGM
CLI
MOV SS,AX
MOV SP,QUIK_STACK_ADR.OFFS
STI
QUIK_START_JMP:
NOP
JMP QUIK_START_ADR
EVEN
GET_BIT PROC NEAR
;
;
;
ADD BP,BP
DEC DX
JZ 1$
RET
1$:
LODSW
XCHG AX,BP
MOV DL,16
RET
GET_BIT ENDP
TRY_FIX_DOT PROC NEAR
;
;ADJUST STORAGE POINTERS
;
OR SI,SI
JNS 51$
SUB SI,8000H
MOV AX,DS
ADD AX,800H
MOV DS,AX
51$:
OR DI,DI
JNS 1$
MOV AX,DI
AND AX,7FF0H
SUB DI,AX
PUSH CX
MOV CL,4
SHR AX,CL
MOV CX,ES
ADD CX,AX
MOV ES,CX
POP CX
; SUB DI,4000H
; MOV AX,ES
; ADD AX,400H
; MOV ES,AX
1$:
QUIK_FIX_DOT:
MOV AL,'.'
QUIK_FIX_DOT1:
MOV AH,2
PUSH DX
MOV DL,AL
QUIK_FIX_INT21:
INT 21H
POP DX
CLD
RET
TRY_FIX_DOT ENDP
CopyRight DB 'Copyright (C) Digital Mars 1990-2004'
QUIKPACK_PARAS DW ?
QUIK_PACK_LEN EQU $-QUIK_UNPACK
PACK_QUIK ENDS
END
|
frame 0, 04
frame 1, 08
frame 2, 24
frame 1, 08
frame 4, 10
frame 0, 10
frame 4, 10
endanim
|
.proc @AllocMem ;(.word ztmp .byte ztmp+2) .var
sta ztmp+1
sty ztmp+2
loop lda (psptr),y
sta ztmp+3
lda (ztmp),y
sta (psptr),y
lda ztmp+3
sta (ztmp),y
dey
bpl loop
lda psptr
sec
adc ztmp+2
sta psptr
scc
inc psptr+1
rts
.endp
.proc @FreeMem ;(.word ztmp .byte ztmp+2) .var
sta ztmp+1
tya
eor #$ff
clc
adc psptr
sta psptr
scs
dec psptr+1
loop lda (psptr),y
sta ztmp+3
lda (ztmp),y
sta (psptr),y
lda ztmp+3
sta (ztmp),y
dey
bpl loop
rts
.endp
|
; A065730: Largest square <= n-th prime.
; 1,1,4,4,9,9,16,16,16,25,25,36,36,36,36,49,49,49,64,64,64,64,81,81,81,100,100,100,100,100,121,121,121,121,144,144,144,144,144,169,169,169,169,169,196,196,196,196,225,225,225,225,225,225,256,256,256,256,256,256,256,289,289,289,289,289,324,324,324,324,324,324,361,361,361,361,361,361,400,400,400,400,400,400,400,441,441,441,441,441,441,441,484,484,484,484,484,484,484,529
seq $0,6005 ; The odd prime numbers together with 1.
seq $0,196 ; Integer part of square root of n. Or, number of positive squares <= n. Or, n appears 2n+1 times.
pow $0,2
|
; A025726: Index of 7^n within sequence of numbers of form 7^i*9^j.
; 1,2,4,7,11,16,22,29,37,45,54,64,75,87,100,114,129,145,161,178,196,215,235,256,278,301,325,349,374,400,427,455,484,514,545,576,608,641,675,710,746,783,821,860,899,939,980,1022,1065,1109,1154,1200,1247,1294,1342
mov $17,$0
mov $19,$0
add $19,1
lpb $19
clr $0,17
mov $0,$17
sub $19,1
sub $0,$19
mov $14,$0
mov $16,$0
add $16,1
lpb $16
mov $0,$14
sub $16,1
sub $0,$16
mov $10,$0
mov $12,2
lpb $12
sub $12,1
add $0,$12
sub $0,1
mov $4,23
mul $4,$0
div $4,26
mov $5,$4
add $5,2
mov $6,$0
lpb $5
sub $5,1
add $6,1
lpe
mov $1,$6
mov $13,$12
lpb $13
mov $11,$1
sub $13,1
lpe
lpe
lpb $10
mov $10,0
sub $11,$1
lpe
mov $1,$11
sub $1,1
add $15,$1
lpe
add $18,$15
lpe
mov $1,$18
|
<%
from pwnlib.shellcraft.aarch64.linux import syscall
%>
<%page args="fdin, fdout, length, flags"/>
<%docstring>
Invokes the syscall tee. See 'man 2 tee' for more information.
Arguments:
fdin(int): fdin
fdout(int): fdout
len(size_t): len
flags(unsigned): flags
</%docstring>
${syscall('SYS_tee', fdin, fdout, length, flags)}
|
//************************************ bs::framework - Copyright 2018 Marko Pintera **************************************//
//*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********//
#include "Animation/BsAnimationManager.h"
#include "Animation/BsAnimation.h"
#include "Animation/BsAnimationClip.h"
#include "Threading/BsTaskScheduler.h"
#include "Utility/BsTime.h"
#include "Scene/BsSceneManager.h"
#include "Renderer/BsCamera.h"
#include "Animation/BsMorphShapes.h"
#include "Mesh/BsMeshData.h"
#include "Mesh/BsMeshUtility.h"
namespace bs
{
AnimationManager::AnimationManager()
: mNextId(1), mUpdateRate(1.0f / 60.0f), mAnimationTime(0.0f), mLastAnimationUpdateTime(0.0f)
, mNextAnimationUpdateTime(0.0f), mPaused(false), mPoseReadBufferIdx(1), mPoseWriteBufferIdx(0)
{
mBlendShapeVertexDesc = VertexDataDesc::create();
mBlendShapeVertexDesc->addVertElem(VET_FLOAT3, VES_POSITION, 1, 1);
mBlendShapeVertexDesc->addVertElem(VET_UBYTE4_NORM, VES_NORMAL, 1, 1);
}
void AnimationManager::setPaused(bool paused)
{
mPaused = paused;
}
void AnimationManager::setUpdateRate(UINT32 fps)
{
if (fps == 0)
fps = 1;
mUpdateRate = 1.0f / fps;
}
const EvaluatedAnimationData* AnimationManager::update(bool async)
{
// Wait for any workers to complete
{
Lock lock(mMutex);
while (mNumActiveWorkers > 0)
mWorkerDoneSignal.wait(lock);
// Advance the buffers (last write buffer becomes read buffer)
if(mSwapBuffers)
{
mPoseReadBufferIdx = (mPoseReadBufferIdx + 1) % (CoreThread::NUM_SYNC_BUFFERS + 1);
mPoseWriteBufferIdx = (mPoseWriteBufferIdx + 1) % (CoreThread::NUM_SYNC_BUFFERS + 1);
mSwapBuffers = false;
}
}
if(mPaused)
return &mAnimData[mPoseReadBufferIdx];
mAnimationTime += gTime().getFrameDelta();
if (mAnimationTime < mNextAnimationUpdateTime)
return &mAnimData[mPoseReadBufferIdx];
mNextAnimationUpdateTime = Math::floor(mAnimationTime / mUpdateRate) * mUpdateRate + mUpdateRate;
float timeDelta = mAnimationTime - mLastAnimationUpdateTime;
mLastAnimationUpdateTime = mAnimationTime;
// Trigger events and update attachments (for the data from the last frame)
if(async)
{
for (auto& anim : mAnimations)
{
anim.second->updateFromProxy();
anim.second->triggerEvents(mAnimationTime, gTime().getFrameDelta());
}
}
// Update animation proxies from the latest data
mProxies.clear();
for (auto& anim : mAnimations)
{
anim.second->updateAnimProxy(timeDelta);
mProxies.push_back(anim.second->mAnimProxy);
}
// Build frustums for culling
mCullFrustums.clear();
auto& allCameras = gSceneManager().getAllCameras();
for(auto& entry : allCameras)
{
bool isOverlayCamera = entry.second->getRenderSettings()->overlayOnly;
if (isOverlayCamera)
continue;
// TODO: Not checking if camera and animation renderable's layers match. If we checked more animations could
// be culled.
mCullFrustums.push_back(entry.second->getWorldFrustum());
}
// Prepare the write buffer
UINT32 totalNumBones = 0;
for (auto& anim : mProxies)
{
if (anim->skeleton != nullptr)
totalNumBones += anim->skeleton->getNumBones();
}
// Prepare the write buffer
EvaluatedAnimationData& renderData = mAnimData[mPoseWriteBufferIdx];
renderData.transforms.resize(totalNumBones);
renderData.infos.clear();
// Queue animation evaluation tasks
{
Lock lock(mMutex);
mNumActiveWorkers = (UINT32)mProxies.size();
}
UINT32 curBoneIdx = 0;
for (auto& anim : mProxies)
{
auto evaluateAnimWorker = [this, anim, curBoneIdx]()
{
UINT32 boneIdx = curBoneIdx;
evaluateAnimation(anim.get(), boneIdx);
Lock lock(mMutex);
{
assert(mNumActiveWorkers > 0);
mNumActiveWorkers--;
}
mWorkerDoneSignal.notify_one();
};
SPtr<Task> task = Task::create("AnimWorker", evaluateAnimWorker);
TaskScheduler::instance().addTask(task);
if (anim->skeleton != nullptr)
curBoneIdx += anim->skeleton->getNumBones();
}
// Wait for tasks to complete
if(!async)
{
{
Lock lock(mMutex);
while (mNumActiveWorkers > 0)
mWorkerDoneSignal.wait(lock);
}
// Trigger events and update attachments (for the data we just evaluated)
for (auto& anim : mAnimations)
{
anim.second->updateFromProxy();
anim.second->triggerEvents(mAnimationTime, gTime().getFrameDelta());
}
}
mSwapBuffers = true;
return &mAnimData[mPoseReadBufferIdx];
}
void AnimationManager::evaluateAnimation(AnimationProxy* anim, UINT32& curBoneIdx)
{
if (anim->mCullEnabled)
{
bool isVisible = false;
for (auto& frustum : mCullFrustums)
{
if (frustum.intersects(anim->mBounds))
{
isVisible = true;
break;
}
}
if (!isVisible)
return;
}
EvaluatedAnimationData& renderData = mAnimData[mPoseWriteBufferIdx];
UINT32 prevPoseBufferIdx = (mPoseWriteBufferIdx + CoreThread::NUM_SYNC_BUFFERS) % (CoreThread::NUM_SYNC_BUFFERS + 1);
EvaluatedAnimationData& prevRenderData = mAnimData[prevPoseBufferIdx];
EvaluatedAnimationData::AnimInfo animInfo;
bool hasAnimInfo = false;
// Evaluate skeletal animation
if (anim->skeleton != nullptr)
{
UINT32 numBones = anim->skeleton->getNumBones();
EvaluatedAnimationData::PoseInfo& poseInfo = animInfo.poseInfo;
poseInfo.animId = anim->id;
poseInfo.startIdx = curBoneIdx;
poseInfo.numBones = numBones;
memset(anim->skeletonPose.hasOverride, 0, sizeof(bool) * anim->skeletonPose.numBones);
Matrix4* boneDst = renderData.transforms.data() + curBoneIdx;
// Copy transforms from mapped scene objects
UINT32 boneTfrmIdx = 0;
for (UINT32 i = 0; i < anim->numSceneObjects; i++)
{
const AnimatedSceneObjectInfo& soInfo = anim->sceneObjectInfos[i];
if (soInfo.boneIdx == -1)
continue;
boneDst[soInfo.boneIdx] = anim->sceneObjectTransforms[boneTfrmIdx];
anim->skeletonPose.hasOverride[soInfo.boneIdx] = true;
boneTfrmIdx++;
}
// Animate bones
anim->skeleton->getPose(boneDst, anim->skeletonPose, anim->skeletonMask, anim->layers, anim->numLayers);
curBoneIdx += numBones;
hasAnimInfo = true;
}
else
{
EvaluatedAnimationData::PoseInfo& poseInfo = animInfo.poseInfo;
poseInfo.animId = anim->id;
poseInfo.startIdx = 0;
poseInfo.numBones = 0;
}
// Reset mapped SO transform
for (UINT32 i = 0; i < anim->sceneObjectPose.numBones; i++)
{
anim->sceneObjectPose.positions[i] = Vector3::ZERO;
anim->sceneObjectPose.rotations[i] = Quaternion::IDENTITY;
anim->sceneObjectPose.scales[i] = Vector3::ONE;
}
// Update mapped scene objects
memset(anim->sceneObjectPose.hasOverride, 1, sizeof(bool) * 3 * anim->numSceneObjects);
// Update scene object transforms
for (UINT32 i = 0; i < anim->numSceneObjects; i++)
{
const AnimatedSceneObjectInfo& soInfo = anim->sceneObjectInfos[i];
// We already evaluated bones
if (soInfo.boneIdx != -1)
continue;
if (soInfo.layerIdx == -1 || soInfo.stateIdx == -1)
continue;
const AnimationState& state = anim->layers[soInfo.layerIdx].states[soInfo.stateIdx];
if (state.disabled)
continue;
{
UINT32 curveIdx = soInfo.curveIndices.position;
if (curveIdx != (UINT32)-1)
{
const TAnimationCurve<Vector3>& curve = state.curves->position[curveIdx].curve;
anim->sceneObjectPose.positions[curveIdx] = curve.evaluate(state.time, state.positionCaches[curveIdx], state.loop);
anim->sceneObjectPose.hasOverride[i * 3 + 0] = false;
}
}
{
UINT32 curveIdx = soInfo.curveIndices.rotation;
if (curveIdx != (UINT32)-1)
{
const TAnimationCurve<Quaternion>& curve = state.curves->rotation[curveIdx].curve;
anim->sceneObjectPose.rotations[curveIdx] = curve.evaluate(state.time, state.rotationCaches[curveIdx], state.loop);
anim->sceneObjectPose.rotations[curveIdx].normalize();
anim->sceneObjectPose.hasOverride[i * 3 + 1] = false;
}
}
{
UINT32 curveIdx = soInfo.curveIndices.scale;
if (curveIdx != (UINT32)-1)
{
const TAnimationCurve<Vector3>& curve = state.curves->scale[curveIdx].curve;
anim->sceneObjectPose.scales[curveIdx] = curve.evaluate(state.time, state.scaleCaches[curveIdx], state.loop);
anim->sceneObjectPose.hasOverride[i * 3 + 2] = false;
}
}
}
// Update generic curves
// Note: No blending for generic animations, just use first animation
if (anim->numLayers > 0 && anim->layers[0].numStates > 0)
{
const AnimationState& state = anim->layers[0].states[0];
if (!state.disabled)
{
UINT32 numCurves = (UINT32)state.curves->generic.size();
for (UINT32 i = 0; i < numCurves; i++)
{
const TAnimationCurve<float>& curve = state.curves->generic[i].curve;
anim->genericCurveOutputs[i] = curve.evaluate(state.time, state.genericCaches[i], state.loop);
}
}
}
// Update morph shapes
if (anim->numMorphShapes > 0)
{
auto iterFind = prevRenderData.infos.find(anim->id);
if (iterFind != prevRenderData.infos.end())
animInfo.morphShapeInfo = iterFind->second.morphShapeInfo;
else
animInfo.morphShapeInfo.version = 1; // 0 is considered invalid version
// Recalculate weights if curves are present
bool hasMorphCurves = false;
for (UINT32 i = 0; i < anim->numMorphChannels; i++)
{
MorphChannelInfo& channelInfo = anim->morphChannelInfos[i];
if (channelInfo.weightCurveIdx != (UINT32)-1)
{
channelInfo.weight = Math::clamp01(anim->genericCurveOutputs[channelInfo.weightCurveIdx]);
hasMorphCurves = true;
}
float frameWeight;
if (channelInfo.frameCurveIdx != (UINT32)-1)
{
frameWeight = Math::clamp01(anim->genericCurveOutputs[channelInfo.frameCurveIdx]);
hasMorphCurves = true;
}
else
frameWeight = 0.0f;
if (channelInfo.shapeCount == 1)
{
MorphShapeInfo& shapeInfo = anim->morphShapeInfos[channelInfo.shapeStart];
// Blend between base shape and the only available frame
float relative = frameWeight - shapeInfo.frameWeight;
if (relative <= 0.0f)
{
float diff = shapeInfo.frameWeight;
if (diff > 0.0f)
{
float t = -relative / diff;
shapeInfo.finalWeight = 1.0f - std::min(t, 1.0f);
}
else
shapeInfo.finalWeight = 1.0f;
}
else // If past the final frame we clamp
shapeInfo.finalWeight = 1.0f;
}
else if (channelInfo.shapeCount > 1)
{
for (UINT32 j = 0; j < channelInfo.shapeCount - 1; j++)
{
float prevShapeWeight;
if (j > 0)
prevShapeWeight = anim->morphShapeInfos[j - 1].frameWeight;
else
prevShapeWeight = 0.0f; // Base shape, blend between it and the first frame
float nextShapeWeight = anim->morphShapeInfos[j + 1].frameWeight;
MorphShapeInfo& shapeInfo = anim->morphShapeInfos[j];
float relative = frameWeight - shapeInfo.frameWeight;
if (relative <= 0.0f)
{
float diff = shapeInfo.frameWeight - prevShapeWeight;
if (diff > 0.0f)
{
float t = -relative / diff;
shapeInfo.finalWeight = 1.0f - std::min(t, 1.0f);
}
else
shapeInfo.finalWeight = 1.0f;
}
else
{
float diff = nextShapeWeight - shapeInfo.frameWeight;
if (diff > 0.0f)
{
float t = relative / diff;
shapeInfo.finalWeight = std::min(t, 1.0f);
}
else
shapeInfo.finalWeight = 0.0f;
}
}
// Last frame
{
UINT32 lastFrame = channelInfo.shapeStart + channelInfo.shapeCount - 1;
MorphShapeInfo& prevShapeInfo = anim->morphShapeInfos[lastFrame - 1];
MorphShapeInfo& shapeInfo = anim->morphShapeInfos[lastFrame];
float relative = frameWeight - shapeInfo.frameWeight;
if (relative <= 0.0f)
{
float diff = shapeInfo.frameWeight - prevShapeInfo.frameWeight;
if (diff > 0.0f)
{
float t = -relative / diff;
shapeInfo.finalWeight = 1.0f - std::min(t, 1.0f);
}
else
shapeInfo.finalWeight = 1.0f;
}
else // If past the final frame we clamp
shapeInfo.finalWeight = 1.0f;
}
}
for (UINT32 j = 0; j < channelInfo.shapeCount; j++)
{
MorphShapeInfo& shapeInfo = anim->morphShapeInfos[channelInfo.shapeStart + j];
shapeInfo.finalWeight *= channelInfo.weight;
}
}
// Generate morph shape vertices
if (anim->morphChannelWeightsDirty || hasMorphCurves)
{
SPtr<MeshData> meshData = bs_shared_ptr_new<MeshData>(anim->numMorphVertices, 0, mBlendShapeVertexDesc);
UINT8* bufferData = meshData->getData();
memset(bufferData, 0, meshData->getSize());
UINT32 tempDataSize = (sizeof(Vector3) + sizeof(float)) * anim->numMorphVertices;
UINT8* tempData = (UINT8*)bs_stack_alloc(tempDataSize);
memset(tempData, 0, tempDataSize);
Vector3* tempNormals = (Vector3*)tempData;
float* accumulatedWeight = (float*)(tempData + sizeof(Vector3) * anim->numMorphVertices);
UINT8* positions = meshData->getElementData(VES_POSITION, 1, 1);
UINT8* normals = meshData->getElementData(VES_NORMAL, 1, 1);
UINT32 stride = mBlendShapeVertexDesc->getVertexStride(1);
for (UINT32 i = 0; i < anim->numMorphShapes; i++)
{
const MorphShapeInfo& info = anim->morphShapeInfos[i];
float absWeight = Math::abs(info.finalWeight);
if (absWeight < 0.0001f)
continue;
const Vector<MorphVertex>& morphVertices = info.shape->getVertices();
UINT32 numVertices = (UINT32)morphVertices.size();
for (UINT32 j = 0; j < numVertices; j++)
{
const MorphVertex& vertex = morphVertices[j];
Vector3* destPos = (Vector3*)(positions + vertex.sourceIdx * stride);
*destPos += vertex.deltaPosition * info.finalWeight;
tempNormals[vertex.sourceIdx] += vertex.deltaNormal * info.finalWeight;
accumulatedWeight[vertex.sourceIdx] += absWeight;
}
}
for (UINT32 i = 0; i < anim->numMorphVertices; i++)
{
PackedNormal* destNrm = (PackedNormal*)(normals + i * stride);
if (accumulatedWeight[i] > 0.0001f)
{
Vector3 normal = tempNormals[i] / accumulatedWeight[i];
normal /= 2.0f; // Accumulated normal is in range [-2, 2] but our normal packing method assumes [-1, 1] range
MeshUtility::packNormals(&normal, (UINT8*)destNrm, 1, sizeof(Vector3), stride);
destNrm->w = (UINT8)(std::min(1.0f, accumulatedWeight[i]) * 255.999f);
}
else
{
*destNrm = { { 127, 127, 127, 0 } };
}
}
bs_stack_free(tempData);
animInfo.morphShapeInfo.meshData = meshData;
animInfo.morphShapeInfo.version++;
anim->morphChannelWeightsDirty = false;
}
hasAnimInfo = true;
}
else
animInfo.morphShapeInfo.version = 1;
if (hasAnimInfo)
{
Lock lock(mMutex);
renderData.infos[anim->id] = animInfo;
}
}
UINT64 AnimationManager::registerAnimation(Animation* anim)
{
mAnimations[mNextId] = anim;
return mNextId++;
}
void AnimationManager::unregisterAnimation(UINT64 animId)
{
mAnimations.erase(animId);
}
AnimationManager& gAnimation()
{
return AnimationManager::instance();
}
} |
format PE64 console
entry start
include 'win64w.inc'
section '.data' data readable writeable
stdout dq ?
filename TCHAR 'filecreate.txt', 0h
fail db 'failed to create file', 0h
section '.text' code readable executable
start:
fastcall setStdout
invoke CreateFile, filename,\
GENERIC_READ|GENERIC_WRITE,\
0,\
0,\
OPEN_ALWAYS,\
FILE_ATTRIBUTE_NORMAL,\
0
cmp rax, 0
jne @f
mov rcx, fail
fastcall sprintLF
@@:
fastcall quitProgram
include 'procs.inc'
section '.idata' import data readable
library kernel32, 'kernel32.dll'
include 'api\kernel32.inc'
|
#include <pigne/Image.h>
using namespace cimg_library;
Image::Image(char*path, bool forceLoading)
{
this->path = path;
this->textureId = -1;
if (forceLoading)
this->load();
}
void Image::load()
{
if (this->loaded) {
getEngineInstance()->getDebugger()->printError("Image %s has already been loaded", this->path); return; }
this->loaded = true;
if (access( this->path, F_OK ) != 0)
{
getEngineInstance()->getDebugger()->printError("Image with path %s doesn't exist!", this->path);
delete this;
}
CImg<unsigned char> image(this->path);
this->size = new Vec2(image._width, image._height);
int s = this->size->x*this->size->y*3;
this->buffer = new uint8_t[s];
for (int i = 0; i < s;i+=3) {
this->buffer[i] = 0xFF;
this->buffer[i + 1] = 0xFF;
this->buffer[i + 2] = 0x00;
}
}
void Image::bindTexture()
{
if (this->textureId == -1)
{
GLuint tex;
glGenTextures(1, &tex);
this->textureId = tex;
glBindTexture(GL_TEXTURE_2D, this->textureId);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, this->size->x, this->size->y, 0, GL_BGR, GL_UNSIGNED_BYTE, this->buffer);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
}
else glBindTexture(GL_TEXTURE_2D, this->textureId);
}
Vec2*Image::getSize()
{
return this->size;
}
uint8_t*Image::getBuffer()
{
return this->buffer;
}
|
; A225373: a(n) = 1 + Sum_{i=0..floor(n/2)} phi(n-2*i).
; 1,2,2,4,4,8,6,14,10,20,14,30,18,42,24,50,32,66,38,84,46,96,56,118,64,138,76,156,88,184,96,214,112,234,128,258,140,294,158,318,174,358,186,400,206,424,228,470,244,512,264,544,288,596,306,636,330,672,358,730
seq $0,106481 ; An Euler phi transform of 1/(1-x^2).
add $0,1
|
; A255413: Row 3 of Ludic array A255127: a(n) = A007310((5*n)-3).
; 5,19,35,49,65,79,95,109,125,139,155,169,185,199,215,229,245,259,275,289,305,319,335,349,365,379,395,409,425,439,455,469,485,499,515,529,545,559,575,589,605,619,635,649,665,679,695,709,725,739,755,769,785,799,815,829,845,859,875,889,905,919,935,949,965,979,995,1009,1025,1039,1055,1069,1085,1099,1115,1129,1145,1159,1175,1189,1205,1219,1235,1249,1265,1279,1295,1309,1325,1339,1355,1369,1385,1399,1415,1429,1445,1459,1475,1489,1505,1519,1535,1549,1565,1579,1595,1609,1625,1639,1655,1669,1685,1699,1715,1729,1745,1759,1775,1789,1805,1819,1835,1849,1865,1879,1895,1909,1925,1939,1955,1969,1985,1999,2015,2029,2045,2059,2075,2089,2105,2119,2135,2149,2165,2179,2195,2209,2225,2239,2255,2269,2285,2299,2315,2329,2345,2359,2375,2389,2405,2419,2435,2449,2465,2479,2495,2509,2525,2539,2555,2569,2585,2599,2615,2629,2645,2659,2675,2689,2705,2719,2735,2749,2765,2779,2795,2809,2825,2839,2855,2869,2885,2899,2915,2929,2945,2959,2975,2989,3005,3019,3035,3049,3065,3079,3095,3109,3125,3139,3155,3169,3185,3199,3215,3229,3245,3259,3275,3289,3305,3319,3335,3349,3365,3379,3395,3409,3425,3439,3455,3469,3485,3499,3515,3529,3545,3559,3575,3589,3605,3619,3635,3649,3665,3679,3695,3709,3725,3739
mov $1,$0
mul $1,30
div $1,4
mul $1,2
add $1,5
|
._CPU = 6502
; For the Atari2600
; Hardware definitions
.include stella.asm
; RAM Usage
.TMP0 = 128
.TMP1 = 129
.TMP2 = 130
.PLAYR0Y = 131
.PLAYR1Y = 132
.MUS_TMP0 = 133
.MUS_TMP1 = 134
.SCANCNT = 135
.MODE = 136
.WALL_INC = 137
.WALLCNT = 138
.WALLDELY = 139
.WALLDELYR = 140
.ENTROPYA = 141
.ENTROPYB = 142
.ENTROPYC = 143
.DEBOUNCE = 144
.WALLDRELA = 145
.WALLDRELB = 146
.WALLDRELC = 147
.WALLSTART = 148
.WALLHEI = 149
.GAPBITS = 150
.SCORE_PF1 = 151
.SCORE_PF2 = 157
.MUSADEL = 163
.MUSAIND = 164
.MUSAVOL = 165
.MUSBDEL = 166
.MUSBIND = 167
.MUSBVOL = 168
0xF000:
main:
SEI ; Turn off interrupts
CLD ; Clear the "decimal" flag
LDX #0xFF ; Set stack ...
TXS ; ... to the end of RAM
JSR INIT ; Initialize game environment
JSR INIT_SELMODE ; Start out in SELECT-MODE
VIDEO_KERNEL:
LDA #2 ; D1 bit ON
STA WSYNC ; Wait for the end of the current line
STA VBLANK ; Turn the electron beam off
STA WSYNC ; Wait for all ...
STA WSYNC ; ... the electrons ...
STA WSYNC ; ... to drain out.
STA VSYNC ; Trigger the vertical sync signal
STA WSYNC ; Hold the vsync signal for ...
STA WSYNC ; ... three ...
STA WSYNC ; ... scanlines
STA HMOVE ; Tell hardware to move all game objects
LDA #0 ; D1 bit OFF
STA VSYNC ; Release the vertical sync signal
LDA #43 ; Set timer to 43*64 = 2752 machine ...
STA TIM64T ; ... cycles 2752/(228/3) = 36 scanlines
; ***** LENGTHY GAME LOGIC PROCESSING BEGINS HERE *****
; Do one of 3 routines while the beam travels back to the top
; 0 = Game Over processing
; 1 = Playing-Game processing
; 2 = Selecting-Game processing
INC ENTROPYA ; Counting video frames as part of the random number
LDA MODE ; What are we doing between frames?
CMP #0 ; Mode is ...
BEQ DoGameOverMode ; ... "game over"
CMP #1 ; Mode is ...
BEQ DoPlayMode ; ... "game play"
JSR SELMODE ; Mode is "select game"
JMP DrawFrame ; Continue to the visible screen area
DoPlayMode:
JSR PLAYMODE ; Playing-game processing
JMP DrawFrame ; Continue to the visible screen area
DoGameOverMode:
JSR GOMODE ; Game-over processing
; ***** LENGTHY GAME LOGIC PROCESSING ENDS HERE *****
DrawFrame:
LDA INTIM ; Wait for ...
CMP #0 ; ... the visible area ...
BNE DrawFrame ; ... of the screen
STA WSYNC ; 37th scanline
LDA #0 ; Turn the ...
STA VBLANK ; ... electron beam back on
LDA #0 ; Zero out ...
STA SCANCNT ; ... scanline count ...
STA TMP0 ; ... and all ...
STA TMP1 ; ... returns ...
STA TMP2 ; ... expected ...
TAX ; ... to come from ...
TAY ; ... BUILDROW
STA CXCLR ; Clear collision detection
DrawVisibleRows:
LDA TMP0 ; Get A ready (PF0 value)
STA WSYNC ; Wait for very start of row
STX GRP0 ; Player 0 -- in X
STY GRP1 ; Player 1 -- in Y
STA PF0 ; PF0 -- in TMP0 (already in A)
LDA TMP1 ; PF1 -- in TMP1
STA PF1 ; ...
LDA TMP2 ; PP2 -- in TMP2
STA PF2 ; ...
JSR BUILDROW ; This MUST take through to the next line
INC SCANCNT ; Next scan line
LDA SCANCNT ; Do 109*2 = 218 lines
CMP #109 ; All done?
BNE DrawVisibleRows ; No ... get all the visible rows
; END VISIBLE PART OF FRAME
LDA #0 ; Turn off electron beam
STA WSYNC ; Next scanline
STA PF0 ; Play field 0 off
STA GRP0 ; Player 0 off
STA GRP1 ; Player 1 off
STA PF1 ; Play field 1 off
STA PF2 ; Play field 2 off
STA WSYNC ; Next scanline
JMP VIDEO_KERNEL
BUILDROW:
LDA SCANCNT ; Where are we on the screen?
CMP #6 ; If we are in the ...
BCC ShowScore ; ... score area
AND #7 ; Lower 3 bits as an index again
TAY ; Using Y to lookup graphics
LDA GR_PLAYER,Y ; Get the graphics (if enabled on this row)
TAX ; Hold it (for return as player 0)
TAY ; Hold it (for return as player 1)
LDA SCANCNT ; Scanline count again
LSR A ; This time ...
LSR A ; ... we divide ...
LSR A ; ... by eight (8 rows in picture)
CMP PLAYR0Y ; Scanline group of the P0 object?
BEQ ShowP0 ; Yes ... keep the picture
LDX #0 ; Not time for Player 0 ... no graphics
ShowP0:
CMP PLAYR1Y ; Scanline group of the P1 object?
BEQ ShowP1 ; Yes ... keep the picture
LDY #0 ; Not time for Player 0 ... no graphics
ShowP1:
LDA WALLSTART ; Calculate ...
CLC ; ... the bottom ...
ADC WALLHEI ; ... of ...
STA TMP0 ; ... the wall
LDA SCANCNT ; Scanline count
CMP WALLSTART ; Past upper part of wall?
BCC NoWall ; No ... skip it
CMP TMP0 ; Past lower part of wall
BCS NoWall ; Yes ... skip it
; The wall is on this row
LDA WALLDRELA ; Draw wall ...
STA TMP0 ; ... by transfering ...
LDA WALLDRELB ; ... playfield ...
STA TMP1 ; ... patterns ...
LDA WALLDRELC ; ... to ...
STA TMP2 ; ... return area
RTS ; Done
NoWall:
; The wall is NOT on this row
LDA #0 ; No walls on this row
STA TMP0 ; ... clear ...
STA TMP1 ; ... out ...
STA TMP2 ; ... the playfield
RTS ; Done
ShowScore:
AND #7 ; OLine=182 Only need the lower 3 bits
TAY ; OLine=183 Soon to be an index into a list
; At this point, the beam is past the loading of the
; playfield for the left half. We want to make sure
; that the right half of the playfield is off, so do that
; now.
LDX #0 ; Blank bit pattern
STX TMP0 ; This will always be blank
STX PF1 ; Turn off playfield ...
STX PF2 ; ... for right half of the screen
TAX ; Another index
LDA SCORE_PF1,Y ; Lookup the PF1 graphics for this row
STA TMP1 ; Return it to the caller
TAY ; We'll need this value again in a second
LDA SCORE_PF2,X ; Lookup the PF2 graphics for this row
STA TMP2 ; Return it to the caller
STA WSYNC ; Now on the next row
STY PF1 ; Repeat the left-side playfield ...
STA PF2 ; ... onto the new row
LDA SCORE_PF2,X ; Kill some time waiting for the ...
LDA SCORE_PF2,X ; ... beam to pass the left half ...
LDA SCORE_PF2,X ; ... of the playfield again
LDA SCORE_PF2,X ; ...
LDA SCORE_PF2,X ; ...
LDA SCORE_PF2,X ; ...
LDX #0 ; Return 0 (off) for player 0 ...
LDY #0 ; ... and player 1
; The beam is past the left half of the field again.
; Turn off the playfield.
STX PF1 ; 0 to PF1 ...
STX PF2 ; ... and PF2
RTS ; Done
INIT:
; This function is called ONCE at power-up/reset to initialize various
; game settings and variables.
LDA #64 ; Wall is ...
STA COLUPF ; ... redish
LDA #126 ; P0 is ...
STA COLUP0 ; ... white
LDA #0 ; P1 ...
STA COLUP1 ; ... black
LDA #5 ; Right half of playfield is reflection of left ...
STA CTRLPF ; ... and playfield is on top of players
; TODO other hardware inits here
LDX #4 ; Player 0 position count
LDY #3 ; Player 1 position count
STA WSYNC ; Get a fresh scanline
TimeP0Pos:
DEX ; Kill time while the beam moves ...
CPX #0 ; ... to desired ...
BNE TimeP0Pos ; ... position
STA RESP0 ; Mark player 0's X position
TimeP1Pos:
DEY ; Kill time while the beam moves ...
CPY #0 ; ... to desired ...
BNE TimeP1Pos ; ... position
STA RESP1 ; Mark player 1's X position
JSR EXPERTISE ; Initialize the players' Y positions base on expert-settings
LDA #10 ; Wall is ...
STA WALLHEI ; ... 10 double-scanlines high
LDA #0 ; Set score to ...
STA WALLCNT ; ... 0
JSR MAKE_SCORE ; Blank the score digits
LDA #0 ; Blank bits ...
STA SCORE_PF2+5 ; ... on the end of each ...
STA SCORE_PF1+5 ; ... digit pattern
JSR ADJUST_DIF ; Initialize the wall parameters
JSR NEW_GAPS ; Build the wall's initial gap
LDA #112 ; Set wall position off bottom ...
STA WALLSTART ; ... to force a restart on first move
LDA #0 ; Zero out ...
STA HMP0 ; ... player 0 motion ...
STA HMP1 ; ... and player 1 motion
RTS ; Done
INIT_PLAYMODE:
; This function initializes the game play mode
LDA #192 ; Background is ...
STA COLUBK ; ... greenish
LDA #1 ; Game mode is ...
STA MODE ; ... SELECT
LDA #255 ; Restart wall score to ...
STA WALLCNT ; ... 0 on first move
LDA #112 ; Force wall to start ...
STA WALLSTART ; ... over on first move
JSR INIT_MUSIC ; Initialize the music
RTS ; Done
PLAYMODE:
; This function is called once per frame to process the main game play.
JSR SEL_RESET_CHK ; Check to see if Reset/Select has changed
CMP #0 ; Is select pressed?
BEQ NoSelect ; No ... skip
STX DEBOUNCE ; Restore the old value ...
JSR INIT_SELMODE ; ... and let select-mode process the toggle
RTS ; Done
NoSelect:
JSR PROCESS_MUSIC ; Process any playing music
JSR MOVE_WALLS ; Move the walls
CMP #1 ; Wall on first row?
BNE NoFirst ; No ... move on
INC WALLCNT ; Bump the score
JSR ADJUST_DIF ; Change the wall parameters based on score
LDA WALLCNT ; Change the ...
JSR MAKE_SCORE ; ... score pattern
JSR NEW_GAPS ; Calculate the new gap position
NoFirst:
LDA CXP0FB ; Player 0 collision with playfield
STA TMP0 ; Hold it
LDA CXP1FB ; Player 1 collision with playfield
ORA TMP0 ; Did either ...
AND #128 ; ... player hit ...
CMP #0 ; ... wall?
BEQ NoHit ; No ... move on
JSR INIT_GOMODE ; Go to Game-Over mode
RTS ; Done
NoHit:
LDA SWCHA ; Joystick
AND #128 ; Player 0 ...
CMP #0 ; ... moving left?
BEQ MoveP0Left ; Yes ... move left
LDA SWCHA ; Joystick
AND #64 ; Player 0 ...
CMP #0 ; ... moving right?
BEQ MoveP0Right ; Yes ... move right
LDA #0 ; Not moving value
JMP SetMoveP0 ; Don't move the player
MoveP0Right:
LDA #16 ; +1
JMP SetMoveP0 ; Set HMP0
MoveP0Left:
LDA #240 ; -1
SetMoveP0:
STA HMP0 ; New movement value P0
LDA SWCHA ; Joystick
AND #8 ; Player 1 ...
CMP #0 ; ... moving left?
BEQ MoveP1Left ; Yes ... move left
LDA SWCHA ; Joystick
AND #4 ; Player 0 ...
CMP #0 ; ... moving right?
BEQ MoveP1Right ; Yes ... move right
LDA #0 ; Not moving value
JMP SetMoveP1 ; Don't move the player
MoveP1Right:
LDA #16 ; +1
JMP SetMoveP1 ; Set HMP0
MoveP1Left:
LDA #240 ; -1
SetMoveP1:
STA HMP1 ; New movement value P1
RTS ; Done
INIT_SELMODE:
; This function initializes the games SELECT-MODE
LDA #0 ; Turn off ...
STA AUDV0 ; ... all ...
STA AUDV1 ; ... sound
LDA #200 ; Background ...
STA COLUBK ; ... greenish bright
LDA #2 ; Now in ...
STA MODE ; SELECT game mode
RTS ; Done
SELMODE:
; This function is called once per frame to process the SELECT-MODE.
; The wall moves here, but doesn't change or collide with players.
; This function selects between 1 and 2 player game.
JSR MOVE_WALLS ; Move the walls
JSR SEL_RESET_CHK ; Check the reset/select switches
CMP #1 ; RESET button?
BEQ SelStartGame ; Yes ... start game
CMP #3 ; RESET and SELECT?
BEQ SelStartGame ; Yes ... start game
CMP #2 ; Select only?
BNE SelExp ; No ... stay in this mode
LDA PLAYR1Y ; Select toggled. Get player 1 Y coordinate
CMP #255 ; 2nd player on the screen?
BEQ SelP1On ; No ... toggle it on
LDA #255 ; Yes ...
STA PLAYR1Y ; ... toggle it off
JMP SelExp ; Move to expertise
SelP1On:
LDA #12 ; Y coordinate
STA PLAYR1Y ; On screen now
JMP SelExp ; Move to expertise
SelStartGame:
JSR INIT_PLAYMODE ; Reset toggled ... start game
SelExp:
JSR EXPERTISE ; Adjust both players for pro settings
RTS ; Done
INIT_GOMODE:
; This function initializes the GAME-OVER game mode.
STA HMCLR ; Stop both players from moving
LDA CXP0FB ; P0 collision ...
AND #128 ; ... with wall
CMP #0 ; Did P0 hit the wall?
BNE GoCheckP1 ; Yes ... leave it at bottom
LDA #2 ; No ... move player 0 ...
STA PLAYR0Y ; ... up the screen to show win
GoCheckP1:
LDA CXP1FB ; P1 collision ...
AND #128 ; ... with wall
CMP #0 ; Did P1 hit the wall?
BNE GoP1Hit ; Yes ... leave it at the bottom
LDA PLAYR1Y ; Is P1 even ...
CMP #255 ; ... on the screen (2 player game?)
BEQ GoP1Hit ; No ... skip it
LDA #2 ; Player 1 is onscreen and didn't collide ...
STA PLAYR1Y ; ... move up the screen to show win
GoP1Hit:
LDA #0 ; Going to ...
STA MODE ; ... game-over mode
STA AUDV0 ; Turn off any ...
STA AUDV1 ; ... sound
JSR INIT_GO_FX ; Initialize sound effects
RTS ; Done
GOMODE:
; This function is called every frame to process the game
; over sequence. When the sound effect has finished, the
; game switches to select mode.
JSR PROCESS_GO_FX ; Process the sound effects
CMP #0 ; Effects still running?
BEQ GoKeepGoing ; Yes ... let them run
JSR INIT_SELMODE ; When effect is over, go to select mode
GoKeepGoing:
RTS ; Done
MOVE_WALLS:
; This function moves the wall down the screen and back to position 0
; when it reaches (or passes) 112.
DEC WALLDELY ; Wall motion timer
LDA WALLDELY ; Time to ...
CMP #0 ; ... move the wall?
BNE WallDone ; No ... leave it alone
LDA WALLDELYR ; Reset the ...
STA WALLDELY ; ... delay count
LDA WALLSTART ; Current wall position
CLC ; Increment ...
ADC WALL_INC ; ... wall position
CMP #112 ; At the bottom?
BCC WallOK ; No ... leave it alone
LDA #0 ; Else restart ...
STA WALLSTART ; ... wall at top of screen
LDA #1 ; Return flag that wall DID restart
RTS ; Done
WallOK:
STA WALLSTART ; Store new wall position
WallDone:
LDA #0 ; Return flag that wall did NOT restart
RTS ; Done
NEW_GAPS:
; This function builds the PF0, PF1, and PF2 graphics for a wall
; with the gap pattern (GAPBITS) placed at random in the 20 bit
; area.
LDA #255 ; Start with ...
STA WALLDRELA ; ... solid wall in PF0 ...
STA WALLDRELB ; ... and PF1
LDA GAPBITS ; Store the gap pattern ...
STA WALLDRELC ; ... in PF2
LDA ENTROPYA ; Get ...
ADC ENTROPYB ; ... a randomish ...
ADC ENTROPYC ; ... number ...
STA ENTROPYC ; Update the random seed
AND #15 ; 0 to 15
CMP #12 ; Too far to the right?
BEQ GapOK ; No ... 12 is OK
BCC GapOK ; No ... less than 12 is OK
SBC #9 ; Back up 9
GapOK:
CMP #0 ; Gap already at far left?
BEQ GapDone ; Yes ... done
SEC ; Roll gap ...
ROR WALLDRELC ; ... left ...
ROL WALLDRELB ; ... desired ...
ROR WALLDRELA ; ... times ...
SEC ; All rolls ...
SBC #1 ; ... done?
JMP GapOK ; No ... do them all
GapDone:
RTS ; New wall pattern is ready
MAKE_SCORE:
; This function builds the PF1 and PF2 graphics rows for
; the byte value passed in A. The current implementation is
; two-digits only ... PF2 is blank.
LDX #0 ; 100's digit
LDY #0 ; 10's digit
Count100s:
CMP #100 ; Need another 100s digit?
BCC Count10s ; No ... move on to 10s
INX ; Count ...
SEC ; ... value
SBC #100 ; Take off this 100
JMP Count100s ; Keep counting
Count10s:
CMP #10 ; Need another 10s digit?
BCC CountDone ; No ... got all the tens
INY ; Count ...
SEC ; ... value
SBC #10 ; Take off this 10
JMP Count10s ; Keep counting
CountDone:
ASL A ; One's digit ...
ASL A ; ... *8 ....
ASL A ; ... to find picture
TAX ; One's digit picture to X
TYA ; Now the 10's digit
ASL A ; Multiply ...
ASL A ; ... by 8 ...
ASL A ; ... to find picture
TAY ; 10's picture in Y
LDA DIGITS,Y ; Get the 10's digit
AND #0xF0 ; Upper nibble
STA SCORE_PF1 ; Store left side
LDA DIGITS,X ; Get the 1's digit
AND #0x0F ; Lower nibble
ORA SCORE_PF1 ; Put left and right half together
STA SCORE_PF1 ; And store image
; We have plenty of code space. Time and registers are at a premium.
; So copy/past the code for each row
LDA DIGITS+1,Y ; Repeat for 2nd line of picture ...
AND #0xF0 ; ...
STA SCORE_PF1+1 ; ...
LDA DIGITS+1,X ; ...
AND #15 ; ...
ORA SCORE_PF1+1 ; ...
STA SCORE_PF1+1 ; ...
LDA DIGITS+2,Y ; Repeat for 3nd line of picture
AND #0xF0 ; ...
STA SCORE_PF1+2 ; ...
LDA DIGITS+2,X ; ...
AND #0x0F ; ...
ORA SCORE_PF1+2 ; ...
STA SCORE_PF1+2 ; ...
LDA DIGITS+3,Y ; Repeat for 4th line of picture
AND #0xF0 ; ...
STA SCORE_PF1+3 ; ...
LDA DIGITS+3,X ; ...
AND #0x0F ; ...
ORA SCORE_PF1+3 ; ...
STA SCORE_PF1+3 ; ...
LDA DIGITS+4,Y ; Repeat for 5th line of picture
AND #0xF0 ; ...
STA SCORE_PF1+4 ; ...
LDA DIGITS+4,X ; ...
AND #0x0F ; ...
ORA SCORE_PF1+4 ; ...
STA SCORE_PF1+4 ; ...
LDA #0 ; For now ...
STA SCORE_PF2 ; ... there ...
STA SCORE_PF2+1 ; ... is ...
STA SCORE_PF2+2 ; ... no ...
STA SCORE_PF2+3 ; ... 100s ...
STA SCORE_PF2+4 ; ... digit drawn
RTS ; Done
EXPERTISE:
; This function changes the Y position of the players based on the
; position of their respective pro/novice switches. The player 1
; position is NOT changed if the mode is a single-player game.
LDA SWCHB ; Check P0 ...
AND #0x40 ; ... pro/novice settings
CMP #0 ; Amateur?
BEQ ExpP0Ama ; Yes ... near the bottom of screen
LDA #8 ; Pro ... near the top
JMP ExpP1 ; Store and check P0
ExpP0Ama:
LDA #12 ; near the bottom
ExpP1:
STA PLAYR0Y ; Player 0 Y coordinate
LDX PLAYR1Y ; Is P1 on ...
CPX #255 ; ... the screen?
BEQ ExpNoP1 ; No ... skip all this
LDA SWCHB ; Check P1 ...
AND #0x80 ; ... pro/novice settings
CMP #0 ; Amateur?
BEQ ExpP1Ama ; Yes ... near the bottom of the screen
LDX #8 ; Pro ... near the top
JMP ExpDone ; Store and out
ExpP1Ama:
LDX #12 ; Novice ... near the bottom
ExpDone:
STX PLAYR1Y ; Player 1 Y coordinate
ExpNoP1:
RTS ; Done
ADJUST_DIF:
; This function adjusts the wall game difficulty values based on the
; current score. The music can also change with the difficulty. A single
; table describes the new values and when they take effect.
LDX #0 ; Starting at index 0
AdjNextRow:
LDA SKILL_VALUES,X ; Get the score match
CMP #255 ; At the end of the table?
BNE AdjCheckTable ; No ... check this row
RTS ; End of the table ... leave it alone
AdjCheckTable:
CMP WALLCNT ; Is this our row?
BNE AdjBump ; No ... bump to next
INX ; Copy ...
LDA SKILL_VALUES,X ; ... new ...
STA WALL_INC ; ... wall increment
INX ; Copy ...
LDA SKILL_VALUES,X ; ... new ...
STA WALLDELY ; ... wall ...
STA WALLDELYR ; ... delay
INX ; Copy ...
LDA SKILL_VALUES,X ; ... new ...
STA GAPBITS ; ... gap pattern
INX ; Copy ...
LDA SKILL_VALUES,X ; ... new ...
STA MUSAIND ; ... MusicA index
INX ; Copy ...
LDA SKILL_VALUES,X ; ... new ...
STA MUSBIND ; ... MusicB index
LDA #1 ; Force ...
STA MUSADEL ; ... music to ...
STA MUSBDEL ; ... start new
RTS ; Done
AdjBump:
INX ; Move ...
INX ; ... X ...
INX ; ... to ...
INX ; ... next ...
INX ; ... row of ...
INX ; ... table
JMP AdjNextRow ; Try next row
SEL_RESET_CHK:
; This function checks for changes to the reset/select
; switches and debounces the transitions.
; xxxxxxSR (Select, Reset)
LDX DEBOUNCE ; Get the last value
LDA SWCHB ; New value
AND #3 ; Only need bottom 2 bits
CMP DEBOUNCE ; Same as before?
BEQ SelDebounce ; Yes ... return nothing changed
STA DEBOUNCE ; Hold new last value
EOR #255 ; Active low to active high
AND #3 ; Only need select/reset
RTS ; Return changes
SelDebounce:
LDA #0 ; Return 0 ...
RTS ; ... nothing changed
INIT_MUSIC:
; This function initializes the hardware and temporaries
; for 2-channel music
LDA #6 ; Audio control ...
STA AUDC0 ; ... to pure ...
STA AUDC1 ; ... tones
LDA #0 ; Turn off ...
STA AUDV0 ; ... all ...
STA AUDV1 ; ... sound
STA MUSAIND ; Music pointers ...
STA MUSBIND ; ... to top of data
LDA #1 ; Force ...
STA MUSADEL ; ... music ...
STA MUSBDEL ; ... reload
LDA #15 ; Set volume levels ...
STA MUSAVOL ; ... to ...
STA MUSBVOL ; ... maximum
RTS ; Done
PROCESS_MUSIC:
; This function is called once per frame to process the
; 2 channel music. Two tables contain the commands/notes
; for individual channels. This function changes the
; notes at the right time.
DEC MUSADEL ; Current note on Channel A ended?
BNE MusDoB ; No ... let it play
MusChanA:
LDX MUSAIND ; Voice-A index
LDA MUSICA,X ; Get the next music command
CMP #0 ; Jump?
BEQ MusCmdJumpA ; Yes ... handle it
CMP #1 ; Control?
BEQ MusCmdCtrlA ; Yes ... handle it
CMP #2 ; Volume?
BNE MusCmdToneA ; No ... must be a note
INX ; Point to volume value
INC MUSAIND ; Bump the music pointer
LDA MUSICA,X ; Get the volume value
INC MUSAIND ; Bump the music pointer
STA MUSAVOL ; Store the new volume value
JMP MusChanA ; Keep processing through a tone
MusCmdCtrlA:
INX ; Point to the control value
INC MUSAIND ; Bump the music pointer
LDA MUSICA,X ; Get the control value
INC MUSAIND ; Bump the music pointer
STA AUDC0 ; Store the new control value
JMP MusChanA ; Keep processing through a tone
MusCmdJumpA:
INX ; Point to jump value
TXA ; X to ...
TAY ; ... Y (pointer to jump value)
INX ; Point one past jump value
TXA ; Into A so we can subtract
SEC ; New ...
SBC MUSICA,Y ; ... index
STA MUSAIND ; Store it
JMP MusChanA ; Keep processing through a tone
MusCmdToneA:
LDY MUSAVOL ; Get the volume
AND #0x1F ; Lower 5 bits are frequency
CMP #0x1F ; Is this a silence?
BNE MusNoteA ; No ... play it
LDY #0 ; Frequency of 31 flags silence
MusNoteA:
STA AUDF0 ; Store the frequency
STY AUDV0 ; Store the volume
LDA MUSICA,X ; Get the note value again
INC MUSAIND ; Bump to the next command
ROR A ; The upper ...
ROR A ; ... three ...
ROR A ; ... bits ...
ROR A ; ... hold ...
ROR A ; ... the ...
AND #7 ; ... delay
CLC ; No accidental carry
ROL A ; Every delay tick ...
ROL A ; ... is *4 frames
STA MUSADEL ; Store the note delay
MusDoB:
DEC MUSBDEL
BNE MusDoDone
MusChanB:
LDX MUSBIND
LDA MUSICB,X
CMP #0
BEQ MusCmdJumpB
CMP #1
BEQ MusCmdCtrlB
CMP #2
BNE MusCmdToneB
INX
INC MUSBIND
LDA MUSICB,X
INC MUSBIND
STA MUSBVOL
JMP MusChanB
MusCmdCtrlB:
INX
INC MUSBIND
LDA MUSICB,X
INC MUSBIND
STA AUDC1
JMP MusChanB
MusCmdJumpB:
INX
TXA
TAY
INX
TXA
SEC
SBC MUSICB,Y
STA MUSBIND
JMP MusChanB
MusCmdToneB:
LDY MUSBVOL
AND #0x1F
CMP #0x1F
BNE MusNoteB
LDY #0
MusNoteB:
STA AUDF1
STY AUDV1
LDA MUSICB,X
INC MUSBIND
ROR A
ROR A
ROR A
ROR A
ROR A
AND #7
CLC
ROL A
ROL A
STA MUSBDEL
MusDoDone:
RTS ; Done
INIT_GO_FX:
; This function initializes the hardware and temporaries
; to play the soundeffect of a player hitting the wall
LDA #5 ; Set counter for frame delay ...
STA MUS_TMP1 ; ... between frequency change
LDA #3 ; Tone type ...
STA AUDC0 ; ... poly tone
LDA #15 ; Volume A ...
STA AUDV0 ; ... to max
LDA #0 ; Volume B ...
STA AUDV1 ; ... silence
LDA #240 ; Initial ...
STA MUS_TMP0 ; ... sound ...
STA AUDF0 ; ... frequency
RTS ; Done
PROCESS_GO_FX:
; This function is called once per scanline to play the
; soundeffects of a player hitting the wall.
DEC MUS_TMP1 ; Time to change the frequency?
BNE FxRun ; No ... let it run
LDA #5 ; Reload ...
STA MUS_TMP1 ; ... the frame count
INC MUS_TMP0 ; Increment ...
LDA MUS_TMP0 ; ... the frequency divisor
STA AUDF0 ; Change the frequency
CMP #0
BNE FxRun
LDA #1 ; All done ... return 1
RTS ; Done
FxRun:
LDA #0 ; Keep playing
RTS ; Done
; Music commands for Channel A and Channel B
; A word on music and wall timing ...
; Wall moves between scanlines 0 and 111 (112 total)
; Wall-increment frames-to-top
; 3 336
; 2 224
; 1 112
; 0.5 56 ; Ah ... but we are getting one less
; Each tick is multiplied by 4 to yield 4 frames per tick
; 32 ticks/song = 32*4 = 128 frames / song
; We want songs to start with wall at top ...
; Find the least-common-multiple
; 336 and 128 : 2688 8 walls, 21 musics
; 224 and 128 : 896 4 walls, 7 musics
; 112 and 128 : 896 8 walls, 7 musics
; 56 and 128 : 896 16 walls, 7 musics
; Wall moving every other gives us 112*2=224 scanlines
; Song and wall are at start every 4
; 1 scanline, every 8
; Wall delay=3 gives us 128*3=336 scanlines 2
.MUSCMD_JUMP = 0 ; Music command value for JUMP
.MUSCMD_CONTROL = 1 ; Music command value for CONTROL
.MUSCMD_VOLUME = 2 ; Music command value for VOLUME
.MUS_REST = 31 ; Frequency value for silence
.MUS_DEL_1 = 32*1 ; Note duration 1
.MUS_DEL_2 = 32*2 ; Note duration 2
.MUS_DEL_3 = 32*3 ; Note duration 3
.MUS_DEL_4 = 32*4 ; Note duration 4
MUSICA:
MA_SONG_1:
.byte MUSCMD_CONTROL, 12
.byte MUSCMD_VOLUME, 15 ; Volume (full)
MA1_01:
.byte MUS_DEL_3 + 15
.byte MUS_DEL_1 + MUS_REST
.byte MUS_DEL_3 + 15
.byte MUS_DEL_1 + MUS_REST
.byte MUS_DEL_1 + 7
.byte MUS_DEL_1 + MUS_REST
.byte MUS_DEL_1 + 7
.byte MUS_DEL_1 + MUS_REST
.byte MUS_DEL_2 + MUS_REST
.byte MUS_DEL_1 + 8
.byte MUS_DEL_1 + MUS_REST
.byte MUS_DEL_4 + MUS_REST
.byte MUS_DEL_2 + 17
.byte MUS_DEL_2 + MUS_REST
.byte MUS_DEL_2 + 17
.byte MUS_DEL_2 + MUS_REST
.byte MUS_DEL_3 + 16
.byte MUS_DEL_1 + MUS_REST
.byte MUSCMD_JUMP, (MA1_END - MA1_01) ; Repeat back to top
MA1_END:
MA_SONG_2:
.byte MUSCMD_CONTROL, 12
.byte MUSCMD_VOLUME, 15
MA2_01:
.byte MUS_DEL_1 + 15
.byte MUS_DEL_1 + MUS_REST
.byte MUS_DEL_1 + 15
.byte MUS_DEL_1 + MUS_REST
.byte MUS_DEL_2 + MUS_REST
.byte MUS_DEL_4 + 7
.byte MUS_DEL_4 + MUS_REST
.byte MUS_DEL_2 + 15
.byte MUS_DEL_4 + MUS_REST
.byte MUS_DEL_2 + 12
.byte MUS_DEL_2 + MUS_REST
.byte MUS_DEL_2 + 15
.byte MUS_DEL_2 + MUS_REST
.byte MUS_DEL_2 + 17
.byte MUS_DEL_2 + MUS_REST
.byte MUSCMD_JUMP, (MA2_END - MA2_01) ; Repeat back to top
MA2_END:
MUSICB:
MB_SONG_1:
.byte MUSCMD_CONTROL, 8
.byte MUSCMD_VOLUME, 8 ; Volume (half)
MB1_01:
.byte MUS_DEL_1 + 10
.byte MUS_DEL_1 + MUS_REST
.byte MUS_DEL_1 + 20
.byte MUS_DEL_1 + MUS_REST
.byte MUS_DEL_1 + 30
.byte MUS_DEL_1 + MUS_REST
.byte MUS_DEL_1 + 15
.byte MUS_DEL_1 + MUS_REST
.byte MUS_DEL_1 + 10
.byte MUS_DEL_1 + MUS_REST
.byte MUS_DEL_1 + 20
.byte MUS_DEL_1 + MUS_REST
.byte MUS_DEL_1 + 30
.byte MUS_DEL_1 + MUS_REST
.byte MUS_DEL_1 + 15
.byte MUS_DEL_1 + MUS_REST
.byte MUSCMD_JUMP, (MB1_END - MB1_01) ; Repeat back to top
MB1_END:
MB_SONG_2:
.byte MUSCMD_CONTROL, 8
.byte MUSCMD_VOLUME, 8
MB2_01:
.byte MUS_DEL_1 + 1
.byte MUS_DEL_1 + MUS_REST
.byte MUS_DEL_1 + 1
.byte MUS_DEL_1 + MUS_REST
.byte MUS_DEL_1 + 1
.byte MUS_DEL_1 + MUS_REST
.byte MUS_DEL_1 + 1
.byte MUS_DEL_1 + MUS_REST
.byte MUS_DEL_1 + 30
.byte MUS_DEL_1 + MUS_REST
.byte MUS_DEL_1 + 30
.byte MUS_DEL_1 + MUS_REST
.byte MUS_DEL_1 + 30
.byte MUS_DEL_1 + MUS_REST
.byte MUS_DEL_1 + 30
.byte MUS_DEL_1 + MUS_REST
.byte MUSCMD_JUMP, (MB2_END - MB2_01) ; Repeat back to top
MB2_END:
SKILL_VALUES:
; This table describes how to change the various
; difficulty parameters as the game progresses.
; For instance, the second entry in the table
; says that when the score is 4, change the values of
; wall-increment to 1, frame-delay to 2, gap-pattern to 0,
; MusicA to 24, and MusicB to 22.
; A 255 on the end of the table indicates the end
; Wall Inc Delay Gap MA MB
.byte 0, 1, 3, 0 ,MA_SONG_1-MUSICA , MB_SONG_1-MUSICB
.byte 4, 1, 2, 0 ,MA_SONG_2-MUSICA , MB_SONG_2-MUSICB
.byte 8, 1, 1, 0 ,MA_SONG_1-MUSICA , MB_SONG_1-MUSICB
.byte 16, 1, 1, 1 ,MA_SONG_2-MUSICA , MB_SONG_2-MUSICB
.byte 24, 1, 1, 3 ,MA_SONG_1-MUSICA , MB_SONG_1-MUSICB
.byte 32, 1, 1, 7 ,MA_SONG_2-MUSICA , MB_SONG_2-MUSICB
.byte 40, 1, 1, 15 ,MA_SONG_1-MUSICA , MB_SONG_1-MUSICB
.byte 48, 2, 1, 0 ,MA_SONG_2-MUSICA , MB_SONG_2-MUSICB
.byte 64, 2, 1, 1 ,MA_SONG_1-MUSICA , MB_SONG_1-MUSICB
.byte 80, 2, 1, 3 ,MA_SONG_2-MUSICA , MB_SONG_2-MUSICB
.byte 96 , 2, 1, 7 ,MA_SONG_1-MUSICA , MB_SONG_1-MUSICB
.byte 255
GR_PLAYER:
; Image for players (8x8)
;
.byte 0b__...1....
.byte 0b__...1....
.byte 0b__..1.1...
.byte 0b__..1.1...
.byte 0b__.1.1.1..
.byte 0b__.1.1.1..
.byte 0b__1.1.1.1.
.byte 0b__.11111..
DIGITS:
; Images for numbers
; We only need 5 rows, but the extra space on the end makes each digit 8 rows,
; which makes it the multiplication easier.
.byte 0b__....111. ; 0 (leading 0 is blank)
.byte 0b__....1.1.
.byte 0b__....1.1.
.byte 0b__....1.1.
.byte 0b__....111.
.byte 0b__........
.byte 0b__........
.byte 0b__........
.byte 0b__..1...1. ; 1
.byte 0b__..1...1.
.byte 0b__..1...1.
.byte 0b__..1...1.
.byte 0b__..1...1.
.byte 0b__........
.byte 0b__........
.byte 0b__........
.byte 0b__111.111. ; 2
.byte 0b__..1...1.
.byte 0b__111.111.
.byte 0b__1...1...
.byte 0b__111.111.
.byte 0b__........
.byte 0b__........
.byte 0b__........
.byte 0b__111.111. ; 3
.byte 0b__..1...1.
.byte 0b__.11..11.
.byte 0b__..1...1.
.byte 0b__111.111.
.byte 0b__........
.byte 0b__........
.byte 0b__........
.byte 0b__1.1.1.1. ; 4
.byte 0b__1.1.1.1.
.byte 0b__111.111.
.byte 0b__..1...1.
.byte 0b__..1...1.
.byte 0b__........
.byte 0b__........
.byte 0b__........
.byte 0b__111.111. ; 5
.byte 0b__1...1...
.byte 0b__111.111.
.byte 0b__..1...1.
.byte 0b__111.111.
.byte 0b__........
.byte 0b__........
.byte 0b__........
.byte 0b__111.111. ; 6
.byte 0b__1...1...
.byte 0b__111.111.
.byte 0b__1.1.1.1.
.byte 0b__111.111.
.byte 0b__........
.byte 0b__........
.byte 0b__........
.byte 0b__111.111. ; 7
.byte 0b__..1...1.
.byte 0b__..1...1.
.byte 0b__..1...1.
.byte 0b__..1...1.
.byte 0b__........
.byte 0b__........
.byte 0b__........
.byte 0b__111.111. ; 8
.byte 0b__1.1.1.1.
.byte 0b__111.111.
.byte 0b__1.1.1.1.
.byte 0b__111.111.
.byte 0b__........
.byte 0b__........
.byte 0b__........
.byte 0b__111.111. ; 9
.byte 0b__1.1.1.1.
.byte 0b__111.111.
.byte 0b__..1...1.
.byte 0b__111.111.
.byte 0b__........
.byte 0b__........
.byte 0b__........
0xF7FA:
; 6502 vectors
.word main
.word main ; Reset vector (top of program)
.word main
|
; A051406: a(n) = (3^n+1) * (3^(n+1)+1) / 8.
; 1,5,35,287,2501,22265,199655,1794707,16145801,145292525,1307573675,11767985927,105911341901,953200482785,8578799562095,77209181709947,694882592342801,6253943201945045,56285488430084915,506569394708502767,4559124548889740501,41032120929547311305,369289088334544742135,3323601794916759500387,29912416153968405967001,269211745384868365093565,2422905708461273420013755,21806151376143835182638807,196255362385271639851294301,1766298261467376128284283825,15896684353206179263426459775,143070159178854995697441854027,1287631432609693108256787834401,11588682893487232415250523954085,104298146041385075060073015920195,938683314372465625509112044282047,8448149829352190479487373101539301,76033348464169713865102452022856345,684300136177527423435070350532715015
add $0,1
mov $1,3
pow $1,$0
add $1,2
pow $1,2
div $1,24
mov $0,$1
|
; ===============================================================
; Tables
; ===============================================================
chartable: ;getcsc to alpha character, $0B relative, extends to $2F
.db 'W'
.db 'R'
.db 'M'
.db 'H'
.db 0
.db 0 ;'?'
.db 0
.db 0
.db 'V'
.db 'Q'
.db 'L'
.db 'G'
.db 0
.db 0
.db 0
.db 'Z'
.db 'U'
.db 'P'
.db 'K'
.db 'F'
.db 'C'
.db 0
.db 0
.db 'Y'
.db 'T'
.db 'O'
.db 0
.db 'E'
.db 'B'
.db 'X'
.db 0
.db 'X'
.db 'S'
.db 'N'
.db 'I'
.db 'D'
.db 'A'
numtable: ;getcsc to numerical character, $12 relative, extends to $24
.db '3'
.db '6'
.db '9'
.db ')' ;r paranthesis
.db 0
.db 0
.db 0
.db '.' ;'.' point
.db '2'
.db '5'
.db '8'
.db '(' ; l paranthesis
.db 0
.db 0
.db 0
.db '0'
.db '1'
.db '4'
.db '7'
rowtable: ;row number to minimum atomic number
.db 1
.db 3
.db 11
.db 19
.db 37
.db 55
.db 87
menutable: ;menu option to displacement #
.db 0
.db 2
.db 3
.db 4
.db 5
.db 6
.db 7
.db 8
.db 9
.db 10
.db 11
.db 12
.db 13
blocktable: ;block # to subshell letter
.db 's', 'p', 'd', 'f'
ngshorttable: ;period # to noble gas shorthand beginning string
.db $C1, "He]", 0
.db $C1, "Ne]", 0
.db $C1, "Ar]", 0
.db $C1, "Kr]", 0
.db $C1, "Xe]", 0
.db $C1, "Rn]", 0
category: ;category keycode to string location
.dw Unknown
.dw alkalimetals
.dw aearthmetals
.dw pnictogens
.dw chalcogens
.dw halogens
.dw noble
.dw lanthanoids
.dw rarearth
.dw actinoids
.dw transitions
.dw ometals
.dw metalloids
.dw onmetals
crystaltab: ;structure keycode to string location
.dw Unknown
.dw tHCP
.dw tCCP
.dw tBCC
.dw tBCT
.dw tCOR
.dw tRH
.dw tCStruc
.dw tCUB
.dw tFCC
.dw tDiamCub
.dw tSpecTetra
.dw tCrysHex
states: ;state keycode to string location
.dw tSynthetic
.dw tSolid
.dw tLiquid
.dw tGas
pages: ;Jump table: page # to memory location of page
.dw second1
.dw second2
.dw second3
.dw second4
.dw second5
Elements: ;atomic number to element location in memory
.dw Hydrogen
.dw Helium
.dw Lithium
.dw Beryllium
.dw Boron
.dw Carbon
.dw Nitrogen
.dw Oxygen
.dw Fluorine
.dw Neon
.dw Sodium
.dw Magnesium
.dw Aluminum
.dw Silicon
.dw Phosphorus
.dw Sulfur
.dw Chlorine
.dw Argon
.dw Potassium
.dw Calcium
.dw Scandium
.dw Titanium
.dw Vanadium
.dw Chromium
.dw Manganese
.dw Iron
.dw Colbalt
.dw Nickel
.dw Copper
.dw Zinc
.dw Gallium
.dw Germanium
.dw Arsenic
.dw Selenium
.dw Bromine
.dw Krypton
.dw Rubidium
.dw Strontium
.dw Yttrium
.dw Zirconium
.dw Niobium
.dw Molybdenum
.dw Technetium
.dw Ruthenium
.dw Rhodium
.dw Palladium
.dw Silver
.dw Cadmium
.dw Indium
.dw Tin
.dw Antimony
.dw Tellurium
.dw Iodine
.dw Xenon
.dw Cesium
.dw Barium
.dw Lanthanum
.dw Cerium
.dw Praseodymium
.dw Neodymium
.dw Promethium
.dw Samarium
.dw Europium
.dw Gadolinium
.dw Terbium
.dw Dysprosium
.dw Holmium
.dw Erbium
.dw Thulium
.dw Ytterbium
.dw Lutetium
.dw Hafnium
.dw Tantalum
.dw Tungsten
.dw Rhenium
.dw Osmium
.dw Iridium
.dw Platinum
.dw Gold
.dw Mercury
.dw Thallium
.dw Lead
.dw Bismuth
.dw Polonium
.dw Astatine
.dw Radon
.dw Francium
.dw Radium
.dw Actinium
.dw Thorium
.dw Protactinium
.dw Uranium
.dw Neptunium
.dw Plutonium
.dw Americium
.dw Curium
.dw Berkelium
.dw Californium
.dw Einsteinium
.dw Fermium
.dw Mendelevium
.dw Nobelium
.dw Lawrencium
.dw Rutherfordium
.dw Dubnium
.dw Seaborgium
.dw Bohrium
.dw Hassium
.dw Meitnerium
.dw Darmstadtium
.dw Roentgenium
.dw Copernicium
.dw Ununtrium
.dw Ununquadium
.dw Ununpentium
.dw Ununhexium
.dw Ununseptium
.dw Ununoctium
Elements_End: |
global _start
section .data
element_size equ 4
buf1 dd 0x01, 0x80, 0x48000
len equ ($-buf1)
LF db 0xa
section .bss
buf2 resd len / element_size
section .text
; void print_dword(DWORD x)
print_dword:
push ebp
mov ebp, esp
sub esp, 1
xor ecx, ecx
.next_iter:
mov ebx, 10
xor edx, edx
div ebx
add edx, '0'
push edx
inc ecx
cmp eax, 0
je .print_iter
jmp .next_iter
.print_iter:
cmp ecx, 0
je .close
pop eax
push eax
push ebx
push ecx
push edx
mov [ebp+1], al
mov eax, 4
mov ebx, 1
lea ecx, [ebp+1]
mov edx, 1
int 0x80
pop edx
pop ecx
pop ebx
pop eax
dec ecx
jmp .print_iter
.close:
mov eax, 4
mov ebx, 1
mov ecx, LF
mov edx, 1
int 0x80
mov esp, ebp
pop ebp
ret
; void process(DWORD dst, DWORD src, DWORD n)
process:
push ebp
mov ebp, esp
mov edi, [ebp+8]
mov esi, [ebp+12]
mov ecx, [ebp+16]
.lp:
lodsb
bt eax, 0x7
jnc .next
shr al, 0x1
.next
stosb
loop .lp
mov esp, ebp
pop ebp
ret
; DWORD sum(DWORD buf, DWORD n)
sum:
push ebp
mov ebp, esp
mov esi, [ebp+8]
mov ecx, [ebp+12]
xor eax, eax
.lp:
add eax, [esi]
add esi, 4
loop .lp
mov esp, ebp
pop ebp
ret
_start:
push len
push buf1
push buf2
call process
add esp, 12
push len / element_size
push buf2
call sum
add esp, 8
push eax
call print_dword
add esp, 4
mov eax, 1
mov ebx, 0
int 0x80
|
/*
* MIT License
*
* Copyright (c) 2018 Michele Biondi, Andrea Salvatori
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* @file SPIporting.hpp
* Arduino porting for the SPI interface.
*/
#include <Arduino.h>
#include <SPI.h>
#include "SPIporting.hpp"
#include "DW1000NgConstants.hpp"
#include "DW1000NgRegisters.hpp"
namespace SPIporting {
namespace {
constexpr uint32_t EspSPImaximumSpeed = 20000000; //20MHz
constexpr uint32_t ArduinoSPImaximumSpeed = 16000000; //16MHz
constexpr uint32_t SPIminimumSpeed = 2000000; //2MHz
/* SPI relative variables */
#if defined(ESP32) || defined(ESP8266)
const SPISettings _fastSPI = SPISettings(EspSPImaximumSpeed, MSBFIRST, SPI_MODE0);
#else
const SPISettings _fastSPI = SPISettings(ArduinoSPImaximumSpeed, MSBFIRST, SPI_MODE0);
#endif
const SPISettings _slowSPI = SPISettings(SPIminimumSpeed, MSBFIRST, SPI_MODE0);
const SPISettings* _currentSPI = &_fastSPI;
void _openSPI(uint8_t slaveSelectPIN) {
SPI.beginTransaction(*_currentSPI);
digitalWrite(slaveSelectPIN, LOW);
}
void _closeSPI(uint8_t slaveSelectPIN) {
digitalWrite(slaveSelectPIN, HIGH);
SPI.endTransaction();
}
}
void SPIinit() {
SPI.begin();
}
void SPIend() {
SPI.end();
}
void SPIselect(uint8_t slaveSelectPIN, uint8_t irq) {
#if !defined(ESP32) && !defined(ESP8266)
if(irq != 0xff)
SPI.usingInterrupt(digitalPinToInterrupt(irq));
#endif
pinMode(slaveSelectPIN, OUTPUT);
digitalWrite(slaveSelectPIN, HIGH);
}
void writeToSPI(uint8_t slaveSelectPIN, uint8_t headerLen, byte header[], uint16_t dataLen, byte data[]) {
_openSPI(slaveSelectPIN);
for(auto i = 0; i < headerLen; i++) {
SPI.transfer(header[i]); // send header
}
for(auto i = 0; i < dataLen; i++) {
SPI.transfer(data[i]); // write values
}
delayMicroseconds(5);
_closeSPI(slaveSelectPIN);
}
void readFromSPI(uint8_t slaveSelectPIN, uint8_t headerLen, byte header[], uint16_t dataLen, byte data[]){
_openSPI(slaveSelectPIN);
for(auto i = 0; i < headerLen; i++) {
SPI.transfer(header[i]); // send header
}
for(auto i = 0; i < dataLen; i++) {
data[i] = SPI.transfer(0x00); // read values
}
delayMicroseconds(5);
_closeSPI(slaveSelectPIN);
}
void setSPIspeed(SPIClock speed) {
if(speed == SPIClock::FAST) {
_currentSPI = &_fastSPI;
} else if(speed == SPIClock::SLOW) {
_currentSPI = &_slowSPI;
}
}
} |
; A004763: Numbers whose binary expansion does not begin 101.
; Submitted by Jamie Morken(s2)
; 0,1,2,3,4,6,7,8,9,12,13,14,15,16,17,18,19,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,96,97,98,99
mov $2,$0
lpb $2
mov $1,$0
sub $1,$2
trn $1,1
sub $2,1
trn $2,$1
lpe
div $1,2
add $1,$0
mov $0,$1
|
ld a, #1
ld [$2100], a |
#include "huaweicloud/vod/v1/model/ShowAssetTempAuthorityResponse.h"
namespace HuaweiCloud {
namespace Sdk {
namespace Vod {
namespace V1 {
namespace Model {
ShowAssetTempAuthorityResponse::ShowAssetTempAuthorityResponse()
{
signStr_ = "";
signStrIsSet_ = false;
}
ShowAssetTempAuthorityResponse::~ShowAssetTempAuthorityResponse() = default;
void ShowAssetTempAuthorityResponse::validate()
{
}
web::json::value ShowAssetTempAuthorityResponse::toJson() const
{
web::json::value val = web::json::value::object();
if(signStrIsSet_) {
val[utility::conversions::to_string_t("sign_str")] = ModelBase::toJson(signStr_);
}
return val;
}
bool ShowAssetTempAuthorityResponse::fromJson(const web::json::value& val)
{
bool ok = true;
if(val.has_field(utility::conversions::to_string_t("sign_str"))) {
const web::json::value& fieldValue = val.at(utility::conversions::to_string_t("sign_str"));
if(!fieldValue.is_null())
{
std::string refVal;
ok &= ModelBase::fromJson(fieldValue, refVal);
setSignStr(refVal);
}
}
return ok;
}
std::string ShowAssetTempAuthorityResponse::getSignStr() const
{
return signStr_;
}
void ShowAssetTempAuthorityResponse::setSignStr(const std::string& value)
{
signStr_ = value;
signStrIsSet_ = true;
}
bool ShowAssetTempAuthorityResponse::signStrIsSet() const
{
return signStrIsSet_;
}
void ShowAssetTempAuthorityResponse::unsetsignStr()
{
signStrIsSet_ = false;
}
}
}
}
}
}
|
; A293497: Triangular array read by rows: row n >= 1 is the list of integers from 0 to 2n-1.
; 0,1,0,1,2,3,0,1,2,3,4,5,0,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,10,11,0,1,2,3,4,5,6,7,8,9,10,11,12,13,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7,8
mov $1,$0
add $0,1
lpb $0
sub $1,$2
add $2,2
trn $0,$2
lpe
|
; QXL extended colour mode
section init
xdef pt_xmodec ; check if mode can be set
xdef pt_xmode ; set mode
xdef qxl_xmode ; set QXL on mode change
xref qxl_mess_add
include 'dev8_keys_err'
include 'dev8_keys_sys'
include 'dev8_keys_con'
include 'dev8_smsq_qxl_keys'
include 'dev8_smsq_qxl_comm_keys'
include 'dev8_mac_assert'
;+++
; Check and set mode
;
; d1 c r mode if can be set
; a3 c p pointer to console linkage
; a6 c p pointer to system variables
;---
pt_xmode
move.b d1,d0 QXL mode 8
cmp.b #ptm.ql8,d1 ... is it?
beq.s ptxm_set
move.b #4,d0 QXL mode 4
clr.l d1
ptxm_set
move.b d1,sys_qlmr(a6)
movem.l a1/a2/a3,-(sp)
move.l qxl_scr_work,a2 ; screen work area
move.l qxl_message,a3 ; message area
move.b d0,qxl_vql(a2) ; set video conversion mode
bsr.s qxl_xmode
movem.l (sp)+,a1/a2/a3
ptxm_ok
moveq #0,d0
rts
pt_xmodec
assert ptm.ql4,0
assert ptm.ql8,8
moveq #$ffffffff-ptm.ql8,d0
and.b pt_dmode(a3),d0 ; is it ql mode?
beq.s ptxm_ok ; ... yes can do mode
clr.b sys_qlmr(a6)
moveq #err.ipar,d0
rts
;---
; QXL set mode 4/8
;
; a1 s
; a2 c p pointer to screen work area
; a3 c p pointer to message area
;+++
qxl_xmode
assert 0,qxl.vc4vga-2,qxl.vc8vga-6
moveq #0,d0
move.b qxl_vql(a2),d0 ; QL mode
subq.w #2,d0 ; set conversion to VGA
move.w d0,qxl_vconv(a2)
lea qxl_ms_vgap+qxl_ms_key(a3),a1 ; vga palette message
move.b #qxm.spal,(a1)+ ; set palette
move.b qxl_vql(a2),(a1)+ ; ql mode
clr.w (a1)+ ; standard palette
subq.w #6,a1
move.w #4,(a1)
jmp qxl_mess_add ; add message to queue
end
|
SilphCo7F_Object:
db $2e ; border block
db 6 ; warps
warp 16, 0, 1, SILPH_CO_8F
warp 22, 0, 0, SILPH_CO_6F
warp 18, 0, 0, SILPH_CO_ELEVATOR
warp 5, 7, 3, SILPH_CO_11F
warp 5, 3, 8, SILPH_CO_3F
warp 21, 15, 3, SILPH_CO_5F
db 0 ; signs
db 11 ; objects
object SPRITE_LAPRAS_GIVER, 1, 5, STAY, NONE, 1 ; person
object SPRITE_LAPRAS_GIVER, 13, 13, STAY, UP, 2 ; person
object SPRITE_LAPRAS_GIVER, 7, 10, STAY, NONE, 3 ; person
object SPRITE_ERIKA, 10, 8, STAY, NONE, 4 ; person
object SPRITE_ROCKET, 13, 1, STAY, DOWN, 5, OPP_ROCKET, 32
object SPRITE_OAK_AIDE, 2, 13, STAY, DOWN, 6, OPP_SCIENTIST, 8
object SPRITE_ROCKET, 20, 2, STAY, LEFT, 7, OPP_ROCKET, 33
object SPRITE_ROCKET, 19, 14, STAY, RIGHT, 8, OPP_ROCKET, 34
object SPRITE_BLUE, 3, 7, STAY, UP, 9 ; person
object SPRITE_BALL, 1, 9, STAY, NONE, 10, CALCIUM
object SPRITE_BALL, 24, 11, STAY, NONE, 11, TM_03
; warp-to
warp_to 16, 0, SILPH_CO_7F_WIDTH ; SILPH_CO_8F
warp_to 22, 0, SILPH_CO_7F_WIDTH ; SILPH_CO_6F
warp_to 18, 0, SILPH_CO_7F_WIDTH ; SILPH_CO_ELEVATOR
warp_to 5, 7, SILPH_CO_7F_WIDTH ; SILPH_CO_11F
warp_to 5, 3, SILPH_CO_7F_WIDTH ; SILPH_CO_3F
warp_to 21, 15, SILPH_CO_7F_WIDTH ; SILPH_CO_5F
|
; A273109: Numbers n such that in the difference triangle of the divisors of n (including the divisors of n) the diagonal from the bottom entry to n gives the divisors of n.
; 1,2,4,8,12,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216,33554432,67108864,134217728,268435456,536870912,1073741824,2147483648,4294967296,8589934592
mov $1,1
mov $2,$0
mov $4,$0
lpb $2,1
lpb $0,1
mov $0,3
mov $1,3
mov $5,5
lpe
lpb $5,1
add $0,9
trn $1,$2
add $1,2
add $3,4
sub $0,$3
add $5,$4
trn $5,$3
lpe
mul $1,2
sub $4,$2
sub $2,1
lpe
|
###############################################################################
# Copyright 2018 Intel Corporation
# All Rights Reserved.
#
# If this software was obtained under the Intel Simplified Software License,
# the following terms apply:
#
# The source code, information and material ("Material") contained herein is
# owned by Intel Corporation or its suppliers or licensors, and title to such
# Material remains with Intel Corporation or its suppliers or licensors. The
# Material contains proprietary information of Intel or its suppliers and
# licensors. The Material is protected by worldwide copyright laws and treaty
# provisions. No part of the Material may be used, copied, reproduced,
# modified, published, uploaded, posted, transmitted, distributed or disclosed
# in any way without Intel's prior express written permission. No license under
# any patent, copyright or other intellectual property rights in the Material
# is granted to or conferred upon you, either expressly, by implication,
# inducement, estoppel or otherwise. Any license under such intellectual
# property rights must be express and approved by Intel in writing.
#
# Unless otherwise agreed by Intel in writing, you may not remove or alter this
# notice or any other notice embedded in Materials by Intel or Intel's
# suppliers or licensors in any way.
#
#
# If this software was obtained under the Apache License, Version 2.0 (the
# "License"), the following terms apply:
#
# You may not use this file except in compliance with the License. You may
# obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
# See the License for the specific language governing permissions and
# limitations under the License.
###############################################################################
.section .note.GNU-stack,"",%progbits
.text
.p2align 5, 0x90
.globl e9_EncryptOFB_RIJ128_AES_NI
.type e9_EncryptOFB_RIJ128_AES_NI, @function
e9_EncryptOFB_RIJ128_AES_NI:
push %r12
push %r15
sub $(168), %rsp
mov (192)(%rsp), %rax
movdqu (%rax), %xmm0
movdqa %xmm0, (%rsp)
movslq %r8d, %r8
movslq %r9d, %r9
mov %rcx, %r15
lea (,%rdx,4), %rax
lea (-144)(%r15,%rax,4), %rax
lea (,%r9,4), %r10
.p2align 5, 0x90
.Lblks_loopgas_1:
cmp %r10, %r8
cmovl %r8, %r10
xor %rcx, %rcx
.L__0009gas_1:
movb (%rdi,%rcx), %r11b
movb %r11b, (96)(%rsp,%rcx)
add $(1), %rcx
cmp %r10, %rcx
jl .L__0009gas_1
mov %r10, %r12
xor %r11, %r11
.p2align 5, 0x90
.Lsingle_blkgas_1:
pxor (%r15), %xmm0
cmp $(12), %rdx
jl .Lkey_128_sgas_1
jz .Lkey_192_sgas_1
.Lkey_256_sgas_1:
aesenc (-64)(%rax), %xmm0
aesenc (-48)(%rax), %xmm0
.Lkey_192_sgas_1:
aesenc (-32)(%rax), %xmm0
aesenc (-16)(%rax), %xmm0
.Lkey_128_sgas_1:
aesenc (%rax), %xmm0
aesenc (16)(%rax), %xmm0
aesenc (32)(%rax), %xmm0
aesenc (48)(%rax), %xmm0
aesenc (64)(%rax), %xmm0
aesenc (80)(%rax), %xmm0
aesenc (96)(%rax), %xmm0
aesenc (112)(%rax), %xmm0
aesenc (128)(%rax), %xmm0
aesenclast (144)(%rax), %xmm0
movdqa %xmm0, (16)(%rsp)
movdqu (96)(%rsp,%r11), %xmm1
pxor %xmm0, %xmm1
movdqu %xmm1, (32)(%rsp,%r11)
movdqu (%rsp,%r9), %xmm0
movdqa %xmm0, (%rsp)
add %r9, %r11
sub %r9, %r12
jg .Lsingle_blkgas_1
xor %rcx, %rcx
.L__000Agas_1:
movb (32)(%rsp,%rcx), %r11b
movb %r11b, (%rsi,%rcx)
add $(1), %rcx
cmp %r10, %rcx
jl .L__000Agas_1
add %r10, %rdi
add %r10, %rsi
sub %r10, %r8
jg .Lblks_loopgas_1
mov (192)(%rsp), %rax
movdqa (%rsp), %xmm0
movdqu %xmm0, (%rax)
add $(168), %rsp
vzeroupper
pop %r15
pop %r12
ret
.Lfe1:
.size e9_EncryptOFB_RIJ128_AES_NI, .Lfe1-(e9_EncryptOFB_RIJ128_AES_NI)
.p2align 5, 0x90
.globl e9_EncryptOFB128_RIJ128_AES_NI
.type e9_EncryptOFB128_RIJ128_AES_NI, @function
e9_EncryptOFB128_RIJ128_AES_NI:
movdqu (%r9), %xmm0
movslq %r8d, %r8
lea (,%rdx,4), %rax
lea (-144)(%rcx,%rax,4), %rax
.Lblks_loopgas_2:
pxor (%rcx), %xmm0
movdqu (%rdi), %xmm1
cmp $(12), %rdx
jl .Lkey_128_sgas_2
jz .Lkey_192_sgas_2
.Lkey_256_sgas_2:
aesenc (-64)(%rax), %xmm0
aesenc (-48)(%rax), %xmm0
.Lkey_192_sgas_2:
aesenc (-32)(%rax), %xmm0
aesenc (-16)(%rax), %xmm0
.Lkey_128_sgas_2:
aesenc (%rax), %xmm0
aesenc (16)(%rax), %xmm0
aesenc (32)(%rax), %xmm0
aesenc (48)(%rax), %xmm0
aesenc (64)(%rax), %xmm0
aesenc (80)(%rax), %xmm0
aesenc (96)(%rax), %xmm0
aesenc (112)(%rax), %xmm0
aesenc (128)(%rax), %xmm0
aesenclast (144)(%rax), %xmm0
pxor %xmm0, %xmm1
movdqu %xmm1, (%rsi)
add $(16), %rdi
add $(16), %rsi
sub $(16), %r8
jg .Lblks_loopgas_2
movdqu %xmm0, (%r9)
vzeroupper
ret
.Lfe2:
.size e9_EncryptOFB128_RIJ128_AES_NI, .Lfe2-(e9_EncryptOFB128_RIJ128_AES_NI)
|
; A216271: Expansion of (1-x)/((1-2x)(1-4x+x^2)).
; Submitted by Jamie Morken(s3)
; 1,5,21,83,319,1209,4549,17051,63783,238337,890077,3322995,12403951,46296905,172791861,644886923,2406788599,8982333009,33522674509,125108627171,466912358463,1742541855257,6503257159717,24270490977915,90578715140551,338044386361505,1261598863859901
mov $1,1
mov $2,2
mov $3,3
lpb $0
sub $0,1
mul $1,2
add $1,$3
add $2,$3
add $2,$3
add $3,$2
lpe
mov $0,$1
|
;--------------------------------------------------------
; File Created by SDCC : free open source ANSI-C Compiler
; Version 4.1.6 #12555 (Linux)
;--------------------------------------------------------
; Processed by Z88DK
;--------------------------------------------------------
EXTERN __divschar
EXTERN __divschar_callee
EXTERN __divsint
EXTERN __divsint_callee
EXTERN __divslong
EXTERN __divslong_callee
EXTERN __divslonglong
EXTERN __divslonglong_callee
EXTERN __divsuchar
EXTERN __divsuchar_callee
EXTERN __divuchar
EXTERN __divuchar_callee
EXTERN __divuint
EXTERN __divuint_callee
EXTERN __divulong
EXTERN __divulong_callee
EXTERN __divulonglong
EXTERN __divulonglong_callee
EXTERN __divuschar
EXTERN __divuschar_callee
EXTERN __modschar
EXTERN __modschar_callee
EXTERN __modsint
EXTERN __modsint_callee
EXTERN __modslong
EXTERN __modslong_callee
EXTERN __modslonglong
EXTERN __modslonglong_callee
EXTERN __modsuchar
EXTERN __modsuchar_callee
EXTERN __moduchar
EXTERN __moduchar_callee
EXTERN __moduint
EXTERN __moduint_callee
EXTERN __modulong
EXTERN __modulong_callee
EXTERN __modulonglong
EXTERN __modulonglong_callee
EXTERN __moduschar
EXTERN __moduschar_callee
EXTERN __mulint
EXTERN __mulint_callee
EXTERN __mullong
EXTERN __mullong_callee
EXTERN __mullonglong
EXTERN __mullonglong_callee
EXTERN __mulschar
EXTERN __mulschar_callee
EXTERN __mulsuchar
EXTERN __mulsuchar_callee
EXTERN __muluchar
EXTERN __muluchar_callee
EXTERN __muluschar
EXTERN __muluschar_callee
EXTERN __rlslonglong
EXTERN __rlslonglong_callee
EXTERN __rlulonglong
EXTERN __rlulonglong_callee
EXTERN __rrslonglong
EXTERN __rrslonglong_callee
EXTERN __rrulonglong
EXTERN __rrulonglong_callee
EXTERN ___sdcc_call_hl
EXTERN ___sdcc_call_iy
EXTERN ___sdcc_enter_ix
EXTERN banked_call
EXTERN _banked_ret
EXTERN ___fs2schar
EXTERN ___fs2schar_callee
EXTERN ___fs2sint
EXTERN ___fs2sint_callee
EXTERN ___fs2slong
EXTERN ___fs2slong_callee
EXTERN ___fs2slonglong
EXTERN ___fs2slonglong_callee
EXTERN ___fs2uchar
EXTERN ___fs2uchar_callee
EXTERN ___fs2uint
EXTERN ___fs2uint_callee
EXTERN ___fs2ulong
EXTERN ___fs2ulong_callee
EXTERN ___fs2ulonglong
EXTERN ___fs2ulonglong_callee
EXTERN ___fsadd
EXTERN ___fsadd_callee
EXTERN ___fsdiv
EXTERN ___fsdiv_callee
EXTERN ___fseq
EXTERN ___fseq_callee
EXTERN ___fsgt
EXTERN ___fsgt_callee
EXTERN ___fslt
EXTERN ___fslt_callee
EXTERN ___fsmul
EXTERN ___fsmul_callee
EXTERN ___fsneq
EXTERN ___fsneq_callee
EXTERN ___fssub
EXTERN ___fssub_callee
EXTERN ___schar2fs
EXTERN ___schar2fs_callee
EXTERN ___sint2fs
EXTERN ___sint2fs_callee
EXTERN ___slong2fs
EXTERN ___slong2fs_callee
EXTERN ___slonglong2fs
EXTERN ___slonglong2fs_callee
EXTERN ___uchar2fs
EXTERN ___uchar2fs_callee
EXTERN ___uint2fs
EXTERN ___uint2fs_callee
EXTERN ___ulong2fs
EXTERN ___ulong2fs_callee
EXTERN ___ulonglong2fs
EXTERN ___ulonglong2fs_callee
EXTERN ____sdcc_2_copy_src_mhl_dst_deix
EXTERN ____sdcc_2_copy_src_mhl_dst_bcix
EXTERN ____sdcc_4_copy_src_mhl_dst_deix
EXTERN ____sdcc_4_copy_src_mhl_dst_bcix
EXTERN ____sdcc_4_copy_src_mhl_dst_mbc
EXTERN ____sdcc_4_ldi_nosave_bc
EXTERN ____sdcc_4_ldi_save_bc
EXTERN ____sdcc_4_push_hlix
EXTERN ____sdcc_4_push_mhl
EXTERN ____sdcc_lib_setmem_hl
EXTERN ____sdcc_ll_add_de_bc_hl
EXTERN ____sdcc_ll_add_de_bc_hlix
EXTERN ____sdcc_ll_add_de_hlix_bc
EXTERN ____sdcc_ll_add_de_hlix_bcix
EXTERN ____sdcc_ll_add_deix_bc_hl
EXTERN ____sdcc_ll_add_deix_hlix
EXTERN ____sdcc_ll_add_hlix_bc_deix
EXTERN ____sdcc_ll_add_hlix_deix_bc
EXTERN ____sdcc_ll_add_hlix_deix_bcix
EXTERN ____sdcc_ll_asr_hlix_a
EXTERN ____sdcc_ll_asr_mbc_a
EXTERN ____sdcc_ll_copy_src_de_dst_hlix
EXTERN ____sdcc_ll_copy_src_de_dst_hlsp
EXTERN ____sdcc_ll_copy_src_deix_dst_hl
EXTERN ____sdcc_ll_copy_src_deix_dst_hlix
EXTERN ____sdcc_ll_copy_src_deixm_dst_hlsp
EXTERN ____sdcc_ll_copy_src_desp_dst_hlsp
EXTERN ____sdcc_ll_copy_src_hl_dst_de
EXTERN ____sdcc_ll_copy_src_hlsp_dst_de
EXTERN ____sdcc_ll_copy_src_hlsp_dst_deixm
EXTERN ____sdcc_ll_lsl_hlix_a
EXTERN ____sdcc_ll_lsl_mbc_a
EXTERN ____sdcc_ll_lsr_hlix_a
EXTERN ____sdcc_ll_lsr_mbc_a
EXTERN ____sdcc_ll_push_hlix
EXTERN ____sdcc_ll_push_mhl
EXTERN ____sdcc_ll_sub_de_bc_hl
EXTERN ____sdcc_ll_sub_de_bc_hlix
EXTERN ____sdcc_ll_sub_de_hlix_bc
EXTERN ____sdcc_ll_sub_de_hlix_bcix
EXTERN ____sdcc_ll_sub_deix_bc_hl
EXTERN ____sdcc_ll_sub_deix_hlix
EXTERN ____sdcc_ll_sub_hlix_bc_deix
EXTERN ____sdcc_ll_sub_hlix_deix_bc
EXTERN ____sdcc_ll_sub_hlix_deix_bcix
EXTERN ____sdcc_load_debc_deix
EXTERN ____sdcc_load_dehl_deix
EXTERN ____sdcc_load_debc_mhl
EXTERN ____sdcc_load_hlde_mhl
EXTERN ____sdcc_store_dehl_bcix
EXTERN ____sdcc_store_debc_hlix
EXTERN ____sdcc_store_debc_mhl
EXTERN ____sdcc_cpu_pop_ei
EXTERN ____sdcc_cpu_pop_ei_jp
EXTERN ____sdcc_cpu_push_di
EXTERN ____sdcc_outi
EXTERN ____sdcc_outi_128
EXTERN ____sdcc_outi_256
EXTERN ____sdcc_ldi
EXTERN ____sdcc_ldi_128
EXTERN ____sdcc_ldi_256
EXTERN ____sdcc_4_copy_srcd_hlix_dst_deix
EXTERN ____sdcc_4_and_src_mbc_mhl_dst_deix
EXTERN ____sdcc_4_or_src_mbc_mhl_dst_deix
EXTERN ____sdcc_4_xor_src_mbc_mhl_dst_deix
EXTERN ____sdcc_4_or_src_dehl_dst_bcix
EXTERN ____sdcc_4_xor_src_dehl_dst_bcix
EXTERN ____sdcc_4_and_src_dehl_dst_bcix
EXTERN ____sdcc_4_xor_src_mbc_mhl_dst_debc
EXTERN ____sdcc_4_or_src_mbc_mhl_dst_debc
EXTERN ____sdcc_4_and_src_mbc_mhl_dst_debc
EXTERN ____sdcc_4_cpl_src_mhl_dst_debc
EXTERN ____sdcc_4_xor_src_debc_mhl_dst_debc
EXTERN ____sdcc_4_or_src_debc_mhl_dst_debc
EXTERN ____sdcc_4_and_src_debc_mhl_dst_debc
EXTERN ____sdcc_4_and_src_debc_hlix_dst_debc
EXTERN ____sdcc_4_or_src_debc_hlix_dst_debc
EXTERN ____sdcc_4_xor_src_debc_hlix_dst_debc
;--------------------------------------------------------
; Public variables in this module
;--------------------------------------------------------
GLOBAL _m32_powf
;--------------------------------------------------------
; Externals used
;--------------------------------------------------------
GLOBAL _m32_polyf
GLOBAL _m32_hypotf
GLOBAL _m32_ldexpf
GLOBAL _m32_frexpf
GLOBAL _m32_invsqrtf
GLOBAL _m32_sqrtf
GLOBAL _m32_invf
GLOBAL _m32_sqrf
GLOBAL _m32_div2f
GLOBAL _m32_mul2f
GLOBAL _m32_modff
GLOBAL _m32_fmodf
GLOBAL _m32_roundf
GLOBAL _m32_floorf
GLOBAL _m32_fabsf
GLOBAL _m32_ceilf
GLOBAL _m32_log10f
GLOBAL _m32_log2f
GLOBAL _m32_logf
GLOBAL _m32_exp10f
GLOBAL _m32_exp2f
GLOBAL _m32_expf
GLOBAL _m32_atanhf
GLOBAL _m32_acoshf
GLOBAL _m32_asinhf
GLOBAL _m32_tanhf
GLOBAL _m32_coshf
GLOBAL _m32_sinhf
GLOBAL _m32_atan2f
GLOBAL _m32_atanf
GLOBAL _m32_acosf
GLOBAL _m32_asinf
GLOBAL _m32_tanf
GLOBAL _m32_cosf
GLOBAL _m32_sinf
GLOBAL _poly_callee
GLOBAL _poly
GLOBAL _exp10_fastcall
GLOBAL _exp10
GLOBAL _mul10u_fastcall
GLOBAL _mul10u
GLOBAL _mul2_fastcall
GLOBAL _mul2
GLOBAL _div2_fastcall
GLOBAL _div2
GLOBAL _invsqrt_fastcall
GLOBAL _invsqrt
GLOBAL _inv_fastcall
GLOBAL _inv
GLOBAL _sqr_fastcall
GLOBAL _sqr
GLOBAL _neg_fastcall
GLOBAL _neg
GLOBAL _isunordered_callee
GLOBAL _isunordered
GLOBAL _islessgreater_callee
GLOBAL _islessgreater
GLOBAL _islessequal_callee
GLOBAL _islessequal
GLOBAL _isless_callee
GLOBAL _isless
GLOBAL _isgreaterequal_callee
GLOBAL _isgreaterequal
GLOBAL _isgreater_callee
GLOBAL _isgreater
GLOBAL _fma_callee
GLOBAL _fma
GLOBAL _fmin_callee
GLOBAL _fmin
GLOBAL _fmax_callee
GLOBAL _fmax
GLOBAL _fdim_callee
GLOBAL _fdim
GLOBAL _nexttoward_callee
GLOBAL _nexttoward
GLOBAL _nextafter_callee
GLOBAL _nextafter
GLOBAL _nan_fastcall
GLOBAL _nan
GLOBAL _copysign_callee
GLOBAL _copysign
GLOBAL _remquo_callee
GLOBAL _remquo
GLOBAL _remainder_callee
GLOBAL _remainder
GLOBAL _fmod_callee
GLOBAL _fmod
GLOBAL _modf_callee
GLOBAL _modf
GLOBAL _trunc_fastcall
GLOBAL _trunc
GLOBAL _lround_fastcall
GLOBAL _lround
GLOBAL _round_fastcall
GLOBAL _round
GLOBAL _lrint_fastcall
GLOBAL _lrint
GLOBAL _rint_fastcall
GLOBAL _rint
GLOBAL _nearbyint_fastcall
GLOBAL _nearbyint
GLOBAL _floor_fastcall
GLOBAL _floor
GLOBAL _ceil_fastcall
GLOBAL _ceil
GLOBAL _tgamma_fastcall
GLOBAL _tgamma
GLOBAL _lgamma_fastcall
GLOBAL _lgamma
GLOBAL _erfc_fastcall
GLOBAL _erfc
GLOBAL _erf_fastcall
GLOBAL _erf
GLOBAL _cbrt_fastcall
GLOBAL _cbrt
GLOBAL _sqrt_fastcall
GLOBAL _sqrt
GLOBAL _pow_callee
GLOBAL _pow
GLOBAL _hypot_callee
GLOBAL _hypot
GLOBAL _fabs_fastcall
GLOBAL _fabs
GLOBAL _logb_fastcall
GLOBAL _logb
GLOBAL _log2_fastcall
GLOBAL _log2
GLOBAL _log1p_fastcall
GLOBAL _log1p
GLOBAL _log10_fastcall
GLOBAL _log10
GLOBAL _log_fastcall
GLOBAL _log
GLOBAL _scalbln_callee
GLOBAL _scalbln
GLOBAL _scalbn_callee
GLOBAL _scalbn
GLOBAL _ldexp_callee
GLOBAL _ldexp
GLOBAL _ilogb_fastcall
GLOBAL _ilogb
GLOBAL _frexp_callee
GLOBAL _frexp
GLOBAL _expm1_fastcall
GLOBAL _expm1
GLOBAL _exp2_fastcall
GLOBAL _exp2
GLOBAL _exp_fastcall
GLOBAL _exp
GLOBAL _tanh_fastcall
GLOBAL _tanh
GLOBAL _sinh_fastcall
GLOBAL _sinh
GLOBAL _cosh_fastcall
GLOBAL _cosh
GLOBAL _atanh_fastcall
GLOBAL _atanh
GLOBAL _asinh_fastcall
GLOBAL _asinh
GLOBAL _acosh_fastcall
GLOBAL _acosh
GLOBAL _tan_fastcall
GLOBAL _tan
GLOBAL _sin_fastcall
GLOBAL _sin
GLOBAL _cos_fastcall
GLOBAL _cos
GLOBAL _atan2_callee
GLOBAL _atan2
GLOBAL _atan_fastcall
GLOBAL _atan
GLOBAL _asin_fastcall
GLOBAL _asin
GLOBAL _acos_fastcall
GLOBAL _acos
;--------------------------------------------------------
; special function registers
;--------------------------------------------------------
;--------------------------------------------------------
; ram data
;--------------------------------------------------------
SECTION bss_compiler
;--------------------------------------------------------
; ram data
;--------------------------------------------------------
IF 0
; .area _INITIALIZED removed by z88dk
ENDIF
;--------------------------------------------------------
; absolute external ram data
;--------------------------------------------------------
SECTION IGNORE
;--------------------------------------------------------
; global & static initialisations
;--------------------------------------------------------
SECTION code_crt_init
;--------------------------------------------------------
; Home
;--------------------------------------------------------
SECTION IGNORE
;--------------------------------------------------------
; code
;--------------------------------------------------------
SECTION code_compiler
; ---------------------------------
; Function m32_powf
; ---------------------------------
_m32_powf:
push ix
ld ix,0
add ix,sp
ld a,(ix+11)
and a,0x7f
or a,(ix+10)
or a,(ix+9)
or a,(ix+8)
jr NZ,l_m32_powf_00102
ld de,0x3f80
ld hl,0x0000
jp l_m32_powf_00117
l_m32_powf_00102:
ld l,(ix+6)
ld h,(ix+7)
push hl
ld l,(ix+4)
ld h,(ix+5)
push hl
ld hl,0x0000
push hl
push hl
call ___fslt_callee
bit 0, l
jr NZ,l_m32_powf_00104
ld hl,0x0000
ld e,l
ld d,h
jp l_m32_powf_00117
l_m32_powf_00104:
ld hl,0x3f80
push hl
ld hl,0x0000
push hl
ld l,(ix+10)
ld h,(ix+11)
push hl
ld l,(ix+8)
ld h,(ix+9)
push hl
call ___fseq_callee
ld a, l
or a, a
jr Z,l_m32_powf_00106
ld l,(ix+4)
ld h,(ix+5)
ld e,(ix+6)
ld d,(ix+7)
jp l_m32_powf_00117
l_m32_powf_00106:
ld hl,0xbf80
push hl
ld hl,0x0000
push hl
ld l,(ix+10)
ld h,(ix+11)
push hl
ld l,(ix+8)
ld h,(ix+9)
push hl
call ___fseq_callee
ld a, l
or a, a
jr Z,l_m32_powf_00108
ld l,(ix+4)
ld h,(ix+5)
ld e,(ix+6)
ld d,(ix+7)
call _m32_invf
jp l_m32_powf_00117
l_m32_powf_00108:
ld hl,0x3f00
push hl
ld h, l
push hl
ld l,(ix+10)
ld h,(ix+11)
push hl
ld l,(ix+8)
ld h,(ix+9)
push hl
call ___fseq_callee
ld a, l
or a, a
jr Z,l_m32_powf_00110
ld l,(ix+4)
ld h,(ix+5)
ld e,(ix+6)
ld d,(ix+7)
call _m32_sqrtf
jp l_m32_powf_00117
l_m32_powf_00110:
ld hl,0xbf00
push hl
ld h, l
push hl
ld l,(ix+10)
ld h,(ix+11)
push hl
ld l,(ix+8)
ld h,(ix+9)
push hl
call ___fseq_callee
ld a, l
or a, a
jr Z,l_m32_powf_00112
ld l,(ix+4)
ld h,(ix+5)
ld e,(ix+6)
ld d,(ix+7)
call _m32_invsqrtf
jp l_m32_powf_00117
l_m32_powf_00112:
ld hl,0x4000
push hl
ld h, l
push hl
ld l,(ix+10)
ld h,(ix+11)
push hl
ld l,(ix+8)
ld h,(ix+9)
push hl
call ___fseq_callee
ld a, l
or a, a
jr Z,l_m32_powf_00114
ld l,(ix+4)
ld h,(ix+5)
ld e,(ix+6)
ld d,(ix+7)
call _m32_sqrf
jr l_m32_powf_00117
l_m32_powf_00114:
ld hl,0xc000
push hl
ld h, l
push hl
ld l,(ix+10)
ld h,(ix+11)
push hl
ld l,(ix+8)
ld h,(ix+9)
push hl
call ___fseq_callee
ld a, l
or a, a
jr Z,l_m32_powf_00116
ld l,(ix+4)
ld h,(ix+5)
ld e,(ix+6)
ld d,(ix+7)
call _m32_sqrf
call _m32_invf
jr l_m32_powf_00117
l_m32_powf_00116:
ld l,(ix+4)
ld h,(ix+5)
ld e,(ix+6)
ld d,(ix+7)
call _m32_logf
ld c, l
ld l,(ix+10)
ld b,h
ld h,(ix+11)
push hl
ld l,(ix+8)
ld h,(ix+9)
push hl
push de
push bc
call ___fsmul_callee
call _m32_expf
l_m32_powf_00117:
pop ix
ret
SECTION IGNORE
|
; A093916: a(2*k-1)=(2*k-1)^2+2-k, a(2*k)=6*k^2+2-k: First column of the triangle A093915.
; 2,7,9,24,24,53,47,94,78,147,117,212,164,289,219,378,282,479,353,592,432,717,519,854,614,1003,717,1164,828,1337,947,1522,1074,1719,1209,1928,1352,2149,1503,2382,1662,2627,1829,2884,2004,3153,2187,3434,2378,3727,2577,4032,2784,4349,2999,4678,3222,5019,3453,5372,3692,5737,3939,6114,4194,6503,4457,6904,4728,7317,5007,7742,5294,8179,5589,8628,5892,9089,6203,9562,6522,10047,6849,10544,7184,11053,7527,11574,7878,12107,8237,12652,8604,13209,8979,13778,9362,14359,9753,14952
mov $1,$0
add $0,1
pow $1,2
add $1,$0
add $1,$0
bin $0,2
dif $1,2
add $1,$0
mov $0,$1
add $0,1
|
; CALLER linkage for function pointers
PUBLIC lseek
EXTERN lseek_callee
EXTERN ASMDISP_LSEEK_CALLEE
.lseek
pop af
pop bc
pop hl
pop de
exx
pop hl
push hl
push hl
push hl
push hl
push af
jp lseek_callee + ASMDISP_LSEEK_CALLEE
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.