Linux-kernel mailing list archive 1999-34,: solaris emulation & word alignment

# solaris emulation & word alignment

Jason Rappleye (rappleye@nexus.hwi.buffalo.edu)
Fri, 27 Aug 1999 12:13:19 -0400

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: kuznet@ms2.inr.ac.ru: "Re: 2.3.15 ifconfig oops"
- Previous message: jumeaux lists: "Re: strange problems with k2.2.11 / glibc 2.1 / xterm (xfree86 3.3.4)"

Hello,

I'm trying to run a binary that calls gettimeofday in solaris emulation,
using kernel 2.2.11 on a Sun Ultra 5, binary compiled on a Sun Ultra
Enterprise 6000 w/ Solaris 5.6 & egcs-2.91.60 19981201. The results are
far from correct. I get the same values every time: sec=0 usec=3960739.
Now, on Solaris sizeof (struct timeval) is 8 and it's also 8 on linux. But
sizeof (strcut timeval) from within the kernel
(arch/sparc64/solaris/misc.c, solaris_gettimeofday()) is 16! Printing the
addresses of tv_sec and tv_usec show that they're double word aligned. So
I tried writing the values returned by the regular linux gettimeofday into
the sturct returned by the emulated call at the right spots. But I still
get the same results! Maybe I've written the code wrong-I haven't had to
deal with all this 32/64 bit crap before, might have messed something
there. Here's the code (I've left in some printks for debugging purposes):

asmlinkage int solaris_gettimeofday(u32 tim)
{
int (*sys_gettimeofday)(struct timeval *, struct timezone *) =
(int (*)(struct timeval *, struct timezone*))SYS(gettimeofday)\ ;

/* return sys_gettimeofday((struct timeval *)(u64)tim, NULL); */

int ret;
int sec, usec;
ret = sys_gettimeofday((struct timeval *)(u64)tim, NULL);
get_user_ret(sec, &((struct timeval *)A((u64)tim))->tv_sec,-EFAULT);
get_user_ret(usec, &((struct timeval *)A((u64)tim))->tv_usec,-EFAULT);
put_user_ret(sec, (int *)A((u64)tim)+0, -EFAULT);
put_user_ret(usec, (int *)A((u64)tim)+1, -EFAULT);
printk("time: tv_sec (%d) tv_usec (%d)\n", sec, usec);
printk("struct timeval: &tv_sec (%x) &tv_usec (%x)\n",
&((struct timeval *)A((u64)tim))->tv_sec,
&((struct timeval *)A((u64)tim))->tv_usec);
printk("(int *): &tv_sec (%x) &tv_usec (%x)\n",
(int *)A((u64)tim)+0,
(int *)A((u64)tim)+1);
printk("sizeof(struct timeval) is %d\n", sizeof(struct timeval));
return ret;
}

Thanks in advance for any help. Please CC me on any responses.

Jason

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

- Next message: kuznet@ms2.inr.ac.ru: "Re: 2.3.15 ifconfig oops"
- Previous message: jumeaux lists: "Re: strange problems with k2.2.11 / glibc 2.1 / xterm (xfree86 3.3.4)"