[Dpcl-develop] 64-bit changes
Brought to you by:
dpcl-admin,
dwootton
|
From: Steve C. <sl...@sg...> - 2004-03-15 22:43:32
|
It occurred to me that I had sent my 64-bit changes to JamesW
but had not posted them here. Just so DaveW is in the loop, I'll
reiterate them here.
*************
DPCL MODS:
*************
NOTE: diffs are generated from the hybrid_121503 delivered by
by JamesW.
1.
~dpcl/src/config.sub:
343a344,346
> ia64-*)
> basic_machine=ia64-pc
> ;;
2.
~dpcl/src/lib/include/ExpTree.h:
209a210
> # ifndef __int8_t_defined
210a212
> #endif
212a215,217
> # if __WORDSIZE == 64
> typedef long int64_t;
> #else
214c219
<
---
> #endif
218a224,226
> # if __WORDSIZE == 64
> typedef unsigned long uint64_t;
> #else
219a228
> #endif
3.
~dpcl/src/lib/include/ModuleObj.h:
71c71
< static void ModuleObj::expand_cb(GCBSysType, GCBTagType, GCBObjType,
---
> static void expand_cb(GCBSysType, GCBTagType, GCBObjType,
4.
~dpcl/src/daemon_RT/include/os/linux/ShmUsage_RT.h:
40a41,44
> #if __WORDSIZE == 64
> typedef unsigned long uint64_t;
> typedef signed long int64_t;
> #else
42a47
> #endif
5.
~dpcl/src/daemon/src/main.C:
880c880
< if ((rc = getrlimit (which_limit, rlimit_p)) != -1) {
---
> if ((rc = getrlimit ((__rlimit_resource)which_limit, rlimit_p)) != -1) {
888c888
< rc = setrlimit (which_limit, rlimit_p);
---
> rc = setrlimit ((__rlimit_resource)which_limit, rlimit_p);
6.
~dpcl/src/daemon/src/os/linux/PModEntry.C:
332c332
< unsigned int adr = point->getPointAddress();
---
> unsigned int adr = (unsigned int)point->getPointAddress();
7.
~dpcl/src/daemon_RT/src/os/linux/lock.c:
96a97,98
> #else
> #include <stdio.h>
97a100,155
> typedef int * atomic_p;
>
> int
> _check_lock (atomic_p addr, int old_val, int new_val);
>
> int
> _safe_fetch (atomic_p addr);
>
> void
> _clear_lock (atomic_p addr, int val);
>
> /******************************************************************/
>
> #define __atomic_fool_gcc(x) (*(volatile struct { int a[100]; } *)x)
>
> int
> _check_lock
> (atomic_p addr, int old_val, int new_val)
> {
> long interim_val = 777;
> int result = 0; /* default is success */
> __asm__ __volatile__ ( "mf");
> __asm__ __volatile__ (
> "mov ar.ccv = %[old]"
> :
> : [old] "r"(old_val));
> __asm__ __volatile__ (
> "cmpxchg4.rel %[interim] =%[mem],%[new],ar.ccv"
> : [interim] "=r" (interim_val)
> : [mem] "m" (__atomic_fool_gcc(addr)), [new] "r" (new_val));
> __asm__ __volatile__ ( "mf");
> if( interim_val == old_val) {
> /* lock memory value was old_val */
> /* exchange to new_val done - new lock in place */
> result = 0; /* false */
> }
> else {
> /* lock memory value was NOT old_val */
> result = 1; /* true */
> }
> return result;
> }
>
> int _safe_fetch
> (atomic_p addr)
> {
> /* 64-bit */
> return *addr;
> }
>
> void _clear_lock
> (atomic_p addr, int val)
> {
> /* 64-bit */
> *addr = val;
> }
8.
~dpcl/src/SD/src/SdServCli.C:
289c289
< if ( (clifd = accept( listenfd, (struct sockaddr *) &unix_addr, (size_t*)&len )) > ZERO )
---
> if ( (clifd = accept( listenfd, (struct sockaddr *) &unix_addr, (socklen_t *)&len )) > ZERO )
9.
~dpcl/src/lib/src/Process.C:
3425c3425
< unsigned data_key;
---
> unsigned long data_key;
3439,3440c3439,3440
< memcpy( (void*)poffset, &data_key, sizeof (int));
< poffset += sizeof (int);
---
> memcpy( (void*)poffset, &data_key, sizeof (unsigned long));
> poffset += sizeof (unsigned long);
10.
~dpcl/src/daemon/src/PEtoBP.C:
925,926c925,926
< v=new BPatch_constExpr((int) msghdl);
< log_write(LGL_severe, "Doit: msghdl=0x%08x, BP_DEBUG %s",msghdl,
---
> v=new BPatch_constExpr((long) msghdl);
> log_write(LGL_severe, "Doit: msghdl=0x%Lx, BP_DEBUG %s",msghdl,
11.
~dpcl/src/lib/src/os/linux/ProbeModuleInt.C:
82a83,86
> #if __WORDSIZE == 64
> Elf64_Ehdr *ehdr;
> Elf64_Shdr *sectionHdr;
> #else
84a89
> #endif
89a95,97
> #if __WORDSIZE == 64
> Elf64_Sym *symbolData;
> #else
90a99
> #endif
104a114,116
> #if __WORDSIZE == 64
> ehdr = elf64_getehdr(elfHandle);
> #else
105a118
> #endif
115a129,131
> #if __WORDSIZE == 64
> sectionHdr = elf64_getshdr(sectionRef);
> #else
116a133
> #endif
125a143,145
> #if __WORDSIZE == 64
> symbolData = new Elf64_Sym[elfData->d_size / sizeof(Elf32_Sym)];
> #else
126a147
> #endif
131a153,155
> #if __WORDSIZE == 64
> symSize = elfData->d_size / sizeof(Elf64_Sym);
> #else
132a157
> #endif
152a178,181
> #if __WORDSIZE == 64
> if ((ELF64_ST_BIND(symbolData[i].st_info) == STB_GLOBAL) &&
> (ELF64_ST_TYPE(symbolData[i].st_info) == STT_FUNC) &&
> #else
154a184
> #endif
164a195,198
> #if __WORDSIZE == 64
> if ((ELF64_ST_BIND(symbolData[i].st_info) == STB_GLOBAL) &&
> (ELF64_ST_TYPE(symbolData[i].st_info) == STT_FUNC) &&
> #else
166a201
> #endif
***************************************************************************************
***************************************************************************************
Analysis for DPCL changes:
-----------------------------
1. Must change 'config.sub' to allow for configuration
`ia64-pc-linux-gnuoldld': machine `ia64-pc.
2. The file /usr/include/inttypes.h includes <stdint.h>, which has:
# if __WORDSIZE == 64
typedef long int int64_t;
# else
__extension__ typedef long long int int64_t;
Without this change, the following compile-time error occurs:
../include/ExpTree.h:214: conflicting types for `typedef long long int
int64_t'
/usr/include/sys/types.h:193: previous declaration as `typedef long int
int64_t'
3. Using the 3.3.2 g++, the following error occurs without this change :
In file included from BlockObj.C:40:
../include/ModuleObj.h:72: error: extra qualification `ModuleObj::' on member `
expand_cb' ignored
BlockObj.C: In constructor `BlockObj::BlockObj()':
BlockObj.C:55: warning: passing NULL used for non-pointer argument 5 of `
SourceObjABC::SourceObjABC(SourceObjABC*, SourceType, int, int, long long
unsigned int, long long unsigned int)'
BlockObj.C:55: warning: passing NULL used for non-pointer argument 6 of `
SourceObjABC::SourceObjABC(SourceObjABC*, SourceType, int, int, long long
unsigned int, long long unsigned int
4. The file /usr/include/inttypes.h includes <stdint.h>, which has:
# if __WORDSIZE == 64
typedef long int int64_t;
# else
__extension__ typedef long long int int64_t;
Without defining __WORDSIZE=64 in rules.mk.linus, the following
compile-time error occurs:
In file included from ../include/os/linux/ShmMessage.h:40,
from ../src/os/linux/ShmAttach.C:95:
../include/os/linux/ShmUsage_RT.h:41: error: conflicting types for `typedef
long long unsigned int uint64_t'
/usr/include/stdint.h:56: error: previous declaration as `typedef long unsigned
int uint64_t'
../include/os/linux/ShmUsage_RT.h:42: error: conflicting types for `typedef
long long int int64_t'
/usr/include/sys/types.h:193: error: previous declaration as `typedef long int
int64_t'
5. Without this change, the following compile-time error occurs:
from ../include/ProcessD.h:65,
from main.C:114:
../include/SourceObjDABC.h: In member function `virtual AisAddress
SourceObjDABC::start_address() const':
../include/SourceObjDABC.h:242: warning: return to non-pointer type `AisAddress
' from NULL
../include/SourceObjDABC.h:242: warning: argument to non-pointer type `long
long unsigned int' from NULL
../include/SourceObjDABC.h: In member function `virtual AisAddress
SourceObjDABC::end_address() const':
../include/SourceObjDABC.h:252: warning: return to non-pointer type `AisAddress
' from NULL
../include/SourceObjDABC.h:252: warning: argument to non-pointer type `long
long unsigned int' from NULL
main.C: In function `int set_max_limit(int)':
main.C:878: error: invalid conversion from `int' to `__rlimit_resource'
main.C:886: error: invalid conversion from `int' to `__rlimit_resource'
6. Without this change, the following compile-time error occurs:
os/linux/PModEntry.C: In method `PModEntry::~PModEntry ()':
os/linux/PModEntry.C:114: warning: NULL used in arithmetic
os/linux/PModEntry.C: In function `BPatch_function *findHaifaFunction
(BPatch_image *, char *, unsigned int, unsigned int, unsigned int,
unsigned int)':
os/linux/PModEntry.C:332: cannot convert `void *' to `unsigned int' in
initialization
7. The routines '_safe_fetch', '_check_lock', and 'clear_lock' need ia64
versions. The ia64 version of 'check_lock' requires gcc 3.3.2 because it
employs named operands.
8. Without this change, the following compile-time error occurs:
SdServCli.C: In function `int serv_accept (int, int *)':
SdServCli.C:289: cannot convert `size_t *' to `socklen_t *' for
argument `3' to `accept (int, sockaddr *, socklen_t *)'
9. From the daemon log, I got the following with a simple mutator testcase:
ProgramObjD::get_inst_point() unique_str libc.so.6.1 module str .so.6.1
ProgramObjD::get_inst_point(): ERROR, the specified module's unique string
did not match. cannot find a specified BPatch_point
The missing 4 characters (i.e. 'libc.so.6.1' .vs. '.so.6.1' occurs for this
reason: GCBObjType is typedef'd to (void *) which is 8 bytes on ia64!!! THe
daemon routine 'install_probe_cb' uses the sizeof(GCBObjType) to walk up on
the 'unique string' pointer. This means 20 bytes!! Unfortunately the message
is packed in the DPCL library routine 'Process::install_probe' using 'unsigned'
and NOT 'unsigned long' for the type of 'data key'. This yields 16 bits!!
Thus we are 4 bytes off, i.e. 'xxxx.so.6' vs 'libc.so.6'.
10. In ~daemon_RT/src/os/linux/ShmMessageAPI_app.C: Ais_send the 'message_handle_id'
coming in is 32 bits and is supposed to be a char *. Its use will cause SEGV.
11. Changes required for processing 64-bit ELF executables.
|