jmp $ or hlt?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
paulbarker

Re:jmp $ or hlt?

Post by paulbarker »

Theres nothing wrong with it it's just "non-standard", and I don't like it myself.

Maybe it's a carry over from applications. When main() finishes, the program stops. To some people (like me :) ), it's counter-intuitive to continue processing events/interrupts after the main function has returned.

All I suggest is that you comment it well.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:jmp $ or hlt?

Post by Pype.Clicker »

Candamir wrote:

Code: Select all

hltloop:
   hlt
   jmp hltloop
There you had to implement SETI or whatever...
usually, that's not the way you make it. The "idle loop" is there for cases where system is idle. Screensavers or Seti@HOME are rather low-priority threads that are started when the system detects no activity for a given period of time.

The idle loop, instead, is always there, as soon as there's no thread ready in the system, it gets executed until any thread is ready.
Post Reply