Commit graph

161 commits

Author SHA1 Message Date
aiju 6f30420136 add dtracy support to mkdevc and enable dtracy with plan9.ini 2018-12-11 07:44:34 +00:00
cinap_lenrek 4dee686ca5 pc, pc64: park application processors in rebootcode with mmu off
instead of having application processors spin in mpshutdown()
with mmu on, and be subject to reboot() overriding kernel text
and modifying page tables, park the application processors in
rebootcode idle loop with the mmu off.
2018-11-19 18:42:01 +01:00
cinap_lenrek 4d7c195804 pc, pc64: add pcienable() and pcidisable() functions
pcienable() puts a device in fully powered on state
and does some missing initialization that UEFI might
have skipped such as I/O and Memory requests being
disabled.

pcidisable() is ment to shutdown the device, but
currently just disables dma to prevent accidents.
2018-10-07 21:52:53 +02:00
cinap_lenrek 83876083c9 pc, pc64: increase CONFADDR buffer from 4K to 24K
move APBOOTSTRAP and TMPADDR to make space available for
boot parameters. which can become quite long such as *e820.
2018-10-06 00:26:07 +02:00
cinap_lenrek 0431ea242d pc, pc64: look for "RSD PTR " in ACPI reserved memory region from e820 map
nobody passes us the "RSD PTR " address when doing multiboot/kexec
on UEFI systems. so we search for it manually in the ACPI reserved
area as indicated in the e820 memory map.
2018-07-22 21:00:20 +02:00
aiju d16a96daca pc64: update headers to match pc 2018-07-11 16:05:03 +01:00
cinap_lenrek 39fb26df70 9pc, 9pc64: make mapalloc() and mapfree() static in memory.c 2018-06-14 20:22:34 +02:00
cinap_lenrek 5da4f0fc0f sdram: experimental ramdisk driver
this driver makes regions of physical memory accessible as a disk.

to use it, ramdiskinit() has to be called before confinit(), so
that conf.mem[] banks can be reserved. currently, only pc and pc64
kernel use it, but otherwise the implementation is portable.

ramdisks are not zeroed when allocated, so that the contents are
preserved across warm reboots.

to not waste memory, physical segments do not allocate Page structures
or populate the segment pte's anymore. theres also a new SG_CHACHED
attribute.
2018-05-27 22:59:19 +02:00
cinap_lenrek 66eac7d687 pc64: fix fpu bug
fpurestore() unconditionally changed fpstate to FPinactive when
the kernel used the FPU. but in the FPinit case, the registers are
not saved by mathemu(), resulting in all zero initialized registers
being loaded once userspace uses the FPU so the process would have
wrong MXCR value.

the index overflow check was wrong with using shifted value.
2018-05-21 19:23:54 +02:00
kremlin 8666ec6b55 add missing ethermii.h dependencies. patch from cinap_lenrek 2018-04-12 17:50:10 -04:00
cinap_lenrek 2c1415277f pc64: fix _intrr(), avoid the linker moving _intrr() arround 2018-03-17 18:25:12 +01:00
cinap_lenrek 108063bc3a pc64: add magic _intrr() symbol for ktrace (thanks mischief) 2018-03-17 17:19:42 +01:00
cinap_lenrek 729c9c39d9 devether: mux bridges, portable netconsole 2018-02-18 19:56:01 +01:00
cinap_lenrek 3d0f4da104 ethersink: provide promisc and multicast functions for v6, set out queue limit to 0 on attach, add to pc64 config 2018-02-11 19:51:23 +01:00
cinap_lenrek d6e0e9c402 kernel: move devether and wifi to port/
the only architecture dependence of devether was enabling interrupts,
which is now done at the end of the driver's reset() function now.

the wifi stack and dummy ethersink also go to port/.

do the IRQ2->IRQ9 hack for pc kernels in intrenabale(), so not
every caller of intrenable() has to be aware of it.
2018-02-11 18:08:03 +01:00
cinap_lenrek 83d8a24215 pc64: fix kmap() and invlpg()
flushing tlb once the index wraps arround is not enougth
as in use pte's can be speculatively loaded. so instead
use invlpg() and explicitely invalidate the tlb of the
page mapped.

