Commit graph

623 commits

Author SHA1 Message Date
cinap_lenrek 4b9845d942 devshr: fix wstat, style
- same problem with wstat, if we error then owner has been already updated...
- avoid smalloc while holding qlock in wstat, do it before
- pikeshedd style...
2013-06-18 22:02:07 +02:00
cinap_lenrek b302cc1097 devsrv: fix wstat(), srvname(), avoid smalloc() while holding srv qlock, style
- wstat would half update the Srv data structure if name was too long
- srvname() walked the linked srv list without holding srv qlock
- dont access sp->chan while not holding srv qlock in srvopen()
- dont modify sp->owner while not holding srv qlock in srvcreate()
- avoid smalloc() allocations while holding srv qlock
- style pikeshedding, sorry
2013-06-17 21:58:38 +02:00
cinap_lenrek bf048d94c3 ip/ethermedium: drop short packets instead of producing negative size blocks
on usb ethernet, it can happen that we read truncated packets smaller
than the ethernet header size. this produces a warning in pullupblock()
later like: "pullup negative length packet, called from 0xf0199e46"
2013-06-17 02:28:10 +02:00
cinap_lenrek d84aeddee7 devmnt: add debug print for convS2M failing, suspecting this causing zero length writes 2013-06-16 06:16:43 +02:00
cinap_lenrek 4cf627a131 wpa: automatically pick cipher suits from beacon rsne 2013-06-15 19:02:17 +02:00
cinap_lenrek 12853d3ba8 merge 2013-06-13 20:08:17 +02:00
jpathy 166da952f4 fpiarm: condok() verfiy before specialop() omap/kw 2013-06-14 23:42:30 +05:30
cinap_lenrek f982f8b00b merge 2013-06-12 19:07:47 +02:00
jpathy 4b79c8f86f Remove unused fpemu function in omap, kw 2013-06-12 01:17:49 +05:30
jpathy 9f949e3cd3 ARM: kernel: add vfp emulator to bcm, teg2, omap, kw 2013-06-12 01:11:41 +05:30
jpathy de46340848 ARM: kernel changes make teg2 procfork() call fpuprocfork() and acid fixes for vfp instruction 2013-06-10 18:07:16 +05:30
cinap_lenrek 177c175fda kernel: allow sysr1 debugging only for hostowner 2013-06-10 01:09:52 +02:00
cinap_lenrek 62f6d1bc43 no need to disable fpu in execregs, this is done in procsetup() already 2013-06-07 18:04:59 +02:00
cinap_lenrek f0c9bb979f archacpi: handle multiple SSDT tables
we cannot assume theres only one instance of an acpi table. some
bios have multiple SSDT tables and we would only find the first
one.

now, we keep a second array to record the physical address of
the table visited by maptable(). load all instances to the
SSDT.
2013-06-07 18:03:44 +02:00
cinap_lenrek 82f9f3df72 usbdwc: sync with sources (Raspberry Pi Model A support) 2013-06-01 16:31:58 +02:00
cinap_lenrek aedb35af2c ether82557: panic() if receive buffer allocation fails on init 2013-06-01 01:42:39 +02:00
cinap_lenrek f7ffca5c1c ether83815: dont raise error() from etherreset
can't raise error() without process context. use panic() instead.
2013-06-01 01:40:56 +02:00
cinap_lenrek d94ffb4808 kernel: do all fp state fork from procfork() (like pc kernel)
this simplifies the arm ports and keeps all the stuff in one place
instead of spreading it thru notify(), trap() and syscall() functions
and prevents useless fp state copying for kernel procs.

also make sure to save fp in notify while still splhi().
2013-05-30 23:26:21 +02:00
cinap_lenrek 9652f5bec5 pc kernel: simulate FXSAVE/FXRSTOR tag-byte from x87 tag-word, copy fp state across fork
the tag-word is not compatible between x87 and sse, have to convert
properly for emulation to work.

