]> git.lizzy.rs Git - plan9front.git/log
plan9front.git
3 years agovmx: avoid strdup() register names for register cache
cinap_lenrek [Wed, 12 May 2021 16:04:25 +0000 (18:04 +0200)]
vmx: avoid strdup() register names for register cache

If we tokenize the register file contents in a static buffer,
we can avoid having to duplicate the register names.

All callers to rpoke() provide constant register arguments
so they also do not need to be duplicated.

3 years agovmx: implement long mode page table translation
cinap_lenrek [Wed, 12 May 2021 16:00:46 +0000 (18:00 +0200)]
vmx: implement long mode page table translation

This allows vmx to translate virtual addresses to physical
when the gues runs in long mode.

3 years agoiwhois: add some improvements (thanks gall0ws)
cinap_lenrek [Sun, 9 May 2021 13:19:05 +0000 (15:19 +0200)]
iwhois: add some improvements (thanks gall0ws)

patch from gall0ws:

> It's impossible to get whois right and probably nobody cares about it,
> nevertheless this small patch fixes some issues with the current version:
>
> * use a more common filter for default boilerplate (useful when
>   following the referral chain)
> * updated boilerplate for *.co.uk *.net.uk *.org.uk
> * added case *.com *.net (got it from iana.org)
> * use ARIN for IPv6 addresses
> * when unsure, check first whether whois.nic.$tld exists otherwise
>   usual fallback to InterNIC
> * fixed regexp for the referral chain (case, extra spaces or /)

- add usage handling.

--
cinap

3 years agogames/opl3: use correct sampling rate
qwx [Wed, 5 May 2021 14:57:19 +0000 (16:57 +0200)]
games/opl3: use correct sampling rate

games/dmid uses the same sample rate as the chip for music, but other
applications do not.  opl3 and its older version opl2 (not in 9front)
read an input stream of commands in basically IMF format, something
used in other id Software games and some others, which assumes a
given input sampling rate:  700 Hz for Wolfenstein 3D music, 560 Hz
for Commander Keen, 60 Hz for Ultima 6, etc.

The opl3 emulation on the other hand is not really intended to run at
a sampling rate different that the chip's 49.716 kHz sampling rate.
Previously, we assumed it runs at 44.1 kHz and just used the input
rate as a divisor to get the number of samples per delay tic.

From what I understand, the correct way to use it for accurate
emulation is to run the opl chip emulator at its intended sampling
frequency, then downsample to 44.1 kHz.  This means better output
but more code.  The alternative is to basically do the same as
before rev 8433, except with no buffering, but at accuracy/quality
loss.  This change implements the former and just forks pcmconv to
deal with resampling.

3 years agomerge
cinap_lenrek [Tue, 4 May 2021 23:51:20 +0000 (01:51 +0200)]
merge

3 years agocpu: properly handle end of file in readstr()
cinap_lenrek [Tue, 4 May 2021 23:50:09 +0000 (01:50 +0200)]
cpu: properly handle end of file in readstr()

3 years agozuke(1): more fixes (thanks humm)
Sigrid [Tue, 4 May 2021 13:32:35 +0000 (15:32 +0200)]
zuke(1): more fixes (thanks humm)

3 years agozuke(1): engrish (thanks qwx)
Sigrid [Tue, 4 May 2021 13:21:44 +0000 (15:21 +0200)]
zuke(1): engrish (thanks qwx)

3 years agoadd zuke(1) manpage (thanks kemal & humm)
Sigrid [Tue, 4 May 2021 12:52:05 +0000 (14:52 +0200)]
add zuke(1) manpage (thanks kemal & humm)

3 years agolibtags: upstream updates
Sigrid [Mon, 3 May 2021 19:04:39 +0000 (21:04 +0200)]
libtags: upstream updates

3 years agoMail: remove message about cyclic threads
Ori Bernstein [Sat, 1 May 2021 19:33:31 +0000 (15:33 -0400)]
Mail: remove message about cyclic threads

They happen, and we break the cycle. There's nothing
the user can do, so there's no point in warning.

3 years agolib9p: remove Srv.srvfd, make postsrv() and threadpostsrv() return the mountable...
cinap_lenrek [Sat, 1 May 2021 17:58:58 +0000 (19:58 +0200)]
lib9p: remove Srv.srvfd, make postsrv() and threadpostsrv() return the mountable file descriptor, update documentation

Now that we have these new functions,
we can also make them return an error
instead of calling sysfatal() like
postmountsrv().

Remove the confusing Srv.srvfd, as it
is only temporarily used and return
it from postsrv() instead.

3 years agolib9p: remove unneccesary headers
cinap_lenrek [Sat, 1 May 2021 15:03:03 +0000 (17:03 +0200)]
lib9p: remove unneccesary headers

3 years agolib9p: expose Srv.forker handler and srvforker(), threadsrvforker() and threadsrv...
cinap_lenrek [Sat, 1 May 2021 14:37:00 +0000 (16:37 +0200)]
lib9p: expose Srv.forker handler and srvforker(), threadsrvforker() and threadsrv() functions

