Commit graph

3661 commits

Author SHA1 Message Date
cinap_lenrek 4e00cf6b17 pc64: get rid of fixed 8MB INIMAP and dynamically map KZERO-end in l.s
traditionally, the pc kernel mapped the first 8MB of physical
address space. when the kernel size grows beyond that memory mapping,
it will crash on boot and theres no checking in the build process
making sure it fits.

with the pc64 kernel, it is not hard to always map the whole
kernel memory image from KZERO to end[], so that the kernel will
always fit into the initial mapping.
2014-11-15 11:43:05 +01:00
stanley lieber 62f5818481 fortunes: (no plan9 to hand) 2014-11-14 12:11:42 -05:00
cinap_lenrek 9841f7f3f5 upas/fs: handle ramfs and hjfs "file locked" error 2014-11-14 10:09:29 +01:00
cinap_lenrek 52c1f712ec upas/fs: handle cwfs "file is locked" error message 2014-11-14 23:36:18 +01:00
cinap_lenrek f51f73bdca ip: implement "hangup" ctl for udp protocol 2014-11-13 16:47:19 +01:00
cinap_lenrek 9840ce91cf kernel: make use of nil vs 0 consistent in qio.c (sorry) 2014-11-13 16:46:41 +01:00
cinap_lenrek 402140675f rootstub: create /sys/src/pkg and /sys/lib/pkg directories 2014-11-13 10:23:53 +01:00
cinap_lenrek 585f475c01 httpfile(4): document webfs dependency 2014-11-12 12:33:14 +01:00
cinap_lenrek c79dc3263e httpfile: use webfs, fix 9p flushes
we can improve performance alot by using webfs which
does http keep alives for us, so connection setup
overhead is eleminated.

fix 9p flushes and double frees.
2014-11-12 12:03:51 +01:00
stanley lieber 5540ca6b68 nintendo(1): more detail about gba 2014-11-11 14:57:45 -05:00
stanley lieber 994977e4d0 nintendo(1): document games/gba 2014-11-10 01:05:18 -05:00
cinap_lenrek bd7e387b51 pc64: fix comment description of pc64 kernel configuration 2014-11-10 12:22:50 +01:00
cinap_lenrek 28977d24b2 ether8169: add support for RTL8411B (thanks quux)
from quux 9fans post:

- based on the following changes in FreeBSD/OpenBSD:
http://svnweb.freebsd.org/base?view=revision&revision=257305
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/dev/ic/re.c.diff?r1=1.144&r2=1.145&f=h
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/dev/ic/rtl81x9reg.h.diff?r1=1.76&r2=1.77&f=h
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/dev/ic/rtl81x9reg.h.diff?r1=1.83&r2=1.84&f=h
- sysinfo _with_ patch, on amd64 (please disregard non-working audio and iwl stuff):
http://sysinfo.9front.org/src/86/body
- tested only on amd64; machine is an Acer V5-573G (exact model: V5-573G-74518G1Takk)
2014-11-10 12:13:07 +01:00
cinap_lenrek 2f8ee8fb4e pc, pc64: command flag sometimes doesnt reset, just check for IBF 2014-11-10 00:53:22 +01:00
cinap_lenrek 95dbc72801 io: add -E flag to access embedded controller space 2014-11-10 00:35:07 +01:00
cinap_lenrek ee05bbccbc merge 2014-11-10 00:06:01 +01:00
cinap_lenrek bcb67353c1 pc, pc64: provide access to embedded controller with #P/ec file 2014-11-10 00:04:37 +01:00
mischief 895d883bbd filter(1): fix typo i introduced
this is a good example of why blindly copy-pasting patches is a bad idea.
2014-11-09 13:41:06 -08:00
cinap_lenrek b18a641397 kernel: remove implicit Proc* argument from procctl()
procctl() is always called with up and it would not
work correctly if passed a different process, so
remove the Proc* argument and use up directly.
2014-11-09 08:19:28 +01:00
cinap_lenrek 1ffcdbab88 dont flush screen when hiding software cursor
we can avoid some flickering when removing the software cursor
from the shadow framebuffer by avoiding the flushscreenimage()
call.

once the cursor is redrawn, we flush the combined rect of its
old and new position in one go.
2014-11-08 11:48:38 +01:00
cinap_lenrek e4af9bc392 smtpd: cleanup hello() domain check code
theres no point in doing domain checks on literal ip addresses,
so handle that case early.
2014-11-08 09:00:04 +01:00
cinap_lenrek 4908ea43d7 merge 2014-11-08 05:23:59 +01:00
cinap_lenrek 9dfe587b27 smtpd: accept literal ipv6 addresses in HELO/EHLO 2014-11-08 05:22:25 +01:00
mischief cd3a742b32 all: typo fixes from ray@raylai.com 2014-11-07 10:39:50 -08:00
cinap_lenrek 797cc13c70 fix dangerous werrstr() usages
werrstr() takes a format string as its first argument.
a common error is to pass user controlled string buffers
into werrstr() that might contain format string escapes
causing werrstr() to take bogus arguments from the stack
and crash.

so instead of doing:
	werrstr(buf);

we want todo:
	werrstr("%s", buf);

or if we have a local ERRMAX sized buffer that we can override:
	errstr(buf, sizeof buf);
2014-11-07 12:51:59 +01:00
cinap_lenrek 5364fa720d libc: import cleaned up syslog() function from sources
this fixes a potential format string problem where the
error string is passed to werrstr() as fmt. also, the
directory comparsion is simplified in this version using
a helper function.
2014-11-07 08:42:19 +01:00
cinap_lenrek 958d698bf8 libc: improve dial error handling
when dial is called with a generic dialstring, it will try
/net and /net.alt in sequence. error out if the /net dial
gets interrupted and do not continue dialing /net.alt.

