From: SMTP%"MACRO32%WKUVX1.BITNET@uu7.psi.com" 7-AUG-1993 12:17:59.55 To: EVERHART CC: Subj: Re: AMAC vs. computed JMP Message-Id: <9308040742.AA08370@uu7.psi.com> X-Listname: "VMS Internals, MACRO, & BLISS Discussions" Warnings-To: <> Errors-To: MacroMan%WKUVX1.BITNET@uu7.psi.com Sender: MacroMan%WKUVX1.BITNET@uu7.psi.com Date: Wed, 04 Aug 1993 09:37:23 +0200 From: "GWDGV1::MOELLER" Reply-To: MACRO32%WKUVX1.BITNET@uu7.psi.com To: MACRO32@WKUVX1.BITNET Subject: Re: AMAC vs. computed JMP writes [in response to my question and Arne's answer]: >[...] > Explanation: When an instruction such as MOVAx or PUSHAx > is used to store the address of a code label which has not > been declared as an entry point, the compiler reports the > STORCODLAB error. The reason for this is that any legal > reference to the stored address will result in a JSB or CALL > to that address. For example, JMP 4(R0) will be treated as a > JSB (followed immediately by an RSB in the current routine). > > > You'd probably use .JSB32_ENTRY instead of .JSB_ENTRY so > the compiler doesn't go trashing all your registers. I think this still means that you cannot 'randomly' transfer control (all within the same module, of course) with JMP and have the same semantics as a branch (with regard to the stack contents). In the meantime, I converted my program to use some big CASEL intructions (by storing 'case labels' instead of the actual adresses). The 'stored code label' problem also affects the 'NEWPC' argument to the $UNWIND system service: In my undestanding, in the following example, the stack pointer changes when the 'alternate return' [x1] is taken. This won't hurt if the main program returns soon (like in the example), but if the main program would want to continue, I wouldn't know how to limit the stack expansion ... Example (just to test the machine code): .title z ; .psect _rodata,quad,nowrt,noexe k_0: .long 0 ; .psect _code,quad,nowrt,exe ; handler:: .call_entry $unwind_s depadr=k_0,newpc=x1 ret ; main:: .call_entry movab handler,(fp) clrl r1 divl3 r1,#1,r0 ret ; x1: .jsb32_entry ;; ;; something pushed on stack here ??? movl #4,r0 ret ; .end main Wolfgang J. Moeller, GWDG, D-37018 Goettingen, F.R.Germany | Disclaimer ... PSI%(0262)45050352008::MOELLER Phone: +49 551 201516 | No claim intended! Internet: moeller@gwdgv1.dnet.gwdg.de | This space intentionally left blank.