]> git.lizzy.rs Git - plan9front.git/log
plan9front.git
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.

3 years agoupas/send: add \n to error in refuse() (thanks josuah)
Ori Bernstein [Sat, 20 Feb 2021 23:25:25 +0000 (15:25 -0800)]
upas/send: add \n to error in refuse() (thanks josuah)

3 years agomarshal: remove debug junk.
Ori Bernstein [Sat, 20 Feb 2021 21:03:35 +0000 (13:03 -0800)]
marshal: remove debug junk.

Oops.

3 years agoupas/marshal: use login instead of user (thanks sirjofri)
Ori Bernstein [Sat, 20 Feb 2021 21:01:48 +0000 (13:01 -0800)]
upas/marshal: use login instead of user (thanks sirjofri)

User is the upasname, and is unlikely to exist when we save
the message to the outbox. We should use the login name instead.

3 years agoupas/marshal: handle nonexistent save folder correctly (thanks sirjofri)
Ori Bernstein [Sat, 20 Feb 2021 20:49:03 +0000 (12:49 -0800)]
upas/marshal: handle nonexistent save folder correctly (thanks sirjofri)

When the save folder did not exist, and we could not create
it, we would handle up to one Biobuf worth of message, and
then fail, due to a failed tee. The sequence of events leading
up to this was:

openfolder() -> error
tee(0, fd, -1) -> wait for read
write(0, data) ->
write(fd, data) -> ok
write(-1, data) -> error, tee terminates
write(0, attachment) -> error

This change prevents us from writing to a closed fd, and
therefore from erroring out when sending.

We also warn the user.

3 years agoether82563: add pci id for i219-LM on thinkcenter (easypeasy, thanks hiro)
cinap_lenrek [Sat, 20 Feb 2021 18:06:59 +0000 (19:06 +0100)]
ether82563: add pci id for i219-LM on thinkcenter (easypeasy, thanks hiro)

3 years agopc/devarch: use m->cpumhz instead of recalculatin it
cinap_lenrek [Sat, 20 Feb 2021 12:08:59 +0000 (13:08 +0100)]
pc/devarch: use m->cpumhz instead of recalculatin it

3 years ago9boot: handle automatic length for 64-bit values in hexfmt() for framebuffer address...
cinap_lenrek [Sat, 20 Feb 2021 11:55:42 +0000 (12:55 +0100)]
9boot: handle automatic length for 64-bit values in hexfmt() for framebuffer address (thanks Michael Forney)

3 years ago/sys/src/cmd/ndb/dns.h:
sl [Sat, 20 Feb 2021 02:29:55 +0000 (21:29 -0500)]
/sys/src/cmd/ndb/dns.h:

---

To: 9front@9front.org
Date: Sun, 07 Feb 2021 14:56:39 +0100
From: kvik@a-b.xyz
Subject: Re: [9front] transient dns errors cause smtp failure
Reply-To: 9front@9front.org
I think I found a reason for DNS failing on known good domains.

/sys/src/cmd/ndb/dns.h:156,157
/* tune; was 60*1000; keep it short */
Maxreqtm= 8*1000, /* max. ms to process a request */

So, 8 seconds is how much the resolver will bother with a request it
has been handed, before dropping it on the floor with little
explanation.

It seems quite possible that this is too short a timeout on a machine
during a spam queue run, which predictably stresses the compute and
network resources.

In turn, negative response caching might explain why a particular
unlucky domain would basically stop receiveing any mail for a while.

I'm dying to know if bumping this limit would clear up the queue of
such DNS errors.

---

[narrator: it did.]

3 years agosam/{address.c, sam.h}: bump STRSIZE to 512MB (thanks, Ori_B)
sl [Sat, 20 Feb 2021 02:15:15 +0000 (21:15 -0500)]
sam/{address.c, sam.h}: bump STRSIZE to 512MB (thanks, Ori_B)

3 years agolibstdio: sync bits of vfprintf from APE
kvik [Fri, 19 Feb 2021 22:04:09 +0000 (23:04 +0100)]
libstdio: sync bits of vfprintf from APE

* Add the %ll length modifier,
* Convert nil to "<nil>" under %s (not in APE),
* Cast void* to uintptr under %p,
* Use "0x" hex prefix under %p,
* Fix manual page mentions of %P to %p,
* Fix empty result for fp conversions,
* Fix zero padding of left-aligned fp conversions,
* Remove deprecated #pragma ref uses.

