blob: 63042be8309c2e7f748770f4ba7e259c5fd86211 [file] [log] [blame]
public x86ident
public __savident
extrn foobar : proc
extrn foobar2 : abs
extrn foobar3 : qword
extrn foobar4 : byte
_DATA SEGMENT
__savident dd 0
savidentptr dd __savident
savidentptr2 dq __savident
x86identptr dd x86ident
x86identptr2 dq x86ident
foobarptr dd foobar
foobarptr2 dq foobar
foobar2ptr dd foobar2
foobar2ptr2 dq foobar2
foobar3ptr dd foobar3
foobar3ptr2 dq foobar3
xptr dd x
xptr2 dq x
;dataptr dd offset _DATA
;dataptr2 dq offset _DATA
;codeptr dd offset _TEXT
;codeptr2 dq offset _TEXT
_DATA ENDS
_BSS SEGMENT
x dq ?
y dq ?
_BSS ENDS
_TEXT SEGMENT
x86ident:
; extern with :proc
mov ebx,[foobar]
mov rcx,offset foobar
lea rdx, foobar
mov rax, qword ptr foobar[rcx]
mov rax, foobar
mov rbx, foobar
movzx rax, byte ptr foobar
movzx rax, byte ptr foobar[rax]
; local proc
mov ebx,[trap]
mov rcx,offset trap
; See note in YASM file
lea rdx, trap
mov rax, qword ptr trap[rcx]
mov rax, trap
mov rbx, trap
; See note in YASM file
movzx rax, byte ptr trap
movzx rax, byte ptr trap[rax]
; with :abs
;mov ebx,[foobar2]
;mov rcx,offset foobar2
;lea rdx, foobar2
;mov rax, qword ptr foobar2[rcx]
;mov rax, foobar2
;mov rbx, foobar2
;movzx rax, byte ptr foobar2
;movzx rax, byte ptr foobar2[rax]
; with :qword
mov ebx, offset foobar3
mov ebx, dword ptr [foobar3]
mov rcx,offset foobar3
lea rdx, foobar3
mov rax, qword ptr foobar3[rcx]
mov rax, foobar3
mov rbx, foobar3
movzx rax, byte ptr foobar3
movzx rax, byte ptr foobar3[rax]
; local var (dword)
mov ebx, offset __savident
mov ebx,[__savident]
mov rcx,offset __savident
lea rdx, __savident
mov rax, qword ptr __savident[rcx]
mov rax, qword ptr __savident
mov rbx, qword ptr __savident
movzx rax, byte ptr __savident
movzx rax, byte ptr __savident[rax]
; local var (qword)
mov ebx, offset savidentptr2
mov ebx, dword ptr [savidentptr2]
mov rcx,offset savidentptr2
lea rdx, savidentptr2
mov rax, savidentptr2[rcx]
mov rax, savidentptr2
mov rbx, savidentptr2
movzx rax, byte ptr savidentptr2
movzx rax, byte ptr savidentptr2[rax]
; bss local var (qword)
mov ebx, offset y
mov ebx, dword ptr [y]
mov rcx,offset y
lea rdx, y
mov rax, y[rcx]
mov rax, y
mov rbx, y
movzx rax, byte ptr y
movzx rax, byte ptr y[rax]
call foobar
call trap
ret
trap proc public frame
sub rsp, 256
.allocstack 256
.endprolog
int 3
add rsp, 256
trap endp
_TEXT ENDS
_FOO SEGMENT
foo_foobar3ptr dd foobar3
foo_foobar3ptr2 dq foobar3
mov ebx, dword ptr [foobar3]
mov rcx,offset foobar3
lea rdx, foobar3
mov rax, qword ptr foobar3[rcx]
mov rax, foobar3
mov rbx, foobar3
movzx rax, byte ptr foobar3
movzx rax, byte ptr foobar3[rax]
_FOO ENDS
END