[LWN Logo]

Date: Mon, 20 Apr 1998 09:14:16 -0400
From: Uncle George <gatgul@voicenet.com>
To: Hugo.van.der.Kooij@caiw.nl
Subject: Re: Netscape

My diffs are as follows:
1) Makefile - include /usr/local/lib/libXm.a
2) Grid.c - include a missing dropsmgrs.h include
3) garray.c - change int32 -> int64 ( all int32's where changed!)
4) jsapi.c    - take care of NaN conversions to int
5) jsnum.c    - plug in the float point MIN value as per alpha handbook.
6) jsnum.h    - security/sanity check for NaN testing conversion
7) _linux.h    - move stack to highed ground, so I can see chopped off address
pointers easier
8) unix.c    - make mmap'ed stack executable - longjmp/signals seem to put
machine instruction on the stack

I Am using lesstif, but lesstif-current. The folks at hungry have been putting a
lot of effort into getting netscape & lesstif working well together, and 83 just
wont make it. dont forget to build lesstif with -DXTHREADS, and ./configure
--enable-static --enable-shared  u need to install the lesstif includes before u
build mozilla.
I am also using redhat 5.0
hope this helps.
gat
PS I guess i gotta say this but THE DIFFS ARE IN THE MAIL.

Hugo van der Kooij wrote:

> On Sun, 19 Apr 1998, Uncle George wrote:
>
> > how about u get src, i give u diff ? u can build to ur hearts content!?
>
> Yes. Please tell us where you put these diffs.

diff -r -u -I RCSID -I Id -I Revision: ns/cmd/xfe/Makefile
ns.new/cmd/xfe/Makefile
--- ns/cmd/xfe/Makefile Mon Mar 30 21:05:35 1998
+++ ns.new/cmd/xfe/Makefile Sat Jan  7 19:23:18 1922
@@ -579,6 +579,7 @@
 -include $(DEPTH)/config/motif.mk

 XTOOLLIB = -L/usr/X11R6/lib -lXt -lSM -lICE
+#XTOOLLIB = -L/usr/X11R6/lib -lSM -lICE
 XLIB  = -lXext -lX11
 XMULIB  = -lXmu -lXpm

@@ -589,7 +590,7 @@

 MOTIFLIB =\
    $(MOTIFPATCH_LIB) \
-   /usr/X11R6/lib/libXm.a \
+   /usr/local/lib/libXm.a \
    $(NS_MOTIF2_XP_LD_FLAGS)

 endif
diff -r -u -I RCSID -I Id -I Revision: ns/cmd/xfe/Microline3.0/XmL/Grid.c
ns.new/cmd/xfe/Microline3.0/XmL/Grid.c
--- ns/cmd/xfe/Microline3.0/XmL/Grid.c Mon Mar 30 21:05:42 1998
+++ ns.new/cmd/xfe/Microline3.0/XmL/Grid.c Sat Apr  4 06:21:41 1998
@@ -30,6 +30,9 @@
 #include <Xm/Text.h>
 #include <Xm/DrawnB.h>
 #include <Xm/CutPaste.h>
+#if defined (__linux__)
+#include <Xm/DropSMgr.h>
+#endif
 #include <X11/StringDefs.h>
 #include <X11/cursorfont.h>
 #include <stdio.h>
diff -r -u -I RCSID -I Id -I Revision: ns/include/garray.h
ns.new/include/garray.h
--- ns/include/garray.h Mon Mar 30 21:03:48 1998
+++ ns.new/include/garray.h Sat Apr  4 21:01:08 1998
@@ -163,7 +163,7 @@
 template<class PTRTYPE>
 class TXP_GrowableArray: public CXP_GrowableArray {
 public:
-    PTRTYPE operator[](int nIndex) const { return
(PTRTYPE)(int32)m_pData[nIndex]; }
+    PTRTYPE operator[](int nIndex) const { return
(PTRTYPE)(int64)m_pData[nIndex]; }
     PTRTYPE& operator[](int nIndex){ return *(PTRTYPE*)&m_pData[nIndex]; }
     int Add(PTRTYPE newElement){ return CXP_GrowableArray::Add( (void*)
newElement ); }
 };
