Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!rochester!udel!mmdf From: mmdf@udel.UUCP Newsgroups: comp.os.minix Subject: File: "MINIX-L MAIL" being sent to you Message-ID: <555@louie.udel.EDU> Date: Thu, 1-Oct-87 23:33:09 EDT Article-I.D.: louie.555 Posted: Thu Oct 1 23:33:09 1987 Date-Received: Sat, 3-Oct-87 05:38:46 EDT Sender: mmdf@udel.EDU Lines: 77 Received: from NDSUVM1(MAILER) by FINHUTC (Mailer X1.25) id 4363; Fri, 02 Oct 87 05:28:19 FIN Received: by NDSUVM1 (Mailer X1.24) id 9883; Thu, 01 Oct 87 22:23:31 CDT Received: from UDEL.EDU by WISCVM.WISC.EDU ; Thu, 01 Oct 87 22:21:16 CDT Received: from Louie.UDEL.EDU by Louie.UDEL.EDU id aa00989; 1 Oct 87 22:29 EDT Received: from USENET by Louie.UDEL.EDU id aa00834; 1 Oct 87 22:22 EDT ARPA: usenet@udel.EDU, UUCP: ...{harv Source-Info: From (or Sender) name not authenticated. Message-ID: <87@rocksvax.UUCP> Newsgroups: comp.os.minix Date: 1 Oct 87 12:01:20 GMT Reply-To: INFO-MINIX@UDEL.EDU Sender: Minix operating system From: Marty Leisner Subject: Controlling processer status -- Minix v. Xinu X-LSVRepTo: X-LSVopts: NOACK Org=MINIX-L@NDSUVM1 X-LSVvia: MINIX-L@NDSUVM1 X-LSVTo: info-minix@UDEL.EDU To: $PEER$ Minix uses two routines -- lock()/restore() which saves the processor status in a common private variable (lockvar). If found this way of coding to often leads to problems when you want to nest subroutines which each require the interrupts be turned off, and you don't want to write the code assuming the low-level subroutine is running with the interrupts turned off. Xinu uses two subroutines -- disable()/restore(). Disable returns the processor status and restore gets passed the new processor status -- the psw should be stored in local memory of the calling function. I've used variants of the lock/restore/unlock variant for several years and have gotten bitten too many times than I care to remember. I'm going to change all references of lock/restore to disable/restore (I just got bitten again doing some hacking). Any comments? Here's the code for disable/restore (real simple): ; disable interrupts and return previous flags setting procdef disable pushf cli pop ax ; to return to caller pret pend disable ; restore processor status as it was procdef restore, <> push proc_status popf ; flags are according to proc_status pret pend restore P.S. The above was written using the Aztec assembler (it has a series of macros which knows how to get at arguments. If arguments are passed in, it knows to do a push bp mov bp,sp and pret does a pop bp only if bp was pushed). marty -- marty leisner xerox corp leisner.henr@xerox.com martyl@rocksvax.uucp