we now copy fp state across fork (again!) to preserve FCW and MXCSR
registers. this might not be neccesary as we could probably just
get the current value for the curren process and avoid the fpsave()
call, but become conservative again.
2013-05-30 23:16:22 +02:00
cinap_lenrek 723018c1de merge 2013-05-28 23:42:59 +02:00
cinap_lenrek 8cce104fcb kernel: sysrfork abortion
when we fail to fork resources for the child due to resource
exhaustion, make the half forked child process call pexit()
to free the resources that where allocated and error out.
2013-05-28 23:41:54 +02:00
cinap_lenrek 71a3ab3f13 kernel: make imagereclaim() skip notext pages (prevent it from blowing the mount cache)
imagereclaim would happily uncache pages from the mountcache (port/cache.c)
without ever getting a Image* released from it. simple fix, just check for
p->image->notext but make sure todo it under the page lock :)
2013-05-27 03:26:53 +02:00
cinap_lenrek 44e4aad870 kernel: dont copy fpsave on fork, simplify freeing waitq in pexit(), remove unused semlock from Proc sturcure 2013-05-27 01:17:11 +02:00
cinap_lenrek 410d6bea6a devfs/devsd: fix waserror() and unused variable compiler problem
the compiler optimizes setting unused variables out, which is
problematic if they are used in waserror() handler which the
compiler isnt aware of. rearrange the code to avoid this problem.
2013-05-27 01:12:21 +02:00
cinap_lenrek c4153b7755 kernel: closechanq error
catch potential interrupt error from kproc(). this can happen when
we run out of processes, then newproc() will call rsrcwait()
which does tsleep(). if the process gets a note, this might
raise a interrupt error.
2013-05-27 01:09:34 +02:00
cinap_lenrek 24b908be8a kernel: image reclaim pauses
get a bit more verbose about process image exhaustion and make
imagreclaim() try to get at least one image on the freelist.

use rsrcwait() to notify the state, and call freebroken() in
case imagereclaim() couldnt free any images.
2013-05-27 01:04:53 +02:00
cinap_lenrek 3e567afed5 kernel: fix sysexec() error handling compiler problem, sysrendez() busyloop
the variables elem and file0 and commited are explicitely
set to avoid that they get freed in ther waserror() handlers.

but it turns out the compiler optimizes this out as he
thinks the variables arent used any further. (the compiler
is not aware of the waserror() / longjmp() semantics).

rearrange the code to account for this. instead of using
a local variable to check for point of no return (commited),
we use up->seg[SSEG] to figure it out.

for file0 and elem, we just rearrange the code. elem can be
checked in the error handler if it was already assigned to
up->text, and file0 is just free()'d after the poperror().

remove silly busy loop in sysrendez. it is not needed.
dequeueproc() will make sure that the process has come to
rest.
2013-05-27 00:59:43 +02:00
cinap_lenrek 257c7e958e keep fpregs always in sse (FXSAVE) format, adapt libmach and acid files for new format
we now always use the new FXSAVE format in FPsave structure and fpregs
file, converting back and forth in fpx87save() and fpx87restore().

document that fprestore() is a destructive operation now.

change fp register definition in libmach and adapt fpr() acid funciton.

avoid unneccesary copy of fpstate and fpsave in sysfork(). functions
including syscalls do not preserve the fp registers and copying fpstate
from the current process would mean we had to fpsave(&up->fpsave); first.
simply not doing it, new process starts in FPinit state.
2013-05-26 22:41:40 +02:00
cinap_lenrek 96511b274d kernel: fix floating point exceptions (was broken by sse kernel changes)
the fpenv() instruction stores in x87 format, using mathstate()
would interpret fpsave as FPssestate in case it was enabled!
instead, pass the status word and fppc explicitely to mathnote()
in matherror().

get rid of m->fpsavealign buffer, as we can just use FPssesave struct
which has enougth padding so rounding up base pointer will not overflow.
2013-05-25 22:44:19 +02:00
cinap_lenrek 8b40eecea8 kernel: cleanup /sys/src/9/pc/mkfile PORT= and OBJ= lists 2013-05-21 19:45:40 +02:00
cinap_lenrek 92b550d665 kernel: prevent alarm(2) from returning instantly when the tick timer wraps. (from erik quanstros alarmwrap patch) 2013-05-21 19:31:41 +02:00
cinap_lenrek f6833ce428 wifi: properly size internal wifi input processing queue
we only used wifi->iq to process management frames only, now its also used
to forward encrypted data frames, so size it accordingly.
2013-05-21 19:29:57 +02:00
cinap_lenrek 7a9ecbed6a merge 2013-05-21 18:58:13 +02:00
jpathy 5331734335 merge 2013-05-22 21:55:08 +05:30
jpathy 81b7451972 sse kernel support (sources) 2013-05-22 23:47:05 +05:30
cinap_lenrek 8a3a36fc05 kernel: make allocb() wait instead of panic() when possible
as long as our process doesnt hold any locks or ilocks, we
can try to wait for the memory to become available instead of
panicing.
2013-05-21 02:29:46 +02:00
cinap_lenrek 58201a67c1 uarti8250: print on malloc failure 2013-05-20 17:43:30 +02:00
cinap_lenrek c4f57ff492 pcuart: malloc error handling, cleanup 2013-05-20 17:32:48 +02:00
cinap_lenrek 6ac8a3ca65 devether: handle malloc error in etherprobe() 2013-05-20 01:17:38 +02:00
cinap_lenrek 926dd18a7a wifi: handle malloc errors in wifiattach() 2013-05-20 01:03:20 +02:00
cinap_lenrek 18b8ae56e8 use resrcwait() when waiting for memory to become available
use resrcwait() when waiting for memory to become available. randomize
the sleep time and properly restore old process status in case tsleep()
gets interrupted.
2013-05-20 23:55:38 +02:00
cinap_lenrek f97798e710 devsd: don't raise Enomem error if sdmalloc() fails, instead wait for the memory to become available
filesystems do not handle i/o errors well (cwfs will abandon the blocks),
and temporary exhaustion of kernel memory (because of too many i/o's in
parallel) causes read and write on the partition to fail.