@@ -176,7 +176,7 @@
 #define Declare_GrowableArray(NAME,PTRTYPE)                                 \
     class TXP_GrowableArray_##NAME: public CXP_GrowableArray
{                          \

public:
\
-        PTRTYPE operator[](int nIndex) const { return
(PTRTYPE)(int32)m_pData[nIndex]; }\
+        PTRTYPE operator[](int nIndex) const { return
(PTRTYPE)(int64)m_pData[nIndex]; }\
         PTRTYPE& operator[](int nIndex){ return *(PTRTYPE*)&m_pData[nIndex];
}          \
         int Add(PTRTYPE newElement){ return CXP_GrowableArray::Add( (void*)
newElement ); } \

};
\
@@ -216,12 +216,12 @@
 #define Declare_PtrStack(NAME, PTRTYPE) \
     class TXP_PtrStack_##NAME : public CXP_PtrStack {                   \
     public:                                                             \
-        void Push( PTRTYPE t ){ CXP_PtrStack::Push((void*)(int32)t); }  \
-        PTRTYPE Top(){ return (PTRTYPE)(int32)CXP_PtrStack::Top(); }    \
-        PTRTYPE Pop(){ return (PTRTYPE)(int32)CXP_PtrStack::Pop(); }    \
-        PTRTYPE operator[](int nIndex) const { return
(PTRTYPE)(int32)m_pData[nIndex]; }\
+        void Push( PTRTYPE t ){ CXP_PtrStack::Push((void*)(int64)t); }  \
+        PTRTYPE Top(){ return (PTRTYPE)(int64)CXP_PtrStack::Top(); }    \
+        PTRTYPE Pop(){ return (PTRTYPE)(int64)CXP_PtrStack::Pop(); }    \
+        PTRTYPE operator[](int nIndex) const { return
(PTRTYPE)(int64)m_pData[nIndex]; }\
         PTRTYPE& operator[](int nIndex){ return *(PTRTYPE*)&m_pData[nIndex];
}          \
-        int Add(PTRTYPE newElement){ return CXP_GrowableArray::Add(
(void*)(int32)newElement ); } \
+        int Add(PTRTYPE newElement){ return CXP_GrowableArray::Add(
(void*)(int64)newElement ); } \
     };                                                                  \


diff -r -u -I RCSID -I Id -I Revision: ns/js/src/jsapi.c ns.new/js/src/jsapi.c
--- ns/js/src/jsapi.c Mon Mar 30 21:04:01 1998
+++ ns.new/js/src/jsapi.c Thu Apr  2 07:02:41 1998
@@ -841,11 +841,36 @@
   * so we don't need to GC-alloc constant doubles.
   */
  jsdouble d = cds->dval;
+#if defined(__linux__) && defined (__alpha__)
+ jsint i;
+ if      (isnan(d)) i = 0;
+ else if (i=isinf(d)) {
+  if ( i < 0 )
+   i = 0x80000000;
+  else
+   i = 0x07ffffff;
+ }
+ else
+ {
+  union feeb {
+   double d;
+   long l;
+  } feeb;
+  long l;
+  feeb.d = d;
+  l = d;
+   i = (jsint) l;
+ }
+ if (JSDOUBLE_IS_INT(d, i) && INT_FITS_IN_JSVAL(i))
+  value = INT_TO_JSVAL(i);
+ else
+  value = DOUBLE_TO_JSVAL(&cds->dval);
+#else
  jsint i = (jsint)d;
-
  value = (JSDOUBLE_IS_INT(d, i) && INT_FITS_IN_JSVAL(i))
   ? INT_TO_JSVAL(i)
   : DOUBLE_TO_JSVAL(&cds->dval);
+#endif
 #else
  ok = js_NewNumberValue(cx, cds->dval, &value);
  if (!ok)
