More V setup for ppc64
 - client stack setup
 - init_thread1state: set TOC ptr



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5314 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_main.c b/coregrind/m_main.c
index cb6892e..b6b10eb 100644
--- a/coregrind/m_main.c
+++ b/coregrind/m_main.c
@@ -370,7 +370,7 @@
       auxsize += sizeof(*cauxv);
    }
 
-#  if defined(VGP_ppc32_linux)
+#  if defined(VGP_ppc32_linux) || defined(VGP_ppc64_linux)
    auxsize += 2 * sizeof(*cauxv);
 #  endif
 
@@ -487,7 +487,7 @@
    auxv = (struct ume_auxv *)ptr;
    *client_auxv = (UInt *)auxv;
 
-#  if defined(VGP_ppc32_linux)
+#  if defined(VGP_ppc32_linux) || defined(VGP_ppc64_linux)
    auxv[0].a_type  = AT_IGNOREPPC;
    auxv[0].u.a_val = AT_IGNOREPPC;
    auxv[1].a_type  = AT_IGNOREPPC;
@@ -559,10 +559,18 @@
                                 "PPC32 cache line size %u (type %u)\n", 
                                 (UInt)auxv->u.a_val, (UInt)auxv->a_type );
             }
+#           elif defined(VGP_ppc64_linux)
+            /* acquire cache info */
+            if (auxv->u.a_val > 0) {
+               VG_(machine_ppc64_set_clszB)( auxv->u.a_val );
+               VG_(debugLog)(2, "main", 
+                                "PPC64 cache line size %u (type %u)\n", 
+                                (UInt)auxv->u.a_val, (UInt)auxv->a_type );
+            }
 #           endif
             break;
 
-#        if defined(VGP_ppc32_linux)
+#        if defined(VGP_ppc32_linux) || defined(VGP_ppc64_linux)
          case AT_IGNOREPPC:
             break;
 #        endif
@@ -578,7 +586,7 @@
             break;
 
          case AT_SYSINFO:
-#        if !defined(VGP_ppc32_linux)
+#        if !defined(VGP_ppc32_linux) && !defined(VGP_ppc64_linux)
          case AT_SYSINFO_EHDR:
 #        endif
             /* Trash this, because we don't reproduce it */
@@ -1692,6 +1700,7 @@
 */
 static void init_thread1state ( Addr client_ip, 
                                 Addr client_sp,
+                                Addr entry,
                                 /*inout*/ ThreadArchState* arch )
 {
 #if defined(VGA_x86)
@@ -1754,8 +1763,8 @@
 
    /* Put essential stuff into the new state. */
    arch->vex.guest_GPR1 = client_sp;
+   arch->vex.guest_GPR2 = ((ULong*)entry)[1];  // TOC ptr
    arch->vex.guest_CIA  = client_ip;
-
 #else
 #  error Unknown arch
 #endif
@@ -2477,6 +2486,7 @@
    //--------------------------------------------------------------
    VG_(debugLog)(1, "main", "Initialise thread 1's state\n");
    init_thread1state( initial_client_IP, initial_client_SP, 
+                      info.entry,
                       &VG_(threads)[1].arch);
 
    //--------------------------------------------------------------