Commit graph

10034 commits

Author SHA1 Message Date
qwx
6dc60ec3a9 qcowfs: add 9p debug flag 2024-08-05 22:23:51 +00:00
Ori Bernstein
f0ef1a4be0 git/fs: don't allow walking blobs 2024-08-05 07:12:37 +00:00
Sigrid Solveig Haflínudóttir
4c6701041e vt: skip over vertical line marks (Contour terminal) 2024-08-05 01:35:19 +00:00
sl
91916b6896 /sys/games/lib/fortunes: redaction day 2024-08-02 03:06:08 +00:00
aap
d6d02abde5 libframe: always draw tick with current TEXT color. 2024-08-01 14:51:00 +00:00
Jacob Moody
9c0f4aa0e5 9p(2): typos
The changes from british to american spelling here follows
what spell(1) thinks, and seems to be more common based on
other manual pages.
2024-08-01 14:33:32 +00:00
qwx
f00a88b509 /sys/lib/dist/ndb/common: add hjgit port, remove unused 2024-08-01 14:31:59 +00:00
Ori Bernstein
462464ff4a ape/patch: also kill ape/patch 2024-07-30 17:36:02 +00:00
Ori Bernstein
76fe6e9693 ape/diff: one more ancient, unmaintained, buggy gnu utility gone 2024-07-30 17:13:21 +00:00
Ori Bernstein
2a47e4f086 hgfs: use merge3 2024-07-30 17:12:03 +00:00
Ori Bernstein
2dc68de342 git: use native merge3 program instead of ape/diff3 2024-07-30 01:55:29 +00:00
Ori Bernstein
0136b08a10 merge3: fix exit conditions -- l, r are never nil 2024-07-30 00:42:51 +00:00
Ori Bernstein
c409b9127d gefs: correct in-memory directory length for DMAPPEND files (thanks cinap)
when appending to a directory, the copy of the offset in the dent was
set to the offset that the write was supposed to happen at -- however,
for DMAPPEND files the offset is always at the end of the file. Until
the file was closed, stat would show the wrong directory info.
2024-07-29 00:37:33 +00:00
Jacob Moody
821e6690d3 2l(1): add 7l and 9l 2024-07-28 20:41:59 +00:00
Jacob Moody
f9212297bd 2c(1): add 9c 2024-07-28 20:17:16 +00:00
cinap_lenrek
67b0aeb219 ipmux: implement hangup ctl
Implement a hangup ctl command that flushes the
queues, but keeps the filter around.

This can be usefull for low-overhead traffic blocking,
as only the file-descriptor needs to be kept around
and the queues can be flushed.

No user-space process is needed to consume packets
and no buffers are wasted.

example:

aux/dial -e -o hangup 'ipmux!ver=4;src=8.8.8.8' rc -c 'echo 0 > /srv/blocked'

rm /srv/blocked
2024-07-28 19:40:54 +00:00
Ori Bernstein
460b007c35 gefs: we need an agetv for the qgen on 32 bit systems 2024-07-28 16:26:33 +00:00
cinap_lenrek
75ac2674de devip: do not raise error from ipoput*()
It seems some protocols are unprepared to
deal with ipoput*() raising an error
(thrown from ifc->m->bwrite()).

so catch it and return -1 (no route) instead.
2024-07-28 00:32:14 +00:00
cinap_lenrek
520d698c3e devip: same for loopbackmedium... 2024-07-27 22:22:55 +00:00
cinap_lenrek
c91d99c5de devip: dont shoot the messenger (dont unbind the interface when ipipu4/ipiput6 errors)
The medium should only self-unbind when we get a read error
from the device, not when ipiput4/8() throw an error,
which can happen for the nullmedium.
2024-07-27 22:03:48 +00:00
Ori Bernstein
439a525113 git: rewrite entcmp to be single pass, less stupid
move to single pass strcmp variant that knows about trailing '/' rule.
2024-07-27 15:36:23 +00:00
Jacob Moody
605bed312a devip: fix masks in ipmux filters
We were accidentally searching the key for '&', instead of the value.
Inferno received this exact fix at some point, but it never made it back to Plan 9.
2024-07-26 22:03:34 +00:00
Ori Bernstein
5ae675bebd libmp: sidestep git bug for now
the installed version of git has a bug; removing
this file will trigger some spurious removals of
test files, so hold off deleting it until people
have time to install a fixed git
2024-07-26 03:01:56 +00:00
Ori Bernstein
5eb5831b05 git/query: use git entry sorting when computing dir diff
directories need to sort as though they end with a '/',
when running through them for comparison, otherwise we
flag files as added and removed spuriously, leading to
them incorrectly getting deleted when merging commits.
2024-07-26 02:44:21 +00:00
Ori Bernstein
c220d0acc6 libmp: remove stale test file
we moved it to test/, so no need for the
old one.
2024-07-25 00:10:51 +00:00
cinap_lenrek
42940399b8 kernel: use flag and integer to handle affinity
Instead of Proc { Mach *mp; Mach *wired; },
track affinity by an integer representing
the mach number instead.

This simplifies the code as it avoids needing
to compare with MACHP(m->machno).

Wiering a process to a processor is now done
by just assigning affinity and then set a flag
that it should not change.

Call procpriority() when we want to change
priority of a process instead of managing
the fields directly.
2024-07-24 19:55:42 +00:00
Ori Bernstein
487c2dc215 git: provide symref extension 2024-07-23 23:42:59 +00:00
cinap_lenrek
703bcae2ed kernel: only reset processor affinity p->mp when p->wired == nil 2024-07-23 22:29:13 +00:00
cinap_lenrek
cbbce6b301 ip/ipconfig: fix logic bug (thanks cgnarne)
We must not skip conf.preflt == 0 (only conf.validlt == 0)
so that we can change the kernels preflt timeout.
2024-07-23 21:35:51 +00:00
cinap_lenrek
2076c934d0 kernel: make schedinit() _Noreturn void 2024-07-23 21:23:26 +00:00
cinap_lenrek
8a6c61c8ef kernel: remove global balancetime variable -> make function static 2024-07-23 21:03:08 +00:00
cinap_lenrek
4a7c44fee4 kernel: improve nlocks print in sleep() 2024-07-23 21:00:04 +00:00
cinap_lenrek
f1e7d6da67 kernel: sched() should not imply spllo()
The idea is:

When we call sched() with interrupts disabled,
it must not return with them re-enabled.

The code becomes easier to reason about if
we make sched() preserve interrupt status,
which lets us call sched() from an interrupt
handler (with interrupts disabled) without
risking preemption by another interrupt once
sched() returns which can pump-up the stack.

This allows removing Proc.preempted flag as
it is now impossible for interrupts to
preempt each other in preempted().

Extra cleanups:

make interrupted() _Noreturn void
and remove unused Proc.yield flag.
2024-07-23 19:50:36 +00:00
cinap_lenrek
fc859af624 etherimx: fix missing barrier for doorbell (thanks sigrid)
the symptom is that ping is apparently skipping
transmits which recover with the next send,
resulting in exactly send-period spikes in
the ping rtt.

It appears that the core seems to reorder writes
to uncached memory, which can result in the doorbell
being written before the descriptor status bits
are written.

put a coherence() barrier before writing doorbell
fixes it.

thanks sigrid for reporting the issue!
2024-07-21 17:35:18 +00:00
cinap_lenrek
3598b7cf36 kernel: hack processor affinity to allow load sharing
On a multiprocessor, the scheduler can run into
a very unfair distribution of processes to cpus
when there are more long-running processes than cpus.

Say we have a 4 cpu machine and we run 4 long-running
proesses, each cpu will pick up a single process
and each process will get 100% of its fair share.

Everything is good so far.

