The NetBSD Project

CVS log for src/sys/arch/x86/x86/vm_machdep.c

[BACK] Up to [cvs.NetBSD.org] / src / sys / arch / x86 / x86

Request diff between arbitrary revisions


Keyword substitution: kv
Default branch: MAIN


Revision 1.46: download - view: text, markup, annotated - select for diffs
Fri Oct 6 11:53:27 2023 UTC (14 months ago) by skrll
Branches: MAIN
CVS tags: thorpej-ifq-base, thorpej-ifq, thorpej-altq-separation-base, thorpej-altq-separation, perseant-exfatfs-base-20240630, perseant-exfatfs-base, perseant-exfatfs, HEAD
Diff to: previous 1.45: preferred, colored
Changes since revision 1.45: +3 -3 lines
Convert the l2->l_md.md_astpending assignments into KASSERTs.

l_md is zeroised by lwp_create with

         memset(&l2->l_startzero, 0, sizeof(*l2) -
                    offsetof(lwp_t, l_startzero));

Revision 1.43.2.2: download - view: text, markup, annotated - select for diffs
Sat Apr 3 22:28:41 2021 UTC (3 years, 8 months ago) by thorpej
Branches: thorpej-futex
Diff to: previous 1.43.2.1: preferred, colored; next MAIN 1.44: preferred, colored
Changes since revision 1.43.2.1: +4 -4 lines
Sync with HEAD.

Revision 1.44.2.1: download - view: text, markup, annotated - select for diffs
Sat Apr 3 21:44:50 2021 UTC (3 years, 8 months ago) by thorpej
Branches: thorpej-cfargs
Diff to: previous 1.44: preferred, colored; next MAIN 1.45: preferred, colored
Changes since revision 1.44: +4 -4 lines
Sync with HEAD.

Revision 1.45: download - view: text, markup, annotated - select for diffs
Sun Mar 28 10:29:05 2021 UTC (3 years, 8 months ago) by skrll
Branches: MAIN
CVS tags: thorpej-i2c-spi-conf2-base, thorpej-i2c-spi-conf2, thorpej-i2c-spi-conf-base, thorpej-i2c-spi-conf, thorpej-futex2-base, thorpej-futex2, thorpej-futex-base, thorpej-cfargs2-base, thorpej-cfargs2, thorpej-cfargs-base, netbsd-10-base, netbsd-10-0-RELEASE, netbsd-10-0-RC6, netbsd-10-0-RC5, netbsd-10-0-RC4, netbsd-10-0-RC3, netbsd-10-0-RC2, netbsd-10-0-RC1, netbsd-10, cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x, bouyer-sunxi-drm-base, bouyer-sunxi-drm
Diff to: previous 1.44: preferred, colored
Changes since revision 1.44: +4 -4 lines
fix a comment that has been c&p'ed around and not updated

Revision 1.43.2.1: download - view: text, markup, annotated - select for diffs
Mon Dec 14 14:38:04 2020 UTC (3 years, 11 months ago) by thorpej
Branches: thorpej-futex
Diff to: previous 1.43: preferred, colored
Changes since revision 1.43: +3 -3 lines
Sync w/ HEAD.

Revision 1.44: download - view: text, markup, annotated - select for diffs
Mon Nov 30 05:33:32 2020 UTC (4 years ago) by msaitoh
Branches: MAIN
Branch point for: thorpej-cfargs
Diff to: previous 1.43: preferred, colored
Changes since revision 1.43: +3 -3 lines
s/ we we / we /

Revision 1.43: download - view: text, markup, annotated - select for diffs
Fri Jul 3 16:17:24 2020 UTC (4 years, 5 months ago) by maxv
Branches: MAIN
Branch point for: thorpej-futex
Diff to: previous 1.42: preferred, colored
Changes since revision 1.42: +40 -13 lines
In cpu_uarea_{alloc,free}:

 - My previous change in this file was not correct, kremove does not free
   the underlying PA, which caused a very slow leak under memory pressure.
   Rework to correctly free the PA.
 - Add a second redzone, this time after the stack, to catch several stack
   overflows. The main concern is read overflows which leak the heap that
   follows the stack.
 - UVM_KMF_WAITVA doesn't fail, so remove error check.
 - Add KASSERTs.

Revision 1.34.2.2: download - view: text, markup, annotated - select for diffs
Mon Apr 13 08:04:12 2020 UTC (4 years, 7 months ago) by martin
Branches: phil-wifi
Diff to: previous 1.34.2.1: preferred, colored; branchpoint 1.34: preferred, colored; next MAIN 1.35: preferred, colored
Changes since revision 1.34.2.1: +41 -41 lines
Mostly merge changes from HEAD upto 20200411

Revision 1.42: download - view: text, markup, annotated - select for diffs
Tue Mar 17 17:18:49 2020 UTC (4 years, 8 months ago) by maxv
Branches: MAIN
CVS tags: phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406, bouyer-xenpvh-base2, bouyer-xenpvh-base1, bouyer-xenpvh-base, bouyer-xenpvh
Diff to: previous 1.41: preferred, colored
Changes since revision 1.41: +30 -8 lines
Add a redzone between the pcb and the stack. Sent to port-amd64@.

Revision 1.39.2.2: download - view: text, markup, annotated - select for diffs
Sat Jan 25 22:38:44 2020 UTC (4 years, 10 months ago) by ad
Branches: ad-namecache
Diff to: previous 1.39.2.1: preferred, colored; branchpoint 1.39: preferred, colored; next MAIN 1.40: preferred, colored
Changes since revision 1.39.2.1: +7 -3 lines
Sync with head.

Revision 1.41: download - view: text, markup, annotated - select for diffs
Sat Jan 25 15:38:24 2020 UTC (4 years, 10 months ago) by ad
Branches: MAIN
CVS tags: is-mlppp-base, is-mlppp, ad-namecache-base3, ad-namecache-base2
Diff to: previous 1.40: preferred, colored
Changes since revision 1.40: +7 -3 lines
cpu_lwp_free() can be called with (l != curlwp) in error paths, so don't
detonate.

Revision 1.39.2.1: download - view: text, markup, annotated - select for diffs
Fri Jan 17 21:47:28 2020 UTC (4 years, 10 months ago) by ad
Branches: ad-namecache
Diff to: previous 1.39: preferred, colored
Changes since revision 1.39: +2 -11 lines
Sync with head.

Revision 1.40: download - view: text, markup, annotated - select for diffs
Sun Jan 12 13:01:11 2020 UTC (4 years, 11 months ago) by ad
Branches: MAIN
CVS tags: ad-namecache-base1
Diff to: previous 1.39: preferred, colored
Changes since revision 1.39: +2 -11 lines
x86 pmap:

- It turns out that every page the pmap frees is necessarily zeroed.  Tell
  the VM system about this and use the pmap as a source of pre-zeroed pages.

- Redo deferred freeing of PTPs more elegantly, including the integration with
  pmap_remove_all().  This fixes problems with nvmm, and possibly also a crash
  discovered during fuzzing.

Reported-by: syzbot+a97186518c84f1d85c0c@syzkaller.appspotmail.com

Revision 1.39: download - view: text, markup, annotated - select for diffs
Fri Oct 18 16:26:38 2019 UTC (5 years, 1 month ago) by maxv
Branches: MAIN
CVS tags: phil-wifi-20191119, ad-namecache-base
Branch point for: ad-namecache
Diff to: previous 1.38: preferred, colored
Changes since revision 1.38: +4 -12 lines
Remove unused call to savectx().

Revision 1.38: download - view: text, markup, annotated - select for diffs
Sat Oct 12 06:31:04 2019 UTC (5 years, 2 months ago) by maxv
Branches: MAIN
Diff to: previous 1.37: preferred, colored
Changes since revision 1.37: +6 -15 lines
Rewrite the FPU code on x86. This greatly simplifies the logic and removes
the dependency on IPL_HIGH. NVMM is updated accordingly. Posted on
port-amd64 a week ago.

Bump the kernel version to 9.99.16.

Revision 1.34.2.1: download - view: text, markup, annotated - select for diffs
Mon Jun 10 22:06:54 2019 UTC (5 years, 6 months ago) by christos
Branches: phil-wifi
Diff to: previous 1.34: preferred, colored
Changes since revision 1.34: +11 -7 lines
Sync with HEAD

