Home | History | Annotate | only in /src/sys/arch/usermode/dev
History log of /src/sys/arch/usermode/dev
RevisionDateAuthorComments
 1.27 29-May-2020  rin For struct timecounter, use C99 initializers.
Compile tested. No functional changes intended.
 1.26 21-Jan-2012  reinoud Complete rewrite of the signal and spl framework for NetBSD/usermode

Signals are now moved from the sigaltstack ASAP and stacked on a replacement
stack for each processes.

Preemption now works though could be enhanced a bit more
 1.25 14-Jan-2012  reinoud Revert back to IPL_SOFTCLOCK so its lower than IPL_SHED
 1.24 14-Jan-2012  reinoud Cleanup clock.c removing unneeded function
 1.23 15-Dec-2011  jmcneill Improve usermode timecounter. It's unreasonable to assume that we'll get
100 "SIGALRM" per second with an ITIMER_REAL at 100Hz on a HZ=100 host as
the timer may expire before a pending signal has been delivered.

Instead of setitimer, use timer_create + timer_settime and from our
intr handler use timer_getoverrun to determine how many ticks we have
missed.
 1.22 13-Dec-2011  jmcneill fix timecounter
 1.21 09-Dec-2011  reinoud Restructure dev/clock to run from the signal stack since its safe to do now.
 1.20 17-Sep-2011  reinoud branches: 1.20.2; 1.20.6;
Transform the clock signal to a sigaction so we have the info i.e. the
context! and thus a good definition for a clockframe!
 1.19 16-Sep-2011  reinoud Like the others, let the clock signal restart calls
 1.18 13-Sep-2011  reinoud Forgot the clock
 1.17 12-Sep-2011  reinoud Move the clock device and the ld device to the new spl interrupt PIC
 1.16 08-Sep-2011  jmcneill get rid of clock softintr and move setitimer call to cpu_initclocks
 1.15 08-Sep-2011  jmcneill use HZ to calculate interval for setitimer
 1.14 05-Sep-2011  reinoud Check SIGALRM handler setup success or failure
 1.13 05-Sep-2011  jmcneill use sigaltstack
 1.12 23-Aug-2011  jmcneill call hardclock from a softint instead of signal handler
 1.11 23-Aug-2011  jmcneill more time_t fixes
 1.10 23-Aug-2011  jmcneill more host vs. userkernel time_t fixes
 1.9 23-Aug-2011  jmcneill host and userkernel timespec might differ in size (because of time_t) so
instead of thunk_clock_getres() filling in a timespec, use instead
thunk_clock_getres_monotonic() that returns the resolution as a long
 1.8 13-Aug-2011  jmcneill - replace the gettimeofday timecounter with one based on CLOCK_MONOTONIC
- use gettimeofday for TODR clock
 1.7 13-Aug-2011  jmcneill - initialize cpu_info_primary early, before cpu0 attaches
- track idepth in cpu_info struct and use it in cpu_intr_p
- for debug and diagnostic kernels, abort when rebooting
- fill in __cpu_simple_lock_* stubs
- splraise(IPL_HIGH) before calling kernmain
- pmap_extract: only return phys addr if pap is not NULL
 1.6 12-Aug-2011  jmcneill Clean up extern mess by adding an API for kernel components to call libc
functions. thunk.c is built with special cflags that makes it compile
against standard system headers instead of kernel ones.
 1.5 10-Aug-2011  jmcneill fix build
 1.4 27-Nov-2009  rmind - Use uvm_lwp_setuarea() instead of directly setting address to lwp_t::l_addr.
- Replace most remaining uses of l_addr with uvm_lwp_getuarea() or lwp_getpcb().
- Amend assembly in ports where it accesses PCB via struct user.
- Rename L_ADDR to L_PCB in few places. Reduce sys/user.h inclusions.
 1.3 21-Oct-2009  snj Drop 3rd and 4th clauses. OK jmcneill (copyright holder).
 1.2 07-Jan-2008  joerg branches: 1.2.2; 1.2.4; 1.2.6; 1.2.16;
Use gettimeofday as timecounter.
 1.1 29-Dec-2007  jmcneill branches: 1.1.2;
Import work-in-progress NetBSD/usermode port.
 1.1.2.3 08-Jan-2008  bouyer Sync with HEAD
 1.1.2.2 02-Jan-2008  bouyer Sync with HEAD
 1.1.2.1 29-Dec-2007  bouyer file clock.c was added on branch bouyer-xeni386 on 2008-01-02 21:50:42 +0000
 1.2.16.1 11-Mar-2010  yamt sync with head
 1.2.6.2 18-Feb-2008  mjf Sync with HEAD.
 1.2.6.1 07-Jan-2008  mjf file clock.c was added on branch mjf-devfs on 2008-02-18 21:05:12 +0000
 1.2.4.2 21-Jan-2008  yamt sync with head
 1.2.4.1 07-Jan-2008  yamt file clock.c was added on branch yamt-lazymbuf on 2008-01-21 09:39:44 +0000
 1.2.2.2 09-Jan-2008  matt sync with HEAD
 1.2.2.1 07-Jan-2008  matt file clock.c was added on branch matt-armv6 on 2008-01-09 01:49:19 +0000
 1.20.6.1 18-Feb-2012  mrg merge to -current.
 1.20.2.1 17-Apr-2012  yamt sync with head
 1.84 04-Oct-2023  ad Eliminate l->l_ncsw and l->l_nivcsw. From memory think they were added
before we had per-LWP struct rusage; the same is now tracked there.
 1.83 03-Dec-2019  riastradh Use __insn_barrier to enforce ordering in l_ncsw loops.

(Only need ordering observable by interruption, not by other CPUs.)
 1.82 01-Dec-2019  ad Make cpu_intr_p() safe to use anywhere, i.e. outside assertions:

Don't call kpreempt_disable() / kpreempt_enable() to make sure we're not
preempted while using the value of curcpu(). Instead, observe the value of
l_ncsw before and after the check to see if we have been preempted. If
we have been preempted, then we need to retry the read.
 1.81 23-Nov-2019  ad cpu_need_resched():

- Remove all code that should be MI, leaving the bare minimum under arch/.
- Make the required actions very explicit.
- Pass in LWP pointer for convenience.
- When a trap is required on another CPU, have the IPI set it locally.
- Expunge cpu_did_resched().
 1.80 01-Jun-2018  reinoud branches: 1.80.2;
Pass the address of the array, this fixes issues with i386 compilation
 1.79 29-May-2018  reinoud Only report the things we've passed in the mcontext and leave out flags that
are not reported in the mcontext anyway!
 1.78 29-May-2018  reinoud Implement cpu_lwp_setprivate(). This removes the need for the cpu_switch()
hack.

Programs with TLS work fine now, including gdb!
 1.77 29-May-2018  reinoud Only set requested parts of the mcontext in cpu_setmcontext()
Make the atomic switcher `atomic' by using splhigh()
 1.76 24-May-2018  reinoud First try at TLS support and getcontext/setcontext/swapcontext support.
 1.75 17-May-2018  reinoud Refactor for easier debugging and while here add some more signals
 1.74 01-Jun-2017  chs branches: 1.74.8;
remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.
 1.73 24-Mar-2014  christos branches: 1.73.6;
use cpu_{g,s}etmodel
 1.72 29-Jul-2012  mlelstv branches: 1.72.2; 1.72.4;
Do not call setroot() from MD code and from MI code, which has
unwanted sideeffects in the RB_ASKNAME case. This fixes PR/46732.

No longer wrap MD cpu_rootconf(), as hp300 port stores reboot information
as a side effect. Instead call MI rootconf() from MD code which makes
rootconf() now a wrapper to setroot().

Adjust several MD routines to set the global booted_device,booted_partition
variables instead of passing partial information to setroot().

Make cpu_rootconf(9) describe the calling order.
 1.71 25-Jun-2012  reinoud Implement dummy `cpu_mcontext_validate' to make it compile again. This
