Commit graph

5243 commits

Author SHA1 Message Date
cinap_lenrek 5d353d62fe devmouse: remove unused static map[] array 2016-12-11 16:02:30 +01:00
cinap_lenrek b3c1fa9ecf devmouse: change msec argument of *mousetrack() to ulong 2016-12-10 16:12:18 +01:00
cinap_lenrek 7a145e89b3 audioac97: support for ICH4-ICH7 based cards with memory mapped registers (thanks echoline) 2016-12-05 18:32:58 +01:00
cinap_lenrek 9a55346264 devmouse: various bugfixes, simplify
the assumption of only one producer ((abs)moustratrack()) is not true
for external mouse events from /dev/mousein, so protect the mouse state
and queue with ilock().

get rid of mousecreate(), just use devcreate().

reset cursor when all instances of /dev/mouse and /dev/cursor got closed,
instead of also considering /dev/mousectl. the reason is that kbdfs keeps
the mousectl file open. so exiting a program that has the cursor changed
will properly reset the cursor to arrow.

don't access user buffer while holding cursor spinlock! the memory access
can fault. theres also no lock needed there, we'r just copying *from* the
cursor memory.

fix use of strtol(), p will always be set, check for end of string.

keep pointer coordinates onscreen (off by one).

make lastms() function to get the last millisecond delta of last
call for resynchronization.

fix msg[3] buffer overflow in m5mouseputc().

get rid of mouseshifted logic, it is not used.
2016-11-29 21:11:48 +01:00
cinap_lenrek 3dc64de2e4 omap: cleanup mouse.c, just a dummy for mousectl() 2016-11-29 20:54:17 +01:00
cinap_lenrek 807019d6eb omap: fix format string warning %d for long 2016-11-29 20:51:08 +01:00
cinap_lenrek 6d42467411 stdio: fix sclose() buffer overrun when terminating string, realloc() error handling (thanks porlock)
theres a bug is in sclose() where it doesnt check if wp is beyond
the buffer. also wp was not updated after realloc().

bug was reported by porlock on 9fans:

Plan 9's implementation of the standard C functions snprintf and
vsnprintf have a buffer overrun bug.

If the buffer length equals the output length (without the terminating
null), then one too many characters is written to the buffer.

For example,
              snprintf(buf, 4, "ABCD");

will write 5 characters to buf.
2016-11-27 21:20:27 +01:00
cinap_lenrek 0edcb33ca1 merge 2016-11-19 16:47:21 +01:00
cinap_lenrek 93f122b94a link loopbackmedium and netdevmedium in bcm/pif, sgi/indy and zynq kernels 2016-11-19 16:45:18 +01:00
ftrvxmtrx ee9b0eef89 libavl, libregexp: put debug functions back 2016-11-17 23:07:54 +01:00
ftrvxmtrx ed76659c05 /sys/src/lib*: clean up 2016-11-17 22:58:16 +01:00
cinap_lenrek 28f4567ba6 libmemdraw: cleanup fillpoly(), remove unused fillcolor hack 2016-11-17 20:10:07 +01:00
cinap_lenrek 6fc0e0541c libsec: remove unused get32() function 2016-11-17 19:54:13 +01:00
cinap_lenrek b4db73795e libmemdraw: remove unused static drawbuf variables and ptrfn() declaration 2016-11-17 19:42:12 +01:00
cinap_lenrek dd4de0b0fa devtls: remove unused get32() function 2016-11-17 18:14:06 +01:00
ftrvxmtrx 0930f44feb cmd: remove a bit of unused stuff 2016-11-17 02:59:40 +01:00
ftrvxmtrx c0d0f86b14 tar: remove unused variable 2016-11-17 02:14:59 +01:00
ftrvxmtrx e49f163ef3 clock: remove unused variable 2016-11-17 02:12:49 +01:00
ftrvxmtrx 4c0c82d6f7 page: remove unused variables 2016-11-17 02:11:35 +01:00
ftrvxmtrx ec32701973 ramfs: remove unused variable 2016-11-17 02:09:57 +01:00
ftrvxmtrx 4195e1a54e aan: didn't ask about sendcommand 2016-11-17 02:07:52 +01:00
ftrvxmtrx 8f221cfec1 libsec: remove unused aes_setupDec 2016-11-17 02:02:32 +01:00
cinap_lenrek 1a782fda3e pc64: check if vmap() range fits in VMAPLEN window, remove unneeded vmapsync(), rename fault386() to faultamd64() 2016-11-17 01:28:11 +01:00
cinap_lenrek 78d2a52577 ip/tcp: never raise the mss over the link mtu < 1280 for v6
v6 mandates minimum mtu of 1280, tho someone *could* setup
an interface with a lower mtu or set it lower for testing.
2016-11-16 00:54:04 +01:00
cinap_lenrek 323d625864 ip: get rid of update_mtucache() and restrict_mtu() prototypes 2016-11-15 22:13:08 +01:00
cinap_lenrek 30c5c3404b ip/pktmedium: no mintu, no maclen... thi is ip packets 2016-11-15 22:11:47 +01:00
cinap_lenrek 3579757291 ip/pktmedium: fix wrong hsize, theres no ethernet header on packet media
packet media is just raw ip packets, so theres no link-level
header there. was probably copy-pasted from ethermedium...
2016-11-15 21:54:03 +01:00
cinap_lenrek 1f628ef132 ip/tcp: only calculae mss from interface mtu when directly reachable for v6
we currently do not implement path mtu discovery so for
destinations that are not directly reachable assume the
minimum mtu of 1280 bytes.
2016-11-15 20:28:45 +01:00
cinap_lenrek fdc8187038 nusb/ether: support for "bridge" ctl message 2016-11-12 23:11:03 +01:00
cinap_lenrek c86b5ddaa6 kernel/qio: make readblist() offset of type ulong as the rest 2016-11-12 17:41:58 +01:00
cinap_lenrek 2127b8c552 kernel/qio: get rid of unused qcopycnt debug variable 2016-11-12 16:05:00 +01:00
cinap_lenrek d2ad8df947 kernel/qio: implement concatblock() with pullupblock() 2016-11-09 19:44:38 +01:00
cinap_lenrek d97eb114d5 kernel/ip: fix typo (rfc -> ifc) 2016-11-08 22:33:48 +01:00
cinap_lenrek ba38aa8b9d gre: check nil for pullupblock() 2016-11-08 22:33:19 +01:00
cinap_lenrek 58fe71b2f5 devbridge: simplify etherwrite() as we dont deal with block lists 2016-11-08 21:06:06 +01:00
cinap_lenrek 99cc56f2e9 kernel/ip: remove nil checks for allocb() and padblock() 2016-11-08 21:05:01 +01:00
cinap_lenrek 5cbffd6e6b kernel/qio: maintain Block.next pointer in padblock() 2016-11-08 21:03:08 +01:00
cinap_lenrek 8f782ac916 srv(4): add SOURCE for srvtls 2016-11-08 02:10:47 +01:00
cinap_lenrek b431b6c169 kernel/qio: fix comments, fix qiwrite() on close queue, remove debug setmalloctag() call in qwrite() 2016-11-08 00:38:07 +01:00
cinap_lenrek 32dfbc7c50 devcons: simplify putstrn0() 2016-11-08 00:34:59 +01:00
cinap_lenrek 48b49361d8 devbridge: various bugfixes and improvements from charles forsyth 2016-11-07 22:43:37 +01:00
cinap_lenrek a54d1cd95e kernel/qio: big cleanup of qio functions
remove bl2mem(), it is broken. a fault while copying to memory
yields a partially freed block list. it can be simply replaced
by readblist() and freeblist(), which we also use for qcopy()
now.