Revision 1.37: download - view: text, markup, annotated - select for diffs
Mon Feb 11 14:59:33 2019 UTC (5 years, 10 months ago) by cherry
Branches: MAIN
CVS tags: phil-wifi-20190609, netbsd-9-base, netbsd-9-4-RELEASE, netbsd-9-3-RELEASE, netbsd-9-2-RELEASE, netbsd-9-1-RELEASE, netbsd-9-0-RELEASE, netbsd-9-0-RC2, netbsd-9-0-RC1, netbsd-9, isaki-audio2-base, isaki-audio2
Diff to: previous 1.36: preferred, colored
Changes since revision 1.36: +3 -3 lines
We reorganise definitions for XEN source support as follows:

XEN - common sources required for baseline XEN support.
XENPV - sources required for support of XEN in PV mode.
XENPVHVM - sources required for support for XEN in HVM mode.
XENPVH - sources required for support for XEN in PVH mode.

Revision 1.32.2.3: download - view: text, markup, annotated - select for diffs
Sat Jul 28 04:37:42 2018 UTC (6 years, 4 months ago) by pgoyette
Branches: pgoyette-compat
CVS tags: pgoyette-compat-merge-20190127
Diff to: previous 1.32.2.2: preferred, colored; branchpoint 1.32: preferred, colored; next MAIN 1.33: preferred, colored
Changes since revision 1.32.2.2: +10 -6 lines
Sync with HEAD

Revision 1.36: download - view: text, markup, annotated - select for diffs
Thu Jul 26 09:29:08 2018 UTC (6 years, 4 months ago) by maxv
Branches: MAIN
CVS tags: pgoyette-compat-20190127, pgoyette-compat-20190118, pgoyette-compat-1226, pgoyette-compat-1126, pgoyette-compat-1020, pgoyette-compat-0930, pgoyette-compat-0906, pgoyette-compat-0728
Diff to: previous 1.35: preferred, colored
Changes since revision 1.35: +7 -3 lines
Rework dbregs, to switch the registers during context switches, and not on
each user->kernel transition via userret. Reloads of DR6/DR7 are expensive
on both native and xen.

Revision 1.35: download - view: text, markup, annotated - select for diffs
Sun Jul 1 08:32:41 2018 UTC (6 years, 5 months ago) by maxv
Branches: MAIN
Diff to: previous 1.34: preferred, colored
Changes since revision 1.34: +5 -5 lines
Use a variable-sized memcpy, instead of copying the PCB and then adding
the extra bytes. The PCB embeds the biggest static FPU state, but our
real FPU state may be smaller (FNSAVE), so we don't need to memcpy the
extra unused bytes.

Revision 1.32.2.2: download - view: text, markup, annotated - select for diffs
Mon Jun 25 07:25:47 2018 UTC (6 years, 5 months ago) by pgoyette
Branches: pgoyette-compat
Diff to: previous 1.32.2.1: preferred, colored; branchpoint 1.32: preferred, colored
Changes since revision 1.32.2.1: +6 -2 lines
Sync with HEAD

Revision 1.28.6.4: download - view: text, markup, annotated - select for diffs
Sat Jun 23 11:39:02 2018 UTC (6 years, 5 months ago) by martin
Branches: netbsd-8
CVS tags: netbsd-8-3-RELEASE, netbsd-8-2-RELEASE, netbsd-8-1-RELEASE, netbsd-8-1-RC1, netbsd-8-0-RELEASE, netbsd-8-0-RC2
Diff to: previous 1.28.6.3: preferred, colored; branchpoint 1.28: preferred, colored; next MAIN 1.29: preferred, colored
Changes since revision 1.28.6.3: +6 -2 lines
Pull up the following, via patch, requested by maxv in ticket #897:

	sys/arch/amd64/amd64/locore.S           1.166 (patch)
	sys/arch/i386/i386/locore.S             1.157 (patch)
	sys/arch/x86/include/cpu.h              1.92 (patch)
	sys/arch/x86/include/fpu.h              1.9 (patch)
	sys/arch/x86/x86/fpu.c                  1.33-1.39 (patch)
	sys/arch/x86/x86/identcpu.c             1.72 (patch)
	sys/arch/x86/x86/vm_machdep.c           1.34 (patch)
	sys/arch/x86/x86/x86_machdep.c          1.116,1.117 (patch)

Support eager fpu switch, to work around INTEL-SA-00145.
Provide a sysctl machdep.fpu_eager, which gets automatically
initialized to 1 on affected CPUs.

Revision 1.34: download - view: text, markup, annotated - select for diffs
Tue Jun 19 07:23:44 2018 UTC (6 years, 5 months ago) by maxv
Branches: MAIN
CVS tags: phil-wifi-base, pgoyette-compat-0625
Branch point for: phil-wifi
Diff to: previous 1.33: preferred, colored
Changes since revision 1.33: +6 -2 lines
Explicitly clear l2's pcb_fpcpu when forking.

A context switch (preemption) could occur between

	fpusave_lwp(l1, true);
and
	memcpy(pcb2, pcb1, sizeof(struct pcb));

In this case, l1's FPU state is re-installed on the current CPU, and
pcb1->pcb_fpcpu becomes non NULL. While it's fine to have l1's state
installed, we don't want to indicate l2's state is installed too.

With lazy fpu this was not a problem, because the context-switch would
not re-install the state, so pcb1->pcb_fpcpu was NULL.

Should fix PR/53383.

Revision 1.28.6.3: download - view: text, markup, annotated - select for diffs
Thu Mar 22 16:59:04 2018 UTC (6 years, 8 months ago) by martin
Branches: netbsd-8
CVS tags: netbsd-8-0-RC1
Diff to: previous 1.28.6.2: preferred, colored; branchpoint 1.28: preferred, colored
Changes since revision 1.28.6.2: +10 -3 lines
Pull up the following revisions, requested by maxv in ticket #652:

	sys/arch/amd64/amd64/amd64_trap.S	upto 1.39 (partial, patch)
	sys/arch/amd64/amd64/db_machdep.c	1.6 (patch)
	sys/arch/amd64/amd64/genassym.cf	1.65,1.66,1.67 (patch)
	sys/arch/amd64/amd64/locore.S		upto 1.159 (partial, patch)
	sys/arch/amd64/amd64/machdep.c		1.299-1.302 (patch)
	sys/arch/amd64/amd64/trap.c		upto 1.113 (partial, patch)
	sys/arch/amd64/amd64/amd64/vector.S	upto 1.61 (partial, patch)
	sys/arch/amd64/conf/GENERIC		1.477,1.478 (patch)
	sys/arch/amd64/conf/kern.ldscript	1.26 (patch)
	sys/arch/amd64/include/frameasm.h	upto 1.37 (partial, patch)
	sys/arch/amd64/include/param.h		1.25 (patch)
	sys/arch/amd64/include/pmap.h		1.41,1.43,1.44 (patch)
	sys/arch/x86/conf/files.x86		1.91,1.93 (patch)
	sys/arch/x86/include/cpu.h		1.88,1.89 (patch)
	sys/arch/x86/include/pmap.h		1.75 (patch)
	sys/arch/x86/x86/cpu.c			1.144,1.146,1.148,1.149 (patch)
	sys/arch/x86/x86/pmap.c			upto 1.289 (partial, patch)
	sys/arch/x86/x86/vm_machdep.c		1.31,1.32 (patch)
	sys/arch/x86/x86/x86_machdep.c		1.104,1.106,1.108 (patch)
	sys/arch/x86/x86/svs.c			1.1-1.14
	sys/arch/xen/conf/files.compat		1.30 (patch)

Backport SVS. Not enabled yet.

Revision 1.32.2.1: download - view: text, markup, annotated - select for diffs
Thu Mar 22 01:44:47 2018 UTC (6 years, 8 months ago) by pgoyette
Branches: pgoyette-compat
Diff to: previous 1.32: preferred, colored
Changes since revision 1.32: +2 -57 lines
Synch with HEAD, resolve conflicts

Revision 1.28.6.2: download - view: text, markup, annotated - select for diffs
Sat Mar 17 11:23:18 2018 UTC (6 years, 8 months ago) by martin
Branches: netbsd-8
Diff to: previous 1.28.6.1: preferred, colored; branchpoint 1.28: preferred, colored
Changes since revision 1.28.6.1: +2 -57 lines
Pull up the following revisions, requested by maxv in ticket #637:

	sys/arch/amd64/amd64/process_machdep.c	1.33,1.34,1.35 (patch)
	sys/arch/amd64/include/types.h		1.55 (patch)
	sys/arch/x86/x86/vm_machdep.c		1.33 (patch)

