Salut,

J'essaie de faire afficher la somme de deux entiers de la facon suivante :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 
;importing exter C symbol
extern printf
 
;declaring variables
segment .data
;variable1 takes 1 as a value
value1: db 1h	; value1 is BYTE containing the hexa 1
value2: db 2h	; value2 is BYTE containing the hexa 2	
 
;entry point for main function
global main
;start assembly program
section .text
 
;coding the _main symbol
main:
 
;put the value of the value1 variable into the EAX registre
mov EAX, value1
 
;add the value of value2 variable into the EAX restre
add EAX, value2
 
;pushing the value1 variable on the stack
push EAX
 
;calling the _printf C function
call printf
 
;cleaning the stack by unstacking the hello variable on the EAX register
pop EAX
 
;exiting from _main symbol
ret
Je travaille sous linux.

Quand j'execute je me prends un segmentation fault

Pourquoi ? Comment faire l'affichage des registres avec printf ?