From mboxrd@z Thu Jan 1 00:00:00 1970 From: lehmann@ans-netz.de (Oliver Lehmann) Date: Mon, 30 Jun 2008 19:34:50 +0200 Subject: [TUHS] Introduction In-Reply-To: <20080630113028.46a50360@veda.cnb.uam.es> References: <20080604135729.4c50e178@veda.cnb.uam.es> <20080605171758.64c80f06@veda.cnb.uam.es> <20080623161801.19a53c3e@veda.cnb.uam.es> <20080623181101.e862a3a2.lehmann@ans-netz.de> <20080625122505.4e3d9803@veda.cnb.uam.es> <20080626165246.9c3933eb.lehmann@ans-netz.de> <20080627142430.57e0a9c4@veda.cnb.uam.es> <20080629102523.0219a85c.lehmann@ans-netz.de> <20080630113028.46a50360@veda.cnb.uam.es> Message-ID: <20080630193450.b82063bb.lehmann@ans-netz.de> Jose R. Valverde wrote: > But you would still be able to see what did generate the code (barring > register number). my C code: register char *r2; register long r4; r2 = uap->linkname; r4 = (long) r2; r4 &= 0x7F00FFFF; u.u_dirp.l = (caddr_t) r4; leads to: ldl rr2,rr8(#4) /* r2 = uap->linkname; */ ldl |_stkseg+~L1|(fp),rr2 /* r2 = uap->linkname; */ ldl |_stkseg+~L1+4|(fp),rr2 /* r4 = (long) r2; */ ldl rr4,rr2 /* r4 &= 0x7F00FFFF; */ and r4,#32512 /* r4 &= 0x7F00FFFF; */ ldl |_stkseg+~L1+4|(fp),rr4 /* r4 &= 0x7F00FFFF; */ ldl _u+78,rr4 /* u.u_dirp.l = (caddr_t) r4; */ looks not sooo bad - just the assigning into the stacked variables (no idea why no register bound is used here even if I told the compiler to make them register bound - but ,,register'' isn't that strong anyway) > That is why I suggested the extra cast to > see if the compiler would be misled into using an unneeded zero-offset > assignment instruction to an auxiliary register. > > u.u_dirp.l = (caddr_t) ((long) (((saddr_t) uap->linkname).l) & 0x7F00FFFF); > [...] > but introducing a saddr_t cast that might fool the compiler into a > temporary assignment with a zero offset (the .l) into ldl rr4,rr2 but not with that code :/ u.u_dirp.l = (caddr_t) ((long) (((saddr_t) uap->linkname).l) & 0x7F00FFFF); "sys2_.c":50: operands of CAST have incompatible types "sys2_.c":50: warning: struct/union or struct/union pointer required Thats why I changed it the last time... to * and ->. -- Oliver Lehmann http://www.pofo.de/ http://wishlist.ans-netz.de/