To use srvrease()/srvaquire() we need to have a way to spawn
new processes to handle the service loop. This functionality
was provided by the internal _forker() function which was
eigther rfork or libthread based implementation depending on
if postmountsrv() or threadpostmountsrv() where called.

For servers who want to use srv() directly, _forker would not
be initialized so srvrelease() could not be used.

To untangle this, we get rid of the global _forker handler
and put the handler in the Srv structure. Which will get
initialized (when nil) to eigther srvforker() or threadsrvforker()
depending on if the thread or non-thread entry points where used.

For symmetry, we provde new threadsrv() and threadpostsrv()
functions which handle the default initialization of Srv.forker.

This also allows a user to provide his own forker function,
maybe to conserve stack space.

To avoid dead code, we put each of these function in their
own object file. Note, this also allows a user to define its
own srvforker() symbol.

3 years agolibtags: use nelem
Sigrid [Fri, 30 Apr 2021 10:36:01 +0000 (12:36 +0200)]
libtags: use nelem

3 years agolibtags: trim text tags and ignore empty values
Sigrid [Thu, 29 Apr 2021 22:20:39 +0000 (00:20 +0200)]
libtags: trim text tags and ignore empty values

3 years agolibtags: modules: ignore empty title
Sigrid [Thu, 29 Apr 2021 21:35:52 +0000 (23:35 +0200)]
libtags: modules: ignore empty title

3 years agolibtags: use CP437 as the default encoding for module formats
Sigrid [Thu, 29 Apr 2021 19:44:06 +0000 (21:44 +0200)]
libtags: use CP437 as the default encoding for module formats

3 years agoopl3(1), exec(2): fix manpage typos (thanks umbraticus)
qwx [Tue, 27 Apr 2021 14:08:06 +0000 (16:08 +0200)]
opl3(1), exec(2): fix manpage typos (thanks umbraticus)

3 years agogames/opl3: don't buffer output and simplify (thanks umbraticus)
qwx [Tue, 27 Apr 2021 07:48:14 +0000 (09:48 +0200)]
games/opl3: don't buffer output and simplify (thanks umbraticus)

this fixes real-time applications.

-n previously specified a rate divisor rather than the rate itself,
which was used for specific applications outside of 9front.  instead,
just set the rate directly, more useful and straightforward.

3 years agofile: partially revert 8419 to detect <?xml as html
Sigrid [Sun, 25 Apr 2021 19:49:01 +0000 (21:49 +0200)]
file: partially revert 8419 to detect <?xml as html

3 years agokernel: clean up Mach structure
cinap_lenrek [Sun, 25 Apr 2021 15:41:34 +0000 (17:41 +0200)]
kernel: clean up Mach structure

Remove unused fields and factor common fields into a
new PMach struct in port/portdat.h.

The fields machno, splpc and proc are not moved to
PMach as they are part of the known offsets from
assembly (l.s).

3 years agobcm: try ATAGS/DTB pointer from R2 on entry
cinap_lenrek [Sun, 25 Apr 2021 15:36:11 +0000 (17:36 +0200)]
bcm: try ATAGS/DTB pointer from R2 on entry

3 years agorio: avoid re-triggering clicks on resize/hide/unhide and send wctl when focus is...
cinap_lenrek [Sun, 25 Apr 2021 10:41:20 +0000 (12:41 +0200)]
rio: avoid re-triggering clicks on resize/hide/unhide and send wctl when focus is lost

3 years agoresample: improve performance (thanks José Miguel Sánchez García)
cinap_lenrek [Sun, 25 Apr 2021 10:16:40 +0000 (12:16 +0200)]
resample: improve performance (thanks José Miguel Sánchez García)

Resample is well known for taking a long time to resize an image. This
patch brings an important performance boost (in my test image, time
was reduced from ~2850ms to ~500ms). It does that by extracting FP
multiplication and division out of the innermost loop of
resamplex/resampley.

The results differ slightly from the current implementation: in my
test: ~0.3% of the bytes had a ±2 difference in their value, which I
attribute to rounding errors. I'm personally not concerned with that
deviation, given the performance gains. However, I recommend testing
it just to be sure I didn't overlook anything.

José Miguel Sánchez García

3 years agolibtags, zuke: add *.mod support (thanks kemal)
Sigrid [Sat, 24 Apr 2021 14:07:24 +0000 (16:07 +0200)]
libtags, zuke: add *.mod support (thanks kemal)

3 years agozuke: fix middle-click restarting playback if held while mouse pointer is moving
Sigrid [Fri, 23 Apr 2021 09:20:30 +0000 (11:20 +0200)]
zuke: fix middle-click restarting playback if held while mouse pointer is moving

3 years agozuke: fix position formatter using a wrong type
Sigrid [Thu, 22 Apr 2021 06:40:50 +0000 (08:40 +0200)]
zuke: fix position formatter using a wrong type

3 years agomerge
cinap_lenrek [Wed, 21 Apr 2021 14:58:27 +0000 (16:58 +0200)]
merge

3 years agovgadb: revert previous commit, the pci device id 8086/1c3a is the embedded controller!
cinap_lenrek [Wed, 21 Apr 2021 14:57:13 +0000 (16:57 +0200)]
vgadb: revert previous commit, the pci device id 8086/1c3a is the embedded controller!

