Commit graph

1870 commits

Author SHA1 Message Date
cinap_lenrek 1fe3143e4c kernel: cleanup the software mouse cursor mess
The swcursor used a 32x32 image for saving/restoring
screen contents for no reason.

Add a doflush argument to swcursorhide(), so that
disabling software cursor with a double buffered
softscreen is properly hidden. The doflush parameter
should be set to 0 in all other cases as swcursordraw()
will flushes both (current and previours) locations.

Make sure swcursorinit() and swcursorhide() clear the
visibility flag, even when gscreen is nil.

Remove the cursor locking and just do everything within
the drawlock. All cursor functions such as curson(),
cursoff() and setcursor() will be called drawlock
locked. This also means &cursor can be read.

Fix devmouse cursor reads and writes. We now have the
global cursor variable that is only modified under
the drawlock. So copy under drawlock.

Move the pc software cursor implementation into vgasoft
driver, so screen.c does not need to handle it as
a special case.

Remove unused functions such as drawhasclients().
2020-04-10 17:12:51 +02:00
cinap_lenrek 7b309d2e28 pc, pc64: remove "got unassigned irq" prints
most pc's are multiprocessors these days, that use apic or
msi interrupts, then the irq does not matter anymore. and
uefi does not even assign irq to pci devices anymore. if
we have a problem enabling an interrupt, we will print.
2020-04-09 13:05:10 +02:00
cinap_lenrek 9e2344a5be pc64: remove rampage() nil check
rampage() never returns nil
2020-04-06 01:29:12 +02:00
cinap_lenrek a35cd0f861 pc: zero rampage() memory (thanks LordCreepity)
memory returned by rampage() is not zeroed, so we have to
zero it ourselfs. apparently, this bug didnt show up as we
where zeroing conventional low memory before the new memory
map code. also rampage() never returns nil.
2020-04-06 01:28:34 +02:00
cinap_lenrek f5352eb501 merge 2020-04-04 17:17:15 +02:00
cinap_lenrek 339112abc3 mtx, ppc: use proctab() to index into process table 2020-04-04 16:52:08 +02:00
cinap_lenrek 30cbaa5c48 kernel: remove scheddump() comment for delay() in */fns.h 2020-04-04 16:50:37 +02:00
cinap_lenrek 5f1b70f437 pc, pc64: new memory map code
This replaces the memory map code for both pc and pc64
kernels with a unified implementation using the new
portable memory map code.

The main motivation is to be robust against broken
e820 memory maps by the bios and delay the Conf.mem[]
allocation after archinit(), so mp and acpi tables
can be reserved and excluded from user memory.

There are a few changes:

new memreserve() function has been added for archinit()
to reserve bios and acpi tables.

upareserve() has been replaced by upaalloc(), which now
has an address argument.

umbrwmalloc() and umbmalloc() have been replaced by
umballoc().

both upaalloc() and umballoc() return physical addresses
or -1 on error. the physical address -1 is now used as
a sentinel value instead of 0 when dealing with physical
addresses.

archmp and archacpi now always use vmap() to access
the bios tables and reserve the ranges. more overflow
checks have been added.

ramscan() has been rewritten using vmap().

to handle the population of kernel memory, pc and pc64
now have pmap() and punmap() functions to do permanent
mappings.
2020-04-04 16:48:37 +02:00
cinap_lenrek 8debb0736e kernel: add portable memory map code (port/memmap.c)
This is a generic memory map for physical addresses. Entries
can be added with memmapadd() giving a range and a type.
Ranges can be allocated and freed from the map. The code
automatically resolves overlapping ranges by type priority.
2020-04-04 16:04:27 +02:00
cinap_lenrek 7451bb405d ether8390: remove unused variables 2020-04-04 15:55:48 +02:00
cinap_lenrek 6498ce3bf2 ether8003: use physical addresses for ISAConfig ether->mem
Fix the inconsistent use of ether->mem. Always use physical
addresses. Let ether8390 convert to virtual addresses using
KADDR() when we have to copy data in/out.
2020-04-04 15:47:50 +02:00
Sigrid 4756cf549a devkbd: bits bad! revert repeat/delay, better patches welcome 2020-04-01 11:31:19 +02:00
cinap_lenrek 480ce0314e audiohda: add pci vid/did for AMD Raven HD Audio Controller (T495) 2020-03-31 19:00:32 +02:00
cinap_lenrek 4dcb3ce2ab xen: fix rebootcode linkage
need to strip the a.out header, just like with the pc
kernel.
2020-03-29 22:47:42 +02:00
Sigrid f5f37ba5eb pc64: enable uartpci (thanks taw9 for testing) 2020-03-29 19:28:39 +02:00
cinap_lenrek 1b8d87555a pc, pc64: ignore the 64-bit bar flag when reserving membar
a bar with bit 3 set means the bar is the low half of
a 64-bit wide bar.
2020-03-29 00:49:07 +01:00
cinap_lenrek 3c36cadefd pc: fix mp boot regression due mistake in mkfile
the previous mkfile had a sneaky hack that would use
sed to delete the first 2 lines of hex output to strip
the 32 byte long a.out header for apbootstrap and rebootcode.

