pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/www/mozilla/files Now that the toolchain is able to bu...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/7f160aea9b40
branches:  trunk
changeset: 463781:7f160aea9b40
user:      martin <martin%pkgsrc.org@localhost>
date:      Wed Nov 26 21:22:12 2003 +0000

description:
Now that the toolchain is able to build this beast at all, replace the
untested MD xpcom routines with working ones for sparc64 - mostly copied
from the solaris sparc v9 versions.

diffstat:

 www/mozilla/files/xptcinvoke_asm_sparc64_netbsd.s |   94 ++++++++------
 www/mozilla/files/xptcinvoke_sparc64_netbsd.cpp   |  135 +++++++--------------
 www/mozilla/files/xptcstubs_asm_sparc64_netbsd.s  |   49 +++----
 www/mozilla/files/xptcstubs_sparc64_netbsd.cpp    |   28 ++--
 4 files changed, 137 insertions(+), 169 deletions(-)

diffs (truncated from 382 to 300 lines):

diff -r ec56ed487cea -r 7f160aea9b40 www/mozilla/files/xptcinvoke_asm_sparc64_netbsd.s
--- a/www/mozilla/files/xptcinvoke_asm_sparc64_netbsd.s Wed Nov 26 19:52:18 2003 +0000
+++ b/www/mozilla/files/xptcinvoke_asm_sparc64_netbsd.s Wed Nov 26 21:22:12 2003 +0000
@@ -22,6 +22,7 @@
 
 /* Platform specific code to invoke XPCOM methods on native objects */
         .global XPTC_InvokeByIndex
+        .type   XPTC_InvokeByIndex, #function
 /*
     XPTC_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
                    PRUint32 paramCount, nsXPTCVariant* params);
@@ -49,50 +50,63 @@
  */
        
 XPTC_InvokeByIndex:
-       save    %sp,-(128+8),%sp    ! room for the register window and this
-       sllx    %i2,3,%l0           ! required stack size in bytes
+       save    %sp,-(128 + 64),%sp ! room for the register window and
+                                   ! struct pointer, rounded up to 0 % 64
+       sll     %i2,4,%l0           ! assume the worst case
+                                   ! paramCount * 2 * 8 bytes
+       cmp     %l0, 0              ! are there any args? If not,
+       be      .invoke             ! no need to copy args to stack
+        nop
+
        sub     %sp,%l0,%sp         ! create the additional stack space
-           
-       add     %sp,0x7ff+128,%l2   ! pointer to parameter save area
-       add     %l2,8,%o0           ! %o1's parameter save area
-       mov     %i2,%o1             ! paramCount
+       add     %sp,0x7ff+136,%o0   ! step past the register window, the
+                                   ! struct result pointer and the 'this' slot
+       mov     %i2,%o1             ! paramCount
        call    invoke_copy_to_stack
-       mov     %i3,%o2             ! params
+        mov    %i3,%o2             ! params
+
+!
+!   load arguments from stack into the outgoing registers
+!   BIAS is 0x7ff (2047)
+!
+
+!   load the %o1..5 64bit (extended word) output registers registers 
+       ldx     [%sp + 0x7ff + 136],%o1    ! %i1
+       ldx     [%sp + 0x7ff + 144],%o2    ! %i2
+       ldx     [%sp + 0x7ff + 152],%o3    ! %i3
+       ldx     [%sp + 0x7ff + 160],%o4    ! %i4
+       ldx     [%sp + 0x7ff + 168],%o5    ! %i5
+
+!   load the even number double registers starting with %f2
+       ldd     [%sp + 0x7ff + 136],%f2
+       ldd     [%sp + 0x7ff + 144],%f4
+       ldd     [%sp + 0x7ff + 152],%f6
+       ldd     [%sp + 0x7ff + 160],%f8
+       ldd     [%sp + 0x7ff + 168],%f10
+       ldd     [%sp + 0x7ff + 176],%f12
+       ldd     [%sp + 0x7ff + 184],%f14
+       ldd     [%sp + 0x7ff + 192],%f16
+       ldd     [%sp + 0x7ff + 200],%f18
+       ldd     [%sp + 0x7ff + 208],%f20
+       ldd     [%sp + 0x7ff + 216],%f22
+       ldd     [%sp + 0x7ff + 224],%f24
+       ldd     [%sp + 0x7ff + 232],%f26
+       ldd     [%sp + 0x7ff + 240],%f28
+       ldd     [%sp + 0x7ff + 248],%f30
+
 !
 !   calculate the target address from the vtable
 !
