]> www.vanbest.org Git - sasc-ng.git/commitdiff
FFdecsa: some tweaks for ARM compile
authorleslie <unknown>
Sat, 23 Jul 2011 15:04:48 +0000 (17:04 +0200)
committerleslie <unknown>
Sat, 23 Jul 2011 15:04:48 +0000 (17:04 +0200)
FFdecsa/FFdecsa.c
FFdecsa/parallel_064_mmx.h
FFdecsa/parallel_128_2mmx.h
FFdecsa/parallel_128_sse.h
FFdecsa/parallel_128_sse2.h

index f272b053dc1dc28ddda8624be925d6e476b7c02e..5aa01a36506db22d3a50412cfc943a76ff35e4ef 100644 (file)
 #define BITS_PER_GROUP GROUP_PARALLELISM
 #define BIPG BITS_PER_GROUP
 
+// platform specific
+
+#ifdef __arm__
+#if !defined(MEMALIGN_VAL) || MEMALIGN_VAL<4
+#undef MEMALIGN_VAL
+#define MEMALIGN_VAL 4
+#endif
+#define COPY_UNALIGNED_PKT
+#endif
+
+//
+
 #ifndef MALLOC
 #define MALLOC(X) malloc(X)
 #endif
 #ifndef FREE
 #define FREE(X) free(X)
 #endif
-#ifndef MEMALIGN
+#ifdef MEMALIGN_VAL
+#define MEMALIGN __attribute__((aligned(MEMALIGN_VAL)))
+#else
 #define MEMALIGN
 #endif
 
@@ -574,6 +588,10 @@ int decrypt_packets(void *keys, unsigned char **cluster){
   MEMALIGN unsigned char stream_out[GROUP_PARALLELISM*8];
   MEMALIGN unsigned char ib[GROUP_PARALLELISM*8];
   MEMALIGN unsigned char block_out[GROUP_PARALLELISM*8];
+#ifdef COPY_UNALIGNED_PKT
+  unsigned char *unaligned[GROUP_PARALLELISM];
+  MEMALIGN unsigned char alignedBuff[GROUP_PARALLELISM][188];
+#endif
   struct stream_regs regs;
 
 //icc craziness  i=(int)&pad1;//////////align!!! FIXME
@@ -799,6 +817,14 @@ DBG(fprintf(stderr,"--- WARNING: DEBUGGING IS MORE DIFFICULT WHEN PROCESSING RAN
     encp[g]=g_pkt[g];
     DBG(fprintf(stderr,"header[%i]=%p (%02x)\n",g,encp[g],*(encp[g])));
     encp[g]+=g_offset[g]; // skip header
+#ifdef COPY_UNALIGNED_PKT
+    if(((int)encp[g])&0x03) {
+      memcpy(alignedBuff[g],encp[g],g_len[g]);
+      unaligned[g]=encp[g];
+      encp[g]=alignedBuff[g];
+      }
+    else unaligned[g]=0;
+#endif
     FFTABLEIN(stream_in,g,encp[g]);
   }
 //dump_mem("stream_in",stream_in,GROUP_PARALLELISM*8,BYPG);
@@ -874,6 +900,11 @@ DBG(dump_mem("23jd_after_ib_decrypt_data ",encp[g],8,8));
 
   DBG(fprintf(stderr,"returning advanced=%i\n",advanced));
 
+#ifdef COPY_UNALIGNED_PKT
+  for(g=0;g<grouped;g++)
+    if(unaligned[g]) memcpy(unaligned[g],alignedBuff[g],g_len[g]);
+#endif
+
   M_EMPTY(); // restore CPU multimedia state
 
   return advanced;
index 3979233065139d9364318f94dcc731ab85840401..0aef8f97f95118387c88e09f38d4f1c0a9e750a8 100644 (file)
@@ -20,7 +20,7 @@
 
 #include <mmintrin.h>
 
-#define MEMALIGN __attribute__((aligned(16)))
+#define MEMALIGN_VAL 16
 
 union __u64 {
     unsigned int u[2];
index 4afb7a7969f67abd209c096bcf57301de409f903..4e6d1bf5308bef7cc030a3ebda1d40b0f239a2c7 100644 (file)
@@ -20,7 +20,7 @@
 
 #include <mmintrin.h>
 
-#define MEMALIGN __attribute__((aligned(16)))
+#define MEMALIGN_VAL 16
 
 struct group_t{
   __m64 s1,s2;
index a26e6b3de10054b0ac87d632832d64f5092f44b0..054490235ccecc397b225e9ddcdbd9ca1c585d82 100644 (file)
@@ -21,7 +21,7 @@
 
 #include <xmmintrin.h>
 
-#define MEMALIGN __attribute__((aligned(16)))
+#define MEMALIGN_VAL 16
 
 union __u128 {
     unsigned int u[4];
index 5a537a9debc546833c86896f07be1d16c0990740..a834a808af8395fbe5dadacfc9896f17d2d3481f 100644 (file)
@@ -20,7 +20,7 @@
 
 #include <emmintrin.h>
 
-#define MEMALIGN __attribute__((aligned(16)))
+#define MEMALIGN_VAL 16
 
 union __u128i {
        unsigned int u[4];