compile WinCE for ARM WINCE_NSPRPUB_RELEASE_4_2_BETA1
authorblythe%netscape.com
Tue, 12 Feb 2002 23:48:04 +0000
branchWINCE_NSPRPUB_RELEASE_4_2_BETA1
changeset 2250 03bb9b496835a01e14d89a48c8cc70f99bbc0121
parent 2249 a63c7241a07e937b5e4f807ac1b3b5b5da90f680
child 2251 d17ee69a2cb004b7f130291c24ac90512089fd27
push idunknown
push userunknown
push dateunknown
compile WinCE for ARM
config/WIN32.mk
configure
configure.in
gmakefile.win
pr/include/md/_wince.h
pr/src/md/windows/ntgc.c
--- a/config/WIN32.mk
+++ b/config/WIN32.mk
@@ -189,12 +189,16 @@ ifdef USE_DEBUG_RTL
 OBJDIR_SUFFIX = OBJD
 else
 OBJDIR_SUFFIX = OBJ
 endif
 
 OBJDIR_NAME = $(OS_CONFIG)$(CPU_ARCH_TAG)$(OBJDIR_TAG).$(OBJDIR_SUFFIX)
 
 ifeq ($(OS_TARGET),WINCE)
+ifeq ($(TARGETCPU),X86)
 OS_DLLFLAGS = -nologo -DLL -SUBSYSTEM:WINDOWSCE,3.00 -MACHINE:IX86 -ENTRY:_DllMainCRTStartup -STACK:0x10000,0x1000 -NODEFAULTLIB:OLDNAMES.lib
 else
+OS_DLLFLAGS = -nologo -DLL -SUBSYSTEM:WINDOWSCE,3.00 -MACHINE:ARM -ENTRY:_DllMainCRTStartup -STACK:0x10000,0x1000 -NODEFAULTLIB:OLDNAMES.lib
+endif
+else
 OS_DLLFLAGS = -nologo -DLL -SUBSYSTEM:WINDOWS -PDB:NONE
 endif
\ No newline at end of file
--- a/configure
+++ b/configure
@@ -3737,18 +3737,28 @@ EOF
 
     if test -n "$GNU_CC"; then
         cat >> confdefs.h <<\EOF
 #define NONAMELESSUNION 1
 EOF
 
         MKSHLIB='$(DLLTOOL) --as=$(AS) -k --dllname $*.dll --output-lib $@'
     else
-        CC=cl
-        CXX=cl
+        if test "$OS_TARGET" = "WINCE"; then
+            if test "$TARGETCPU" = "ARM"; then
+                CC=clarm
+                CXX=clarm
+            else
+                CC=cl
+                CXX=cl
+            fi
+        else
+            CC=cl
+            CXX=cl
+        fi
         LD=link
         AR='lib -NOLOGO -OUT:"$@"'
         AR_FLAGS=
         RANLIB='echo not_ranlib'
         STRIP='echo not_strip'
         NSINSTALL=nsinstall
         RC=rc.exe
         GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
@@ -3888,17 +3898,21 @@ EOF
         CPU_ARCH_TAG=$CPU_ARCH
     fi
 
     if test -n "$USE_DEBUG_RTL"; then
         OBJDIR_SUFFIX=OBJD
     fi
 
     if test "$OS_TARGET" = "WINCE"; then
-        OS_DLLFLAGS='-nologo -DLL -SUBSYSTEM:WINDOWSCE,3.00 -MACHINE:IX86 -ENTRY:_DllMainCRTStartup -STACK:0x10000,0x1000 -NODEFAULTLIB:OLDNAMES.lib'
+        if test "$TARGETCPU" = "X86"; then
+            OS_DLLFLAGS='-nologo -DLL -SUBSYSTEM:WINDOWSCE,3.00 -MACHINE:IX86 -ENTRY:_DllMainCRTStartup -STACK:0x10000,0x1000 -NODEFAULTLIB:OLDNAMES.lib'
+        else
+            OS_DLLFLAGS='-nologo -DLL -SUBSYSTEM:WINDOWSCE,3.00 -MACHINE:ARM -ENTRY:_DllMainCRTStartup -STACK:0x10000,0x1000 -NODEFAULTLIB:OLDNAMES.lib'
+        fi
     else
         OS_DLLFLAGS='-nologo -DLL -SUBSYSTEM:WINDOWS -PDB:NONE'
     fi
 
     case "$OS_TARGET" in
     WINNT)
 	    MDCPUCFG_H=_winnt.cfg
 	    ;;
@@ -3911,42 +3925,68 @@ EOF
     WIN16)
 	    MDCPUCFG_H=_win16.cfg
 	    ;;
     *)
 	    { echo "configure: error: Missing OS_TARGET for ${target}.  Use --enable-win32-target to set." 1>&2; exit 1; }
    	;;
     esac
 
