Port-vax archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Emulator idle detect [was Re: Clock Error]



On 2023-12-20 03:05, Mouse wrote:
[bqt@]
Unless I misremember, it raises the IPL to 1.  A level that is
otherwise meaningless, so not something done by mistake, and not
something used by anything.

But setting IPL to 1 being "otherwise meaningless" or "not [] used by
anything" are very OS-specific things.

Oh. It is very OS specific. That's why, in simh, you have to tell it to do NetBSD idle detection, which is different than VMS idle detection.

With VMS, it is, as far as I can remember, just detecting a specific loop pattern in the kernel.

I suppose that's at least one reason why, as quoted below, simh has a
BSD-specific internal flag controlling idle detection.

Yes. Not sure if Ken copied it verbatim from the later version of simh, or if he embellished it. But either way, that's basically it.

[kwellsch@]
... and FWIW, this it the hackish patch I made to SIMH 3.12-4 to
carry over the correct IDLE detection code that is part of open-simh
(4.1).

      case MT_IPL:                                        /* IPL */
          PSL = (PSL & ~PSL_IPL) | ((val & PSL_M_IPL) << PSL_V_IPL);
+        if ((VAX_IDLE_BSD & cpu_idle_mask) &&           /* New NetBSD and OpenBSD */
+            (0 != (PC & 0x80000000)) &&                 /* System Space (Not BOOT ROM) */
+            (val == 1))                                 /* IPL 1 */
+            cpu_idle();                                 /* idle loop */
          break;

Ah, glad I asked!  Just from the kernel code jbglaw@ quoted, I would
not have inferred the "PC must be in system space" condition.

Considering that a user space program usually can't even raise the IPL, it sortof already gives that this would be in the kernel. Of course, any code that can switch to running in kernel mode can play around with this, so it might not be strictly in the kernel itself, but unless you really just want to mess with the simh idle detection, why would anyone want to go to IPL 1? There is no hardware that does interrupts at that level, so it's pretty much an IPL level that is not used/useful.

  Johnny

--
Johnny Billquist                  || "I'm on a bus
                                  ||  on a psychedelic trip
email: bqt%softjar.se@localhost             ||  Reading murder books
pdp is alive!                     ||  tryin' to stay hip" - B. Idol


Home | Main Index | Thread Index | Old Index