Most of these were introduced in APE prior to 9front.

I've omitted the %z conversion specifier since Plan 9 code
rarely uses the usize type. This may need to be added later
for the benefit of native ports of alien code.

3 years agonan(2): document isInf(x, 0) matching +∞ and -∞
kvik [Thu, 18 Feb 2021 20:40:30 +0000 (21:40 +0100)]
nan(2): document isInf(x, 0) matching +∞ and -∞

3 years agoaudio/flacenc: fix usage
Sigrid [Thu, 18 Feb 2021 14:13:25 +0000 (15:13 +0100)]
audio/flacenc: fix usage

3 years agogames/snes: use enum constants KON and ENDX instead of their values
Michael Forney [Wed, 17 Feb 2021 10:20:13 +0000 (11:20 +0100)]
games/snes: use enum constants KON and ENDX instead of their values

3 years agogames/snes: implement DSP echo
Michael Forney [Wed, 17 Feb 2021 10:20:05 +0000 (11:20 +0100)]
games/snes: implement DSP echo

3 years agogames/snes: implement DSP noise
Michael Forney [Wed, 17 Feb 2021 10:19:50 +0000 (11:19 +0100)]
games/snes: implement DSP noise

I'm not sure if this LFSR is the same one used by the hardware or is
arbitrary, but it matches the noise sequence used by all other snes
emulators I looked at.

3 years agogames/snes: fix BRR decoding with filters 2 and 3
Michael Forney [Wed, 17 Feb 2021 10:19:39 +0000 (11:19 +0100)]
games/snes: fix BRR decoding with filters 2 and 3

s1 and s2 should store the last and next to last output, but were set
in the wrong order, causing them both to be the last output. This
breaks filters 2 and 3, which both utilize s2.

3 years agomothra: tune up entry control logic for easier text editing
Sigrid [Tue, 16 Feb 2021 21:04:50 +0000 (22:04 +0100)]
mothra: tune up entry control logic for easier text editing

3 years ago9boot: mark efi boot and runtime service regions as reserved
cinap_lenrek [Mon, 15 Feb 2021 00:49:30 +0000 (01:49 +0100)]
9boot: mark efi boot and runtime service regions as reserved

despite the kernel never doing any efi runtime service calls,
overriding the runtime service regions makes some machines
lock up. so consider them reserved.

the boot service regions should also, in theory, be usable
by the os, but linux says otherwise...

3 years agondb/dns: implement RFC6844 certificate authority authorization record type
cinap_lenrek [Sun, 14 Feb 2021 13:25:41 +0000 (14:25 +0100)]
ndb/dns: implement RFC6844 certificate authority authorization record type

3 years ago[9front] audio/flacenc: fix error check for fseeko
Michael Forney [Thu, 11 Feb 2021 08:37:36 +0000 (09:37 +0100)]
[9front] audio/flacenc: fix error check for fseeko
fseeko returns 0 on success, not the new stream position.

This allows flacenc to update the streaminfo block when it is finished
(for example to set the number of samples and checksum).

3 years agofont/terminus: you can't run a font, silly
Ori Bernstein [Wed, 10 Feb 2021 23:42:18 +0000 (15:42 -0800)]
font/terminus: you can't run a font, silly

Remove the execute bit from the fonts.

3 years agonusb: don't create rw iso endpoints (by Michael Forney)
cinap_lenrek [Wed, 10 Feb 2021 19:08:13 +0000 (20:08 +0100)]
nusb: don't create rw iso endpoints (by Michael Forney)

There may be two iso endpoints with the same ID if it is asynchronous
or adaptive (one for data, one for feedback), and rw iso endpoints are
unusable (error out with "iso i/o is half-duplex").

3 years agonusb: don't create rw iso endpoints (by Michael Forney)
cinap_lenrek [Wed, 10 Feb 2021 18:52:00 +0000 (19:52 +0100)]
nusb: don't create rw iso endpoints (by Michael Forney)

There may be two iso endpoints with the same ID if it is asynchronous
or adaptive (one for data, one for feedback), and rw iso endpoints are
unusable (error out with "iso i/o is half-duplex").

3 years agomerge
Ori Bernstein [Wed, 10 Feb 2021 18:21:06 +0000 (10:21 -0800)]
merge