remove mem2bl(), and handle putting back remainer from a short
read internally (splitblock()) avoiding the releasing and re-
acquiering of the ilock.

always attempt to free blocks outside of the ilock.

have qaddlist() return the number of bytes enqueued, which
avoids walking the block list twice.
2016-11-07 22:20:10 +01:00
cinap_lenrek 23d217afb4 devloopback: simplify loopoput()
remove unneeded waserror() block, loopoput is alled from
loopbackbwrite only so we will always get called with a
*single* block, so the concatblock() is not needed.
2016-11-07 22:08:21 +01:00
cinap_lenrek 857f2528e0 ip: always pass a single block to Medium.bwrite(), avoid concatblock() calls in Dev.bwrite()
the convention for Dev.bwrite() is that it accepts a *single* block,
and not a block chain. so we never have concatblock here.

to keep stuff consistent, we also guarantee thet Medium.bwrite()
will get a *single* block passed as well, as the callers are
few in number.
2016-11-07 22:05:29 +01:00
cinap_lenrek ea993877a9 ip/nullmedium: free passed block in nullbwrite() 2016-11-07 21:40:12 +01:00
cinap_lenrek 59dd0af53a ip/tcp: remove useless nil checks for padblock() and allocb() return value 2016-11-07 21:39:28 +01:00
cinap_lenrek c1fd7c210b kernel: fix missing ; in panic() call 2016-11-05 20:08:20 +01:00
cinap_lenrek 963497f06b kernel: avoid padblock copying for devtls/devssl/esp, cleanup debugging
to avoid copying in padblock() when adding cryptographics macs to a block
in devtls/devssl/esp we reserve 16 extra bytes to the allocation.

remove qio ixsummary() function and add acid function qiostats() to
/sys/lib/acid/kernel

simplify iallocb(), remove iallocsummary() statitics.
2016-11-05 20:05:40 +01:00
cinap_lenrek 240590ab0a archacpi: fix format string warning on amd64 2016-11-05 18:31:50 +01:00
cinap_lenrek fa5bd71218 devmnt: avoid memory copies of I/O rpc buffer by using bwrite()
given that devmnt will almost always write into a pipe
or a network connection, which supports te bwrite routine,
we can avoid the memory copy that would have been done by
devbwrite(). this also means the i/o buffer for writes
will get freed sooner without having to wait for the 9p
rpc to get a response, saving memory.

theres one case where we have to keep the rpc arround and
that is when we write to a cached file, as we want to update
the cache with the data that was written, but the user buffer
cannot be trusted to stay the same during the rpc.
2016-11-05 18:26:12 +01:00
cinap_lenrek 5c1feb0ef0 libc: move calloc() into its own compilation unit
move calloc() in its own compilation unit to avoid
code duplication. also, calloc() is used rarely in
plan9 programs.
2016-11-05 18:00:10 +01:00
cinap_lenrek bf9bada0c2 winwatch: put previous label contents in edit buffer for relabling 2016-11-01 09:50:25 +01:00
cinap_lenrek 95609d520e 8c: fix double compiling FNX complex lvalue in cgen64()
sugen() calls cgen64() speculatively so that when cgen64() returns
zero, it will fall back and compile 64-bit copy.

the bug was that cgen64() compiled the left hand side and then recursively
called cgen64() again, which didnt handle the memory copy so it returned
zero and sugen() would compile the left hand side again resulting in two
function calls being emited.

some code that reproduced the issue:

#include <u.h>
#include <libc.h>

typedef struct
{
	char x[10];
	vlong a;
} X;

X a;
X *f(void) { return &a; }

void
main(int argc, char *argv[])
{
	f()->a = a.a;
}

producing:

TEXT	f+0(SB),0,$0
	MOVL	$a+0(SB),AX
	RET	,
	RET	,
	TEXT	main+0(SB),0,$0
	CALL	,f+0(SB)
	CALL	,f+0(SB)			<- bug
	MOVL	AX,CX
	LEAL	a+12(SB),DX
	MOVL	(DX),AX
	MOVL	AX,12(CX)
	MOVL	4(DX),AX
	MOVL	AX,16(CX)
	RET	,
	GLOBL	a+0(SB),$20
	END	,