reduce stack usage by using the swaping nature of errstr()
instead of keeping two error string buffers on the stack.
2014-11-07 08:10:19 +01:00
cinap_lenrek a0e001a234 devproc: reset p->pdbg under p->debug qlock in procstopwait()
theres a race where procstopwait() is interrupted by a note,
setting p->pdbg to nil *before* acquiering the lock and
and pexit() and procctl() accessing it assuming it doesnt
change under them while they are holding the lock.
2014-11-07 05:21:42 +01:00
cinap_lenrek 20cc2799af mouse(2): fix atomouse (thanks qrstuv) 2014-11-06 04:59:07 +01:00
cinap_lenrek ea80ea451d libdraw: fix atomouse 2014-11-06 04:42:20 +01:00
mischief 9f75e55216 libc: allow dial to be interrupted
previously, if dial was interrupted by an alarm or other note while connecting to a host that resolved to multiple ips, dial would ignore the interruption and try the next host. now dial properly returns with error when it is interrupted.
2014-11-05 17:24:55 -08:00
cinap_lenrek 2c1dc1aa4f fix some manpage cross references 2014-11-05 21:00:23 +01:00
cinap_lenrek 3f09d4b623 acpi: fix pcibusno() when PCI0._ADR = 0
libaml comresses zero integer as nil, so remove the
nil check. this makes interrupts work in vmware with
efi.
2014-11-04 06:42:39 +01:00
cinap_lenrek f5e45a02d4 pc: enable page size extension early in apbootstrap
vmware in efi mode brings application processors up
with CR4 = 0 (pse disabled) which makes us page fault
when accessing the ap's pdb which might be in a 4MB
mapping when the boot processor used pse to setup
page tables.

so we unconditionally enable pse in apbootstrap
(and disable pae in case of surprises).
2014-11-04 05:52:42 +01:00
cinap_lenrek 32b5b2f42d 9boot(8): remove redundant "the" 2014-11-02 21:25:37 +01:00
cinap_lenrek 9916e03947 9boot(8): improve efi documentation 2014-11-02 21:22:03 +01:00
cinap_lenrek 9ac3a0c39e wpa: fork note group when going to background (thanks jpm)
bug: as jpm pointed out, when we run aux/wpa in rio window
and delete the window, aux/wpa was killed as it shared the
note group of the window.

fix: fork the notegroup.
2014-11-02 17:23:10 +01:00
cinap_lenrek bb95002c2d pc, pc64: implement acpi reset (for efi)
x230 booted in efi only (no csp) mode hangs
when traditional i8042reset() keyboard reset
is tried.

so we try acpireset() first which discoveres
and writes the acpi reset register.
2014-11-02 03:52:53 +01:00
cinap_lenrek 670493fe5e realemu: make sure instruction arguments are initialized even when decoding traps 2014-11-02 00:50:37 +01:00
cinap_lenrek 2020190f94 pc, pc64: more sanity checking for lowraminit() 2014-11-02 00:32:46 +01:00
cinap_lenrek 153f96ebc6 pc64: remove unused pdballoc and pdbfree counters from mach structure 2014-11-01 20:53:36 +01:00
cinap_lenrek 5c5daef9f6 dist: generate efi bootable cd image 2014-10-31 20:59:35 +01:00
cinap_lenrek bb33ba6b9a nusb/kb: dont set boot protocol on HidCSP interface when we failed to read report descriptor (thanks aap_)
this fixes wireless keyboard/mouse on raspi.
2014-10-31 20:40:13 +01:00
cinap_lenrek 634c55543a efi: generate /386/efiboot.fat for generating efi bootable cd images (see -E option of mk9660) 2014-10-31 20:07:54 +01:00
cinap_lenrek c7a5345aa6 efi: iso filesystem support for cdrom booting
instead of including kernel and config in the efi
fat image, we can just include the loaders and
read the plan9.ini and kernel from iso filesystem
just like the bios loaders.
2014-10-31 19:43:47 +01:00
cinap_lenrek 5f91d3f484 efi: add test targets for iso and fat (for documentation only) 2014-10-31 03:15:15 +01:00
cinap_lenrek 2cfbc3c1cb mk9660: add -E option to create EFI boot entry 2014-10-31 03:06:09 +01:00
cinap_lenrek 4bfa18a5d1 bcm: fix baudrate setting for serial console (thanks to aap and hiro)
the uartmini enable function used to override the baud
register so the effecive baudrate was always set to
115200 baud.

now the default baudrate of 9600 is set correctly and can
be changed in the console= boot parameter.