-    case "$target_cpu" in
-    i?86)
-	    cat >> confdefs.h <<\EOF
+    if test "$OS_TARGET" = "WINCE"; then
+        case "$TARGETCPU" in
+        X86)
+	        cat >> confdefs.h <<\EOF
+#define _ARM_ 1
+EOF
+            ;;
+        ARM)
+	        cat >> confdefs.h <<\EOF
+#define _ARM_ 1
+EOF
+            ;;
+        *)
+	        cat >> confdefs.h <<\EOF
+#define _CPU_ARCH_NOT_DEFINED 1
+EOF
+            ;;
+        esac
+    else
+        case "$target_cpu" in
+        i?86)
+	        cat >> confdefs.h <<\EOF
 #define _X86_ 1
 EOF
 
-        ;;
-    alpha)
-	    cat >> confdefs.h <<\EOF
+            ;;
+        alpha)
+	        cat >> confdefs.h <<\EOF
 #define _ALPHA_ 1
 EOF
 
-   	    ;;
-    mips)
-	    cat >> confdefs.h <<\EOF
+   	        ;;
+        mips)
+	        cat >> confdefs.h <<\EOF
 #define _MIPS_ 1
 EOF
 
-	    ;;
-    *)
-	    cat >> confdefs.h <<\EOF
+	        ;;
+        arm)
+	        cat >> confdefs.h <<\EOF
+#define _ARM_ 1
+EOF
+
+	        ;;
+        *)
+	        cat >> confdefs.h <<\EOF
 #define _CPU_ARCH_NOT_DEFINED 1
 EOF
 
-	    ;;
-    esac
+	        ;;
+        esac
+    fi
 
     ;;
 
 *-ncr-sysv*)
     cat >> confdefs.h <<\EOF
 #define XP_UNIX 1
 EOF
 
--- a/configure.in
+++ b/configure.in
@@ -1188,18 +1188,28 @@ case "$target" in
     AC_DEFINE(WIN32)
     PR_MD_ARCH_DIR=windows
     RESOLVE_LINK_SYMBOLS=1
 
     if test -n "$GNU_CC"; then
         AC_DEFINE(NONAMELESSUNION)
         MKSHLIB='$(DLLTOOL) --as=$(AS) -k --dllname $*.dll --output-lib $@'
     else
-        CC=cl
-        CXX=cl
+        if test "$OS_TARGET" = "WINCE"; then
+            if test "$TARGETCPU" = "ARM"; then
+                CC=clarm
+                CXX=clarm
+            else
+                CC=cl
+                CXX=cl
+            fi
+        else
+            CC=cl
+            CXX=cl
+        fi
         LD=link
         AR='lib -NOLOGO -OUT:"$@"'
         AR_FLAGS=
         RANLIB='echo not_ranlib'
         STRIP='echo not_strip'
         NSINSTALL=nsinstall
         RC=rc.exe
         GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
@@ -1292,17 +1302,21 @@ case "$target" in
         CPU_ARCH_TAG=$CPU_ARCH
     fi
 
     if test -n "$USE_DEBUG_RTL"; then
         OBJDIR_SUFFIX=OBJD
     fi
 
     if test "$OS_TARGET" = "WINCE"; then
-        OS_DLLFLAGS='-nologo -DLL -SUBSYSTEM:WINDOWSCE,3.00 -MACHINE:IX86 -ENTRY:_DllMainCRTStartup -STACK:0x10000,0x1000 -NODEFAULTLIB:OLDNAMES.lib'
+        if test "$TARGETCPU" = "X86"; then
+            OS_DLLFLAGS='-nologo -DLL -SUBSYSTEM:WINDOWSCE,3.00 -MACHINE:IX86 -ENTRY:_DllMainCRTStartup -STACK:0x10000,0x1000 -NODEFAULTLIB:OLDNAMES.lib'
+        else
+            OS_DLLFLAGS='-nologo -DLL -SUBSYSTEM:WINDOWSCE,3.00 -MACHINE:ARM -ENTRY:_DllMainCRTStartup -STACK:0x10000,0x1000 -NODEFAULTLIB:OLDNAMES.lib'
+        fi
     else
         OS_DLLFLAGS='-nologo -DLL -SUBSYSTEM:WINDOWS -PDB:NONE'
     fi
 
     case "$OS_TARGET" in
     WINNT)
 	    MDCPUCFG_H=_winnt.cfg
 	    ;;
@@ -1315,30 +1329,47 @@ case "$target" in
     WIN16)
 	    MDCPUCFG_H=_win16.cfg
 	    ;;
     *)
 	    AC_MSG_ERROR([Missing OS_TARGET for ${target}.  Use --enable-win32-target to set.])
    	;;
     esac
 