function needs to be implemented in the target secton one day for extra
security.
 1.70 03-Mar-2012  reinoud Implement signal forwarding to userland for usermode kernels. Especially
SIGFPE is important since the urkel shouldn't stop when a userland program
devides by zero!
 1.69 21-Jan-2012  reinoud branches: 1.69.2;
Complete rewrite of the signal and spl framework for NetBSD/usermode

Signals are now moved from the sigaltstack ASAP and stacked on a replacement
stack for each processes.

Preemption now works though could be enhanced a bit more
 1.68 18-Jan-2012  reinoud Create an atomic switchto() that has SIGALRM and SIGIO signals blocked that
might otherwise disrupt the setting of curlwp to match the lwp context.
 1.67 15-Jan-2012  jmcneill sync disks and unmount at shutdown, and run shutdownhooks + pmf shutdown
handlers
 1.66 15-Jan-2012  jmcneill allow specifing the root device with 'root=ldN' parameter
 1.65 14-Jan-2012  reinoud Reimplement userret() to also include AST for preemption.

Note it would be nice if we could do the check "are we going to userland?" in
a less intrusive way.
 1.64 14-Jan-2012  reinoud Revamp the NetBSD/usermode pagefault and illegal instruction handing. It now
can handle recursive entry and is a lot more memory tight compared to the old
implementation. Performance wise:

* slightly less number of syscalls/sec possible though could be optimized
* a lot faster context creation / destruction making overall operation faster.
 1.63 12-Jan-2012  reinoud Remove old comment about space not being freed; it is now done correctly so
remove it to avoid confusion later.
 1.62 06-Jan-2012  reinoud Cleanup stack allocation and freeing. This means the memory leak on lwp
destruction ought to be solved.
 1.61 04-Jan-2012  reinoud No reason why to have a larger pagefault stackframe for lwp0
 1.60 04-Jan-2012  reinoud Zero the memory we claim for the stacks
 1.59 03-Jan-2012  reinoud Use M_WAITOK instead of M_NOWAIT for the stack allocations
 1.58 03-Jan-2012  reinoud Rename the debug printf's to use a thunk_ prefix to avoid confusion.
 1.57 27-Dec-2011  reinoud Implement physio() for NetBSD/usermode the right way!
 1.56 24-Dec-2011  reinoud Implement cpu_getmcontext() and cpu_setmcontext()
 1.55 15-Dec-2011  jmcneill Improve usermode timecounter. It's unreasonable to assume that we'll get
100 "SIGALRM" per second with an ITIMER_REAL at 100Hz on a HZ=100 host as
the timer may expire before a pending signal has been delivered.

Instead of setitimer, use timer_create + timer_settime and from our
intr handler use timer_getoverrun to determine how many ticks we have
missed.
 1.54 15-Dec-2011  jmcneill allocate msgbuf with kmem_zalloc instead of thunk_malloc, now dmesg works
 1.53 15-Dec-2011  jmcneill implement cpu idle via sigsuspend
 1.52 14-Dec-2011  jmcneill only need to setup altstack after fork, not in lwp tramp
 1.51 14-Dec-2011  jmcneill need to sigaltstack for each lwp
 1.50 13-Dec-2011  reinoud Just in case ease up the stack space a bit more
 1.49 12-Dec-2011  reinoud No need for such big stack spaces on lwp_fork() with the new setup.
 1.48 11-Dec-2011  reinoud Free the systemcall and pagefault stacks on lwp destroy.

XXX what about the main ucps stackspace that is used for the trampoline?
 1.47 27-Nov-2011  reinoud branches: 1.47.2;
Big patch that changes the signal stack usage of urkel significantly.

Formerly, all signals came on the signal stack and the two important ones were
then forwared to either the system call or the pagefault handler. This worked
fine but the signal stack remains that, a stack. When we go multi-process this
stack gets corrupted and out-of-order with all kind of nastyness since a
userland process switch can occure when a system call is called or when a
process gets a page fault.

The new scheme only uses the signal stack as a jumpboard. It swaps states and
then returns from the signal, clearing the stack but instead of returning to
the code it now jumpt to the handler and that handler then returns to the code
when its finished.
 1.46 14-Sep-2011  reinoud branches: 1.46.2;
Make stacksize of newly spawn lwp's bigger than one page. Actually use the
variable stack_size now
 1.45 10-Sep-2011  reinoud Make cpu_lwp_trampo only jump once and make successive jumps go to the func
only
 1.44 09-Sep-2011  reinoud Make the trampoline only jump once!
All next calls are directed directly to the func specified.
 1.43 09-Sep-2011  reinoud Use the new thunk_makecontext() scheme with function and upto 3 aguments
 1.42 09-Sep-2011  reinoud Streamline makecontext() calls to really only specify the number of arguments
to prevent side-effects
 1.41 09-Sep-2011  reinoud Clean up cpu_trampoline and link the context so we dont have to manually do
that.
 1.40 08-Sep-2011  reinoud Use the machdep.h and now use the md_check_syscall_opcode()
 1.39 08-Sep-2011  reinoud Link syscall to userland so on exit is automatically goes to userland.
 1.38 08-Sep-2011  reinoud Cleanup syscall context creation
 1.37 08-Sep-2011  jmcneill get rid of clock softintr and move setitimer call to cpu_initclocks
 1.36 08-Sep-2011  reinoud White space
 1.35 08-Sep-2011  reinoud Create a ucontext for the system call to work in; its cloned from the new
pcb's call `userland' ucontext.
 1.34 06-Sep-2011  jmcneill cpu_lwp_inkernel approach won't work, back to the drawing board
 1.33 05-Sep-2011  jmcneill Have the urkel maintain a 'cpu_lwp_inkernel' variable and read it from the
urkelvisor to determine the origin of a syscall.
 1.32 05-Sep-2011  reinoud Restore errno just before switching to the new context and NOT after it got