3 years agofortunes: That depends on how you define native. -- Andre Garzia
sl [Wed, 10 Feb 2021 04:11:08 +0000 (23:11 -0500)]
fortunes: That depends on how you define native. -- Andre Garzia

3 years agonewt: remove fn f, replace with walk
sl [Wed, 10 Feb 2021 03:50:31 +0000 (22:50 -0500)]
newt: remove fn f, replace with walk

3 years agostdio: remove erronous assert in dtoa
Ori Bernstein [Tue, 9 Feb 2021 21:57:38 +0000 (13:57 -0800)]
stdio: remove erronous assert in dtoa

The value of `k` in dtoa() is an estimate of
floor(log10(d)), where `d` is the number being
converted. The code was asserting that 'k' was
less than 100, but the full range of a double
goes to 10^308 or so.

This means that the majority of the range of
a double would trigger that assert.

3 years ago[9front] mimetype: add entry for .patch extension
Michael Forney [Tue, 9 Feb 2021 05:09:17 +0000 (21:09 -0800)]
[9front] mimetype: add entry for .patch extension
This way, upas/vf won't flag .patch files as suspicious by default.

3 years ago[9front] upas/vf: exclude mime boundary from temporary attachment files
Michael Forney [Tue, 9 Feb 2021 04:59:01 +0000 (20:59 -0800)]
[9front] upas/vf: exclude mime boundary from temporary attachment files
validateattachment has no business with the mime boundary; it is not
part of the attachment itself.

Also, it causes the boundary to be dropped in the message output from
upas/vf, effectively dropping the following attachment (though the
content is still present after the last boundary of the wrapped first
attachment part).

Consider the following sequence of events:
1. upas/vf is run on a message containing two attachments.
2. The first attachment does not have a known extension, so is saved
   to a temporary file *including* the following mime boundary.
3. This file is opened as p->tmpbuf, which is used for subsequent
   reads until switching back to stdin.
4. The attachment fails validateattachment, so upas/vf wraps it in a
   multipart with a warning message.
5. problemchild() calls passbody(p, 0), which copies from p->tmpbuf
   until it hits the outer boundary line, which it excludes, seeks
   back one line, then returns the outer multipart.
6. problemchild() then writes its own boundary, and then copies one
   line from *stdin* to stdout, expecting the outer boundary.
   However, this boundary was already read from stdin in 2, so it ends
   up reading the first line of the subsequent part instead.

To fix this, pass 0 to passbody() in save() to exclude it from the
attachment file and make it available in stdin when expected.

3 years agoape/lib9: sync arm getfcr.s implementation
Ori Bernstein [Tue, 9 Feb 2021 00:07:09 +0000 (16:07 -0800)]
ape/lib9: sync arm getfcr.s implementation

The arm assembler supports movw to handle
getfcr and setfcr now, no need to hack it
with macros; sync from plan9 libc.

3 years agoape: sync flaot.h macros with u.h
Ori Bernstein [Mon, 8 Feb 2021 23:45:11 +0000 (15:45 -0800)]
ape: sync flaot.h macros with u.h

The float.h macros got out of sync with u.h,
some of them missing and some of them being
incorrect. This change brings them back in
line.

3 years agoMail: correct rendering of nested multipart messages
Ori Bernstein [Mon, 8 Feb 2021 04:30:04 +0000 (20:30 -0800)]
Mail: correct rendering of nested multipart messages

Reading nested subparts of messages into the root
message array allows deeply nested multipart trees
of messages to show correctly in the message view.

3 years ago[9front] upas/vf: remove debugging print statements
Michael Forney [Mon, 8 Feb 2021 04:17:06 +0000 (20:17 -0800)]
[9front] upas/vf: remove debugging print statements
These messages aren't useful and were presumably left over from
someone debugging this code.

3 years agogames/gb: fix reversed audio channels
Michael Forney [Mon, 8 Feb 2021 03:58:49 +0000 (04:58 +0100)]
games/gb: fix reversed audio channels
The high bits correspond to the left channel, and the low bits to the
right channel.

Reference: https://gbdev.io/pandocs/#sound-control-registers

Tested with pokemon crystal.

3 years agogames/gb: various HDMA fixes
Michael Forney [Mon, 8 Feb 2021 03:58:41 +0000 (04:58 +0100)]
games/gb: various HDMA fixes
H-blank DMA should only transfer 16 bytes per h-blank, rather than
waiting for the first h-blank and then transferring the whole size.