If we start more long-running processes, all these
processes are going to be picked up by the cpu core
that runs most sporanic / bursty work loads as it
is calling sched() more often.

This results in all the extra long-running prcoesses
to cluster around the same core resulting in very
unfair sharing of load.

The problem is that once a process runs on a cpu,
it stays on that cpu as processor affinity
is never reset.

Process migration only happens when a cpu cannot
find any process to run, given the affinity
constrains, but this can never happen when
the system is under full load and each cpu
always has a low-priority long running
process to run.

How do we fix this?

The idea of this hack is to reset processor
affinity in ready() when its priority changes or,
when it appears to be a long-running process.

That way, we give every cpu a chance to pick
it up and share the load.

This is not a ideal solution of course. Long term,
we should probably have separate runqueues per cpu
and do the balancing explicitely.
2024-07-21 13:44:18 +00:00
cinap_lenrek
11cd33bcec kernel: make fixedpri work.
Fix and document the "fixedpri" control.
2024-07-21 13:00:48 +00:00
cinap_lenrek
706b44c15d kernel: fix wrong updatecpu() context regression
In the sched() function, the call to reprioritize()
must be done before we set up, as reprioritize()
calls updatecpu(), which determines if the process
was running or not based on p == up. So move
the call to runproc() itself.
2024-07-21 12:44:23 +00:00
Ori Bernstein
b0d33c09ff gefs: more/stricter asserts and checks 2024-07-19 20:37:11 +00:00
Ori Bernstein
108f94b25a gefs: set super dir in Qadm correctly
gefs: ream uplink for root dir in adm correctly
2024-07-19 20:13:46 +00:00
Ori Bernstein
6a049aafed history: add support for gefs dumps 2024-07-18 16:49:31 +00:00
Ori Bernstein
1ca26f9924 gefs: work around 8c bug
8c doesn't like assigning struct literals with vlongs
into array indexes, so work around it for now.
2024-07-18 16:25:46 +00:00
Ori Bernstein
0956f48633 git/commit: filter to changed files for git/save
while rehashing the same files over and over will work
just fine, it can be slow with a large number of large
files; this makes 'git/comit .' perform much better in
repos with a large number of large binary blobs.
2024-07-18 13:13:42 +00:00
Ori Bernstein
338e78a024 gefs: dump dirs are dirs too
even if they're down in the dumps
2024-07-17 21:48:15 +00:00
Ori Bernstein
48edf79c69 gefs: modifying a directory should update qid.vers 2024-07-17 15:07:11 +00:00
Ori Bernstein
201fe8de4b gefs: change log compression heuristic
compress when the log doubles in size, rather than
using a fixed size heuristic; this means that we
don't start compressing frequently as the log gets
big and the file system gets fragmented.
2024-07-08 03:29:40 +00:00
Ori Bernstein
a19d90dc8c gefs: fix allocation log compression
We could overwrite the log tail when compressing the
allocation log; this would be bad. Stop doing that.
2024-07-08 03:23:40 +00:00
rodri
1442891a3e samterm: avoid division-by-zero when $tabstop is zero or empty
this happens in libframe:

	/sys/src/libframe/frutil.c:80: 	x -= (x-f->r.min.x)%f->maxtab;

but there's no way to control when the user changes the
maxtab value, so it's samterm's responsibility to
sanitize it.
2024-07-16 11:29:49 +00:00
Ori Bernstein
51c899ca01 bio(2): fix formatting 2024-07-14 19:49:00 +00:00
Ori Bernstein
ee51c91f6f gefs: copy mode down on create, don't truncate walks with no DMEXEC
we were copying the owner and group of the parent dir into the fid
on create, but we forgot the mode; fix that, so that we don't check
perms against the wrong dir.
2024-07-13 15:55:37 +00:00
mkf
23e7a57172 rx: add ssh 2024-07-04 20:26:20 +00:00
sl
79822e96dc /sys/src/9/pc/audiohda.c: add vid/did for Intel Tiger Lake 2024-07-07 21:42:30 +00:00
Ori Bernstein
f628dc850d gefs: temporarily disable log compression
There are some bugs with fixes in progress, but
let's not take any risks while those fixes are
in flight.
2024-07-02 02:55:55 +00:00
Ori Bernstein
ed73544be6 gefs: remove useless cachedel
copy paste error
2024-06-27 05:17:05 +00:00
Ori Bernstein
2350b08401 gefs: remove trace noise
this pushes useful entries out of the ring.
2024-06-23 15:33:09 +00:00
qwx
a71a76745b etheriwl: add support for 3168 2024-06-25 19:08:54 +00:00
Sigrid Solveig Haflínudóttir
9b5d186746 it kbmap: more mapping fixes (thank shura)
The Italian keyboard layout is ISO, and unlike the ANSI layout,
it has an extra key between Shift and Z, and the key above Enter,
which becomes vertical, is moved to the bottom left of it.

 - the key between Shift and Z is mapped to `<`, and shift+`<` is mapped to `>`
 - the old `>` (at the bottom left of Enter) is mapped to `ù`
 - shift+`ù` is mapped to `§`
 - the old shift+`"` is mapped to `°`
 - altgr+`'` is mapped to backtick
 - altgr+`ì` is mapped to `~`
 - altgr+`e` is mapped to `€`
 - shiftaltgr+`[` is mapped to `{`
 - shiftaltgr+`]` is mapped to `}`
2024-06-25 15:52:36 +00:00
Emery Hemingway
2760eef549 kbmap: add Workman layout 2024-01-22 11:13:14 +00:00
Sigrid Solveig Haflínudóttir
c05ee321f8 it kbmap: fix > and < (thanks NeuraL) 2024-06-25 13:23:06 +00:00
mia soweli
f43c301827 9/pc: Remove unused lm78 driver
This seems to have been around but not compiled since the third edition.
Remove it and the accompanying SMBus machinery that is only used
for this driver.
2024-06-24 20:22:31 +00:00
Ori Bernstein
6b5d2ac468 gefs: weaken overzealous assert
When modifying a sparse file, it's possible to get
clobbers and clears to item s that don't exist; in
this case, we try to apply to an empty kvp, and
assert -- we should just not apply.
2024-06-23 14:26:44 +00:00
Ori Bernstein
107a7ba971 git: allow longer authors in commits
there are git repos where the author line is longer than
128 chars; bump our limit up.
2024-06-19 17:42:52 +00:00
Sigrid Solveig Haflínudóttir
c9a153088d sam(1): ^ does not take any range 2024-06-17 22:03:20 +00:00
cinap_lenrek
68b4a8e6ef cc: logical operations (& | ^) operate on integers only (thanks sigrid)
void
main(void)
{
	uchar a[3];
	float f = a[2] | a[1] | (a[0]/1.2);
	USED(f);
}

the code above used to generate impossible
code in the linker like:

main: doasm: notfound from=34 to=35 (872)	ORL	X0,X1
main: doasm: notfound from=34 to=35 (872)	ORL	X0,X1
main: doasm: notfound from=34 to=35 (872)	ORL	X0,X1

with the change, the compiler correctly rejects it:

incompatible types: "UINT" and "DOUBLE" for op "OR"

i assume the BNUMBER in the type matrix must have been
a oversight.
2024-06-17 20:31:01 +00:00
Sigrid Solveig Haflínudóttir
12ad6dffeb sam: make X/.../b work 2024-06-16 15:58:07 +00:00
mia soweli
3d6deb3f69 9/port: make sure MSI-X is off before enabling and disabling MSI 2024-06-16 14:22:58 +00:00
cinap_lenrek
82f44b3ffc ip/ipconfig: properly handle ipv6 address deprecations
do not add default route when address is
deprecated (preflt == 0).

delete previous default route on router change.

