summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2020-11-30tmdate(2): remove liesOri Bernstein
Initially the code tried to guess the date format. This turned out to be a bit too magical, so the feature was removed, but the manpage still documented the nonfeature.
2020-11-29rio: avoid redrawing window text on resize for programs using libdrawcinap_lenrek
As long as the client as the mouse file open and maintains reading the winname file of the window after a resize we will avoid drawing the text frame on a resize as it will be overdrawn by the client. This reduces flicker on resize somewhat for slow systems.
2020-11-29pc, pc64, xen: rewrite interrupt handling codecinap_lenrek
This implements proper intrdisable() support for all interrupt controllers. For enable, (*arch->intrassign)(Vctl*) fills in the Vctl.enable and Vctl.disable pointers with the appropriate routines and returns the assigned vector number. Once the Vctl struct has been linked to its vector chain, Vctl.enable(Vctl*, shared) gets called with a flag if the vector has been already enabled (shared). This order is important here as enabling the interrupt on the controller before we have linked the chain can cause spurious interrupts, expecially on mp system where the interrupt can target a different cpu than the caller of intrenable(). The intrdisable() case is the other way around. We first disable the interrupt on the controller and after that unlink the Vctl from the chain. On a multiprocessor, the xfree() of the Vctl struct is delayed to avoid freeing it while it is still in use by another cpu. The xen port now also uses pc/irq.c which has been made generic enougth to handle xen's irq scheme. Also, archgeneric is now a separate file to avoid pulling in dependencies from the 8259 interrupt controller code.
2020-11-28games/mix: fix decoding of shift instructionsAlex Musolino
2020-11-28games/mix: fix SLAX and SRAX instructions (thanks nicolagi)Alex Musolino
MIX shift instructions shift by bytes not bits.
2020-11-27fplot: add hyperbolic functionsSigrid
2020-11-27fplot(1): use abs()Sigrid
2020-11-27fplot: add absSigrid
2020-11-27mergeAlex Musolino
2020-11-27games/mix: fix implementation of MOVE instruction (thanks nicolagi)Alex Musolino
Plan 9 memcpy(2) uses the same implementation as memmove(2) to handle overlapping ranges. Hovewer, the MIX MOVE instruction, as described in TAOCP, specifically does not do this. It copies words one at a time starting from the lowest address. This change also expands the address validation to check that all addresses within the source and destination ranges are valid before proceeding.
2020-11-26kbmap/neo2: add support for neo2 kbmak (thanks jstsmthrgk)Ori Bernstein
2020-11-25upas: fix mk nukeAlex Musolino
2020-11-22g: fix typo in last commitOri Bernstein
2020-11-22upas/*: fix mkfile issues (thanks amavect)Ori Bernstein
Fixes 3 issues in our upas mkfiles: - mk/mkfile and send/mkfile were rebuilding only the rfc822.tab.$O, even though the header also needed to be rebuilt. - CLEANFILES had a pattern that would not get expanded. - Third, ../upas/mkfile was being included in the wrong place and making the wrong rule default.
2020-11-22pc, pc64: move common irq handling code out of trap.ccinap_lenrek
Move the common irq handling code out of trap.c into pc/irq.c so that it can be shared between 386 and amd64 ports.
2020-11-21g: filter directory argumentsOri Bernstein
When searching directories recursively, it's still desirable to filter the contents by the file pattern, so that 'g foo /sys/src' doesn't end up searching for foo within .$O files. Files passed explicitly are still searched, so for the old behavior, just use walk: g foo `{walk -f $dir}
2020-11-219boot(8): update manual to reflect efi loader search order changesmischief
the efi loader now looks for plan9.ini and the kernel in the ESP first, before looking elsewhere.
2020-11-21efi: prefer plan9.ini from ESP we loaded frommischief
currently the EFI loader's behavior is to search all disks in a firmware-defined order. we search the list returned by the firmware in reverse order in the hopes of searching the first 9FAT instead of the ESP, but this results in unintuitive behavior when there are multiple FAT partitions (possibly in multiple disks), such as loading a plan9.ini and kernel from a different disk than the one you executed the EFI loader from. to resolve this, we change the EFI loader to instead prefer read plan9.ini and the kernel from the same disk as the EFI loader was read from, and then fall back to the old behavior, since the old behavior is relied on by current installations.
2020-11-21dc: fix crashes with : operator (thanks istvan bak)Ori Bernstein
dc crashes because a Blk* sometimes ends getting double freed. To make it crash, any of these lines will do: (each line is a separate input to dc): 1 sa 2 :a le d sa v :a 1 sa 2 :a le d sa :a 1 sa 2 :a le d sa c Fix by assigning p to sptr->val before EMTPY causes a jump. Additionally, dcgetwd() can return 0. all other uses check for 0 ptr; Also fix a buffer overflow.
2020-11-21upas: make 'all' the default targetOri Bernstein
When consolidating the duplicated targets, the one that actually got built ended up arbitrary. Put in a 'default' target that runs 'mk all'.
2020-11-21pc, pc64: fix grub multibootcinap_lenrek
It appears that our IDT overlaps with the data structures passed from grub in multiboot load. So defer setup of the interrupt table after the multiboot parameters have been processed.
2020-11-21mergecinap_lenrek
2020-11-21ether8169: fix interrupt panic before init, defer initialization until attachcinap_lenrek
The driver used to register the interrupt handler just after reset, tho the Ctlr struct, including the buffer descriptor arrays where only allocated on attach. This moves most of the reset/init out of pnp function and into attach. This also means we can error out and even retry on the next attach. The logic of the reseter kproc has been changed: now it is only started once the first initialization completely succeeded. This avoids the strange qlock passing. Implement a shutdown function so the device gets halted for /dev/reboot. Assume 64 bit physical addresses for dma. Check that pci bar0 is actually I/O.
2020-11-21pc, pc64: implement disabling of msi interruptscinap_lenrek
2020-11-21nusb/kb, nusb/joy: dont try to set protocol on nonboot devicesmischief
the hid 1.11 specification says that for hid devices which arent in the boot subclass (subclass 1), it is only optional to support the set protocol command. for my devices, trying to set protocol results in a stall error and unusable devices. fixes my Tex Shinobi keyboard and Playstation 4 controller.
2020-11-21pc, pc64: new MTRR code supporting AMD TOM2 MSR and fixed mtrr rangescinap_lenrek
The new MTRR code handles overlapping ranges and supports AMD specific TOM2 MSR. The format in /dev/archctl now only shows the effective cache ranges only, without exposing the low level registers.
2020-11-21pc, pc64: disable all pci devices for /dev/rebootcinap_lenrek
Make sure all pci busmaster activity is disabled, including MSI/MSI-X interrupts, before switching control to the new kernel.
2020-11-21pc, pc64: disable all pci devices in pcicfginit()cinap_lenrek
Make sure all pci busmaster activity is disabled, including MSI/MSI-X interrupts. Drivers will later reenable once taking control of a device.
2020-11-21kernel: add portable pcimsienable()/pcimsidisable(), disable MSI/MSI-X on ↵cinap_lenrek
pcidisable()/pcireset() This avoids some duplication in the pci support code and allows pcireset() to diable MSI and MSI-X interrupts when disabling or reseting a device.
2020-11-21etherm10g: remove duplicated pci capability enumcinap_lenrek
2020-11-21kernel: remove unused pcinextcap() functioncinap_lenrek
2020-11-21pc/l.s: remove unsued m0gdtptr/m0idtptr structscinap_lenrek
2020-11-19awk: fix truncated input after fflushAnthony Martin
Before the "native" awk work, a call to the fflush function resulted in one or more calls to the APE fflush(2). Calling fflush on a stream open for reading has different behavior based on the environment: within APE, it's a no-op¹; on OpenBSD, it's an error²; in musl, it depends on whether or not the underlying file descriptor is seekable³; etc. I'm sure glibc is subtly different. Now that awk uses libbio, things are different: calling Bflush(2) on a file open for reading simply discards any data in the buffer. This explains why we're seeing truncated input. When awk attempts to read in the next record, there's nothing in the buffer and no more data to read so it gets EOF and exits normally. Note that this behavior is not documented in bio(2). It was added in the second edition but I haven't figured out why or what depends on it. The simple fix is to have awk only call Bflush on files that were opened for writing. You could argue that this is the only correct behavior according to the awk(1) manual and it is, in fact, how GNU awk behaves⁴. 1. /sys/src/ape/lib/ap/stdio/fflush.c 2. https://cvsweb.openbsd.org/src/lib/libc/stdio/fflush.c?rev=1.9 3. https://git.musl-libc.org/cgit/musl/tree/src/stdio/fflush.c 4. https://git.savannah.gnu.org/cgit/gawk.git/tree/io.c#n1492
2020-11-18tmdate(2): failed to (p)arseSigrid
2020-11-18ctime(2): add tmdate(2) to "see also"Sigrid
2020-11-17upas/*: cleanup mkfiles (thanks amavect)Ori Bernstein
Changeset 50ad211fb12f broke the libcommon rule in mkupas. Deleting the 'mk clean' in the recipe fixes this. Cleanup includes deleting UPDATE vars from all mkfiles, reorganization of vars in TARG,LIB,OFILE,HFILE order, and deletion of extra vars used for UPDATE.
2020-11-17pc, pc64: load idt early in trapinit0()cinap_lenrek
loading the interrupt vector table early allows us to handle traps during bootup before mmuinit() which gives better diagnostics for debugging. we also can handle general protection fault on rdmsr() and wrmsr() which helps during cpuidentify() and archinit() when probing for cpu features.
2020-11-17pc/l.s: load virtual gdt pointer after mmu switchcinap_lenrek
before removing the double map at 0, load our initial gdt pointer with its new KZERO based virtual address. this is prerequisite for handling traps early during bootup before mmuinit() loads the final gdt.
2020-11-16nusb/cam: don't videoclose() when open failedcinap_lenrek
The fsdestroyfid() is called regardless if the open succeeded or failed. This causes erroneous videoclose() when opening the frame or video file while the camera is active.
2020-11-16diff: fix change marker for -c modekvik
2020-11-16ptrap: fail if invoked with no argumentskvik
2020-11-15aux/cpuid: fix final newline on printbits()cinap_lenrek
2020-11-15etheriwl: bring back recovery on flushq timeoutcinap_lenrek
2020-11-15audiohda: do not enable interrupts before intrenable()cinap_lenrek
When using /dev/reboot, the MSI vecor might have already been setup causing interrupts to fire on the designated cpu while we send the commands to the card.
2020-11-11audiohda: reset irbsts bits in hdainterrupt() (thanks LordCreepity)cinap_lenrek
reseting irbsts bits in hdacmd() only works while interrupts are disabled during hdareset(). once interrupts are enabled we need to reset the irbsts bits in the interrupt handler or else the interrupt never clears and locks up the system.
2020-11-08imap4d: imap4date should ignore time and timezone (RFC3501, 6.4.4)Ori Bernstein
2020-11-08pop3(1): write options consistentlyOri Bernstein
The pop3 options were prefixed with a '-'; the imap4d options were not. Proofreading, foolks.
2020-11-06upas/marshal: add -S saveto to save outgoing mail, fix -FOri Bernstein
Upas/marshal -F was broken with the '-8' command, and silly without it: It used aliases passed on the command line, so the destination address was ignored with -8 was passed. In addition, it would create a new mailbox for any aliases being sent to, instead of putting them all in one location. The new -S option is similar to -F, but specifies where the message should go.
2020-11-04mergecinap_lenrek
2020-11-04pc/pc64: fix faulty mtrr slot reuse (thanks Fulton)cinap_lenrek
The change 3306:c5cf77167bfe made the code reuse MTRR slots of the default memory type. But this did not take overlapping ranges into account! If two or more variable-range MTRRs overlap, the following rules apply: a. If the memory types are identical, then that memory type is used. b. If at least one of the memory types is UC, then UC memory type is used. c. If at least of of the memory types is WT. and the only other memory type is WB, then th WT memory type is used. d. If the combination of memory types is not listed above, then the memory type used in undefined. It so happend that on a Dell Latitude E7450 that the BIOS defines the default type as UC. and the first slot defines a 16GB range of type WB. Then the rest of the ranges mark the PCI space back as UC, but overlapping the first WB range! This works because of rule (B) above. When trying to make the framebuffer write-combining, we would falsely reuse one of the UC sub-ranges and making the UC memory into WB as a side effect. Thanks to Fulton for his patience and providing debug logs and doing experiments for us to narrow the problem down.