Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/arch/sh3/gen Add a comment that explains that



details:   https://anonhg.NetBSD.org/src/rev/bc2dd604d1cb
branches:  trunk
changeset: 551019:bc2dd604d1cb
user:      uwe <uwe%NetBSD.org@localhost>
date:      Wed Aug 27 15:03:06 2003 +0000

description:
Add a comment that explains that

  . this function cannot have _PROF_PROLOGUE
  . this function cannot be called via PLT

Change ENTRY to NENTRY for the former.

XXX: The latter is important in the gcc3 world, that have shared
libraries.  We will need to play tricks with .hidden to make sure
every shared library gets its own private __udivsi3 that it can call
directly, without going through the PLT.

diffstat:

 lib/libc/arch/sh3/gen/udivsi3.S |  25 ++++++++++++++++++++++---
 1 files changed, 22 insertions(+), 3 deletions(-)

diffs (42 lines):

diff -r d0feabc06b1d -r bc2dd604d1cb lib/libc/arch/sh3/gen/udivsi3.S
--- a/lib/libc/arch/sh3/gen/udivsi3.S   Wed Aug 27 14:55:36 2003 +0000
+++ b/lib/libc/arch/sh3/gen/udivsi3.S   Wed Aug 27 15:03:06 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: udivsi3.S,v 1.5 2003/08/07 16:42:19 agc Exp $  */
+/*     $NetBSD: udivsi3.S,v 1.6 2003/08/27 15:03:06 uwe Exp $  */
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -36,11 +36,30 @@
 
 #include <machine/asm.h>
 #if defined(LIBC_SCCS)
-       RCSID("$NetBSD: udivsi3.S,v 1.5 2003/08/07 16:42:19 agc Exp $")
+       RCSID("$NetBSD: udivsi3.S,v 1.6 2003/08/27 15:03:06 uwe Exp $")
 #endif
 
+/*
+ * IMPOTANT: This function is special.
+ *
+ * This function is an auxiliary function that is referenced by the
+ * code generated by gcc for integer division.  But gcc does NOT treat
+ * a call to this function as an ordinary function call w.r.t. the set
+ * of register this call clobbers.  See the definition of "udivsi3_i1"
+ * in gcc/config/sh/sh.md.
+ *
+ * Any call to this function MUST NOT clobber any registers besides r4
+ * and r0, where the result is returned.  At the time of the call the
+ * r4 contains the first argument, so we are only left with r0, and we
+ * cannot do anything meaningful using only one register.  The
+ * consequences are:
+ *
+ * . this function cannot have _PROF_PROLOGUE
+ * . this function cannot be called via PLT
+ */
+
 /* r0 <= r4 / r5 */
-ENTRY(__udivsi3)
+NENTRY(__udivsi3)
        tst     r5, r5
        bt      div_by_zero
 



Home | Main Index | Thread Index | Old Index