implement rfc4862 section 5.5.3 processing rules
in regard to remaining valid lifetime.
2024-06-15 17:20:45 +00:00
Romano
0dc37f9794 dhcpd(8): typos 2024-06-10 04:42:52 +00:00
Ori Bernstein
16369de87d gefs: correctly set duid/dgid on Tcreate
we were updating the dir that the fid pointed
to, but not updating the parent uid/gid.
2024-06-09 14:40:40 +00:00
cinap_lenrek
f3ee064802 ip/ipconfig: ask devip to delete expired ipv6 prefixes (thanks arne)
In addition to removing expired default routes,
ask devip to clean out expired addresses as well.

In the future, devip might do something more
sophisticated than just checking the valid life time
like also considering if the address is still begin
used by active connections.
2024-06-09 13:02:06 +00:00
Ori Bernstein
c91e9322f1 gefs: only start epochs for console procs that need them
we shouldn't need to defer reclamation for procs that
don't actually interact with the tree directly, especially
since if they send on a channel they can stall for a while.
2024-06-08 16:21:16 +00:00
Ori Bernstein
5e6f3db0d7 gefs: fix deadlock between epochclean and truncwait
epochclean should not hold the mutation lock, which
should allow procs within an epoch to make progress
and end their epoch.
2024-06-08 16:02:11 +00:00
Arne Meyer
0db5d2bdd6 nusb/ether: fix typo in previous commit 2024-06-07 21:30:15 +00:00
Arne Meyer
43166ed050 nusb/ether: Don't pass ethernet fcs to the network stack for smsc and lan78xx 2024-06-05 09:22:31 +00:00
Ori Bernstein
f9b061c9bd gefs: bring back write cancellation for free blocks. 2024-06-07 14:50:05 +00:00
Ori Bernstein
f91852c653 gefs: improve flow of blocks/frees
This change covers three improvements:
- inline the limbo entry into the objects
  being freed, meaning we don't need to
  allocate, and thus can't fail to free
  an object when we're out of memory
- Preallocate Bfree objects, for the same
  reason above.
2024-06-07 14:41:15 +00:00
qwx
dd4b1abbe6 gs: ignore more autogenerated headers
the build process could be cleaned up a lot more.  the default.*.h headers are
basically only used in cross-compilation, but every usable arch has its default
header already, so all the mkfile effectively does is copy it to $objtype.h.  it
would perhaps make more sense to just run mk on any new arch and copy to a new
default.$objtype.h and get rid of a lot of this stuff.  but then it's not really
worth messing with this further, so leaving it as is.
2024-06-06 23:05:42 +00:00
qwx
aad45634c8 gs: don't track autogenerated header (thanks James) 2024-06-06 10:35:37 +00:00
Ori Bernstein
8c046fe451 gefs: revert cacheflag()
it seems likely that it was causing writeback
bugs, revert until further testing, and likely
move to a different approach.
2024-06-04 17:49:49 +00:00
Sigrid Solveig Haflínudóttir
005bd2b7e1 sam: M: don't require a current file to operate (thanks umbraticus) 2024-06-04 14:27:41 +00:00
Ori Bernstein
8759403bdb gefs: fix file truncation performance (thanks cinap)
We were inserting very oversized deletion messages when
removing a file, instead of inserting the right size
message. This also batches the insertions, reducing the
number of upserts.
2024-06-02 19:52:12 +00:00
Ori Bernstein
5c0670bfae gefs: remove vestigial bucket lock
it was doing nothing
2024-06-02 18:53:43 +00:00
umbraticus
828c577e03 sam: introduce a new command M for adding commands to mouse b2 menu 2024-06-01 22:55:26 +00:00
Jacob Moody
4e4bd869e9 9[cl]: correct previous changes
37e65b331b
Was to adjust the compiler to better match the ISA w.r.t.
subtraction, but was overzelous and rewrote all additions instead of
just those with constants.

5390130426
Intended to restrict compiler generated immediate operations to only
those of which can be encodable by the ISA.  However the check for
signed constants was incorrect and resulted in constants that do not
properly encode.

0c6fd079ce
Attempted to classify address literals to save on instruction
encoding, but this is actually not possible.  We have to walk the
program first to derive some of the constants (INITDAT depends on
etext) so we can not classify them here.  Instead we should just limit
address literals to 32 bits (with sign extension) as a worst case.  It
would be possible in the future to do a pass over to program later and
find address literals that only need one instruction instead of two
but this works for now.
2024-06-01 17:53:20 +00:00
cinap_lenrek
01e7d784df sdaoe: remove unfinished atapi code (thanks arne) 2024-06-01 16:14:25 +00:00
cinap_lenrek
40cb72e7f8 2c: fix indirect calls
The peeophole optimizer was removing MOVL R0, A0
instructions before BSR (A0) because copyu()
decided all registers are being written (because
function calls clobber the registers).

For indirect calls, the register operand must
be correctly reported as being used (and then
clobbered).
2024-05-31 21:04:41 +00:00
cinap_lenrek
865a0f43f1 hjfs: check mount spec (aname) in Tauth
Filesystems should ensure that the mount
spec (aname) is valid before handing out
an auth fid.

This avoids pointless authenticaiton
protocols being run just for the
mount later to fail.

This happens with our current /lib/namespace
file for the opportunistic line:

mount /srv/boot /n/other other
2024-05-31 20:50:41 +00:00
rodri
9bbbc13ce2 libgeometry: simplify rframes
i got rid of redundant code, and added routines
to get the xform matrix out of an rframe, so it
can be stored and used separately or as part of
a composition of xforms.

also replaced the big example in the man page for
more concise, useful ones.
2024-05-30 21:11:33 +00:00
Alex Musolino
33572bd895 sshnet: update usage text to match man page 2024-05-30 12:46:36 +00:00
Alex Musolino
31b7b7a75b sshnet(4): merge usage lines 2024-05-30 12:46:01 +00:00
Ori Bernstein
eddf77b8f9 gefs: revert the last commit; we added a deadlock 2024-05-29 23:53:41 +00:00
Ori Bernstein
dd82b07a86 gefs: correctly serialize updates to mounts
we don't need a lock free list, we just need an
rwlock; this isn't a high contention data structure.
2024-05-29 19:34:14 +00:00
Ori Bernstein
79323e05d1 gefs: make dent cache per-mount
with a global dent cache, directory entries from different
trees can be cached. This almost works, but QID state can
change as the files get modified -- ownership, permissions,
and similar can get changed.

A global mount cache means that changes to a qid may leak
across mount boundaries. Don't do that.
2024-05-29 17:12:21 +00:00
Ori Bernstein
04d0d77e4b gefs: improve 'print fid' on cons 2024-05-28 14:45:01 +00:00
cinap_lenrek
68a98ec9d1 devip: don't send and ignore MLD messages for invalid multicast groups
RFC2710 states that MLD messages should never
be sent for scope 0 and 1 mcast addresses
as well as FF02::1.
2024-05-28 18:16:44 +00:00
cinap_lenrek
dc85e6d01a ipconfig(8): fix /net/null vs /dev/null (thanks humm) 2024-05-28 17:25:52 +00:00
Ori Bernstein
857d06b644 gefs: skip writeback on data blocks
when writing back data blocks, we didn't
read the data back from disk, and instead
just enqueued the block pointer; This means
that we don't have the Blk struct to set
the freed flag on, so we would commit every
IO operation to a data block.

