mirror of
https://git.openafs.org/openafs.git
synced 2025-01-21 08:20:16 +00:00
aix51-64bit-exporter-20020107
loads, but doesn't yet work
This commit is contained in:
parent
436674ee07
commit
e0a78652da
@ -8,16 +8,17 @@
|
||||
srcdir=@srcdir@
|
||||
include @TOP_OBJDIR@/src/config/Makefile.config
|
||||
|
||||
OPTMZ = -g
|
||||
DEFS =
|
||||
INCS = -I${TOP_OBJDIR}/src/config -I${TOP_INCDIR}
|
||||
CFLAGS = ${OPTMZ} ${DEFS} ${INCS}
|
||||
EXPORTS = -bexport:export.exp
|
||||
EXPORTS5 = -bexport:export5.exp
|
||||
IMPORTS = /lib/kernex.exp /lib/syscalls.exp extras.exp
|
||||
KOBJ = export.o symtab.o
|
||||
|
||||
include ../config/Makefile.version
|
||||
|
||||
all: ${TOP_LIBDIR}/export.exp ${TOP_LIBDIR}/export64.exp ${TOP_LIBDIR}/extras.exp cfgexport cfgafs
|
||||
all: ${TOP_LIBDIR}/export.exp ${TOP_LIBDIR}/extras.exp cfgexport cfgafs
|
||||
${INSTALL} ${srcdir}/export.h ${KERNELDIR}
|
||||
${INSTALL} ${srcdir}/export.exp ${KERNELDIR}
|
||||
@ -28,49 +29,113 @@ noversion system: install
|
||||
|
||||
install: ${DESTDIR}${libdir}/afs/export.exp ${DESTDIR}${libdir}/afs/extras.exp
|
||||
|
||||
export.ext: ${KOBJ}
|
||||
export.ext: export4.exp export5.exp
|
||||
case ${SYS_NAME} in \
|
||||
rs_aix4* ) \
|
||||
${LD} -o export.ext -eexport ${IMPORTS} ${KOBJ} ${EXPORTS} -lcsys ;; \
|
||||
cp -p export4.exp export.exp ; \
|
||||
cp -p export4-64.exp export64.exp ;; \
|
||||
rs_aix5* ) \
|
||||
${LD} -o export.ext -eexport ${IMPORTS} ${KOBJ} ${EXPORTS5} -lcsys ;; \
|
||||
cp -p export5.exp export.exp ; \
|
||||
cp -p export5-64.exp export64.exp ;; \
|
||||
esac
|
||||
|
||||
export.ext: ${KOBJ}
|
||||
${LD} -o export.ext -eexport ${IMPORTS} ${KOBJ} ${EXPORTS} -lcsys
|
||||
|
||||
export64.ext: export64.o symtab64.o
|
||||
${LD} -b64 -o export64.ext -eexport ${IMPORTS} export64.o symtab64.o \
|
||||
-bexport:export64.exp -lcsys
|
||||
|
||||
export.ext.nonfs: export.nonfs.o symtab.o
|
||||
${LD} -o export.ext.nonfs -eexport ${IMPORTS} export.nonfs.o \
|
||||
symtab.o ${EXPORTS} -lcsys
|
||||
|
||||
export.nonfs.o:
|
||||
${CC} ${INCS} -DAFS_NONFSTRANS -c export.c
|
||||
export64.ext.nonfs: export64.nonfs.o symtab64.o
|
||||
${LD} -b64 -o export64.ext.nonfs -eexport ${IMPORTS} export64.nonfs.o \
|
||||
symtab64.o -bexport:export64.exp -lcsys
|
||||
|
||||
symtab.o symtab64.o: symtab.c
|
||||
case ${SYS_NAME} in \
|
||||
rs_aix4* ) \
|
||||
${CC} ${CFLAGS} -c symtab.c ;; \
|
||||
rs_aix5* ) \
|
||||
${CC} ${CFLAGS} -q64 -D__XCOFF64__ -DAFS_64BIT_KERNEL -DAFS_AIX51_ENV -c symtab.c ; \
|
||||
mv symtab.o symtab64.o ; \
|
||||
${CC} ${CFLAGS} -DAFS_AIX51_ENV -c symtab.c ;; \
|
||||
esac
|
||||
|
||||
export.o export64.o: export.c
|
||||
case ${SYS_NAME} in \
|
||||
rs_aix4* ) \
|
||||
${CC} ${CFLAGS} -c export.c ;; \
|
||||
rs_aix5* ) \
|
||||
${CC} ${CFLAGS} -q64 -D__XCOFF64__ -DAFS_64BIT_KERNEL -DAFS_AIX51_ENV -c export.c ; \
|
||||
mv export.o export64.o ; \
|
||||
${CC} ${CFLAGS} -DAFS_AIX51_ENV -c export.c ;; \
|
||||
esac
|
||||
|
||||
export.nonfs.o export64.nonfs.o: export.c
|
||||
case ${SYS_NAME} in \
|
||||
rs_aix4* ) \
|
||||
${CC} ${INCS} -DAFS_NONFSTRANS -c export.c ;; \
|
||||
rs_aix5* ) \
|
||||
${CC} -q64 ${INCS} -D__XCOFF64__ -DAFS_64BIT_KERNEL -DAFS_NONFSTRANS -DAFS_AIX51_ENV -c export.c ; \
|
||||
mv export.o export64.nonfs.o ; \
|
||||
${CC} ${INCS} -DAFS_NONFSTRANS -DAFS_AIX51_ENV -c export.c ;; \
|
||||
esac
|
||||
-mv export.o export.nonfs.o
|
||||
|
||||
cfgexport: cfgexport.o
|
||||
${CC} ${INCS} -O -o cfgexport cfgexport.o
|
||||
${CC} -g ${INCS} -o cfgexport cfgexport.o
|
||||
|
||||
cfgexport64: cfgexport64.o
|
||||
${CC} -g ${INCS} -q64 -o cfgexport64 cfgexport64.o
|
||||
|
||||
cfgafs: cfgafs.o
|
||||
${CC} ${INCS} -O -o cfgafs cfgafs.o
|
||||
${CC} ${INCS} -o cfgafs cfgafs.o
|
||||
|
||||
cfgafs64: cfgafs64.o
|
||||
${CC} -g ${INCS} -q64 -o cfgafs64 cfgafs64.o
|
||||
|
||||
cfgexport64.o: cfgexport.c AFS_component_version_number.c
|
||||
${CC} -g -q64 ${CFLAGS} -D__XCOFF64__ -c cfgexport.c -o cfgexport64.o
|
||||
|
||||
cfgexport.o: cfgexport.c AFS_component_version_number.c
|
||||
cfgafs.o: cfgafs.c AFS_component_version_number.c
|
||||
cfgafs64.o: cfgafs.c AFS_component_version_number.c
|
||||
${CC} -q64 ${CFLAGS} -c cfgafs.c -o cfgafs64.o
|
||||
|
||||
clean:
|
||||
$(RM) -f *.o *.Zlst *.map *.out cfgexport cfgafs *.ext AFS_component_version_number.c
|
||||
${DEST}/root.client/usr/vice/etc/dkload/export.ext: export.ext
|
||||
${INSTALL} $? $@
|
||||
|
||||
${DEST}/root.client/usr/vice/etc/dkload/export64.ext: export64.ext
|
||||
${INSTALL} $? $@
|
||||
|
||||
${DEST}/root.client/usr/vice/etc/dkload/export.ext.nonfs: export.ext.nonfs
|
||||
${INSTALL} $? $@
|
||||
|
||||
${DEST}/root.client/usr/vice/etc/dkload/export64.ext.nonfs: export64.ext.nonfs
|
||||
${INSTALL} $? $@
|
||||
|
||||
${DEST}/lib/afs/export.exp: export.exp
|
||||
${INSTALL} $? $@
|
||||
|
||||
${DESTDIR}${libdir}/afs/export.exp: export.exp
|
||||
${DEST}/lib/afs/export64.exp: export64.exp
|
||||
${INSTALL} $? $@
|
||||
|
||||
${DESTDIR}${libdir}/afs/export.exp: export.exp
|
||||
${INSTALL} $? $@
|
||||
|
||||
${DESTDIR}${libdir}/afs/export64.exp: export64.exp
|
||||
${INSTALL} $? $@
|
||||
|
||||
${TOP_LIBDIR}/export.exp: export.exp
|
||||
${INSTALL} $? $@
|
||||
|
||||
${TOP_LIBDIR}/export64.exp: export64.exp
|
||||
${INSTALL} $? $@
|
||||
|
||||
${DEST}/lib/afs/extras.exp: extras.exp
|
||||
${INSTALL} $? $@
|
||||
@ -86,7 +151,23 @@ ${TOP_LIBDIR}/extras.exp: extras.exp
|
||||
${DEST}/root.client/usr/vice/etc/dkload/cfgexport: cfgexport
|
||||
${INSTALL} $? $@
|
||||
|
||||
${DEST}/root.client/usr/vice/etc/dkload/cfgexport64: cfgexport64
|
||||
${INSTALL} $? $@
|
||||
|
||||
${DEST}/root.client/usr/vice/etc/dkload/cfgafs: cfgafs
|
||||
${INSTALL} $? $@
|
||||
|
||||
dest: ${DEST}/root.client/usr/vice/etc/dkload/export.ext ${DEST}/root.client/usr/vice/etc/dkload/export.ext.nonfs ${DEST}/lib/afs/export.exp ${DEST}/lib/afs/extras.exp ${DEST}/root.client/usr/vice/etc/dkload/cfgexport ${DEST}/root.client/usr/vice/etc/dkload/cfgafs
|
||||
${DEST}/root.client/usr/vice/etc/dkload/cfgafs64: cfgafs64
|
||||
${INSTALL} $? $@
|
||||
|
||||
dest: ${DEST}/root.client/usr/vice/etc/dkload/export.ext \
|
||||
${DEST}/root.client/usr/vice/etc/dkload/export64.ext \
|
||||
${DEST}/root.client/usr/vice/etc/dkload/export.ext.nonfs \
|
||||
${DEST}/root.client/usr/vice/etc/dkload/export64.ext.nonfs \
|
||||
${DEST}/lib/afs/export.exp \
|
||||
${DEST}/lib/afs/export64.exp \
|
||||
${DEST}/lib/afs/extras.exp \
|
||||
${DEST}/root.client/usr/vice/etc/dkload/cfgexport \
|
||||
${DEST}/root.client/usr/vice/etc/dkload/cfgexport64 \
|
||||
${DEST}/root.client/usr/vice/etc/dkload/cfgafs \
|
||||
${DEST}/root.client/usr/vice/etc/dkload/cfgafs64
|
||||
|
@ -34,6 +34,7 @@ extern int sysconfig(int cmd, void *arg, int len);
|
||||
|
||||
int debug = 0 ;
|
||||
char *syms = "/unix";
|
||||
char *xstrings;
|
||||
|
||||
#include "AFS_component_version_number.c"
|
||||
|
||||
@ -185,14 +186,13 @@ get_syms(conf, syms)
|
||||
struct k_conf *conf;
|
||||
char *syms;
|
||||
{
|
||||
register sym_t *k_symtab, *ksp;
|
||||
register struct syment *x_symtab, *xsp, *xsq;
|
||||
register char *xstrings;
|
||||
sym_t *k_symtab, *ksp;
|
||||
struct syment *x_symtab, *xsp, *xsq;
|
||||
char *kstrings;
|
||||
struct xcoffhdr hdr; /* XCOFF header from symbol file*/
|
||||
sym_t k_sym; /* export version of symbol */
|
||||
struct syment xcoff_sym; /* xcoff version of symbol */
|
||||
register i, nsyms, nksyms, nxsyms;
|
||||
int i, nsyms, nksyms, nxsyms = 0;
|
||||
int xstr_size, kstr_size;
|
||||
FILE *fp;
|
||||
int xsym_compar();
|
||||
@ -214,6 +214,7 @@ char *syms;
|
||||
case U800WRMAGIC:
|
||||
case U800ROMAGIC:
|
||||
case U800TOCMAGIC:
|
||||
case U64_TOCMAGIC:
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -267,6 +268,9 @@ char *syms;
|
||||
if (fread(&xcoff_sym, SYMESZ, 1, fp) != 1)
|
||||
error("%s: reading symbol entry", syms);
|
||||
|
||||
#ifdef __XCOFF64__
|
||||
p = xstrings + xcoff_sym.n_offset;
|
||||
#else
|
||||
if (xcoff_sym.n_zeroes == 0) {
|
||||
/*
|
||||
* Need to relocate string table offset
|
||||
@ -277,6 +281,7 @@ char *syms;
|
||||
|
||||
p = name, p[8] = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (debug > 2)
|
||||
dump_xsym(&xcoff_sym);
|
||||
@ -331,9 +336,14 @@ char *syms;
|
||||
memset(xsq = &xcoff_sym, 0, sizeof (*xsq));
|
||||
|
||||
for (i = 1; i < nxsyms; ++i, xsq = xsp++) {
|
||||
#ifdef __XCOFF64__
|
||||
if (xsp->n_offset != xsq->n_offset
|
||||
|| xsp->n_value != xsq->n_value) {
|
||||
#else
|
||||
if (xsp->n_zeroes != xsq->n_zeroes
|
||||
|| xsp->n_offset != xsq->n_offset
|
||||
|| xsp->n_value != xsq->n_value) {
|
||||
#endif
|
||||
xlate_xtok(xsp, ksp++, &kstrings, &kstr_size);
|
||||
++nksyms;
|
||||
}
|
||||
@ -384,6 +394,39 @@ uint *szp; {
|
||||
*(uint *) export_strings = 0; /* initial 4 bytes */
|
||||
}
|
||||
|
||||
#ifdef __XCOFF64__
|
||||
if (strcmp(prev, xstrings + xp->n_offset) == 0) {
|
||||
/*
|
||||
* same name as previous entry: just use previous
|
||||
*/
|
||||
kp->n_offset = offset - strlen( *strp + xp->n_offset) - 1;
|
||||
} else if (find_suffix(xstrings + xp->n_offset, *strp, offset, &kp->n_offset)) {
|
||||
/*
|
||||
* found a string that we are a suffix of
|
||||
*/
|
||||
;
|
||||
} else {
|
||||
/*
|
||||
* need to add to our string table
|
||||
*/
|
||||
len = strlen(xstrings + xp->n_offset) + 1;
|
||||
while (len >= left) {
|
||||
export_strings = (char *)realloc(*strp, sz += 1024);
|
||||
if (!export_strings)
|
||||
error("no memory for EXPORT string table");
|
||||
*strp = export_strings;
|
||||
left += 1024;
|
||||
prev = ""; /* lazy */
|
||||
}
|
||||
|
||||
strcpy(prev = *strp + offset, xstrings + xp->n_offset);
|
||||
|
||||
kp->n_offset = offset;
|
||||
offset += len;
|
||||
left -= len;
|
||||
*szp += len;
|
||||
}
|
||||
#else
|
||||
if (kp->n_zeroes = xp->n_zeroes) { /* sic */
|
||||
kp->n_zeroes = xp->n_zeroes;
|
||||
kp->n_offset = xp->n_offset;
|
||||
@ -418,6 +461,7 @@ uint *szp; {
|
||||
left -= len;
|
||||
*szp += len;
|
||||
}
|
||||
#endif
|
||||
|
||||
kp->n_value = xp->n_value;
|
||||
|
||||
@ -487,12 +531,17 @@ register struct syment *xp, *xq; {
|
||||
register char *p, *q;
|
||||
register compar;
|
||||
|
||||
#ifndef __XCOFF64__
|
||||
p = (xp->n_zeroes ? xp->n_name : xp->n_nptr);
|
||||
q = (xq->n_zeroes ? xq->n_name : xq->n_nptr);
|
||||
|
||||
if (xp->n_zeroes || xq->n_zeroes)
|
||||
compar = strncmp(p, q, 8);
|
||||
else
|
||||
#else
|
||||
p = xstrings + xp->n_offset;
|
||||
q = xstrings + xq->n_offset;
|
||||
#endif
|
||||
compar = strcmp(p, q);
|
||||
|
||||
if (compar == 0)
|
||||
@ -507,6 +556,7 @@ register struct syment *xp, *xq; {
|
||||
dump_xsym(xsp)
|
||||
struct syment *xsp; {
|
||||
|
||||
#ifndef __XCOFF64__
|
||||
if (xsp->n_zeroes)
|
||||
printf(
|
||||
"nptr <%-8.8s %8.8s> val %8.8x sc# %4.4x type %4.4x sclass %2.2x naux %2.2x\n"
|
||||
@ -519,9 +569,14 @@ struct syment *xsp; {
|
||||
, xsp->n_sclass
|
||||
, xsp->n_numaux);
|
||||
else
|
||||
#endif
|
||||
printf(
|
||||
"nptr <%-17.17s> val %8.8x sc# %4.4x type %4.4x sclass %2.2x naux %2.2x\n"
|
||||
#ifdef __XCOFF64__
|
||||
, xstrings + xsp->n_offset
|
||||
#else
|
||||
, xsp->n_nptr
|
||||
#endif
|
||||
, xsp->n_value
|
||||
, xsp->n_scnum & 0xffff
|
||||
, xsp->n_type
|
||||
@ -533,9 +588,11 @@ dump_ksym(ksp, strings)
|
||||
sym_t *ksp;
|
||||
char *strings; {
|
||||
|
||||
#ifndef __XCOFF64__
|
||||
if (ksp->n_zeroes)
|
||||
printf("%8.8x %-8.8s\n", ksp->n_value, ksp->n_name);
|
||||
else
|
||||
#endif
|
||||
printf("%8.8x %s\n", ksp->n_value, ksp->n_offset + strings);
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,9 @@ register struct uio *uiop; {
|
||||
* into the string table.
|
||||
*/
|
||||
for (sym = toc_syms; sym < &toc_syms[toc_nsyms]; ++sym)
|
||||
#ifndef __XCOFF64__
|
||||
if (sym->n_zeroes == 0)
|
||||
#endif
|
||||
sym->n_nptr = sym->n_offset + toc_strs;
|
||||
|
||||
return 0;
|
||||
@ -152,19 +154,26 @@ export_cleanup() {
|
||||
* exported from some other kernel extension (but referenced in
|
||||
* the /unix symbol table) we are in trouble.
|
||||
*/
|
||||
#ifdef __XCOFF64__
|
||||
u_int64 *myg_toc;
|
||||
#else
|
||||
u_int32 *myg_toc;
|
||||
#endif
|
||||
|
||||
import_kfunc(struct k_func *kfp) {
|
||||
register sym_t *sym;
|
||||
register caddr_t *toc;
|
||||
register i, pri;
|
||||
static u_int *g_toc;
|
||||
#if 0
|
||||
static caddr_t *g_toc;
|
||||
#endif
|
||||
|
||||
if (!g_toc) {
|
||||
if (!myg_toc) {
|
||||
sym = sym_lookup("g_toc", 0);
|
||||
if (!sym) {
|
||||
printf("\nimport: can't ascertain kernel's TOC\n");
|
||||
return EINVAL;
|
||||
}
|
||||
g_toc = (u_int *) sym->n_value;
|
||||
myg_toc = sym->n_value;
|
||||
}
|
||||
|
||||
sym = sym_lookup(kfp->name, 0);
|
||||
@ -174,10 +183,14 @@ import_kfunc(struct k_func *kfp) {
|
||||
}
|
||||
|
||||
kfp->fdesc[0] = sym->n_value;
|
||||
kfp->fdesc[1] = *g_toc;
|
||||
kfp->fdesc[1] = myg_toc;
|
||||
kfp->fdesc[2] = 0;
|
||||
|
||||
#ifdef __XCOFF64__
|
||||
*(u_int64**) kfp->fpp = kfp->fdesc;
|
||||
#else
|
||||
*(u_int **) kfp->fpp = kfp->fdesc;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -244,7 +257,11 @@ osetgroups(ngroups, gidset)
|
||||
#endif
|
||||
|
||||
#ifdef AFS_AIX51_ENV
|
||||
#ifdef AFS_64BIT_KERNEL
|
||||
okioctl(fdes, cmd, arg, ext, arg2, arg3)
|
||||
#else /* AFS_64BIT_KERNEL */
|
||||
okioctl32(fdes, cmd, arg, ext, arg2, arg3)
|
||||
#endif /* AFS_64BIT_KERNEL */
|
||||
int fdes, cmd;
|
||||
caddr_t ext, arg, arg2, arg3;
|
||||
#else
|
||||
@ -256,7 +273,11 @@ okioctl(fdes, cmd, arg, ext)
|
||||
int error;
|
||||
|
||||
#ifdef AFS_AIX51_ENV
|
||||
#ifdef AFS_64BIT_KERNEL
|
||||
error = kioctl(fdes, cmd, arg, ext, arg2, arg3);
|
||||
#else /* AFS_64BIT_KERNEL */
|
||||
error = kioctl32(fdes, cmd, arg, ext, arg2, arg3);
|
||||
#endif /* AFS_64BIT_KERNEL */
|
||||
#else
|
||||
error = kioctl(fdes, cmd, arg, ext);
|
||||
#endif
|
||||
|
@ -28,7 +28,11 @@ struct k_conf {
|
||||
struct k_func {
|
||||
void *(**fpp)(); /* ^ to ^ to function we import */
|
||||
char *name; /* ^ to symbol name */
|
||||
#if defined(__XCOFF64__) || defined(AFS_64BIT_KERNEL)
|
||||
u_int64 fdesc[3]; /* function descriptor storage */
|
||||
#else
|
||||
u_int fdesc[3]; /* function descriptor storage */
|
||||
#endif
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -12,6 +12,15 @@
|
||||
*/
|
||||
|
||||
struct toc_syment {
|
||||
#ifdef __XCOFF64__
|
||||
unsigned long long n_value;
|
||||
union {
|
||||
struct {
|
||||
int _n_offset; /* offset into string table */
|
||||
} _n_n;
|
||||
char * _n_nptr; /* Allows for overlaying */
|
||||
} _n;
|
||||
#else /* __XCOFF64__ */
|
||||
union {
|
||||
char _n_name[8]; /* old COFF version */
|
||||
struct {
|
||||
@ -21,10 +30,15 @@ struct toc_syment {
|
||||
char *_n_nptr[2]; /* allows for overlaying */
|
||||
} _n;
|
||||
int n_value; /* value of symbol */
|
||||
#endif /* __XCOFF64__ */
|
||||
};
|
||||
#ifdef __XCOFF64__
|
||||
#define n_nptr _n._n_nptr
|
||||
#else
|
||||
#define n_name _n._n_name
|
||||
#define n_nptr _n._n_nptr[1]
|
||||
#define n_zeroes _n._n_n._n_zeroes
|
||||
#endif
|
||||
#define n_offset _n._n_n._n_offset
|
||||
|
||||
typedef struct toc_syment sym_t;
|
||||
|
@ -22,9 +22,13 @@ RCSID("$Header$");
|
||||
* using the toc_syment structure, that we fabricate:
|
||||
* sym->n_offset is the string pointer
|
||||
*/
|
||||
#ifdef __XCOFF64__
|
||||
#define sym_str(sym) ((char *) (sym)->n_nptr)
|
||||
#else
|
||||
#define sym_off(sym) ((sym)->n_offset)
|
||||
#define sym_str(sym) \
|
||||
((sym)->n_zeroes == 0 ? (char *) sym_off(sym) : (sym)->n_name)
|
||||
#endif
|
||||
|
||||
sym_t *
|
||||
sym_lookup(name, value)
|
||||
@ -128,11 +132,13 @@ register sym_t *sym; {
|
||||
|
||||
strncpy(name, sym_str(sym), sizeof (name) - 1);
|
||||
|
||||
#ifndef __XCOFF64__
|
||||
if (sym->n_zeroes != 0)
|
||||
name[8] = 0; /* make sure that we truncate correctly */
|
||||
symbol.n_zeroes = 0;
|
||||
#endif
|
||||
|
||||
symbol = *sym;
|
||||
symbol.n_zeroes = 0;
|
||||
symbol.n_nptr = name;
|
||||
|
||||
return &symbol;
|
||||
|
Loading…
Reference in New Issue
Block a user