[TUHS] Introduction

Oliver Lehmann lehmann at ans-netz.de
Sun Jun 29 18:25:23 AEST 2008


Jose R. Valverde wrote:

> Why don't you try to split the assignment into various statements
> to reproduce the assembly and the recombine them? Like, e.g.
> 
> 1:	r2 = uap->linkname;		/* ldl rr2,rr8(#4) */
> 2:	r4 = (long) r2;			/* ldl rr4,rr2 */
> 3:	r4 &= 0x7F00FFFF;		/* and rr4,#32512 */
> 4:	u.u_dirp.l = (caddr_t) r4;	/* ldl _u+78, rr4 */

hm.. this won't work because the compiler starts handing out registers
the register-declared variables with the highest register possible so
would start with rr10 or so.

> 	u.u_dirp.l = (caddr_t) ((long) (((saddr_t) uap->linkname).l) & 0x7F00FFFF);

I've changed it to:

	u.u_dirp.l = (caddr_t) ((long) (((saddr_t *) uap->linkname)->l) & 0x7F00FFFF);

otherwise it won't compile. It compiles to:

        ldl     rr2,rr8(#4)
        ldl     rr4, at rr2
        and     r4,#32512
        ldl     _u+78,rr4

is it because I added a * and changed . to ->?

> 	u.u_dirp = (saddr_t) (((long) uap->linkname) & 0x7F00FFFF);

this generates:
"sys2.c":305: operands of CAST have incompatible types 
"sys2.c":305: operands of "=" have incompatible types 

:(

-- 
 Oliver Lehmann
  http://www.pofo.de/
  http://wishlist.ans-netz.de/



More information about the TUHS mailing list