rcornwell / sims

Burroughs B5500, ICL1900, SEL32, IBM 360/370, IBM 7000 and DEC PDP10 KA10/KI10/KL10/KS10, PDP6 simulators for SimH
http://sky-visions.com
95 stars 20 forks source link

maybe kl10 non-zero section push operations treat stack pointer incorrectly in some cases #306

Closed jeffgunter closed 1 year ago

jeffgunter commented 1 year ago

it appears to me that a global stack pointer being used with a pc in a nonzero section behaves differently on an sc40 or klh10 machine than it does on simh machine. i don't have the necessary hardware anymore to test this. however, the code i'm complaining about DID run on our sc40, and does run under klh10, and i think but am not positive it ran on our kl10.

i claim that on an sc40, or a klh10 machine, this code is used successfully to load up virtual exec mapped locations 23,,1 and 23,,2 and NOT ACs 1 & 2

    move sp,[23,,0]      ;global stack pointer
    xjrst [1,,.+1]           ;enter section 1, or any nzs
    push sp,[1]            ;put a 1 into 23,,1
    push sp,[2]            ;put a 2 into 23,,2
    xjrst [0,,.+1]          ;resume normal operation

the actual failing code is part of tops10 startup and runs in kernel mode and writes into virtual section 23. when it executes in section one, AC1 and AC2 are overwritten, not virtual locations 23,,1 and 23,,2.

the section isn't relevant - the same thing happens in a user mode program running in section 1, trying to write into section 3. the attached program does this in simh:

run

Before PUSHes 0/ 0,,0 1/ 0,,1 2/ 0,,2 3/ 0,,3 13/ 3,,0; 13 is used as global stack pointer UNEXPECTED RESULTS, ACS WERE CLOBBERED After PUSHes 0/ 0,,0 1/ 0,,31416 2/ 0,,272 3/ 0,,42 13/ 3,,3; 13 is used as global stack pointer from section 3: 3,,0/ 0,,0 3,,1/ 0,,0 3,,2/ 0,,0 3,,3/ 0,,0 EXIT

while under klh10, and i claim, under the sc40 & kl10, this is the result: .run

Before PUSHes 0/ 0,,0 1/ 0,,1 2/ 0,,2 3/ 0,,3 13/ 3,,0; 13 is used as global stack pointer After PUSHes 0/ 0,,0 1/ 0,,1 2/ 0,,2 3/ 0,,3 13/ 3,,3; 13 is used as global stack pointer from section 3: 3,,0/ 0,,0 3,,1/ 0,,31416 3,,2/ 0,,272 3,,3/ 0,,42 EXIT

so i claim that on a kl10, an sc40, and klh10, the global stack pointer doesn't write into the acs for rh <20, but on simh it does. maybe you have a way to test a kl10?

-jfg

stak2.mac.txt

rcornwell commented 1 year ago

Thanks for finding this. I pushed out a fix.

larsbrinkhoff commented 1 year ago

Note that sdf.org has made an SC40 available online, so it should be possible to test this case on real hardware. There's also a Toad2. Unfortunately no real KL10 at the moment.

jeffgunter commented 1 year ago

thanx for pointing this out.  i'll drop for a lifetime account and try to figure out how to locate and connect to the sc40 and the toad if i can find it (at 1st glance it isn't as obvious as the connect page at living computers.org). 

fwiw, the stack pointer issue worked as described on my sc40, which is not currently up.

-jfg

------ Original Message ------
   Received: 02:20 AM EDT, 09/27/2023
   From: Lars Brinkhoff ***@***.***>
   To: rcornwell/sims ***@***.***>
  Cc: jeffgunter ***@***.***>, Author ***@***.***>
   Subject: Re: [rcornwell/sims] maybe kl10 non-zero section push operations treat stack pointer incorrectly in some cases (Issue #306)

      Note that sdf.org has made an SC40 available online, so it should be possible to test this case on real hardware. There's also a Toad2. Unfortunately no real KL10 at the moment.

      —
        Reply to this email directly, view it on GitHub, or unsubscribe.
        You are receiving this because you authored the thread.Message ID: ***@***.***>
       [ { ***@***.***": "http://schema.org", ***@***.***": "EmailMessage", "potentialAction": { ***@***.***": "ViewAction", "target": "https://github.com/rcornwell/sims/issues/306#issuecomment-1736770985", "url": "https://github.com/rcornwell/sims/issues/306#issuecomment-1736770985", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { ***@***.***": "Organization", "name": "GitHub", "url": "https://github.com" } } ]
rcornwell commented 1 year ago

My fix lets the program work. Not sure there is need to test elsewhere. I am not sure why diagnostics did not catch this.

jeffgunter commented 1 year ago

thanx for the fix. possibly no other tops10 is using a global stack pointer in that way. for my own curiosity, i will try to check the code on available online resources. so if i can figure out the sdf sc40 and the toad, i will; at the very least i can probably make the same program run on lcm's tops20 machine, which i think is a toad... you and lars have been very helpful, thanx!

-jfg

rcornwell commented 1 year ago

Like I say, this was an error in KL10 simulator. Pushing with a stack other then 0,,n or 1,,n should go directly to the page, not the registers. 0,,n and 1,,n should go to register if n < 16.

Perhaps you can figure out the Tops 20 CC error.

larsbrinkhoff commented 1 year ago

I believe the SDF remote logins should be available from ssh menu@sdf.org, but it's not reponding now. It seems all SDF resources are offline today.

jeffgunter commented 1 year ago

rcornwell, yes, i agree, with your interpretation of 0&1,,ac extended addressing. and i have at least one more trivial coming in that regard.

"Perhaps you can figure out the Tops20 CC error" ... ?

probably not, since i can only rarely figure anything out, but ... what is the Tops 20 CC error?

-jfg