Commit graph

10350 commits

Author SHA1 Message Date
cinap_lenrek
1efad2d8fb bcm64: fix build caused by added bootargs file in arm64/ 2024-01-08 00:16:27 +00:00
cinap_lenrek
80f875fd92 devip: no more wandering routes
Before, it was possible to add routes before
the interface existed.

The routes would look for their interface lazily
as the route was looked up, but this leads to
all kinds of hard to explain behaviour when
a interface goes away and the routes start
wandering to a different interface on their
own which they will stick to when a new
interface comes up that would match the route
better.

Instead, we have routes always associated
to their desination interface and remove
the routes when the interface gets unbound.

It is no longer possible to add routes for
interfaces that do not exist.

This is easier to reason about behaviour as
well as allows us to get rid of canrlock(ifc)
in findipifc().

All routes inside the routing tree are now
by definition up-to-date (as long as we
hold the routelock).

Callers of v4lookup()/v6lookup() still should
check if the ifcid of the interface still
matches the route once they have acquired
the interface lock.
2024-01-07 23:39:29 +00:00
Keegan Saunders
57fc95de3c arm64/qemu: add xhci usb
To use, add the QEMU XHCI PCI device:

	-device qemu-xhci,id=xhci -device usb-tablet,bus=xhci.0
2024-01-07 21:10:57 +00:00
Keegan Saunders
1fe150f1ed arm64/qemu: detect VM configuration
Now, *maxmem and *ncpu are not required to be provided.
They will be detected automatically from the QEMU device
tree. Further, >4GB memory configurations are also supported.
The maximum number of CPUs is 16 for now, and the maximum
supported memory is 16GB
2024-01-07 19:57:50 +00:00
cinap_lenrek
23f34184d6 ip/ppp: increase echo timeout to 5 periods (25 seconds)
I get every hour a delay of the echo replies for as
long as 20 seconds causing reconnects.

It does recover however and sends all the replies
eventually.
2024-01-07 05:12:08 +00:00
Jacob Moody
74c1f4730b 6?, 8?, libc: add JMPF instruction
In 6? and 8? JMP works a bit uniquely,
when passed a function name it always encodes
as a JMP* instead of a JMP. This means

JMP myfunc(SB)

always assume that myfunc is a function pointer, not
a function itself. The new JMPF instead has the same
semantics as CALL and matches B and JMP in other
assemblers. This allows for a small optimization in
our 386 and amd64 entrypoint by avoiding a jump between
_main and _callmain.
2024-01-07 03:04:35 +00:00
cinap_lenrek
7a503757b1 vncs: bind devswap also for memory(1), this used to be in devcons 2024-01-06 21:14:25 +00:00
cinap_lenrek
dc593372bf nusb/audio: name audio device as audioUxxxx/volumeUxxxx (thanks arne)
This allows having multiple audio devices.
2024-01-06 19:55:38 +00:00
cinap_lenrek
5e370061e0 mixfs: allow switching between audio devices (/dev/audio*)
At startup, look for audio devices like /dev/audio*
and open the first one that shows up.

We allow to later changing the audio device using
the new "new" control message to /dev/audio.

Only devices named /dev/audio*, #u/audio* and #A/audio*
are allowd so far to prevent accidents.
2024-01-06 19:40:00 +00:00
cinap_lenrek
3d706f9621 ip/ppp: lower echo timeout to 2 periods (10 seconds)
it usually never recovers...
2024-01-06 19:32:53 +00:00
cinap_lenrek
8b19c4f273 9nfs: fix rfork() race with shared pid variable 2024-01-05 07:10:58 +00:00
cinap_lenrek
e80c7eb50b cifs: fix rfork() race with shard pid variable 2024-01-05 07:07:53 +00:00
cinap_lenrek
ee2174eb6d telco: fix rfork() race for pid 2024-01-05 07:02:25 +00:00
cinap_lenrek
8d2b84747b ip/ppp: fix race condition with rfork()
ipinprocpid is static so shared with parent and child,
so we need a temporary variable on the local stack
to properly assign ipinprocpid.
2024-01-05 06:46:35 +00:00
cinap_lenrek
2ca3934809 ip/ppp: remove -> del 2024-01-05 05:48:37 +00:00
cinap_lenrek
e48a5c343d imx8: the mpid should not contain other bits from MPIDR_EL1, only the AFF bits
By looking at ATF, it seems only the affinity bits are
expected here, no MT bit.
2024-01-05 02:45:01 +00:00
cinap_lenrek
eaffa1ef55 kernel: fix EDF scheduler double ready() and more robust double-ready detection
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.
2024-01-05 02:12:42 +00:00
cinap_lenrek
39321d74d8 kernel: never do sched() in unlock() when not in "Running" state.
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.
2024-01-05 01:58:37 +00:00
cinap_lenrek
381da3192f kernel: fix typo in sema assert= vs == (thanks moody) 2024-01-04 05:07:52 +00:00
cinap_lenrek
e38d42b4a7 kernel: handle errors in semacquire
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.
2024-01-04 04:49:33 +00:00
cinap_lenrek
16c1cc99ec kernel: .... aaand devswap :) 2024-01-04 04:46:30 +00:00
cinap_lenrek
feda4b1ed2 kernel: add extra "New" process state to catch invalid state transitions
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.
2024-01-04 04:45:56 +00:00
cinap_lenrek
f16547d604 kernel: forgot portfns.h from last change 2024-01-04 04:35:12 +00:00
cinap_lenrek
29e9c7bf01 kernel: don't sched() for clock interrupt when up->state != Running
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.
2024-01-04 04:33:29 +00:00
cinap_lenrek
02015f69f6 kernel: make sure process is in Queueing state in qunlock() 2024-01-04 04:22:04 +00:00
cinap_lenrek
692023ee08 etherseeq: defer enabling controller until attach(), provide shutdown() function
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.
2024-01-02 23:51:22 +00:00
adventuresin9
5de941cbcf mt7688/uarti8250.c; fixed interrupts 2024-01-02 04:54:30 +00:00
cinap_lenrek
f62e54b13d sgi: make newport graphics work in MAME
MAME doesnt support RGB Map 1 mode so use RGB Map 0 instead.