thanks aap and hiro for debugging, pizza and beer :)
2014-10-30 20:13:44 +01:00
cinap_lenrek 482e03c64d merge 2014-10-29 17:31:37 +01:00
cinap_lenrek 840ade48c4 fix syslog() use with linefeeds for various programs 2014-10-29 17:29:09 +01:00
cinap_lenrek 4616c93e8d cs: fix linefeeds in syslog(), cleanup 2014-10-29 03:20:43 +01:00
cinap_lenrek fe23dcefd4 cs: use /net/ether* instead /net/ether[0123], dont remove srv file with -n, dont write dns logfile 2014-10-29 02:43:18 +01:00
stanley lieber 6213e137ff newt: implement ned-style address ranges and overhaul h command to suit 2014-10-28 00:38:58 -04:00
cinap_lenrek c38cd50805 rio: dont serve a kbd file per window when we didnt got one from the environment
9vx doesnt provide a /dev/kbd file and rio faking one
up causes problems with vncv. (issue #223)
2014-10-25 02:05:44 +02:00
stanley lieber 88486c7529 fortunes: this exact error message is in the fortunes file. 2014-10-24 14:40:48 -04:00
cinap_lenrek fa3e71ab80 efi: change eficonfig ordering so memconf() is first, dont fallback to fs when /cfg/pxe/ file isnt there
having the memconf() (*e820=) last clutters the screen.
do it first, so we can read *acpi= and *bootscreen=
prints.

we want to continue using tftp even when the /cfg/pxe/$ether
file is not found. only when we detect no pxe/dhcp session,
then we switch to local filesystem (non-network boot).
2014-10-24 00:40:09 +02:00
cinap_lenrek 3bb7ad61aa lib9p: prevent files from being created in deleted directories (thanks BurnZeZ) 2014-10-23 00:43:27 +02:00
cinap_lenrek 89e6315699 lib9p: fix .. walk crash in deleted directory (thanks BurnZeZ)
to reproduce:

 % ramfs; cd /tmp
 % mkdir foo; cd foo
 % pwd
 /tmp/foo
 % rm /tmp/foo
 % pwd
 /tmp/foo
 % ls
 % ls /tmp
 % ls ..
 ramfs 202751: suicide: sys: trap: fault read addr=0x0 pc=0x0000e46d
 ls: ..: '..' mount rpc error
2014-10-23 23:59:16 +02:00
cinap_lenrek 16e08adb32 efi: add initial pxe support (v4 only) 2014-10-23 23:11:49 +02:00
cinap_lenrek e81e1a4aed pc, pc64: make mtrr() callable from interrupt context and before mpinit
to make it possible to mark the bootscreen framebuffer
as write combining in early initialization, mtrr() is
changed not not to error() but to return an error string.

as bootscreen() is used before multiprocessor initialization,
we have to synchronize the mtrr's for every processor as
it comes online. for this, a new mtrrsync() function is
provided that is called from cpuidentify() if mtrr support
is indicated.

the boot processor runs mtrrsync() which snarfs the
registers. later, mtrrsync() is run again from the
application processors which apply the values from the
boot processor.

checkmtrr() from mp.c was removed as its task is also
done by mtrrsync() now.
2014-10-21 06:03:03 +02:00
cinap_lenrek dfe8c8bffb 9boot(8): document efi booting 2014-10-19 21:55:19 +02:00
cinap_lenrek bcc65db171 pc, pc64: lookup pci device for bootscreen() and maximize framebuffer aperture so can change screen resolution 2014-10-19 21:00:34 +02:00
cinap_lenrek d7785060fb efi: use LocateHandle() and HandleProtocol() to check for multiple gop protocols to find a usable one
the gop returned by LocateProtocol() is not usable on thinkpad x230,
so iterate over all handles to find a usable one.
2014-10-19 19:55:45 +02:00
cinap_lenrek d6ea496960 efi: fix compiler warnings, remove indicator prints in readn() 2014-10-19 22:01:13 +02:00
cinap_lenrek f0ff0fb054 efi: simplify bootscreen code 2014-10-18 19:15:53 +02:00
aiju 040166493d games/gba: add state saving 2014-10-18 19:08:38 +02:00
cinap_lenrek 99e004c72e efi: convert pixel format to bootscreen color channel 2014-10-18 18:48:56 +02:00
cinap_lenrek 6aa6e9fc8b efi: make clean target virtual 2014-10-18 02:15:40 +02:00
cinap_lenrek 6f3dfb57eb efi: add experimental efi bootloader
this is basically a port of 9boot to EFI. theres
support for IA32 (386) and X64 (amd64).

has been tested only under qemu with OVMF so far.
2014-10-18 02:13:02 +02:00
cinap_lenrek 0a6439a1f5 pc, pc64: allow passing RSDT pointer in *acpi= boot parameter, early bootscreeninit(), fix rampage() usage
rampage() cannot be used after meminit(), so test for
conf.mem[0].npage != 0 and use xalloc()/mallocalign()
instead. this allows us to use vmap() early before
mmuinit() which is needed for bootscreeninit() and
acpi.

to get memory for page tables, pc64 needs a lowraminit().

with EFI, the RSDT pointer is passed in *acpi= parameter
from the efi loader. as the RSDT is ususally at the end of
the physical address space (and not to be found in
bios areas), we cannot KMAP() it so we need to vmap().
2014-10-18 02:01:58 +02:00
cinap_lenrek b52f0c884e pc: add *bootscreen= variable to pass pre-initialized framebuffer info to kernel
EFI system has no cga or vesa anymore, so it becomes neccesary to
pass GOP framebuffer info to the kernel to get some output on the
screen.
2014-10-13 23:02:53 +02:00
cinap_lenrek cc6ab31891 pc: sanity check bda value in lowraminit() to avoid overflow with efi 2014-10-12 20:18:59 +02:00
stanley lieber ca694c51ef pkg: change default repo to http://9front.org/pkg/386 2014-10-12 13:27:53 -04:00
BurnZeZ 748a95266f rio: fix "-cd dir" in mountspec being ignored 2014-10-11 11:47:38 -04:00
stanley lieber 081bbcf0a1 fortunes: You have an agenda. 2014-10-06 21:17:26 -04:00
aiju 5de71b116a games/gba: new faster ppu code, audio support 2014-10-03 16:52:56 +02:00
aiju 74b7abe95c games/gba: fix dma repeat bit and eeprom addresses 2014-09-30 15:48:32 +02:00
aiju 4f264cedfb added crc32 2014-09-30 13:07:36 +02:00
cinap_lenrek 4f4d71b941 hgfs: make data files with meta headers having the right size after open
to get the right data size of a file, the revlog needs to have been
opened and the metaheader parsed. as an optimization, we used to
open revlog only on the first read resulting revlogs with metaheaders
having the wrong size returned by fstat() until the first read().

tar relies on fstat() giving the correct file size, so just open
the revlog on open. reading directories can still yield the wrong
size but it is not that critical.
2014-09-29 21:01:51 +02:00
cinap_lenrek c1dc5d15c3 snap: change ulong return of stackptr() to uvlong for amd64 2014-09-29 20:11:58 +02:00
aiju 752841fcc1 games/gba: small fixes 2014-09-28 19:41:52 +02:00
cinap_lenrek 15afb9d00b apply ps2mouse corruption fix to omap
the omap ps2mouse driver is currently unused, but
in case of being finished at some point, apply the
fix from the pc driver.
2014-09-28 19:02:25 +02:00
cinap_lenrek 36db1295be pc/pc64: fix ps2mouse memory corruption race
there was a memory corruption bug caused by us enabling the
ps2mouseputc() handler *before* initializing packetsize.

once we enabled the handler, mouse interrupts could come
in and advance the packet buffer index (nb) beyond the
buffer boundaries.

as ps2mouseputc() only checked for ++nb == packetsize, once
nb was advanced beyond the packetsize, it would continue writing
beyond the buffer and corrupt memory with each mouse packet byte.

solution is to initialize packetsize *before* enabling the
handler, and also do a >= check in ps2mouseputc() in case the
packetsize gets changed to a smaller value at runtime.
2014-09-28 18:28:38 +02:00
cinap_lenrek a494cc74ad ndb/dns: request recursion only for local dns servers
we used to set RD flag in requests unconditionally, which
is fine by the standard but some dns server administrators
seem to use it as a denial of service indicator (for ther
non recursive authoritative nameservers) and ignore the
request.

so only set the RD flag when talking to local dns servers.
2014-09-28 05:15:25 +02:00
cinap_lenrek eb6a4fc1a4 devcons: avoid division by zero reading Qsysstat
alexchandel got the kernel to crash with divide error
on qemu 2.1.2/macosx at this location. probably
caused by perfticks()/tsc being wrong or accounttime()
not having been called yet from timer interrupt yet for
some reason.
2014-09-28 02:42:33 +02:00
aiju c8cf0cee47 games/gba: remove bogus file 2014-09-28 22:42:11 +02:00
aiju 05bdd09bc3 merge 2014-09-27 20:51:00 +02:00
aiju 77f3fa19de games/gba: slowly working (no pun intended) 2014-09-27 20:50:20 +02:00
mischief ee29c17639 pc64: enable rtl8169 driver (thanks awabimakoto for testing) 2014-09-24 14:19:22 -07:00
cinap_lenrek decc7ec518 6c/8c: eleminate moves by swaping source and destination operands in peephole pass 2014-09-24 20:45:16 +02:00
cinap_lenrek 4cb032442a acid: fix sysr1() stack corruption
the syscall stubs (for amd64) currently have a unconditional
spill of the first (register) argument to the stack.

sysr1 (and _nsec) are exceptional in that they do not
take any arguments, so the stub is writing unconditionally
to ther first argument slot on the stack.

i could avoid emiting the spill in the syscall stubs for
sysr1 but that would also break truss which assumes fixed
instruction sequence from stub start to the syscall number.

i'm not going to complicate the syscall stubs just for
sysr1 (_nsec is not used in 9front), but just add a dummy
argument to sysr1 definition that can receive the bogus
argument spill.
2014-09-22 23:07:59 +02:00
cinap_lenrek 84c40fb226 devip: sanity check Nchan in Fsproto()
devip can only handle Maskconv+1 conversations per
protocol depending on how many bits it uses in the
qid to encode the conversation number.

we check this when the protocol gets registered.

if we do not do this, the kernel will mysteriously
panic when the conversaion numbers collide which
took some time to debug.
2014-09-21 19:24:38 +02:00
cinap_lenrek c145a2c0aa devip: print protocol name in garbage collection notification 2014-09-21 18:02:53 +02:00
cinap_lenrek 47e52123d0 pc64: print "Plan 9" on boot, cleanup pccpu64 files 2014-09-21 16:06:25 +02:00
cinap_lenrek 2604bc3603 stats: handle /dev/sysstat 32bit overflow in delta calculation
the numbers from /dev/sysstat overflow on 32bit, so have
to do subtraction modulo 2^32 as we calculate with 64bit
integers.

thanks mischief for reporting this.
2014-09-20 18:06:59 +02:00
cinap_lenrek 19a8f66eec pc64: syscallfmt for nsec syscall 2014-09-20 01:37:11 +02:00
cinap_lenrek acd15f13c4 pc64: put return value of nsec syscall in register on amd64
WHAT WHERE THEY *THINKING*??!?!

unlike seek, the (new) nsec syscall (not used in 9front libc)
returns the time value in register (from nix), so do the same
for compatibility.
2014-09-20 01:07:46 +02:00
cinap_lenrek f899e55818 libmemdraw: fix byte ordering in memfillcolor()
memfillcolor() used to write longs in host byte
order which is wrong. have to always use little
endian.

to simplify, moved little endian conversion into
memsetl() and memsets() avoiding code duplication.
2014-09-19 17:49:48 +02:00
cinap_lenrek a1b2b9b126 lib9p: fix nil dereference crash in remove for directory permission check
file->parent can be nil when the file has been previously removed.
removefile() deals with this, so skip the permission check in
that case and let removefile() error out.
2014-09-19 05:22:26 +02:00
cinap_lenrek 5d8300d2eb teg2: fix wrong l2 setshift address in wholecache() (from sources) 2014-09-17 16:34:30 +02:00
cinap_lenrek ce80c5029e oggdec: recognize "begin of stream" packets and restart decoding 2014-09-16 20:25:01 +02:00
cinap_lenrek 187aad97be merge 2014-09-16 16:42:16 +02:00
cinap_lenrek e060bc6df6 libauthsrv: allow multiple auth= attributes for backup auth servers, authdial() tries each one in order
some of us run auth servers from home that are used by multiple
servers on the internet. when the home authserver becomes unreachable,
services on the outside servers stop working. so we thought about
specifing a secondary auth servers for backup when the primary
server is not reachable.

this changes authdial() to consult multiple auth= entries in
the authdom= or dom= tuples, trying each one in order until
dial() succeeds.
2014-09-16 16:41:05 +02:00
mischief e5c47ca18e ramfs: allow changing mtime in wstats 2014-09-15 15:49:39 -07:00
mischief 222018340b hg: make intermediate directories like newer hg does 2014-09-15 13:42:54 -07:00
cinap_lenrek 7011194af1 ramfs: fix directory check in wstat() (thanks mischief) 2014-09-16 22:33:27 +02:00
cinap_lenrek 694597de3b devtls: fix typo in debug print 2014-09-15 08:19:51 +02:00
cinap_lenrek 7f295c2055 telnetd: let the kernel place the shared segment in segattach() (thanks kenji arisawa) 2014-09-14 21:20:13 +02:00
cinap_lenrek fdf3883ce4 libmemdraw: update drawtest to use same rounding in alpha calculation as libmemdraw 2014-09-14 17:03:56 +02:00
cinap_lenrek e9fddbaad8 kernel: fix segattach() rounding of va+len (thanks kenji arisawa)
from segattach(2):

          Va and len specify the position of the segment in the
          process's address space.  Va is rounded down to the nearest
          page boundary and va+len is rounded up.  The system does not
          permit segments to overlap.  If va is zero, the system will
          choose a suitable address.

just rounding up len isnt enougth. we have to round up va+len
instead of just len so that the span [va, va+len) is covered
even if va is not page aligned.

kenjis example:

	print("%p\n",ap);	// 206cb0
	ap = segattach(0, "shared", ap, 1024);
	print("%p\n",ap);	// 206000

term% cat /proc/612768/segment
Stack     defff000 dffff000    1
Text   R      1000     6000    1
Data          6000     7000    1
Bss           7000     7000    1
Shared      206000   207000    1
term%

note that 0x206cb0 + 0x400 > 0x20700.
2014-09-14 16:04:22 +02:00
mischief 8348a233ae vi: implement _nsec syscall 2014-09-13 06:07:57 -07:00
cinap_lenrek c8008e1ffd libsec: experimental DHE client support for tls and cleanups 2014-09-14 02:30:46 +02:00
cinap_lenrek 6c68876db6 libsec: add diffie-hellman functions 2014-09-14 02:29:18 +02:00
cinap_lenrek 4cf00ca6cb libsec: fix hmac for keys bigger then 64 byte block size
RFC2104 defines HMAC for keys bigger than the 64 byte block
size as follows:

Applications that use keys longer than B (64) bytes will
first hash the key using H (the hash function) and then
use the resultant L byte string as the actual key to HMAC.
2014-09-14 02:26:26 +02:00
aiju 69fab298be libsec: ecgen() and ecdsasign() fix 2014-09-13 19:46:41 +02:00
BurnZeZ 62a8bf1846 acme: remove unused #include 2014-09-11 12:47:04 -04:00
aiju 418ce96ca2 games/gb: minor goof 2014-09-11 11:36:35 +02:00
aiju d63850570c games/nes: reduce volume, causes overflow and confuses ac97 2014-09-11 11:20:57 +02:00
cinap_lenrek a49ddece8b ip/ayiya: experimental anything in anything tunnel protocol client
this is a work in progress implementation of the ayiya (anything
in anything) protocol as used by sixxs.net. hiro tested it and it
worked for him, but progress has stalled as sixxs.net rejected my
request for an account and ignored my emails since.
2014-09-06 22:59:58 +02:00
cinap_lenrek 460f482ad0 doom: fix alignment issues for arm 2014-09-04 23:02:37 +02:00
cinap_lenrek 3a322e9f32 5e: fix signed long multiply 2014-09-04 22:53:54 +02:00
cinap_lenrek e890c3d943 5e: push ERRMAX for note message on stack avoiding unaligned stack pointer 2014-09-03 19:23:55 +02:00
cinap_lenrek b864727723 ether8139: fix pointer to smaller int tuncation warning on amd64 2014-09-02 16:20:43 +02:00
stanley lieber 585ab698de /sys/lib/dist/ndb/common: add auth=fs.stanleylieber.com authdom=inri 2014-08-28 20:46:56 -04:00
stanley lieber 935e8472d1 fortunes: $75K Prosthetic Arm Is Bricked When Paired iPod Is Stolen 2014-08-27 01:13:11 -04:00
cinap_lenrek 7996878864 ipconfig: remove sleep() left over from debug :-) 2014-08-27 01:41:02 +02:00
cinap_lenrek 46b8a0ac00 ipconfig: fix readipifc() memory leaks in recvra6 and sendra6 processes
to avoid continuously leaking memory in recvra6 and sendra6
processes, pass the previous Ipifc* pointer to readipifc().
2014-08-27 01:12:42 +02:00
cinap_lenrek acb49987e6 ip: set arp entry for own v6 address when not tentative
after running ip/ipconfig -6, we are unable to ping our
own link-local address and the arp daemon sends out useless
neighbor solicitation requests to itself. this change
adds an arp entry for our ipv6 address. however, this
must not be done for tentative interface configuration.
2014-08-26 21:29:37 +02:00
cinap_lenrek 7ad08a8515 ipconfig: cleanup code duplication in ip6cfg() 2014-08-26 21:09:57 +02:00
cinap_lenrek dbf165e1bd ping: don't spin when we get error reading icmp connection, print error and sleep 2014-08-26 21:07:59 +02:00
cinap_lenrek 6031dd83b6 pc64: enable ether8139 in kernel config (thanks hiro) 2014-08-22 00:00:06 +02:00
cinap_lenrek 15755a5f83 ether8139: fix pointer truncation by ulong cast, use mallocalign() 2014-08-21 10:56:15 +02:00
cinap_lenrek 2161885034 secstore: improve error messages, newSConn() can't fail 2014-08-21 01:18:36 +02:00
cinap_lenrek 2ec9006e9e ip: fix memory leak in ipicadd6()
allocate the Iplifc structure on the stack instead.
i assuming that it was allocated on heap in fear of
causing stack oveflow. on 386, this adds arround
88 bytes on the stack but it doesnt seem to cause
any trouble. (checked with poolcheck after ctl write)
2014-08-21 00:30:13 +02:00
cinap_lenrek 0d5491fb08 pc, pc64: fix off by one error in _multibootentry 2014-08-18 03:16:11 +02:00
cinap_lenrek f128c6eab0 boot: dont print errors if ethernet has no ifstats file, can happen with usb ethernet 2014-08-17 06:08:06 +02:00
cinap_lenrek 98e3e12d92 5a: revert MOVM .S and .W are exclusive (broke bcm build) 2014-08-17 04:26:28 +02:00
cinap_lenrek 3b661a96ef kernel: make noswap flag exclude processes from killbig() if not eve, reset noswap flag on exec 2014-08-17 00:50:20 +02:00
iru 0bc51a90b0 Fix acme crash: Get D in a new window with D being an existing directory 2014-08-16 18:50:42 -03:00
cinap_lenrek 773b57b676 kernel: fix todfix() race
we have to recheck the condition under tod lock, otherwise
another process can come in and updated tod.last and
tod.off and once we have the lock, we would make time
jump backwards.
2014-08-16 21:04:41 +02:00
cinap_lenrek ce0b77e2b9 kernel: xinit() use ulong for page counts, cleanup 2014-08-16 17:26:12 +02:00
cinap_lenrek a5bce84600 nusb/kb: delete code for keyboard boot protocol handling, just use hid parser
unify the keyboard and mouse readers into one using the hid
report parser for both. remove the keyboard protocol handling,
as it is now handled by hid parser and all we get is a sequence
of keycodes in Hiddev.k[] which we diff for up/down and translate
to pc scancodes.
2014-08-16 23:34:28 +02:00
aiju 74a276d076 spred: command window improvements 2014-08-14 10:42:39 +02:00
cinap_lenrek a67d18ccf1 import: make aan (-p flag) work in ``backwards mode'' (-B)
in backwards mode, the roles of the aan filters need to be
reversed. add "-n address" option to import to override the
announce address for the aan server part (default tcp!*!0).
2014-08-14 00:11:14 +02:00
cinap_lenrek d8d26c7001 nusb/ptp: do maxpkt reads to avoid babble error with usb 2.0 devices (thanks mischief!)
mischief got babble error with his mobile phone as we used to
read at max 64 bytes for the data response phase. his device
has 512 byte packet size.