HDMAC should read 0xff when the transfer is finished, and 0 in the
high bit when the transfer is ongoing. Also, if 0 is written in the
high bit, the current transfer should be aborted.

Introduce two flags, DMAREADY and DMAHBLANK rather than special
constants 1 and -1. If dma is non-zero, there is an ongoing DMA. If
DMAREADY is set, the next chunk is ready to transfer.

Reference: https://gbdev.io/pandocs/#ff55-hdma5-cgb-mode-only-new-dma-length-mode-start

Tested with pokemon crystal.

What was happening is that when the game was loading N background tiles
into vram (each 16 bytes, so one per h-blank), it did something like
this:
- start an hdma transfer for N+1 tiles
- after the Nth tile is transferred, it would read HDMA5, clear the
high bit, then write it back to abort the transfer.

games/gb would instead transfer all N+1 tiles at once, overwriting one
extra tile with whatever was 1 past the end of the source array, and
then would interpret the cancel request as the start of a new transfer
of 16 bytes, which would copy an additional tile past the end. The end
result is that every transfer would end up copying N+2 tiles instead
of just N, overwriting certain tiles with whatever was after the end
of the source data.

3 years agogames/gb: fix timer divider for input clock 0
Michael Forney [Mon, 8 Feb 2021 03:58:02 +0000 (04:58 +0100)]
games/gb: fix timer divider for input clock 0
According to [0], input clock 0 should divide by 1024=2¹⁰, not 2¹².
This caused audio to run at quarter-speed in one game I tried.

[0] https://gbdev.io/pandocs/#ff07-tac-timer-control-r-w

Tested with zelda: oracle of seasons, and dr. mario
---

3 years ago[9front] upas/vf: install %τ format specifier
Michael Forney [Sun, 7 Feb 2021 16:02:36 +0000 (08:02 -0800)]
[9front] upas/vf: install %τ format specifier
upas/vf was converted to use tmdate, but the formatter was never
installed.  This caused it to send attachments to validateattachment
with header `From virusfilter %τ%`, which always failed since upas/fs
would just skip over the message.

3 years agomerge
cinap_lenrek [Sat, 6 Feb 2021 12:50:06 +0000 (13:50 +0100)]
merge

3 years agobcm64: get inbound and outbound pci window base address from device tree
cinap_lenrek [Sat, 6 Feb 2021 12:47:45 +0000 (13:47 +0100)]
bcm64: get inbound and outbound pci window base address from device tree

On the pi400, the xhci reset firmware mailbox request
assumes that the pci windows match the ones specified
in the device tree. The inbound window (pcidmawin)
also varies now depending on the amount of memory
installed.

It is all pretty ridiculous, as the firmware could as
well just read the pci controllers hardware register
to determine the window configuration and the os could
keep a nice simple 1:1 mapping (with pci dma addresses
== physical addresses).

3 years agopc: increase number of Conf.mem[] entries from 4 to 16
cinap_lenrek [Sat, 6 Feb 2021 12:33:58 +0000 (13:33 +0100)]
pc: increase number of Conf.mem[] entries from 4 to 16

3 years agopc, pc64: warn when running out of conf.mem[] entries in meminit()
cinap_lenrek [Sat, 6 Feb 2021 12:33:27 +0000 (13:33 +0100)]
pc, pc64: warn when running out of conf.mem[] entries in meminit()

3 years agotest: fix expression parser
Alex Musolino [Sat, 6 Feb 2021 05:21:09 +0000 (15:51 +1030)]
test: fix expression parser

The old parser code was rubbish and only worked for trivial
expressions.  The new code properly handles complex expressions,
including short circuit evaluation.

As such, the BUGS section has been removed from the test(1) man page.
The description of an unimplemented feature has also been removed.

3 years agolibdraw: enter/eenter: fix ^W removing the text on the right side of the tick
Sigrid [Thu, 4 Feb 2021 09:57:37 +0000 (10:57 +0100)]
libdraw: enter/eenter: fix ^W removing the text on the right side of the tick

3 years agolibdraw: enter/eenter: fix Kleft for non-ascii text
Sigrid [Thu, 4 Feb 2021 09:45:52 +0000 (10:45 +0100)]
libdraw: enter/eenter: fix Kleft for non-ascii text