2016-10-30 23:30:13 +01:00
cinap_lenrek 62d3108646 ape/libsec: add secp384r1 curve parameters for tls 2016-10-30 20:32:03 +01:00
cinap_lenrek ef8cbbba03 merge 2016-10-30 02:17:12 +01:00
cinap_lenrek c9d55cadb3 libsec: add secp384r1 curve parameters for tls 2016-10-30 02:15:40 +01:00
spew cf5d24033d winwatch: no more 'l' key labeling 2016-10-26 14:01:13 -05:00
spew d5992857bb winwatch: middle mouse button click also prompts for label 2016-10-25 22:53:38 -05:00
ftrvxmtrx 7b8c6ae432 stats: alternatively read battery and temp from aux/acpi 2016-10-24 23:51:16 +02:00
ftrvxmtrx 1f3600c83f aux/acpi: make it stats(8)-friendly 2016-10-24 23:50:04 +02:00
cinap_lenrek 234137bce3 fix bugs and cleanup cryptsetup code
devfs:

- fix memory leak in devfs leaking the aes key
- allocate aes-xts cipher state in secure memory
- actually check if the hexkey got fully parsed

cryptsetup:

- get rid of stupid "type YES" prompt
- use genrandom() to generate salts and keys
- rewrite cryptsetup to use common pbkdf2 and readcons routines
- fix alot of error handling and simplify the code
- move cryptsetup command to disk/cryptsetup
- update cryptsetup(8) manual page
2016-10-24 20:56:11 +02:00
cinap_lenrek f3feafc476 auth/factotum: bound the number of srv processes to 16, error the 9p rpc when it is over limit 2016-10-23 17:18:35 +02:00
cinap_lenrek b728f50a79 lib9p: limit the number of srv processes kept arround 8 2016-10-23 17:16:22 +02:00
cinap_lenrek 98dba9a4a3 pc/archacpi: don't do acpi initialization in the kernel, provide generic acpimem routines
get rid of _INI and _REG method calls, this is not full acpi environment
anyway and all we really want todo at kernel boot time is figuring out
the interrupt routing. aux/acpi can try to enable more stuff if it needs
to later when battery status desired.

