summaryrefslogtreecommitdiff
path: root/prologue.snippet.asm
blob: 294a60c1a2679598b85648b8f1ad69d8b145aeca (plain)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
global _main

extern _calloc
extern _fclose
extern _fflush
extern _fopen
extern _fprintf
extern _free
extern _getchar
extern _malloc
extern _perror
extern _printf
extern _putchar
extern _snprintf
extern _write

default rel

section .text

_main:
	push rbp  ; PROLOGUE
	mov rbp, rsp
	push rbx
	push r12
	push r13 ;for stack alignment
	push r13
	mov edi, PARAMS_MEMSIZE
	call _malloc
	cmp rax, 0
	jz nomem
	mov rbx, rax ;bufp
	mov [buf], rax ;buf

%ifdef HEATMAPFNAME
	mov edi, SOURCE_LENGTH
	mov esi, 4
	call _calloc
	cmp rax, 0
	jz nomem
	mov r12, rax
%endif

	nop

; rbx = bufp
; r12 = heatmap
; r13 is used for the heatmap data file