Hi, suggestion from Bernd: Add a config sys switch that allows you
to enable something like:
chario.c -> Do_DosIdle_loop ->
while (...) {
if config sys switch enables it
__emit__(0xf4); /* or any other way to do an HLT here */
DosIdle_int();
}
Or probably easier: Insert such code in dosidle.asm ...
(easier because it already is in Assembly language).
The problem here is that HLT must not be issued during CLI state.
But it you are idling because you are waiting for a key and for
some reason interrupts are disabled, then you have lost anyway even
without the HLT (e.g. if you are idling because you wait for a char
from CON). I think it would actually be safest to use HLT only in
the case of waiting for CON at all.
Of couse FDAPM uses more advanced logics (or at least more hooks)
for triggering both HLT and APM BIOS system idle calls (which can
be used by the BIOS for other things like lowering some clocks as
well). But a simple HLT in the "wait for key" loop will probably
already help quite a bit (FDAPM both hooks the dos idle int and
the keyboard int 16h, but if the kernel does not hook int 16h anyway
already, it is probably not worth the effort to make the kernel hook
int 16h only for a lousy HLT...).
The "HLT in wait for CON loop" would take < 10 bytes of resident
kernel code I hope, while FDAPM takes a something between 0.5 and 1.0kB.
By the way, Linux issues HLT for example in apm.c and process.c in
arch/i386/kernel, for example in the idle loop cpu_idle.
for (;;) {
...
if (boot_cpu_data.hlt_works_ok && !hlt_counter && !curre
nt->need_resched)
__asm__("hlt");
}
work = current->need_resched;
schedule();
check_pgt_cache();
}
...
Eric.
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Freedos-kernel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel