Move the "double-ready" check into queueproc() function,
doing it while holding the runq lock, meaning
all transitions to Ready state are serialized.
We do not just check for double-ready but for any
"illegal" transisions:
ready() on Dead, Moribund, New, Ready, Running and Waitrelease
is not allowed.
ready() on Queueing*, Wakeme, Broken, Stopped and Rendez
is only valid when done from another process.
For rescheduling, we have to go to Scheding state
before calling ready(). (rebalance(), schedinit()...)
The EDF scheduler had this bug where it could ready() multiple
times as it was staying in Waitrelease state after releasing
the edflock. Now it transitions thru Scheding avoiding
the issue.
Some callers of unlock change the process state
(such as qlock()) which means they are committed
to calling sched() anyway, so no ned to call it
internally.
Move waserror()/poperror() out of the loop,
so we can also catch errors from canacquire().
This is theoretically possible if memory has
been paged out and we get I/O errors when
trying to page it back in.
For ready() to check invalid state transitions,
we want to ensure that ready() is never called
on a dead proc (or one that is currently dying),
however when we create a new process,
its initial state was "Dead" until is is ready()d.
Instead, introduce the state "New", which is
set when the proc is removed from the freelist
by newproc(), making New -> Ready -> Running
state transition valid.
Also make sure we never leave notes to deadly
processes or ones that are in "Broken" state.
When we get a clock interrupt, we should not
call sched() when the process is not in "Running" state
as it is already committed to call sched() itself.
(An example is qlock(), just after the unlock() call).
As this is basically the same check as done in
preempted(), unify both and add a "clockintr"
argument to preempted().
Then most trap handlers just become:
preempted(irq());
Also, we do not want to call preempted() for traps,
as the trap handler has just setup some machine
state to resolve the trap. We can wait for the
clock interrupt if we really need the preempt.
On pnp(), just allocate descriptors and bring the controller
in a halted state.
Start the controller and dma in attach().
This prevents MAME from locking up when there is ethernet
traffic during bootup.
Before each arch had to implement the _privates array
themselves in assembly, which meant it was quite easy
for them to get out of sync. This cleans this up to be
a single enum and shares this initialization code.
we used to compare the symbol to nodret->s to see if
we got the return pointer, but this is wrong as
nodret is a OIND, pointing to a ONAME and therefore
sym would be nil.
instead, just compare the symbol string to ".ret".
Variables are lists, just as in rc,
so preserve emptry strings ('')
in variables properly: FOO='' bar baz
should result in FOO=('' bar baz) in
the environment, while FOO=
becomes a emptry list FOO=().
Get rid of the Evy struct, the environment
can be represented as just an array
of Symtab pointers, also meaning the
value can never be out of sync.
Embedd the name string in Symtab struct.
It is immutable and dont require
the caller to strdup() the name.
Make Word's immutable, embedding the
string value in the Word struct.
This avoids alot of extra allocations.
Provide a Strdup() function that handles
allocation error.
Handle variable overrides from the
command line internally, avoiding the
maketmp() file.
When executing a recipe, pass the body
using the -c flag to rc, avoiding
a pipe() and fork(). This also has
the advntage that rc can optimize the
script as it sees it in its entirety
and avoid fork() down the line.
Make sure not to leak file-descriptors
into sub-processes.
Do an attempt at freeing memory
(mostly for Arc's and environment values).
Maintain a QLock.pc and RWLock.wpc field which is
the callerpc() of the last owner of the qlock/wlock.
The previous patch that set QLock.use.pc was
kind of nonsensical as it will get overridden
by the next attempt to acquire the qlock.
> this fixes multicast on hypervisors without a command queue
> for the ethernet interface, like OpenBSD.
> Right now the driver does not install a multicast function when
> no command queue is ava> ilable.
> This breaks multicast because the network stack errors out in
> netif.c:netmulti.
> To fix this, move the check for the queue to the multicast and
> promiscuous functions and install those functions unconditionally.
SMB 2/3 is not supported by cifsd, so clarify that in the man page and update teh code to mention in the log file if SMB2/3 is attempted. Also, while in the code, fix a typo, add a few more commands to the explicitly unsupported list, and align the return value for unsupported calls to the SMBv1 spec.
Keeping the PC for the qlock call isn't very useful,
since it's always going to be the same PC. Instead,
set the Lock's pc to the pc of the QLock locker.
On 64-bit platforms, when the index being 32-bit unsigned,
any calculation there must be done modulo 2^32,
but rearranging the factors into the address calculation
is done in signed 64-bits yielding the wrong index.
In constrast to .safe, the .ret variable can
be registerized just fine which can avoid
some quite ugly code in functions manipulating
a returned struct.
This also fixes the sparc and 68020 libc, since their mkfiles
referenced a dummy cycles.c that was never in their subdir.
Likewise while the 68000 libc would build, linking a program
against it would fail due to missing a _tas implementation.
This copies the 68020 implementation to alleviate this.
The new TBZ/TBNZ instructions use imm14 displacement (±32K 4-byte
instruction aligned), so have to check constant pool more often.
Also, make the absolute pc value vlong.
As we want to keep applying dmat translations
when bypassing a wifi interface, make the
dmat handling code part of devether instead
of doing it internally in the wifi driver.
The wifi driver just needs to allocate and
assign Ether.dmat pointer.
when link-status on secondary is lost, always switch
back to the primary regardless of if it has a link.
this works around some ethernet driver not setting
link-status consistently and wifi's that might
only indicate a link when connected to an ap.
Recent realtek models will not send packets if rx/tx is enabled before
configuration is complete. Additionally, the RXDV gate should be enabled
to put traffic on the fifo instead of the DMA controller.
this follows OpenBSD's sys/dev/pci/if_rge.c and FreeBSD's sys/dev/re/if_re.c
When inserting an object into cache, we try to remove objects
from cache to keep the size below the limit. If the object is
larger than the cache, we try to unload not only every cached
object, but the object we're in the process of inserting.
This leads to an immediate unload of the object, which is very
wrong.