Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!wuarchive!sdd.hp.com!mips!carbon!stanford.edu!agate!pasteur!dog.ee.lbl.gov!elf.ee.lbl.gov!torek From: torek@elf.ee.lbl.gov (Chris Torek) Newsgroups: comp.arch Subject: Re: skip instructions Message-ID: <13039@dog.ee.lbl.gov> Date: 10 May 91 11:26:49 GMT References: <1182@opus.NMSU.Edu> <1991May05.174307.8952@iecc.cambridge.ma.us> <1991May10.004650.7258@sbcs.sunysb.edu> Reply-To: torek@elf.ee.lbl.gov (Chris Torek) Distribution: comp Organization: Lawrence Berkeley Laboratory, Berkeley Lines: 46 X-Local-Date: Fri, 10 May 91 04:26:49 PDT In article <1991May10.004650.7258@sbcs.sunysb.edu> jallen@eeserv1.ic.sunysb.edu (Joseph Allen) writes: >Also, when are we going to see multiple error return points from OS calls? >I.E., if no error goto return point+1, if error goto return point+0 which >contains a jump to the error handler. This is a nice idea, but the ret+0/1 is a bit limiting. On the SPARC, in which the system call number is passed in %g1 and %g2..%g7 are in essence `wasted', it might be more reasonable to have the success-return address passed in %g2. That is, instead of: .globl _read _read: mov SYS_read, %g1 ! read t 0 ! read(%o0, %o1, %o2) bcc 1f ! if success, go return .empty ! next instr okay in delay slot set cerror, %g1 jmp %g1 ! jump cerror nop 1: retl ! success: jump to [%o7+8] nop ! nothing to do in delay slot we would have: .globl _read _read: mov SYS_read, %g1 ! read add %o7, 8, %g2 ! success return t 0 ! read(%o0, %o1, %o2) set cerror, %g1 jmp %g1 nop I will probably do this with a `high bit' in %g1 since it is not compatible with SunOS (i.e., #define RETFLAG 0x800 _read: mov SYS_read+RETFLAG, %g1 ! read, return to %g2 on success or something like that). Actually, since the return is invariably a `retl' (return to %o7+8) I might just make it use %o7+8. This will save one whole instruction on failure returns (oh boy :-) ). -- In-Real-Life: Chris Torek, Lawrence Berkeley Lab CSE/EE (+1 415 486 5427) Berkeley, CA Domain: torek@ee.lbl.gov