thans to mischief for the patience.
2014-08-13 01:10:59 +02:00
cinap_lenrek bedffdd8c3 devenv: prevent non-hostowner from creating or removing variables in '#ec', cleanup 2014-08-13 23:09:47 +02:00
cinap_lenrek 55bf3d6399 ip: fix missed unlocks and waserror handlers
ipifcunbind() could error out from ipifcremlifc() and Medium.unbind()
*after* decrementing ifc->conv->inuse! move the decrement after
calling these functions.

make ipifcremlifc() never raise error but return error string.
the only places where it could error is when it calls into
medium functions like Medium.remroute() and Medium.remmulti().
Ignore these errors as they could happen when the ethernet driver
crashed (think imported ethernet device or usb ethernet
in userspace), so we will be able to unbind.

add waserror() handlers as neccesary to deal with errors from
Medium.addmulti(), Medium.areg() and arpenter() to properly
unlock the data structures.
2014-08-12 21:35:31 +02:00
mischief 53619de428 aux/8prefix: fix usage 2014-08-12 10:33:47 -07:00
mischief b0d7ade423 secstore(1): clarify how the server is dialed and add new $secstore environment variable 2014-08-10 20:38:59 -07:00
mischief a0b7cabe3a secstore: read server from $secstore environment variable
this allows setting the secstore server with secstore=tcp!example.com!secstore or secstore='$secstore' to read from ndb.
2014-08-10 18:05:57 -07:00
stanley lieber e17025174a fortunes: it´s easy but you are complicated 2014-08-10 19:04:20 -04:00
stanley lieber 443b046bff fs(8): correct spelling 2014-08-10 19:00:55 -04:00
cinap_lenrek 427e925eea cwfs: add optional uid argument to allow command, unify permission override code
the allow command now takes an optional uid argument for the user
to be granted temporary god status on the fileserver for maintenance.

