Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!gatech!bloom-beacon!husc6!mit-eddie!ll-xn!cit-vax!ucla-cs!zen!ucbvax!hplabs!pyramid!voder!blia!ted From: ted@blia.BLI.COM (Ted Marshall) Newsgroups: comp.os.vms Subject: Re: Help with a Kernal mode macro program Message-ID: <2935@blia.BLI.COM> Date: Fri, 10-Jul-87 12:25:55 EDT Article-I.D.: blia.2935 Posted: Fri Jul 10 12:25:55 1987 Date-Received: Sun, 12-Jul-87 12:24:12 EDT References: <870708122836.001@sitvxb> Distribution: world Organization: Britton Lee, Los Gatos, CA Lines: 42 Summary: movc instructions destroy R0 through R5 This on is easy! :-) (But don't feel too bad. The reason it's easy is that I've been bitten on this one too!) Your problem is that the movc instructions destroy registers R0 through R5. Reading from my trusty VAX Architecture Handbook, 1981, after a movc3, these registers are left with the following values: R0 = 0 R1 = address of 1 byte beyond the source string R2 = 0 R3 = address of 1 byte beyond the destination string R4 = 0 R5 = 0 One of the reasons this is done is that the instruction is interruptible. If an interrupt does occur during the movc3, the processor saves the state of the instruction in these registers and sets the FPD (First Part Done) bit in the PSL. When the instruction stream resumes, the PC still points at the movc3. The FPD bit tells the processor to restore the state from the registers and continue from there. Anyway, in your program, the routine that does the movc3 does not save R2 through R5. Note also that since this is called with the $CMKRNL system service, the direct caller is not your program but the EXE$CMKRNL routine in the executive. I haven't looked at it in the fiche, but I expect that when your routine returns to it, it tries to use a value it saved in one of these registers and gets an access violation. Thus, I expect that the fix is to add R2, R3, R4 and R5 to the entry mask for that routine. [Note: I don't have a LAT server and have not verified that this is the complete fix, but it is at least part of it.] -- Ted Marshall ...!ucbvax!mtxinu!blia!tedmtxinu!blia!ted@Berkeley.EDU Britton Lee, Inc., 14600 Winchester Blvd, Los Gatos, Ca 95030 (408)378-7000 The opinions expressed above are those of the poster and not his employer.