This change opportunistically reaches into
the cache and flags the data block as dead,
so we can skip writeback.
2024-05-28 01:57:52 +00:00
Ori Bernstein
89017223e1 gefs: allow halting read-only file system
we would bail out of any adm op when we were in
read-only mode; we should really complain and
skip when we're not shutting it down.
2024-05-28 01:56:26 +00:00
sl
421057ca68 /sys/man/8/plan9.ini: document the existence of git.9front.org/plan9front/firmware (thanks, orib) 2024-05-27 23:59:22 +00:00
Ori Bernstein
1a1b1c4b6a git/clone: allow cloning into an empty directory 2024-05-27 15:02:28 +00:00
Ori Bernstein
45b5336f88 gefs: add command to show free ranges on console 2024-05-27 04:17:29 +00:00
Ori Bernstein
33b0e1bb81 users(6): it's not just older servers 2024-05-27 01:35:22 +00:00
Ori Bernstein
12bf41489c gefs(8): docment user creation commands 2024-05-26 23:39:07 +00:00
Ori Bernstein
469573c3fe gefs: avoid holding the wrlock when syncing the file system
we only need to enforce ordering or syncedness to disk when
writing out the blocks during sync, we don't need to prevent
mutation on the tree once the arenas and superblock are
serialized.
2024-05-26 22:01:41 +00:00
Ori Bernstein
843b2168c6 gefs: tweak block address heuristic to sequentialize allocation
When churning through data blocks and writing out of order, we would
copy blocks and release them often, leading to gaps at the back of
the file. Retrying an allocation could also lead to allocating a block
in the same arena as the metadata.

This would leave gaps in the allocated files, which would cause seeks
when accessing the data later.

This set of changes allocates blocks that are expected to be accessed
sequentially from the start of the arena, and blocks that are expected
to be accessed out of order at the end of the arena.

For full data blocks (ie, where the write is at the end of the block),
we assume that the accesses will be sequential. For partial data blocks,
when the write offset is not at the end of the data block, we assume
that future appends are inbound, and we allocate the block in the non
sequential part of the arena. As a result, when we eventuall fill the
block, we will allocate the sequential block.

This doesn't help us too much if we have writes to files interleaved,
or we overwrite the same section of a file over and over, but it's
better than nothing.
2024-05-27 00:42:36 +00:00
Ori Bernstein
90d8e4d944 gefs: improve heuristic for arena selection 2024-05-27 00:17:35 +00:00
Ori Bernstein
80ed3922c3 gefs: use a single syncer proc to flush to disk 2024-05-27 00:11:26 +00:00
qwx
ded308e576 devsegment: don't use ulong as negative index
len is ulong, hence &l[-len] makes no sense.
&l[-(uintptr)len] and l - len are correct.

igfx uses a fixed segment to extend its memory when stolen memory is
insufficient for the requested mode.  this caused segment allocation
to always fail since no page in the loop would fall within the range.
modesetting then fails but the bottom of the screen stays garbled.
2024-05-26 02:02:29 +00:00
Ori Bernstein
8a2efea90c gefs: fix memory leak on nop syncs
when syncing a clean file system, we would leak
the sync messsage; stop doing that.
2024-05-26 03:05:20 +00:00
Ori Bernstein
ae8836d46a gefs(8): say some words about snapshots 2024-05-24 12:59:21 +00:00
Ori Bernstein
85ca0c9adc gefs: set gid correctly when creating directory entries 2024-05-23 03:28:38 +00:00
Ori Bernstein
95077e876a gefs: clean up blk logging code 2024-05-23 02:30:00 +00:00
Ori Bernstein
d7b6319891 gefs: add lock assertion for paranoia 2024-05-23 02:29:48 +00:00
Ori Bernstein
e6fa5a21f9 fs: acquire mutation lock around ORCLOSE upsert
only one upsert can go at once.
2024-05-23 01:51:11 +00:00
Keegan Saunders
5b13dcf68d boot: add honeycomb 2024-05-22 01:20:23 +00:00
Keegan Saunders
8e03baff8b add honeycomb kernel
This is a kernel for the NXP LX2160A, specifically the SolidRun
Honeycomb board which is available for sale on the SolidRun
website.

It currently boots on U-Boot. UEFI support is planned. Build or
download the U-Boot firmware from the SolidRun site and then write
it to the on-board SD card. Then, plug in a USB with the honeycomb
image and proceed to install as normal. Only NVMe or USB storage
is supported (SATA is planned).

This kernel supports PCIe and USB. On-board ethernet and SFP are
not supported (yet). It uses 2GB of memory by default, but that
can be increased using *maxmem depending on how much RAM you have
in the system. As well, SMP is currently disabled until an
uncommon deadlock issue is fixed (could be a hardware issue, unknown
at this point).
2024-05-21 23:54:48 +00:00
Ori Bernstein
5e34f6ae06 gefs: dump set of directory entry attributes 2024-05-21 14:17:59 +00:00
Jacob Moody
5ed2ea3310 mp(2): typos (thanks sirjofri) 2024-05-21 04:42:03 +00:00
Jacob Moody
a9d09ee1f1 webfs(4): typo around connection close (thanks halfwit) 2024-05-21 04:28:08 +00:00
Jacob Moody
5994b10942 /sys/src/cmd/test: enable zones.rc test (thanks unobe) 2024-05-21 04:27:27 +00:00
Ori Bernstein
796e4078d2 gefs: remove unused blk field 2024-05-21 01:34:43 +00:00
Sigrid Solveig Haflínudóttir
93da12e8aa nusb/audio: use correct buffer size for d2h requests, else some devices stalls 2024-05-20 22:26:42 +00:00
Sigrid Solveig Haflínudóttir
078d7a0281 nusb/audio: don't add a control if getvalues errored 2024-05-20 17:14:31 +00:00
Ori Bernstein
b2518fd92a fs: correct mode check for other group
we copied and pasted the structure of this from
cwfs, but they lay out the bits differently. We
fixed this for the other cases, but forgot this
one, which lead to exec being permitted when it
shouldn't have been.
2024-05-20 00:38:55 +00:00
Jacob Moody
17f7f6be4e /sys/src: cleanup power64 assembly 2024-05-19 20:57:04 +00:00
mia soweli
01140dbe17 gefs: convert to atomic instructions
8[al] now support the required atomics, so let's
stop using byte constants.
2024-05-19 15:35:55 +00:00
mia soweli
1b09060f46 8[al]: support XADD 2024-05-19 15:31:32 +00:00
mia soweli
1c7e58e75b 8[al]: support CMPXCHG and CMPXCHG8B 2024-05-19 14:54:06 +00:00
Ori Bernstein
61c6a24d35 gefs(8): small formatting fixes (thanks kvik) 2024-05-18 19:00:16 +00:00
Ori Bernstein
020b9bdd65 upas/smtp: add -C flag to disable thumbprint verification (thanks sirjofri) 2024-05-18 18:47:36 +00:00
Igor Böhm
6cd07cf340 gefs.ms: Minor fixes and improvements. 2024-05-16 22:16:45 +00:00
Ori Bernstein
037bc7b432 gefs: make it impossible for clunkfid to error
in out of memory situations, clunkfid could run
out of memory and error; preallocating moves the
error to fscreate/fsopen, which are prepared to
handle them.
2024-05-18 18:28:17 +00:00
Ori Bernstein
b2cd4959fe gefs: check name lengths before packing them 2024-05-18 18:26:38 +00:00
Jacob Moody
b37238edb8 vdiff: show filename instead of "/dev/null" when removing entire file 2024-05-18 18:07:46 +00:00
Jacob Moody
96c4dbca89 /sys/src/cmd: ?[cl] mkfile consistency 2024-05-18 17:21:43 +00:00
Sigrid Solveig Haflínudóttir
9c5fc1ce37 /sys/doc/mkfile: gefs 2024-05-17 13:12:20 +00:00
Ori Bernstein
b1e897ae44 gefs.ms: sycer => syncer (thanks sigrid) 2024-05-16 21:01:48 +00:00
Ori Bernstein
da1daf3012 gefs: initial import 2024-05-16 20:47:43 +00:00
Jacob Moody
94c69c4f68 9[acl], libmach: L?AR/ST?CCC 2024-05-14 18:26:29 +00:00
Jacob Moody
178cd4d113 9[acl], libmach: LWSYNC/CMPW/CMPWU 2024-05-14 01:54:07 +00:00
Sigrid Solveig Haflínudóttir
2734fa8545 riow(1): mention having to put the rc pipeline into its own script 2024-05-13 20:28:18 +00:00
rodri
ff6a0f490a tmdate(2): fix two little typos in the examples 2024-05-13 13:37:22 +00:00
cinap_lenrek
a74c7ca5ea ipconfig(8): document loopback and null media 2024-05-12 13:50:52 +00:00
cinap_lenrek
c76cc12a17 ip/ipconfig: add "null" verb to bind nullmedium
Example usage:

