File: win64.s

package info (click to toggle)
arch-test 0.22-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 260 kB
  • sloc: asm: 461; perl: 187; makefile: 155; sh: 149; ansic: 6
file content (27 lines) | stat: -rw-r--r-- 460 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
.globl _start
.extern GetStdHandle
.extern WriteFile
.extern ExitProcess

.data
msg:
	.ascii	"ok\n"
.text
_start:
	mov	%rsp, %rbp
	sub	$40, %rsp

	mov	$-11, %rcx	# STD_OUTPUT_HANDLE
	call	GetStdHandle

	sub	$8, %rsp	# make the stack 16-aligned for a 8-byte arg
	pushq	$0		# 0
	mov	%rbp, %r9	# &dummy
	mov	$3, %r8		# 3
	lea	msg(%rip), %rdx	# msg
	mov	%rax, %rcx	# stdout
	call	WriteFile
	# cleaning the stack is for wimps

	xor	%rcx, %rcx	# 0
	call	ExitProcess