dont snoop memory space regions in amlmapio(), this is just wrong as
amlmapio() is *lazily* mapping regions as they are accessed, so the
range table would never be really complete. instead, we provide generic
access to the physical address space, excluding kernel and user memory
with acpimem file.
2016-10-23 04:09:27 +02:00
cinap_lenrek 055f837043 ip: simplify code as packblock() and concatblock() will never error 2016-10-23 00:31:42 +02:00
cinap_lenrek 75c6ab45e0 devip: simplify ipbwrite() by using retun value of qbwrite() 2016-10-23 00:29:41 +02:00
cinap_lenrek ef5c862ce9 ip/icmp: only reply to echo request when directed to us and source is unicast 2016-10-23 00:25:17 +02:00
cinap_lenrek a8d00e5d56 gif: just read and decode the first image when -9 or -c flag is specified 2016-10-22 00:35:17 +02:00
cinap_lenrek 6d97f77c2d libdraw: avoid dropping queued button change mouse events in emouse() 2016-10-22 00:04:21 +02:00
cinap_lenrek e5dc3ade08 mothra: avoid flushimage() calls, event() will implicitely flush 2016-10-22 00:02:23 +02:00
spew 3145ca7d78 mpc: remove unused yylval type 2016-10-19 22:15:51 -05:00
ftrvxmtrx 26e00d014c aux/acpi: batteries and CPU temp reading so far 2016-10-18 23:05:09 +02:00
ftrvxmtrx e01577f8f6 archacpi: optionally export acpi memory regions; properly initialize environment 2016-10-18 23:04:19 +02:00
ftrvxmtrx 06dd182695 sam: revert showdata crap 2016-10-18 21:25:19 +02:00
ftrvxmtrx d010b87b18 sam: corner cases are hard 2016-10-18 20:27:08 +02:00
ftrvxmtrx e19308ee16 sam: fixup :( 2016-10-18 20:22:25 +02:00
ftrvxmtrx dff69d5922 samterm: support "showdata" plumb action 2016-10-18 20:02:01 +02:00
stanley lieber 40f69f4df5 fortunes: does that me a dipshit 2016-10-16 14:16:17 -04:00
ftrvxmtrx 0a7a717525 scram: remove _PTS(5). it just doesn't make any sense 2016-10-15 23:42:22 +02:00
ftrvxmtrx 277913c94a scram: oops. word is 0xffff, not 0xff 2016-10-15 23:34:08 +02:00
ftrvxmtrx 375ad2d3ab scram: run _PTS(5) and disable GPEs before entering S5. x200s shuts down properly now 2016-10-15 23:10:53 +02:00
stanley lieber 7392dce0a7 fortunes: Angular uses the term "scope" in a manner akin to the fundamentals of co
mputer science.
2016-10-10 13:43:48 -04:00
cinap_lenrek 062a46607e nusb/kb: set usage to 0 (undefined) for items exceeding usage list 2016-09-28 19:25:23 +02:00
cinap_lenrek 9cb3e5900e nusb/lib: fix wrong endpoint id when openep() finds already existing endpoint file 2016-09-28 19:15:10 +02:00
ftrvxmtrx ab3492f05e sam: putenv("%", ...): don't crash when no file is current 2016-09-26 23:00:06 +02:00
cinap_lenrek d8b4f95476 sam: use $% instead of $f for filename to be consistent with acme 2016-09-22 11:04:43 +02:00
cinap_lenrek 52cacba37c sam: make current filename available to shell commands in $f (thanks aiju) 2016-09-22 10:49:48 +02:00
cinap_lenrek 483e54a0d3 ip(3): spelling, thanks sl 2016-09-21 21:57:08 +02:00
cinap_lenrek e864523eed ip(3): update description of /net/ipifc/*/status format 2016-09-21 21:47:52 +02:00
cinap_lenrek c7bad8f0e5 rio: fix onscreen() 2016-09-20 09:15:53 +02:00
cinap_lenrek 35fde3591f scat: hjdicks for amd64 2016-09-19 19:04:21 +02:00
aiju 11e40fc6b4 pc(1): if the input base is not 10, print the 0d prefix before decimal numbers; this way, all output is always valid input (for the current mode) 2016-09-19 16:45:15 +00:00
cinap_lenrek bb823caa28 merge 2016-09-19 02:30:39 +02:00
cinap_lenrek c7f0aba80b webfs: aaand another one (should go to sleep) 2016-09-19 02:28:10 +02:00
cinap_lenrek fe320116da merge 2016-09-19 02:14:03 +02:00
cinap_lenrek f5fcb42cff merge 2016-09-19 02:12:18 +02:00
cinap_lenrek cbdf48454f webfs: fix mistake... 2016-09-19 02:11:03 +02:00
cinap_lenrek 6d354d07e8 webfs: don't use cache connections when posting
we cannot retry posts and we do not know for sure if a
post had any side effect when we got no status, so always
make a new connection for a post request.
2016-09-19 02:04:13 +02:00
aiju 0c50e1bc3d pc(1): add pb (thanks, BurnZeZ); add bit numbering 2016-09-19 01:20:28 +02:00
cinap_lenrek 1447b95555 rio: improved bandsize()
when dragging a window edge, allow one to slide to a corner
or slide from corner to corner (usefull when inverting).

also make sure the right or bottom of the rectangle returned
by whichrect() is not outside of the screen (which makes
drawing slow).
2016-09-18 21:16:45 +02:00
cinap_lenrek 31b10e364f cpu: quote remaining remote command arguments, don't syslog on missing /mnt/term/dev/cpunote file 2016-09-18 16:54:24 +02:00
cinap_lenrek 2aa727ff09 etherzynq: implement promisc mode and multicast filter support 2016-09-17 15:58:11 +02:00
cinap_lenrek cb9a5a19b0 nusb/ether: promisc and multicast support for admtek pegasus (aue) 2016-09-17 14:18:40 +02:00
cinap_lenrek 382abccf27 nusb/ether: multicast and promisc support for rtl8150 (url) 2016-09-17 14:06:03 +02:00
cinap_lenrek ce07c1d6e7 merge 2016-09-16 23:23:19 +02:00
cinap_lenrek c937aac59b nusb/ether: experimental pomisc mode and multicast support for smsc and asix 2016-09-16 23:21:54 +02:00
aiju 0c3ba556a2 pc(1): _ handling in numbers was broken at some point; restore documented behaviour 2016-09-15 09:13:22 +00:00
aiju 07284c41f6 pc(1): add nsa() command 2016-09-15 08:51:59 +00:00
cinap_lenrek 7bcbef11eb ape: fix format clash, %z is for size_t (which is a long currently), not pointer sized 2016-09-14 00:18:45 +02:00
cinap_lenrek a0150376df ape: bring strtod() in line with plan9's libc version 2016-09-11 23:20:55 +02:00
cinap_lenrek 5b66b52623 libc: dont use floating point for portable umuldiv(), use 64 bit uvlong 2016-09-11 23:19:18 +02:00
cinap_lenrek c0a9c3b551 kernel: rekey chacha state on each randomread() invocation
we can encrypt the 256 bit chacha key on each invocation
making it hard to reconstruct previous outputs of the
generator given the current state (backtracking resiatance).
2016-09-11 19:07:17 +02:00
cinap_lenrek 36c9a2489d devcons: remove /dev/reboot "halt" command...
the "halt" command written to /dev/reboot just causes the
machine to crash... its also undocumented... removing it.

--
cinap
2016-09-11 14:12:39 +02:00
cinap_lenrek 95c9f5bf37 kernel: better nonce partitioning for chacha random number generator
leave the block counter to chacha_encrypt() and increment the 96 bit
iv instead.
2016-09-11 03:18:48 +02:00
cinap_lenrek 10275ad6dd kernel: xoroshiro128+ generator for rand()/nrand()
the kernels custom rand() and nrand() functions where not working
as specified in rand(2). now we just use libc's rand() and nrand()
functions but provide a custom lrand() impelmenting the xoroshiro128+
algorithm as proposed by aiju.
2016-09-11 02:10:25 +02:00
cinap_lenrek 7713145638 kernel: make randomread() fault reentrant
we now access the user buffer in randomread() outside of the lock,
only copying and advancing the chacha state under the lock. this
means we can use randomread() within the fault handling path now
without fearing deadlock. this also allows multiple readers to
generate random numbers in parallel.
2016-09-11 02:09:07 +02:00
cinap_lenrek a121806126 kernel: replace various custom random iv buffer filling functions with calls to prng() 2016-09-11 01:54:06 +02:00
stanley lieber b137763fe7 fortunes: Nein -- General Chuck Yeager 2016-09-09 16:59:00 -04:00
cinap_lenrek efe5c58c01 authsrv(2): update Nvrsafe structure to include aesmachkey 2016-09-08 10:40:19 +02:00
cinap_lenrek ed38b5e9cb kernel: fix type for utime/stime in pexit(), fix debug format strings 2016-09-08 01:49:25 +02:00
cinap_lenrek 5d9deb77e9 kernel: make sure procalarm() remaining time doesnt become negative 2016-09-08 01:28:34 +02:00
cinap_lenrek 01b4c2a63d kernel: always do unsigned subtractions for m->ticks delta for updatecpu() and rebalance(), handle ticks wrap arround in hzsched() 2016-09-08 00:44:38 +02:00
cinap_lenrek bd3429304c kernel: use tk2ms() instead of TK2MS macro for process time conversion
this code isnt time critical and process TReal delta can become
very long, so use tk2ms() which is less prone to overflow.
2016-09-07 23:39:10 +02:00
cinap_lenrek 1848f4e946 kernel: tsemacquire() use MACHP(0)->ticks for time delta
we might wake up on a different cpu after the sleep so
delta from machX->ticks - machY->ticks can become negative
giving spurious timeouts. to avoid this always use the
same mach 0 tick counter for the delta.
2016-09-07 23:36:04 +02:00
cinap_lenrek bfd8098b8d devcap: timeout capabilities after a minute, fix memory leak, paranoia
the manpage states that capabilities time out after a minute,
so we add ticks field into the Caphash struct and record the
time when the capability was inserted. freeing old capabilities
is handled in trimcaps(), which makes room for one extra cap
and frees timed out ones.

we also limit the capuse write size to less than 1024 bytes to
prevent denial of service as we have to copy the user buffer.
(memory exhaustion).

we have to check the from user *before* attempting to remove
the capability! the wrong user shouldnt be able to change any
state. this fixes the memory leak of the caphash.

do the hash comparsion with tsmemcmp(), avoiding timing
side channels.

allocate the capabilities in secret memory pool to prevent
debugger access.
2016-09-07 21:14:23 +02:00
cinap_lenrek 76daf9f863 merge 2016-09-06 22:29:40 +02:00
cinap_lenrek cf78fd37cb devproc: do unsigned subtraction to get MACHP(0)->ticks - up->times[TReal] delta 2016-09-06 22:27:26 +02:00
aiju 6d96b35fad pc(1): bugfix: allow setting output base to 0 (thanks, deuteron) 2016-09-05 15:48:46 +00:00
cinap_lenrek 9e926eeb4e 5c: do shift propagation for rotate right (ROR) 2016-09-03 19:05:28 +02:00
cinap_lenrek a5d8cd30bb 5c: format assembly constant right shift encoding 0 as >>32 2016-09-03 18:18:28 +02:00
cinap_lenrek b46a0e97ea 5a: assemble constant >>0 right shifts as <<0 (no shift), allow >>32
previously, right shift >>0 resulted in >>32 being emited. this
is especially problematic when the shift count comes from a macro
expansion.

we now handle constant shift >>0 as <<0 (no shift) and allow
shift by 32 be specified.

this applies to logical right shift (>>) arithmetic right shift (->)
and right rotate (@>).
2016-09-03 17:11:38 +02:00
cinap_lenrek 607f3bc55c 5l: format assembly constant right shift encoding 0 as >>32 2016-09-03 17:01:56 +02:00
cinap_lenrek 2e120a29db libmach: fix RORREG, right shift with shift count 0 means >>32 2016-09-03 16:47:51 +02:00
aiju 1b4f432eae pc(1): manpage: restore previous size rather than set to 10 2016-09-01 11:46:44 +00:00
aiju 183f700a20 pc(1): manpage formatting 2016-09-01 11:38:33 +00:00
aiju 30c9e34c0d pc: add cat() function 2016-09-01 10:55:12 +00:00
aiju d552fed385 mptrunc: don't write to r->p[r->top] 2016-09-01 10:46:37 +00:00
aiju 560ea5474c pc: add rev function 2016-08-31 13:00:50 +00:00
aiju e95082f66c pc: add gcd, rand and minv; set base of logical operation results to 0 2016-08-29 09:57:15 +02:00
cinap_lenrek a08bf6831f libmp: remove unused mpeuclid.c 2016-08-29 02:09:34 +02:00
cinap_lenrek 5852f8a144 libmp: allow passing nil to v,x,y results of mpextendedgcd(), simplify mpinvert() 2016-08-29 02:07:52 +02:00
cinap_lenrek 33862ff793 libmp: mpnrand(), what was i *THINKING*
the prior implementation was unneccesarily complicated for
no good reason due to me misunderstanding how libc's nrand()
works. in contrast to libc, we already generate the *closest*
power-of-2 random number with mprand() in the sampling loop.
2016-08-29 00:45:16 +02:00
cinap_lenrek b80684a1d2 python: remove automatic compiled module loading (.pyc files) 2016-08-28 17:39:18 +02:00
cinap_lenrek 1f9bdb6f5d libmp: mpdiv(): fix divisor==quotient case (again) 2016-08-28 16:46:32 +02:00
cinap_lenrek bdc87e17bd libmp: timingsafe sign flip for small power-of-two negative divisor for mpdiv() 2016-08-28 16:33:52 +02:00
aiju b65f409d54 mp.h: add mpasr 2016-08-28 16:05:22 +02:00
aiju c3da573eb7 pc(1): SYNOPSIS... 2016-08-28 13:59:16 +02:00
aiju d9d2925fa0 pc(1): document -n option in manpage 2016-08-28 13:49:26 +02:00
aiju a931ad737a add pc(1) 2016-08-28 13:40:01 +02:00
aiju 43bb71c8cc mpdiv: negative divisor has to flip sign of quotient 2016-08-28 12:00:25 +02:00
aiju 344ff48512 mp: fix mptov and mptouv 2016-08-28 11:38:29 +02:00
aiju cf2f2a8841 mp: fix mpnot and add mpasr 2016-08-28 10:49:41 +02:00
cinap_lenrek 193daffafb mercurial: use new d_stat from dirent structure in osutil.listdir 2016-08-28 03:41:25 +02:00
cinap_lenrek 5debddf8af ape: add d_stat struct in dirent struct allowing the avoidance of stats 2016-08-28 03:39:49 +02:00
aiju a8ffbcabea timmy: manpage 2016-08-28 01:23:51 +02:00
aiju 913ce62cfc strtomp: update the returned char* even if there were no characters parsed 2016-08-28 01:08:26 +02:00
aiju 261ec9fe0e strtomp: fix mpbits() call in octal code 2016-08-28 01:07:34 +02:00
cinap_lenrek 75990fc719 fix wrong manpage section index generation for rc-httpd(8) 2016-08-27 22:37:08 +02:00
cinap_lenrek f2519d701c rio(4): document text truncation 2016-08-27 21:28:21 +02:00
cinap_lenrek b59aa67922 rand(2), cons(3): clarify /dev/random behaviour 2016-08-27 21:27:52 +02:00
cinap_lenrek f777743b72 merge 2016-08-27 20:50:55 +02:00
cinap_lenrek 0a5f81a442 kernel: switch to fast portable chacha based seed-once random number generator 2016-08-27 20:42:31 +02:00
cinap_lenrek 71ac88392f devsdp: keep cipher states in secret memory 2016-08-27 20:39:36 +02:00
cinap_lenrek 7f16c92762 ip/esp: allocate cipher states in secret memory 2016-08-27 20:38:33 +02:00
cinap_lenrek 2967f942ea devtls: allocate cipher states in secret memory 2016-08-27 20:37:31 +02:00
cinap_lenrek 7250c438bb devssl: allocate cipher states in secret memory 2016-08-27 20:37:14 +02:00
cinap_lenrek 0ac260b18a wifi: update wifi.h header 2016-08-27 20:36:08 +02:00
cinap_lenrek 0b8851ddb6 wifi: allocate cipher states in secret memory, do AESstate key setup once 2016-08-27 20:35:39 +02:00
cinap_lenrek 0f97eb3a60 kernel: add secalloc() and secfree() functions for secret memory allocation
The kernel needs to keep cryptographic keys and cipher states
confidential. secalloc() allocates memory from the secret pool
which is protected from debuggers reading the memory thru devproc.
secfree() releases the memory, overriding the data with garbage.
2016-08-27 20:33:03 +02:00
cinap_lenrek 8a73650874 libc: add poolisoverlap() and definitions for Pool *secrmem 2016-08-27 20:23:55 +02:00
aiju 1bd3ace9e7 document Bfn 2016-08-25 23:39:07 +02:00
cinap_lenrek a1e96ae4b5 merge 2016-08-20 19:09:08 +02:00
cinap_lenrek c0ab6c1d01 vga/igfx: add pci did's for kenjis intel graphics cards. 2016-08-20 19:06:57 +02:00
cinap_lenrek 51f76ae999 merge 2016-08-20 18:51:07 +02:00
cinap_lenrek 540373b9f6 vga/igfx: work in progress fdi link train for sandy bridge, properly calculate fdi and displayport lane count 2016-08-20 18:49:44 +02:00
spew db7d1ed2b1 fix awk format printing bugs (thanks aiju) 2016-08-18 08:52:58 -05:00
cinap_lenrek 713beb6d42 devmnt: fix mistake in mntrahread()
mntrahread() had the prefetch window condition wrong so
it would very agressively prefetch ignoring the prefetch
window.
2016-08-16 18:06:22 +02:00
cinap_lenrek f3b27fd889 webfs: dont include http status in "needkey" error string 2016-08-15 09:07:34 +02:00
cinap_lenrek 52d407f86f libframe: consistent use of nil vs. 0 2016-08-15 08:40:04 +02:00
cinap_lenrek 5af0a7ce73 libflate: add bounds checking on decode array, add sanity checks in hufftab() 2016-08-15 01:07:28 +02:00
cinap_lenrek 75a8003a8a ndb/cs: don't lookup AAAA records for IL, make sure translated address is IPv4 for IL, consistent use of nil vs. 0 for pointers 2016-08-14 23:10:19 +02:00
cinap_lenrek 58a0db935c ip/il: dont attept to connect over IPv6, IL only supports IPv4 packets 2016-08-14 23:07:10 +02:00
cinap_lenrek d41ca0d32c 6c: subsitute floating point registers eleminating MOVSD and MOVSS instructions in peephole pass 2016-08-14 18:52:18 +02:00
cinap_lenrek dac5756766 ratrace: fix fork/exec race with "nohang" procctl (like a debugger) 2016-08-10 02:40:16 +02:00
aiju a07a2025da document mplogic functions 2016-08-08 22:19:29 +02:00
cinap_lenrek 590a4980bc auth/fgui: use pale colors 2016-08-08 07:48:55 +02:00
cinap_lenrek e9818df0ba libcontrol: primitive text entry cut and paste with mouse 2016-08-08 07:37:57 +02:00
cinap_lenrek 15fd826147 hgwebfs: make hgwebfs prompt for password 2016-08-08 05:35:06 +02:00
cinap_lenrek c8d1a885f8 webfs: avoid retry loops when we got a bad key in factotum 2016-08-08 05:32:20 +02:00
cinap_lenrek 038a615549 webfs: include factotum key query in error string for 401/407 Unauthorized status 2016-08-08 04:17:41 +02:00
cinap_lenrek 62ad8fc8df authsrv(6): document session secret key derivation for p9sk1 and dp9ik 2016-08-08 02:03:06 +02:00
aiju c6318ecb17 mptrunc: normalize after mpassign to handle the case b==r 2016-08-08 00:54:45 +02:00
cinap_lenrek 333468d668 thread(2): threadgrp() -> threadgetgrp(), thanks jpm 2016-08-06 15:09:18 +02:00
cinap_lenrek b21fe017d1 libauthsrv: ANAMELEN -> PASSWDLEN 2016-08-05 19:09:42 +02:00
cinap_lenrek b540a22eb0 libauth: fix mount file-descriptor leak in auth_chuid() 2016-08-04 11:48:19 +02:00
cinap_lenrek 2a6fd6ec25 auth/login: add dp9ik key to sub factotum, get rid of temporary /srv file 2016-08-04 11:47:12 +02:00
cinap_lenrek ad6bb37e33 ape/libauth: add PASSWDLEN constant to compile passtokey.c from native libauthsrv (thanks lawler) 2016-08-04 10:38:20 +02:00
cinap_lenrek 261e319092 auth: various cleanups, use common readcons() from libauthsrv, zero keys after use 2016-07-31 20:16:25 +02:00
cinap_lenrek a75f4de5c9 auth/secstore: use common readcons() routine from libauthsrv 2016-07-31 20:09:47 +02:00
cinap_lenrek ae5fb4ab78 auth/factotum: use common readcons() function from libauthsrv 2016-07-31 20:06:56 +02:00
cinap_lenrek cf37a1010f libauthsrv: export common readcons() routine and introduce PASSWDLEN constant
drawterm, factotum, secstore and the auth commands
all had ther own implementation of readcons. we
want to have one common function for this to avoid
the duplication, so putting that in libauthsrv.

introduce PASSWDLEN which makes the use more explicit
than ANAMELEN.
2016-07-31 20:04:02 +02:00
cinap_lenrek d91c4e407d auth/changeuser: fix misleading print (secret is 31 chars max, not 256) 2016-07-24 15:13:14 +02:00
cinap_lenrek 409babb990 devtls, devssl: make sure channel has ORDWR mode and is not a mount chan on fdtochan() 2016-07-24 03:24:42 +02:00
cinap_lenrek 8173223f43 swap: make sure swap chan has ORDWR mode on fdtochan() 2016-07-24 03:23:01 +02:00
cinap_lenrek a0d4c5e208 make error handling in 9p service loops consistent
when we get eof, stop the loop immidiately and do not
rely on the read to eventually return an error.

when convM2S() fails to decode the message, error out
and stop the loop. there is no point in continuing.
2016-07-24 02:21:32 +02:00
cinap_lenrek a840b597ca upas/fs: remove checkmboxrefs() debugging code, properly handle errors in 9p loop 2016-07-24 02:17:45 +02:00
cinap_lenrek 518a40ae95 ndb/dns: remove procname statistics and restart feature, cleanup 9p service loop
given that the memory leaks have been fixed, theres no need
for the obscure restart feature which is not reliable anyway.

remove the code updating procname on each 9p request.

handle convM2S error by exiting the service loop, dont read
9p channel after eof.
2016-07-24 02:12:17 +02:00
cinap_lenrek 093eaec219 kernel: dont pprint() into 9p channels
when fd 2 (stderr) points to a mount channel, dont
cause protocol confusion by dumping error strings
into it.
2016-07-19 22:10:52 +02:00
cinap_lenrek 95524b1cdd 5c: fix int -> uvlong cast bug (thanks to qwx on his patience on a the trouble session to narrowing it down)
we used to not sign extend if the destination was unsigned
uvlong, which is wrong. we have to sign extend only based
on the signedness of the source (it gets propagated to vlong)

this bug hit in hjfs in the newentry() function, causing file
creation to fail with "create -- phase error":

newentry(...)
{
	uvlong sj;
	int si;
	...

	sj = si = -1;

	...
}
2016-07-15 21:13:35 +02:00
cinap_lenrek de1e74abd2 5a: ROL instruction 2016-07-15 15:04:32 +02:00
cinap_lenrek 1492f46f87 libsec: add scrypt password based key derivation function 2016-07-10 21:41:57 +02:00
cinap_lenrek 677dd90b02 disk/prep: if no 9fat, reserve space for plan9 partition table in autopart (thanks Shamar)
usually, the plan9 partition table is contained in
the first 9fat partition after the pbs/fat header,
but when no 9fat partition is requested, we have
to make sure partitions wont overlap the partition
table (start at sector offset >= 2).
2016-07-08 16:19:15 +02:00
cinap_lenrek 49cd794fbd 5l: ROR instruction 2016-07-08 04:16:37 +02:00
spew 752ba45fbf remove mpc.tab.h on mk clean 2016-07-05 23:21:36 -05:00
spew eef8f57b22 add history for libregexp 2016-07-04 14:25:08 -05:00
cinap_lenrek 1edd8d28a5 acpi: _ADR and _BBN might be methods, so use amleval() to evaluate the value 2016-06-30 19:11:06 +02:00
cinap_lenrek 3ec84c5d73 rc: implement 9atoms ` split {command} syntax extension 2016-06-30 19:09:27 +02:00
cinap_lenrek cabbe0a84c doom: use Kprint for pause function (from qu7uux)
the pause function is different from just accessing the menu: it pauses both
single and multiplayer games, stops music and sound, and is recorded in demos
(does not cause a desync, unlike menu access).
this uses Kprint rather than Kbreak because Kbreak is e.g. Kctl+pause on some
keyboards.
2016-06-30 17:18:30 +02:00
cinap_lenrek 92aa75e879 ether8169: fix wrong mbps setting (from qu7uux)
the first time rtl8169link is called (from rtl8169pnp), the link isn't up, so
setting edev->mbps based on Phystatus register is skipped. edev->mbps is then
still set at the default 100, and that ends up being what devether uses.
this is why some rtl8169 cards are misprinted as 100Mbps in kmesg.
later, after rtl8169link is called again from rtl8169interrupt, the link is up
and edev->mbps is set to the correct value (as shown by e.g. /net/ether0/stats).

so instead, set speed regardless of link status.
2016-06-30 17:16:11 +02:00
cinap_lenrek ca8ca008f4 doom: fix blazing door sounds (from qu7uux)
blazing doors are a "fast" door type with its own sound effects, introduced in
doom2. doom2 map 2 has one right at the beginning.

this fixes two bugs:
- when a closing blazing door is completely shut, the closing sound effect is
  erroneously played again (the first time being when it began closing). this
  gives the impression of two doors closing.
- when reopening a closing blazing door (standing underneath a blazing door
  while it's closing), the sound effect for regular doors opening is played,
  instead of the one for blazing doors, because of a missing case in the switch
  statement.
2016-06-30 17:13:47 +02:00
cinap_lenrek dab539cd14 vga/igfx: fix integer overflow in datam calculation (from qu7uux)
data[mn] and link[mn] are 24-bit values.
in the expression 'm = (n * ((freq * bpp)/8)) / (lsclk * lanes)',
uvlongs are used to prevent integer overflow, but since freq, bpp, lsclk and
lanes are all ints, the cast to uvlong does not happen until it's too late,
getting a wrong value.
instead, use u32int for m and n, and use casts where necessary.

example of bad calculation:
freq = 141400000
lsclk = 270000000
lanes = 2
bpp = 18
→ 0x7f3ee1ca6 (correct value: 0x4b69d0)
2016-06-30 11:58:40 +02:00
cinap_lenrek 6c7829092e acme(1): remove references to awd 2016-06-30 01:07:03 +02:00
cinap_lenrek 828ec57d65 acme/win: implement /dev/wdir file in win to change directory tagline, remove awd 2016-06-30 00:46:52 +02:00
cinap_lenrek 65977417e7 rc: write /dev/wdir after printing the prompt, not after executing "cd" command 2016-06-30 00:45:37 +02:00
cinap_lenrek d39d1a5303 merge 2016-06-27 00:36:54 +02:00
cinap_lenrek 2dc97202de ndb/dns: purge db records on refresh for resolvers, remove old debug and testing code
when ndb/dns runs as a resolver only (cfg.cachedb == 0),
we still want to purge the "local#" db records to reread
dns server configuration or react to changed ip addresses.

removing old poolcheck and dncheck code, these bugs have
been fixed a long time ago.
2016-06-27 00:36:04 +02:00
stanley lieber cb1a49daac /sys/src/games/mkfile: add timmy 2016-06-26 16:47:19 -04:00
aiju 4821c261c4 added games/timmy 2016-06-23 21:12:06 +02:00
cinap_lenrek baf20a548b rio: move the test if w is allowed to change cursor into wsetcursor()
the onscreen cursor shows the cursor of the current
focused window or the window it points at. if there
is no window, then we set the default cursor (nil).
2016-06-26 18:14:34 +02:00
cinap_lenrek b2efac4687 5c: handle unused results for cgen64() 2016-06-26 16:38:46 +02:00
cinap_lenrek 67a9174ff8 chacha: calculate rounds in separate function (helps registerizer), get rid of unrolled code 2016-06-26 15:28:01 +02:00
cinap_lenrek 69b0980a42 libc: native _addv() and _subv() routines for arm 2016-06-26 15:16:23 +02:00
cinap_lenrek a99cf56c7d kernel: more (arm) compiler friendly mul64fract()
the arm compiler can lift long->vlong casts on multiplcation
and convert 64x64->64 multiplication into a 32x32->64 one
with optional 64 bit accumulate.
2016-06-26 15:13:10 +02:00
cinap_lenrek 5bf09937da 5c: support for bit ROL, native 64 bit arithmetic 2016-06-26 15:09:27 +02:00
cinap_lenrek 57ff297cc0 cc: add OROL op to side effect free op list 2016-06-26 15:00:40 +02:00
cinap_lenrek c7565b51b8 merge 2016-06-20 23:11:27 +02:00
cinap_lenrek 94ba3db591 audio/flacdec: exit on decode error, print error message 2016-06-20 23:09:40 +02:00
stanley lieber 0d29a5d81f fortunes: Emacs now supports webkit. 2016-06-19 18:40:46 -04:00
aiju e73a9eb9e8 togif: -E flag to read animation from stdin 2016-06-10 12:14:02 +02:00
cinap_lenrek a00b6bdbfa 8c, 6c: native ROL (cyclic shift) instruction support, improve peephole optimizers
introduce rolor() function to subsitute (a << c) | (a >> (bits(a) - c))
with (a <<< c) where <<< is cyclic rotation and c is constant.
this almost doubles the speed of chacha encryption of 386 and amd64.

the peephole optimizer used to stop when it hit a shift or rol
instruction when attempting to eleminate moves by register
substitution. but we do not have to as long as the shift count
operand is not CX (which cannot be substituted) and CX is not
a subject for substitution.
2016-06-09 23:12:46 +02:00
cinap_lenrek 5cdabc5eb1 ?c: track ../cc/cc.h dependency and rebuild cc.a$O as neccesary 2016-06-09 23:03:30 +02:00
cinap_lenrek bd8b6c2f99 aml(2): document amlintmask 2016-06-05 15:15:03 +02:00
cinap_lenrek bc2a5d9b1e aml: define amlintmask and set it according to DSDT revision (64bit / 32bit) 2016-06-05 14:57:38 +02:00
cinap_lenrek 3ccc8224be aml: implement ToInteger() and Match() instructions 2016-06-04 21:11:17 +02:00
cinap_lenrek a4a1a88a70 webfs: less aggressive url normalization; never unescape reserved characters in path/query/fragment 2016-06-04 19:10:07 +02:00
stanley lieber 7c5ca77a6e etheriwl: add pcid 0x0082 for Intel Centrino Advanced-N 6205 variant 2016-06-01 21:45:46 -04:00
cinap_lenrek de19776b2f mk: remove buggy and useless symtab functions (thanks qrstuv)
neither symdel nor symstat were used anywhere. syminit was used but
had no effect. both syminit and symdel dereference pointers after
freeing them. symstat can be tricked into writing beyond the bounds of
its array
2016-06-02 00:12:36 +02:00
cinap_lenrek b878450725 mk: remove buggy and unneeded syminit() function (thanks qurstuv)
syminit() attemts to reset the symbol table by freeing
all the hash table entries, tho the code is buggy having
a obviously use after free bug.

as syminit() is only called once in main when it does not
contain any symbols, the bug never occured.

removing the unneccesary code alltogether.
2016-06-01 18:31:21 +02:00
cinap_lenrek 68571320fa libmemdraw: remove unused static variable from memimagedraw() 2016-05-29 18:23:42 +02:00
cinap_lenrek 3b1f13cb36 add polish keymap (thanks chomzee!) 2016-05-28 23:59:10 +02:00