c-struct.s

来自「一个编译器的例子,基于c语言,在linux下开发 现在了简单的c语言例子」· S 代码 · 共 146 行

S
146
字号
				# start of the file.include "defines.h"		# system call numbers.include "c-struct.literals"	# include the string literal file	.global _start		.bss	.align	4_data:	.skip		24	# global variables' size.text	.align	4_start:	pushl %ebp		# save the ebp address	movl %esp, %ebp	subl $1200, %esp		# allocate space for local variables	leal _data+20, %eax	pushl %eax	pushl $0	popl %ebx	popl %eax	addl %ebx, %eax	pushl %eax	pushl $1	sall $2, (%esp)	popl %ebx	popl %eax	addl %ebx, %eax	pushl %eax	pushl $100	popl %ebx	popl %eax	movl %ebx, (%eax)	pushl (%eax)	popl %eax	leal -1200(%ebp), %eax	pushl %eax	pushl $1	sall $2, (%esp)	popl %ebx	popl %eax	addl %ebx, %eax	pushl %eax	pushl $0	popl %ebx	popl %eax	addl %ebx, %eax	pushl %eax	pushl $2	sall $2, (%esp)	popl %ebx	popl %eax	addl %ebx, %eax	pushl %eax	pushl $10	popl %ebx	popl %eax	movl %ebx, (%eax)	pushl (%eax)	popl %eax	leal _data+20, %eax	pushl %eax	pushl $20	popl %ebx	popl %eax	addl %ebx, %eax	pushl %eax	pushl $10	leal -1200(%ebp), %eax	pushl %eax	pushl $1	sall $2, (%esp)	popl %ebx	popl %eax	addl %ebx, %eax	pushl %eax	pushl $0	popl %ebx	popl %eax	addl %ebx, %eax	pushl %eax	pushl $2	sall $2, (%esp)	popl %ebx	popl %eax	addl %ebx, %eax	pushl %eax	popl %eax	pushl (%eax)				# arithmetic calculate	popl %ebx	popl %eax	imull %ebx, %eax	pushl %eax	pushl $9	leal _data+20, %eax	pushl %eax	pushl $0	popl %ebx	popl %eax	addl %ebx, %eax	pushl %eax	pushl $1	sall $2, (%esp)	popl %ebx	popl %eax	addl %ebx, %eax	pushl %eax	popl %eax	pushl (%eax)				# arithmetic calculate	popl %ebx	popl %eax	imull %ebx, %eax	pushl %eax				# arithmetic calculate	popl %ebx	addl %ebx, (%esp)	popl %ebx	popl %eax	movl %ebx, (%eax)	pushl (%eax)	popl %eax	movl $SYS_write, %eax	# load the write call number	movl $STDOUT, %ebx		# get the output channel	movl $literal0,%ecx		# get the literal string	movl $len0,%edx		# string length	int $0x80	leal _data+20, %eax	pushl %eax	pushl $20	popl %ebx	popl %eax	addl %ebx, %eax	pushl %eax	popl %ebx	movl (%ebx), %eax	call ishow	call newline	pushl $0	popl %eax		# save the return value in eax	movl %ebp, %esp	popl %ebp		# restore the ebp address	movl $SYS_exit,%eax	# load the exit call number	movl $0,%ebx		# load the exit code	int $0x80		# and exit!				# end of the file

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?