jg@hpldola.HP.COM (Joe Gilray) (07/23/90)
I have gotten the shareware Micrortx kernel and have been playing with it. Everything seems to work quite well. It seems like a very powerful and complete kernel. Last night I tried to define a 'switch' call out function to simply count the number of process switches. First I tried to simply increment a global variable in a C function, but this gave quirky and often incorrect results. After reading through the Micrortx documentation, I thought the problem was that the C function was munging with the registers so I wrote an assembly program that saves the registers on the stack, increments the global variable, and restores the registers, but this seems to invariably lock up my system. Has anyone solved this problem? Or done anything with the call-out functions in Micrortx? I am using the MWC 3.0.6 development package. Thanks in advance Joe Gilray
david@bdt.UUCP (David Beckemeyer) (07/25/90)
In article <1146@cnps.PHILIPS.nl> jg@hpldola.HP.COM (Joe Gilray) writes: >Has anyone solved this problem? Or done anything with the call-out >functions in Micrortx? > The "switch" call-out occurs at a very critical time, when no process is actually running. The routine must be very carefully constructed. Perhaps your routine overflowed the stack. The routines must be short and sweet. Rather than use the stack, try to save the regs. in a fixed area of memory. Perhaps even use your own stack area if you expect to nest deeply into C code (not really recommended for the switch function). If all you want to do is bump a global, how about: switch: add.l #1,_counter rts I don't see why you need to save regs or call a C routine at all. -- David Beckemeyer (david@bdt.UUCP) | "I'll forgive you Dad... If you have Beckemeyer Development Tools | a breath mint." P.O. Box 21575, Oakland, CA 94620 | Bart - "The Simpsons" UUCP: {uunet,ucbvax}!unisoft!bdt!david |