x86 Assembly, getting segmentation fault
问题 section .data msg: db "hello!", 10, 0 ;my message section .text extern printf ;C printf function global main main: push ebp mov ebp, esp call print_string mov esp, ebp pop ebp ret ;end of program print_string: pusha push msg call printf ;should print "Hello" popa ret ;return back to main When I run this code I get: hello! Segmentation fault (core dumped) What is wrong with the code? 回答1: The print_string subroutine is modifying the stack pointer without restoring it. The subroutine main has