| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
When debugging some syslinux code with debugging enabled, the threading
code is so verbose that it completly slow down syslinux but also is so
verbose that any other trace is invisible in the flood.
This commit aims at requesting people to explicitly enable the
threading logs by using -DDEBUG_THREAD.
|
|
|
|
|
|
| |
If the mailbox/semaphore is invalid, disallow additions.
Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
|
|
|
|
|
|
| |
Also set mbox invalid and mbox pointer NULL when free()d
Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
|
|
|
|
|
|
|
| |
Always start the idle thread, but leave it blocked unless we have an
indication that interrupts are not working.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
|
|
|
|
|
|
|
|
|
|
|
| |
Add a magic number to the thread control block; this helps check for
memory overwrites.
Add dprintf()s to the scheduler.
Force a minimum stack size.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
|
|
|
|
|
|
|
| |
Make sure we use "sti ; hlt" to make sure we don't go to sleep when we
suddenly have an interrupt coming in.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
|
|
|
|
|
|
| |
Fix set-but-not-used variable warnings and undefined references.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
need_schedule was no longer used by anything else, and schedule_lock
only verified if we were being called from inside sched_hook_func().
Make the localness of this data explicit.
While we're at it, call kaboom if we ever find ourselves without a
runnable thread (which should not be possible, as the idle thread is
not allowed to block.)
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
|
|
|
|
|
|
|
|
|
| |
Instead of testing __schedule_lock explicitly, we can just call
kaboom() if the scheduler returns, since that can only happen if the
scheduler lock is set, and is in fact the reason we can't be here with
the scheduler locked in the first place.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
|
|
|
|
|
|
|
| |
If we ever end up in __exit_thread with the scheduler locked, we're
completely fscked.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
|
|
|
|
|
|
|
| |
kill_thread() had been modifying errno(!) as if it had been the return
value... in other words, it really did absolutely nothing.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
|
|
|
|
|
|
|
|
|
|
|
| |
The idle thread can never sleep, so it's not really safe to do
anything inside it. Instead, run a separate poll thread at low
priority; we can also do that to poll the serial console if needed.
Overall, the "classic" Syslinux idle handling really should go away
and be replaced by the idle thread.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
|
|
|
|
|
|
|
| |
Free curr->rmstack instead of double free of curr->stack.
Signed-off-by: Sebastian Herbszt <herbszt@gmx.de>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
|
|
|
|
|
|
|
|
|
|
| |
free(NULL) is safe and permitted, no reason to conditionalize calling
free().
lmalloc() will always return a paragraph-aligned memory block, so we
don't have to play games with the offset.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
|
|
|
|
|
|
|
|
|
|
|
| |
If the UNDI stack reports either IRQ 0 or does NOT report the NDIS IRQ
supported flag, then poll the interrupt routine from the idle thread
instead.
This is somewhat limited; we really should have a chain of idle poll
routines to support things like serial console.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
When this code was originally written, we didn't have lmalloc(). Now
when lmalloc() is implemented, let each real-mode task have its own
stack.
Note that this means we absolutely have to continue to support the
SS != CS, DS model in the real-mode code, which should already be the
case, but...
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For some reason the core_pm_hook is not getting called
every time we get an interrupt with the result that
in some situations like arping for our neighbours mac
address or a tftp transfer we can stall, we never move
forward again.
The reason for those stalls likely bears more investigating
but for now it is sufficient for me to know that they exist
and that I can work around them by polling for wakekup
conditions everytime we call schedule. That gives us code
that works reliably and stays within the letter of the
pxe spec. The oddities of the pxelinux core can be ironed
out later.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
|
|
|
|
| |
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
|
|
|
|
|
|
| |
Return 0 from sem_down if we passed right through the assembly code.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
|
|
|
|
|
|
|
|
|
|
|
| |
core.h brings in a lot of symbols and causes conflicts when
included into lwip, in particular conflicts on the symbol
lfree.
So do the simple thing and simplify what thread.h brings in to
reduce the change of symbol conflicts.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
|
|
|
|
|
|
| |
Add a name field to struct thread, for debugging's sake.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
|
|
|
|
|
|
|
| |
Add support for locking the scheduler; this is needed for the pm
return hook to operate properly.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
|
|
|
|
|
|
|
| |
Move most our thread state to the stack. Task switch the errno
variable.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
|
|
|
|
|
|
|
| |
Merge mbox_post() and mbox_trypost() into a single function with a
timeout parameter.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
|
|
|
|
|
|
| |
A very simple mailbox library, designed for lwIP porting.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
|
|
|
|
|
|
|
| |
Implement a "trywait" option... if timeout is set to -1, then timeout
immediately if the semaphore isn't available.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
|
|
|
|
|
|
|
|
| |
Have start_thread() allocate memory dynamically, using malloc().
XXX: should probably free that memory in __exit_thread()... could be
"interesting".
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
|
|
Simple thread library with the intent of making lwIP easier to port.
-- Modified to use milliseconds instead of jiffies,
as lwIP expresses everything in milliseconds. EWB
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
|