Tracking merge of dalvik-dev to gingerbread

git cherry-pick --no-commit b99a099c
git cherry-pick --no-commit 9811671e023ceb82029040f7acf599013c773e6b
git cherry-pick --no-commit d0645bf0cc76ef7be11cf77a8e1995233a1972e4

Change-Id: Ie70fecaeaba97a25f114cd2717e381b5107533b1
diff --git a/include/cutils/mspace.h b/include/cutils/mspace.h
index e6e4047..93fe48e 100644
--- a/include/cutils/mspace.h
+++ b/include/cutils/mspace.h
@@ -87,6 +87,11 @@
     size_t max_capacity, int locked, void *base);
 
 size_t destroy_contiguous_mspace(mspace msp);
+
+/*
+   Returns the position of the "break" within the given mspace.
+*/
+void *contiguous_mspace_sbrk0(mspace msp);
 #endif
 
 /*
diff --git a/libcutils/mspace.c b/libcutils/mspace.c
index 63b199d..6d3b35c 100644
--- a/libcutils/mspace.c
+++ b/libcutils/mspace.c
@@ -271,4 +271,16 @@
   }
   return 0;
 }
+
+void *contiguous_mspace_sbrk0(mspace msp) {
+    struct mspace_contig_state *cs;
+    mstate ms;
+    const unsigned int pagesize = PAGESIZE;
+
+    ms = (mstate)msp;
+    cs = (struct mspace_contig_state *)((uintptr_t)ms & ~(pagesize-1));
+    assert(cs->magic == CONTIG_STATE_MAGIC);
+    assert(cs->m == ms);
+    return cs->brk;
+}
 #endif
diff --git a/rootdir/init.rc b/rootdir/init.rc
index 4a88513..1e3e2d2 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -17,7 +17,7 @@
     export EXTERNAL_STORAGE /mnt/sdcard
     export ASEC_MOUNTPOINT /mnt/asec
     export LOOP_MOUNTPOINT /mnt/obb
-    export BOOTCLASSPATH /system/framework/core.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar
+    export BOOTCLASSPATH /system/framework/core.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/core-junit.jar
 
 # Backward compatibility
     symlink /system/etc /etc