-       inc     %i1                 ! vTable is zero-based, index is 1 based (?)
-       ldx     [%i0],%l1           ! *that --> vTable
-       sllx    %i1,4,%i1           ! Each vtable entry is 16-bytes long
-       add     %i1,%l1,%l1
-       ldsh    [%l1],%l0           ! this adjustor
-       add     %l0,%i0,%i0         ! adjust this
-       ldx     [%l1 + 8],%l0       ! target address
+.invoke:
+       sll     %i1,3,%l0           ! index *= 8
+       ldx     [%i0],%l1           ! *this --> address of vtable
+       ldx     [%l0 + %l1],%l0     ! this->vtable[index] --> address
 
-.L15:  ldd     [%sp + 0x7ff + 128 + 120],%f30
-.L14:  ldd     [%sp + 0x7ff + 128 + 112],%f28
-.L13:  ldd     [%sp + 0x7ff + 128 + 104],%f26
-.L12:  ldd     [%sp + 0x7ff + 128 + 96],%f24
-.L11:  ldd     [%sp + 0x7ff + 128 + 88],%f22
-.L10:  ldd     [%sp + 0x7ff + 128 + 80],%f20
-.L9:   ldd     [%sp + 0x7ff + 128 + 72],%f18
-.L8:   ldd     [%sp + 0x7ff + 128 + 64],%f16
-.L7:   ldd     [%sp + 0x7ff + 128 + 56],%f14
-.L6:   ldd     [%sp + 0x7ff + 128 + 48],%f12
-.L5:   ldx     [%sp + 0x7ff + 128 + 40],%o5
-       ldd     [%sp + 0x7ff + 128 + 40],%f10
-.L4:   ldx     [%sp + 0x7ff + 128 + 32],%o4
-       ldd     [%sp + 0x7ff + 128 + 32],%f8
-.L3:   ldx     [%sp + 0x7ff + 128 + 24],%o3
-       ldd     [%sp + 0x7ff + 128 + 24],%f6
-.L2:   ldx     [%sp + 0x7ff + 128 + 16],%o2
-       ldd     [%sp + 0x7ff + 128 + 16],%f4
-.L1:   ldx     [%sp + 0x7ff + 128 +  8],%o1
-       ldd     [%sp + 0x7ff + 128 +  8],%f2
-.L0:
-       jmpl    %l0,%o7             ! call the routine
-! always have a 'this', from the incoming 'that'
-        mov    %i0,%o0
-       
+       jmpl    %l0,%o7             ! call the routine
+        mov    %i0,%o0             ! move 'this' pointer to out register
+
+       mov     %o0,%i0             ! propagate return value
        ret
-        restore        %o0,0,%o0   ! propogate return value
+        restore
+
+        .size    XPTC_InvokeByIndex, .-XPTC_InvokeByIndex
diff -r ec56ed487cea -r 7f160aea9b40 www/mozilla/files/xptcinvoke_sparc64_netbsd.cpp
--- a/www/mozilla/files/xptcinvoke_sparc64_netbsd.cpp   Wed Nov 26 19:52:18 2003 +0000
+++ b/www/mozilla/files/xptcinvoke_sparc64_netbsd.cpp   Wed Nov 26 21:22:12 2003 +0000
@@ -24,106 +24,61 @@
 
 #include "xptcprivate.h"
 
-/* solaris defines __sparc for workshop compilers and 
-   linux defines __sparc__ */
-
-#if !defined(__sparc64__) && !defined(__sparc_v9__)
+#if !defined(__sparc64__) && !defined(_LP64)
 #error "This code is for Sparc64 only"
 #endif
 