i think it is better to wait for the memory to become available in
this case. the single allocation is at max SDmaxio bytes, which makes
it likely to become available. if we havnt even enought fo that, then
rebooting the machine would be the best option. (aux/reboot)
2013-05-19 20:59:55 +02:00
cinap_lenrek 3cccb8fb12 devaoe: avoid panic on malloc() error by using smalloc() instead. 2013-05-12 19:04:07 +02:00
cinap_lenrek 8020743579 ether8169: do phywakeup magic only for specific mac versions (from openbsd) 2013-05-12 18:25:24 +02:00
cinap_lenrek 29ece7fda4 ether8169: and phy wakeup and reset phy before enabling auto negotiation
this brings up the 8198B on BurnZeZ's ASRock Z68 Professional Gen3 board.
2013-05-12 02:58:02 +02:00
cinap_lenrek 25bc4e84e9 devmnt: fix mount device leak and allocation error handling in mntversion()
the fist problem is that qopen() might return nil and that kstrdup() will
sleep, so we should try to avoid holding the mntalloc lock. so we move
the kstrdup() and qopen() calls before the Mnt allocation, and properly
recover the memory if we fail later.

the second problem was that we error(Eshort) after we already created the Mnt
when returnlen < sizeof(f.version). this check has to happen *before* we
even attempt to allocate the Mnt structures. note that we only copy the
version string once everything is in the clear, so the semantics of the
user buffer not being modified in case of error is not changed.

a little cleanup in muxclose(), getting rid of mntptfree()...
2013-05-11 20:54:50 +02:00
cinap_lenrek fe073f852a sdide: add Intel SERIES 6 SATA controller pci ids 2013-05-11 18:45:46 +02:00
jpathy e3883b050e Add RDRAND Support for /dev/random 2013-05-08 23:27:58 +05:30
cinap_lenrek d3b727db18 devip: dont raise error() out of Fsprotocone()
Fsprotoclone() is not supposed to raise error, but return nil.
ipopen() seemed to assume otherwise as it setup error label
before calling Fsprotoclone(). fix ipopen(), make Fsprotoclone()
return nil instead of raising error.
2013-05-05 04:28:50 +02:00
cinap_lenrek 9500191af6 devip: handle malloc errors, fix queue leaks
Fsprotocone():

qopen() and qbypass() can fail and return nil, so make sure
the connection was not partially created by checking if read
and write queues have been setup by the protocol create hanler.
on error, free any resources of the partial connection and
error out.

netlogopen(): check malloc() error.
2013-05-05 03:56:11 +02:00
cinap_lenrek 78794f03dd devsd: initialize unit->sense[0] in sdsetsense() (from erik quanstroms 9atom) 2013-05-02 23:12:37 +02:00
cinap_lenrek d0bb0f7757 chan: fix potential path leak on clone in namec() (from erik quanstroms 9atom) 2013-05-01 21:56:02 +02:00
cinap_lenrek 91818e7081 devpipe: fix channel and queue leaks (from erik quanstroms 9atom) 2013-05-01 19:03:56 +02:00
cinap_lenrek 0124d865a6 aoe: updating aoe driver from erik quanstros 9atom
1  the config string was grabbed Aoehsz too far into the packet due to using the wrong pointer to start.
  2  never accept a response with tag Tmgmt or Tfree.
  3  defend against "malicious" responses; ones with a response Aoehdr.type != request Aoehdr.type. this previously could
 cause the initiator to crash.
  4  vendor commands were improperly filtered out.
