Commit graph

8323 commits

Author SHA1 Message Date
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
Ori Bernstein 5b8b5884f4 5l: fix shifts by zero
on arm32, we can do one of 4 shifts
by a constant:

	reg<<(0..31)
	reg>>(1..32)
	((u32int)reg)>>(1..32)
	reg ROT (0..31)

There's no way to encode a 0 bit right
shift,  so when encoding reg>>0, flip
it to the equivalent nop reg<<0, which
can be encoded.
2021-01-23 20:36:09 -08:00
Ori Bernstein f76e28cb71 ape/libm: add back fmod, remove modf
We removed the wrong file. Put it back.
2021-01-23 20:03:07 -08:00
Michael Forney 988bdd05a3 [9front] ape: remove _SUSV2_SOURCE guard from inttypes.h
inttypes.h was added to C99, and this is the only header that used
_SUSV2_SOURCE.

Also, remove now unneeded _SUSV2_SOURCE from python mkfile.
2021-01-23 19:47:12 -08:00
Michael Forney 443d5256bd [9front] nusb(4): fix typo 2021-01-23 19:46:57 -08:00
Michael Forney e8b8cec9c7 [9front] cc: fix comparison warning with constant LHS
This prevents an incorrect warning for a comparison such as `0 < x`,
where x is an unsigned type.  Previously, this would get normalized as
`x >= 0` rather than `x > 0` when checking the comparison.
2021-01-23 18:28:08 -08:00
Michael Forney a8834acf73 [9front] cc: remove unnecessary 128-bit add function
Instead, just change the comparisons from <=/>= to </>.
2021-01-23 18:26:34 -08:00
Ori Bernstein ed2b1d5c61 upas/fs: fix swapped argument, dead code
With ntlm auth, we were trying to set 0 bytes of
the auth struct to its size. The args were clearly
swapped. Fix it.

While we're here, remove some dead code.
2021-01-23 18:02:46 -08:00
Ori Bernstein f164ee6dd9 upas/runq: fix typo
one slipped in to the last commit.
2021-01-23 16:38:32 -08:00
Ori Bernstein 51319cc5b5 upas/runq: bring back -a
Turns out -a is useful in crontab, so bring
back a simplified version of it. This only
iterates through directories one at a time.
2021-01-23 16:05:21 -08:00
qwx 41f85d46f8 ape: update mkfile for removed fmod.c 2021-01-24 00:58:47 +01:00
Ori Bernstein bd5af0df5d vnc: I don't like your face.
Cosmetic improvements to vnc auth code.
Should not have user-visible changes.
2021-01-23 13:20:09 -08:00
Ori Bernstein f321298c55 upas/runq: support parallel queue processing, drop -a
When running a mail queue, it's useful to run it with limited
parallelism. This helps mailing lists process messages in a
reasonable time.

At the same time, we can remove the load balancing from runq,
since the kinds of systems that this matters on no longer
exist, and running multiple queues at once can be better
done through xargs.
2021-01-23 11:03:05 -08:00
cinap_lenrek 5e20e8f963 vt(1): document optional command argument (thanks sl) 2021-01-23 18:42:46 +01:00
cinap_lenrek 6d012d2df0 ape: apply infinite recursion in fmod() fix (thanks jxy and ality)
Apply changeset 2880:cab2b9d13a73 to ape's fmod() implementation.

Remove the unused math/fmod.c copy.
2021-01-23 15:53:56 +01:00
cinap_lenrek b5c7158f39 syscall: don't rely on . being in $path (thanks Silas) 2021-01-23 15:06:30 +01:00
Sigrid a9e70446a0 nusb/kb: correct Mod4 scancode (125 → 91, to match what kbdfs has) 2021-01-22 17:48:41 +01:00
Sigrid 9025176193 aux/acpi: do not expose empty files 2021-01-22 10:57:43 +01:00
Sigrid 6a78bb2e4f stats: don't query battery and temp as often when using acpi
Querying battery (or temperature) using ACPI takes quite some
resources, which makes the battery discharge faster.  It doesn't make
much sense to have it queried as often either.  So, when using ACPI:

1) set battery query period to 10s minimum
2) set temperature query period to 5s minimum
2021-01-22 10:15:36 +01:00
Ori Bernstein 1047b53efc ape/libap: fix _startbuf, check rfork return (thanks pixelherodev)
When _startbuf is invoked, it would crash on the second invocation
if creating a mux segment failed. This is because the first attempt
would assign the return value -1 to the global mux variable, and
the second attempt would notice that the global mux was not nil,
and would attempt to use it.

This change only assigns to the global variable if the allocation
of the segment was a success.

While we're here, we should also check the return of the rfork call.
2021-01-19 19:56:38 -08:00
Ori Bernstein 50efe18550 webcookies: remove straggling custom date parser
One place missed in the tmdate purge.
2021-01-19 18:14:53 -08:00