64-bit write() system call

Bob Plantz plantz@cds1.net
Thu Mar 20 00:19:00 GMT 2008


First, I have also posted this on ubuntuforums.org. I know that's bad
form, but I don't think there will be many cross-readers here.

The default address size is 64 bits in 64-bit mode. But when I look at
the assembly language for the write() syscall, gcc uses only 32 bits of
the address:

	.file	"oneChar.c"
	.data
	.type	aLetter, @object
	.size	aLetter, 1
aLetter:
	.byte	65
	.text
.globl main
	.type	main, @function
main:
	pushq	%rbp             // <== 64-bit addresses
	movq	%rsp, %rbp       // <==
	movl	$1, %edx
	movl	$aLetter, %esi   // <== 32-bit address
	movl	$1, %edi
	call	write
	movl	$0, %eax
	leave
	ret
	.size	main, .-main
	.ident	"GCC: (GNU) 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)"
	.section	.note.GNU-stack,"",@progbits

Can anyone point me to discussions of what is going on here?

Bob




More information about the Gcc-help mailing list