2013-05-01 18:50:07 +02:00
cinap_lenrek d4414b3959 devloopback: fix potential channel leak on allocation error (from eriks 9atom) 2013-05-01 18:31:13 +02:00
cinap_lenrek 27f65a138a uartpci: add detection for StarTech PCI8S9503V (P588UG) (from sources) 2013-05-01 16:29:58 +02:00
cinap_lenrek b325475fc8 Fix double-free fault when isaconfig returns nothing for "etherN". (from richard millers devether-doublefree patch) 2013-04-29 18:39:44 +02:00
ppatience0 84172fc961 bootrc: fix spacing when asking for fs/auth ip 2013-04-28 18:34:47 -04:00
cinap_lenrek 05d3cc414d ether8169: fix deadlock in allocation error case for attach. (thanks erik)
typo in error case, should qunlock() instead of qlock().
2013-04-22 18:50:29 +02:00
cinap_lenrek 4fcc5efce5 mouse: fix cursor redraw to prevent screen blanking (thanks erik) 2013-04-16 18:52:49 +02:00
cinap_lenrek c31c4ca7b3 devmouse: remove unneeded reference to kerndate 2013-04-14 18:28:55 +02:00
cinap_lenrek e2baea8ddf sdiahci: add pci id for 82801eb/er and c210 2013-04-14 18:13:26 +02:00
cinap_lenrek 3045d63969 reduce software cursor flickering
the software cursor starts flickering and reacts bumby if a process
spends most of its time with drawlock acquired because the timer interrupt
thats supposed to redraw the cursor fails to acquire the lock at the time
the timer fires.

instead of trying to draw the cursor on the screen from a timer interrupt
30 times per second, devmouse now creates a process calling cursoron() and
cursoroff() when the cursor needs to be redrawn. this allows the swcursor
to schedule a redraw while holding the drawlock in swcursoravoid() and
cursoron()/cursoroff() are now able to wait for a qlock (drawlock) because
they get called from process context.

the overall responsiveness is also improved with this change as the cursor
redraw rate isnt limited to 30 times a second anymore.
2013-04-14 16:28:54 +02:00
cinap_lenrek 14650e9c25 pci: Add Intel C216 chipset PCI support (from sources) 2013-04-12 23:07:40 +02:00
cinap_lenrek 800670da4e usbehci: align page td buffer for >16K transfers, fix isohsinit()
from ehci spec:

