Commit graph

10328 commits

Author SHA1 Message Date
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
cinap_lenrek
85d0f0e1a2 7l: fix constant pool size for imm14 displacement for TBZ/TBNZ
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.
2023-12-10 23:51:54 +00:00
cinap_lenrek
e4191b8d11 devether: handle bypass case for dmat 2023-12-09 17:32:07 +00:00
Jacob Moody
9d09242bee date: remove reference to dead -m flag (thanks Thim Cederlund) 2023-12-08 19:37:49 +00:00
cinap_lenrek
8d9a4e1502 devether: make dmatproxy part of devether
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.
2023-12-07 16:23:04 +00:00
cinap_lenrek
f28d61ca22 aux/wpa: continue trying to connect when forked
The "auth" write can fail when the AP reboots or
vanishes temporarily. Don't sysfatal and continue
trying to connect.
2023-12-07 15:15:40 +00:00
cinap_lenrek
3f0f52ab69 ether4330: dmat support
move dmatproxy() function in its own module so we can use it
independently of wifi.c.
2023-12-07 14:50:09 +00:00
cinap_lenrek
7137060d85 ethermultilink: ignore link-status of primary
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.
2023-12-07 14:48:49 +00:00
cinap_lenrek
b8604dd760 ether4330: set link status, omit "status:" line from ifstats for aux/wpa when bypassed 2023-12-07 14:43:23 +00:00
cinap_lenrek
b388488ab6 ether4330: ignore join request while bypassed 2023-12-06 15:50:09 +00:00
Ori Bernstein
0231537cba ether8169: fix rx/tx on more recent realtek models (thanks uramekus)
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
2023-12-04 17:31:54 +00:00
Ori Bernstein
73ffc757d5 git/fs: don't unload large objects when inserting into cache
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.
2023-12-02 21:08:52 +00:00
Jacob Moody
b07a6e33bd /lib/terry: speak no ill of the dead 2023-12-02 18:16:14 +00:00
qwx
4573bb5550 git(1): conform NAME to indexing assumptions
- putting the dash and label on their own line breaks an assumption
  in /sys/lib/man/secindex
- /sys/man/1/INDEX will then have an entry '^ git$' instead of
  '^git git$'
- if by luck or by being deuteron man is passed the argument '-?',
  it is interpreted as a query, not an option
- '^-? ' is searched for and matches the ' git' line
- man -? (or '-?') displays git(1) instead of erroring with
  'no manual page'
2023-12-01 19:23:39 +00:00
rodri
ad7120b2e2 6[acl], libmach: add 3-byte opcode encoding support for SSE[34] along with some instructions 2023-11-29 21:04:59 +00:00
Aidan K. Wiggins
6ecb921719 nusb/ether: implement link status for a88179
In addition to a179linkstatus(), there is now proper link detection on
start, and the phy no longer auto powers off when not talked to.
2023-11-06 08:55:54 +00:00
Jacob Moody
1633e20b32 ip/torrent: allow seeding files from read-only contexts.
Makes 'auth/none ip/torrent -s ...' work without making
the files world writable iff we already have all pieces
of the torrent.
2023-11-26 20:23:45 +00:00
Jacob Moody
cbf003434b ip/torrent: fix webseed when there is only one defined in the torrent file 2023-11-26 14:03:31 +00:00
cinap_lenrek
99e2d549e8 libndb: do some extra robustness checks around hash files
- make sure the hash-file has non-zero hlen field (avoid division by zero)
- bound the chain walking by hlen, so we wont end up in a infinite loop
- always check for NDBNAP (nil) pointer while walking chain
- verify chain pointers (must be multiple of NDBPLEN and not overlap hashtable)
2023-11-25 19:08:21 +00:00
cinap_lenrek
e8242918f4 ndb/mkhash: handle database= reordering, check offset overflow, remove file
when opening /lib/ndb/local, the db returned is the first entry
in the database= tuple, not the file passed to ndbopen(),
so search for the file in question.

make sure the file-offset doesnt exceed the NDBSPEC bit (23-bit).

remove the created hash file on error, and set TMP bit.
2023-11-25 19:04:01 +00:00
Ori Bernstein
970d3b7eb7 git/walk: skip all paths with '.git/' when creating the index 2023-11-22 19:48:58 +00:00
rodri
474c03a439 libmach: add HSUBPD decoding for amd64
reference: https://www.felixcloutier.com/x86/hsubpd
2023-11-22 18:17:21 +00:00
rodri
57f22f910c libmach: add DPPD decoding for amd64
reference: https://www.felixcloutier.com/x86/dppd
2023-11-22 13:37:34 +00:00