diff -r -u -I RCSID -I Id -I Revision: ns/js/src/jsnum.c ns.new/js/src/jsnum.c
--- ns/js/src/jsnum.c Mon Mar 30 21:04:02 1998
+++ ns.new/js/src/jsnum.c Thu Apr  2 07:00:38 1998
@@ -235,7 +235,11 @@
     {0,                         "POSITIVE_INFINITY"},
     {0,                         "NEGATIVE_INFINITY"},
     {1.7976931348623157E+308,   "MAX_VALUE"},
+#if !( defined(__linux__) && defined(__alpha__))
     {0,                         "MIN_VALUE"},
+#else
+    {2.2250738585072013E-308,   "MIN_VALUE"},
+#endif
     {0}
 };

@@ -287,9 +291,11 @@
      return NULL;
  }

+#if !( defined(__linux__) && defined(__alpha__))
  u.s.hi = 0;
  u.s.lo = 1;
  number_constants[NC_MIN_VALUE].dval = u.d;
+#endif
     }

     if (!JS_DefineFunctions(cx, obj, number_functions))
diff -r -u -I RCSID -I Id -I Revision: ns/js/src/jsnum.h ns.new/js/src/jsnum.h
--- ns/js/src/jsnum.h Mon Mar 30 21:04:02 1998
+++ ns.new/js/src/jsnum.h Thu Apr  2 07:04:44 1998
@@ -59,7 +59,7 @@

 #define JSDOUBLE_IS_INT_2(d, i) (!JSDOUBLE_IS_NEGZERO(d) && (jsdouble)i == d)

-#ifdef XP_PC
+#if defined(XP_PC) || (defined(__linux__) && defined (__alpha))
 /* XXX MSVC miscompiles NaN floating point comparisons for ==, !=, <, and <= */

 #define JSDOUBLE_IS_INT(d, i) (!JSDOUBLE_IS_NaN(d) && JSDOUBLE_IS_INT_2(d, i))
 #else
diff -r -u -I RCSID -I Id -I Revision: ns/nsprpub/pr/include/md/_linux.h
ns.new/nsprpub/pr/include/md/_linux.h
--- ns/nsprpub/pr/include/md/_linux.h Mon Mar 30 21:05:25 1998
+++ ns.new/nsprpub/pr/include/md/_linux.h Sat Apr  4 05:45:42 1998
@@ -29,13 +29,17 @@
 #define _PR_SI_ARCHITECTURE "ppc"
 #elif defined(__alpha)
 #define _PR_SI_ARCHITECTURE "alpha"
+/* Move VMBASE to beyond 32 bits so we can readily observe ptr truncation */
+#define _PR_STACK_VMBASE 0x15450000000L
 #else
 #define _PR_SI_ARCHITECTURE "x86"
 #endif
 #define PR_DLL_SUFFIX  ".so"

 #define _PR_VMBASE              0x30000000
+#if !defined _PR_STACK_VMBASE
 #define _PR_STACK_VMBASE 0x50000000
+#endif
 #define _MD_DEFAULT_STACK_SIZE 65536L
 #define _MD_MMAP_FLAGS          MAP_PRIVATE

diff -r -u -I RCSID -I Id -I Revision: ns/nsprpub/pr/src/md/unix/unix.c
ns.new/nsprpub/pr/src/md/unix/unix.c
--- ns/nsprpub/pr/src/md/unix/unix.c Mon Mar 30 21:05:26 1998
+++ ns.new/nsprpub/pr/src/md/unix/unix.c Sat Apr  4 05:37:45 1998
@@ -34,6 +34,10 @@
 #include <sys/filio.h>
 #endif

+#if defined (__linux__)
+#include <sys/uio.h>  /* Get readv/writev */
+#endif
+
 /*
  * Make sure _PRSockLen_t is 32-bit, because we will cast a PRUint32* or
  * PRInt32* pointer to a _PRSockLen_t* pointer.
@@ -2485,6 +2489,9 @@
  }

  prot = PROT_READ|PROT_WRITE;
+#if defined(__linux__) && defined (__alpha__)
+ prot |= PROT_EXEC;  /* Stack needs +x permissions */
+#endif
  rv = mmap((vaddr != 0) ? vaddr : lastaddr, size, prot,
      _MD_MMAP_FLAGS,
      _pr_zero_fd, 0);



-- 
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com