Commit graph

8343 commits

Author SHA1 Message Date
kvik 1ce6f0f2ab nan(2): document isInf(x, 0) matching +∞ and -∞ 2021-02-18 21:40:30 +01:00
Sigrid ca1542a199 audio/flacenc: fix usage 2021-02-18 15:13:25 +01:00
Michael Forney 8aff377698 games/snes: use enum constants KON and ENDX instead of their values 2021-02-17 11:20:13 +01:00
Michael Forney 03eeebb97f games/snes: implement DSP echo 2021-02-17 11:20:05 +01:00
Michael Forney f1d29a9d12 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.
2021-02-17 11:19:50 +01:00
Michael Forney 52b54097bf 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.
2021-02-17 11:19:39 +01:00
Sigrid 79cf39c53a mothra: tune up entry control logic for easier text editing 2021-02-16 22:04:50 +01:00
cinap_lenrek 04bf70d344 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...
2021-02-15 01:49:30 +01:00
cinap_lenrek b5690a5ae7 ndb/dns: implement RFC6844 certificate authority authorization record type 2021-02-14 14:25:41 +01:00
Michael Forney 5fd4fa912e [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).
2021-02-11 09:37:36 +01:00
Ori Bernstein f2974b6cfa font/terminus: you can't run a font, silly
Remove the execute bit from the fonts.
2021-02-10 15:42:18 -08:00
cinap_lenrek 2f28aaac65 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").
2021-02-10 20:08:13 +01:00
cinap_lenrek d7ade692c8 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").
2021-02-10 19:52:00 +01:00
Ori Bernstein 8606fc8f29 merge 2021-02-10 10:21:06 -08:00
sl e31773cbf3 fortunes: That depends on how you define native. -- Andre Garzia 2021-02-09 23:11:08 -05:00
sl 72868594c7 newt: remove fn f, replace with walk 2021-02-09 22:50:31 -05:00
Ori Bernstein 0719ce2aa7 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.
2021-02-09 13:57:38 -08:00
Michael Forney ac5a8ea1e2 [9front] mimetype: add entry for .patch extension
This way, upas/vf won't flag .patch files as suspicious by default.
2021-02-08 21:09:17 -08:00
Michael Forney 29fbba7b6d [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.
2021-02-08 20:59:01 -08:00
Ori Bernstein 2d8adc7b88 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.
2021-02-08 16:07:09 -08:00
Ori Bernstein 566c3ca2de 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.
2021-02-08 15:45:11 -08:00
Ori Bernstein 491fe25158 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.
2021-02-07 20:30:04 -08:00
Michael Forney e20dcb151a [9front] upas/vf: remove debugging print statements
These messages aren't useful and were presumably left over from
someone debugging this code.
2021-02-07 20:17:06 -08:00
Michael Forney 415c110b28 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.
2021-02-08 04:58:49 +01:00
Michael Forney e502abe001 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.
2021-02-08 04:58:41 +01:00
Michael Forney 655170c873 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
---
2021-02-08 04:58:02 +01:00
Michael Forney 827bf1b7da [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.
2021-02-07 08:02:36 -08:00
cinap_lenrek d5f9514304 merge 2021-02-06 13:50:06 +01:00
cinap_lenrek efcfdd23d7 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).
2021-02-06 13:47:45 +01:00
cinap_lenrek 0e381493bf pc: increase number of Conf.mem[] entries from 4 to 16 2021-02-06 13:33:58 +01:00
cinap_lenrek e9af397dc7 pc, pc64: warn when running out of conf.mem[] entries in meminit() 2021-02-06 13:33:27 +01:00
Alex Musolino b562b269ce 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.
2021-02-06 15:51:09 +10:30
Sigrid 4ec97f73ee libdraw: enter/eenter: fix ^W removing the text on the right side of the tick 2021-02-04 10:57:37 +01:00
Sigrid e0bfd148e2 libdraw: enter/eenter: fix Kleft for non-ascii text 2021-02-04 10:45:52 +01:00
Michael Forney 49220af76e [9front] [PATCH] audiohda: add PCI ID for Intel C610/X99
---
Tested and seems to work fine.
2021-02-03 16:19:57 -08:00
Ori Bernstein 79c4c039ab acmemail(1): Nail => Mail
Forgot to change the program name when importing
the rewrite.
2021-02-03 11:09:43 -08:00
Ori Bernstein 101312c1d7 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.
2021-02-03 08:10:11 -08:00
cinap_lenrek 01ab07ef72 acme: fix use after free in warning() call (thanks igor) 2021-02-03 01:19:19 +01:00
Ori Bernstein 3c1022a3de merge 2021-02-02 07:21:47 -08:00
Ori Bernstein 49d7ca8d92 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.
2021-02-02 06:52:00 -08:00
Sigrid 3ff21a0e93 fortunes: SATAN 2021-02-02 12:51:22 +01:00
Sigrid bd78bad3c7 winwatch: always reflow when possible (thanks telephil9) 2021-02-02 11:56:45 +01:00
Ori Bernstein 34ed7f7aa2 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.
2021-02-01 20:38:40 -08:00
Ori Bernstein c20f68f801 mothra: don't insert newline after div (thanks phil9) 2021-01-31 12:25:03 -08:00
Ori Bernstein bb250c4c3b ape/libm: implement log2 in libc 2021-01-30 09:19:57 -08:00
Ori Bernstein 273c4bff7a Mail: fix inverted reply-all condition 2021-01-29 18:29:01 -08:00
Ori Bernstein bee6271ae1 Mail: rewrite.
Acme mail made it hard to do threading, so I wrote a new one.
2021-01-29 17:34:47 -08:00
Ori Bernstein 319e625be0 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.
2021-01-28 18:07:48 -08:00
Ori Bernstein a5517fca5f news: make -a and -n get along (thanks lyndon)
currently, -a and -n are mutually exclusive.
this change allows them to be used together.
2021-01-26 18:07:04 -08:00
Ori Bernstein 21e5726f43 cc: mk clean should delete cc.a$O
It's surprising when 'mk clean' doesn't actually
do a clean build in cc -- fix this.
2021-01-24 09:58:39 -08:00