this was kenji okomotos idea, so thanks :)

remove wstatallow and writeallow flags. instead, we have global:

int allowed;

that contains the uid of the currently allowed user id or -1
if permission checking is globally disabled for the fileserver.
when zero, normal permission checking takes place.

added int isallowed(File*) function that returns non-zero when the
context is the console, or the allowed user. this is also used internally
by iaccess(), so all the extra code of in the callers of iaccess()
is gone now.

dont conflate allowed user with noauth flag and auto-allow on ream.
the installer already knows about noauth and allow flags so theres no
problem with bootstraping.
2014-08-11 22:36:59 +02:00
cinap_lenrek 30d4d8984b 5a: MOVM.IA.W.S ..., [R15] is exception return and needs to be allowed (thanks aiju) 2014-08-09 18:23:14 +02:00
cinap_lenrek 760063ab57 cwfs: fix 32bit multiplication overflows for allocation sizes (thanks kenji okomoto) 2014-08-09 17:37:02 +02:00
cinap_lenrek 3472f91129 5a: reject MOVM instruction with .S and .W bits both set (aijus idea) 2014-08-09 22:47:46 +02:00
cinap_lenrek daa15d1edb kernel: more nil vs 0 cleanup in chan.c 2014-08-08 17:02:10 +02:00
cinap_lenrek ee6409366e kernel: use nil for pointers instead of 0, zero channel umc and dirrock in newchan() 2014-08-08 16:44:41 +02:00
cinap_lenrek 0ceeee4c8b ndb/dns: fix nil dereference crash with convM2DNS() returning reqmsg.qd == nil 2014-08-08 02:06:03 +02:00
cinap_lenrek 45333cdc92 devmnt: fix potential race with mntflushfree(), remove mntstats, 0 vs nil cleanup
when mountmux() completes a request for another process, enforce odering
of the loads and stores to the request prior to writing q->done = 1
so mntflushfree() sees q->done != 0 only when the request has actually
completed. otherwise, the q->done = 1 store could have been reordered
before the load from q->z, reading from already freed request and causing
spurious wakeups.