3 years agoplumber: fix substrings in match rules
Humm [Wed, 21 Apr 2021 06:28:32 +0000 (08:28 +0200)]
plumber: fix substrings in match rules

Unmatched substrings are nil, so we can't rely on nil terminating the
array of substrings.

3 years agonusbrc: rndis with csp 0104ef
Sigrid [Tue, 20 Apr 2021 16:12:54 +0000 (18:12 +0200)]
nusbrc: rndis with csp 0104ef

3 years agonusb/ether: rndis: add standard class code (tested by jmi2k with OnePlus 8)
Sigrid [Tue, 20 Apr 2021 16:08:58 +0000 (18:08 +0200)]
nusb/ether: rndis: add standard class code (tested by jmi2k with OnePlus 8)

3 years agofile: recognize executable scripts, etc.
kemal [Mon, 19 Apr 2021 23:40:31 +0000 (01:40 +0200)]
file: recognize executable scripts, etc.

The patch does the following:

1. Adds recognition of executable script (shebang) files.
2. Returns correct MIME type for mbox files (RFC 4155).
3. Returns XML instead of HTML type in some cases.

3 years agodevloopback: fix wrong device character (thanks romano)
cinap_lenrek [Sun, 18 Apr 2021 14:20:04 +0000 (16:20 +0200)]
devloopback: fix wrong device character (thanks romano)

devloopback was changed from using #X to #λ awhile ago; one bit was missed.

3 years agopatch for imap when imap fails
unobe [Sun, 18 Apr 2021 01:52:11 +0000 (18:52 -0700)]
patch for imap when imap fails
changeset:   8411:19f6a88ea241
branch:      mbp-2011
user:        Romano <unobe@cpan.org>
date:        Sat Apr 17 14:35:21 2021 -0700
files:       sys/src/cmd/upas/fs/imap.c
description:
When an imap fetch fails, it's helpful at times to know the underlying
cause.  This provides more details by providing the underlying error
message.

3 years agoMail: remove impliicit headers (thanks unobe)
Ori Bernstein [Sun, 18 Apr 2021 01:46:02 +0000 (18:46 -0700)]
Mail: remove impliicit headers (thanks unobe)

Setting headers from Mail can cause conflicts
with the headers that upas/marshal adds when
sending attachments.

So, let's not set them.

3 years agoacme: fix border size, autoindent undo: imported from plan9port (thanks jxy)
Ori Bernstein [Thu, 15 Apr 2021 03:30:24 +0000 (20:30 -0700)]
acme: fix border size, autoindent undo: imported from plan9port (thanks jxy)

origin:

https://github.com/9fans/plan9port/pull/493
https://github.com/9fans/plan9port/pull/489
https://github.com/9fans/plan9port/pull/461

3 years agozuke: include libtags in CFLAGS
Sigrid [Tue, 13 Apr 2021 13:55:19 +0000 (15:55 +0200)]
zuke: include libtags in CFLAGS

3 years agozuke: remove -G option (old playlists not supported anymore)
Sigrid [Tue, 13 Apr 2021 11:28:31 +0000 (13:28 +0200)]
zuke: remove -G option (old playlists not supported anymore)

3 years agoremove juke (use play or zuke instead)
Sigrid [Tue, 13 Apr 2021 11:25:24 +0000 (13:25 +0200)]
remove juke (use play or zuke instead)

3 years agoaudio/: zuke, mkplist, readtags
Sigrid [Tue, 13 Apr 2021 11:20:27 +0000 (13:20 +0200)]
audio/: zuke, mkplist, readtags

3 years agoremove old, broken scripts: fedex, u(s)ps, weather (thanks fulton)
Sigrid [Tue, 13 Apr 2021 09:26:55 +0000 (11:26 +0200)]
remove old, broken scripts: fedex, u(s)ps, weather (thanks fulton)

3 years agoMail: correctly track the number of messages (thanks igor)
Ori Bernstein [Mon, 12 Apr 2021 16:22:48 +0000 (09:22 -0700)]
Mail: correctly track the number of messages (thanks igor)

We forgot to update the message count when deleting
messages in mail, meaning we could access trailing
messages that had been freed.

3 years agocrop: allow no-ops for pipelines
qwx [Mon, 12 Apr 2021 08:29:54 +0000 (10:29 +0200)]
crop: allow no-ops for pipelines

unlike other tools like iconv(1), a crop(1) without arguments or with
ones resulting in a no-op, like `-t 0 0', errors out.  other options
like `-i 0' do not error.  this breaks assumptions and results in
tedious intermediary steps or hacks like:

foo | {crop -t $1 $2 >[2]/null || cat} > baz.bit

instead, just ignore the check.  subsequent code doesn't make
assumptions on that.

3 years agoip/tftpd: add a syslog message about what error we return to the client on a NAK
cinap_lenrek [Sun, 11 Apr 2021 21:58:30 +0000 (23:58 +0200)]
ip/tftpd: add a syslog message about what error we return to the client on a NAK