ip/ipconfig null /dev/mordor 8.8.8.8 /128
2024-05-12 13:42:26 +00:00
cinap_lenrek
0a7279b3af devip: make "null" medium bindable
It can actually be usefull to bind this dummy
"null" medium to an address, which gives a way to
divert packets towards it that should be discarded.
2024-05-12 13:39:58 +00:00
cinap_lenrek
11fa01778a devip: increase MTU to 64k for loopback medium
We should ever attempt fragmenting packets
towards the loopback medium.
2024-05-12 13:35:03 +00:00
phil9
025a2d172e vdiff: exit if diff is empty
currently vdiff will display an empty window if there is no diff.
	Print a message and exit early instead.
2024-05-09 17:18:45 +00:00
rodri
039015ad71 vdiff: fix scrolling and mouse button handling.
vertical scrolling now works in a line-wise manner,
just like in rio(1), sam(1) and friends. horizontal
scrolling showed problems with some line widths
where they got cut before showing the last
characters.

finally, pressing LMB or RMB and swiping while going
through any of the blocks caused a storm of plumbs
and visibility toggling (when over the expander line).
this doesn't happen anymore.
2024-05-09 11:49:09 +00:00
Jacob Moody
92d5d58784 flambe: pass correct name to initdraw() 2024-05-08 23:24:55 +00:00
Jacob Moody
88faa807aa flambe: flame graphs for prof(1) data 2024-05-08 18:01:08 +00:00
Jacob Moody
c8544c91d9 prof: increase precision of measurements
Currently we use millisecond ticks for time spent in each function.
This is not good enough for modern machines where fast functions could
be completed in a handful of nanoseconds.  Instead let us just use the
raw ticks and store the cyclecfreq in the output prof data.  This
requires that we enlargen the time section in the data to 8 bytes,
which broke the assumptions for struct allignment and required a
slight refactor of the code used to read it in prof(1).  Since this is
a breaking change, we've devised a small format to communicate the
version for future revision of this format and this patch includes a
modification to file(1) for recognizing this format.  Additionally
some minor improvements were made across the board.
2024-05-08 17:20:22 +00:00
phil9
0fcab2a6e8 vcrop: fix image panning 2024-05-07 10:43:36 +00:00
phil9
d11ca3b545 vcrop - graphical image cropping tool
vcrop is a graphical version of crop(1).
2024-05-06 16:24:25 +00:00
Jacob Moody
bd1305a0b9 libc: compress directly recursive functions while profiling
When a function calls itself, the execution slot of its child is now
just added to its own time.  This makes conceptual sense and also
reduces a big cause of depth inflation.
2024-05-05 01:57:22 +00:00
Jacob Moody
15d1425b27 libc: increase default allocation for profiling
Current profiling size was 128k, and causes more frustration than it
is worth as demand paging makes this cheap.  Assuming 64 bytes at
worst per Plink this will use ~16M of virtual address space on 64bit
systems.
2024-05-05 01:34:22 +00:00
Jacob Moody
f3216125de limbach: remove unused 9c subdirectory 2024-05-04 19:45:01 +00:00
cinap_lenrek
7aceac32e8 eqn: fix silly mkfile
prevy.tab.h not used at all, dependency between
y.tab.c and y.tab.h is just *WRONG*.
2024-05-04 19:38:39 +00:00
Jacob Moody
2b202ec918 libmach: clean up power64 tests 2024-05-04 17:45:36 +00:00
Jacob Moody
0ab44a0062 9c: copy warning from other compilers regarding pointer -> int truncation 2024-04-29 21:31:05 +00:00
Jacob Moody
bac935c71f 9a: mkfile was pointing to wrong header 2024-04-29 21:30:27 +00:00
Jacob Moody
418f36d7eb libc/libap: update power64 entrypoints to new _callmain standard 2024-04-07 01:27:08 +00:00
Jacob Moody
37e65b331b 9c/9l: do not have the linker rewrite OSUB to negative OADD
POWER does not provided subtract immediate functions and
instead rely on negative addition. It was such that the linker
was the one who would go through and rewrite these to be negative
but it really should be done in the compiler while we still have
the width information.
2024-04-07 00:13:41 +00:00
Jacob Moody
0c6fd079ce 9l: do consize check for SB relative as well 2024-04-07 00:01:30 +00:00
Jacob Moody
5390130426 9c: avoid generating immediates that make the linker use REGTMP 2024-04-06 22:13:54 +00:00
Jacob Moody
8483799d4a 9c/9l/libmach: handle 64 bit constants
* Add a handful of 64 bit classifications to 9l, along with instruction generation for each.
* 9c should avoid generating immediate instructions for 64 constants.
* libmach should know about 9l's generation to present a better disassembly.
* libmach now properly displays MOVD for moves between registers on 64 bit.
2024-04-01 05:20:20 +00:00
Jacob Moody
7f8bd35954 9l: add -H6 for elf targeting kexec 2024-03-27 15:54:10 +00:00
Jacob Moody
5fe33fb808 /sys/src: power64 target 2024-03-30 18:58:36 +00:00
Jacob Moody
0ec381a846 libmach: power64 vector mov and cleanup 2023-11-07 14:45:29 +00:00
Jacob Moody
39c021fbc1 /sys/lib/acid: add power64 2023-11-04 20:52:35 +00:00
Jacob Moody
4cdad07b98 9c: mind which CMP is used when handling constants 2023-11-04 20:51:19 +00:00
Jacob Moody
fe53c0930e libmach: power64 catch up 2023-11-03 15:34:48 +00:00
Jacob Moody
7b63c05b21 9c: allow switches on 64bit values 2023-10-01 23:18:23 +00:00
Jacob Moody
ceba67bc06 9l: fix ELF generation 2023-10-01 21:08:38 +00:00
Jacob Moody
29ce934c91 9a, 9c, 9l: import from 9legacy 2024-04-01 20:46:41 +00:00
Jacob Moody
7628681f83 libmach: remove unused 6c subdirectory
This was leftover from before 6c was
in /sys/src/cmd, as the mkfile adds this
to the include path. Now that we have 6c,
this subdirectory is never used.
2024-05-04 17:13:41 +00:00
cinap_lenrek
0273db0792 ip/torrent: support compact peers6 list 2024-05-04 14:49:03 +00:00
cinap_lenrek
3ba68527b3 ip/torrent: fix wrong interval check 2024-05-04 14:48:27 +00:00
cinap_lenrek
217d2f751c ip/torrent: fix webseed
Commit 9f755671fb broke
webseeding with the last block.

The haveiece() call at the end was because the inner
is not calling havepiece() on the last block as it
does not take the piece length into account.

Now, instead, fix the inner loop, making the code
more setright foward so we call havepiece() on the
last block.
2024-04-28 16:37:29 +00:00
Sigrid Solveig Haflínudóttir
9ebd6f860e ext4srv: reduce the number of options, align more with existing filesystems
Also provide saner defaults (block size 4k instead of 1k).
Cache write back is always enabled now as well.
2024-04-27 16:26:55 +00:00
Ori Bernstein
ce86e64ee0 libc: correct dst transition times
The transition time in the timezone info file is,
confusingly, in local time and not UTC, so we need
to translate it before we do the comparison.