The buffer pointer list in the qTD is long enough to support a maximum
transfer size of 20K bytes. This case occurs when all five buffer pointers
are used and the first offset is zero. A qTD handles a 16Kbyte buffer
with any starting buffer alignment.
2013-04-12 22:14:32 +02:00
cinap_lenrek e60f177ad2 etheriwl: add pci id for Centrino Wireless-N 100 (thanks fgudin9) 2013-04-10 22:13:54 +02:00
cinap_lenrek 6bef56f037 intel ethernet: default to 16 byte cache line size when not properly initialized and disable checksum offload for igbe (from sources) 2013-04-03 21:51:42 +02:00
cinap_lenrek 81b394f30a pci: add pci bridge id for Intel 6 Series/C200 (from sources) 2013-04-03 21:47:50 +02:00
ppatience0 c70c20de12 ether82563: add untested devices from OpenBSD's em(4) Intel driver. also update some names according to OpenBSD's driver (previously added device, 0x10c0, is also from OpenBSD's driver). 2013-03-30 22:50:48 -04:00
ppatience0 10987d2dc7 ether82563: add 82562V-2 did 2013-03-24 01:51:43 -04:00
cinap_lenrek b9214d6662 wifi: cleanup
cleanup wifiencrypt()/wifidecrypt() routines moving tkip
and ccmp in separate routines so we dont use less stack
space.
2013-03-24 21:59:47 +01:00
cinap_lenrek 66a3ffe248 unrolling loops in aesCCMencrypt() and aesCCMdecrypt()
do the xoring word wise for 16-byte block instead
of doing it bytewise in a loop.
2013-03-23 20:52:54 +01:00
cinap_lenrek 49a4ac0728 wpa2 support continued... 2013-03-23 04:30:20 +01:00
cinap_lenrek e7131e9313 add experimental wpa2/ccmp support 2013-03-23 04:27:49 +01:00
cinap_lenrek f37465fd7f sysexec: fix possible segment overlap with temporary stack
the kernel uses fixed area (TSTKTOP, TSTKSIZ) of the address
space to temporarily map the new stack segment for exec. for
386 and arm, this area was right below the stack segment which
has the problem that the program can map arbitrary segments
there (even readonly).

alpha and ppc dont have this problem as they map the temporary
exec stack *above* the user reachable stack segement and segattach
prevents one from mapping anything above or overlaping the stack.

lots of arch code assumes USTKTOP being the end of userspace
address space and changing this to TSTKTOP would work, but results
in lots of hard to test changes.

instead, we'r going to map the temporary stack programmatically
finding a hole in the address space where to map it. we also lift
the size limitation for arguments and allow arguments to fill
the whole new stack segement.

the TSTKTOP and TSTKSIZ are not used anymore so they where removed.

references:

http://9fans.net/archive/2013/03/203
http://9fans.net/archive/2013/03/202
http://9fans.net/archive/2013/03/197
http://9fans.net/archive/2013/03/195
http://9fans.net/archive/2013/03/181
2013-03-16 02:37:07 +01:00
cinap_lenrek f0303b65ca merge 2013-03-12 21:08:47 +01:00
cinap_lenrek da66a67a94 ether8169: add RTL8101/8102E macid 2013-03-12 21:07:40 +01:00
ftrvxmtrx f28ccb0ed9 etheriwl: 6005 - set rom calibration flags and temperature sensor offset 2013-03-12 00:14:55 +01:00
cinap_lenrek 26792d8db5 wifi: add experimental wpa / tkip encryption support 2013-03-09 17:28:41 +01:00
cinap_lenrek 5c4f2f9d35 sdiahci: only wait for drives that are in the process of becoming ready when onlining, add *noahci option 2013-02-23 14:05:51 +01:00
ppatience0 82c816d15c ether8169: add another RTL8111/8168B mac id 2013-02-22 01:14:31 -05:00
cinap_lenrek 3612d281aa sdiahci: fix mistake 2013-02-22 13:47:04 +01:00
cinap_lenrek f5ff6d6f34 sdiahci: prevent nil pointer dereference on spurious interrupt status
on some controllers, we get bogus interrupt indication
for non present drives. ack the irq but ignore.
2013-02-22 12:23:01 +01:00
cinap_lenrek 56d9f57dc8 ether8169: add RTL8111e mac id (thanks glorfdev for the patch) 2013-02-22 10:37:47 +01:00
cinap_lenrek 5bcc932168 netif: fix stat() on "stats" and "ifstats" files in network interface
the kernel would go into endless loop when stating "stats" and "ifstats"
files and the network interface having no connections, or otherwise return
wrong stat info.
2013-02-21 16:10:28 +01:00
cinap_lenrek 00ba1aac9e etheriwl: fix rominit
we used use the *last* block in otp block list instead of
the block *before* the last block resulting in wrong eeprom
data (1000er series only)
2013-02-19 07:57:30 +01:00
khm e68130f082 add wifi link 1000 pci id 2013-02-18 21:04:19 -05:00
cinap_lenrek 012273f39d etheriwl: simplify 2013-02-16 21:37:36 +01:00
cinap_lenrek c5c9233c3d etheriwl: add otp rom initialization (for 1000er series, untested) 2013-02-16 21:16:05 +01:00
cinap_lenrek f6290afb14 etheriwl: use first available antenna from eeprom txantmask instead of hardcode to antenna A 2013-02-16 04:42:42 +01:00
ftrvxmtrx a8d97f31f6 etheriwl: move runtime dc calibration block to proper place 2013-02-16 03:28:21 +01:00
ftrvxmtrx d676eaf59a etheriwl: support for Centrino Advanced-N 6205 2013-02-16 02:56:40 +01:00
cinap_lenrek 126d7e6feb etheriwl: avoid leaking blocks when controller breaks 2013-02-15 22:56:54 +01:00
cinap_lenrek 8deac637d7 merge 2013-02-15 22:21:45 +01:00
cinap_lenrek 9bcf45da9a etheriwl: fix bugs, support for Centrino Ultimate-N 6300 2013-02-15 22:20:25 +01:00
ftrvxmtrx e712752229 pci: add intel qm67 pch 2013-02-14 01:04:45 +01:00
ppatience0 6d7bb96b22 merge 2013-02-13 07:37:26 -05:00
ppatience0 0734a0b836 ether8169: support for RTL8111/8168B 2013-02-13 07:12:51 -05:00
cinap_lenrek 0243f52bae etheriwl: dont let transmit change back receiver settings when in promisc mode, cleanup 2013-02-13 08:23:54 +01:00
cinap_lenrek 78fc90ec86 etheriwl: support for WiFi Link 4965 2013-02-12 14:28:22 +01:00