Commit graph

10508 commits

Author SHA1 Message Date
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