While we're here, revert the Australian timezone
change that made the offsets UTC, and add some test
to make sure we get this right.
2024-04-27 02:19:11 +00:00
cinap_lenrek
498f4f15b5 usbtree(8): document usbtree 2024-04-24 20:31:45 +00:00
cinap_lenrek
b7da224d10 nusb(4): document usbhubctl command format for PPPS 2024-04-24 20:09:57 +00:00
cinap_lenrek
03a52c7cf7 tcp: remove "MaxSegment" MIB stat, add InLimbo stat
This global "Mss" MIB element does not really exists,
and it makes no sense as the MSS is negotiated
per connection.

Put the InLimbo in the statistics table.
2024-04-24 09:06:22 +00:00
Jacob Moody
0320813091 /sys/lib/dist/ndb/common: remove old random auth domains 2024-04-23 00:55:07 +00:00
cinap_lenrek
0298949dd2 tcp: fix limbo entry leaks from hell
In limbo() function, once tpriv->nlimbo
reaches Maxlimbo, we'd try to re-use
Limbo entries from the head of the hash
chain. However, theres a special case
where our current chain contains only
a single entry. Then Limbo **l; points
to its next pointer, and writing:
*l = lp; would just yield in the entry
being linked to itself, leaking it.

The for(;;) loop in limborexmit() was wrong,
as the "continue" case would not advance
the lp pointer at all, (such as when
tpriv->nlimbo reaches > 100), we'd stop
cleaning out entries.

Handle Fsnewcall() returning nil case,
have to free Limbo *lp as we just removed
it from the hash table.

Add tpriv->nlimbo as "InLimbo" at the
end of /net/tcp/stats.
2024-04-22 18:44:53 +00:00
cinap_lenrek
b43c416083 pc: fix link order, libc.a *after* libsec.a (for rand()) 2024-04-22 07:19:58 +00:00
Jacob Moody
567b1b912a rio: fix memory leak with closed kbdtap (thanks aap) 2024-04-21 18:40:08 +00:00
Jacob Moody
ff30a7743b stats: use a high water mark for maximum on graphs 2024-04-21 18:21:54 +00:00
Jacob Moody
46b4b99997 /sys/lib/dist/ndb: update root servers and add script to keep them updated
Also remove dnsdump as that feature is dead now.
2024-04-21 18:20:30 +00:00
cinap_lenrek
a70280308a rudp: better newgen() function, avoiding the lock 2024-04-21 13:16:22 +00:00
cinap_lenrek
a54fcac016 devsdp: fix randomization of dial and acceptid
We where allocating the dialid and acceptid using:

rand()<<16 + rand()

this gives a biased values as rand() retuns a 15-bit
number. Instead, use two calls to nrand() to get
the full 32-bit unsigned range.
2024-04-21 13:10:39 +00:00
cinap_lenrek
314faec394 rudp: fix start generation randomization and cleanup
the start generation was allocated by calling rand(),
which gives a value between 0 and 2^15.

Instead, make a newgen() function that returns a new
generation id in the full 32-bit range, but also
avoids 0 and Hangupgen special values.

Cleanup and make all helper functions static.
2024-04-21 13:08:19 +00:00
cinap_lenrek
e4509d40cc snoopy: teach gre about ethernet and ip6 payloads (thanks arne meyer)
teach snoopy about ethernet and ip6 encapsulated in GRE.
2024-04-20 12:01:37 +00:00
cinap_lenrek
a288db973c keyboard(6): use >> instead of > for caps example (thanks moody)
Using > causes the kbmap file to get truncated,
which resets to the default keymap and *THEN*
applies the new change. Which is probably not
what was intended.
2024-04-19 16:17:41 +00:00
Roberto E. Vargas Caballero
dd820435e9 Fix minor typos and error redirections 2024-04-19 14:06:38 +00:00
Roberto E. Vargas Caballero
c655b6552c Add caps kbmap
The default behaviour of the key labelled as Caps Lock is
to be a Ctrl key, but in some cases in can be desirable
to have it like an actual Caps Lock. A new kbmap file is
added and the keyboard documentation is updated.

git/commit /sys/lib/kbmap/caps /sys/man/6/keybo
2024-04-19 11:55:01 +00:00
Sigrid Solveig Haflínudóttir
ec73849b69 nusb/usbd: fix typos 2024-04-16 14:07:18 +00:00
cinap_lenrek
fe5d1976a0 snoopy: add igmp protocol 2024-04-14 13:29:22 +00:00
cinap_lenrek
9861f1a92b igmp: maintain timeout per group per interface
We used to only allow a single report per interface,
ignoring queries if a interfce already had a report
in flight.

However, this is not correct. Imagine if there is
a query specific query for a group, we add the
report and then we will ignore all further
queries (general or specific) until that
report times out.

Instead, we should maintain the timeout (report)
for each group (and interface) individually.

This means, Report.multi must point to a *single*
Ipmulti. When we handle general queries,
we must create individual Reports for
each of our multicast addresses, but check if
such a report already exists (for that interface).

Because the individual check is basically
quadratic, organise the reports in a hash table
to make finding the existing reports per group
per interface cheaper.
2024-04-13 17:34:28 +00:00
cinap_lenrek
7144ff2694 kernel: do nlocks && delayshed check only for Running state
If the process called sched to do a procswitch(),
skip the delaysched logic, we definitely do not
want to return here unless we'r in running state.
2024-04-08 16:47:30 +00:00
cinap_lenrek
b3a26fb633 kernel: fix the semacquire stack corruption on interrupt
The semacquire allocates a Rendez struct on its stack,
and publishes it on the semaphore linked list in the
segment.

Before returning, it removes it again, properly taking
the locks protecting the linked list, so whats the issue?

The issue happens when procinterrupt() does the wakeup,
which does not care about the spinlock of the segment
lined list, and it does it in the following way:

 			p->r = nil;
 			r->p = nil;
			ready(p);
 			unlock(r);

Note that the unlock happens *after* the ready.
So the process could'v already run on another core, remove
itself from the segment list and get out of semacquire()
alltogether, but we still have one line to execute here,
which is the unlock() of the now free'd Rendez.

And that was causing the stack corruption!

So wakeup() and procinterrupt() always had this issue.
If the Rendez memory stays valid after the wakeup,
here is no issue. Most code just uses &up->sleep,
which will stay valid as Proc's are never freed.

The solution for now is to do the ready() as the
last step, not touching the resource after the final
unlock.
2024-04-08 16:45:23 +00:00
Sigrid Solveig Haflínudóttir
a6ccb66d9c audio(1): mention mixfs resampling audio 2024-04-08 15:57:29 +00:00
Sigrid Solveig Haflínudóttir
0a28dcd218 ext4srv(4): fshalt works with ext4srv now, update; add SOURCE section 2024-04-08 14:50:45 +00:00
Sigrid Solveig Haflínudóttir
354a970bc1 ext4srv: fix ext4_bmap_bit_find_clr returning the wrong bit index 2024-04-08 14:00:38 +00:00
Sigrid Solveig Haflínudóttir
b17ce0d9ae ext4srv: remove mbr scanning and writing 2024-04-08 13:48:50 +00:00
Sigrid Solveig Haflínudóttir
733c5d6645 ext4srv: revisit "fix meta csum producing garbage" in a better way
The entry's inode wasn't set *before* calculating the checksum.
There is no reason to clear the whole block.
2024-04-07 23:22:48 +00:00
Sigrid Solveig Haflínudóttir
2875193842 disk/smart: fix a warning 2024-04-07 22:03:28 +00:00
Sigrid Solveig Haflínudóttir
a3f2d6d23e tapefs: fix two warnings 2024-04-07 22:00:41 +00:00
Sigrid Solveig Haflínudóttir
6a714c488e imx8/sai: run off ref 25MHz clock - no need to turn audio PLL on 2024-04-07 21:44:21 +00:00
Jacob Moody
217f99b137 filter(1): small typesetting error 2024-04-07 19:04:38 +00:00
cinap_lenrek
26008742c5 kernel: dont zero up->nerrlab in syscall()
up->nerrlab is initialized to zero in newproc(),
and we make sure that the syscall handler returns
with up->nerrlan == 0 as well.