- Reduce the number of places where segment register faults can
  occur.
- Remove __HAVE_CPU_UAREA_ROUTINES.

Revision 1.33: download - view: text, markup, annotated - select for diffs
Fri Mar 16 12:19:35 2018 UTC (6 years, 8 months ago) by maxv
Branches: MAIN
CVS tags: pgoyette-compat-0521, pgoyette-compat-0502, pgoyette-compat-0422, pgoyette-compat-0415, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322
Diff to: previous 1.32: preferred, colored
Changes since revision 1.32: +2 -57 lines
Remove the __HAVE_CPU_UAREA_ROUTINES code from x86.

It was available only in amd64, and I disabled it a few months ago in
order to support SVS. Regardless of SVS this option was questionable,
since it made stack overflows more difficult to detect.

Revision 1.14.6.1: download - view: text, markup, annotated - select for diffs
Mon Feb 19 20:55:44 2018 UTC (6 years, 9 months ago) by snj
Branches: netbsd-6-0
Diff to: previous 1.14: preferred, colored; next MAIN 1.15: preferred, colored
Changes since revision 1.14: +3 -3 lines
Pull up following revision(s) (requested by maxv in ticket #1517):
	sys/arch/amd64/amd64/machdep.c: 1.280 via patch
	sys/arch/amd64/include/segments.h: 1.34 via patch
	sys/arch/i386/i386/machdep.c: 1.800
	sys/arch/i386/include/segments.h: 1.64
	sys/arch/x86/x86/vm_machdep.c: 1.30
Fix a huge privilege separation vulnerability in Xen-amd64.
On amd64 the kernel runs in ring3, like userland, and therefore SEL_KPL
equals SEL_UPL. While Xen can make a distinction between usermode and
kernelmode in %cs, it can't when it comes to iopl. Since we set SEL_KPL
in iopl, Xen sees SEL_UPL, and allows (unprivileged) userland processes
to read and write to the CPU ports.
It is easy, then, to completely escalate privileges; by reprogramming the
PIC, by reading the ATA disks, by intercepting the keyboard interrupts
(keylogger), etc.
Declare IOPL_KPL, set to 1 on Xen-amd64, which allows the kernel to use
the ports but not userland. I didn't test this change on i386, but it
seems fine enough.

Revision 1.14.8.1: download - view: text, markup, annotated - select for diffs
Mon Feb 19 20:54:53 2018 UTC (6 years, 9 months ago) by snj
Branches: netbsd-6-1
Diff to: previous 1.14: preferred, colored; next MAIN 1.15: preferred, colored
Changes since revision 1.14: +3 -3 lines
Pull up following revision(s) (requested by maxv in ticket #1517):
	sys/arch/amd64/amd64/machdep.c: 1.280 via patch
	sys/arch/amd64/include/segments.h: 1.34 via patch
	sys/arch/i386/i386/machdep.c: 1.800
	sys/arch/i386/include/segments.h: 1.64
	sys/arch/x86/x86/vm_machdep.c: 1.30
Fix a huge privilege separation vulnerability in Xen-amd64.
On amd64 the kernel runs in ring3, like userland, and therefore SEL_KPL
equals SEL_UPL. While Xen can make a distinction between usermode and
kernelmode in %cs, it can't when it comes to iopl. Since we set SEL_KPL
in iopl, Xen sees SEL_UPL, and allows (unprivileged) userland processes
to read and write to the CPU ports.
It is easy, then, to completely escalate privileges; by reprogramming the
PIC, by reading the ATA disks, by intercepting the keyboard interrupts
(keylogger), etc.
Declare IOPL_KPL, set to 1 on Xen-amd64, which allows the kernel to use
the ports but not userland. I didn't test this change on i386, but it
seems fine enough.

Revision 1.14.2.1: download - view: text, markup, annotated - select for diffs
Mon Feb 19 20:54:38 2018 UTC (6 years, 9 months ago) by snj
Branches: netbsd-6
Diff to: previous 1.14: preferred, colored; next MAIN 1.15: preferred, colored
Changes since revision 1.14: +3 -3 lines
Pull up following revision(s) (requested by maxv in ticket #1517):
	sys/arch/amd64/amd64/machdep.c: 1.280 via patch
	sys/arch/amd64/include/segments.h: 1.34 via patch
	sys/arch/i386/i386/machdep.c: 1.800
	sys/arch/i386/include/segments.h: 1.64
	sys/arch/x86/x86/vm_machdep.c: 1.30
Fix a huge privilege separation vulnerability in Xen-amd64.
On amd64 the kernel runs in ring3, like userland, and therefore SEL_KPL
equals SEL_UPL. While Xen can make a distinction between usermode and
kernelmode in %cs, it can't when it comes to iopl. Since we set SEL_KPL
in iopl, Xen sees SEL_UPL, and allows (unprivileged) userland processes
to read and write to the CPU ports.
It is easy, then, to completely escalate privileges; by reprogramming the
PIC, by reading the ATA disks, by intercepting the keyboard interrupts
(keylogger), etc.
Declare IOPL_KPL, set to 1 on Xen-amd64, which allows the kernel to use
the ports but not userland. I didn't test this change on i386, but it
seems fine enough.

Revision 1.25.4.2: download - view: text, markup, annotated - select for diffs
Mon Jan 22 19:41:08 2018 UTC (6 years, 10 months ago) by snj
Branches: netbsd-7
CVS tags: netbsd-7-2-RELEASE
Diff to: previous 1.25.4.1: preferred, colored; branchpoint 1.25: preferred, colored; next MAIN 1.26: preferred, colored
Changes since revision 1.25.4.1: +3 -3 lines
Pull up following revision(s) (requested by maxv in ticket #1550):
	sys/arch/amd64/amd64/machdep.c: revision 1.280 via patch
	sys/arch/amd64/include/segments.h: revision 1.34 via patch
	sys/arch/i386/i386/machdep.c: revision 1.800 via patch
	sys/arch/i386/include/segments.h: revision 1.64 via patch
	sys/arch/x86/x86/vm_machdep.c: revision 1.30 via patch
Fix a huge privilege separation vulnerability in Xen-amd64.
On amd64 the kernel runs in ring3, like userland, and therefore SEL_KPL
equals SEL_UPL. While Xen can make a distinction between usermode and
kernelmode in %cs, it can't when it comes to iopl. Since we set SEL_KPL
in iopl, Xen sees SEL_UPL, and allows (unprivileged) userland processes
to read and write to the CPU ports.
It is easy, then, to completely escalate privileges; by reprogramming the
PIC, by reading the ATA disks, by intercepting the keyboard interrupts
(keylogger), etc.
Declare IOPL_KPL, set to 1 on Xen-amd64, which allows the kernel to use
the ports but not userland. I didn't test this change on i386, but it
seems fine enough.

Revision 1.25.4.1.2.1: download - view: text, markup, annotated - select for diffs
Mon Jan 22 19:40:58 2018 UTC (6 years, 10 months ago) by snj
Branches: netbsd-7-1
CVS tags: netbsd-7-1-2-RELEASE
Diff to: previous 1.25.4.1: preferred, colored; next MAIN 1.25.4.2: preferred, colored
Changes since revision 1.25.4.1: +3 -3 lines
Pull up following revision(s) (requested by maxv in ticket #1550):
	sys/arch/amd64/amd64/machdep.c: revision 1.280 via patch
	sys/arch/amd64/include/segments.h: revision 1.34 via patch
	sys/arch/i386/i386/machdep.c: revision 1.800 via patch
	sys/arch/i386/include/segments.h: revision 1.64 via patch
	sys/arch/x86/x86/vm_machdep.c: revision 1.30 via patch
Fix a huge privilege separation vulnerability in Xen-amd64.
On amd64 the kernel runs in ring3, like userland, and therefore SEL_KPL
equals SEL_UPL. While Xen can make a distinction between usermode and
kernelmode in %cs, it can't when it comes to iopl. Since we set SEL_KPL
in iopl, Xen sees SEL_UPL, and allows (unprivileged) userland processes
to read and write to the CPU ports.
It is easy, then, to completely escalate privileges; by reprogramming the
PIC, by reading the ATA disks, by intercepting the keyboard interrupts
(keylogger), etc.
Declare IOPL_KPL, set to 1 on Xen-amd64, which allows the kernel to use
the ports but not userland. I didn't test this change on i386, but it
seems fine enough.

Revision 1.25.8.2: download - view: text, markup, annotated - select for diffs
Mon Jan 22 19:40:25 2018 UTC (6 years, 10 months ago) by snj
Branches: netbsd-7-0
Diff to: previous 1.25.8.1: preferred, colored; branchpoint 1.25: preferred, colored; next MAIN 1.26: preferred, colored
Changes since revision 1.25.8.1: +3 -3 lines
Pull up following revision(s) (requested by maxv in ticket #1550):
	sys/arch/amd64/amd64/machdep.c: revision 1.280 via patch
	sys/arch/amd64/include/segments.h: revision 1.34 via patch
	sys/arch/i386/i386/machdep.c: revision 1.800 via patch
	sys/arch/i386/include/segments.h: revision 1.64 via patch
	sys/arch/x86/x86/vm_machdep.c: revision 1.30 via patch
Fix a huge privilege separation vulnerability in Xen-amd64.
On amd64 the kernel runs in ring3, like userland, and therefore SEL_KPL
equals SEL_UPL. While Xen can make a distinction between usermode and
kernelmode in %cs, it can't when it comes to iopl. Since we set SEL_KPL
in iopl, Xen sees SEL_UPL, and allows (unprivileged) userland processes
to read and write to the CPU ports.
It is easy, then, to completely escalate privileges; by reprogramming the
PIC, by reading the ATA disks, by intercepting the keyboard interrupts
(keylogger), etc.
Declare IOPL_KPL, set to 1 on Xen-amd64, which allows the kernel to use
the ports but not userland. I didn't test this change on i386, but it
seems fine enough.

Revision 1.32: download - view: text, markup, annotated - select for diffs
Thu Jan 18 07:25:34 2018 UTC (6 years, 10 months ago) by maxv
Branches: MAIN
CVS tags: pgoyette-compat-base, pgoyette-compat-0315
Branch point for: pgoyette-compat
Diff to: previous 1.31: preferred, colored
Changes since revision 1.31: +8 -2 lines
Unmap the kernel heap from the user page tables (SVS).

This implementation is optimized and organized in such a way that we
don't need to copy the kernel stack to a safe place during user<->kernel
transitions. We create two VAs that point to the same physical page; one
will be mapped in userland and is offset in order to contain only the
trapframe, the other is mapped in the kernel and maps the entire stack.

Sent on tech-kern@ a week ago.

Revision 1.31: download - view: text, markup, annotated - select for diffs
Thu Jan 11 11:15:34 2018 UTC (6 years, 11 months ago) by maxv
Branches: MAIN
Diff to: previous 1.30: preferred, colored
Changes since revision 1.30: +4 -3 lines
The uarea must always be page-aligned.

Revision 1.28.6.1: download - view: text, markup, annotated - select for diffs
Mon Jan 1 19:09:04 2018 UTC (6 years, 11 months ago) by snj
Branches: netbsd-8
Diff to: previous 1.28: preferred, colored
Changes since revision 1.28: +3 -3 lines
Pull up following revision(s) (requested by maxv in ticket #477):
	sys/arch/amd64/amd64/machdep.c: revision 1.280
	sys/arch/amd64/include/segments.h: revision 1.34
	sys/arch/i386/i386/machdep.c: revision 1.800
	sys/arch/i386/include/segments.h: revision 1.64 via patch
	sys/arch/x86/x86/vm_machdep.c: revision 1.30
Fix a huge privilege separation vulnerability in Xen-amd64.
On amd64 the kernel runs in ring3, like userland, and therefore SEL_KPL
equals SEL_UPL. While Xen can make a distinction between usermode and
kernelmode in %cs, it can't when it comes to iopl. Since we set SEL_KPL
in iopl, Xen sees SEL_UPL, and allows (unprivileged) userland processes
to read and write to the CPU ports.
It is easy, then, to completely escalate privileges; by reprogramming the
PIC, by reading the ATA disks, by intercepting the keyboard interrupts
(keylogger), etc.
Declare IOPL_KPL, set to 1 on Xen-amd64, which allows the kernel to use
the ports but not userland. I didn't test this change on i386, but it
seems fine enough.

Revision 1.30: download - view: text, markup, annotated - select for diffs
Sun Dec 31 08:29:38 2017 UTC (6 years, 11 months ago) by maxv
Branches: MAIN
Diff to: previous 1.29: preferred, colored
Changes since revision 1.29: +3 -3 lines
Fix a huge privilege separation vulnerability in Xen-amd64.

On amd64 the kernel runs in ring3, like userland, and therefore SEL_KPL
equals SEL_UPL. While Xen can make a distinction between usermode and
kernelmode in %cs, it can't when it comes to iopl. Since we set SEL_KPL
in iopl, Xen sees SEL_UPL, and allows (unprivileged) userland processes
to read and write to the CPU ports.

It is easy, then, to completely escalate privileges; by reprogramming the
PIC, by reading the ATA disks, by intercepting the keyboard interrupts
(keylogger), etc.

Declare IOPL_KPL, set to 1 on Xen-amd64, which allows the kernel to use
the ports but not userland. I didn't test this change on i386, but it
seems fine enough.

Revision 1.16.2.2: download - view: text, markup, annotated - select for diffs
Sun Dec 3 11:36:51 2017 UTC (7 years ago) by jdolecek
Branches: tls-maxphys
Diff to: previous 1.16.2.1: preferred, colored; branchpoint 1.16: preferred, colored; next MAIN 1.17: preferred, colored
Changes since revision 1.16.2.1: +21 -1 lines
update from HEAD

Revision 1.25.6.3: download - view: text, markup, annotated - select for diffs
Mon Aug 28 17:51:56 2017 UTC (7 years, 3 months ago) by skrll
Branches: nick-nhusb
Diff to: previous 1.25.6.2: preferred, colored; branchpoint 1.25: preferred, colored; next MAIN 1.26: preferred, colored
Changes since revision 1.25.6.2: +17 -9 lines
Sync with HEAD

Revision 1.29: download - view: text, markup, annotated - select for diffs
Sat Jun 17 07:45:13 2017 UTC (7 years, 5 months ago) by maxv
Branches: MAIN
CVS tags: tls-maxphys-base-20171202, perseant-stdc-iso10646-base, perseant-stdc-iso10646, nick-nhusb-base-20170825
Diff to: previous 1.28: preferred, colored
Changes since revision 1.28: +3 -3 lines
Check (inside), not (!outside). It explains the two install failures
reported between pmap.h::r1.65 and vmparam.h::r1.40.

Revision 1.27.2.1: download - view: text, markup, annotated - select for diffs
Fri Apr 21 16:53:39 2017 UTC (7 years, 7 months ago) by bouyer
Branches: bouyer-socketcan
Diff to: previous 1.27: preferred, colored; next MAIN 1.28: preferred, colored
Changes since revision 1.27: +16 -8 lines
Sync with HEAD

Revision 1.25.10.2: download - view: text, markup, annotated - select for diffs
Mon Mar 20 06:57:22 2017 UTC (7 years, 8 months ago) by pgoyette
Branches: pgoyette-localcount
Diff to: previous 1.25.10.1: preferred, colored; branchpoint 1.25: preferred, colored; next MAIN 1.26: preferred, colored
Changes since revision 1.25.10.1: +16 -8 lines
Sync with HEAD

Revision 1.28: download - view: text, markup, annotated - select for diffs
Thu Feb 23 03:34:22 2017 UTC (7 years, 9 months ago) by kamil
Branches: MAIN
CVS tags: prg-localcount2-base3, prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, prg-localcount2, pgoyette-localcount-20170426, pgoyette-localcount-20170320, netbsd-8-base, matt-nb8-mediatek-base, matt-nb8-mediatek, jdolecek-ncq-base, jdolecek-ncq, bouyer-socketcan-base1
Branch point for: netbsd-8
Diff to: previous 1.27: preferred, colored
Changes since revision 1.27: +16 -8 lines
Introduce PT_GETDBREGS and PT_SETDBREGS in ptrace(2) on i386 and amd64

This interface is modeled after FreeBSD API with the usage.

This replaced previous watchpoint API. The previous one was introduced
recently in NetBSD-current and remove its spurs without any
backward-compatibility.

Design choices for Debug Register accessors:
 - exec() (TRAP_EXEC event) must remove debug registers from LWP
 - debug registers are only per-LWP, not per-process globally
 - debug registers must not be inherited after (v)forking a process
 - debug registers must not be inherited after forking a thread
 - a debugger is responsible to set global watchpoints/breakpoints with the
   debug registers, to achieve this PTRACE_LWP_CREATE/PTRACE_LWP_EXIT event
   monitoring function is designed to be used
 - debug register traps must generate SIGTRAP with si_code TRAP_DBREG
 - debugger is responsible to retrieve debug register state to distinguish
   the exact debug register trap (DR6 is Status Register on x86)
 - kernel must not remove debug register traps after triggering a trap event
   a debugger is responsible to detach this trap with appropriate PT_SETDBREGS
   call (DR7 is Control Register on x86)
 - debug registers must not be exposed in mcontext
 - userland must not be allowed to set a trap on the kernel

Implementation notes on i386 and amd64:
 - the initial state of debug register is retrieved on boot and this value is
   stored in a local copy (initdbregs), this value is used to initialize dbreg
   context after PT_GETDBREGS
 - struct dbregs is stored in pcb as a pointer and by default not initialized
 - reserved registers (DR4-DR5, DR9-DR15) are ignored

Further ideas:
 - restrict this interface with securelevel

Tested on real hardware i386 (Intel Pentium IV) and amd64 (Intel i7).

This commit enables 390 debug register ATF tests in kernel/arch/x86.
All tests are passing.

This commit does not cover netbsd32 compat code. Currently other interface
PT_GET_SIGINFO/PT_SET_SIGINFO is required in netbsd32 compat code in order to
validate reliably PT_GETDBREGS/PT_SETDBREGS.

This implementation does not cover FreeBSD specific defines in their
<x86/reg.h>: DBREG_DR7_LOCAL_ENABLE, DBREG_DR7_GLOBAL_ENABLE, DBREG_DR7_LEN_1
etc. These values tend to be reinvented by each tracer on its own. GNU
Debugger (GDB) works with NetBSD debug registers after adding this patch:

--- gdb/amd64bsd-nat.c.orig	2016-02-10 03:19:39.000000000 +0000
+++ gdb/amd64bsd-nat.c
@@ -167,6 +167,10 @@ amd64bsd_target (void)

 #ifdef HAVE_PT_GETDBREGS

+#ifndef DBREG_DRX
+#define	DBREG_DRX(d,x)	((d)->dr[(x)])
+#endif
+
 static unsigned long
 amd64bsd_dr_get (ptid_t ptid, int regnum)
 {


Another reason to stop introducing unpopular defines covering machine
specific register macros is that these value varies across generations of
the same CPU family.

GDB demo:
  (gdb) c
  Continuing.

  Watchpoint 2: traceme

  Old value = 0
  New value = 16
  main (argc=1, argv=0x7f7fff79fe30) at test.c:8
  8               printf("traceme=%d\n", traceme);

(Currently the GDB interface is not reliable due to NetBSD support bugs)

Sponsored by <The NetBSD Foundation>

Revision 1.25.6.2: download - view: text, markup, annotated - select for diffs
Sun Feb 5 13:40:23 2017 UTC (7 years, 10 months ago) by skrll
Branches: nick-nhusb
Diff to: previous 1.25.6.1: preferred, colored; branchpoint 1.25: preferred, colored
Changes since revision 1.25.6.1: +8 -2 lines
Sync with HEAD

Revision 1.25.12.1: download - view: text, markup, annotated - select for diffs
Wed Jan 18 08:46:26 2017 UTC (7 years, 10 months ago) by skrll
Branches: netbsd-7-nhusb
Diff to: previous 1.25: preferred, colored; next MAIN 1.26: preferred, colored
Changes since revision 1.25: +8 -2 lines
Sync with netbsd-5

Revision 1.25.10.1: download - view: text, markup, annotated - select for diffs
Sat Jan 7 08:56:28 2017 UTC (7 years, 11 months ago) by pgoyette
Branches: pgoyette-localcount
Diff to: previous 1.25: preferred, colored
Changes since revision 1.25: +14 -2 lines
Sync with HEAD.  (Note that most of these changes are simply $NetBSD$
tag issues.)

Revision 1.25.8.1: download - view: text, markup, annotated - select for diffs
Sun Dec 18 07:02:59 2016 UTC (7 years, 11 months ago) by snj
Branches: netbsd-7-0
Diff to: previous 1.25: preferred, colored
Changes since revision 1.25: +8 -2 lines
Pull up following revision(s) (requested by riastradh in ticket #1316):
	sys/arch/x86/x86/pmap.c: revision 1.223
	sys/arch/x86/x86/vm_machdep.c: revision 1.26
	sys/arch/x86/include/pmap.h: revision 1.61
PR/49691: KAMADA Ken'ichi: free deferred ptp mappings if present.
XXX: pullup-7

Revision 1.25.4.1: download - view: text, markup, annotated - select for diffs
Sun Dec 18 07:01:57 2016 UTC (7 years, 11 months ago) by snj
Branches: netbsd-7
CVS tags: netbsd-7-nhusb-base-20170116, netbsd-7-1-RELEASE, netbsd-7-1-RC2, netbsd-7-1-RC1, netbsd-7-1-1-RELEASE
Branch point for: netbsd-7-1
Diff to: previous 1.25: preferred, colored
Changes since revision 1.25: +8 -2 lines
Pull up following revision(s) (requested by riastradh in ticket #1316):
	sys/arch/x86/x86/pmap.c: revision 1.223
	sys/arch/x86/x86/vm_machdep.c: revision 1.26
	sys/arch/x86/include/pmap.h: revision 1.61
PR/49691: KAMADA Ken'ichi: free deferred ptp mappings if present.
XXX: pullup-7

Revision 1.27: download - view: text, markup, annotated - select for diffs
Thu Dec 15 12:04:18 2016 UTC (7 years, 11 months ago) by kamil
Branches: MAIN
CVS tags: pgoyette-localcount-20170107, nick-nhusb-base-20170204, bouyer-socketcan-base
Branch point for: bouyer-socketcan
Diff to: previous 1.26: preferred, colored
Changes since revision 1.26: +8 -2 lines
Add support for hardware assisted watchpoints/breakpoints API in ptrace(2)

Add new ptrace(2) calls:
 - PT_COUNT_WATCHPOINTS - count the number of available hardware watchpoints
 - PT_READ_WATCHPOINT   - read struct ptrace_watchpoint from the kernel state
 - PT_WRITE_WATCHPOINT  - write new struct ptrace_watchpoint state, this
                          includes enabling and disabling watchpoints

The ptrace_watchpoint structure contains MI and MD parts:

typedef struct ptrace_watchpoint {
	int		pw_index;	/* HW Watchpoint ID (count from 0) */
	lwpid_t		pw_lwpid;	/* LWP described */
	struct mdpw	pw_md;		/* MD fields */
} ptrace_watchpoint_t;

For example amd64 defines MD as follows:
struct mdpw {
	void	*md_address;
	int	 md_condition;
	int	 md_length;
};

These calls are protected with the __HAVE_PTRACE_WATCHPOINTS guard.

Tested on amd64, initial support added for i386 and XEN.

Sponsored by <The NetBSD Foundation>

Revision 1.25.6.1: download - view: text, markup, annotated - select for diffs
Mon Dec 5 10:54:59 2016 UTC (8 years ago) by skrll
Branches: nick-nhusb
Diff to: previous 1.25: preferred, colored
Changes since revision 1.25: +8 -2 lines
Sync with HEAD

Revision 1.26: download - view: text, markup, annotated - select for diffs
Tue Nov 8 03:05:36 2016 UTC (8 years, 1 month ago) by christos
Branches: MAIN
CVS tags: nick-nhusb-base-20161204
Diff to: previous 1.25: preferred, colored
Changes since revision 1.25: +8 -2 lines
PR/49691: KAMADA Ken'ichi: free deferred ptp mappings if present.
XXX: pullup-7

Revision 1.16.2.1: download - view: text, markup, annotated - select for diffs
Wed Aug 20 00:03:29 2014 UTC (10 years, 3 months ago) by tls
Branches: tls-maxphys
Diff to: previous 1.16: preferred, colored
Changes since revision 1.16: +16 -22 lines
Rebase to HEAD as of a few days ago.

Revision 1.13.4.3: download - view: text, markup, annotated - select for diffs
Thu May 22 11:40:14 2014 UTC (10 years, 6 months ago) by yamt
Branches: yamt-pagecache
Diff to: previous 1.13.4.2: preferred, colored; branchpoint 1.13: preferred, colored; next MAIN 1.14: preferred, colored
Changes since revision 1.13.4.2: +16 -22 lines
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")

Revision 1.16.4.1: download - view: text, markup, annotated - select for diffs
Sun May 18 17:45:30 2014 UTC (10 years, 6 months ago) by rmind
Branches: rmind-smpnet
Diff to: previous 1.16: preferred, colored; next MAIN 1.17: preferred, colored
Changes since revision 1.16: +16 -22 lines
sync with head

Revision 1.25: download - view: text, markup, annotated - select for diffs
Tue Mar 11 20:55:19 2014 UTC (10 years, 9 months ago) by para
Branches: MAIN
CVS tags: yamt-pagecache-base9, tls-maxphys-base, tls-earlyentropy-base, tls-earlyentropy, rmind-smpnet-nbase, rmind-smpnet-base, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3, pgoyette-localcount-base, pgoyette-localcount-20161104, pgoyette-localcount-20160806, pgoyette-localcount-20160726, nick-nhusb-base-20161004, nick-nhusb-base-20160907, nick-nhusb-base-20160529, nick-nhusb-base-20160422, nick-nhusb-base-20160319, nick-nhusb-base-20151226, nick-nhusb-base-20150921, nick-nhusb-base-20150606, nick-nhusb-base-20150406, nick-nhusb-base, netbsd-7-nhusb-base, netbsd-7-base, netbsd-7-0-RELEASE, netbsd-7-0-RC3, netbsd-7-0-RC2, netbsd-7-0-RC1, netbsd-7-0-2-RELEASE, netbsd-7-0-1-RELEASE, localcount-20160914
Branch point for: pgoyette-localcount, nick-nhusb, netbsd-7-nhusb, netbsd-7-0, netbsd-7
Diff to: previous 1.24: preferred, colored
Changes since revision 1.24: +3 -3 lines
mark a diagnostic only variable

Revision 1.24: download - view: text, markup, annotated - select for diffs
Tue Feb 25 22:16:52 2014 UTC (10 years, 9 months ago) by dsl
Branches: MAIN
Diff to: previous 1.23: preferred, colored
Changes since revision 1.23: +4 -2 lines
Add support for saving the AVX-256 ymm registers during FPU context switches.
Add support for the forthcoming AVX-512 registers.
Code compiled with -mavx seems to work, but I've not tested context
  switches with live ymm registers.
There is a small cost on fork/exec (a larger area is copied/zerod),
  but I don't think the ymm registers are read/written unless they
  have been used.
The code use XSAVE on all cpus, I'm not brave enough to enable XSAVEOPT.

Revision 1.23: download - view: text, markup, annotated - select for diffs
Thu Feb 20 18:19:10 2014 UTC (10 years, 9 months ago) by dsl
Branches: MAIN
Diff to: previous 1.22: preferred, colored
Changes since revision 1.22: +7 -4 lines
Move the amd64 and i386 pcb to the bottom of the uarea, and move the
  kernel stack to the top.
Change the pcb layouts so that fpu save area is at the end and is
  64byte aligned ready for xsave (saving the ymm registers).
Welcome to 6.99.32

Revision 1.22: download - view: text, markup, annotated - select for diffs
Sat Feb 15 10:11:15 2014 UTC (10 years, 9 months ago) by dsl
Branches: MAIN
Diff to: previous 1.21: preferred, colored
Changes since revision 1.21: +4 -9 lines
Remove all references to MDL_USEDFPU and deferred fpu initialisation.
The cost of zeroing the save area on exec is minimal.
This stops the FP registers of a random process being used the first
  time an lwp uses the fpu.
sendsig_siginfo() and get_mcontext() now unconditionally copy the FP
registers.
I'll remove the double-copy for signal handlers soon.
get_mcontext() might have been leaking kernel memory to userspace - and
  may still do so if i386_use_fxsave is false (short copies).

Revision 1.21: download - view: text, markup, annotated - select for diffs
Tue Feb 11 20:17:16 2014 UTC (10 years, 10 months ago) by dsl
Branches: MAIN
Diff to: previous 1.20: preferred, colored
Changes since revision 1.20: +2 -6 lines
Move sys/arch/amd64/amd64/fpu.c and sys/arch/amd64/include/fpu.h
into sys/arch/x86 in preparation for using the same code for i386.

Revision 1.20: download - view: text, markup, annotated - select for diffs
Sun Jan 26 19:16:17 2014 UTC (10 years, 10 months ago) by dsl
Branches: MAIN
Diff to: previous 1.19: preferred, colored
Changes since revision 1.19: +2 -9 lines
Remove support for 'external' floating point units and the MS-DOS
  compatible method of handling floating point exceptions.
Make kernel support for teh fpu non-optional (486SX should still work).
Only 386 cpus support external fpu, and i386 support was removed years ago.
This means that the npx code no longer uses port 0xf0 or interupt 13.
All the "npx at isa" lines go from the configs, arch/i386/isa/npx.c
  is now mandatory for all i386 kernels.
I've renamed npxinit() to fpuinit() and npxinit_cpu() to fpuinit_cpu()
  to match the very similar amd64 functions.
The fpu of the boot cpu is now initialised by a direct call from
  cpu_configure(), this enables FP emulation for a 486SX.
  (for amd64 the cr0 values are set in locore.S and similar).
This fixes a long-standing bug in linux_setregs() - which did not
  save the fpu regsiters if they were active.
I've test booted a single cpu i386 kernel (using anita).
amd64 builds - none of teh changes should affect it.
The i386 XEN kernels build, but I'm not sure where they set cr0, and
  it might have got lost!

Revision 1.19: download - view: text, markup, annotated - select for diffs
Sat Jan 11 17:14:00 2014 UTC (10 years, 11 months ago) by christos
Branches: MAIN
Diff to: previous 1.18: preferred, colored
Changes since revision 1.18: +7 -2 lines
Comment about missing stackframe member initialization (Richard Hansen)

I haven't studied the code, but I'm concerned that not initializing
sf->sf_edi could potentially leak a few bytes of information to a new
userspace process.

Revision 1.18: download - view: text, markup, annotated - select for diffs
Sun Dec 1 01:05:16 2013 UTC (11 years ago) by christos
Branches: MAIN
Diff to: previous 1.17: preferred, colored
Changes since revision 1.17: +25 -1 lines
revert fpu/pcu changes until we figure out what's wrong; they cause random
freezes

Revision 1.17: download - view: text, markup, annotated - select for diffs
Wed Oct 23 20:18:50 2013 UTC (11 years, 1 month ago) by drochner
Branches: MAIN
Diff to: previous 1.16: preferred, colored
Changes since revision 1.16: +3 -27 lines
Use the MI "pcu" framework for bookkeeping of npx/fpu states on x86.
This reduces the amount of MD code enormously, and makes it easier
to implement support for newer CPU features which require more fpu
state, or for fpu usage by the kernel.
For access to FPU state across CPUs, an xcall kthread is used now
rather than a dedicated IPI.
No user visible changes intended.

Revision 1.13.4.2: download - view: text, markup, annotated - select for diffs
Tue Oct 30 17:20:35 2012 UTC (12 years, 1 month ago) by yamt
Branches: yamt-pagecache
CVS tags: yamt-pagecache-tag8
Diff to: previous 1.13.4.1: preferred, colored; branchpoint 1.13: preferred, colored
Changes since revision 1.13.4.1: +3 -6 lines
sync with head

Revision 1.16: download - view: text, markup, annotated - select for diffs
Sun Jul 15 15:17:56 2012 UTC (12 years, 4 months ago) by dsl
Branches: MAIN
CVS tags: yamt-pagecache-base8, yamt-pagecache-base7, yamt-pagecache-base6, riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2, khorben-n900, agc-symver-base, agc-symver
Branch point for: tls-maxphys, rmind-smpnet
Diff to: previous 1.15: preferred, colored
Changes since revision 1.15: +3 -6 lines
Rename MDP_IRET to MDL_IRET since it is an lwp flag, not a proc one.
Add an MDL_COMPAT32 flag to the lwp's md_flags, set it for 32bit lwps
  and use it to force 'return to user' with iret (as is done when
  MDL_IRET is set).
Split the iret/sysret code paths much later.
Remove all the replicated code for 32bit system calls - which was only
  needed so that iret was always used.
frameasm.h for XEN contains '#define swapgs', while XEN probable never
  needs swapgs, this is likely to be confusing.
Add a SWAPGS which is a nop on XEN and swapgs otherwise.
(I've not yet checked all the swapgs in files that include frameasm.h)
Simple x86 programs still work.
Hijack 6.99.9 kernel bump (needed for compat32 modules)

Revision 1.13.4.1: download - view: text, markup, annotated - select for diffs
Tue Apr 17 00:07:06 2012 UTC (12 years, 7 months ago) by yamt
Branches: yamt-pagecache
Diff to: previous 1.13: preferred, colored
Changes since revision 1.13: +65 -17 lines
sync with head

Revision 1.13.8.2: download - view: text, markup, annotated - select for diffs
Fri Feb 24 09:11:37 2012 UTC (12 years, 9 months ago) by mrg
Branches: jmcneill-usbmp
Diff to: previous 1.13.8.1: preferred, colored; branchpoint 1.13: preferred, colored; next MAIN 1.14: preferred, colored
Changes since revision 1.13.8.1: +9 -16 lines
sync to -current.

Revision 1.15: download - view: text, markup, annotated - select for diffs
Sun Feb 19 21:06:35 2012 UTC (12 years, 9 months ago) by rmind
Branches: MAIN
CVS tags: yamt-pagecache-base5, yamt-pagecache-base4, jmcneill-usbmp-base9, jmcneill-usbmp-base8, jmcneill-usbmp-base7, jmcneill-usbmp-base6, jmcneill-usbmp-base5, jmcneill-usbmp-base4, jmcneill-usbmp-base3, jmcneill-usbmp-base10
Diff to: previous 1.14: preferred, colored
Changes since revision 1.14: +9 -16 lines
Remove COMPAT_SA / KERN_SA.  Welcome to 6.99.3!
Approved by core@.

Revision 1.13.8.1: download - view: text, markup, annotated - select for diffs
Sat Feb 18 07:33:37 2012 UTC (12 years, 9 months ago) by mrg
Branches: jmcneill-usbmp
Diff to: previous 1.13: preferred, colored
Changes since revision 1.13: +58 -3 lines
merge to -current.

Revision 1.14: download - view: text, markup, annotated - select for diffs
Sat Jan 21 16:48:57 2012 UTC (12 years, 10 months ago) by chs
Branches: MAIN
CVS tags: netbsd-6-base, netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1, netbsd-6-1-5-RELEASE, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE, netbsd-6-1-1-RELEASE, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, netbsd-6-0-6-RELEASE, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE, netbsd-6-0-2-RELEASE, netbsd-6-0-1-RELEASE, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus, jmcneill-usbmp-base2
Branch point for: netbsd-6-1, netbsd-6-0, netbsd-6
Diff to: previous 1.13: preferred, colored
Changes since revision 1.13: +58 -3 lines
allocate uareas contiguously and access them via the direct map.

Revision 1.10.2.1: download - view: text, markup, annotated - select for diffs
Mon Jun 6 09:07:09 2011 UTC (13 years, 6 months ago) by jruoho
Branches: jruoho-x86intr
Diff to: previous 1.10: preferred, colored; next MAIN 1.11: preferred, colored
Changes since revision 1.10: +7 -6 lines
Sync with HEAD.

Revision 1.1.6.5: download - view: text, markup, annotated - select for diffs
Mon Mar 28 23:04:54 2011 UTC (13 years, 8 months ago) by jym
Branches: jym-xensuspend
Diff to: previous 1.1.6.4: preferred, colored; branchpoint 1.1: preferred, colored; next MAIN 1.2: preferred, colored
Changes since revision 1.1.6.4: +7 -6 lines
Sync with HEAD. TODO before merge:
- shortcut for suspend code in sysmon, when powerd(8) is not running.
Borrow ``xs_watch'' thread context?
- bug hunting in xbd + xennet resume. Rings are currently thrashed upon
resume, so current implementation force flush them on suspend. It's not
really needed.

Revision 1.8.4.2: download - view: text, markup, annotated - select for diffs
Sat Mar 5 20:52:32 2011 UTC (13 years, 9 months ago) by rmind
Branches: rmind-uvmplock
Diff to: previous 1.8.4.1: preferred, colored; branchpoint 1.8: preferred, colored; next MAIN 1.9: preferred, colored
Changes since revision 1.8.4.1: +7 -13 lines
sync with head

Revision 1.11.2.2: download - view: text, markup, annotated - select for diffs
Thu Feb 17 12:00:06 2011 UTC (13 years, 9 months ago) by bouyer
Branches: bouyer-quota2
Diff to: previous 1.11.2.1: preferred, colored; next MAIN 1.12: preferred, colored
Changes since revision 1.11.2.1: +5 -3 lines
Sync with HEAD

Revision 1.13: download - view: text, markup, annotated - select for diffs
Thu Feb 10 14:46:48 2011 UTC (13 years, 10 months ago) by pooka
Branches: MAIN
CVS tags: yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, uebayasi-xip-base7, rmind-uvmplock-nbase, rmind-uvmplock-base, jym-xensuspend-nbase, jym-xensuspend-base, jmcneill-usbmp-pre-base2, jmcneill-usbmp-base, jmcneill-audiomp3-base, jmcneill-audiomp3, cherry-xenmp-base, cherry-xenmp, bouyer-quota2-nbase, bouyer-quota2-base
Branch point for: yamt-pagecache, jmcneill-usbmp
Diff to: previous 1.12: preferred, colored
Changes since revision 1.12: +5 -3 lines
Make vmapbuf() return success/error and make physio deal with a
failure.

Revision 1.11.2.1: download - view: text, markup, annotated - select for diffs
Tue Feb 8 16:19:45 2011 UTC (13 years, 10 months ago) by bouyer
Branches: bouyer-quota2
Diff to: previous 1.11: preferred, colored
Changes since revision 1.11: +4 -3 lines
Sync with HEAD

Revision 1.12: download - view: text, markup, annotated - select for diffs
Sat Feb 5 13:47:57 2011 UTC (13 years, 10 months ago) by yamt
Branches: MAIN
Diff to: previous 1.11: preferred, colored
Changes since revision 1.11: +4 -3 lines
cpu_lwp_free2: add assertions

Revision 1.11: download - view: text, markup, annotated - select for diffs
Tue Jan 18 23:56:48 2011 UTC (13 years, 10 months ago) by matt
Branches: MAIN
Branch point for: bouyer-quota2
Diff to: previous 1.10: preferred, colored
Changes since revision 1.10: +2 -4 lines
Copy PK_32 to p2->p_flag instead of doing it in the cpu_proc_fork hook.

Revision 1.1.6.4: download - view: text, markup, annotated - select for diffs
Sun Oct 24 22:48:20 2010 UTC (14 years, 1 month ago) by jym
Branches: jym-xensuspend
Diff to: previous 1.1.6.3: preferred, colored; branchpoint 1.1: preferred, colored
Changes since revision 1.1.6.3: +19 -20 lines
Sync with HEAD

Revision 1.8.2.2: download - view: text, markup, annotated - select for diffs
Tue Aug 17 06:45:34 2010 UTC (14 years, 3 months ago) by uebayasi
Branches: uebayasi-xip
Diff to: previous 1.8.2.1: preferred, colored; branchpoint 1.8: preferred, colored; next MAIN 1.9: preferred, colored
Changes since revision 1.8.2.1: +0 -7 lines
Sync with HEAD.

Revision 1.1.4.4: download - view: text, markup, annotated - select for diffs
Wed Aug 11 22:52:58 2010 UTC (14 years, 4 months ago) by yamt
Branches: yamt-nfs-mp
Diff to: previous 1.1.4.3: preferred, colored; branchpoint 1.1: preferred, colored; next MAIN 1.2: preferred, colored
Changes since revision 1.1.4.3: +2 -9 lines
sync with head.

Revision 1.10: download - view: text, markup, annotated - select for diffs
Wed Jul 7 01:20:50 2010 UTC (14 years, 5 months ago) by chs
Branches: MAIN
CVS tags: yamt-nfs-mp-base11, yamt-nfs-mp-base10, uebayasi-xip-base6, uebayasi-xip-base5, uebayasi-xip-base4, uebayasi-xip-base3, uebayasi-xip-base2, matt-mips64-premerge-20101231, jruoho-x86intr-base
Branch point for: jruoho-x86intr
Diff to: previous 1.9: preferred, colored
Changes since revision 1.9: +2 -9 lines
implement cpu_lwp_setprivate() on several platforms.

Revision 1.8.4.1: download - view: text, markup, annotated - select for diffs
Sun May 30 05:17:13 2010 UTC (14 years, 6 months ago) by rmind
Branches: rmind-uvmplock
Diff to: previous 1.8: preferred, colored
Changes since revision 1.8: +4 -4 lines
sync with head

Revision 1.8.2.1: download - view: text, markup, annotated - select for diffs
Fri Apr 30 14:39:59 2010 UTC (14 years, 7 months ago) by uebayasi
Branches: uebayasi-xip
Diff to: previous 1.8: preferred, colored
Changes since revision 1.8: +4 -4 lines
Sync with HEAD.

Revision 1.9: download - view: text, markup, annotated - select for diffs
Fri Apr 23 16:07:33 2010 UTC (14 years, 7 months ago) by joerg
Branches: MAIN
CVS tags: uebayasi-xip-base1
Diff to: previous 1.8: preferred, colored
Changes since revision 1.8: +4 -4 lines
Use struct segment_descriptor for pcb_fsd and pcb_gsd instead of int[2].

Revision 1.1.4.3: download - view: text, markup, annotated - select for diffs
Thu Mar 11 15:03:09 2010 UTC (14 years, 9 months ago) by yamt
Branches: yamt-nfs-mp
Diff to: previous 1.1.4.2: preferred, colored; branchpoint 1.1: preferred, colored
Changes since revision 1.1.4.2: +71 -94 lines
sync with head

Revision 1.8: download - view: text, markup, annotated - select for diffs
Sun Nov 29 04:15:43 2009 UTC (15 years ago) by rmind
Branches: MAIN
CVS tags: yamt-nfs-mp-base9, uebayasi-xip-base, matt-premerge-20091211
Branch point for: uebayasi-xip, rmind-uvmplock
Diff to: previous 1.7: preferred, colored
Changes since revision 1.7: +12 -6 lines
Replace l_addr with uvm_lwp_getuarea() in various MD code, mostly cpu_lwp_fork().

Revision 1.7: download - view: text, markup, annotated - select for diffs
Wed Nov 25 13:38:38 2009 UTC (15 years ago) by rmind
Branches: MAIN
Diff to: previous 1.6: preferred, colored
Changes since revision 1.6: +3 -3 lines
Disable kstack red-zone for now, while we decide on a nice way to fix it.

Revision 1.6: download - view: text, markup, annotated - select for diffs
Sat Nov 21 03:11:02 2009 UTC (15 years ago) by rmind
Branches: MAIN
Diff to: previous 1.5: preferred, colored
Changes since revision 1.5: +7 -7 lines
Use lwp_getpcb() on x86 MD code, clean from struct user usage.

Revision 1.5: download - view: text, markup, annotated - select for diffs
Sat Nov 7 07:27:49 2009 UTC (15 years, 1 month ago) by cegger
Branches: MAIN
Diff to: previous 1.4: preferred, colored
Changes since revision 1.4: +3 -3 lines
Add a flags argument to pmap_kenter_pa(9).
Patch showed on tech-kern@ http://mail-index.netbsd.org/tech-kern/2009/11/04/msg006434.html
No objections.

Revision 1.1.6.3: download - view: text, markup, annotated - select for diffs
Sun Nov 1 13:58:19 2009 UTC (15 years, 1 month ago) by jym
Branches: jym-xensuspend
Diff to: previous 1.1.6.2: preferred, colored; branchpoint 1.1: preferred, colored
Changes since revision 1.1.6.2: +61 -90 lines
Sync with HEAD.

Revision 1.4: download - view: text, markup, annotated - select for diffs
Thu Oct 29 09:50:49 2009 UTC (15 years, 1 month ago) by yamt
Branches: MAIN
Diff to: previous 1.3: preferred, colored
Changes since revision 1.3: +3 -3 lines
fix a typo in a comment.

Revision 1.3: download - view: text, markup, annotated - select for diffs
Tue Oct 27 03:48:59 2009 UTC (15 years, 1 month ago) by rmind
Branches: MAIN
Diff to: previous 1.2: preferred, colored
Changes since revision 1.2: +61 -73 lines
cpu_proc_fork: use pcb1 and pcb2, and thus make routine more readable.
Remove or update outdated comments, add new ones.  Clean-up.

Revision 1.2: download - view: text, markup, annotated - select for diffs
Wed Oct 21 21:12:04 2009 UTC (15 years, 1 month ago) by rmind
Branches: MAIN
Diff to: previous 1.1: preferred, colored
Changes since revision 1.1: +3 -20 lines
Remove uarea swap-out functionality:

- Addresses the issue described in PR/38828.
- Some simplification in threading and sleepq subsystems.
- Eliminates pmap_collect() and, as a side note, allows pmap optimisations.
- Eliminates XS_CTL_DATA_ONSTACK in scsipi code.
- Avoids few scans on LWP list and thus potentially long holds of proc_lock.
- Cuts ~1.5k lines of code.  Reduces amd64 kernel size by ~4k.
- Removes __SWAP_BROKEN cases.

Tested on x86, mips, acorn32 (thanks <mpumford>) and partly tested on
acorn26 (thanks to <bjh21>).

Discussed on <tech-kern>, reviewed by <ad>.

Revision 1.1.6.2: download - view: text, markup, annotated - select for diffs
Wed May 13 17:18:45 2009 UTC (15 years, 7 months ago) by jym
Branches: jym-xensuspend
Diff to: previous 1.1.6.1: preferred, colored; branchpoint 1.1: preferred, colored
Changes since revision 1.1.6.1: +387 -0 lines
Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.

Revision 1.1.4.2: download - view: text, markup, annotated - select for diffs
Mon May 4 08:12:11 2009 UTC (15 years, 7 months ago) by yamt
Branches: yamt-nfs-mp
Diff to: previous 1.1.4.1: preferred, colored; branchpoint 1.1: preferred, colored
Changes since revision 1.1.4.1: +387 -0 lines
sync with head.

Revision 1.1.2.2: download - view: text, markup, annotated - select for diffs
Tue Apr 28 07:34:57 2009 UTC (15 years, 7 months ago) by skrll
Branches: nick-hppapmap
Diff to: previous 1.1.2.1: preferred, colored; branchpoint 1.1: preferred, colored; next MAIN 1.2: preferred, colored
Changes since revision 1.1.2.1: +387 -0 lines
Sync with HEAD.

Revision 1.1.6.1
Mon Mar 30 22:20:55 2009 UTC (15 years, 8 months ago) by jym
Branches: jym-xensuspend
FILE REMOVED
Changes since revision 1.1: +0 -387 lines
file vm_machdep.c was added on branch jym-xensuspend on 2009-05-13 17:18:45 +0000

Revision 1.1.4.1
Mon Mar 30 22:20:55 2009 UTC (15 years, 8 months ago) by yamt
Branches: yamt-nfs-mp
FILE REMOVED
Changes since revision 1.1: +0 -387 lines
file vm_machdep.c was added on branch yamt-nfs-mp on 2009-05-04 08:12:11 +0000

Revision 1.1.2.1
Mon Mar 30 22:20:55 2009 UTC (15 years, 8 months ago) by skrll
Branches: nick-hppapmap
FILE REMOVED
Changes since revision 1.1: +0 -387 lines
file vm_machdep.c was added on branch nick-hppapmap on 2009-04-28 07:34:57 +0000

Revision 1.1: download - view: text, markup, annotated - select for diffs
Mon Mar 30 22:20:55 2009 UTC (15 years, 8 months ago) by rmind
Branches: MAIN
CVS tags: yamt-nfs-mp-base8, yamt-nfs-mp-base7, yamt-nfs-mp-base6, yamt-nfs-mp-base5, yamt-nfs-mp-base4, yamt-nfs-mp-base3, nick-hppapmap-base4, nick-hppapmap-base3, nick-hppapmap-base, jymxensuspend-base
Branch point for: yamt-nfs-mp, nick-hppapmap, jym-xensuspend
Merge i386 and amd64 vm_machdep.c into x86.  No functional changes intended.
Note: some #ifdefs will be removed with macros.

Diff request

This form allows you to request diffs between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.

Log view options

CVSweb <webmaster@jp.NetBSD.org>