removing unused mntstats callback.

use nil for pointers instead of 0.
2014-08-08 23:28:47 +02:00
cinap_lenrek bc306a5a63 8c, 6c: generate enam.c file, just like 5c 2014-08-07 21:35:52 +02:00
cinap_lenrek 0a101736b8 pc, pc64: make pc kaddr() check reject -KZERO address (thanks aiju) 2014-08-07 21:11:11 +02:00
cinap_lenrek d304dc8119 5a, 5l: add LDREX/STREX/CLREX instructions 2014-08-07 20:22:00 +02:00
cinap_lenrek ca4f815cfc pc64: fix wrong Ureg* argument on note handler (thanks _sl!)
_sl reported crash:

stats 593: suicide: sys: trap: fault write addr=0xffffffff8258d1b0 pc=0x204cc7

; acid 593
/proc/593/text:amd64 plan 9 executable
/sys/lib/acid/port
/sys/lib/acid/amd64
acid: lstk()
notejmp(ret=0x1,j=0x40ac90)+0x13 /sys/src/libc/amd64/notejmp.c:10
alarmed(a=0xffffffff8258d1b0,s=0x7ffffeffea58)+0x3f /sys/src/cmd/stats.c:718
notifier+0x3e /sys/src/libc/port/atnotify.c:15
acid:

note how a in alarmed is a kernel address!

the first Ureg* argument is passed to the note handler in the
RARG (BX) register, which was not loaded when returning to
userspace from syscall() thru forkret(). fix by returning thru
noteret() from syscall().
2014-08-07 19:55:25 +02:00
cinap_lenrek 7c1ae2ead3 samterm: fix ctrl-b crash when cmd window resized (thanks revex)
for reference:

On IRC revex reported that samterm crashes on Ctrl-b if the command window has
been resized. I was able to reproduce:

http://plan9.stanleylieber.com/sam/bugs/ctrl-b.png

; acid 831213
/proc/831213/text:amd64 plan 9 executable
/sys/lib/acid/port
/sys/lib/acid/amd64
acid: lstk()
abort()+0x0 /sys/src/libc/9sys/abort.c:6
panic1(s=0x400448)+0x27 /sys/src/cmd/samterm/main.c:692
panic()+0x19 /sys/src/cmd/samterm/main.c:684
lldelete()+0x71 /sys/src/cmd/samterm/flayer.c:221
flupfront(l=0x40eac0)+0x18 /sys/src/cmd/samterm/flayer.c:139
	v=0x20062900000001
current(nw=0x40eac0)+0x49 /sys/src/cmd/samterm/main.c:156
type(l=0x40eac0,res=0x15300000001)+0x37c /sys/src/cmd/samterm/main.c:658
	t=0x40eaa8
	buf=0x419ec0
	p=0x41dd48
	a=0x0
	backspacing=0x200000000
	c=0x41dd4800000002
	cursor=0x0
	a0=0x0
threadmain(argv=0x7ffffeffefa0)+0x21c /sys/src/cmd/samterm/main.c:75
	r=0xb0000001b1
	got=0xfefefefe00000002
	chord=0x0
	nwhich=0x43c310
	scr=0x200000000
	t=0xfefefefefefefefe
	w=0x43c310fefefefe
mainlauncher()+0x18 /sys/src/libthread/main.c:59
launcheramd64(arg=0x4194a0,f=0x221673)+0x10 /sys/src/libthread/amd64.c:11
0xfefefefefefefefe ?file?:0
acid:
2014-08-04 09:33:23 +02:00
cinap_lenrek 15b5a980d7 iostats: properly distribute exit status and give usefull error messages 2014-08-03 17:09:28 +02:00
cinap_lenrek 718f3358bb iostats: remove unused fcallfmt, dont leak our mount pipe end into exportfs proc 2014-08-03 16:28:07 +02:00
cinap_lenrek d63734eb53 iostats: bring back standard filedescriptor spying 2014-08-03 16:02:47 +02:00
cinap_lenrek 5302e88796 exportfs: simplify freefile() code
remove impossible checks, rewrite as while loop.
2014-08-02 19:22:10 +02:00
cinap_lenrek b185d2fe5c exportfs: remove getsbuf() nil check, can't happen 2014-08-02 19:04:33 +02:00
cinap_lenrek 686cf0b0f3 iostats: isolate fs from interrupt notes
interrupt notes go to the child process, not the filesystem
and filter process.
2014-08-02 18:45:19 +02:00
cinap_lenrek 4f45a40334 iostats: cannot spy on fd 0,1,2 as /fd is per process 2014-08-02 15:47:24 +02:00
cinap_lenrek 73d35f9c7d exportfs: cleanup 2014-08-02 15:07:29 +02:00
cinap_lenrek 7ae4e473da ftpfs: dont convert names to latin when string is valid utf-8 2014-08-02 14:37:16 +02:00
cinap_lenrek 7cc757c3c0 python: disable symlink and readlink compile options, ape has no reasonable way emulating it 2014-08-02 14:28:19 +02:00
cinap_lenrek dc501ae1e3 iostats: dont prefix /bin to argv[0] when already absolute or relative path 2014-08-02 03:06:09 +02:00
cinap_lenrek 4e42b9996f iostats: cleanup, remove bogus Maxrpc constant 2014-08-02 02:41:57 +02:00
cinap_lenrek 23aaa0c59c iostats: reimplement iostats as a 9p filter instead of duplicating exportfs
old iostats failed to work when builidng the kernel due to old bugs
that where already fixed in exportfs. instead of backporting the fixes,
reimplement iostats as a filter that sits between exportfs and the
process mount. from users perspective, theres no difference.