-typedef unsigned nsXPCVariant;
-
-extern "C" PRUint32
-invoke_count_words(PRUint32 paramCount, nsXPTCVariant* s)
-{
-    PRUint32 result = 0;
-    for(PRUint32 i = 0; i < paramCount; i++, s++)
-    {
-        if(s->IsPtrData())
-        {
-            result++;
-            continue;
-        }
-        switch(s->type)
-        {
-        case nsXPTType::T_I8     :
-        case nsXPTType::T_I16    :
-        case nsXPTType::T_I32    :
-        case nsXPTType::T_I64    :
-            result++;
-            break;
-        case nsXPTType::T_U8     :
-        case nsXPTType::T_U16    :
-        case nsXPTType::T_U32    :
-        case nsXPTType::T_U64    :
-            result++;
-            break;
-        case nsXPTType::T_FLOAT  :
-        case nsXPTType::T_DOUBLE :
-            result++;
-            break;
-        case nsXPTType::T_BOOL   :
-        case nsXPTType::T_CHAR   :
-        case nsXPTType::T_WCHAR  :
-            result++;
-            break;
-        default:
-            // all the others are plain pointer types
-            result++;
-            break;
-        }
-    }
-    // nuts, I know there's a cooler way of doing this, but it's late
-    // now and it'll probably come to me in the morning.
-    if (result & 0x7) result += 8 - (result & 0x7);     // ensure 16-byte alignment
-    return result;
-}
-
 extern "C" PRUint32
 invoke_copy_to_stack(PRUint64* d, PRUint32 paramCount, nsXPTCVariant* s)
 {
-/*
+  /*
     We need to copy the parameters for this function to locals and use them
     from there since the parameters occupy the same stack space as the stack
     we're trying to populate.
-*/
-    uint64 *l_d = d;
-    nsXPTCVariant *l_s = s;
-    uint32 l_paramCount = paramCount;
-    uint32 regCount = 0;       // return the number of registers to load from the stack
+  */
+  PRUint64 *l_d = d;
+  nsXPTCVariant *l_s = s;
+  PRUint64 l_paramCount = paramCount;
+  PRUint64 regCount = 0;  // return the number of registers to load from the stack
 
-    for(uint32 i = 0; i < l_paramCount; i++, l_d++, l_s++)
+  for(PRUint64 i = 0; i < l_paramCount; i++, l_d++, l_s++)
+  {
+    if (regCount < 5) regCount++;
+
+    if (l_s->IsPtrData())
+    {
+      *l_d = (PRUint64)l_s->ptr;
+      continue;
+    }
+    switch (l_s->type)
     {
-       if (regCount < 5) regCount++;
-        if(l_s->IsPtrData())
-        {
-            *((void**)l_d) = l_s->ptr;
-            continue;
-        }
-        switch(l_s->type)
-        {
-        case nsXPTType::T_I8     : *((int64*)  l_d) = l_s->val.i8;          break;
-        case nsXPTType::T_I16    : *((int64*)  l_d) = l_s->val.i16;         break;
-        case nsXPTType::T_I32    : *((int64*)  l_d) = l_s->val.i32;         break;
-        case nsXPTType::T_I64    : *((int64*)  l_d) = l_s->val.i64;         break;
-        case nsXPTType::T_U64    : *((uint64*) l_d) = l_s->val.u64;         break;
-        case nsXPTType::T_U8     : *((uint64*) l_d) = l_s->val.u8;          break;
-        case nsXPTType::T_U16    : *((uint64*) l_d) = l_s->val.u16;         break;
-        case nsXPTType::T_U32    : *((uint64*) l_d) = l_s->val.u32;         break;
-        case nsXPTType::T_FLOAT  : 
-            struct floats { float pad; float data; };
-            ((floats*) l_d)->pad = 0;
-            ((floats*) l_d)->data = l_s->val.f;           break;
-        case nsXPTType::T_DOUBLE : *((uint64*) l_d) = l_s->val.u64;         break;
-        case nsXPTType::T_BOOL   : *((uint64*) l_d) = l_s->val.b;           break;
-        case nsXPTType::T_CHAR   : *((uint64*) l_d) = l_s->val.c;           break;
-        case nsXPTType::T_WCHAR  : *((uint64*) l_d) = l_s->val.wc;          break;
-        default:
-            // all the others are plain pointer types
-            *((void**)l_d) = l_s->val.p;
-            break;
-        }
+      case nsXPTType::T_I8    : *((PRInt64*)l_d)     = l_s->val.i8;    break;
+      case nsXPTType::T_I16   : *((PRInt64*)l_d)     = l_s->val.i16;   break;
+      case nsXPTType::T_I32   : *((PRInt64*)l_d)     = l_s->val.i32;   break;
+      case nsXPTType::T_I64   : *((PRInt64*)l_d)     = l_s->val.i64;   break;
+      
+      case nsXPTType::T_U8    : *((PRUint64*)l_d)    = l_s->val.u8;    break;
+      case nsXPTType::T_U16   : *((PRUint64*)l_d)    = l_s->val.u16;   break;
+      case nsXPTType::T_U32   : *((PRUint64*)l_d)    = l_s->val.u32;   break;
+      case nsXPTType::T_U64   : *((PRUint64*)l_d)    = l_s->val.u64;   break;
+
+      /* in the case of floats, we want to put the bits in to the
+         64bit space right justified... floats in the paramter array on
+         sparcv9 use odd numbered registers.. %f1, %f3, so we have to skip
+         the space that would be occupied by %f0, %f2, etc.
+      */
+      case nsXPTType::T_FLOAT : *(((float*)l_d) + 1) = l_s->val.f;     break;
+      case nsXPTType::T_DOUBLE: *((double*)l_d)      = l_s->val.d;     break;
+      case nsXPTType::T_BOOL  : *((PRBool*)l_d)      = l_s->val.b;     break;
+      case nsXPTType::T_CHAR  : *((PRUint64*)l_d)    = l_s->val.c;     break;
+      case nsXPTType::T_WCHAR : *((PRInt64*)l_d)     = l_s->val.wc;    break;
+
+      default:
+        // all the others are plain pointer types
+        *((void**)l_d) = l_s->val.p;
+        break;
     }
-    return regCount;
+  }
+  
+  return regCount;
 }
