Anonymous user
Bran's Kernel Development Tutorial Known Bugs: Difference between revisions
Bran's Kernel Development Tutorial Known Bugs (view source)
Revision as of 00:50, 14 January 2014
, 10 years agono edit summary
[unchecked revision] | [unchecked revision] |
m (Added category) |
No edit summary |
||
Line 32:
If you still have problems, you may need to change the output format of the nasm command in the build.bat to make an [[ELF]] file instead of [[a.out]].
===timer_wait never returns===
The provided method to wait a number of timer ticks never returns because the <code>timer_ticks</code> variable is not defined as volatile. Changing its definition to <code>volatile unsigned int timer_ticks = 0;</code> will make the <code>timer_wait()</code> function work.
Also, instead of busy waiting, the processor could be put into sleep in order to save power. It can be done like this:
<syntaxhighlight lang="c">
void timer_wait(int ticks)
{
unsigned int eticks;
eticks = timer_ticks + ticks;
while(timer_ticks < eticks)
{
__asm__ __volatile__ ("sti//hlt//cli");
}
}
</syntaxhighlight>
===References===
|