use 8l -H3 flag to strip the header from the output file.
2020-03-29 00:44:09 +01:00
Sigrid 9014360921 kbd: add "repeat" file to set typematic repeat rate/delay on PS/2 keyboards 2020-03-28 15:37:48 +01:00
cinap_lenrek 28f3a3aad8 boorc, nusbrc: fix wrong redirections after &
the rc & operator changes stdin to /dev/null, so we
have to do the <[0=1] inside the {}

this never showed up as an issue because many
fileservers just read 9p messages from standard
output.
2020-03-08 20:53:30 +01:00
cinap_lenrek f99b9cae6a devshr: unmount service on #σc/share/mount removal
when the control mountpoint side gets removed, close
mount channel immediately. this is usefull for implementing
automatic cleanup with ORCLOSE create mode.
2020-03-08 18:23:07 +01:00
cinap_lenrek a609c1a2f8 devproc: return process id when reading /proc/n/ctl file
allow reading the control file of a process and return
its pid number. if the process has exited, return an error.

this can be usefull as a way to test if a process is
still alive. and also makes it behave similar to
network protocol directories.

another side effect is that processes who erroneously
open the ctl file ORDWR would be allowed todo so as
along as they have write permission and the process is
not a kernel process.
2020-03-08 14:11:23 +01:00
cinap_lenrek a0879abae4 devproc: don't allow /proc/$pid/ctl to be opens for reading 2020-03-07 23:58:47 +01:00
cinap_lenrek a87c9cfc6c devproc: fix syscalltrace read for ratrace 2020-03-05 20:46:01 +01:00
cinap_lenrek 69e28c6513 kernel: simplify exec()
progarg[0] can be assigned to elem directly as it is a
copy in kernel memory, so the char proelem[64] buffer
is not neccesary.

do the close-on-exit outside of the segment lock. there
is no reason to keep the segment table locked.
2020-02-29 21:06:45 +01:00
cinap_lenrek 17a92f3995 devproc: make sure writewatchpt() doesnt overflow the watchpoint array
the user buffer could be changed while we parse it resulting
in a different number of watchpoints than initially calculated.
so add a check to the parse loop so we wont overflow the
watchpoint array.
2020-02-28 16:48:42 +01:00
cinap_lenrek adb36de077 kernel: make sure we wont run into the tos when copying exec() arguments
in case the calling process changes its arguments under us, it could
happen that the final argument string lengths become bigger than
initially calculated. this is fine as we still make sure we wont
overflow the stack segment, but we could overrun into the tos
structure at the end of the stack. so change the limit to the
base of the tos, not the end of the stack segment.
2020-02-28 16:45:20 +01:00
cinap_lenrek ff3e0eeb22 devproc: cleanup procwrite size checks
writes to /proc/n/notepg and /proc/n/note should be able to write
at ERRMAX-1 bytes, not ERRMAX-2.

simplify write to /proc/n/args by just copying to local buf first
and then doing a kstrdup(). the value of Proc.nargs does not matter
when Proc.setargs is 1.
2020-02-28 16:41:09 +01:00
cinap_lenrek ab5c4799d9 devcons: fix permissions for reboot and sysstat
#c/reboot is a write only file
#c/sysstat should not be writable by everyone (write resets counters)
2020-02-23 20:42:00 +01:00
cinap_lenrek 9fcce48b38 kernel: avoid selecting the boot process in killbig() 2020-02-23 18:58:06 +01:00
cinap_lenrek 4a80d9d029 kernel: fix multiple devproc bugs and pid reuse issues
devproc assumes that when we hold the Proc.debug qlock,
the process will be prevented from exiting. but there is
another race where the process has already exited and
the Proc* slot gets reused. to solve this, on process
creation we also have to acquire the debug qlock while
initializing the fields of the process. this also means
newproc() should only initialize fields *not* protected
by the debug qlock.

always acquire the Proc.debug qlock when changing strings
in the proc structure to avoid doublefree on concurrent
update. for changing the user string, we add a procsetuser()
function that does this for auth.c and devcap.

remove pgrpnote() from pgrp.c and replace by static
postnotepg() in devproc.

avoid the assumption that the Proc* entries returned by
proctab() are continuous.

fixed devproc permission issues:
	- make sure only eve can access /proc/trace
	- none should only be allowed to read its own /proc/n/text
	- move Proc.kp checks into procopen()