3 years ago[9front] [PATCH] audiohda: add PCI ID for Intel C610/X99
Michael Forney [Thu, 4 Feb 2021 00:19:57 +0000 (16:19 -0800)]
[9front] [PATCH] audiohda: add PCI ID for Intel C610/X99
---
Tested and seems to work fine.

3 years agoacmemail(1): Nail => Mail
Ori Bernstein [Wed, 3 Feb 2021 19:09:43 +0000 (11:09 -0800)]
acmemail(1): Nail => Mail

Forgot to change the program name when importing
the rewrite.

3 years agomklib, upas/common: clean up libcommon properly (thanks mikan)
Ori Bernstein [Wed, 3 Feb 2021 16:10:11 +0000 (08:10 -0800)]
mklib, upas/common: clean up libcommon properly (thanks mikan)

Despite pervious efforts, mk clean still doesn't remove libcommon.a*
files from cmd/upas/common/. To fix this, let's tell cmd/mklib to do
the job instead.

3 years agoacme: fix use after free in warning() call (thanks igor)
cinap_lenrek [Wed, 3 Feb 2021 00:19:19 +0000 (01:19 +0100)]
acme: fix use after free in warning() call (thanks igor)

3 years agomerge
Ori Bernstein [Tue, 2 Feb 2021 15:21:47 +0000 (07:21 -0800)]
merge

3 years agorunq: clean up code, fix error handling.
Ori Bernstein [Tue, 2 Feb 2021 14:52:00 +0000 (06:52 -0800)]
runq: clean up code, fix error handling.

Runq spawns a number of processes, and wait()s for them
in 2 different places. Because of the way that the exit
handling is done, the wait can get the wrong message.

It turns out that only one place in the code needs to
wait for the child, and in all other cases, it's just
muddling the problem.

This change adds the RFNOWAIT call to all the processes
we don't need to wait for, so that the places that do
need wait will always get the correct child.

3 years agofortunes: SATAN
Sigrid [Tue, 2 Feb 2021 11:51:22 +0000 (12:51 +0100)]
fortunes: SATAN

3 years agowinwatch: always reflow when possible (thanks telephil9)
Sigrid [Tue, 2 Feb 2021 10:56:45 +0000 (11:56 +0100)]
winwatch: always reflow when possible (thanks telephil9)

3 years agoMail: only clear upas-maintained flags on change (thanks deuteron)
Ori Bernstein [Tue, 2 Feb 2021 04:38:40 +0000 (20:38 -0800)]
Mail: only clear upas-maintained flags on change (thanks deuteron)

When message flags change, Mail would clear all the flags and
recompute them. This would clobber internal flags like Ftodel.
So, don't do that.

3 years agomothra: don't insert newline after div (thanks phil9)
Ori Bernstein [Sun, 31 Jan 2021 20:25:03 +0000 (12:25 -0800)]
mothra: don't insert newline after div (thanks phil9)

3 years agoape/libm: implement log2 in libc
Ori Bernstein [Sat, 30 Jan 2021 17:19:57 +0000 (09:19 -0800)]
ape/libm: implement log2 in libc

3 years agoMail: fix inverted reply-all condition
Ori Bernstein [Sat, 30 Jan 2021 02:29:01 +0000 (18:29 -0800)]
Mail: fix inverted reply-all condition

3 years agoMail: rewrite.
Ori Bernstein [Sat, 30 Jan 2021 01:34:47 +0000 (17:34 -0800)]
Mail: rewrite.

Acme mail made it hard to do threading, so I wrote a new one.

3 years agoscreenlock: use initdisplay(2), top the window (thanks stuart morrow)
Ori Bernstein [Fri, 29 Jan 2021 02:07:48 +0000 (18:07 -0800)]
screenlock: use initdisplay(2), top the window (thanks stuart morrow)

Screenlock should use libdraw(2) to init the display
and create the window, instead of looking at the screen
file directly. Also, to prevent new windows from popping
up over screenlock, bring it to the top periodically.

3 years agonews: make -a and -n get along (thanks lyndon)
Ori Bernstein [Wed, 27 Jan 2021 02:07:04 +0000 (18:07 -0800)]
news: make -a and -n get along (thanks lyndon)

currently, -a and -n are mutually exclusive.
this change allows them to be used together.