From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.7 required=5.0 tests=BAYES_00,INVALID_DATE, MSGID_SHORT,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Xref: utzoo comp.lang.ada:2664 comp.lang.asm370:171 Path: utzoo!attcan!utgpu!watmath!att!dptg!rutgers!apple!brutus.cs.uiuc.edu!psuvax1!husc6!m2c!wpi!wpi.wpi.edu!tfrancis From: tfrancis@wpi.wpi.edu (Krishan M Nainani) Newsgroups: comp.lang.ada,comp.lang.asm370 Subject: Interfacing from Ada to C to Assembler ('286) Message-ID: <4060@wpi.wpi.edu> Date: 16 Sep 89 16:59:11 GMT Sender: tfrancis@wpi.wpi.edu Reply-To: tfrancis@wpi.wpi.edu (Krishan M Nainani) Organization: Worcester Polytechnic Institute, Worcester, Mass. List-Id: (Posted to comp.lang.ada and comp.lang.asm370 in the hopes that I'll get a reply that will help my question.) Hi Folks, I have been working on a project involving context switching of Ada procedures. Essentially, my project consists of Ada procedures communicating via messages (a uni-processor environment) so when procedure A performs some calculations it sends the result(s) to procedure B. As a result, procedure B should then be scheduled thereby leaving procedure A unfinished. Then, procedure B could perform some calculations and then send it's result(s) to procedure C. Here comes the tricky part. Now, procedure C could use the message from B and then send it's result to procedure A which would then RESUME from where it left off earlier. Obviously, this is not single-thread execution, instead this is a real-time system which allows the most important procedure to execute next. Since this system allows any procedure to call any other procedure and then RESUME ANY other procedure (or start the procedure if it hasn't begun yet), then this is going to be system dependant and this is acceptable. However, this system involves using Assembler which does the context switch. An added complication was required by the so-called "management" which demanded an interface from Ada to C to Assembler. So now, C routines call the Assembler (context switch) routines. As a whole, Ada procedures call the C routines which call the Assembler routines. There are actually two Assembler routines : initstk and swap. INITSTK creates a procedure stack whereas swap performs a context switch between procedure stacks. I have tried interfacing between Ada and Assmbler and the results are perfect whereas the results obtained by interfacing between Ada -> C -> Assembler are very dissapointing. The system crashes repeatedly in the swap (assembler) routine. --------------------------------------------- Can anyone provide me with (much needed) help or advice regarding the reason for this crash before I spend a long time trying to debug this with the MS-DOS debug tool since I cannot use CodeView (5.0) because CodeView does not handle Ada code ?? Also, does anyone see any problems with this method? BTW, I am using Alsys Ada (ver 4.2), an IBM-AT, with DOS 3.3 (MicroSoft) and the 80286 chip (using the extended mode - NOT the Protected mode). Krishan Nainani (tfrancis@wpi.wpi.edu or tfrancis@wpi.bitnet)