the result is much smaller and can handle everything that exportfs
can like /srv.
2014-08-02 02:30:19 +02:00
cinap_lenrek 1b70ab5979 exportfs: use argv0 instead of hardcoding "/bin/exportfs" in openmount(), dont use 0 for nil 2014-08-01 16:57:39 +02:00
aiju 709e78b9f9 spred: scrolling and other bugfixes 2014-07-31 11:36:24 +02:00
stanley lieber a39ce6a934 fortunes: From: urielc@cantv.net 2014-07-30 12:11:58 -04:00
stanley lieber e7a3cd0fd0 spred(1): fix troff 2014-07-30 12:09:35 -04:00
aiju 712fd30652 added sprite editor spred 2014-07-30 15:57:14 +02:00
stanley lieber 555a05018b fstype(1): document hjfs 2014-07-29 22:32:16 -04:00
cinap_lenrek a2f7d03d4e rc: fix slow Xqdol(), avoid recursion in conclist(), estrdup(), avoid copying
Xqdol() used to take quadratic time because of strcat(),
the code isnt really needed as list2str() aready does the
same thing in linear time without the strcat().

add estrdup() which uses emalloc() so allocation error are
catched.

move strdups() of name from callers into newvar().

avoid recursion of conclist(), and avoid copying of word
strings by providing Newword() function which doesnt copy
the word string.
2014-07-23 15:28:37 +02:00
mischief 2bdd2663db ratrace(1): uses syscall not syscalltrace file 2014-07-22 23:40:53 -07:00
stanley lieber e42d8492c6 fortunes: I wanted to do something that didn't involve arguing online about trivia. -- jwz 2014-07-22 18:41:36 -04:00
stanley lieber de8752e45e sega(1): add man page for games/md (and potential future sega emulators) 2014-07-22 18:29:33 -04:00
stanley lieber 0d909ae6ab nintendo(1): document snes 2014-07-22 17:44:46 -04:00
stanley lieber 33592e9d7c games/md: add -2 -3 -a and trailing newline to usage 2014-07-22 17:38:44 -04:00
stanley lieber 69eb0cd713 games/snes: add -a -h -m -T to usage 2014-07-22 17:00:32 -04:00
cinap_lenrek 6273bad12d ratrace: make multithreaded ratraces less confusing (for mischief) 2014-07-22 21:54:26 +02:00
cinap_lenrek 168b9f3de4 libdraw: add missing borderop() (thanks aiju) 2014-07-21 18:10:58 +02:00
cinap_lenrek 1021caa395 pc64: cleanup syscallentry()
avoid the stack shuffeling and make syscallentry() and
forkret() use the same stack offsets.
2014-07-21 18:02:14 +02:00
cinap_lenrek c78c6e349a pc64: dont save/restore DS/ES/FS/GS segment registers on syscall or interrupt, they are ignored in long mode.
we do not support 32 bit processes and DS, ES, FS and GS segment
registers are ignored in long mode, so theres no point in saving
and restoring them.
2014-07-20 02:59:45 +02:00
cinap_lenrek 20b7a19c58 pc64: preserve user extern registers R14 and R15 across syscalls, use Ureg.bp (RARG) for syscall number
the 6c compiler reserves R14 and R15 for extern register variables,
which is used by the kernel to hold the m and up pointers. until
now, the meaning of R14 and R15 was undefined for userspace and
extern register would not work as the kernel trashes R14 and R15
on syscalls. with this change, user extern registers R14 and R15
are zeroed on exec and otherwise preserved across syscalls. so
userspace *could* use them for per process variables like the
kernel does.

use Ureg.bp (RARG) for syscall number instead of Ureg.ax. this is
less confusing and mirrors the amd64 calling convention.
2014-07-20 22:49:02 +02:00
mischief b603991593 a.out(6): sync definitions 2014-07-17 23:22:48 -07:00
cinap_lenrek 4a7d29dd5f libframe: use correct text color on frinsert depending on selection (thanks sl)
frinsert() used cols[TEXT] for drawing selected text instead of the
HTEXT color. this was discovered with rio -b.
2014-07-17 23:29:55 +02:00
cinap_lenrek e4436ec0bb page: fix deadlock with addpage (thanks BurnZeZ for the stacktraces)
addpage() should not be called with the display locked as it
calls showpage1() which sleeps when there are too many
processes active.

the bug was triggered by plumbing to trigger the addpage().
2014-07-15 20:45:00 +02:00
cinap_lenrek 4f3724e6e1 devproc: nil 2014-07-15 18:51:58 +02:00