this fixes wired mount cache corruption for reads approaching
2MB which is the size of the KMAP window.

invlpg() was broken, using wrong operand type.
2018-01-29 08:26:42 +01:00
cinap_lenrek 3e48a66665 pc, pc64: add devbridge to kernel configuration 2017-12-17 20:33:39 +01:00
cinap_lenrek 15ff38e818 wifi: use protocol constants from ip/ip.h and ip/ipv6.h for dmatproxy() 2017-12-17 17:17:26 +01:00
cinap_lenrek 070a9ef753 wifi: matt damon wifi bridging support 2017-12-16 21:43:47 +01:00
cinap_lenrek 435a9a150e 9pc64: handle special case in fpurestore() for procexec()/procsetup()
when a process does an exec, it calls procsetup() which
unconditionally sets the sets the TS flag and fpstate=FPinit
and fpurestore() should not revert the fpstate.
2017-11-16 23:15:08 +01:00
cinap_lenrek 753f64a877 pc64: fix mistake fpurestore() mistake
cannot just reenable the fpu in FPactive case as we might have
been procsaved() an rescheduled on another cpu. what was i thinking...
thanks qu7uux for reproducing the problem.
2017-11-14 00:16:21 +01:00
cinap_lenrek 4f27f6a04f pc64: allow using the FPU in syscall and pagefault handlers
The aim is to take advantage of SSE instructions such as AES-NI
in the kernel by lazily saving and restoring FPU state across
system calls and pagefaults. (everything can can do I/O)

This is accomplished by the functions fpusave() and fpurestore().

fpusave() remembers the current state and disables the FPU if it
was active by setting the TS flag. In case the FPU gets used,
the current state gets saved and a new PFPU.fpslot is allocated
by mathemu().

fpurestore() restores the previous FPU state, reenabling the FPU
if fpusave() disabled it.

In the most common case, when userspace is not using the FPU,
then fpusave()/fpurestore() just toggle the FPpush bit in
up->fpstate.

When the FPU was active, but we do not use the FPU, then nothing
needs to be saved or restored. We just switched the TS flag on
and off agaian.

Note, this is done for the amd64 kernel only.
2017-11-12 22:55:54 +01:00
cinap_lenrek 3ccd53549f pc64: set ts flag before schedinit() 2017-11-08 00:34:08 +01:00
cinap_lenrek 24057fd4f4 kernel: introduce per process FPU struct (PFPU) for more flexible machine specific fpu handling
introducing the PFPU structue which allows the machine specific
code some flexibility on how to handle the FPU process state.

for example, in the pc and pc64 kernel, the FPsave structure is
arround 512 bytes. with avx512, it could grow up to 2K. instead
of embedding that into the Proc strucutre, it is more effective
to allocate it on first use of the fpu, as most processes do not
use simd or floating point in the first place. also, the FPsave
structure has special 16 byte alignment constraint, which further
favours dynamic allocation.

this gets rid of the memmoves in pc/pc64 kernels for the aligment.

there is also devproc, which is now checking if the fpsave area
is actually valid before reading it, avoiding debuggers to see
garbage data.

the Notsave structure is gone now, as it was not used on any
machine.
2017-11-04 20:08:22 +01:00
cinap_lenrek f3f9392517 kernel: introduce devswap #¶ to serve /dev/swap and handle swapfile encryption 2017-10-29 23:09:54 +01:00
cinap_lenrek 87274893d8 pc64: add ether82598 driver to configuration 2017-09-27 14:13:58 +02:00
cinap_lenrek be7f3fb5e4 rename pcf kernel to pc, remove pcf, pccpuf, pccpu64 kernels, update documentation
there isnt much of a point in keep maintaining separate
kernel configurations for terminal and cpu kernels as
the role can be switched with service=cpu boot parameter.