-
diff -r ec56ed487cea -r 7f160aea9b40 www/mozilla/files/xptcstubs_asm_sparc64_netbsd.s
--- a/www/mozilla/files/xptcstubs_asm_sparc64_netbsd.s  Wed Nov 26 19:52:18 2003 +0000
+++ b/www/mozilla/files/xptcstubs_asm_sparc64_netbsd.s  Wed Nov 26 21:22:12 2003 +0000
@@ -32,36 +32,35 @@
 ! we don't create a new frame yet, but work within the frame of the calling
 ! function to give ourselves the other parameters we want
 
-        mov     %o0, %o1            ! shuffle the index up to 2nd place
-        mov     %i0, %o0            ! the original 'this'
-        add     %fp, 0x7ff+128+(2*8), %o2    ! previous stack top adjusted to the first argument slot (beyond 'this')
+       mov     %o0, %o1               ! shuffle the index up to 2nd place
+       mov     %i0, %o0               ! the original 'this'
+       add     %fp, 0x7ff + 136, %o2  ! previous stack top adjusted to the first argument slot (beyond 'this')
+
 ! save off the original incoming parameters that arrived in 
 ! registers, the ABI guarantees the space for us to do this
-        st      %i1, [%o2 +  0]
-        st      %i2, [%o2 +  8]
-        st      %i3, [%o2 + 16]
-        st      %i4, [%o2 + 24]
-        st      %i5, [%o2 + 32]
+       stx     %i1, [%fp + 0x7ff + 136]
+       stx     %i2, [%fp + 0x7ff + 144]
+       stx     %i3, [%fp + 0x7ff + 152]
+       stx     %i4, [%fp + 0x7ff + 160]
+       stx     %i5, [%fp + 0x7ff + 168]
 ! now we can build our own stack frame
-        save    %sp,-(176),%sp   ! room for the register window
+       save    %sp,-(128 + 64),%sp    ! room for the register window and
+                                      ! struct pointer, rounded up to 0 % 64



Home | Main Index | Thread Index | Old Index