Port-vax archive

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

Emulator idle detect [was Re: Clock Error]



[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.

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

[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.

I wonder if I could autodetect idle loops as "any loop within the body
of which no writes, and no reads of anything but main memory, are
done".  For a simple implementation I'd probably have to limit the size
of the loop to something like maybe 8 or 16 instructions, but it might
be doable.  (Idle would have to be broken by not just interrupts but
also DMA, though, for that to work properly in full generality.)

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse%rodents-montreal.org@localhost
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index