am 6626af93: Merge "Remove the 060-reflection-security test." into gingerbread

Merge commit '6626af931dad11d2c2035cbd1f2e1593fb3097b8' into gingerbread-plus-aosp

* commit '6626af931dad11d2c2035cbd1f2e1593fb3097b8':
  Remove the 060-reflection-security test.
diff --git a/vm/arch/x86-atom/Call386ABI.S b/vm/arch/x86-atom/Call386ABI.S
index 9e3b916..1146c2d 100644
--- a/vm/arch/x86-atom/Call386ABI.S
+++ b/vm/arch/x86-atom/Call386ABI.S
@@ -149,8 +149,42 @@
     movl        32(%ebp), %ecx          # %ecx<- return pointer
     je          2f                      # handle double return
     jl          1f                      # handle float return
+
+   /*
+    *  If a native function returns a result smaller than 8-bytes
+    *  then higher bytes may contain garbage.
+    *  This code does type-checking based on size of return result.
+    *  We zero higher bytes instead of allowing the garbage to go through.
+    */
+
+    cmpl        $3,%ebx
+    je  S8
+    cmpl        $4,%ebx
+    je          S4
+    cmpl        $7,%ebx
+    je          S1
+    cmpl        $6,%ebx
+    jne S2
+U2:
+    movzwl      %ax, %eax
     movl        %eax, (%ecx)            # save 32-bit return
+    jmp         CallABI_EXIT            # exit call
+
+S1:
+    movsbl      %al, %eax
+    movl        %eax, (%ecx)            # save 32-bit return
+    jmp         CallABI_EXIT            # exit call
+S2:
+    movswl      %ax, %eax
+    movl        %eax, (%ecx)            # save 32-bit return
+    jmp         CallABI_EXIT            # exit call
+S4:
+    cltd
+    movl        %eax, (%ecx)            # save 32-bit return
+    jmp         CallABI_EXIT            # exit call
+S8:
     movl        %edx, 4(%ecx)           # save 64-bit return
+    movl        %eax, (%ecx)            # save 32-bit return
     jmp         CallABI_EXIT            # exit call
 
 2:
diff --git a/vm/native/java_lang_Runtime.c b/vm/native/java_lang_Runtime.c
index b5c0aee..5170eed 100644
--- a/vm/native/java_lang_Runtime.c
+++ b/vm/native/java_lang_Runtime.c
@@ -19,7 +19,8 @@
  */
 #include "Dalvik.h"
 #include "native/InternalNativePriv.h"
-
+#include <unistd.h>
+#include <limits.h>
 
 /*
  * public void gc()
@@ -109,6 +110,26 @@
 }
 
 /*
+ * public int availableProcessors()
+ *
+ * Returns the number of online processors, at least one.
+ *
+ */
+static void Dalvik_java_lang_Runtime_availableProcessors(const u4* args,
+    JValue* pResult)
+{
+    long result = 1;
+#ifdef _SC_NPROCESSORS_ONLN
+    result = sysconf(_SC_NPROCESSORS_ONLN);
+    if (result > INT_MAX) {
+        result = INT_MAX;
+    } else if (result < 1 ) {
+        result = 1;
+    }
+#endif
+    RETURN_INT((int)result);
+}
+/*
  * public void maxMemory()
  *
  * Returns GC heap max memory in bytes.
@@ -152,6 +173,8 @@
         Dalvik_java_lang_Runtime_freeMemory },
     { "gc",                 "()V",
         Dalvik_java_lang_Runtime_gc },
+    { "availableProcessors", "()I",
+        Dalvik_java_lang_Runtime_availableProcessors },
     { "maxMemory",          "()J",
         Dalvik_java_lang_Runtime_maxMemory },
     { "nativeExit",         "(IZ)V",