to make stuff cosistent, we will just have one "pc" kernel
and one "pc64" kernel configuration now.
2017-09-10 22:35:23 +02:00
aiju bd4513fe87 devvmx: call vmxshutdown from reboot() function manually 2017-09-02 10:43:37 +00:00
aiju e5d3aaf1aa devvmx, vmx: lilu dallas multivm 2017-08-28 17:27:41 +00:00
cinap_lenrek adfb0e9371 pc, pc64: enable usbxhci in the configuration 2017-07-29 01:15:05 +02:00
cinap_lenrek e7e18aac7f pc kernel: mkfile target usbehcipc.$O needs ../port/usb.h, add usbxhci.$O 2017-07-16 22:33:24 +02:00
cinap_lenrek befdd7d755 kernel: pass bootargs also in multiboot command line, retire the bootline mechanism to pass arguments to /boot/boot 2017-06-28 18:56:16 +02:00
cinap_lenrek aab4e32ce0 pc, pc64: support for multiboot framebuffer, common bootargs and multiboot code 2017-06-25 22:22:58 +02:00
aiju becb89bae5 pc, pc64: adapt devvmx to work on pc64 2017-06-20 15:10:08 +00:00
aiju 13869bab11 pc/pc64: keep shadow copy of DR7 in Mach and use that to check whether we need to reset DR7 in procsave(); remove superfluous reset of DR7 in mmurelease() 2017-06-13 00:10:36 +00:00
aiju dea6bc51bc pc/pc64: debugexc: ignore exception if in kernel mode and can't get hold of up->debug 2017-06-12 22:58:25 +00:00
aiju 3844090f39 pc/pc64: reset DR7 in mmurelease 2017-06-12 19:46:25 +00:00
aiju 773be02aa1 kernel: add support for hardware watchpoints 2017-06-12 19:03:07 +00:00
aiju 1cfa405d0a pc64: set error code and trap fields in Ureg* on syscalls 2017-06-12 17:09:11 +00:00
cinap_lenrek 34f5a83330 pc64: state mp.h dependency for archacpi.$O 2017-04-11 02:26:39 +02:00
cinap_lenrek 557cbe10ad sdnvme: enable in pcf, pccpuf, pc64 kernel configuration 2017-03-30 23:37:28 +02:00
cinap_lenrek 4e8494aad7 pc kernel: handle PCMP and RSD being in low (kaddr) or reserved (vmap) memory
on thinkpad x1v4, the PCMP structure resides in upper reserved memory
pa=0xd7f49000 - while system memory ends at 0x0ffff000; so we have to
vmap() it instead of KADDR().

the RSD structure for ACPI might reside in low memory, so we sould
KADDR() in that case.
2017-03-25 04:08:14 +01:00
cinap_lenrek 8177d20fb2 kernel: get rid of active.Lock and active.thunderbirdsargo 2017-03-11 16:30:51 +01:00
cinap_lenrek a7f8ebca2f pc kernel: give cpu servers as many image cache strctures as processes 2017-03-11 16:28:11 +01:00
cinap_lenrek 5104934135 pc kernel: avoid AP's spinning in syncclock(), don't wait for thunderbirdsargo 2017-03-11 16:24:56 +01:00
mischief a4895f5e44 pc64: enable cputemp driver
works on on x301 and t420.
2017-03-01 02:43:51 -08:00
cinap_lenrek ea30cf94a5 pat write combinding support for 386 kernel, honor cpuid bits 2016-12-17 16:35:26 +01:00
cinap_lenrek d48a089486 pc64: implement simple write combining for framebuffers with the PAT
on some modern machines like the x250, the bios arranges the mtrr's
and the framebuffer membar in a way that doesnt allow us to mark
the framebuffer pages as write combining, leading to slow graphics.

since the pentium III, the processor interprets the page table bit
combinations of the WT, CD and bit7 bits as an index into the
page attribute table (PAT).

to not change the semantics of the WT and CD bits, we preserve
the bit patterns 0-3 and use the last entry 7 for write combining.
(done in mmuinit() for each core).

the new patwc() function takes virtual address range and changes
the page table marking the range as write combining. no attempt
is made on invalidating tlb's. doesnt matter in our case as the
following mtrr() call in screen.c does it for us.
2016-12-15 23:27:01 +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 0a5f81a442 kernel: switch to fast portable chacha based seed-once random number generator 2016-08-27 20:42:31 +02:00