If we are paranoid, we can put a check in kenter().
2024-04-07 17:45:47 +00:00
cinap_lenrek
31c5c1ac9a kernel: zero Proc.lastlock and Proc.lastilock in newproc() 2024-04-07 16:23:07 +00:00
cinap_lenrek
18039c83c0 kernel: remove unused Proc.lockwait Lock pointer 2024-04-07 16:19:36 +00:00
cinap_lenrek
8a4a2dea70 kernel: remove some debugging cruft from taslock.c
Only keep the data structures for LOCKCYCLES when
LOCKCYCLES is actually defined (saves 2K in data segment).

Remove unused dumplockmem() function.
2024-04-07 16:09:46 +00:00
cinap_lenrek
87299152ec pc, pc64: simplify error handling setscreensize()
The if(waserror()) nexterror(); is quite useless,
clean it up. do the bootscreenconf() at the very
end.
2024-04-07 15:22:59 +00:00
cinap_lenrek
36d797f8b6 nusb/audio: fix division by zero error
I have a edirol usb 1.1 soundcard:

ep4.0: audio csp 0x000101 vid 0x08bb did 0x2902 'Burr-Brown from TI ' 'USB Audio CODEC ' 76dd2 xhci

Recent code changes produce the following errors
and seems to leave some volume controls empty,
causing later a division by zero crash.

getvalue: mute: cur: Stall Error
getvalue: volume: cur: Stall Error
getvalue: volume: cur: Stall Error
...
audio 269: suicide: sys: trap: divide error pc=0x201b25

The device doesnt appear to have digital
volume controls or anything so i'm not really
interested in getting it to work :)

Just getting rid of the crash. The device works
otherwise fine:

% for(i in /dev/audioctlU* /dev/audiostatU*){echo $i; cat $i;}
/dev/audioctlU76dd2
out on
in on
/dev/audiostatU76dd2
bufsize      0 buffered      0
fmtout u8c1r32000 u8c1r44100 u8c1r48000 u8c2r32000 u8c2r44100 u8c2r48000 s8c1r32000 s8c1r44100 s8c1r48000 s8c2r32000 s8c2r44100 s8c2r48000 s16c1r32000 s16c1r44100 s16c1r48000 s16c2r32000 s16c2r44100 s16c2r48000
fmtin s8c1r11025 s8c2r11025 s16c1r11025 s16c2r11025 s8c1r8000 s8c2r8000 s8c1r16000 s8c2r16000 s16c1r16000 s16c2r16000 s16c1r22050 s16c2r22050 s16c1r32000 s16c2r32000 s16c1r44100 s16c2r44100 s16c1r48000 s16c2r48000
2024-04-07 15:19:43 +00:00
Jacob Moody
cc17845f6c ape: bring in entrypoint changes from libc and fix profiling across the board
* copy _callmain structure from libc
* assembly functions without a prelude can not be profiled
* add missing files for profiling on some archs
* reduce minor style differences between ape/libc profile code
2024-04-07 01:56:57 +00:00
cinap_lenrek
69793014c2 pc, pc64: fix rlock: nlocks 1 print from vga
bootscreenconf() must not be called
with locks held as we are calling into
devenv which arquires rwlocks.
2024-04-06 23:18:35 +00:00
Sigrid Solveig Haflínudóttir
6e33b8e40b audio/mixfs: resample based on audio dev output format, not just the rate
This is pleminary work of replacing "speed" with "fmtout"/"fmtin"
through the entire system.
Switching between output devices with different PCM formats
back and forth now works as expected.
2024-04-06 23:07:48 +00:00
Sigrid Solveig Haflínudóttir
e6f85e3ec8 nusb(4): fix audio(3) reference 2024-04-06 22:55:43 +00:00
Sigrid Solveig Haflínudóttir
dde3628d54 nusb(4): fix Audio section 2024-04-06 21:31:49 +00:00
cinap_lenrek
1b44caa0c4 kernel: print warning in rlock() and wlock() when we hold spinlocks
Just like for qlock(), print a warning when
the process calls rlock() and wlock() while
holding a spinlock.
2024-04-06 16:42:27 +00:00
cinap_lenrek
a597496b19 9boot: use BIOS tick counter instead of INT 0x15 WAIT
To implement keyboard input timeout, we used
to poll the keyboard in a loop with a 100ms
sleep in between using INT 0x15 WAIT BIOS call.

But it seems iPXE breaks the BIOS call, making
it just hang.

The BIOS has a 32-bit tick counter at
040:006C that has a period of 54.9254ms.

Using that instead of the WAIT call appears to be
more reliable and makes it work in iPXE.

Implementation note:

Because the counter has a wrap around value
at non-power-of-two, only check if the counter changed
and counting down the millisecond timeout when it did.
2024-04-06 16:35:37 +00:00
cinap_lenrek
3e9ae26c2e devip: handle interface spec correctly for writes to /net/iproute
When the interface is specified as "-",
we should find the interface based on
the gateway and source ip.

As another improvement, also allow
specifying the interface as the bound
device name (for example "/net/ether0").
2024-04-06 16:17:40 +00:00
Jacob Moody
d5fc608059 sdide: add pci id for SiS 964 IDE controller (thanks mrunix00) 2024-04-05 03:21:24 +00:00
Sigrid Solveig Haflínudóttir
0c77ac17f4 nusb/audio: great new features
- automatically choose configuration with the format closest to the
  s16c2r44100
- allow independent in/out formats to be configured (mono mic with
  lower rate will work)
- provide "fmtout" and "fmtin" via /dev/volumeU*; those can be changed
  by writing to /dev/volumeU*
- expose some of the useful controls (volume, mute etc), if available,
  via /dev/volumeU
- add "in on/off" and "out on/off" via /dev/audioctlU* for
  input/output toggling, which helps with headsets that force low
  quality on both
- expose supported intput/output formats via /dev/audiostatU*

Tested with:

- vid 0x1b3f did 0x2008 GeneralPlus 'USB Audio Device'
  (audio 1.0, in + out)
- vid 0x14ed did 0x3004 Shure 'Shure AONIC 50 USB Hi-Res'
  (audio 2.0, out only)
- vid 0x14ed did 0x3003 'Shure Inc' 'Shure AONIC 50 USB'
  (audio 1.0, headset, in + out)

Known issues:

- on MNT Reform, changing rate to 48kHz on GeneralPlus results in
  silence on the output if the device is connected to either of the
  closest (to the user) usb ports; it works well with the one closer to
  the back
2024-04-05 00:50:47 +00:00
adventuresin9
0a7d581eec mt7688: add devarch and i2c 2024-04-04 22:23:19 +00:00
Sigrid Solveig Haflínudóttir
6901fbd5e9 usbxhci: fix high/super speed iso transfers
full speed assumes 1ms between the frames, but with high
speeds the (micro)frames are 125us between.
Adjust accordingly.

