[PATCH] wimax-network-service: 64-bit fixes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Correct assorted 64-bit issues.

Signed-off-by: Paul Donohue <wimax at PaulSD.com>

diff --git a/InfraStack/OSAgnostic/Common/L4Common/SourceControl/BitmanCommon.h b/InfraStack/OSAgnostic/Common/L4Common/SourceControl/BitmanCommon.h
index bdb48dc..874df35 100644
--- a/InfraStack/OSAgnostic/Common/L4Common/SourceControl/BitmanCommon.h
+++ b/InfraStack/OSAgnostic/Common/L4Common/SourceControl/BitmanCommon.h
@@ -67,6 +67,10 @@
 #define MASK_1 (0xFFFFFFFFFFFFFFFF)
 #define MASK_2 (0xFFFFFFFFFFFFFFFE)
 #define MASK_4 (0xFFFFFFFFFFFFFFFC)
+#elif __x86_64__
+#define MASK_1 (0xFFFFFFFFFFFFFFFF)
+#define MASK_2 (0xFFFFFFFFFFFFFFFE)
+#define MASK_4 (0xFFFFFFFFFFFFFFFC)
 #else
 #define MASK_1 (0xFFFFFFFF)
 #define MASK_2 (0xFFFFFFFE)
diff --git a/InfraStack/OSAgnostic/Common/L4Common/SourceControl/CommonTypes.h b/InfraStack/OSAgnostic/Common/L4Common/SourceControl/CommonTypes.h
index b410c38..f8aba19 100644
--- a/InfraStack/OSAgnostic/Common/L4Common/SourceControl/CommonTypes.h
+++ b/InfraStack/OSAgnostic/Common/L4Common/SourceControl/CommonTypes.h
@@ -91,6 +91,8 @@ typedef const char*	PCSTR;
 /// when you need to hold both a pointer and a number
 #ifdef WIN64
 typedef UINT64 POINTER_AND_UINT;
+#elif __x86_64__
+typedef UINT64 POINTER_AND_UINT;
 #else
 typedef UINT POINTER_AND_UINT;
 #endif
diff --git a/InfraStack/OSDependent/Linux/InfraStackModules/Skeletons/AppSrv/GenericConsole.c b/InfraStack/OSDependent/Linux/InfraStackModules/Skeletons/AppSrv/GenericConsole.c
index 69cab00..abc22e5 100644
--- a/InfraStack/OSDependent/Linux/InfraStackModules/Skeletons/AppSrv/GenericConsole.c
+++ b/InfraStack/OSDependent/Linux/InfraStackModules/Skeletons/AppSrv/GenericConsole.c
@@ -118,8 +118,13 @@ void print_callstack_to_file(int sig, siginfo_t *info, void *secret)
 	}
 	strcat(gcLogFilePathName, "/callstack.log");
 	if(OSAL_fopen(&fp, gcLogFilePathName, "a", 0) < 0) {
+#ifdef __x86_64__
+		syslog(LOG_ERR, "Got signal %d, faulty address is %p, from %p", 
+		       sig, info->si_addr, uc->uc_mcontext.gregs[REG_RIP]);
+#else
 		syslog(LOG_ERR, "Got signal %d, faulty address is %p, from %p", 
 		       sig, info->si_addr, uc->uc_mcontext.gregs[REG_EIP]);
+#endif
 		syslog(LOG_ERR, "Could not open a file %s to log call stack");
 		// printf("Came here %d\n", __LINE__);
   		return;
@@ -137,13 +142,22 @@ void print_callstack_to_file(int sig, siginfo_t *info, void *secret)
 	fprintf(fp, "Use the function name and offset to function and search file above for the line no \n");
 	fprintf(fp, "==================================================================================\n\n");
 	
+#ifdef __x86_64__
+	fprintf(fp, "Got signal %d, faulty address is %p, from %p\n", 
+		sig, info->si_addr, uc->uc_mcontext.gregs[REG_RIP]);
+#else
 	fprintf(fp, "Got signal %d, faulty address is %p, from %p\n", 
 		sig, info->si_addr, uc->uc_mcontext.gregs[REG_EIP]);
+#endif
 	// printf("Came here %d\n", __LINE__);
   	
   	trace_size = backtrace(trace, 16);
   	/* overwrite sigaction with caller's address */
+#ifdef __x86_64__
+  	trace[1] = (void *) uc->uc_mcontext.gregs[REG_RIP];
+#else
   	trace[1] = (void *) uc->uc_mcontext.gregs[REG_EIP];
+#endif
 	
   	messages = backtrace_symbols(trace, trace_size);
   	/* skip first stack frame (points here) */
diff --git a/InfraStack/OSDependent/Linux/OSAL/Primitives/wimax_osal_basictypes.h b/InfraStack/OSDependent/Linux/OSAL/Primitives/wimax_osal_basictypes.h
index 1085c4b..f13fade 100644
--- a/InfraStack/OSDependent/Linux/OSAL/Primitives/wimax_osal_basictypes.h
+++ b/InfraStack/OSDependent/Linux/OSAL/Primitives/wimax_osal_basictypes.h
@@ -39,6 +39,7 @@
 #include <string.h>
 #include <ctype.h>
 #include <sys/stat.h>
+#include <pthread.h>
 
 #if 0
 #include <sys/socket.h>
@@ -90,7 +91,7 @@ typedef void* OSAL_critical_section;
 
 typedef int pid_t;
 
-typedef int OSAL_thread_t;
+typedef pthread_t OSAL_thread_t;
 
 typedef void * OSAL_event_t;
 


[Index of Archives]     [Linux Kernel]     [Linux Wireless]     [Linux Bluetooth]     [Linux Netdev]     [Linux Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux