Discussion:
[Rpcemu] PATCH: Implement OS_Reset "0x0ff"
Reuben Thomas
2018-10-30 20:00:01 UTC
Permalink
Attached, a patch to implement powering off (intercept OS_Reset with
R0="0x0ff", and to advertise this capability (intercept OS_ReadSysInfo 8).

Do let me know if there's anything I can do to make it more digestible. As
it is, it just patches opSWI in arm_common.c.
--
https://rrt.sc3d.org
Ralph Corderoy
2018-10-31 11:49:00 UTC
Permalink
Hi Reuben,

Couple of minor comments.
+ /* Intercept OS_Reset to check for turning off
+ https://www.riscosopen.org/wiki/documentation/show/OS_Reset
+ */
+ if (swinum == SWI_OS_Reset) {
+ if (arm.reg[0] == 0x46464F26) { /* 0x0ff */
It's "&0ff", not 0x0ff.
+ exit(0);
+ }
+ }
+
+ if (swinum == SWI_OS_ReadSysInfo && arm.reg[0] == 8) {
Use `else if' as the previous if being true might not result in the
exit().
+ arm.reg[0] = 0; /* Unknown hardware platform */
+ arm.reg[1] = 0x08; /* Software control over PSU supported */
+ return;
+ }
--
Cheers, Ralph.
https://plus.google.com/+RalphCorderoy
Theo Markettos
2018-10-31 12:15:23 UTC
Permalink
Post by Ralph Corderoy
Hi Reuben,
Couple of minor comments.
+ /* Intercept OS_Reset to check for turning off
+ https://www.riscosopen.org/wiki/documentation/show/OS_Reset
+ */
+ if (swinum == SWI_OS_Reset) {
+ if (arm.reg[0] == 0x46464F26) { /* 0x0ff */
It's "&0ff", not 0x0ff.
I think it's a bug in the webpage, but the hex spells "&OFF"
(letter oh not number zero, all capitalised).

PRM 5a doesn't mention any parameters to OS_Reset - can anyone confirm the
above hex number is correct for power off?

Theo
Ralph Corderoy
2018-10-31 12:46:37 UTC
Permalink
Hi Theo,
Post by Theo Markettos
Post by Ralph Corderoy
+ if (arm.reg[0] == 0x46464F26) { /* 0x0ff */
It's "&0ff", not 0x0ff.
I think it's a bug in the webpage, but the hex spells "&OFF"
Yes, sorry, that's what I meant, having read the bytes, but messed up by
the time I wrote the email.
--
Cheers, Ralph.
https://plus.google.com/+RalphCorderoy
Steve Fryatt
2018-10-31 20:14:33 UTC
Permalink
On 31 Oct, Theo Markettos wrote in message
Post by Theo Markettos
PRM 5a doesn't mention any parameters to OS_Reset - can anyone confirm the
above hex number is correct for power off?
https://www.riscosopen.org/wiki/documentation/show/OS_Reset
--
Steve Fryatt - Leeds, England

http://www.stevefryatt.org.uk/
Reuben Thomas
2018-10-31 16:49:13 UTC
Permalink
Post by Ralph Corderoy
Hi Reuben,
Couple of minor comments.
+ /* Intercept OS_Reset to check for turning off
+ https://www.riscosopen.org/wiki/documentation/show/OS_Reset
+ */
+ if (swinum == SWI_OS_Reset) {
+ if (arm.reg[0] == 0x46464F26) { /* 0x0ff */
It's "&0ff", not 0x0ff.
Thanks (corrected to "&OFF"; a case where the code lagged behind the
comment). Indeed, the online documentation at
https://www.riscosopen.org/wiki/documentation/show/OS_Reset has the right
hex but the wrong ASCII.
Post by Ralph Corderoy
Use `else if' as the previous if being true might not result in the
exit().
Fixed. Arguably the whole opSWI function would benefit from switching on
swinum and only then applying other conditions; the logic is a little
tortuous at the moment.

New version attached.
--
https://rrt.sc3d.org
Reuben Thomas
2018-10-31 16:49:58 UTC
Permalink
Post by Reuben Thomas
Thanks (corrected to "&OFF"; a case where the code lagged behind the
comment). Indeed, the online documentation at
https://www.riscosopen.org/wiki/documentation/show/OS_Reset has the right
hex but the wrong ASCII.
I fixed the documentation wiki, BTW, so it's right now!
--
https://rrt.sc3d.org
Reuben Thomas
2018-11-06 19:32:18 UTC
Permalink
Post by Reuben Thomas
Post by Reuben Thomas
Thanks (corrected to "&OFF"; a case where the code lagged behind the
comment). Indeed, the online documentation at
https://www.riscosopen.org/wiki/documentation/show/OS_Reset has the
right hex but the wrong ASCII.
I fixed the documentation wiki, BTW, so it's right now!
Is there anything else that needs doing?
--
https://rrt.sc3d.org
Loading...