Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dummy timer for ELKS #16

Closed
mfld-fr opened this issue Oct 25, 2020 · 4 comments
Closed

Dummy timer for ELKS #16

mfld-fr opened this issue Oct 25, 2020 · 4 comments
Assignees
Labels
bug Defect in the product

Comments

@mfld-fr
Copy link
Owner

mfld-fr commented Oct 25, 2020

After #14 merge, as the INT8 will no more be called on each HLT instruction, implement a dummy timer to keep the ELKS timeouts working, otherwise it would block in the BIOS console driver.

@mfld-fr mfld-fr added the bug Defect in the product label Oct 25, 2020
@ghaerr
Copy link
Contributor

ghaerr commented Oct 25, 2020

Yes, this will be needed.

To be precise, the BIOS console driver, as well as the intended replacement for Advantech, the headless console driver, both setup a scheduler timer that calls a callback function every 8 jiffies. This callback function polls the BIOS and if input is ready, inserts a character into a TTY character queue that also wakes up any waiting processes.

I mention this because my thoughts are for the Advantech that it could use a modified headless driver that initializes the hardware serial port (no BIOS), then uses only a real hardware interrupt to process incoming characters, instead of the scheduling callback function. No BIOS polling required, and the system can wait in the HLT instruction. This entire scenario could be emulated with EMU86.

Of course, a timer is still required for ELKS, for two reasons: to update jiffies, and for implementing scheduler timer callbacks, of which select() is dependent on for accurate timeouts. Because of this, I recommend the implementation of a timer that attempts to emulate wall time, which would be suspended when active execution is stopped (at the emulator prompt). This would allow select() to function more accurately (until the HLT instruction). This could be implemented in a very basic way by having the timer count down by an amount linear to the number of CPU instructions emulated, say, 4 cycles per byte of code accessed.

Is this how you are implementing the Advantech hw timer emulator?

@ghaerr
Copy link
Contributor

ghaerr commented Nov 19, 2020

Hello @mfld-fr,

I have not yet updated the EMU86 commit in ELKS tools/Makefile to use the enhancements added several weeks ago, because the out-of-the-box EMU86 won't run ELKS without the INT 8 simulated on HLT.

Would you be open to a temporary PR that added INT 8 back in, for the purpose of having an EMU86 commit that would coincide with the ELKS v0.4.0 release? I think it would be nice to have an EMU86 commit that worked with ELKS, if for no other reason a reference point. This could be removed after a real dummy timer is coded. I plan to release ELKS v0.4.0 very soon.

Thank you!

@mfld-fr
Copy link
Owner Author

mfld-fr commented Dec 5, 2020

Moved the temporary code to the right place in #24

@mfld-fr
Copy link
Owner Author

mfld-fr commented Apr 30, 2021

Implementation completed in #24

@mfld-fr mfld-fr closed this as completed Apr 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Defect in the product
Projects
None yet
Development

No branches or pull requests

2 participants