This fixed playback on my usb audio 2.0 headset connected
to Reform's xhci hub port.
2024-04-04 21:45:46 +00:00
Sigrid Solveig Haflínudóttir
c613e336df libpcm: fix pcmratio - forgot to adjust for output frame size 2024-04-03 01:46:50 +00:00
Sigrid Solveig Haflínudóttir
3d5dca5217 ext4srv: correct the "not found" walk error 2024-04-02 21:28:10 +00:00
Sigrid Solveig Haflínudóttir
8dfdc38f95 ext4srv: walk: set QTTMP 2024-04-02 21:19:25 +00:00
Sigrid Solveig Haflínudóttir
5af9daea17 ext4srv: fix ..-walk from a dir under root 2024-04-02 20:52:34 +00:00
Sigrid Solveig Haflínudóttir
de1a460fa1 ext4srv: add append-only and temp files support 2024-04-02 20:52:14 +00:00
Jacob Moody
0196ca7536 /sys/doc/nssec.ms: fix references section header 2024-04-02 03:57:17 +00:00
Jacob Moody
68512a3f66 ktrans: correct Korean input (thanks npmania!)
This patch implements two specific behaviors of Dubeolsik layout.

dubeollkup function makes Jongseong(final consonant) to be treated as
Choseong(initial consonant) when possible. For example, QWERTY input
"zhem" in Dubeolsik has to be "코드", not "콛ㅡ" where switched
Jongseong is "ㄷ".

dubeolbksp function emits out syllable remaining after single
backspace. So when user presses backspace on "코드", the expected output
is "코ㄷ", still allowing user to edit latter syllable, rather than
"코" without dubeolbksp. This should only apply to last syllable
considering it's de facto in Dubeolsik implementations.
2024-04-02 03:55:16 +00:00
Jacob Moody
f4122cfbc9 ktrans: graphical upgrade and feedback
* scrollbar and mouse selection of candidate
* arrow keys for moving selection cursor after first completion
* user defined dictionaries that are merged on top
* document using the plumber to change languages
* loop candidates when reaching the start/end of the list.
* skk2ktrans was using the wrong from encoding
2024-04-02 04:01:56 +00:00
cinap_lenrek
578af37678 6c: fix botched "embedded struct conversion codegen"-fix
Commit ee93b99842
typoed the node name ("nod1" vs "nod") when bringing
back the nod offset for struct offset in ODOT.
2024-04-01 20:23:46 +00:00
cinap_lenrek
1b51d5683a pc64: use chain of IDIVQ for delayloop() (former aamloop())
On modern machines, doing a empty loop
is too fast, resulting in us using the
maximum loopconst of 1000000 and getting
wrong delay() timings.

To fix the timings, use a chain of IDIVQ
instructions instead.

The loop timings is going to be measured
using the TSC, so the exact timing doesnt
need to be known.

Rename aamloop() to delayloop() as it does
different things depending on 386 or amd64.
2024-03-31 19:55:02 +00:00
cinap_lenrek
ad5c6c0dfa qio: fix deadlock with qdiscard()
Both qflush() and qdiscard() appear to
be interrupt level, and must not call
the kick routine of the queue, see
the deadlock in tcp:

0xffffffff80f2fb10 304: loopbackread cinap_lenrek pc 0xffffffff8019a053 kproc (Queueing) ut 0 st 1959 qpc 0xffffffff8014f98e
gotolabel()+0x0 /sys/src/9/pc64/l.s:573
procswitch()+0x50 /sys/src/9/port/proc.c:161
sched()+0xed /sys/src/9/port/proc.c:214
qlock(q=0xffffffff8283ab48)+0x14f /sys/src/9/port/qlock.c:108
tcpkick()+0x5a /sys/src/9/ip/tcp.c:593
iunlock_reader(q=0xffffffff820d1e48)+0x3b /sys/src/9/port/qio.c:480
qdiscard(q=0xffffffff820d1e48,len=0xffffffff00000001)+0x53 /sys/src/9/port/qio.c:1188
update(seg=0xffffffff80f2f968,s=0xffffffff8283ab48)+0x16b /sys/src/9/ip/tcp.c:2032
tcpiput(tcp=0xffffffff809ea2b8,bp=0xffffffff823150c8,ifc=0xffffffff80f39850)+0x1107 /sys/src/9/ip/tcp.c:2387
ipmuxiput(bp=0xffffffff823150c8,ifc=0xffffffff80f39850)+0xa6 /sys/src/9/ip/ipmux.c:765
ipiput4(bp=0xffffffff823150c8,ifc=0xffffffff80f39850,f=0xffffffff809ef7f8)+0x5d9 /sys/src/9/ip/ip.c:408
loopbackread()+0x100 /sys/src/9/ip/loopbackmedium.c:100
linkproc()+0x19 /sys/src/9/port/proc.c:1569
2024-03-30 19:26:20 +00:00
Ori Bernstein
0bf1028ead git/branch: don't add dirs to removed file list 2024-03-29 21:38:15 +00:00
Sigrid Solveig Haflínudóttir
61cc069464 audio(1): add a missing comma 2024-03-29 15:35:13 +00:00
cinap_lenrek
bdd385803d kernel: fix addbroken() race
There is a unlikely race condition when a
process does addbroken(). Due to the
state being set *after* qunlock().

If the process gets preempted just after qunlock(),
it gets put back in the runqueue in Ready state.

Another process can then unbreak() or
release the process, calling ready()
again on the process (causing a warning
for double-ready) and removing the process
from the broken.p list.

Now the original process resumes and
puts itself in Broken state. Now it is out
of the broken list but in Broken state.

So becomes un-killable by unbreak().

The fix is to mark the process as Broken
before unlocking and changing the QLock
into a Lock which inhibits preemption.
2024-03-28 22:27:14 +00:00
cinap_lenrek
b96573b481 kernel: zero up->ureg on sysexec() and pexit()
The up->ureg pointer points to the last delivered
note in the user-space stack.

On exec(), all the notes are cleared and the
ureg pointer should be zeroed as well as it
points into the previous programs stack.

Note, this can only happen if someone does
exec() from a note handler.

When we pexit(), also zero the up->ureg and up->dbgreg
as we are about to release the memory segments
and nobody should debugging user-space anymore.
2024-03-28 21:52:38 +00:00
cinap_lenrek
c309f466ef kernel: bring back cooperating scheduling
In commit eaffa1ef55
(which fixed some bugs in the efd scheduling code),
the cooperating scheduling got removed accidentially.

This was not the intention, so bring it back.
2024-03-28 21:34:02 +00:00
cinap_lenrek
92ce2cfea6 ktrace: _intrr -> noteret (pc64)
The _intrr symbol has been removed from pc64/l.s
in commit 72aa282792
and replaced with noteret.
2024-03-28 15:16:21 +00:00
sl
5622b0bbd8 /sys/src/cmd/nusb/kb/kb.c: increase uchar rep from 512 to 1024, makes thinkpad x280 usb touchscreen work 2024-03-28 02:58:47 +00:00
Sigrid Solveig Haflínudóttir
027f579f43 nusb/audio: pick a different rate if 44.1kHz is not available
Try to pick the closest (but higher) rate. If there are none,
pick a lower one.

Mixfs is able to convert to whichever rate, so this should
make plenty of new audio devices work.
2024-03-27 23:47:45 +00:00
Sigrid Solveig Haflínudóttir
571d3258ef audio/mixfs: convert pcm for devices that are not 44.1kHz 2024-03-27 23:44:25 +00:00
Sigrid Solveig Haflínudóttir
2d1f4327f1 audio/pcmconv: use libpcm 2024-03-27 23:43:06 +00:00
Sigrid Solveig Haflínudóttir
0d84321e65 libpcm: audio/pcmconv-as-a-library 2024-03-27 23:42:37 +00:00
cinap_lenrek
4834c3c19f devuart: dont allow ridiculous queue sizes 2024-03-27 21:14:41 +00:00