Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Apr 2003 19:03:57 -0700 (PDT)
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 29759 for review
Message-ID:  <200304260203.h3Q23v2i048696@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=29759

Change 29759 by peter@peter_daintree on 2003/04/25 19:03:43

	update for PIC.  Oh my, that's a lot nicer with pc-relative modes.

Affected files ...

.. //depot/projects/hammer/lib/libc/x86_64/sys/brk.S#4 edit
.. //depot/projects/hammer/lib/libc/x86_64/sys/ptrace.S#3 edit
.. //depot/projects/hammer/lib/libc/x86_64/sys/sbrk.S#4 edit
.. //depot/projects/hammer/lib/libc/x86_64/sys/setlogin.S#3 edit

Differences ...

==== //depot/projects/hammer/lib/libc/x86_64/sys/brk.S#4 (text+ko) ====

@@ -49,41 +49,19 @@
 	jmp	ok
 
 ENTRY(brk)
-#ifdef PIC
-	movl	4(%esp),%eax
-	movl	PIC_GOT(HIDENAME(curbrk)),%edx	# set up GOT addressing
-	movl	PIC_GOT(HIDENAME(minbrk)),%ecx	#
-	cmpl	%eax,(%ecx)
-	jbe	ok
-	movl	(%ecx),%eax
-	movl	%eax,4(%esp)
-ok:
-	mov	$SYS_break,%eax
-	KERNCALL
-	jb	err
-	movl	4(%esp),%eax
-	movl	%eax,(%edx)
-	movl	$0,%eax
-	ret
-err:
-	jmp	PIC_PLT(HIDENAME(cerror))
-
-#else
-
 	pushq	%rdi
 	movq	%rdi,%rax
-	cmpq	%rax,HIDENAME(minbrk)
+	cmpq	%rax,PIC_GOT(HIDENAME(minbrk))
 	jbe	ok
-	movq	HIDENAME(minbrk),%rdi
+	movq	PIC_GOT(HIDENAME(minbrk)),%rdi
 ok:
 	movq	$SYS_break,%rax
 	KERNCALL
 	jb	err
 	movq	0(%rsp),%rax
-	movq	%rax,HIDENAME(curbrk)
+	movq	%rax,PIC_GOT(HIDENAME(curbrk))
 	movq	$0,%rax
 	popq	%rdi
 	ret
 err:
-	jmp	HIDENAME(cerror)
-#endif
+	jmp	PIC_PLT(HIDENAME(cerror))

==== //depot/projects/hammer/lib/libc/x86_64/sys/ptrace.S#3 (text+ko) ====

@@ -44,12 +44,7 @@
 
 ENTRY(ptrace)
 	xorl	%eax,%eax
-#ifdef PIC
-        movl    PIC_GOT(CNAME(errno)),%edx
-        movl    %eax,(%edx)
-#else
-        movl    %eax,CNAME(errno)
-#endif
+        movl    %eax,PIC_GOT(CNAME(errno))
 	mov	$SYS_ptrace,%eax
 	KERNCALL
 	jb	err

==== //depot/projects/hammer/lib/libc/x86_64/sys/sbrk.S#4 (text+ko) ====

@@ -52,42 +52,21 @@
 	.text
 
 ENTRY(sbrk)
-#ifdef PIC
-	movl	4(%esp),%ecx
-	movl	PIC_GOT(HIDENAME(curbrk)),%edx
-	movl	(%edx),%eax
-	testl	%ecx,%ecx
-	jz	back
-	addl	%eax,4(%esp)
-	mov	$SYS_break,%eax
-	KERNCALL
-	jb	err
-	movl	PIC_GOT(HIDENAME(curbrk)),%edx
-	movl	(%edx),%eax
-	addl	%ecx,(%edx)
-back:
-	ret
-err:
-	jmp	PIC_PLT(HIDENAME(cerror))
-
-#else /* !PIC */
-
 	pushq	%rdi
 	movq	%rdi,%rcx
-	movq	HIDENAME(curbrk),%rax
+	movq	PIC_GOT(HIDENAME(curbrk)),%rax
 	testq	%rcx,%rcx
 	jz	back
 	addq	%rax,%rdi
 	mov	$SYS_break,%eax
 	KERNCALL
 	jb	err
-	movq	HIDENAME(curbrk),%rax
+	movq	PIC_GOT(HIDENAME(curbrk)),%rax
 	movq	0(%rsp), %rcx
-	addq	%rcx,HIDENAME(curbrk)
+	addq	%rcx,PIC_GOT(HIDENAME(curbrk))
 back:
 	addq	$8, %rsp
 	ret
 err:
 	addq	$8, %rsp
-	jmp	HIDENAME(cerror)
-#endif /* PIC */
+	jmp	PIC_PLT(HIDENAME(cerror))

==== //depot/projects/hammer/lib/libc/x86_64/sys/setlogin.S#3 (text+ko) ====

@@ -45,12 +45,5 @@
 .globl	CNAME(_logname_valid)		/* in _getlogin() */
 
 SYSCALL(setlogin)
-#ifdef PIC
-	pushl	%eax
-	movl	PIC_GOT(CNAME(_logname_valid)),%eax
-	movl	$0,(%eax)
-	popl	%eax
-#else
-	movl	$0,CNAME(_logname_valid)
-#endif
+	movl	$0,PIC_GOT(CNAME(_logname_valid))
 	ret				/* setlogin(name) */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200304260203.h3Q23v2i048696>