-    case "$target_cpu" in
-    i?86)
-	    AC_DEFINE(_X86_)
-        ;;
-    alpha)
-	    AC_DEFINE(_ALPHA_)
-   	    ;;
-    mips)
-	    AC_DEFINE(_MIPS_)
-	    ;;
-    *)
-	    AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
-	    ;;
-    esac
+    if test "$OS_TARGET" = "WINCE"; then
+        case "$TARGETCPU" in
+        X86)
+	        AC_DEFINE(_X86_)
+            ;;
+        ARM)
+	        AC_DEFINE(_ARM_)
+            ;;
+        *)
+	        AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
+            ;;
+        esac
+    else
+        case "$target_cpu" in
+        i?86)
+	        AC_DEFINE(_X86_)
+            ;;
+        alpha)
+	        AC_DEFINE(_ALPHA_)
+       	    ;;
+        mips)
+	        AC_DEFINE(_MIPS_)
+    	    ;;
+        arm)
+	        AC_DEFINE(_ARM_)
+    	    ;;
+        *)
+	        AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
+    	    ;;
+        esac
+    fi
 
     ;;
 
 *-ncr-sysv*)
     AC_DEFINE(XP_UNIX)
     AC_DEFINE(SVR4)
     AC_DEFINE(SYSV)
     AC_DEFINE(NCR)
--- a/gmakefile.win
+++ b/gmakefile.win
@@ -41,19 +41,19 @@ endif
 ifndef MOZ_TOP
 MOZ_TOP=mozilla
 endif
 
 MOZ_DIST_FLIPPED = $(MOZ_SRC_FLIPPED)/mozilla/dist
 
 ifeq ($(OS_TARGET),WINCE)
 ifdef MOZ_DEBUG
-MOZ_OBJDIR = WINCE_D.OBJ
+MOZ_OBJDIR = $(OSVERSION)$(TARGETCPU)_D.OBJ
 else
-MOZ_OBJDIR = WINCE_O.OBJ
+MOZ_OBJDIR = $(OSVERSION)$(TARGETCPU)_O.OBJ
 endif
 else
 ifdef MOZ_DEBUG
 MOZ_OBJDIR = WIN32_D.OBJ
 else
 MOZ_OBJDIR = WIN32_O.OBJ
 endif
 endif
--- a/pr/include/md/_wince.h
+++ b/pr/include/md/_wince.h
@@ -276,17 +276,21 @@ extern PRInt32 _MD_CloseSocket(PRInt32 o
 
 #define _MD_INIT_ATOMIC()
 #if defined(_M_IX86) || defined(_X86_)
 #define _MD_ATOMIC_INCREMENT          _PR_MD_ATOMIC_INCREMENT
 #define _MD_ATOMIC_ADD          	  _PR_MD_ATOMIC_ADD
 #define _MD_ATOMIC_DECREMENT          _PR_MD_ATOMIC_DECREMENT
 #else /* non-x86 processors */
 #define _MD_ATOMIC_INCREMENT(x)       InterlockedIncrement((PLONG)x)
+#if defined(WINCE)
+#define _MD_ATOMIC_ADD(ptr,val)    (InterlockedExchange((PLONG)ptr, (*(PLONG)ptr) + (LONG)val) + val)
+#else
 #define _MD_ATOMIC_ADD(ptr,val)    (InterlockedExchangeAdd((PLONG)ptr, (LONG)val) + val)
+#endif
 #define _MD_ATOMIC_DECREMENT(x)       InterlockedDecrement((PLONG)x)
 #endif /* x86 */
 #define _MD_ATOMIC_SET(x,y)           InterlockedExchange((PLONG)x, (LONG)y)
 
 #define _MD_INIT_IO                   _PR_MD_INIT_IO
 
 
 /* wince doesn't have async IO */
--- a/pr/src/md/windows/ntgc.c
+++ b/pr/src/md/windows/ntgc.c
@@ -89,16 +89,18 @@ PRWord *_MD_HomeGCRegisters(PRThread *t,
         t->md.gcContext[5] = fiberData[0x2c];  /* context.Edi */
         t->md.gcContext[6] = fiberData[0x36];  /* context.Esp */
         t->md.gcContext[7] = fiberData[0x32];  /* context.Ebp */
         *np = PR_NUM_GCREGS;
 #endif
     }
     return (PRWord *)&t->md.gcContext;
 #elif defined(_ALPHA_)
+#elif defined(_ARM_)
+    return NULL;
 #endif /* defined(_X86_) */
 }
 
 /* This function is not used right now, but is left as a reference.
  * If you ever need to get the fiberID from the currently running fiber, 
  * this is it.
  */
 void *
@@ -114,10 +116,12 @@ GetMyFiberID()
     __asm {
         mov    EDX, FS:[18h]
         mov    EAX, DWORD PTR [EDX+10h]
         mov    [fiberData], EAX
     }
   
     return fiberData;
 #elif defined(_ALPHA_)
+#elif defined(_ARM_)
+    return NULL;
 #endif /* defined(_X86_) */
 }