Hardware cursor is screwed up too, so just implement
software cursor for now.
2024-01-02 02:06:08 +00:00
cinap_lenrek
59d4a6261f ip/dhcpd: don't override local address for gateway case 2024-01-01 21:14:28 +00:00
cinap_lenrek
f0ac2d0176 sgi: fix botched conversion to stacks below Proc. 2024-01-01 02:35:13 +00:00
Jacob Moody
a0c7560782 libc: add _callmain to share more initialization code
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.
2023-12-31 23:58:47 +00:00
cinap_lenrek
fb1eadf6ed /sys/lib/acid/kernel: fix proctab() 2023-12-31 19:23:22 +00:00
cinap_lenrek
835db8f796 7l: dont dump constant-pool in the middle of switch/case jump table 2023-12-31 17:00:05 +00:00
cinap_lenrek
069fd98950 ?c: fix nodret check
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".
2023-12-29 16:38:04 +00:00
cinap_lenrek
caec06be08 qc: fix crash, nodet not nused/initialized 2023-12-29 03:56:56 +00:00
cinap_lenrek
94b1d3f0ad mk: Various improvements
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).
2023-12-28 18:10:41 +00:00
cinap_lenrek
6b0150764c rc: handle Xeflag in exitnext() 2023-12-27 23:07:06 +00:00
Ori Bernstein
37a8fc6168 ref: check if object is a commit when needed 2023-12-23 22:24:07 +00:00
Ori Bernstein
abc6e8ee6b git/log: ensure we're starting to log from a commit hash 2023-12-23 19:59:25 +00:00
cinap_lenrek
044d3e74eb kernel: add pc field in QLock for debugging
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.
2023-12-22 18:28:25 +00:00
rodri
858893ff8f libgeometry: fix typo from previous commit 2023-12-20 11:38:22 +00:00
rodri
e94d21ee3a libgeometry: add matrix minor and cofactor functions 2023-12-20 11:27:36 +00:00
cinap_lenrek
34e7b54c13 ethervirtio: make multicast work (thanks Arne)
> 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.
2023-12-19 19:41:07 +00:00
cinap_lenrek
2c8181eed7 ip/cifsd: dont add pointless logging (already logged when debug is active) 2023-12-18 18:03:37 +00:00
Romano
0e96985e12 cifsd: clarify SMBv1 is supported, not SMB 2/3.
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.
2023-09-28 06:34:09 +00:00
Ori Bernstein
5e336b9d96 qlock: keep the caller pc in the qlock for debugging
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.
2023-12-18 00:42:47 +00:00
cinap_lenrek
e33798c7e0 cc: don't rearrange constant scaling across unsigned casts
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.
2023-12-12 20:58:59 +00:00
cinap_lenrek
e74a87d537 ?c: allow registerizing .ret (thanks rodri)
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.
2023-12-12 20:42:20 +00:00
cinap_lenrek
ef1b1e159b libmach: add TBZ and TBNZ instructions for arm64 2023-12-12 19:30:31 +00:00
Jacob Moody
3613f5061b libc: deduplicate fake cycles() imeplementation to port/
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.
2023-12-11 18:42:31 +00:00