3 years agoip/dhcpd: work around raspberry pi pxe firmware by providing dhcp option 66
cinap_lenrek [Sun, 11 Apr 2021 18:20:41 +0000 (20:20 +0200)]
ip/dhcpd: work around raspberry pi pxe firmware by providing dhcp option 66

The raspberry pi 4 PXE firmware insists on finding the tftp
server address by parsing dhcp option 66 as an ip address
string.

3 years agoip/ipconfig: ODtftpserver (dhcp option 66) is of type string
cinap_lenrek [Sun, 11 Apr 2021 18:18:03 +0000 (20:18 +0200)]
ip/ipconfig: ODtftpserver (dhcp option 66) is of type string

3 years agotermrc, cpurc: silence /net/ether* error message when there are no ethernet devices
cinap_lenrek [Sat, 10 Apr 2021 13:01:09 +0000 (15:01 +0200)]
termrc, cpurc: silence /net/ether* error message when there are no ethernet devices

3 years agolibthread: generate correct acid files
Humm [Fri, 9 Apr 2021 14:48:07 +0000 (16:48 +0200)]
libthread: generate correct acid files

/sys/src/cmd/mksyslib uses `{basename $stem .$objtype}^.c to get the
source file name for *.acid files.  /sys/lib/acid/thread expects
sched.$objtype.acid.  This lets /sys/src/libthread/mkfile generate
that file.

3 years agopage: fix for kerTeX dvi
Humm [Fri, 9 Apr 2021 14:40:56 +0000 (16:40 +0200)]
page: fix for kerTeX dvi

3 years agodisk/fdisk: add OpenBSD partition type
Humm [Fri, 9 Apr 2021 14:11:48 +0000 (16:11 +0200)]
disk/fdisk: add OpenBSD partition type

3 years agoprintfont: load all fonts for `printfont all`
Humm [Fri, 9 Apr 2021 14:09:31 +0000 (16:09 +0200)]
printfont: load all fonts for `printfont all`

3 years agotrofftable.rc: make work
Humm [Fri, 9 Apr 2021 14:05:30 +0000 (16:05 +0200)]
trofftable.rc: make work

3 years agog: add lua, mk, ml, mli, myr, and sh suffixes
kvik [Fri, 9 Apr 2021 01:18:53 +0000 (03:18 +0200)]
g: add lua, mk, ml, mli, myr, and sh suffixes

3 years agonusbrc: ignore rndis ethernet in /rc/bin/nusbed, handled by /sys/src/9/boot/nusbrc...
cinap_lenrek [Thu, 8 Apr 2021 19:57:24 +0000 (21:57 +0200)]
nusbrc: ignore rndis ethernet in /rc/bin/nusbed, handled by /sys/src/9/boot/nusbrc (thanks romano)

3 years agominor man page typos
Romano [Thu, 8 Apr 2021 19:42:31 +0000 (21:42 +0200)]
minor man page typos

3 years agovgadb: igfx: add vid/did for early 2011 apple mbp (thanks Romano)
Sigrid [Wed, 7 Apr 2021 10:21:06 +0000 (12:21 +0200)]
vgadb: igfx: add vid/did for early 2011 apple mbp (thanks Romano)

3 years ago[9front] walk: properly format permissions
Stephen Gregoratto [Tue, 6 Apr 2021 12:43:38 +0000 (14:43 +0200)]
[9front] walk: properly format permissions
This patch adds dirmodefmt from fcall.h to pretty-print file
permissions, similarly to ls -l. I didn't notice any performance
degradation.

I hope no-one relied on the old behaviour.

3 years agofile: detect webp files (thanks kemal)
cinap_lenrek [Sat, 3 Apr 2021 17:32:47 +0000 (19:32 +0200)]
file: detect webp files (thanks kemal)

this patch adds a small check to the "iff" function, so this
way file can detect webp files. tested with a webp file i
found randomly.

3 years agogames/glendy: your complication had a complication (god damn it kemal)
cinap_lenrek [Fri, 2 Apr 2021 20:23:40 +0000 (22:23 +0200)]
games/glendy: your complication had a complication (god damn it kemal)

3 years agogames/glendy: don't use lucida sans in menus by default and bugfix (thanks kemal)
cinap_lenrek [Fri, 2 Apr 2021 20:05:15 +0000 (22:05 +0200)]
games/glendy: don't use lucida sans in menus by default and bugfix (thanks kemal)

i have found one bug. when i put glenda in a position like this

i somehow win, but the glenda can escape from there.

in addition, i have changed the games manpage to include more info about glendy.

3 years agokernel: get rid of physical page bank array and use conf.mem[] instead
cinap_lenrek [Fri, 2 Apr 2021 18:23:25 +0000 (20:23 +0200)]
kernel: get rid of physical page bank array and use conf.mem[] instead

We can take advantage of the fact that xinit() allocates
kernel memory from conf.mem[] banks always at the beginning
of a bank, so the separate palloc.mem[] array can be eleminated
as we can calculate the amount of non-kernel memory like:

upages = cm->npage - (PGROUND(cm->klimit - cm->kbase)/BY2PG)

for the number of reserved kernel pages,
we provide the new function: ulong nkpages(Confmem*)

This eleminates the error case of running out of slots in
the array and avoids wasting memory in ports that have simple
memory configurations (compared to pc/pc64).

3 years agowhois: suppress missing file errors (thanks kivik)
cinap_lenrek [Fri, 2 Apr 2021 15:26:34 +0000 (17:26 +0200)]
whois: suppress missing file errors (thanks kivik)

3 years agoacme: fix suicide *and* resource leak in ecmd.c (thanks igor)
cinap_lenrek [Fri, 2 Apr 2021 13:51:15 +0000 (15:51 +0200)]
acme: fix suicide *and* resource leak in ecmd.c (thanks igor)

To reproduce the suicide try running the following in acme:

• 'Edit B <ls lib'

by select and middle clicking in a window that is in your $home.

There is a very high chance acme will commit suicide like this:

<snip>
cpu% broke
echo kill>/proc/333310/ctl # acme
cpu% acid 333310
/proc/333310/text:amd64 plan 9 executable
/sys/lib/acid/port
/sys/lib/acid/amd64
acid: lstk()
edittext(nr=0x31,q=0x0,r=0x45aa10)+0x8 /sys/src/cmd/acme/ecmd.c:135
xfidwrite(x=0x461230)+0x28a /sys/src/cmd/acme/xfid.c:479
        w=0x0
        qid=0x5
        fc=0x461390
        t=0x1
        nr=0x100000031
        r=0x45aa10
        eval=0x3100000000
        a=0x405621
        nb=0x500000001
        err=0x419310
        q0=0x100000000
        tq0=0x80
        tq1=0x8000000000
        buf=0x41e8d800000000
xfidctl(arg=0x461230)+0x35 /sys/src/cmd/acme/xfid.c:52
        x=0x461230
launcheramd64(arg=0x461230,f=0x22357e)+0x10 /sys/src/libthread/amd64.c:11
0xfefefefefefefefe ?file?:0
</snap>

The suicide issue is caused by the following chain of events:

• /sys/src/cmd/acme/ecmd.c:/^edittext is called at
/sys/src/cmd/acme/xfid.c:479 passing nil as its first parameter:

<snip>
...
        case QWeditout:
                r = fullrunewrite(x, &nr);
                if(w)
                        err = edittext(w, w->wrselrange.q1, r, nr);
                else
                        err = edittext(nil, 0, r, nr);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
</snap>

...and /sys/src/cmd/acme/ecmd.c:/^edittext dereferences the
first parameter that is *nil* at the first statement:

<snip>
char*
edittext(Window *w, int q, Rune *r, int nr)
{
        File *f;

        f = w->body.file;
^^^^^^^^^^^^^^^^^^^^^
This will crash if 'w' is *nil*

        switch(editing){
...
</snap>

Moving the the derefernce of 'w' into the case where it is
needed (see above patch) fixes the suicude.

The memory leak is fixed in /sys/src/cmd/acme/ecmd.c:/^filelist.  The
current implementation of filelist(...) breaks its contract with its
caller, thereby leading to a memory leak in /sys/src/cmd/acme/ecmd.c:/^B_cmd
and /sys/src/cmd/acme/ecmd.c:/^D_cmd.

The contract /sys/src/cmd/acme/ecmd.c:/^filelist seems to have with
its callers is that in case of success it fills up a 'collection' that
callers can then clear with a call to clearcollection(...).

The fix above honours this contract and thereby removes the leak.

After you apply the patch the following two tests should succeed:

• Execute by select and middle click in a Tag:
        'Edit B lib/profile'

• Execute by select and middle click in a Tag:
        'Edit B <ls lib'

The former lead to a resource leak that is now fixed.

The latter lead to a suicide that is now fixed by moving the statement
that dereferences the parameter to the location where it is needed,
which is not the path used in the case of 'Edit B <ls'.

Cheers,
Igor

3 years ago[9front] [patch] nusb/ether -t rndis
Romano [Thu, 1 Apr 2021 10:54:08 +0000 (12:54 +0200)]
[9front] [patch] nusb/ether -t rndis

3 years agomerge
cinap_lenrek [Wed, 31 Mar 2021 15:50:25 +0000 (17:50 +0200)]
merge

3 years agodevfs: fix locking and ignore undocumented "fsdev:\n" configuration signature
cinap_lenrek [Wed, 31 Mar 2021 15:49:10 +0000 (17:49 +0200)]
devfs: fix locking and ignore undocumented "fsdev:\n" configuration signature

The confstr was shared between readers so seprintconf() could
write concurrently to that buffer which is not safe.

This replaces the shared static confstr[Maxconf] buffer with a
pointer that is initially nil and a buffer that is alloced on
demand.

The new confstr pointer (and buffer) is now only updated while
wlock()ed from the new setconfstr() function.

This is now done by mconfig() / mdelctl() just before releasing
the wlock.

Now, rdconf() will check if confstr has been initialized, and
test for it again while wlock()ed; making sure the configuration
is read only once.

Also, rdconf() used to check for a undocumented "fsdev:\n" string
at the beginning of config data tho that was never documented.

This changes mconfig() to ignore that particular signature so
the example from the manpage will work as documented.

3 years agomerge
Ori Bernstein [Mon, 29 Mar 2021 16:29:35 +0000 (09:29 -0700)]
merge

3 years agolibsunrpc: work around arm64 compiler bug in sunStringUnpack()
cinap_lenrek [Mon, 29 Mar 2021 15:13:50 +0000 (17:13 +0200)]
libsunrpc: work around arm64 compiler bug in sunStringUnpack()

The sunStringUnpack() routine was miscompiled by 7c, as
pointer arithmetic is done in 64 bit but the constant -1
offset got expended to a unsigned 32 bit integer.

3 years agokbmap/tr: add one missing key to Turkish keymap (thanks kemal)
Ori Bernstein [Wed, 24 Mar 2021 03:49:07 +0000 (20:49 -0700)]
kbmap/tr: add one missing key to Turkish keymap (thanks kemal)

while we're here, change the hex values to  unicode chars.

3 years agolegal: mit neuer lizenz: mit
Ori Bernstein [Tue, 23 Mar 2021 23:33:32 +0000 (16:33 -0700)]
legal: mit neuer lizenz: mit

The Plan 9 foundation has ownership of the Plan 9 code now,
and has made it accessible under the MIT license, so we're
taking that version of the code as our base now.

3 years agokernel: remove ucalloc.c duplicates
cinap_lenrek [Sat, 13 Mar 2021 13:57:53 +0000 (14:57 +0100)]
kernel: remove ucalloc.c duplicates

3 years agokernel: use 64-bit mask to avoid compiler warning in port/pci.c
cinap_lenrek [Sat, 13 Mar 2021 13:20:00 +0000 (14:20 +0100)]
kernel: use 64-bit mask to avoid compiler warning in port/pci.c

3 years ago5c, 6c, 7c, 8c, kc, qc, vc: use explicit gmove(... , nn) in cgen() for result of...
cinap_lenrek [Sat, 13 Mar 2021 12:56:40 +0000 (13:56 +0100)]
5c, 6c, 7c, 8c, kc, qc, vc: use explicit gmove(... , nn) in cgen() for result of OAS*, OPREINC, OPOSTINC

The expression value of the assignment operation was
returned implicitely by relying on regalloc() on the
right hand side "nod" borrowing the register from nn.

But this only works if nn is a register.

In case of 6c, it can also be a ONAME from a .safe
rathole returned by regsalloc().

This change adds explicit gmove() calls to assign the
expression value. Note that gmove() checks if source
and destination are the same register so it wont emit
redundant move operations in the common case.

The same is applied also to OPREINC and OPOSTINC operations.

3 years agoaudio(1): fix little typo.
rgl [Sat, 13 Mar 2021 08:47:48 +0000 (09:47 +0100)]
audio(1): fix little typo.

3 years agocorrect off-by-one nul termination.
rgl [Thu, 11 Mar 2021 18:37:44 +0000 (19:37 +0100)]
correct off-by-one nul termination.

3 years agoMail: separate deletion from relinking messages
Ori Bernstein [Thu, 11 Mar 2021 00:49:17 +0000 (16:49 -0800)]
Mail: separate deletion from relinking messages

Mutating lists that are being iterated is needlessly error
prone, and we were removing the wrong message in some cases
if it the dummy got inserted in the right place.

Separating deletion into a redraw/relink and zap phase
simplifies the problem.

3 years agoriostart: revert, this doesnt fix anything
cinap_lenrek [Sun, 7 Mar 2021 19:29:55 +0000 (20:29 +0100)]
riostart: revert, this doesnt fix anything

This change does not work and the real fix is in rio.

3 years agorio: make window focus changes deterministic, cleanup wind.c
cinap_lenrek [Sun, 7 Mar 2021 19:26:30 +0000 (20:26 +0100)]
rio: make window focus changes deterministic, cleanup wind.c

Switching window focus used to be non deterministic
as the current window in focus (Window *input) was set
concurrently while processing window messages such as
Resized and Topped.

This implements a new approach where wcurrent() and
wuncurrent() are responsible for the synchronization
and switch of the input.

It is implemented by sending a Repaint message to the
old input window first, neccesarily waiting until that
window releases the focus and then input is updated
and then a Topped or Reshaped message is send to the
new input window.

Note, that when the whole screen is resized that no
input changes need to happening anymore.

3 years ago[9front] [PATCH] fix small typo in vmx(3)
kemal [Sat, 6 Mar 2021 21:52:00 +0000 (22:52 +0100)]
[9front] [PATCH] fix small typo in vmx(3)
vmx(3) does not use itself to implement virtual machines.

3 years ago/sys/man/1/mothra: eu regulations require that we disclose we're sending search queri...
sl [Wed, 3 Mar 2021 03:56:58 +0000 (22:56 -0500)]
/sys/man/1/mothra: eu regulations require that we disclose we're sending search queries to duckduckgo.

3 years ago[9front] riostart: make text window focused by default
José Miguel Sánchez García [Tue, 2 Mar 2021 09:03:25 +0000 (10:03 +0100)]
[9front] riostart: make text window focused by default
This change makes the text window be focused on startup when using
default riostart (e.g: when using the release ISO). This little change
makes you able to immediately reach the rc shell without clicking the
window, which at the very least is more convenient, and if you have
problems to use your mouse but want to install the system, you also
can (I had to stop profile from running at boot to patch it in my VPS
KVM console because the mouse wasn't working properly. Could install
and setup it to connect through drawterm).

3 years agomothra: "d": use lite version, disable redirect
Sigrid [Tue, 2 Mar 2021 07:41:02 +0000 (08:41 +0100)]
mothra: "d": use lite version, disable redirect

3 years agomothra: add "d" command to search for a text on the internet (using duckduckgo)
Sigrid [Tue, 2 Mar 2021 07:21:56 +0000 (08:21 +0100)]
mothra: add "d" command to search for a text on the internet (using duckduckgo)

3 years agoMail: revert 096538d64724
Ori Bernstein [Tue, 2 Mar 2021 03:23:13 +0000 (19:23 -0800)]
Mail: revert 096538d64724

3 years agodevpccard, pci: fix pccard support and handle pci expansion roms
cinap_lenrek [Mon, 1 Mar 2021 16:24:54 +0000 (17:24 +0100)]
devpccard, pci: fix pccard support and handle pci expansion roms

let pci.c deal with the special cardbus controller bar0 and
expansion roms.

handle apic interrupt routing for devices behind a cardbus slot.

do not free the pcidev on card removal, as the drivers
most certanly are not prepared to handle this yet.
instead, we provide a pcidevfree() function that just unlinks
the device from pcilist and the parent bridge.

3 years agoMail: fix infinite deletion loop
Ori Bernstein [Mon, 1 Mar 2021 00:36:42 +0000 (16:36 -0800)]
Mail: fix infinite deletion loop

When deleting messages that came in just
the right order, we would end up stuck in
a loop deleting and reinserting a dummy
parent, rather than the messages we wanted
to remove.

3 years agobcm: change color chan to RGB24 (thanks p.kosyh)
cinap_lenrek [Sun, 28 Feb 2021 12:31:49 +0000 (13:31 +0100)]
bcm: change color chan to RGB24 (thanks p.kosyh)

p.kosyh writes:

Hello!  I finally bought rpi4 4Gb specially for 9front. It seems,
that default bpp of framebuffer is 16.  I changed it to 24 (via
cmdline.txt and config.txt) and found, that rendering is much faster!
(May be due removing overheads in 16->24 conversions?)

But on rpi4 r and b channels are swapped.  So, i changed BGR24 to
RGB24 in bcm/screen.c and now it works fine!

3 years agoB, Bfn: fix invocation with multiple files, improve manual page
moody [Sat, 27 Feb 2021 18:35:06 +0000 (19:35 +0100)]
B, Bfn: fix invocation with multiple files, improve manual page

3 years agoramfs: fix truncfile() for non multiple of extend size (64k)
cinap_lenrek [Sat, 27 Feb 2021 14:08:34 +0000 (15:08 +0100)]
ramfs: fix truncfile() for non multiple of extend size (64k)

The calculation of the last block size is wrong and we can
only shrink the size of the last data block, not extend it.

3 years agovmx: reduce cpu load by eliminating nop-loop
Sigrid [Tue, 23 Feb 2021 14:54:09 +0000 (15:54 +0100)]
vmx: reduce cpu load by eliminating nop-loop

Sacrifice some of the sub-millisecond timer precision in favor of less
cpu load when the timer is about to be kicked a bit early.  Result is
visible *especially* when the guest idling.

Timer proc *still* has to send to the channel (in order to kick PIT
and RTC logic), which takes time, and compensates a bit for possibly
early runs.

3 years agohtml2ms: 0xFFFD → Runeerror
Sigrid [Tue, 23 Feb 2021 07:52:59 +0000 (08:52 +0100)]
html2ms: 0xFFFD → Runeerror

3 years agoip/tftpd: add -n namespace-file flag (thanks sam-d)
cinap_lenrek [Tue, 23 Feb 2021 00:47:33 +0000 (01:47 +0100)]
ip/tftpd: add -n namespace-file flag (thanks sam-d)

tftpd currently unconditionally sets its namespace via /lib/namespace
(newns("none", nil)), which stymied my attempts to pxe boot the
openbsd installer without creating a real /etc dir on 9front, which
would've been gross.

I tried working around this with -h (and -r for good measure), but
again hit issues because the namespace is rebuilt from scratch -- any
binds of /386, /amd64, /cfg/pxe, etc. into the tftp-specific directory
disappeared from tftpd's namespace and rendered my *9front* boxes
unable to boot. I could maintain copies of the needed files in the
tftp-specific directory, but that'd be kind of a drag.

The following patch adds a -n flag to allow the specification of a
namespace file in place of /lib/namespace; similar to ip/ftpd.

I thought about setting up a /lib/namespace.tftp to act as a default
rather than continuing to use /lib/namespace by default (which
security-wise is about the same as allowing 9p mounts by user none,
which I also have disabled), but I had trouble coming up with a sane
default. Maybe someone more experienced would like to try that out.

- sam-d

3 years agoip/tftpd: use procsetuser() instead of writing #c/user
cinap_lenrek [Tue, 23 Feb 2021 00:41:09 +0000 (01:41 +0100)]
ip/tftpd: use procsetuser() instead of writing #c/user

3 years agoboot/bcm: download dtb files for rpi-400 and rpi-cm4
cinap_lenrek [Mon, 22 Feb 2021 22:44:28 +0000 (23:44 +0100)]
boot/bcm: download dtb files for rpi-400 and rpi-cm4

3 years agolibaml: fix IndexField and BankField implementations (thanks Michael Forney)
cinap_lenrek [Mon, 22 Feb 2021 18:27:49 +0000 (19:27 +0100)]
libaml: fix IndexField and BankField implementations (thanks Michael Forney)

IndexField is supposed to increment the index value when an
access is done with a bigger size than the data field.
The index value is always a byte offset.

Now that we always calculate the offset for each field unit
access for IndexField, rename the indexv to bank (the bank
value), as it is only used for that. Also, do not compare
it with nil, as it is a integer constant which can be
encoded as nil to mean zero.

For BankField, the banking field was written using store(),
which does nothing when the destination is a Field*.
Use rwfield() to fix it in the new rwfieldunit().

Resolve all the Name*'s when IndexField, BankField and
Field are created. Now, Field.reg points to eigther
Buffer object, Region or Field (data Field of an IndexField).

PS: initial bug report by Michael Forney follows below:

In /dev/kmesg on my T14, I saw a message

amlmapio: [0xffffff18-0x100000018] overlaps usable memory
amlmapio: mapping \_SB.FRTP failed

Here is the relevant snippet from my DSDT:

    Scope (_SB)
    {
        ...

        OperationRegion (ECMC, SystemIO, 0x72, 0x02)
        Field (ECMC, AnyAcc, NoLock, Preserve)
        {
            ECMI,   8,
            ECMD,   8
        }

        IndexField (ECMI, ECMD, ByteAcc, NoLock, Preserve)
        {
            Offset (0x08),
            FRTB,   32
        }

        OperationRegion (FRTP, SystemMemory, FRTB, 0x0100)
        Field (FRTP, AnyAcc, NoLock, Preserve)
        {
...
        }
    }

With some debugging output:

amlmapio(\_SB.ECMC): Io       72 - 74
rwreg(\_SB.ECMC): Io       [72+0]/1 <- 8
rwreg(\_SB.ECMC): Io       [72+1]/1 -> 18
amlmapio(\_SB.FRTP): Mem      ffffff18 - 100000018
amlmapio: [0xffffff18-0x100000018) overlaps usable memory
amlmapio: mapping \_SB.FRTP failed

It seems that libaml does not handle IndexField correctly and just did
a single read from ECMD after setting ECMI to 8, causing the FRTP
region to be evaluated as 0xffffff18-0x100000018. Instead, it should
be reading 4 bytes [18 c0 22 cc], evaluating it as
0xcc22c018-0xcc22118:

amlmapio(\_SB.ECMC): Io       72 - 74
rwreg(\_SB.ECMC): Io       [72+0]/1 <- 8
rwreg(\_SB.ECMC): Io       [72+1]/1 -> 18
rwreg(\_SB.ECMC): Io       [72+0]/1 <- 9
rwreg(\_SB.ECMC): Io       [72+1]/1 -> c0
rwreg(\_SB.ECMC): Io       [72+0]/1 <- a
rwreg(\_SB.ECMC): Io       [72+1]/1 -> 22
rwreg(\_SB.ECMC): Io       [72+0]/1 <- b
rwreg(\_SB.ECMC): Io       [72+1]/1 -> cc
amlmapio(\_SB.FRTP): Mem      cc22c018 - cc22c118

I wrote a patch (attached) to fix this, and it seems to work. Though,
it's not clear to me when things should be dereferenced. Previously,
the data field was dereferenced at evalfield, but the region and index
field were not until rwfield. After the patch, the index field is
also dereferenced in evalfield.

For BankField, the index *is* dereferenced in evalfield. I'm pretty
sure that this means that BankField does not work currently, since
store() just returns nil for 'f' objects. The bank selector will
never get set.

Anyway, I don't know if this solves any real problems; it's just
something I noticed and thought I'd try to fix.

3 years agogames/snes: use 4-point hermite interpolation to resample
Michael Forney [Mon, 22 Feb 2021 15:12:24 +0000 (16:12 +0100)]
games/snes: use 4-point hermite interpolation to resample

This is noticeably better than nearest-neighbor.

3 years agotheo: wrong.
Sigrid [Mon, 22 Feb 2021 10:38:05 +0000 (11:38 +0100)]
theo: wrong.

3 years agoape/lib9: expose fd2path (thanks phil9)
Ori Bernstein [Sun, 21 Feb 2021 05:02:07 +0000 (21:02 -0800)]
ape/lib9: expose fd2path (thanks phil9)

Fd2path is a useful call for the netsurf plan9 frontend,
so we should expose it.