pid reuse was not handled correctly, as we where only
checking if a pid had a living process, but there still
could be processes expecting a particular parentpid or
noteid.

this is now addressed with reference counted Pid
structures which are organized in a hash table.
read access to the hash table does not require locks
which will be usefull for dtracy later.
2020-02-23 18:00:21 +01:00
cinap_lenrek f7c6023066 devswap: dont assume Proc* structures returned from proctab() are continuous 2020-02-23 14:08:33 +01:00
cinap_lenrek b7089d66ad sdiahci, sdodin: avoid calling kproc() while holding ilock() 2020-02-23 14:05:01 +01:00
Roberto E. Vargas Caballero 5f7a6b7ea3 bcm: change ARGB32 to XRGB32 for framebuffer to avoid slow drawing 2020-02-09 21:39:17 +01:00
cinap_lenrek 77a7e3f8fc kernel: cleanup makefile for $CONF.$O target 2020-02-02 20:46:58 +01:00
cinap_lenrek 023d957e6b kernel: restore old behaviour that kprocs have ther noteid == pid 2020-01-27 02:17:14 +01:00
cinap_lenrek 46a733c328 kernel: fix mistake from previous commit (noteid not being inherited by default) 2020-01-27 01:51:35 +01:00
cinap_lenrek 8d51e7fa1a kernel: implement portable userinit() and simplify process creation
replace machine specific userinit() by a portable
implemntation that uses kproc() to create the first
process. the initcode text is mapped using kmap(),
so there is no need for machine specific tmpmap()
functions.

initcode stack preparation should be done in init0()
where the stack is mapped and can be accessed directly.

replacing the machine specific userinit() allows some
big simplifications as sysrfork() and kproc() are now
the only callers of newproc() and we can avoid initializing
fields that we know are being initialized by these
callers.

rename autogenerated init.h and reboot.h headers.
the initcode[] and rebootcode[] blobs are now in *.i
files and hex generation was moved to portmkfile. the
machine specific mkfile only needs to specify how to
build rebootcode.out and initcode.out.
2020-01-26 19:01:36 +01:00
cinap_lenrek 60bb408acc ppc: remove old duplicate of devtls.c 2020-01-25 18:37:28 +01:00
aiju 639500b748 cycv: support for registers 2020-01-13 23:22:35 +00:00
aiju 561346d07f cyclone v kernel: fpga support, fix CONFADDR 2020-01-12 03:40:42 +00:00
cinap_lenrek 16784a2e45 devdraw: fix topnwindows() panic when images are not windows (thanks aiju)
Crashes drawterm and native:

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

void
main(int argc, char **argv)
{
 	initdraw(nil, nil, nil);

 	Image *a[] = {screen, display->black};

 	topnwindows(a, nelem(a));
 	flushimage(display, 1);
}
2020-01-12 00:07:27 +01:00
cinap_lenrek 5254e41f6b pc64: adapt vgaradeon driver to 64-bit (thanks Robert Ransom)
Not yet tested.
2020-01-11 23:31:54 +01:00
cinap_lenrek 361b65e4df kernel: remove relics of CPU 'load balancing' policy in scheduler (thanks Robert Ransom)
This code was deleted from Plan 9 before the 9front repo began.
Proc.movetime was used by it, but has never been referenced in 9front.
2020-01-11 21:26:42 +01:00
cinap_lenrek dfda1cc878 bootrc: fix comment typo (thanks Robert Ransom) 2020-01-11 21:25:05 +01:00
aiju ffd9c39d1c dont spin on MDIO 2020-01-10 20:43:24 +00:00
aiju d64f76c96c add cycv ethernet driver 2020-01-10 18:49:33 +00:00
aiju 17ebe55031 add cycv kernel 2020-01-08 02:35:01 +00:00
cinap_lenrek f12744b5db devip: fix packet loss when interface is wlocked
to prevent deadlock on media unbind (which is called with
the interface wlock()'ed), the medias reader processes
that unbind was waiting for used to discard packets when
the interface could not be rlocked.

this has the unfortunate side effect that when we change
addresses on a interface that packets are getting lost.
this is problematic for the processing of ipv6 router
advertisements when multiple RA's are getting received
in quick succession.

this change removes that packet dropping behaviour and
instead changes the unbind process to avoid the deadlock
by wunlock()ing the interface temporarily while waiting
for the reader processes to finish. the interface media
is also changed to the mullmedium before unlocking (see
the comment).
2020-01-05 18:20:47 +01:00
Alex Musolino 8fa9b7d6ff pc, pc64: fix cputemp decimal handling in amd10temprd (thanks Robert Ransom) 2019-12-19 15:19:02 +10:30
cinap_lenrek 52e4e51b50 devcons: fix write length of writebintime() (thanks BurnZeZ) 2019-12-11 23:52:05 +01:00