back again
 1.31 05-Sep-2011  reinoud Move kpreempt_enable/disable to splsched()
 1.30 05-Sep-2011  reinoud Disable kernel preemption in the critical section of cpu_switchto()
 1.29 04-Sep-2011  reinoud pcb->errno to pcb->pcb_errno
 1.28 04-Sep-2011  reinoud Try to preserve errno over traps and on context switches
 1.27 03-Sep-2011  jmcneill unbreak build on netbsd
 1.26 03-Sep-2011  jmcneill Get this compiling (but not quite linking yet) on Linux
 1.25 03-Sep-2011  reinoud Oops forgot to commit this one
 1.24 02-Sep-2011  reinoud Update trapframe and add system call switchframe
 1.23 29-Aug-2011  reinoud Dirty commit of machdep.c and cpu.c
 1.22 28-Aug-2011  jmcneill cpu_reboot: only call thunk_abort if RB_DUMP is set
 1.21 28-Aug-2011  reinoud Jump to `userland' or the other function specified in the pcb's ucontext
 1.20 28-Aug-2011  jmcneill cpu_lwp_trampoline isn't supposed to return, so drop the atexit handler
and drop a panic() at the end of the function
 1.19 27-Aug-2011  jmcneill defflag CPU_DEBUG
 1.18 27-Aug-2011  reinoud Print when the cpu_trampoline is called()
 1.17 27-Aug-2011  jmcneill CPU_DEBUG: remove printf in cpu_signotify, and print pid/lid in cpu_switchto
 1.16 24-Aug-2011  jmcneill make room for a small msgbuf
 1.15 13-Aug-2011  jmcneill lwp0pcb should be struct pcb not ucontext_t, and initialize it in cpu_startup
instead of cpu_attach
 1.14 13-Aug-2011  jmcneill no need to print copyright/version/memory info, just call banner()
 1.13 13-Aug-2011  jmcneill - initialize cpu_info_primary early, before cpu0 attaches
- track idepth in cpu_info struct and use it in cpu_intr_p
- for debug and diagnostic kernels, abort when rebooting
- fill in __cpu_simple_lock_* stubs
- splraise(IPL_HIGH) before calling kernmain
- pmap_extract: only return phys addr if pap is not NULL
 1.12 12-Aug-2011  jmcneill add a simple disk driver, pass the path to the disk image on the kernel command line:

soundwave$ ./netbsd /tmp/test.fs
NetBSD/usermode startup
[...]
ld0 at mainbus0: /tmp/test.fs (33554432)
ld0: 32768 KB, 8322 cyl, 64 head, 63 sec, 1 bytes/sect x 33554432 sectors
boot device: ld0
root on ld0a dumps on ld0b
 1.11 12-Aug-2011  jmcneill implement reboot using execv
 1.10 12-Aug-2011  jmcneill Clean up extern mess by adding an API for kernel components to call libc
functions. thunk.c is built with special cflags that makes it compile
against standard system headers instead of kernel ones.
 1.9 11-Aug-2011  jmcneill initialize lwp0 l_addr so we can switch back to it
 1.8 10-Aug-2011  jmcneill fix build
 1.7 08-Feb-2010  joerg Remove separate mb_map. The nmbclusters is computed at boot time based
on the amount of physical memory and limited by NMBCLUSTERS if present.
Architectures without direct mapping also limit it based on the kmem_map
size, which is used as backing store. On i386 and ARM, the maximum KVA
used for mbuf clusters is limited to 64MB by default.

The old default limits and limits based on GATEWAY have been removed.
key_registered_sb_max is hard-wired to a value derived from 2048
clusters.
 1.6 27-Nov-2009  rmind branches: 1.6.2;
- Use uvm_lwp_setuarea() instead of directly setting address to lwp_t::l_addr.
- Replace most remaining uses of l_addr with uvm_lwp_getuarea() or lwp_getpcb().
- Amend assembly in ports where it accesses PCB via struct user.
- Rename L_ADDR to L_PCB in few places. Reduce sys/user.h inclusions.
 1.5 21-Nov-2009  rmind Catch-up Xen and usermode with lwp_getpcb() and unbreak Xen build.
 1.4 21-Oct-2009  snj Drop 3rd and 4th clauses. OK jmcneill (copyright holder).
 1.3 11-Aug-2009  matt Remove all declarations of physmem from sys/arch. Add an include of
<sys/systm.h> to the one file that did not already contain it.
This now means that physmem can be changed by updating systm.h and uvm_page.c
(excluding fixing printfs)
 1.2 12-Feb-2008  joerg branches: 1.2.2; 1.2.12;
Introduce device_find_by_xname and device_find_by_driver_unit to replace
alldevs iterations all over src.

Patch discussed with and improved on suggestioned from cube@.
 1.1 29-Dec-2007  jmcneill branches: 1.1.2; 1.1.4; 1.1.6;
Import work-in-progress NetBSD/usermode port.
 1.1.6.3 27-Feb-2008  yamt sync with head.
 1.1.6.2 21-Jan-2008  yamt sync with head
 1.1.6.1 29-Dec-2007  yamt file cpu.c was added on branch yamt-lazymbuf on 2008-01-21 09:39:44 +0000
 1.1.4.3 23-Mar-2008  matt sync with HEAD
 1.1.4.2 09-Jan-2008  matt sync with HEAD
 1.1.4.1 29-Dec-2007  matt file cpu.c was added on branch matt-armv6 on 2008-01-09 01:49:20 +0000
 1.1.2.2 02-Jan-2008  bouyer Sync with HEAD
 1.1.2.1 29-Dec-2007  bouyer file cpu.c was added on branch bouyer-xeni386 on 2008-01-02 21:50:43 +0000
 1.2.12.2 11-Mar-2010  yamt sync with head
 1.2.12.1 19-Aug-2009  yamt sync with head.
 1.2.2.2 18-Feb-2008  mjf Sync with HEAD.
 1.2.2.1 12-Feb-2008  mjf file cpu.c was added on branch mjf-devfs on 2008-02-18 21:05:12 +0000
 1.6.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.46.2.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.46.2.2 30-Oct-2012  yamt sync with head
 1.46.2.1 17-Apr-2012  yamt sync with head
 1.47.2.4 06-Mar-2012  mrg sync to -current
 1.47.2.3 06-Mar-2012  mrg sync to -current
 1.47.2.2 04-Mar-2012  mrg sync to latest -current.
 1.47.2.1 18-Feb-2012  mrg merge to -current.
 1.69.2.3 08-Aug-2012  martin Pull up following revision(s) (requested by mlelstv in ticket #466):
sys/arch/amiga/amiga/autoconf.c: revision 1.113
sys/arch/rs6000/rs6000/autoconf.c: revision 1.4
sys/arch/emips/emips/autoconf.c: revision 1.6
sys/arch/sandpoint/sandpoint/autoconf.c: revision 1.27
sys/arch/evbmips/alchemy/autoconf.c: revision 1.18
sys/arch/sgimips/sgimips/autoconf.c: revision 1.43
sys/arch/atari/atari/autoconf.c: revision 1.63
sys/arch/powerpc/oea/ofw_autoconf.c: revision 1.17
sys/arch/mmeye/mmeye/autoconf.c: revision 1.9
distrib/sets/lists/comp/mi: revision 1.1771
sys/arch/mipsco/mipsco/autoconf.c: revision 1.25
sys/arch/iyonix/iyonix/autoconf.c: revision 1.14
sys/arch/hp300/hp300/autoconf.c: revision 1.100
sys/kern/init_main.c: revision 1.445
sys/arch/pmax/pmax/autoconf.c: revision 1.79
sys/arch/netwinder/netwinder/autoconf.c: revision 1.11
sys/arch/dreamcast/dreamcast/autoconf.c: revision 1.10
sys/arch/ibmnws/ibmnws/autoconf.c: revision 1.12
sys/arch/evbppc/ev64260/autoconf.c: revision 1.17
sys/arch/evbmips/gdium/autoconf.c: revision 1.5
sys/arch/algor/algor/autoconf.c: revision 1.21
share/man/man9/Makefile: revision 1.367
sys/arch/ews4800mips/ews4800mips/autoconf.c: revision 1.9
sys/arch/amigappc/amigappc/autoconf.c: revision 1.5
sys/arch/x86/x86/x86_autoconf.c: revision 1.65
sys/arch/acorn26/acorn26/autoconf.c: revision 1.9
sys/arch/mvmeppc/mvmeppc/autoconf.c: revision 1.13
sys/arch/vax/vax/autoconf.c: revision 1.94
sys/arch/usermode/dev/cpu.c: revision 1.72
sys/arch/evbppc/virtex/autoconf.c: revision 1.5
sys/arch/next68k/next68k/autoconf.c: revision 1.26
sys/arch/mac68k/mac68k/autoconf.c: revision 1.73
sys/arch/ia64/ia64/autoconf.c: revision 1.6
sys/arch/evbppc/obs405/obs405_autoconf.c: revision 1.6
share/man/man9/cpu_rootconf.9: revision 1.7
sys/arch/landisk/landisk/autoconf.c: revision 1.6
sys/arch/evbmips/malta/autoconf.c: revision 1.16
sys/arch/sun3/sun3/autoconf.c: revision 1.76
sys/arch/evbppc/explora/autoconf.c: revision 1.13
sys/arch/sun3/sun3/autoconf.c: revision 1.77
sys/arch/evbmips/loongson/autoconf.c: revision 1.3
sys/arch/evbmips/atheros/autoconf.c: revision 1.11
sys/arch/sparc64/sparc64/autoconf.c: revision 1.188
sys/arch/acorn32/acorn32/autoconf.c: revision 1.18
sys/arch/evbarm/evbarm/autoconf.c: revision 1.13
sys/arch/cobalt/cobalt/autoconf.c: revision 1.30
sys/arch/mvme68k/mvme68k/autoconf.c: revision 1.46
sys/arch/hp700/hp700/autoconf.c: revision 1.48
sys/arch/evbmips/adm5120/autoconf.c: revision 1.5
sys/arch/hpcmips/hpcmips/autoconf.c: revision 1.25
sys/arch/alpha/alpha/autoconf.c: revision 1.52
sys/arch/sparc/sparc/autoconf.c: revision 1.244
sys/arch/evbppc/pmppc/autoconf.c: revision 1.7
sys/arch/bebox/bebox/autoconf.c: revision 1.25
sys/arch/luna68k/luna68k/autoconf.c: revision 1.13
sys/arch/hpcarm/hpcarm/autoconf.c: revision 1.20
sys/arch/evbppc/walnut/autoconf.c: revision 1.21
sys/arch/cesfic/cesfic/autoconf.c: revision 1.26
sys/arch/cats/cats/autoconf.c: revision 1.17
sys/arch/x68k/x68k/autoconf.c: revision 1.67
sys/arch/news68k/news68k/autoconf.c: revision 1.21
sys/arch/arc/arc/autoconf.c: revision 1.34
sys/arch/evbsh3/evbsh3/autoconf.c: revision 1.11
sys/sys/conf.h: revision 1.143
sys/arch/evbmips/rasoc/autoconf.c: revision 1.3
sys/arch/hpcsh/hpcsh/autoconf.c: revision 1.26
sys/arch/sun68k/sun68k/autoconf.c: revision 1.29
sys/arch/evbmips/rmixl/autoconf.c: revision 1.6
sys/arch/zaurus/zaurus/autoconf.c: revision 1.12
sys/arch/xen/x86/autoconf.c: revision 1.15
sys/arch/evbppc/mpc85xx/autoconf.c: revision 1.6
sys/arch/shark/shark/autoconf.c: revision 1.18
sys/arch/prep/prep/autoconf.c: revision 1.25
sys/arch/newsmips/newsmips/autoconf.c: revision 1.36
sys/arch/sbmips/sbmips/autoconf.c: revision 1.8
Do not call setroot() from MD code and from MI code, which has
unwanted sideeffects in the RB_ASKNAME case. This fixes PR/46732.
No longer wrap MD cpu_rootconf(), as hp300 port stores reboot information
as a side effect. Instead call MI rootconf() from MD code which makes
rootconf() now a wrapper to setroot().
Adjust several MD routines to set the global booted_device,booted_partition
variables instead of passing partial information to setroot().
Make cpu_rootconf(9) describe the calling order.
add rootconf(9) as a link to cpu_rootconf(9)
make this compile again
 1.69.2.2 02-Jul-2012  jdc Pull up revision 1.71 (requested by reinoud in ticket #377).

Implement dummy `cpu_mcontext_validate' to make it compile again. This
function needs to be implemented in the target secton one day for extra
security.
 1.69.2.1 07-Mar-2012  riz Pull up following revision(s) (requested by reinoud in ticket #89):
sys/arch/usermode/usermode/thunk.c: revision 1.81
sys/arch/usermode/target/i386/cpu_i386.c: revision 1.4
sys/arch/usermode/include/thunk.h: revision 1.61
sys/arch/usermode/include/intr.h: revision 1.9
sys/arch/usermode/dev/cpu.c: revision 1.70
sys/arch/usermode/dev/ttycons.c: revision 1.19
sys/arch/usermode/usermode/trap.c: revision 1.64
Implement signal forwarding to userland for usermode kernels. Especially
SIGFPE is important since the urkel shouldn't stop when a userland program
devides by zero!
 1.72.4.1 18-May-2014  rmind sync with head
 1.72.2.2 03-Dec-2017  jdolecek update from HEAD
 1.72.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.73.6.1 28-Aug-2017  skrll Sync with HEAD
 1.74.8.2 25-Jun-2018  pgoyette Sync with HEAD
 1.74.8.1 21-May-2018  pgoyette Sync with HEAD
 1.80.2.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.2 29-Dec-2011  jmcneill Replace the SDL based genfb driver with a wsdisplay and wskbd driver that
implements the VNC (RFB) protocol.

To enable the VNC server, add 'vnc=640x480,5900' to the kernel command line
(where 640x480 is the desired fb resolution and 5900 is the TCP port).

Screenshot of it here: http://www.netbsd.org/~jmcneill/usermode.tiff
 1.1 25-Aug-2011  jmcneill branches: 1.1.2; 1.1.6;
- build thunk code with warnings
- add option SDL which pulls in thunk_sdl code and links the kernel to libSDL
- add an experimental framebuffer driver based on thunk_sdl, enable with:
options SDL
genfb* at mainbus?
wsdisplay* at genfb?
options WS_KERNEL_FG=WSCOL_GREEN
options WSEMUL_VT100
- reserve a major # for wsdisplay
- add thunk_getenv()
 1.1.6.1 18-Feb-2012  mrg merge to -current.
 1.1.2.1 17-Apr-2012  yamt sync with head
 1.16 18-Sep-2022  thorpej Eliminate use of IFF_OACTIVE.
 1.15 16-Jun-2021  riastradh if_attach and if_initialize cannot fail, don't test return value

These were originally made failable back in 2017 when if_initialize
allocated a softint in every interface for link state changes, so
that it could fail gracefully instead of panicking:

https://mail-index.NetBSD.org/source-changes/2017/10/23/msg089053.html

However, this spawned many seldom- or never-tested error branches,
which are risky to have around. And that softint in every interface
has since been replaced by a single global workqueue, because link
state changes require thread context but not low latency or high
throughput:

https://mail-index.NetBSD.org/source-changes/2020/02/06/msg113759.html

So there is no longer any reason for if_initialize to fail. (The
subroutine if_stats_init can't fail because percpu_alloc can't fail
either.)

There is a snag: the softint_establish in if_percpuq_create could
fail, potentially leading to bad consequences later on trying to use
the softint. This change doesn't introduce any new bugs because of
the snag -- if_percpuq_attach was already broken. However, the snag
can be better addressed without spawning error branches, either by
using a single softint or making softints less scarce.

(Separate commit will change the signatures of if_attach and
if_initialize to return void, scheduled to ride whatever is the next
convenient kernel bump.)

Patch and testing on amd64 and evbmips64-eb by maya@; commit message
soliloquy, and compile-testing on evbppc/i386/earmv7hf, by me.
 1.14 05-Feb-2020  skrll branches: 1.14.10;
Adopt <net/if_stat.h>
 1.13 29-May-2019  msaitoh branches: 1.13.4;
Even if we don't use MII(4), use the common path of SIOC[GS]IFMEDIA in
sys/net/if_ethersubr.c if we can.
- Add ec_ifmedia into struct ethercom.
- ec_mii in struct ethercom is kept and used as it is. It might be used in
future. Note that some Ethernet drivers which _DOESN'T_ use mii(4) use
ec_mii for keeping the if_media. Those should be changed in future.
 1.12 29-May-2019  msaitoh KNF. No functional change.
 1.11 03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.10 26-Jun-2018  msaitoh branches: 1.10.2;
Implement the BPF direction filter (BIOC[GS]DIRECTION). It provides backward
compatibility with BIOC[GS]SEESENT ioctl. The userland interface is the same
as FreeBSD.

This change also fixes a bug that the direction is misunderstand on some
environment by passing the direction to bpf_mtap*() instead of checking
m->m_pkthdr.rcvif.
 1.9 23-Oct-2017  msaitoh branches: 1.9.2;
If if_initialize() failed in the attach function, free resources and return.
 1.8 15-Dec-2016  ozaki-r branches: 1.8.8;
Move bpf_mtap and if_ipackets++ on Rx of each driver to percpuq if_input

The benefits of the change are:
- We can reduce codes
- We can provide the same behavior between drivers
- Where/When if_ipackets is counted up
- Note that some drivers still update packet statistics in their own
way (periodical update)
- Moved bpf_mtap run in softint
- This makes it easy to MP-ify bpf

Proposed on tech-kern and tech-net
 1.7 10-Jun-2016  ozaki-r branches: 1.7.2;
Introduce m_set_rcvif and m_reset_rcvif

The API is used to set (or reset) a received interface of a mbuf.
They are counterpart of m_get_rcvif, which will come in another
commit, hide internal of rcvif operation, and reduce the diff of
the upcoming change.

No functional change.
 1.6 09-Feb-2016  ozaki-r Introduce softint-based if_input

This change intends to run the whole network stack in softint context
(or normal LWP), not hardware interrupt context. Note that the work is
still incomplete by this change; to that end, we also have to softint-ify
if_link_state_change (and bpf) which can still run in hardware interrupt.

This change softint-ifies at ifp->if_input that is called from
each device driver (and ieee80211_input) to ensure Layer 2 runs
in softint (e.g., ether_input and bridge_input). To this end,
we provide a framework (called percpuq) that utlizes softint(9)
and percpu ifqueues. With this patch, rxintr of most drivers just
queues received packets and schedules a softint, and the softint
dequeues packets and does rest packet processing.

To minimize changes to each driver, percpuq is allocated in struct
ifnet for now and that is initialized by default (in if_attach).
We probably have to move percpuq to softc of each driver, but it's
future work. At this point, only wm(4) has percpuq in its softc
as a reference implementation.

Additional information including performance numbers can be found
in the thread at tech-kern@ and tech-net@:
http://mail-index.netbsd.org/tech-kern/2016/01/14/msg019997.html

Acknowledgment: riastradh@ greatly helped this work.
Thank you very much!
 1.5 21-Jan-2012  reinoud branches: 1.5.4; 1.5.6; 1.5.10; 1.5.28;
Complete rewrite of the signal and spl framework for NetBSD/usermode

Signals are now moved from the sigaltstack ASAP and stacked on a replacement
stack for each processes.

Preemption now works though could be enhanced a bit more
 1.4 15-Jan-2012  jmcneill close file descriptors at shutdown
 1.3 09-Jan-2012  reinoud Don't directly call softint_shedule() when we might be in an SPL level too
high.
 1.2 26-Dec-2011  jmcneill veth_start: copy data from mbuf into a buffer and pass that to thunk_write(),
now this driver works as expected
 1.1 26-Dec-2011  jmcneill first cut at networking support for usermode, doesn't fully work yet but
enough to get an address with dhcp and answer arps
 1.5.28.3 05-Feb-2017  skrll Sync with HEAD
 1.5.28.2 09-Jul-2016  skrll Sync with HEAD
 1.5.28.1 19-Mar-2016  skrll Sync with HEAD
 1.5.10.1 03-Dec-2017  jdolecek update from HEAD
 1.5.6.2 17-Apr-2012  yamt sync with head
 1.5.6.1 21-Jan-2012  yamt file if_veth.c was added on branch yamt-pagecache on 2012-04-17 00:06:59 +0000
 1.5.4.2 18-Feb-2012  mrg merge to -current.
 1.5.4.1 21-Jan-2012  mrg file if_veth.c was added on branch jmcneill-usbmp on 2012-02-18 07:33:23 +0000
 1.7.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.8.8.1 10-Dec-2017  snj Pull up following revision(s) (requested by msaitoh in ticket #427):
sys/arch/amiga/dev/if_bah_zbus.c: 1.17
sys/arch/arm/broadcom/bcm53xx_eth.c: 1.30
sys/arch/powerpc/booke/dev/pq3etsec.c: 1.32
sys/arch/usermode/dev/if_veth.c: 1.9
sys/dev/ic/an.c: 1.66
sys/dev/ic/athn.c: 1.17
sys/dev/ic/atw.c: 1.162
sys/dev/ic/bwi.c: 1.33
sys/dev/ic/dwc_gmac.c: 1.41-1.42
sys/dev/ic/malo.c: 1.10
sys/dev/ic/rt2560.c: 1.31
sys/dev/ic/rt2661.c: 1.36
sys/dev/ic/rt2860.c: 1.29
sys/dev/ic/rtw.c: 1.127
sys/dev/ic/rtwvar.h: 1.46
sys/dev/ic/smc90cx6.c: 1.71
sys/dev/ic/smc90cx6var.h: 1.12
sys/dev/ic/wi.c: 1.244
sys/dev/pci/if_ipw.c: 1.66
sys/dev/pci/if_iwi.c: 1.104
sys/dev/pci/if_iwm.c: 1.76
sys/dev/pci/if_iwn.c: 1.86
sys/dev/pci/if_rtwn.c: 1.13
sys/dev/pci/if_wm.c: 1.541
sys/dev/pci/if_wpi.c: 1.79
sys/dev/pci/ixgbe/ixgbe.c: 1.106
sys/dev/pci/ixgbe/ixv.c: 1.73 via patch
sys/dev/pcmcia/if_malo_pcmcia.c: 1.15
sys/dev/scsipi/if_se.c: 1.95
sys/dev/usb/if_upl.c: 1.60
sys/net/if.c: 1.396
sys/net/if.h: 1.241
sys/net/if_arc.h: 1.23
sys/net/if_arcsubr.c: 1.78
sys/net/if_bridge.c: 1.136-1.137
sys/net/if_etherip.c: 1.39
sys/net/if_faith.c: 1.56
sys/net/if_gif.c: 1.131
sys/net/if_loop.c: 1.96
sys/net/if_mpls.c: 1.30
sys/net/if_pppoe.c: 1.129
sys/net/if_srt.c: 1.27
sys/net/if_stf.c: 1.102
sys/net/if_tap.c: 1.100
sys/net/if_vlan.c: 1.105
sys/netinet/ip_carp.c: 1.91
sys/rump/net/lib/libshmif/if_shmem.c: 1.73-1.74
sys/rump/net/lib/libvirtif/if_virt.c: 1.55-1.56
if_initalize() and if_attach() failed when resource allocation failed
(e.g. allocating softint). Without this change, it panics. It's bad because
resource shortage really occured when a lot of pseudo interface is created.
To avoid this problem, don't panic and change return value of if_initialize()
and if_attach() to int. Caller fanction will be recover from error cleanly by
checking the return value.
Return if bah_attach_subr() failed.
If if_attach() failed in the attach function, return.
- If if_initialize() failed in the attach function, free resources and return.
- Add some missing frees in bridge_clone_destroy().
- KNF
If error occured in bcmeth_ccb_attach(), free resources and return.
If error occured in pq3etsec_attach(), free resources and return.
If error occured in the attach function, free resources and return.
- If if_initialize() failed in athn_attach(), free resources and return.
- Add missing pmf_event_deregister() in athn_detach().
- Free resources correctly on some errors in atw_attach().
- Use apint*() insread of printf() in the attach function.
If if_initialize() failed in the attach function, return.
- If if_initialize() failed in the attach function, free resources and return.
- Add missing dwc_gmac_free_dma_rings() and mutex_destroy() when attach
failed.
- If if_initialize() failed in the attach function, free resources and return.
- ifp is always not NULL in iwi_detach(). Check correctly with ifp->if_softc.
- If if_initialize() failed in the attach function, free resources and return.
- Fix error path in the attach function correctly.
If if_initialize() failed in the attach function, free resources and return.
If if_attach() failed in the attach function, free resources and return.
- If if_initialize() failed in the attach function, free resources and return.
- KNF
- If if_attach() failed in the attach function, free resources and return.
- KNF
Fix compile error.
Fix compile error.
We don't need '&mii', but just 'mii' for mii_detach().
Don't free sc_rthash twice
 1.9.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.9.2.1 28-Jul-2018  pgoyette Sync with HEAD
 1.10.2.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.10.2.1 10-Jun-2019  christos Sync with HEAD
 1.13.4.1 29-Feb-2020  ad Sync with head.
 1.14.10.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.34 13-Apr-2025  rin ld(4): Convert blkno argument for sc_dump() to daddr_t

PR kern/59153

(1) For backends that accept 64-bit block address, i.e.,
nvme(4), virtio(4), aac(4), iop(4), and mainbus(usermode/4),
this should enable to dump beyond 2Gi blocks.

(2) sdmmc(4) backend allows to dump up to the last block.

(3) For other backends, block address is handled as `int`.
Some of them may support blocks up to 4Gi, but I do not have
enough time to examine datasheets. So, continue to reject >2Gi
blocks as before.

XXX
This is KABI change, and cannot be pulled up into netbsd-{10,9}.

XXX
Compile-test only (for amd64/ALL) due to lack of large SSDs ;)

Thanks mlelstv@ for discussion and careful review!!
 1.33 04-Jun-2018  reinoud branches: 1.33.38;
Its a hack, but make sure the pages are paged in
 1.32 13-Jan-2018  reinoud branches: 1.32.2;
Keep up with changes in ld(4): adding ioctl handling on the ld(4) instead of
using the old dedicated ldflush() function.
 1.31 13-Jan-2018  reinoud Add the missing strategy argument of ldattach()
 1.30 21-Jan-2012  reinoud Complete rewrite of the signal and spl framework for NetBSD/usermode

Signals are now moved from the sigaltstack ASAP and stacked on a replacement
stack for each processes.

Preemption now works though could be enhanced a bit more
 1.29 09-Jan-2012  reinoud Re-implement aio for ld_thunkbus. It seems to work fine though its not set by
default; define LD_USE_AIO or uncomment its setting at the top of the
sourcefile to enable it.
 1.28 09-Jan-2012  reinoud sizeof_t is allways >=0 and the check for >=0 thus allways is true and amd64
complains about this. This might explain the odd write errors that could
sometimes be reported. Those are/were probably a side effect of this.
 1.27 06-Jan-2012  reinoud Enhance debugging printfs to also report the functionname
 1.26 06-Jan-2012  jmcneill support disk images >= 2GB
 1.25 03-Jan-2012  reinoud Rename the debug printf's to use a thunk_ prefix to avoid confusion.
 1.24 14-Dec-2011  jmcneill set ld maxxfer to MAXPHYS
 1.23 13-Dec-2011  reinoud Remove dead code. The error variable was no longer used.
 1.22 13-Dec-2011  reinoud No need for the bounce-buffer anymore since pmap bahaves like it ought to
 1.21 13-Dec-2011  jmcneill - gc old aio implementation
- set busy before scheduling softint not after
- try not to write past end of backing file
- if B_PHYS flag is set, pread/write with bounce buffer and copyout/copyin
- use the correct offset in ld_thunkbus_dump
 1.20 09-Dec-2011  reinoud Disable aio usage in thunkbus_ld since mixing ucontext_t and threads is a NONO
according to the manpage.

Why is AIO using a pthread?
 1.19 27-Nov-2011  reinoud branches: 1.19.2;
Use AIO by default
 1.18 27-Nov-2011  reinoud Fix in-code declaration of the sigaction structure.
 1.17 27-Nov-2011  reinoud Implement the choice between using AIO or not.
 1.16 16-Sep-2011  reinoud branches: 1.16.2;
Remove the blockage of SIGALRM here too
 1.15 15-Sep-2011  reinoud Check reentry to prevent double use of the aiocb structure
 1.14 13-Sep-2011  reinoud Remove excess signal stack declarations and remove the clock and ld signals
from the signal stack since they are only issued shortly.
 1.13 12-Sep-2011  reinoud Move the clock device and the ld device to the new spl interrupt PIC
 1.12 05-Sep-2011  jmcneill use sigaltstack
 1.11 05-Sep-2011  reinoud Disable SIGALRM from interfering with this signal handler
 1.10 04-Sep-2011  reinoud Space around | (style)
 1.9 03-Sep-2011  jmcneill Now that pr45327 is fixed, remove BROKEN_SIGINFO code.
 1.8 03-Sep-2011  jmcneill add a workaround for kern/45327
 1.7 03-Sep-2011  jmcneill Get this compiling (but not quite linking yet) on Linux
 1.6 25-Aug-2011  reinoud When this debug printf is enabled, please also tell WHAT address one is using
for read/write.
 1.5 23-Aug-2011  jmcneill struct stat also has time_t in it, so we can't use that in the thunk api either
 1.4 23-Aug-2011  jmcneill don't use kmem from softint context
 1.3 13-Aug-2011  jmcneill call lddone from a softint instead of the signal handler, now reading from
disk works:

ld0 at mainbus0: /home/jmcneill/test.fs (33554432)
ld0: 32768 KB, 65 cyl, 16 head, 63 sec, 512 bytes/sect x 65536 sectors
boot device: ld0
root on ld0a dumps on ld0b
root file system type: ffs
WARNING: no TOD clock present
WARNING: using filesystem time
WARNING: CHECK AND RESET THE DATE!
 1.2 13-Aug-2011  jmcneill try to use aio_read/aio_write instead of pread/pwrite
 1.1 12-Aug-2011  jmcneill add a simple disk driver, pass the path to the disk image on the kernel command line:

soundwave$ ./netbsd /tmp/test.fs
NetBSD/usermode startup
[...]
ld0 at mainbus0: /tmp/test.fs (33554432)
ld0: 32768 KB, 8322 cyl, 64 head, 63 sec, 1 bytes/sect x 33554432 sectors
boot device: ld0
root on ld0a dumps on ld0b
 1.16.2.1 17-Apr-2012  yamt sync with head
 1.19.2.1 18-Feb-2012  mrg merge to -current.
 1.32.2.1 25-Jun-2018  pgoyette Sync with HEAD
 1.33.38.1 02-Aug-2025  perseant Sync with HEAD
 1.12 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.11 24-Apr-2021  thorpej branches: 1.11.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.10 05-Jun-2018  reinoud branches: 1.10.16;
Add ATAPI passtrough support giving the NetBSD/usermode kernel full control of
an ATAPI device. All ATAPI/SCSI commands are passed trough.

Note that ATAPI/SCSI calls are made in the foreground still. Lengthy calls
will still hug the CPU until completion. Making it asynchronous is in the
pipeline
 1.9 07-Jan-2012  jmcneill branches: 1.9.46;
support multiple disk images (pass multiple disk=<path> parameters on the
command-line). while changing command-line params, rename tap= option to
net=
 1.8 29-Dec-2011  jmcneill Replace the SDL based genfb driver with a wsdisplay and wskbd driver that
implements the VNC (RFB) protocol.

To enable the VNC server, add 'vnc=640x480,5900' to the kernel command line
(where 640x480 is the desired fb resolution and 5900 is the TCP port).

Screenshot of it here: http://www.netbsd.org/~jmcneill/usermode.tiff
 1.7 26-Dec-2011  jmcneill add vaudio(4) audio device driver
 1.6 26-Dec-2011  jmcneill first cut at networking support for usermode, doesn't fully work yet but
enough to get an address with dhcp and answer arps
 1.5 25-Aug-2011  jmcneill branches: 1.5.2; 1.5.6;
- build thunk code with warnings
- add option SDL which pulls in thunk_sdl code and links the kernel to libSDL
- add an experimental framebuffer driver based on thunk_sdl, enable with:
options SDL
genfb* at mainbus?
wsdisplay* at genfb?
options WS_KERNEL_FG=WSCOL_GREEN
options WSEMUL_VT100
- reserve a major # for wsdisplay
- add thunk_getenv()
 1.4 12-Aug-2011  jmcneill add a simple disk driver, pass the path to the disk image on the kernel command line:

soundwave$ ./netbsd /tmp/test.fs
NetBSD/usermode startup
[...]
ld0 at mainbus0: /tmp/test.fs (33554432)
ld0: 32768 KB, 8322 cyl, 64 head, 63 sec, 1 bytes/sect x 33554432 sectors
boot device: ld0
root on ld0a dumps on ld0b
 1.3 27-Nov-2009  rmind - Use uvm_lwp_setuarea() instead of directly setting address to lwp_t::l_addr.
- Replace most remaining uses of l_addr with uvm_lwp_getuarea() or lwp_getpcb().
- Amend assembly in ports where it accesses PCB via struct user.
- Rename L_ADDR to L_PCB in few places. Reduce sys/user.h inclusions.
 1.2 21-Oct-2009  snj Drop 3rd and 4th clauses. OK jmcneill (copyright holder).
 1.1 29-Dec-2007  jmcneill branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.18;
Import work-in-progress NetBSD/usermode port.
 1.1.18.1 11-Mar-2010  yamt sync with head
 1.1.8.2 18-Feb-2008  mjf Sync with HEAD.
 1.1.8.1 29-Dec-2007  mjf file mainbus.c was added on branch mjf-devfs on 2008-02-18 21:05:12 +0000
 1.1.6.2 21-Jan-2008  yamt sync with head
 1.1.6.1 29-Dec-2007  yamt file mainbus.c was added on branch yamt-lazymbuf on 2008-01-21 09:39:45 +0000
 1.1.4.2 09-Jan-2008  matt sync with HEAD
 1.1.4.1 29-Dec-2007  matt file mainbus.c was added on branch matt-armv6 on 2008-01-09 01:49:20 +0000
 1.1.2.2 02-Jan-2008  bouyer Sync with HEAD
 1.1.2.1 29-Dec-2007  bouyer file mainbus.c was added on branch bouyer-xeni386 on 2008-01-02 21:50:44 +0000
 1.5.6.1 18-Feb-2012  mrg merge to -current.
 1.5.2.1 17-Apr-2012  yamt sync with head
 1.9.46.1 25-Jun-2018  pgoyette Sync with HEAD
 1.10.16.1 23-Mar-2021  thorpej Convert config_found_ia() call sites where the device only carries
a single interface attribute to bare config_found() calls.
 1.11.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.20 25-Jul-2014  dholland Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.
 1.19 03-Mar-2012  reinoud branches: 1.19.2; 1.19.12;
Implement signal forwarding to userland for usermode kernels. Especially
SIGFPE is important since the urkel shouldn't stop when a userland program
devides by zero!
 1.18 21-Jan-2012  reinoud branches: 1.18.2;
Complete rewrite of the signal and spl framework for NetBSD/usermode

Signals are now moved from the sigaltstack ASAP and stacked on a replacement
stack for each processes.

Preemption now works though could be enhanced a bit more
 1.17 27-Dec-2011  jmcneill support ^Z
 1.16 26-Dec-2011  jmcneill add sigio_intr_establish so more than one driver can register a SIGIO handler
 1.15 21-Dec-2011  jmcneill move the (now 1024 byte) printing buffer off the stack
 1.14 21-Dec-2011  reinoud Increase printing buffer of ttycons from 80 to 1024 significantly increasing
console output on large dumps.
 1.13 20-Dec-2011  jmcneill check return value of write, make sure we send the whole buffer to stdout
 1.12 15-Dec-2011  jmcneill use write instead of putchar putchar putchar putchar putchar ... for console output
 1.11 12-Dec-2011  jmcneill install a SIGINT handler and use it to emulate ^C
 1.10 12-Dec-2011  jmcneill make sure to set O_ASYNC on stdin to enable ttycons "interrupts"
 1.9 12-Dec-2011  jmcneill use spl_intr from signal handler instead of calling softint_schedule directly
 1.8 11-Dec-2011  jmcneill make ttycons a proper tty device, now it can be the console
 1.7 11-Dec-2011  jmcneill make sure to set cn_dev and cn_pri in our consdev struct
 1.6 09-Dec-2011  reinoud Remove empty lines in ttycons_consinit
 1.5 28-Aug-2011  jmcneill branches: 1.5.2; 1.5.6;
turn off input echo and buffering
 1.4 12-Aug-2011  jmcneill Clean up extern mess by adding an API for kernel components to call libc
functions. thunk.c is built with special cflags that makes it compile
against standard system headers instead of kernel ones.
 1.3 27-Nov-2009  rmind - Use uvm_lwp_setuarea() instead of directly setting address to lwp_t::l_addr.
- Replace most remaining uses of l_addr with uvm_lwp_getuarea() or lwp_getpcb().
- Amend assembly in ports where it accesses PCB via struct user.
- Rename L_ADDR to L_PCB in few places. Reduce sys/user.h inclusions.
 1.2 21-Oct-2009  snj Drop 3rd and 4th clauses. OK jmcneill (copyright holder).
 1.1 29-Dec-2007  jmcneill branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.18;
Import work-in-progress NetBSD/usermode port.
 1.1.18.1 11-Mar-2010  yamt sync with head
 1.1.8.2 18-Feb-2008  mjf Sync with HEAD.
 1.1.8.1 29-Dec-2007  mjf file ttycons.c was added on branch mjf-devfs on 2008-02-18 21:05:12 +0000
 1.1.6.2 21-Jan-2008  yamt sync with head
 1.1.6.1 29-Dec-2007  yamt file ttycons.c was added on branch yamt-lazymbuf on 2008-01-21 09:39:45 +0000
 1.1.4.2 09-Jan-2008  matt sync with HEAD
 1.1.4.1 29-Dec-2007  matt file ttycons.c was added on branch matt-armv6 on 2008-01-09 01:49:20 +0000
 1.1.2.2 02-Jan-2008  bouyer Sync with HEAD
 1.1.2.1 29-Dec-2007  bouyer file ttycons.c was added on branch bouyer-xeni386 on 2008-01-02 21:50:44 +0000
 1.5.6.4 06-Mar-2012  mrg sync to -current
 1.5.6.3 06-Mar-2012  mrg sync to -current
 1.5.6.2 04-Mar-2012  mrg sync to latest -current.
 1.5.6.1 18-Feb-2012  mrg merge to -current.
 1.5.2.1 17-Apr-2012  yamt sync with head
 1.18.2.1 07-Mar-2012  riz Pull up following revision(s) (requested by reinoud in ticket #89):
sys/arch/usermode/usermode/thunk.c: revision 1.81
sys/arch/usermode/target/i386/cpu_i386.c: revision 1.4
sys/arch/usermode/include/thunk.h: revision 1.61
sys/arch/usermode/include/intr.h: revision 1.9
sys/arch/usermode/dev/cpu.c: revision 1.70
sys/arch/usermode/dev/ttycons.c: revision 1.19
sys/arch/usermode/usermode/trap.c: revision 1.64
Implement signal forwarding to userland for usermode kernels. Especially
SIGFPE is important since the urkel shouldn't stop when a userland program
devides by zero!
 1.19.12.1 10-Aug-2014  tls Rebase.
 1.19.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.3 24-Apr-2021  thorpej branches: 1.3.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.2 13-Jun-2018  reinoud branches: 1.2.2; 1.2.18;
Split out error reporting and make it compile without SCSIVERBOSE
 1.1 05-Jun-2018  reinoud Add ATAPI passtrough support giving the NetBSD/usermode kernel full control of
an ATAPI device. All ATAPI/SCSI commands are passed trough.

Note that ATAPI/SCSI calls are made in the foreground still. Lengthy calls
will still hug the CPU until completion. Making it asynchronous is in the
pipeline
 1.2.18.1 23-Mar-2021  thorpej Convert config_found_ia() call sites where the device only carries
a single interface attribute to bare config_found() calls.
 1.2.2.2 25-Jun-2018  pgoyette Sync with HEAD
 1.2.2.1 13-Jun-2018  pgoyette file vatapi.c was added on branch pgoyette-compat on 2018-06-25 07:25:46 +0000
 1.3.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.5 08-May-2019  isaki Merge isaki-audio2 branch, the overhaul of audio subsystem.
- Interrupt-oriented system rather than thread-oriented.
- Improve stability, quality and performance.
- Split playback and record cleanly. Improve halfduplex support.
- Many bugs are fixed including deadlocks, resource leaks, abuses, etc.
- Simplify audio filter mechanism. The encoding/channels/frequency
conversions are completely handled in the upper layer. So the hard-
ware driver only converts its hardware encoding (if necessary).
- audio_hw_if changes:
- Obsoletes query_encoding and add query_format instead.
- Obsoletes set_params and add set_format instead.
- Remove drain, setfd, mappage.
- The call sequences are changed.
- ioctl AUDIO_GETFD/SETFD, AUDIO_GETCHAN/SETCHAN are obsoleted.
- ioctl AUDIO_{QUERY,GET,SET}FORMAT are introduced.
- cleanup config attributes: au*conv and mulaw.
- All hardware drivers should follow it (I've done as much as possible).

Some file paths are changed:
- dev/audio.c -> dev/audio/audio.c (rewritten)
- dev/audiovar.h -> dev/audio/audiovar.h
- dev/audio_dai.h -> dev/audio/audio_dai.h
- dev/audio_if.h -> dev/audio/audio_if.h
- dev/audiobell.c -> dev/audio/audiobell.c
- dev/audiobellvar.h -> dev/audio/audiobellvar.h
- dev/mulaw.[ch] -> dev/audio/mulaw.[ch] + dev/audio/alaw.c
 1.4 26-Mar-2014  christos branches: 1.4.30; 1.4.32;
fix sprintf
 1.3 15-Jan-2012  jmcneill branches: 1.3.4; 1.3.6; 1.3.10; 1.3.14;
close file descriptors at shutdown
 1.2 26-Dec-2011  jmcneill mark vaudio callout and softint handler as mpsafe
 1.1 26-Dec-2011  jmcneill add vaudio(4) audio device driver
 1.3.14.1 18-May-2014  rmind sync with head
 1.3.10.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3.6.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.3.6.2 17-Apr-2012  yamt sync with head
 1.3.6.1 15-Jan-2012  yamt file vaudio.c was added on branch yamt-pagecache on 2012-04-17 00:06:59 +0000
 1.3.4.2 18-Feb-2012  mrg merge to -current.
 1.3.4.1 15-Jan-2012  mrg file vaudio.c was added on branch jmcneill-usbmp on 2012-02-18 07:33:23 +0000
 1.4.32.3 04-May-2019  isaki Move dev/audio_if.h -> dev/audio/audio_if.h
 1.4.32.2 27-Apr-2019  isaki Adapt to audio2.
 1.4.32.1 21-Apr-2019  isaki Use C99 style struct initializer to audio_format.
 1.4.30.1 10-Jun-2019  christos Sync with HEAD
 1.14 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.13 24-Apr-2021  thorpej branches: 1.13.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.12 04-Jan-2012  jmcneill branches: 1.12.4; 1.12.6; 1.12.66;
implement cngetc and cnpollc
 1.11 02-Jan-2012  jmcneill fix range check for mmap
 1.10 30-Dec-2011  jmcneill add wsmouse support
 1.9 30-Dec-2011  jmcneill add mmap support
 1.8 30-Dec-2011  jmcneill no need to poll for pending drawing ops if no client is connected
 1.7 30-Dec-2011  jmcneill add a barrier before copyrows(), and add an RRE based fillrect functino,
use it for eraserows and erasecols
 1.6 30-Dec-2011  reinoud Implement VNC's copyrect sending and let the copyrows use the new
vncfb_copyrecs()
 1.5 30-Dec-2011  jmcneill support wskbd bell
 1.4 30-Dec-2011  jmcneill use O_ASYNC + SIGIO instead of polling for input
 1.3 30-Dec-2011  jmcneill take nrows into account when calculating the update rectangle in vncfb_copyrows
 1.2 30-Dec-2011  jmcneill send framebuffer updates for cursor changes too
 1.1 29-Dec-2011  jmcneill Replace the SDL based genfb driver with a wsdisplay and wskbd driver that
implements the VNC (RFB) protocol.

To enable the VNC server, add 'vnc=640x480,5900' to the kernel command line
(where 640x480 is the desired fb resolution and 5900 is the TCP port).

Screenshot of it here: http://www.netbsd.org/~jmcneill/usermode.tiff
 1.12.66.2 02-Apr-2021  thorpej config_found_ia() -> config_found() w/ CFARG_IATTR.
 1.12.66.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.12.6.2 17-Apr-2012  yamt sync with head
 1.12.6.1 04-Jan-2012  yamt file vncfb.c was added on branch yamt-pagecache on 2012-04-17 00:06:59 +0000
 1.12.4.2 18-Feb-2012  mrg merge to -current.
 1.12.4.1 04-Jan-2012  mrg file vncfb.c was added on branch jmcneill-usbmp on 2012-02-18 07:33:23 +0000
 1.13.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.2 30-Dec-2011  jmcneill branches: 1.2.4; 1.2.6;
map Fn keys, make vt switching work
 1.1 29-Dec-2011  jmcneill Replace the SDL based genfb driver with a wsdisplay and wskbd driver that
implements the VNC (RFB) protocol.

To enable the VNC server, add 'vnc=640x480,5900' to the kernel command line
(where 640x480 is the desired fb resolution and 5900 is the TCP port).

Screenshot of it here: http://www.netbsd.org/~jmcneill/usermode.tiff
 1.2.6.2 17-Apr-2012  yamt sync with head
 1.2.6.1 30-Dec-2011  yamt file vnckbdmap.c was added on branch yamt-pagecache on 2012-04-17 00:06:59 +0000
 1.2.4.2 18-Feb-2012  mrg merge to -current.
 1.2.4.1 30-Dec-2011  mrg file vnckbdmap.c was added on branch jmcneill-usbmp on 2012-02-18 07:33:23 +0000

RSS XML Feed