spinhawk
spinhawk copied to clipboard
Dynamic loader, instructions do not get actually loaded.
I'm currently testing J. Winter dyn75 (75/TCPIP instruction for MVS3.8j) under hercules-3.13.
On both the github master and the reference hercules-3.13.tar.gz distribution, new dynamically loadable instructions get compiled and linked correctly and loaded into the optable, as "lsmod" show, with the "ldmod" command.
Unfortunately, although correctly loaded, they never get actually executed, as a simple test with the reference TESTINS.C/BARF instruction show.
I did some debugging and I found that the function "set_opcode_pointers()", in cpu.c, is called ONLY at emulator initialization time, from cpu.c:1989 and never called again.
So the set_opcode_pointers() in opcode.c is not called to initialize the "regs->s370_opcode_table" runtime real table AFTER the "ldmod" command load a new instruction and the instruction is NEVER actually seen at execution time.
A simple change in ipl.c:
`@@ -408,6 +408,9 @@ int i; /* Array subscript */ ARCH_DEP(store_int_timer_nolock) (regs); #endif
- /* Initialize opcode table pointers */
- set_opcode_pointers (regs);
- if(regs->host && regs->guestregs) { ARCH_DEP(cpu_reset)(regs->guestregs);`
allow to reload the reg->opcode_table just BEFORE an IPL (which seems the right, safe time to perform this action) and with this simple patch dynamically loadable instructions get executed correctly.
I now have the J. Winter dyn75/tcpip instructions correcly loaded (with "ldmod dyn75") and executed from MVS3.8J (personal SYSGEN), as a test with the TK4- J.Winter FTPD show.
Also the TESTINS.C begin to work correctly after applying this patch to ipl.c.
Regards, Orfheo (AKA Peppe/G. Vitillaro on hercules main group).