Skip site navigation (1)Skip section navigation (2)

CVS log for src/sys/amd64/amd64/exception.S

[BACK] Up to [FreeBSD] / src / sys / amd64 / amd64

Request diff between arbitrary revisions


Keyword substitution: kv
Default branch: MAIN


Revision 1.158.2.1.2.1: download - view: text, markup, annotated - select for diffs
Fri Nov 11 04:20:22 2011 UTC (2 months, 4 weeks ago) by kensmith
Branches: RELENG_9_0
CVS tags: RELENG_9_0_0_RELEASE
Diff to: previous 1.158.2.1: preferred, colored
Changes since revision 1.158.2.1: +0 -0 lines
SVN rev 227445 on 2011-11-11 04:20:22Z by kensmith

Copy stable/9 to releng/9.0 as part of the FreeBSD 9.0-RELEASE release
cycle.

Approved by:	re (implicit)

Revision 1.140.2.13: download - view: text, markup, annotated - select for diffs
Thu Sep 29 00:39:56 2011 UTC (4 months, 1 week ago) by kib
Branches: RELENG_8
Diff to: previous 1.140.2.12: preferred, colored; branchpoint 1.140: preferred, colored; next MAIN 1.141: preferred, colored
Changes since revision 1.140.2.12: +15 -16 lines
SVN rev 225855 on 2011-09-29 00:39:56Z by kib

Merge the optimizations for the syscall entry and leave.

MFC r225474:
Inline the syscallenter() and syscallret(). This reduces the time measured
by the syscall entry speed microbenchmarks by ~10% on amd64.

MFC r225475:
Perform amd64-specific microoptimizations for native syscall entry
sequence. The effect is ~1% on the microbenchmark.

In particular, do not restore registers which are preserved by the
C calling sequence. Align the jump target. Avoid unneeded memory
accesses by calculating some data in syscall entry trampoline.

MFC r225483:
The jump target shall be after the padding, not into it.

MFC r225575:
Microoptimize the return path for the fast syscalls on amd64. Arrange
the code to have the fall-through path to follow the likely target.
Do not use intermediate register to reload user %rsp.

MFC r225576:
Put amd64_syscall() prototype in md_var.h.

Tested by:	 Alexandr Kovalenko <never nevermind kiev ua>

Revision 1.158.2.1: download - view: text, markup, annotated - select for diffs
Fri Sep 23 00:51:37 2011 UTC (4 months, 2 weeks ago) by kensmith
Branches: RELENG_9
CVS tags: RELENG_9_0_BP
Branch point for: RELENG_9_0
Diff to: previous 1.158: preferred, colored
Changes since revision 1.158: +0 -0 lines
SVN rev 225736 on 2011-09-23 00:51:37Z by kensmith

Copy head to stable/9 as part of 9.0-RELEASE release cycle.

Approved by:	re (implicit)

Revision 1.158: download - view: text, markup, annotated - select for diffs
Thu Sep 15 09:53:04 2011 UTC (4 months, 3 weeks ago) by kib
Branches: MAIN
CVS tags: RELENG_9_BP, HEAD
Branch point for: RELENG_9
Diff to: previous 1.157: preferred, colored
Changes since revision 1.157: +10 -10 lines
SVN rev 225575 on 2011-09-15 09:53:04Z by kib

Microoptimize the return path for the fast syscalls on amd64. Arrange
the code to have the fall-through path to follow the likely target.
Do not use intermediate register to reload user %rsp.

Proposed by:	alc
Reviewed by:	alc, jhb
Approved by:	re (bz)
MFC after:	2 weeks

Revision 1.157: download - view: text, markup, annotated - select for diffs
Sun Sep 11 18:00:46 2011 UTC (4 months, 4 weeks ago) by kib
Branches: MAIN
Diff to: previous 1.156: preferred, colored
Changes since revision 1.156: +2 -1 lines
SVN rev 225483 on 2011-09-11 18:00:46Z by kib

The jump target shall be after the padding, not into it.

Reported by:	alc
Approved by:	re (bz)
MFC after:	2 weeks

Revision 1.156: download - view: text, markup, annotated - select for diffs
Sun Sep 11 16:08:10 2011 UTC (4 months, 4 weeks ago) by kib
Branches: MAIN
Diff to: previous 1.155: preferred, colored
Changes since revision 1.155: +6 -8 lines
SVN rev 225475 on 2011-09-11 16:08:10Z by kib

Perform amd64-specific microoptimizations for native syscall entry
sequence. The effect is ~1% on the microbenchmark.

In particular, do not restore registers which are preserved by the
C calling sequence. Align the jump target. Avoid unneeded memory
accesses by calculating some data in syscall entry trampoline.

Reviewed by:	jhb
Approved by:	re (bz)
MFC after:	2 weeks

Revision 1.140.2.12: download - view: text, markup, annotated - select for diffs
Mon Apr 18 18:55:27 2011 UTC (9 months, 3 weeks ago) by jhb
Branches: RELENG_8
Diff to: previous 1.140.2.11: preferred, colored; branchpoint 1.140: preferred, colored
Changes since revision 1.140.2.11: +37 -4 lines
SVN rev 220797 on 2011-04-18 18:55:27Z by jhb

MFC 220430,220431,220452,220460:
If a system call does not request a full interrupt return, use a fast
path via the sysretq instruction to return from the system call.  This
resolves most of the performance regression in system call microbenchmarks
between 7 and 8 on amd64.

While here, trim an instruction (and memory access) from the doreti path
and fix a typo in a comment.

Revision 1.155: download - view: text, markup, annotated - select for diffs
Fri Apr 8 21:26:50 2011 UTC (10 months ago) by kib
Branches: MAIN
Diff to: previous 1.154: preferred, colored
Changes since revision 1.154: +2 -1 lines
SVN rev 220460 on 2011-04-08 21:26:50Z by kib

Disable local interrupts before testing the PCB_FULL_IRET flag.
Thread might be preempted after testing, which causes the flag to be
cleared. If ast was not delivered, we will do sysret with potentially
wrong fs/gs bases.

Reviewed by:	jhb, jkim
MFC after:	1 week (together with r220430, r220452)

Revision 1.154: download - view: text, markup, annotated - select for diffs
Fri Apr 8 13:33:57 2011 UTC (10 months ago) by jhb
Branches: MAIN
Diff to: previous 1.153: preferred, colored
Changes since revision 1.153: +5 -6 lines
SVN rev 220452 on 2011-04-08 13:33:57Z by jhb

Fix a bug in the previous change to restore the fast path for syscall
return.  The ast() function may cause a context switch in which case
PCB_FULL_IRET would be set in the pcb.  However, the code was not
rechecking the flag after ast() returned and would not properly restore
the FSBASE and GSBASE MSRs.  To fix, recheck the PCB_FULL_IRET flag after
ast() returns.

While here, trim an instruction (and memory access) from the doreti path
and fix a typo in a comment.

MFC after:	1 week

Revision 1.153: download - view: text, markup, annotated - select for diffs
Thu Apr 7 23:13:22 2011 UTC (10 months ago) by jhb
Branches: MAIN
Diff to: previous 1.152: preferred, colored
Changes since revision 1.152: +1 -1 lines
SVN rev 220431 on 2011-04-07 23:13:22Z by jhb

pcb_flags is an int, so use testl rather than testq.

Pointy hat to:	jhb
Submitted by:	jkim
MFC after:	1 week

Revision 1.152: download - view: text, markup, annotated - select for diffs
Thu Apr 7 21:32:25 2011 UTC (10 months ago) by jhb
Branches: MAIN
Diff to: previous 1.151: preferred, colored
Changes since revision 1.151: +33 -0 lines
SVN rev 220430 on 2011-04-07 21:32:25Z by jhb

If a system call does not request a full interrupt return, use a fast
path via the sysretq instruction to return from the system call.  This was
removed in 190620 and not quite fully restored in 195486.  This resolves
most of the performance regression in system call microbenchmarks between
7 and 8 on amd64.

Reviewed by:	kib
MFC after:	1 week

Revision 1.140.2.11: download - view: text, markup, annotated - select for diffs
Wed Mar 2 19:09:49 2011 UTC (11 months, 1 week ago) by jkim
Branches: RELENG_8
Diff to: previous 1.140.2.10: preferred, colored; branchpoint 1.140: preferred, colored
Changes since revision 1.140.2.10: +7 -7 lines
SVN rev 219187 on 2011-03-02 19:09:49Z by jkim

MFC:	r216634, r216673

Improve PCB flags handling and make it more robust.  Add two new functions
for manipulating pcb_flags.  These inline functions are very similar to
atomic_set_int(9) and atomic_clear_int(9) but without unnecessary LOCK
prefix for SMP.  Add comments about the rationale.  Use these functions
wherever possible.  Although there are some places where it is not strictly
necessary (e.g., a PCB is copied to create a new PCB), it is done across
the board for sake of consistency.  Turn pcb_full_iret into a PCB flag as
it is safe now.  Move rarely used fields before pcb_flags and reduce size
of pcb_flags to four bytes.  Fix some style(9) nits in pcb.h while I am in
the neighborhood.

Revision 1.140.2.10: download - view: text, markup, annotated - select for diffs
Mon Feb 28 23:28:35 2011 UTC (11 months, 1 week ago) by rwatson
Branches: RELENG_8
Diff to: previous 1.140.2.9: preferred, colored; branchpoint 1.140: preferred, colored
Changes since revision 1.140.2.9: +4 -0 lines
SVN rev 219107 on 2011-02-28 23:28:35Z by rwatson

Merge userspace DTrace support from head to stable/8:

r209721:

  Merge from vendor-sys/opensolaris:
  * add fasttrap files

r209731:

  Introduce USD_{SET,GET}{BASE,LIMIT}. These help setting up the user
  segment descriptor hi and lo values. Idea from Solaris.

  Reviewed by:  kib

r209763:

  Fix style issues with the previous commit, namely
  use-tab-instead-of-space and don't use underscores in macro variables.

  Pointed out by:       bde

r210292:

  Fix typo in comment.

r210357:

  MFamd64:
    Add USD_GETBASE(), USD_SETBASE(), USD_GETLIMIT() and USD_SETLIMIT().

r210611:

  Bump the witness pendlist to 768 to accomodate the increased number of
  spinlocks.

r211553:

  Add sysname to struct opensolaris_utsname. This is needed by one DTrace
  test.

r211566:

  Add a sysname char * to struct opensolaris_utsname.

r211606:

  Add the FreeBSD definition for the fasttrap ioctls.

r211607:

  Add a function compatibility function dtrace_instr_size_isa() that on
  FreeBSD does the same as dtrace_dis_isize().

r211608:

  Kernel DTrace support for:
  o uregs  (sson@)
  o ustack (sson@)
  o /dev/dtrace/helper device (needed for USDT probes)

r211610:

  Add more compatibility structure members needed by the upcoming fasttrap
  DTrace device.

r211611:

  Destroy the helper device when unloading.

r211613:

  Fix style issues.

r211614:

  Bump KDTRACE_THREAD_ZERO and use M_ZERO as a malloc flag instead of
  calling bzero.

r211615:

  Remove an elif and add an or-clause.

r211616:

  Add an extra comment to the SDT probes definition. This allows us to get
  use '-' in probe names, matching the probe names in Solaris.

  Add userland SDT probes definitions to sys/sdt.h.

r211617:

  Call the systrace_probe_func() when the error value.

r211618:

  Port this to FreeBSD. We miss some suword functions, so we use copyout.

r211738:

  Port the fasttrap provider to FreeBSD. This provider is responsible for
  injecting debugging probes in the userland programs and is the basis for
  the pid provider and the usdt provider.

r211744:

  MD fasttrap implementation.

r211745:

  Replace a pksignal() call with tdksignal().

  Pointed out by:       kib

r211746:

  Update for the recent location of the fasttrap code.

r211747:

  Replace structure assignments with explicity memcpy calls. This allows
  Clang to compile this file: it was using the builtin memcpy and we want
  to use the memcpy defined in gptboot.c. (Clang can't compile boot2 yet).

  Submitted by: Dimitry Andric <dimitry at andric.com>
  Reviewed by:  jhb

r211751:

  Add a trap code for DTrace induced traps.

r211752:

  Add two DTrace trap type values. Used by fasttrap.

r211753:

  Enable fasttrap and make dtraceall depend on fasttrap when building i386
  or amd64.

r211804:

  Call the necessary DTrace function pointers when we have different kinds
  of traps.

r211813:

  Add the necessary DTrace function pointers.

r211839:

  Sync DTrace bits with amd64 and fix the build.

r211924:

  Register an interrupt vector for DTrace return probes. There is some
  code missing in lapic to make sure that we don't overwrite this entry,
  but this will be done on a sequent commit.

r211925:

  Replace a memory barrier with a mutex barrier.

r211926:

  Add the path necessary to find fasttrap_isa.h to CFLAGS.

r211929:

  Remove debugging.

r212004:

  When DTrace is enabled, make sure we don't overwrite the IDT_DTRACE_RET
  entry with an IRQ for some hardware component.

  Reviewed by:  jhb

r212093:

  Make the /dev/dtrace/helper node have the mode 0660. This allows
  programs that refuse to run as root (pgsql) to install probes when their
  user is part of the wheel group.

r212357:

  Fix two bugs in DTrace:
  * when the process exits, remove the associated USDT probes
  * when the process forks, duplicate the USDT probes.

r212465:

  Avoid a LOR (sleepable after non-sleepable) in
  fasttrap_tracepoint_enable().

r212494:

  Revamp locking a bit. This fixes three problems:
  * processes now can't go away while we are inserting probes (fixes a panic)
  * if a trap happens, we won't be holding the process lock (fixes a hang)
  * fix a LOR between the process lock and the fasttrap bucket list lock

  Thanks to kib for pointing some problems.

r212568:

  Bump __FreeBSD_version to reflect the userland DTrace changes

Sponsored by:                   The FreeBSD Foundation
Userspace DTrace work by:       rpaulo

Revision 1.151: download - view: text, markup, annotated - select for diffs
Wed Dec 22 19:57:03 2010 UTC (13 months, 2 weeks ago) by jkim
Branches: MAIN
Diff to: previous 1.150: preferred, colored
Changes since revision 1.150: +6 -6 lines
SVN rev 216673 on 2010-12-22 19:57:03Z by jkim

Increase size of pcb_flags to four bytes.

Requested by:	bde, jhb

Revision 1.150: download - view: text, markup, annotated - select for diffs
Wed Dec 22 00:18:42 2010 UTC (13 months, 2 weeks ago) by jkim
Branches: MAIN
Diff to: previous 1.149: preferred, colored
Changes since revision 1.149: +7 -7 lines
SVN rev 216634 on 2010-12-22 00:18:42Z by jkim

Improve PCB flags handling and make it more robust.  Add two new functions
for manipulating pcb_flags.  These inline functions are very similar to
atomic_set_char(9) and atomic_clear_char(9) but without unnecessary LOCK
prefix for SMP.  Add comments about the rationale[1].  Use these functions
wherever possible.  Although there are some places where it is not strictly
necessary (e.g., a PCB is copied to create a new PCB), it is done across
the board for sake of consistency.  Turn pcb_full_iret into a PCB flag as
it is safe now.  Move rarely used fields before pcb_flags and reduce size
of pcb_flags to one byte.  Fix some style(9) nits in pcb.h while I am in
the neighborhood.

Reviewed by:	kib
Submitted by:	kib[1]
MFC after:	2 months

Revision 1.129.2.5.4.1: download - view: text, markup, annotated - select for diffs
Tue Dec 21 17:10:29 2010 UTC (13 months, 2 weeks ago) by kensmith
Branches: RELENG_7_4
CVS tags: RELENG_7_4_0_RELEASE
Diff to: previous 1.129.2.5: preferred, colored; next MAIN 1.130: preferred, colored
Changes since revision 1.129.2.5: +0 -0 lines
SVN rev 216618 on 2010-12-21 17:10:29Z by kensmith

Copy stable/7 to releng/7.4 in preparation for FreeBSD-7.4 release.

Approved by:	re (implicit)

Revision 1.140.2.9.2.1: download - view: text, markup, annotated - select for diffs
Tue Dec 21 17:09:25 2010 UTC (13 months, 2 weeks ago) by kensmith
Branches: RELENG_8_2
CVS tags: RELENG_8_2_0_RELEASE
Diff to: previous 1.140.2.9: preferred, colored; next MAIN 1.140.2.10: preferred, colored
Changes since revision 1.140.2.9: +0 -0 lines
SVN rev 216617 on 2010-12-21 17:09:25Z by kensmith

Copy stable/8 to releng/8.2 in preparation for FreeBSD-8.2 release.

Approved by:	re (implicit)

Revision 1.140.2.9: download - view: text, markup, annotated - select for diffs
Wed Dec 15 15:23:25 2010 UTC (13 months, 3 weeks ago) by kib
Branches: RELENG_8
CVS tags: RELENG_8_2_BP
Branch point for: RELENG_8_2
Diff to: previous 1.140.2.8: preferred, colored; branchpoint 1.140: preferred, colored
Changes since revision 1.140.2.8: +0 -1 lines
SVN rev 216457 on 2010-12-15 15:23:25Z by kib

MFC r216253:
Retire write-only PCB_FULLCTX pcb flag on amd64.

Approved by:	re (bz)

Revision 1.149: download - view: text, markup, annotated - select for diffs
Tue Dec 7 12:17:43 2010 UTC (14 months ago) by kib
Branches: MAIN
Diff to: previous 1.148: preferred, colored
Changes since revision 1.148: +0 -1 lines
SVN rev 216253 on 2010-12-07 12:17:43Z by kib

Retire write-only PCB_FULLCTX pcb flag on amd64.

Reminded by:	Petr Salinger <Petr.Salinger seznam cz>
Tested by:	pho
MFC after:	1 week

Revision 1.140.2.8: download - view: text, markup, annotated - select for diffs
Tue Nov 9 01:57:56 2010 UTC (15 months ago) by attilio
Branches: RELENG_8
Diff to: previous 1.140.2.7: preferred, colored; branchpoint 1.140: preferred, colored
Changes since revision 1.140.2.7: +1 -1 lines
SVN rev 215026 on 2010-11-09 01:57:56Z by attilio

MFC r204309, r204313 and r204319 by nyan:
Introduce the x86 subtree for code shared between amd64, i386 and pc98.

Differently from the HEAD version, the headers are not moved around,
in order to avoid breaking the KPI but it can be eventually done once the
core mechanism of r214629 is MFCed.

MFCing this patch does allow for simpler MFCs handling on i386/amd64
specific code.

Sponsored by:   Sandvine Incorporated

Revision 1.148: download - view: text, markup, annotated - select for diffs
Sat Aug 28 08:03:29 2010 UTC (17 months, 1 week ago) by rpaulo
Branches: MAIN
Diff to: previous 1.147: preferred, colored
Changes since revision 1.147: +4 -0 lines
SVN rev 211924 on 2010-08-28 08:03:29Z by rpaulo

Register an interrupt vector for DTrace return probes. There is some
code missing in lapic to make sure that we don't overwrite this entry,
but this will be done on a sequent commit.

Sponsored by:	The FreeBSD Foundation

Revision 1.140.2.7: download - view: text, markup, annotated - select for diffs
Wed Jun 30 11:47:03 2010 UTC (19 months, 1 week ago) by kib
Branches: RELENG_8
Diff to: previous 1.140.2.6: preferred, colored; branchpoint 1.140: preferred, colored
Changes since revision 1.140.2.6: +4 -0 lines
SVN rev 209608 on 2010-06-30 11:47:03Z by kib

MFC r209483:
Clear DF bit in eflags/rflags on the kernel entry.

Revision 1.147: download - view: text, markup, annotated - select for diffs
Wed Jun 23 20:44:07 2010 UTC (19 months, 2 weeks ago) by kib
Branches: MAIN
Diff to: previous 1.146: preferred, colored
Changes since revision 1.146: +4 -0 lines
SVN rev 209483 on 2010-06-23 20:44:07Z by kib

Clear DF bit in eflags/rflags on the kernel entry. The i386 and amd64
ABI specifies the DF should be zero, and newer compilers do not clear
DF before using DF-sensitive instructions.

The DF clearing for signal handlers was done some time ago.

MFC after:	1 week

Revision 1.140.2.6.2.1: download - view: text, markup, annotated - select for diffs
Mon Jun 14 02:09:06 2010 UTC (19 months, 4 weeks ago) by kensmith
Branches: RELENG_8_1
CVS tags: RELENG_8_1_0_RELEASE
Diff to: previous 1.140.2.6: preferred, colored; next MAIN 1.140.2.7: preferred, colored
Changes since revision 1.140.2.6: +0 -0 lines
SVN rev 209145 on 2010-06-14 02:09:06Z by kensmith

Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.

Approved by:	re (implicit)

Revision 1.140.2.6: download - view: text, markup, annotated - select for diffs
Wed May 19 09:32:59 2010 UTC (20 months, 3 weeks ago) by kib
Branches: RELENG_8
CVS tags: RELENG_8_1_BP
Branch point for: RELENG_8_1
Diff to: previous 1.140.2.5: preferred, colored; branchpoint 1.140: preferred, colored
Changes since revision 1.140.2.5: +1 -1 lines
SVN rev 208294 on 2010-05-19 09:32:59Z by kib

MFC r207958:
Route all returns from the interrupts and faults through the doreti_iret
labeled iretq instruction.

MFC r208026:
Do not use .extern.

Revision 1.146: download - view: text, markup, annotated - select for diffs
Wed May 12 10:29:35 2010 UTC (20 months, 4 weeks ago) by kib
Branches: MAIN
Diff to: previous 1.145: preferred, colored
Changes since revision 1.145: +1 -1 lines
SVN rev 207958 on 2010-05-12 10:29:35Z by kib

Route all returns from the interrupts and faults through the doreti_iret
labeled iretq instruction.

Suppose that multithreaded process executes two threads, currently
scheduled on different processors. Let assume that thread A executes
using %cs or %ss pointing into the descriptor from LDT. If IPI comes
which handler does not return by jump to doreti, and meantime thread B
invalidates descriptor pointed to by %cs or %ss, then iretq from IPI
handler could fault.

Routing the return by doreti_iret allows kernel to catch the situation
and recover from it by sending signal to the usermode.

Tested by:	pho
MFC after:	1 week

Revision 1.140.2.5: download - view: text, markup, annotated - select for diffs
Thu May 6 04:57:10 2010 UTC (21 months ago) by kib
Branches: RELENG_8
Diff to: previous 1.140.2.4: preferred, colored; branchpoint 1.140: preferred, colored
Changes since revision 1.140.2.4: +45 -34 lines
SVN rev 207693 on 2010-05-06 04:57:10Z by kib

MFC r207570:
Style and comment adjustements.

Revision 1.145: download - view: text, markup, annotated - select for diffs
Mon May 3 14:30:49 2010 UTC (21 months, 1 week ago) by kib
Branches: MAIN
Diff to: previous 1.144: preferred, colored
Changes since revision 1.144: +45 -34 lines
SVN rev 207570 on 2010-05-03 14:30:49Z by kib

Style and comment adjustements.

Suggested and reviewed by:	bde
MFC after:	3 days

Revision 1.140.2.4: download - view: text, markup, annotated - select for diffs
Sat Apr 17 09:37:08 2010 UTC (21 months, 3 weeks ago) by kib
Branches: RELENG_8
Diff to: previous 1.140.2.3: preferred, colored; branchpoint 1.140: preferred, colored
Changes since revision 1.140.2.3: +0 -1 lines
SVN rev 206748 on 2010-04-17 09:37:08Z by kib

MFC r206623:
ld_gs_base is executing with stack containing only the frame,
temporary pushed %rflags has been popped already.

Revision 1.144: download - view: text, markup, annotated - select for diffs
Wed Apr 14 20:04:55 2010 UTC (21 months, 3 weeks ago) by kib
Branches: MAIN
Diff to: previous 1.143: preferred, colored
Changes since revision 1.143: +0 -1 lines
SVN rev 206623 on 2010-04-14 20:04:55Z by kib

ld_gs_base is executing with stack containing only the frame,
temporary pushed %rflags has been popped already.

Pointy hat to:	kib
MFC after:	3 days

Revision 1.140.2.3: download - view: text, markup, annotated - select for diffs
Tue Apr 13 10:23:03 2010 UTC (21 months, 4 weeks ago) by kib
Branches: RELENG_8
Diff to: previous 1.140.2.2: preferred, colored; branchpoint 1.140: preferred, colored
Changes since revision 1.140.2.2: +28 -2 lines
SVN rev 206554 on 2010-04-13 10:23:03Z by kib

MFC r206459:
Handle a case when non-canonical address is loaded into the fsbase or
gsbase MSR.

Revision 1.143: download - view: text, markup, annotated - select for diffs
Sat Apr 10 18:38:11 2010 UTC (22 months ago) by kib
Branches: MAIN
Diff to: previous 1.142: preferred, colored
Changes since revision 1.142: +28 -2 lines
SVN rev 206459 on 2010-04-10 18:38:11Z by kib

Handle a case when non-canonical address is loaded into the fsbase or
gsbase MSR.

MFC after:	3 days

Revision 1.140.2.2: download - view: text, markup, annotated - select for diffs
Wed Apr 7 02:24:41 2010 UTC (22 months ago) by nwhitehorn
Branches: RELENG_8
Diff to: previous 1.140.2.1: preferred, colored; branchpoint 1.140: preferred, colored
Changes since revision 1.140.2.1: +1 -1 lines
SVN rev 206336 on 2010-04-07 02:24:41Z by nwhitehorn

MFC r205014,205015:

Provide groundwork for 32-bit binary compatibility on non-x86 platforms,
for upcoming 64-bit PowerPC and MIPS support. This renames the COMPAT_IA32
option to COMPAT_FREEBSD32, removes some IA32-specific code from MI parts
of the kernel and enhances the freebsd32 compatibility code to support
big-endian platforms.

This MFC is required for MFCs of later changes to the freebsd32
compatibility from HEAD.

Requested by:	kib

Revision 1.142: download - view: text, markup, annotated - select for diffs
Thu Mar 11 14:49:06 2010 UTC (23 months ago) by nwhitehorn
Branches: MAIN
Diff to: previous 1.141: preferred, colored
Changes since revision 1.141: +1 -1 lines
SVN rev 205014 on 2010-03-11 14:49:06Z by nwhitehorn

Provide groundwork for 32-bit binary compatibility on non-x86 platforms,
for upcoming 64-bit PowerPC and MIPS support. This renames the COMPAT_IA32
option to COMPAT_FREEBSD32, removes some IA32-specific code from MI parts
of the kernel and enhances the freebsd32 compatibility code to support
big-endian platforms.

Reviewed by:	kib, jhb

Revision 1.141: download - view: text, markup, annotated - select for diffs
Thu Feb 25 14:13:39 2010 UTC (23 months, 2 weeks ago) by attilio
Branches: MAIN
Diff to: previous 1.140: preferred, colored
Changes since revision 1.140: +1 -1 lines
SVN rev 204309 on 2010-02-25 14:13:39Z by attilio

Introduce the new kernel sub-tree x86 which should contain all the code
shared and generalized between our current amd64, i386 and pc98.

This is just an initial step that should lead to a more complete effort.
For the moment, a very simple porting of cpufreq modules, BIOS calls and
the whole MD specific ISA bus part is added to the sub-tree but ideally
a lot of code might be added and more shared support should grow.

Sponsored by:	Sandvine Incorporated
Reviewed by:	emaste, kib, jhb, imp
Discussed on:	arch
MFC:		3 weeks

Revision 1.129.2.5.2.1: download - view: text, markup, annotated - select for diffs
Wed Feb 10 00:26:20 2010 UTC (2 years ago) by kensmith
Branches: RELENG_7_3
CVS tags: RELENG_7_3_0_RELEASE
Diff to: previous 1.129.2.5: preferred, colored; next MAIN 1.130: preferred, colored
Changes since revision 1.129.2.5: +0 -0 lines
SVN rev 203736 on 2010-02-10 00:26:20Z by kensmith

Copy stable/7 to releng/7.3 as part of the 7.3-RELEASE process.

Approved by:	re (implicit)

Revision 1.140.2.1.2.1: download - view: text, markup, annotated - select for diffs
Sun Oct 25 01:10:29 2009 UTC (2 years, 3 months ago) by kensmith
Branches: RELENG_8_0
CVS tags: RELENG_8_0_0_RELEASE
Diff to: previous 1.140.2.1: preferred, colored; next MAIN 1.140.2.2: preferred, colored
Changes since revision 1.140.2.1: +0 -0 lines
SVN rev 198460 on 2009-10-25 01:10:29Z by kensmith

Copy stable/8 to releng/8.0 as part of 8.0-RELEASE release procedure.

Approved by:	re (implicit)

Revision 1.140.2.1: download - view: text, markup, annotated - select for diffs
Mon Aug 3 08:13:06 2009 UTC (2 years, 6 months ago) by kensmith
Branches: RELENG_8
CVS tags: RELENG_8_0_BP
Branch point for: RELENG_8_0
Diff to: previous 1.140: preferred, colored
Changes since revision 1.140: +0 -0 lines
SVN rev 196045 on 2009-08-03 08:13:06Z by kensmith

Copy head to stable/8 as part of 8.0 Release cycle.

Approved by:	re (Implicit)

Revision 1.140: download - view: text, markup, annotated - select for diffs
Fri Jul 10 10:29:16 2009 UTC (2 years, 7 months ago) by kib
Branches: MAIN
CVS tags: RELENG_8_BP
Branch point for: RELENG_8
Diff to: previous 1.139: preferred, colored
Changes since revision 1.139: +12 -12 lines
SVN rev 195535 on 2009-07-10 10:29:16Z by kib

When amd64 CPU cannot load segment descriptor during trap return to
usermode, it generates GPF, that is mirrored to user mode as SIGSEGV.
The offending register in mcontext should contain the value loading of
which generated the GPF, and it is so on i386. On amd64, we currently
report segment descriptor in tf_err, while segment register contains the
corrected value loaded by trap handler.

Fix the issue by behaving like i386, reloading segment register in trap
frame after signal frame is pushed onto user stack.

Noted and tested by:	pho
Approved by:	re (kensmith)

Revision 1.139: download - view: text, markup, annotated - select for diffs
Thu Jul 9 09:34:11 2009 UTC (2 years, 7 months ago) by kib
Branches: MAIN
Diff to: previous 1.138: preferred, colored
Changes since revision 1.138: +19 -9 lines
SVN rev 195486 on 2009-07-09 09:34:11Z by kib

Restore the segment registers and segment base MSRs for amd64 syscall
return path only when neither thread was context switched while
executing syscall code nor syscall explicitely modified LDT or MSRs.

Save segment registers in trap handlers before interrupts are enabled,
to not allow context switches to happen before registers are saved.
Use separated byte in pcb for indication of fast/full return, since
pcb_flags are not synchronized with context switches.

The change puts back syscall microbenchmark numbers that were slowed
down after commit of the support for LDT on amd64.

Reviewed by:	jeff
Tested (and tested, and tested ...) by:	pho
Approved by:	re (kensmith)

Revision 1.129.2.5: download - view: text, markup, annotated - select for diffs
Sun Jun 7 10:00:35 2009 UTC (2 years, 8 months ago) by fabient
Branches: RELENG_7
CVS tags: RELENG_7_4_BP, RELENG_7_3_BP
Branch point for: RELENG_7_4, RELENG_7_3
Diff to: previous 1.129.2.4: preferred, colored; branchpoint 1.129: preferred, colored; next MAIN 1.130: preferred, colored
Changes since revision 1.129.2.4: +118 -16 lines
SVN rev 193634 on 2009-06-07 10:00:35Z by fabient

MFC hwpmc framework:

- capture with callchain
- Intel Core 2 support
- Intel Core i7 support
- source code annotate (pmcannotate)
- bug fixes

Reviewed by: jkoshy (mentor)
Approved by: re (gnn)

Revision 1.129.2.4.4.1: download - view: text, markup, annotated - select for diffs
Wed Apr 15 03:14:26 2009 UTC (2 years, 9 months ago) by kensmith
Branches: RELENG_7_2
CVS tags: RELENG_7_2_0_RELEASE
Diff to: previous 1.129.2.4: preferred, colored; next MAIN 1.129.2.5: preferred, colored
Changes since revision 1.129.2.4: +0 -0 lines
SVN rev 191087 on 2009-04-15 03:14:26Z by kensmith

Create releng/7.2 from stable/7 in preparation for 7.2-RELEASE.

Approved by:	re (implicit)

Revision 1.138: download - view: text, markup, annotated - select for diffs
Wed Apr 1 13:09:26 2009 UTC (2 years, 10 months ago) by kib
Branches: MAIN
Diff to: previous 1.137: preferred, colored
Changes since revision 1.137: +147 -50 lines
SVN rev 190620 on 2009-04-01 13:09:26Z by kib

Save and restore segment registers on amd64 when entering and leaving
the kernel on amd64. Fill and read segment registers for mcontext and
signals. Handle traps caused by restoration of the
invalidated selectors.

Implement user-mode creation and manipulation of the process-specific
LDT descriptors for amd64, see sysarch(2).

Implement support for TSS i/o port access permission bitmap for amd64.

Context-switch LDT and TSS. Do not save and restore segment registers on
the context switch, that is handled by kernel enter/leave trampolines
now. Remove segment restore code from the signal trampolines for
freebsd/amd64, freebsd/ia32 and linux/i386 for the same reason.

Implement amd64-specific compat shims for sysarch.

Linuxolator (temporary ?) switched to use gsbase for thread_area pointer.

TODO:
Currently, gdb is not adapted to show segment registers from struct reg.
Also, no machine-depended ptrace command is added to set segment
registers for debugged process.

In collaboration with:	pho
Discussed with:	peter
Reviewed by:	jhb
Linuxolator tested by:	dchagin

Revision 1.137: download - view: text, markup, annotated - select for diffs
Tue Feb 3 09:01:45 2009 UTC (3 years ago) by jkoshy
Branches: MAIN
Diff to: previous 1.136: preferred, colored
Changes since revision 1.136: +52 -25 lines
SVN rev 188065 on 2009-02-03 09:01:45Z by jkoshy

Improve robustness of NMI handling, for NMIs recognized in kernel
mode.

- Make the NMI handler run on its own stack (TSS_IST2).
- Store the GSBASE value for each CPU just before the start of
  each NMI stack, permitting efficient retrieval using %rsp-relative
  addressing.
- For NMIs taken from kernel mode, program MSR_GSBASE explicitly
  since one or both of MSR_GSBASE and MSR_KGSBASE can be potentially
  invalid.  The current contents of MSR_GSBASE are saved and restored
  at exit.
- For NMIs handled from user mode, continue to use 'swapgs' to
  load the per-CPU GSBASE.

Reviewed by:	jeff
Debugging help:	jeff
Tested by:	gnn, Artem Belevich <artemb at gmail dot com>

Revision 1.136: download - view: text, markup, annotated - select for diffs
Wed Jan 14 14:20:08 2009 UTC (3 years ago) by kib
Branches: MAIN
Diff to: previous 1.135: preferred, colored
Changes since revision 1.135: +1 -0 lines
SVN rev 187221 on 2009-01-14 14:20:08Z by kib

Disable interrupts, if they were enabled, before doing swapgs.
Otherwise, interrupt may happen while we run with kernel CS and usermode
gsbase.

Reviewed by:	jeff
MFC after:	1 week

Revision 1.135: download - view: text, markup, annotated - select for diffs
Sun Dec 14 09:06:28 2008 UTC (3 years, 1 month ago) by jkoshy
Branches: MAIN
Diff to: previous 1.134: preferred, colored
Changes since revision 1.134: +4 -4 lines
SVN rev 186076 on 2008-12-14 09:06:28Z by jkoshy

Bug fix: %ebx needs to be preserved in the user callchain capture
path.

Revision 1.134: download - view: text, markup, annotated - select for diffs
Sat Dec 13 13:07:12 2008 UTC (3 years, 1 month ago) by jkoshy
Branches: MAIN
Diff to: previous 1.133: preferred, colored
Changes since revision 1.133: +10 -6 lines
SVN rev 186037 on 2008-12-13 13:07:12Z by jkoshy

- Bug fix: prevent a thread from migrating between CPUs between the
  time it is marked for user space callchain capture in the NMI
  handler and the time the callchain capture callback runs.

- Improve code and control flow clarity by invoking hwpmc(4)'s user
  space callchain capture callback directly from low-level code.

Reviewed by:	jhb (kern/subr_trap.c)
Testing (various patch revisions): gnn,
		Fabien Thomas <fabien dot thomas at netasq dot com>,
		Artem Belevich <artemb at gmail dot com>

Revision 1.129.2.4.2.1: download - view: text, markup, annotated - select for diffs
Tue Nov 25 02:59:29 2008 UTC (3 years, 2 months ago) by kensmith
Branches: RELENG_7_1
CVS tags: RELENG_7_1_0_RELEASE
Diff to: previous 1.129.2.4: preferred, colored; next MAIN 1.129.2.5: preferred, colored
Changes since revision 1.129.2.4: +0 -0 lines
SVN rev 185281 on 2008-11-25 02:59:29Z by kensmith

Create releng/7.1 in preparation for moving into RC phase of 7.1 release
cycle.

Approved by:	re (implicit)

Revision 1.125.2.3.2.1: download - view: text, markup, annotated - select for diffs
Thu Oct 2 02:57:24 2008 UTC (3 years, 4 months ago) by kensmith
Branches: RELENG_6_4
CVS tags: RELENG_6_4_0_RELEASE
Diff to: previous 1.125.2.3: preferred, colored; next MAIN 1.126: preferred, colored
Changes since revision 1.125.2.3: +0 -0 lines
SVN rev 183531 on 2008-10-02 02:57:24Z by kensmith

Create releng/6.4 from stable/6 in preparation for 6.4-RC1.

Approved by:	re (implicit)

Revision 1.129.2.1.2.1: download - view: text, markup, annotated - select for diffs
Wed Sep 3 19:09:47 2008 UTC (3 years, 5 months ago) by simon
Branches: RELENG_7_0
Diff to: previous 1.129.2.1: preferred, colored; next MAIN 1.129.2.2: preferred, colored
Changes since revision 1.129.2.1: +3 -6 lines
SVN rev 182740 on 2008-09-03 19:09:47Z by simon

- Fix amd64 local privilege escalation. [08:07]
- Fix nmount(2) local privilege escalation. [08:08]
- Fix IPv6 remote kernel panics. [08:09]

Fix for [08:07] is merge of r181823.

Submitted by:	kib [08:07], csjp [08:08], bz [08:09]
Reviewed by:	peter [08:07], jhb [08:07]
Reviewed by:	jinmei [08:09], rwatson [08:09]
Approved by:	re (SA blanket)
Approved by:	so (simon)
Security:	FreeBSD-SA-08:07.amd64
Security:	FreeBSD-SA-08:08.nmount
Security:	FreeBSD-SA-08:09.icmp6

Revision 1.125.2.3: download - view: text, markup, annotated - select for diffs
Wed Sep 3 19:09:47 2008 UTC (3 years, 5 months ago) by simon
Branches: RELENG_6
CVS tags: RELENG_6_4_BP
Branch point for: RELENG_6_4
Diff to: previous 1.125.2.2: preferred, colored; branchpoint 1.125: preferred, colored; next MAIN 1.126: preferred, colored
Changes since revision 1.125.2.2: +3 -6 lines
SVN rev 182740 on 2008-09-03 19:09:47Z by simon

- Fix amd64 local privilege escalation. [08:07]
- Fix nmount(2) local privilege escalation. [08:08]
- Fix IPv6 remote kernel panics. [08:09]

Fix for [08:07] is merge of r181823.

Submitted by:	kib [08:07], csjp [08:08], bz [08:09]
Reviewed by:	peter [08:07], jhb [08:07]
Reviewed by:	jinmei [08:09], rwatson [08:09]
Approved by:	re (SA blanket)
Approved by:	so (simon)
Security:	FreeBSD-SA-08:07.amd64
Security:	FreeBSD-SA-08:08.nmount
Security:	FreeBSD-SA-08:09.icmp6

Revision 1.125.2.2.2.1: download - view: text, markup, annotated - select for diffs
Wed Sep 3 19:09:47 2008 UTC (3 years, 5 months ago) by simon
Branches: RELENG_6_3
Diff to: previous 1.125.2.2: preferred, colored; next MAIN 1.125.2.3: preferred, colored
Changes since revision 1.125.2.2: +3 -6 lines
SVN rev 182740 on 2008-09-03 19:09:47Z by simon

- Fix amd64 local privilege escalation. [08:07]
- Fix nmount(2) local privilege escalation. [08:08]
- Fix IPv6 remote kernel panics. [08:09]

Fix for [08:07] is merge of r181823.

Submitted by:	kib [08:07], csjp [08:08], bz [08:09]
Reviewed by:	peter [08:07], jhb [08:07]
Reviewed by:	jinmei [08:09], rwatson [08:09]
Approved by:	re (SA blanket)
Approved by:	so (simon)
Security:	FreeBSD-SA-08:07.amd64
Security:	FreeBSD-SA-08:08.nmount
Security:	FreeBSD-SA-08:09.icmp6

Revision 1.129.2.4: download - view: text, markup, annotated - select for diffs
Wed Aug 27 16:59:42 2008 UTC (3 years, 5 months ago) by jhb
Branches: RELENG_7
CVS tags: RELENG_7_2_BP, RELENG_7_1_BP
Branch point for: RELENG_7_2, RELENG_7_1
Diff to: previous 1.129.2.3: preferred, colored; branchpoint 1.129: preferred, colored
Changes since revision 1.129.2.3: +0 -69 lines
SVN rev 182281 on 2008-08-27 16:59:42Z by jhb

Revert some hwpmc and p_comm vs td_name changes from HEAD that snuck in with
the DTrace commit.

Revision 1.129.2.3: download - view: text, markup, annotated - select for diffs
Wed Aug 27 04:41:15 2008 UTC (3 years, 5 months ago) by jb
Branches: RELENG_7
Diff to: previous 1.129.2.2: preferred, colored; branchpoint 1.129: preferred, colored
Changes since revision 1.129.2.2: +109 -0 lines
SVN rev 182231 on 2008-08-27 04:41:15Z by jb

MFC

DTrace support.

Note that this defaults the 'make buildkernel' to build with CTF data so
that the release kernel and modules are DTrace-able.

Revision 1.129.2.2: download - view: text, markup, annotated - select for diffs
Thu Aug 21 09:58:18 2008 UTC (3 years, 5 months ago) by kib
Branches: RELENG_7
Diff to: previous 1.129.2.1: preferred, colored; branchpoint 1.129: preferred, colored
Changes since revision 1.129.2.1: +3 -6 lines
SVN rev 181961 on 2008-08-21 09:58:18Z by kib

MFC r181823:
Remove the check for mode and conditional swapgs in doreti_iret_fault,
we already have right gs base in the MSR.

Revision 1.133: download - view: text, markup, annotated - select for diffs
Mon Aug 18 08:47:27 2008 UTC (3 years, 5 months ago) by kib
Branches: MAIN
Diff to: previous 1.132: preferred, colored
Changes since revision 1.132: +3 -6 lines
SVN rev 181823 on 2008-08-18 08:47:27Z by kib

The doreti_iret_fault code is always called with gs base MSR containing
kernel gs base, because %rip is adjusted only on kernel-mode trap caused
by iretq execution. On the other hand, the stack contains (hardware
part of) trap frame from the usermode. As a consequence, checking for
frame mode and doing swapgs causes the kernel to enter trap() with
usermode gs base.

Remove the check for mode and conditional swapgs, we already have right
gs base in the MSR.

Submitted by:	Nate Eldredge <neldredge math ucsd edu>
MFC after:	3 days

Revision 1.132: download - view: text, markup, annotated - select for diffs
Sat May 24 06:32:26 2008 UTC (3 years, 8 months ago) by jb
Branches: MAIN
Diff to: previous 1.131: preferred, colored
Changes since revision 1.131: +40 -0 lines
Add the DTrace hooks for exception handling (Function boundary trace
-fbt- provider), cyclic clock and syscalls.

Revision 1.131: download - view: text, markup, annotated - select for diffs
Fri Dec 7 08:20:15 2007 UTC (4 years, 2 months ago) by jkoshy
Branches: MAIN
Diff to: previous 1.130: preferred, colored
Changes since revision 1.130: +69 -0 lines
Kernel and hwpmc(4) support for callchain capture.

Sponsored by:	FreeBSD Foundation and Google Inc.

Revision 1.125.2.2: download - view: text, markup, annotated - select for diffs
Wed Nov 21 16:41:51 2007 UTC (4 years, 2 months ago) by jhb
Branches: RELENG_6
CVS tags: RELENG_6_3_BP, RELENG_6_3_0_RELEASE
Branch point for: RELENG_6_3
Diff to: previous 1.125.2.1: preferred, colored; branchpoint 1.125: preferred, colored
Changes since revision 1.125.2.1: +17 -0 lines
MFC: Add support for debugging double fault frames.

Approved by:	re (kensmith)

Revision 1.129.2.1: download - view: text, markup, annotated - select for diffs
Wed Nov 21 16:38:54 2007 UTC (4 years, 2 months ago) by jhb
Branches: RELENG_7
CVS tags: RELENG_7_0_BP, RELENG_7_0_0_RELEASE
Branch point for: RELENG_7_0
Diff to: previous 1.129: preferred, colored
Changes since revision 1.129: +19 -1 lines
MFC: Add support for debugging double fault frames.

Approved by:	re (kensmith)

Revision 1.130: download - view: text, markup, annotated - select for diffs
Thu Nov 15 22:00:56 2007 UTC (4 years, 2 months ago) by jhb
Branches: MAIN
Diff to: previous 1.129: preferred, colored
Changes since revision 1.129: +19 -1 lines
Add support for cross double fault frames in stack traces:
- Populate the register values for the trapframe put on the stack by the
  double fault handler.
- Teach DDB's trace routine to treat a double fault like other trap frames.

MFC after:	3 days

Revision 1.129: download - view: text, markup, annotated - select for diffs
Sat Dec 23 03:30:50 2006 UTC (5 years, 1 month ago) by davidxu
Branches: MAIN
CVS tags: RELENG_7_BP
Branch point for: RELENG_7
Diff to: previous 1.128: preferred, colored
Changes since revision 1.128: +1 -0 lines
Fix a panic when rebooting a SMP machine, when option STOP_NMI is used,
nmi handler is used to stop other processors, nmi hander calls trap(),
however, trap() now accepts a pointer rather than a reference, this was
changed by kmacy@.

Revision 1.128: download - view: text, markup, annotated - select for diffs
Sun Dec 17 06:48:39 2006 UTC (5 years, 1 month ago) by kmacy
Branches: MAIN
Diff to: previous 1.127: preferred, colored
Changes since revision 1.127: +2 -0 lines
Newer versions of gcc don't support treating structures passed by value
as if they were really passed by reference. Specifically, the dead stores
elimination pass in the GCC 4.1 optimiser breaks the non-compliant behavior
on which FreeBSD relied. This change brings FreeBSD up to date by switching
trap frames to being explicitly passed by reference.

Reviewed by: kan
Tested by: kan

Revision 1.125.2.1: download - view: text, markup, annotated - select for diffs
Sat Sep 3 11:57:28 2005 UTC (6 years, 5 months ago) by jkoshy
Branches: RELENG_6
CVS tags: RELENG_6_2_BP, RELENG_6_2_0_RELEASE, RELENG_6_2, RELENG_6_1_BP, RELENG_6_1_0_RELEASE, RELENG_6_1, RELENG_6_0_BP, RELENG_6_0_0_RELEASE, RELENG_6_0
Diff to: previous 1.125: preferred, colored
Changes since revision 1.125: +76 -2 lines
MFC: { db_trace.c:1.69, exception.S:1.127, genassym.c:1.156, trap.c:1.290 }

- Special-case NMI handling on the AMD64.

  On entry or exit from the kernel the 'alltraps' and 'doreti' the code
  used by normal traps disables interrupts to protect the critical sections
  where it is setting up %gs.

  This protection is insufficient in the presence of NMIs since NMIs
  can be taken even when the processor has disabled normal interrupts.
  Thus the NMI handler needs to actually read MSR_GBASE on entry to
  the kernel to determine whether a swap of %gs using 'swapgs' is
  needed.  However, reads of MSRs are expensive and integrating this
  check into the 'alltraps'/'doreti' path would penalize normal
  interrupts.

- Teach DDB about the 'nmi_calltrap' symbol.

Reviewed by:	bde, peter (an older version) and ups
Approved by:	re (scottl)

Revision 1.127: download - view: text, markup, annotated - select for diffs
Sat Aug 27 16:03:40 2005 UTC (6 years, 5 months ago) by jkoshy
Branches: MAIN
Diff to: previous 1.126: preferred, colored
Changes since revision 1.126: +76 -2 lines
- Special-case NMI handling on the AMD64.

  On entry or exit from the kernel the 'alltraps' and 'doreti' code
  used taken by normal traps disables interrupts to protect the
  critical sections where it is setting up %gs.

  This protection is insufficient in the presence of NMIs since NMIs
  can be taken even when the processor has disabled normal interrupts.
  Thus the NMI handler needs to actually read MSR_GBASE on entry to
  the kernel to determine whether a swap of %gs using 'swapgs' is
  needed.  However, reads of MSRs are expensive and integrating this
  check into the 'alltraps'/'doreti' path would penalize normal
  interrupts.

- Teach DDB about the 'nmi_calltrap' symbol.

Reviewed by:	bde, peter (older versions of this change)

Revision 1.126: download - view: text, markup, annotated - select for diffs
Thu Aug 25 20:33:43 2005 UTC (6 years, 5 months ago) by ups
Branches: MAIN
Diff to: previous 1.125: preferred, colored
Changes since revision 1.125: +1 -1 lines
NMI handler should not enable interrupts.

Tested by: kris@
MFC after:	3 weeks

Revision 1.125: download - view: text, markup, annotated - select for diffs
Thu Jun 30 00:26:54 2005 UTC (6 years, 7 months ago) by peter
Branches: MAIN
CVS tags: RELENG_6_BP
Branch point for: RELENG_6
Diff to: previous 1.124: preferred, colored
Changes since revision 1.124: +26 -3 lines
Add a special-case handler for general protection faults.  It appears to
be possible to get the swapgs state reversed if doreti traps during
the iretq.  Attempt to handle this.  load_gs() might need special
handling too.  Running the kernel with the user's TLS and the
kernel's PCPU space interchanged would be bad(TM).

Discovered as a result of a conversation with:  bde
Approved by:  re

Revision 1.124: download - view: text, markup, annotated - select for diffs
Fri Jun 24 00:38:36 2005 UTC (6 years, 7 months ago) by peter
Branches: MAIN
Diff to: previous 1.123: preferred, colored
Changes since revision 1.123: +1 -1 lines
Eliminate a source of 'trap xx with interrupts disabled'.  I was jumping to
the wrong backend code and neglecting to re-enable interrupts after the
stack prep.

Approved by:  re

Revision 1.120.2.2: download - view: text, markup, annotated - select for diffs
Thu Jun 23 19:46:29 2005 UTC (6 years, 7 months ago) by peter
Branches: RELENG_5
CVS tags: RELENG_5_5_BP, RELENG_5_5_0_RELEASE, RELENG_5_5
Diff to: previous 1.120.2.1: preferred, colored; branchpoint 1.120: preferred, colored; next MAIN 1.121: preferred, colored
Changes since revision 1.120.2.1: +1 -1 lines
Fix a source of 'trap xxx with interrupts disabled'.  This was a cut/pasto.

Revision 1.123: download - view: text, markup, annotated - select for diffs
Sun May 22 23:28:17 2005 UTC (6 years, 8 months ago) by peter
Branches: MAIN
Diff to: previous 1.122: preferred, colored
Changes since revision 1.122: +3 -2 lines
Fix some of the problems Bruce observed with this code.

Revision 1.122: download - view: text, markup, annotated - select for diffs
Sat May 21 00:02:12 2005 UTC (6 years, 8 months ago) by peter
Branches: MAIN
Diff to: previous 1.121: preferred, colored
Changes since revision 1.121: +4 -2 lines
For non-profiling kernels, there were two symbols assigned to the same
address.  One was alltraps_with_regs_pushed, the other was calltrap.

When the stack tracer walks up, it looks for magic symbol names to
determine how to parse non-standard stack frames, such as a trapframe.
It was looking for "calltrap".  Which of the two symbols you got depended
on things like Phase of moon, etc.  If you were unlucky, you got a
garbage stack trace for things like 'debug.trace_on_panic', which would
completely hide the actual source of the problem.

Revision 1.120.2.1: download - view: text, markup, annotated - select for diffs
Sun Jan 30 11:58:12 2005 UTC (7 years ago) by rwatson
Branches: RELENG_5
CVS tags: RELENG_5_4_BP, RELENG_5_4_0_RELEASE, RELENG_5_4
Diff to: previous 1.120: preferred, colored
Changes since revision 1.120: +1 -1 lines
Merge exception.S:1.121 from HEAD to RELENG_5:

  date: 2005/01/21 05:56:40;  author: peter;  state: Exp;  lines: +1 -1
  MFi386: whitespace, copyright header, etc updates

Revision 1.121: download - view: text, markup, annotated - select for diffs
Fri Jan 21 05:56:40 2005 UTC (7 years ago) by peter
Branches: MAIN
Diff to: previous 1.120: preferred, colored
Changes since revision 1.120: +1 -1 lines
MFi386: whitespace, copyright header, etc updates

Revision 1.120: download - view: text, markup, annotated - select for diffs
Mon Aug 16 12:51:32 2004 UTC (7 years, 5 months ago) by obrien
Branches: MAIN
CVS tags: RELENG_5_BP, RELENG_5_3_BP, RELENG_5_3_0_RELEASE, RELENG_5_3
Branch point for: RELENG_5
Diff to: previous 1.119: preferred, colored
Changes since revision 1.119: +2 -2 lines
Complete 'IA32' -> 'COMPAT_IA32' change for the Linuxulator32.

Revision 1.119: download - view: text, markup, annotated - select for diffs
Mon May 24 12:42:16 2004 UTC (7 years, 8 months ago) by bde
Branches: MAIN
Diff to: previous 1.118: preferred, colored
Changes since revision 1.118: +3 -3 lines
Oops, ".align 4" for the data section in the previous commit should
have been ".p2align 4".  This bug is cosmetic since the data section
happens to be empty.

Revision 1.118: download - view: text, markup, annotated - select for diffs
Mon May 24 12:08:56 2004 UTC (7 years, 8 months ago) by bde
Branches: MAIN
Diff to: previous 1.117: preferred, colored
Changes since revision 1.117: +40 -2 lines
Fixed profiling of trap, syscall and interrupt handlers and some
ordinary functions, essentially by backing out half of rev.1.115 of
amd64/exception.S.  The handlers must be between certain labels for
the purposes of profiling, and this was broken by scattering them in
separately compiled .S files, especially for ordinary functions that
ended up between the labels.  Merge the files by #including them as
before, except with different pathnames and better comments and
organization.  Changes to the scattered files are minimal -- just
move the labels to the file that does the #includes.

This also partly fixes profiling of IPIs -- all IPI handlers are now
correctly classified as interrupt handlers, but many are still missing
mcount calls.

Revision 1.117: download - view: text, markup, annotated - select for diffs
Sun May 23 17:18:48 2004 UTC (7 years, 8 months ago) by bde
Branches: MAIN
Diff to: previous 1.116: preferred, colored
Changes since revision 1.116: +8 -0 lines
Restored FAKE_MCOUNT() and MEXITCOUNT invocations and adjusted them for
amd64 as necessary.  This is routine, except:
- the FAKE_MCOUNT($bintr) in doreti was missing the '$'.  This gave a
  a garbage address made up of padding bytes (with the nop byte 0x90 as
  the MSB) instead of the intended address of bintr.  This accidentally
  worked on i386's because (0x90 << 24) is close enough to bintr, but
  it doesn't work on amd64's because (0x90 << 56) is much further away
  from bintr.
- the FAKE_MCOUNT($btrap) in calltrap was similarly broken.  It hasn't
  been needed since FreeBSD-1, so just delete it.

Revision 1.116: download - view: text, markup, annotated - select for diffs
Mon Apr 5 21:25:51 2004 UTC (7 years, 10 months ago) by imp
Branches: MAIN
Diff to: previous 1.115: preferred, colored
Changes since revision 1.115: +0 -4 lines
Remove advertising clause from University of California Regent's license,
per letter dated July 22, 1999.

Approved by: core

Revision 1.115: download - view: text, markup, annotated - select for diffs
Mon Nov 17 08:58:12 2003 UTC (8 years, 2 months ago) by peter
Branches: MAIN
CVS tags: RELENG_5_2_BP, RELENG_5_2_1_RELEASE, RELENG_5_2_0_RELEASE, RELENG_5_2
Diff to: previous 1.114: preferred, colored
Changes since revision 1.114: +1 -16 lines
Initial landing of SMP support for FreeBSD/amd64.

- This is heavily derived from John Baldwin's apic/pci cleanup on i386.
- I have completely rewritten or drastically cleaned up some other parts.
  (in particular, bootstrap)
- This is still a WIP.  It seems that there are some highly bogus bioses
  on nVidia nForce3-150 boards.  I can't stress how broken these boards
  are.  I have a workaround in mind, but right now the Asus SK8N is broken.
  The Gigabyte K8NPro (nVidia based) is also mind-numbingly hosed.
- Most of my testing has been with SCHED_ULE.  SCHED_4BSD works.
- the apic and acpi components are 'standard'.
- If you have an nVidia nForce3-150 board, you are stuck with 'device
  atpic' in addition, because they somehow managed to forget to connect the
  8254 timer to the apic, even though its in the same silicon!  ARGH!
  This directly violates the ACPI spec.

Revision 1.114: download - view: text, markup, annotated - select for diffs
Thu Nov 13 02:38:33 2003 UTC (8 years, 2 months ago) by peter
Branches: MAIN
Diff to: previous 1.113: preferred, colored
Changes since revision 1.113: +0 -7 lines
Stop pretending to support kernel profiling.  The FAKE_MCOUNT() etc
calls are just gradually getting more and more stale.  At this point it
would be better to start from scratch once prof_machdep.c is adapted.

Revision 1.113: download - view: text, markup, annotated - select for diffs
Wed Oct 15 02:04:52 2003 UTC (8 years, 3 months ago) by peter
Branches: MAIN
Diff to: previous 1.112: preferred, colored
Changes since revision 1.112: +1 -1 lines
Pull the tier-2 card one last time and break the get/setcontext and
sigreturn() ABI and the signal context on the stack.

Make the trapframe (and its shadows in the ucontext and sigframe etc)
8 bytes larger in order to preserve 16 byte stack alignment for the
following C code calls.  I could have done some padding after the
trapframe was saved, but some of the C code still expects an argument of
'struct trapframe'.  Anyway, this gives me a spare field that can be used
to store things like 'partial trapframe' status or something else in
the future.

The runtime impact is fairly small, *except* for threaded apps and things
that decode contexts and the signal stack (eg: cvsup binary).  Signal
delivery isn't too badly affected because the kernel generates the
sigframe that sigreturn uses after the handler has been called.

The size of mcontext_t and struct sigframe hasn't changed.  Only
the last few fields (sc_eip etc) got moved a little and I eliminated
a spare field.  mc_len/sc_len did change location though so the
sanity checks there will still trap it.

Revision 1.112: download - view: text, markup, annotated - select for diffs
Mon Sep 22 22:54:14 2003 UTC (8 years, 4 months ago) by peter
Branches: MAIN
Diff to: previous 1.111: preferred, colored
Changes since revision 1.111: +1 -1 lines
MFi386 rev 1.105 by jhb: fix comment typo

Revision 1.111: download - view: text, markup, annotated - select for diffs
Tue Sep 9 19:32:09 2003 UTC (8 years, 5 months ago) by peter
Branches: MAIN
Diff to: previous 1.110: preferred, colored
Changes since revision 1.110: +2 -2 lines
Clean up get/set_mcontext() and get/set_fpcontext().  These are operated
on data structures on the kernel stack which are guaranteed to be 16 byte
aligned by gcc, the amd64 ABI and __aligned(16).

Ensire the tss_rsp0 initial stack pointer is 16 byte aligned in case
sizeof(pcb) becomes odd at some point.  This is convenient for the
interrupt handler case because the ring crossing pushes cause the
required odd alignment before the call to the C code.

Have fast_syscall add an additional 8 bytes to ensure that the trapframe
has the correct odd alignment for the call to C code.  Note that there are
no checks to make sure that the trapframe size is appropriate for this.

This makes get/setfpcontext work properly (finally).  You get a GPF in
kernel mode if any of this is botched without the alignment fixup code
that is apparently needed on i386.

Revision 1.110: download - view: text, markup, annotated - select for diffs
Wed May 14 04:10:47 2003 UTC (8 years, 9 months ago) by peter
Branches: MAIN
CVS tags: RELENG_5_1_BP, RELENG_5_1_0_RELEASE, RELENG_5_1
Diff to: previous 1.109: preferred, colored
Changes since revision 1.109: +1 -34 lines
Add BASIC i386 binary support for the amd64 kernel.  This is largely
stolen from the ia64/ia32 code (indeed there was a repocopy), but I've
redone the MD parts and added and fixed a few essential syscalls.  It
is sufficient to run i386 binaries like /bin/ls, /usr/bin/id (dynamic)
and p4.  The ia64 code has not implemented signal delivery, so I had
to do that.

Before you say it, yes, this does need to go in a common place.  But
we're in a freeze at the moment and I didn't want to risk breaking ia64.
I will sort this out after the freeze so that the common code is in a
common place.

On the AMD64 side, this required adding segment selector context switch
support and some other support infrastructure.  The %fs/%gs etc code
is hairy because loading %gs will clobber the kernel's current MSR_GSBASE
setting.  The segment selectors are not used by the kernel, so they're only
changed at context switch time or when changing modes.  This still needs
to be optimized.

Approved by:	re (amd64/* blanket)

Revision 1.109: download - view: text, markup, annotated - select for diffs
Mon May 12 18:33:19 2003 UTC (8 years, 9 months ago) by peter
Branches: MAIN
Diff to: previous 1.108: preferred, colored
Changes since revision 1.108: +63 -32 lines
For the page fault handler, save %cr2 in the outer trap handler so that
we do not have to run so long with interrupts disabled.  This involved
creating tf_addr in the trapframe.  Reorganize the trap stubs so that
they consistently reserve the stack space and initialize any missing
bits.

Approved by:	re (amd64 stuff)

Revision 1.108: download - view: text, markup, annotated - select for diffs
Mon May 12 02:37:28 2003 UTC (8 years, 9 months ago) by peter
Branches: MAIN
Diff to: previous 1.107: preferred, colored
Changes since revision 1.107: +74 -37 lines
Give a %fs and %gs to userland.  Use swapgs to obtain the kernel %GS.base
value on entry and exit.  This isn't as easy as it sounds because when
we recursively trap or interrupt, we have to avoid duplicating the
swapgs instruction or we end up back with the userland %gs.  I implemented
this by testing TF_CS to see if we're coming from supervisor mode
already, and check for returning to supervisor. To avoid a race with
interrupts in the brief period after beginning executing the handler and
before the swapgs, convert all trap gates to interrupt gates, and reenable
interrupts immediately after the swapgs.  I am not happy with this.
There are other possible ways to do this that should be investigated.
(eg: storing the GS.base MSR value in the trapframe)

Add some sysarch functions to let the userland code get to this.

Approved by:	re (blanket amd64/*)

Revision 1.107: download - view: text, markup, annotated - select for diffs
Sun May 11 22:38:54 2003 UTC (8 years, 9 months ago) by peter
Branches: MAIN
Diff to: previous 1.106: preferred, colored
Changes since revision 1.106: +2 -2 lines
Since compiling natively, the compile environment has been less forgiving
about silly typos.  Use the correct comment sequences.

Revision 1.106: download - view: text, markup, annotated - select for diffs
Thu May 8 00:05:00 2003 UTC (8 years, 9 months ago) by peter
Branches: MAIN
Diff to: previous 1.105: preferred, colored
Changes since revision 1.105: +1 -1 lines
Fix a preemption race.  I was reenabling interrupts in the fast system
call handler before it was safe.  It was possible for to lose context
and for something else to clobber the PCPU scratch variable.  This
moves the interrupt enable *way* too late, but its better safe than
sorry for the moment.

Revision 1.105: download - view: text, markup, annotated - select for diffs
Sat May 3 00:21:43 2003 UTC (8 years, 9 months ago) by peter
Branches: MAIN
Diff to: previous 1.104: preferred, colored
Changes since revision 1.104: +2 -2 lines
Repocopy *.s to *.S

Revision 1.104: download - view: text, markup, annotated - select for diffs
Thu May 1 01:05:21 2003 UTC (8 years, 9 months ago) by peter
Branches: MAIN
Diff to: previous 1.103: preferred, colored
Changes since revision 1.103: +174 -137 lines
Commit MD parts of a loosely functional AMD64 port.  This is based on
a heavily stripped down FreeBSD/i386 (brutally stripped down actually) to
attempt to get a stable base to start from.  There is a lot missing still.
Worth noting:
- The kernel runs at 1GB in order to cheat with the pmap code.  pmap uses
  a variation of the PAE code in order to avoid having to worry about 4
  levels of page tables yet.
- It boots in 64 bit "long mode" with a tiny trampoline embedded in the
  i386 loader.  This simplifies locore.s greatly.
- There are still quite a few fragments of i386-specific code that have
  not been translated yet, and some that I cheated and wrote dumb C
  versions of (bcopy etc).
- It has both int 0x80 for syscalls (but using registers for argument
  passing, as is native on the amd64 ABI), and the 'syscall' instruction
  for syscalls.  int 0x80 preserves all registers, 'syscall' does not.
- I have tried to minimize looking at the NetBSD code, except in a couple
  of places (eg: to find which register they use to replace the trashed
  %rcx register in the syscall instruction).  As a result, there is not a
  lot of similarity.  I did look at NetBSD a few times while debugging to
  get some ideas about what I might have done wrong in my first attempt.

Revision 1.103: download - view: text, markup, annotated - select for diffs
Mon Feb 17 09:55:08 2003 UTC (8 years, 11 months ago) by julian
Branches: MAIN
Diff to: previous 1.102: preferred, colored
Changes since revision 1.102: +1 -2 lines
Move a bunch of flags from the KSE to the thread.
I was in two minds as to where to put them in the first case..
I should have listenned to the other mind.

Submitted by:	 parts by davidxu@
Reviewed by:	jeff@ mini@

Revision 1.102: download - view: text, markup, annotated - select for diffs
Sat Feb 1 12:17:06 2003 UTC (9 years ago) by julian
Branches: MAIN
Diff to: previous 1.101: preferred, colored
Changes since revision 1.101: +0 -3 lines
Reversion of commit by Davidxu plus fixes since applied.

I'm not convinced there is anything major wrong with the patch but
them's the rules..

I am using my "David's mentor" hat to revert this as he's
offline for a while.

Revision 1.101: download - view: text, markup, annotated - select for diffs
Tue Jan 28 19:05:44 2003 UTC (9 years ago) by jake
Branches: MAIN
Diff to: previous 1.100: preferred, colored
Changes since revision 1.100: +0 -18 lines
Remove BDE_DEBUGGER.

Discussed with:	bde

Revision 1.100: download - view: text, markup, annotated - select for diffs
Sun Jan 26 11:41:33 2003 UTC (9 years ago) by davidxu
Branches: MAIN
Diff to: previous 1.99: preferred, colored
Changes since revision 1.99: +3 -0 lines
Move UPCALL related data structure out of kse, introduce a new
data structure called kse_upcall to manage UPCALL. All KSE binding
and loaning code are gone.

A thread owns an upcall can collect all completed syscall contexts in
its ksegrp, turn itself into UPCALL mode, and takes those contexts back
to userland. Any thread without upcall structure has to export their
contexts and exit at user boundary.

Any thread running in user mode owns an upcall structure, when it enters
kernel, if the kse mailbox's current thread pointer is not NULL, then
when the thread is blocked in kernel, a new UPCALL thread is created and
the upcall structure is transfered to the new UPCALL thread. if the kse
mailbox's current thread pointer is NULL, then when a thread is blocked
in kernel, no UPCALL thread will be created.

Each upcall always has an owner thread. Userland can remove an upcall by
calling kse_exit, when all upcalls in ksegrp are removed, the group is
atomatically shutdown. An upcall owner thread also exits when process is
in exiting state. when an owner thread exits, the upcall it owns is also
removed.

KSE is a pure scheduler entity. it represents a virtual cpu. when a thread
is running, it always has a KSE associated with it. scheduler is free to
assign a KSE to thread according thread priority, if thread priority is changed,
KSE can be moved from one thread to another.

When a ksegrp is created, there is always N KSEs created in the group. the
N is the number of physical cpu in the current system. This makes it is
possible that even an userland UTS is single CPU safe, threads in kernel still
can execute on different cpu in parallel. Userland calls kse_create to add more
upcall structures into ksegrp to increase concurrent in userland itself, kernel
is not restricted by number of upcalls userland provides.

The code hasn't been tested under SMP by author due to lack of hardware.

Reviewed by: julian

Revision 1.99: download - view: text, markup, annotated - select for diffs
Thu Nov 7 01:34:23 2002 UTC (9 years, 3 months ago) by davidxu
Branches: MAIN
CVS tags: old_RELENG_5_0_BP, old_RELENG_5_0_0_RELEASE, old_RELENG_5_0
Diff to: previous 1.98: preferred, colored
Changes since revision 1.98: +3 -2 lines
1.Fix smp race between kernel vm86 BIOS calling and userland vm86 mode code,
  remove global variable in_vm86call, set vm86 calling flag in PCB flags.

2.Fix vm86 BIOS calling preempted problem by changing vm86_lock mutex type
  from MTX_DEF to MTX_SPIN. vm86pcb is not remembered in thread struct,
  when the thread calling vm86 BIOS is preempted by interrupt thread,
  and later switching back to the thread would cause incorrect context be
  loaded into CPU registers, this leads to kernel crash.

Revision 1.98: download - view: text, markup, annotated - select for diffs
Sun Jul 28 00:27:51 2002 UTC (9 years, 6 months ago) by peter
Branches: MAIN
Diff to: previous 1.97: preferred, colored
Changes since revision 1.97: +14 -2 lines
Unwind the syscall_with_err_pushed tweak that jake did some time back.

OK'ed by:	jake

Revision 1.97: download - view: text, markup, annotated - select for diffs
Wed Jul 10 21:17:23 2002 UTC (9 years, 7 months ago) by julian
Branches: MAIN
Diff to: previous 1.96: preferred, colored
Changes since revision 1.96: +2 -2 lines
fix a comment and note a problem with XXXSMP

Revision 1.96: download - view: text, markup, annotated - select for diffs
Wed Jul 10 20:15:57 2002 UTC (9 years, 7 months ago) by dillon
Branches: MAIN
Diff to: previous 1.95: preferred, colored
Changes since revision 1.95: +0 -16 lines
Remove the critmode sysctl - the new method for critical_enter/exit (already
the default) is now the only method for i386.

Remove the paraphanalia that supported critmode.  Remove td_critnest, clean
up the assembly, and clean up (mostly remove) the old junk from
cpu_critical_enter() and cpu_critical_exit().

Revision 1.95: download - view: text, markup, annotated - select for diffs
Wed Jul 10 02:24:44 2002 UTC (9 years, 7 months ago) by julian
Branches: MAIN
Diff to: previous 1.94: preferred, colored
Changes since revision 1.94: +97 -8 lines
Include all of isa/ipl.s into exception.s as there is now nothing left in
ipl.s except doreti which really belongs in with the exceptions as it's
just the other side of the same coin. Will remove ipl.s in a separate commit.

Agreed by: several including bde@freebsd.org

Revision 1.94: download - view: text, markup, annotated - select for diffs
Wed Mar 27 05:39:18 2002 UTC (9 years, 10 months ago) by dillon
Branches: MAIN
Diff to: previous 1.93: preferred, colored
Changes since revision 1.93: +19 -0 lines
Compromise for critical*()/cpu_critical*() recommit.  Cleanup the interrupt
disablement assumptions in kern_fork.c by adding another API call,
cpu_critical_fork_exit().  Cleanup the td_savecrit field by moving it
from MI to MD.  Temporarily move cpu_critical*() from <arch>/include/cpufunc.h
to <arch>/<arch>/critical.c (stage-2 will clean this up).

Implement interrupt deferral for i386 that allows interrupts to remain
enabled inside critical sections.  This also fixes an IPI interlock bug,
and requires uses of icu_lock to be enclosed in a true interrupt disablement.

This is the stage-1 commit.  Stage-2 will occur after stage-1 has stabilized,
and will move cpu_critical*() into its own header file(s) + other things.
This commit may break non-i386 architectures in trivial ways.  This should
be temporary.

Reviewed by:	core
Approved by:	core

Revision 1.93: download - view: text, markup, annotated - select for diffs
Tue Feb 26 20:33:39 2002 UTC (9 years, 11 months ago) by dillon
Branches: MAIN
Diff to: previous 1.92: preferred, colored
Changes since revision 1.92: +0 -12 lines
revert last commit temporarily due to whining on the lists.

Revision 1.92: download - view: text, markup, annotated - select for diffs
Tue Feb 26 17:06:17 2002 UTC (9 years, 11 months ago) by dillon
Branches: MAIN
Diff to: previous 1.91: preferred, colored
Changes since revision 1.91: +12 -0 lines
STAGE-1 of 3 commit - allow (but do not require) interrupts to remain
enabled in critical sections and streamline critical_enter() and
critical_exit().

This commit allows an architecture to leave interrupts enabled inside
critical sections if it so wishes.  Architectures that do not wish to do
this are not effected by this change.

This commit implements the feature for the I386 architecture and provides
a sysctl, debug.critical_mode, which defaults to 1 (use the feature).  For
now you can turn the sysctl on and off at any time in order to test the
architectural changes or track down bugs.

This commit is just the first stage.  Some areas of the code, specifically
the MACHINE_CRITICAL_ENTER #ifdef'd code, is strictly temporary and will
be cleaned up in the STAGE-2 commit when the critical_*() functions are
moved entirely into MD files.

The following changes have been made:

	* critical_enter() and critical_exit() for I386 now simply increment
	  and decrement curthread->td_critnest.  They no longer disable
	  hard interrupts.  When critical_exit() decrements the counter to
	  0 it effectively calls a routine to deal with whatever interrupts
	  were deferred during the time the code was operating in a critical
	  section.

	  Other architectures are unaffected.

	* fork_exit() has been conditionalized to remove MD assumptions for
	  the new code.  Old code will still use the old MD assumptions
	  in regards to hard interrupt disablement.  In STAGE-2 this will
	  be turned into a subroutine call into MD code rather then hardcoded
	  in MI code.

	  The new code places the burden of entering the critical section
	  in the trampoline code where it belongs.

	* I386: interrupts are now enabled while we are in a critical section.
	  The interrupt vector code has been adjusted to deal with the fact.
	  If it detects that we are in a critical section it currently defers
	  the interrupt by adding the appropriate bit to an interrupt mask.

	* In order to accomplish the deferral, icu_lock is required.  This
	  is i386-specific.  Thus icu_lock can only be obtained by mainline
	  i386 code while interrupts are hard disabled.  This change has been
	  made.

	* Because interrupts may or may not be hard disabled during a
	  context switch, cpu_switch() can no longer simply assume that
	  PSL_I will be in a consistent state.  Therefore, it now saves and
	  restores eflags.

	* FAST INTERRUPT PROVISION.  Fast interrupts are currently deferred.
	  The intention is to eventually allow them to operate either while
	  we are in a critical section or, if we are able to restrict the
	  use of sched_lock, while we are not holding the sched_lock.

	* ICU and APIC vector assembly for I386 cleaned up.  The ICU code
	  has been cleaned up to match the APIC code in regards to format
	  and macro availability.  Additionally, the code has been adjusted
	  to deal with deferred interrupts.

	* Deferred interrupts use a per-cpu boolean int_pending, and
	  masks ipending, spending, and fpending.  Being per-cpu variables
	  it is not currently necessary to lock; bus cycles modifying them.

	  Note that the same mechanism will enable preemption to be
	  incorporated as a true software interrupt without having to
	  further hack up the critical nesting code.

	* Note: the old critical_enter() code in kern/kern_switch.c is
	  currently #ifdef to be compatible with both the old and new
	  methodology.  In STAGE-2 it will be moved entirely to MD code.

Performance issues:

	One of the purposes of this commit is to enhance critical section
	performance, specifically to greatly reduce bus overhead to allow
	the critical section code to be used to protect per-cpu caches.
	These caches, such as Jeff's slab allocator work, can potentially
	operate very quickly making the effective savings of the new
	critical section code's performance very significant.

	The second purpose of this commit is to allow architectures to
	enable certain interrupts while in a critical section.  Specifically,
	the intention is to eventually allow certain FAST interrupts to
	operate rather then defer.

	The third purpose of this commit is to begin to clean up the
	critical_enter()/critical_exit()/cpu_critical_enter()/
	cpu_critical_exit() API which currently has serious cross pollution
	in MI code (in fork_exit() and ast() for example).

	The fourth purpose of this commit is to provide a framework that
	allows kernel-preempting software interrupts to be implemented
	cleanly.  This is currently used for two forward interrupts in I386.
	Other architectures will have the choice of using this infrastructure
	or building the functionality directly into critical_enter()/
	critical_exit().

	Finally, this commit is designed to greatly improve the flexibility
	of various architectures to manage critical section handling,
	software interrupts, preemption, and other highly integrated
	architecture-specific details.

Revision 1.91: download - view: text, markup, annotated - select for diffs
Mon Feb 11 03:41:58 2002 UTC (10 years ago) by bde
Branches: MAIN
Diff to: previous 1.90: preferred, colored
Changes since revision 1.90: +1 -2 lines
Garbage-collect the "LOCORE" version of MPLOCKED.

Revision 1.90: download - view: text, markup, annotated - select for diffs
Fri Aug 24 16:46:15 2001 UTC (10 years, 5 months ago) by jhb
Branches: MAIN
CVS tags: old_KSE_PRE_MILESTONE_2, old_KSE_MILESTONE_2
Diff to: previous 1.89: preferred, colored
Changes since revision 1.89: +1 -19 lines
Remove references to the old giant kernel lock in various comments.

Revision 1.65.2.3: download - view: text, markup, annotated - select for diffs
Wed Aug 15 01:23:49 2001 UTC (10 years, 5 months ago) by peter
Branches: old_RELENG_4
CVS tags: old_RELENG_4_8_BP, old_RELENG_4_8_0_RELEASE, old_RELENG_4_8, old_RELENG_4_7_BP, old_RELENG_4_7_0_RELEASE, old_RELENG_4_7, old_RELENG_4_6_BP, old_RELENG_4_6_2_RELEASE, old_RELENG_4_6_1_RELEASE, old_RELENG_4_6_0_RELEASE, old_RELENG_4_6, old_RELENG_4_5_BP, old_RELENG_4_5_0_RELEASE, old_RELENG_4_5, old_RELENG_4_4_BP, old_RELENG_4_4_0_RELEASE, old_RELENG_4_4
Diff to: previous 1.65.2.2: preferred, colored; branchpoint 1.65: preferred, colored; next MAIN 1.66: preferred, colored
Changes since revision 1.65.2.2: +4 -1 lines
MFC: SSE kernel support.  This is only active if you compile
'options CPU_ENABLE_SSE' in the kernel.  This is a MFC of the
code in -current, plus all the followup fixes and tweaks but
adapted for the npx and compile differences in RELENG_4.
The npx_intr() change comes from the 4.3 version of the diffs
since -current uses traps vs. interrupts in npx.c.

This is a giant no-op without the kernel compile option.

Approved by:	re (murray)

Revision 1.89: download - view: text, markup, annotated - select for diffs
Mon Aug 13 12:42:13 2001 UTC (10 years, 6 months ago) by bde
Branches: MAIN
Diff to: previous 1.88: preferred, colored
Changes since revision 1.88: +3 -5 lines
Removed he BPTTRAP() macro and its use.  It was intended for restoring
bug for bug compatibility to ddb trap handlers after fixing the debugger
trap gates to be interrupt gates, but the fix was never committed.  Now
I want the fix to apply to ddb.

Revision 1.88: download - view: text, markup, annotated - select for diffs
Thu Jul 12 06:32:49 2001 UTC (10 years, 7 months ago) by peter
Branches: MAIN
Diff to: previous 1.87: preferred, colored
Changes since revision 1.87: +4 -1 lines
Activate SSE/SIMD.  This is the extra context switching support that
we are required to do if we let user processes use the extra 128 bit
registers etc.

This is the base part of the diff I got from:
  http://www.issei.org/issei/FreeBSD/sse.html
I believe this is by:  Mr. SUZUKI Issei <issei@issei.org>
SMP support apparently by: Takekazu KATO <kato@chino.it.okayama-u.ac.jp>
Test code by: NAKAMURA Kazushi <kaz@kobe1995.net>, see
  http://kobe1995.net/~kaz/FreeBSD/SSE.en.html

I have fixed a couple of style(9) deviations.  I have some followup
commits to fix a couple of non-style things.

Revision 1.87: download - view: text, markup, annotated - select for diffs
Tue May 22 21:20:47 2001 UTC (10 years, 8 months ago) by bde
Branches: MAIN
Diff to: previous 1.86: preferred, colored
Changes since revision 1.86: +1 -33 lines
Convert npx interrupts into traps instead of vice versa.  This is much
simpler for npx exceptions that start as traps (no assembly required...)
and works better for npx exceptions that start as interrupts (there is
no longer a problem for nested interrupts).

Submitted by:	original (pre-SMPng) version by luoqi

Revision 1.86: download - view: text, markup, annotated - select for diffs
Tue May 15 23:22:19 2001 UTC (10 years, 8 months ago) by jhb
Branches: MAIN
Diff to: previous 1.85: preferred, colored
Changes since revision 1.85: +1 -2 lines
Remove unneeded includes of sys/ipl.h and machine/ipl.h.

Revision 1.85: download - view: text, markup, annotated - select for diffs
Sun Feb 25 06:28:59 2001 UTC (10 years, 11 months ago) by jake
Branches: MAIN
Diff to: previous 1.84: preferred, colored
Changes since revision 1.84: +24 -24 lines
Remove the leading underscore from all symbols defined in x86 asm
and used in C or vice versa.  The elf compiler uses the same names
for both.  Remove asnames.h with great prejudice; it has served its
purpose.

Note that this does not affect the ability to generate an aout kernel
due to gcc's -mno-underscores option.

moral support from:	peter, jhb

Revision 1.84: download - view: text, markup, annotated - select for diffs
Sun Feb 25 02:53:04 2001 UTC (10 years, 11 months ago) by jake
Branches: MAIN
Diff to: previous 1.83: preferred, colored
Changes since revision 1.83: +9 -22 lines
- Rename the lcall system call handler from Xsyscall to Xlcall_syscall
  to be more like Xint0x80_syscall and less like c function syscall().
- Reduce code duplication between the int0x80 and lcall handlers by
  shuffling the elfags into the right place, saving the sizeof the
  instruction in tf_err and jumping into the common int0x80 code.

Reviewed by:	peter

Revision 1.83: download - view: text, markup, annotated - select for diffs
Sun Feb 11 10:44:06 2001 UTC (11 years ago) by markm
Branches: MAIN
Diff to: previous 1.82: preferred, colored
Changes since revision 1.82: +2 -2 lines
RIP <machine/lock.h>.

Some things needed bits of <i386/include/lock.h> - cy.c now has its
own (only) copy of the COM_(UN)LOCK() macros, and IMASK_(UN)LOCK()
has been moved to <i386/include/apic.h> (AKA <machine/apic.h>).
Reviewed by:	jhb

Revision 1.82: download - view: text, markup, annotated - select for diffs
Sat Feb 10 02:20:32 2001 UTC (11 years ago) by jhb
Branches: MAIN
Diff to: previous 1.81: preferred, colored
Changes since revision 1.81: +5 -11 lines
- Make astpending and need_resched process attributes rather than CPU
  attributes.  This is needed for AST's to be properly posted in a preemptive
  kernel.  They are backed by two new flags in p_sflag: PS_ASTPENDING and
  PS_NEEDRESCHED.  They are still accesssed by their old macros:
  aston(), astoff(), etc.  For completeness, an astpending() macro has been
  added to check for a pending AST, and clear_resched() has been added to
  clear need_resched().
- Rename syscall2() on the x86 back to syscall() to be consistent with
  other architectures.

Revision 1.81: download - view: text, markup, annotated - select for diffs
Wed Jan 24 21:59:24 2001 UTC (11 years ago) by jhb
Branches: MAIN
Diff to: previous 1.80: preferred, colored
Changes since revision 1.80: +3 -2 lines
- Change fork_exit() to take a pointer to a trapframe as its 3rd argument
  instead of a trapframe directly.  (Requested by bde.)
- Convert the alpha switch_trampoline to call fork_exit() and use the MI
  fork_return() instead of child_return().
- Axe child_return().

Revision 1.80: download - view: text, markup, annotated - select for diffs
Wed Jan 24 09:43:26 2001 UTC (11 years ago) by jhb
Branches: MAIN
Diff to: previous 1.79: preferred, colored
Changes since revision 1.79: +4 -25 lines
Call fork_exit() now instead of futzing around in assembly during a fork
return.

Revision 1.79: download - view: text, markup, annotated - select for diffs
Sun Jan 21 19:25:04 2001 UTC (11 years ago) by jake
Branches: MAIN
Diff to: previous 1.78: preferred, colored
Changes since revision 1.78: +1 -6 lines
Make intr_nesting_level per-process, rather than per-cpu.  Setup
interrupt threads to run with it always >= 1, so that malloc can
detect M_WAITOK from "interrupt" context.  This is also necessary
in order to context switch from sched_ithd() directly.

Reviewed By:	peter

Revision 1.78: download - view: text, markup, annotated - select for diffs
Sat Jan 20 04:14:24 2001 UTC (11 years ago) by jake
Branches: MAIN
Diff to: previous 1.77: preferred, colored
Changes since revision 1.77: +3 -3 lines
Simplify the i386 asm MTX_{ENTER,EXIT} macros to just call the
appropriate function, rather than doing a horse-and-buggy
acquire.  They now take the mutex type as an arg and can be
used with sleep as well as spin mutexes.

Revision 1.77: download - view: text, markup, annotated - select for diffs
Sat Jan 20 02:30:54 2001 UTC (11 years ago) by jake
Branches: MAIN
Diff to: previous 1.76: preferred, colored
Changes since revision 1.76: +1 -3 lines
- Make npx_intr INTR_MPSAFE and move acquiring Giant into the
  function itself.
- Remove a hack to allow acquiring Giant from the npx asm trap
  vector.

Revision 1.76: download - view: text, markup, annotated - select for diffs
Fri Jan 19 13:19:01 2001 UTC (11 years ago) by peter
Branches: MAIN
Diff to: previous 1.75: preferred, colored
Changes since revision 1.75: +5 -5 lines
Use #ifdef DEV_NPX from opt_npx.h instead of #if NNPX > 0 from npx.h

Revision 1.75: download - view: text, markup, annotated - select for diffs
Sat Jan 6 17:40:01 2001 UTC (11 years, 1 month ago) by jake
Branches: MAIN
Diff to: previous 1.74: preferred, colored
Changes since revision 1.74: +6 -12 lines
Use %fs to access per-cpu variables in uni-processor kernels the same
as multi-processor kernels.  The old way made it difficult for kernel
modules to be portable between uni-processor and multi-processor
kernels.  It is no longer necessary to jump through hoops.

- always load %fs with the private segment on entry to the kernel
- change the type of the self referntial pointer from struct privatespace
  to struct globaldata
- make the globaldata symbol have value 0 in all cases, so the symbols
  in globals.s are always offsets, not aliases for fields in globaldata
- define the globaldata space used for uniprocessor kernels in C, rather
  than assembler
- change the assmebly language accessors to use %fs, add a macro
  PCPU_ADDR(member, reg), which loads the register reg with the address
  of the per-cpu variable member

Revision 1.74: download - view: text, markup, annotated - select for diffs
Wed Dec 13 09:23:51 2000 UTC (11 years, 1 month ago) by jake
Branches: MAIN
Diff to: previous 1.73: preferred, colored
Changes since revision 1.73: +11 -11 lines
Introduce a new potientially cleaner interface for accessing per-cpu
variables from i386 assembly language.  The syntax is PCPU(member)
where member is the capitalized name of the per-cpu variable, without
the gd_ prefix.  Example: movl %eax,PCPU(CURPROC).  The capitalization
is due to using the offsets generated by genassym rather than the symbols
provided by linking with globals.o.  asmacros.h is the wrong place for
this but it seemed as good a place as any for now.  The old implementation
in asnames.h has not been removed because it is still used to de-mangle
the symbols used by the C variables for the UP case.

Revision 1.73: download - view: text, markup, annotated - select for diffs
Fri Dec 1 02:09:41 2000 UTC (11 years, 2 months ago) by jake
Branches: MAIN
Diff to: previous 1.72: preferred, colored
Changes since revision 1.72: +3 -7 lines
Change doreti to take a trapframe instead of an intrframe.
Remove associated pushes of dummy units to convert frame.

Reviewed by:	jhb

Revision 1.72: download - view: text, markup, annotated - select for diffs
Tue Nov 14 23:01:24 2000 UTC (11 years, 2 months ago) by jhb
Branches: MAIN
Diff to: previous 1.71: preferred, colored
Changes since revision 1.71: +4 -1 lines
Always enable interrupts during fork_trampoline() after releasing the
sched_lock.  This is needed for kernel threads that are created before
interrupts are enabled.  kthreads created by kld's that are created at
SI_SUB_KLD such as the random kthread.

Tested by:	phk

Revision 1.71: download - view: text, markup, annotated - select for diffs
Fri Oct 6 01:47:24 2000 UTC (11 years, 4 months ago) by jhb
Branches: MAIN
Diff to: previous 1.70: preferred, colored
Changes since revision 1.70: +1 -3 lines
Remove an unnecessary sti and spl0() in fork_trampoline.  Interrupts
should be enabled by MTX_EXIT() now when it releases the sched_lock.

Revision 1.70: download - view: text, markup, annotated - select for diffs
Thu Oct 5 23:09:51 2000 UTC (11 years, 4 months ago) by jhb
Branches: MAIN
Diff to: previous 1.69: preferred, colored
Changes since revision 1.69: +2 -2 lines
- Heavyweight interrupt threads on the alpha for device I/O interrupts.
- Make softinterrupts (SWI's) almost completely MI, and divorce them
  completely from the x86 hardware interrupt code.
  - The ihandlers array is now gone.  Instead, there is a MI shandlers array
    that just contains SWI handlers.
  - Most of the former machine/ipl.h files have moved to a new sys/ipl.h.
- Stub out all the spl*() functions on all architectures.

Submitted by:	dfr

Revision 1.69: download - view: text, markup, annotated - select for diffs
Thu Sep 7 01:32:42 2000 UTC (11 years, 5 months ago) by jasone
Branches: MAIN
Diff to: previous 1.68: preferred, colored
Changes since revision 1.68: +10 -33 lines
Major update to the way synchronization is done in the kernel.  Highlights
include:

* Mutual exclusion is used instead of spl*().  See mutex(9).  (Note: The
  alpha port is still in transition and currently uses both.)

* Per-CPU idle processes.

* Interrupts are run in their own separate kernel threads and can be
  preempted (i386 only).

Partially contributed by:	BSDi (BSD/OS)
Submissions by (at least):	cp, dfr, dillon, grog, jake, jhb, sheldonh

Revision 1.65.2.2: download - view: text, markup, annotated - select for diffs
Fri Jul 7 00:38:46 2000 UTC (11 years, 7 months ago) by obrien
Branches: old_RELENG_4
CVS tags: old_RELENG_4_3_BP, old_RELENG_4_3_0_RELEASE, old_RELENG_4_3, old_RELENG_4_2_0_RELEASE, old_RELENG_4_1_1_RELEASE, old_RELENG_4_1_0_RELEASE
Diff to: previous 1.65.2.1: preferred, colored; branchpoint 1.65: preferred, colored
Changes since revision 1.65.2.1: +18 -18 lines
MFC: x86 ASM cleanups allowed/required with/by Binutils 2.10.0.
1. Do not specify the size to operations; allow the assembler to decide.
   (we often were mixing 32-bit operations with 16-bit operands)
2. AT&T asm syntax requires a leading '*' in front of the operand for
   indirect calls and jumps.

Revision 1.65.2.1: download - view: text, markup, annotated - select for diffs
Tue May 16 06:58:06 2000 UTC (11 years, 8 months ago) by dillon
Branches: old_RELENG_4
Diff to: previous 1.65: preferred, colored
Changes since revision 1.65: +80 -55 lines
    MFC the SMP cleanup.

Revision 1.68: download - view: text, markup, annotated - select for diffs
Wed May 10 01:24:22 2000 UTC (11 years, 9 months ago) by obrien
Branches: MAIN
CVS tags: old_PRE_SMPNG
Diff to: previous 1.67: preferred, colored
Changes since revision 1.67: +18 -18 lines
1. `movl' is for use with 32-bit operands.  Do NOT use it with 16-bit
   operands.  `movw' could be used, but instead let the assembler decide
   the right instruction to use.
2. AT&T asm syntax requires a leading '*' in front of the operand for
   indirect calls and jumps.

Revision 1.67: download - view: text, markup, annotated - select for diffs
Wed Mar 29 06:15:37 2000 UTC (11 years, 10 months ago) by dillon
Branches: MAIN
Diff to: previous 1.66: preferred, colored
Changes since revision 1.66: +2 -2 lines
    The SMP cleanup commit broke need_resched, this fixes that and also
    removed unncessary MPLOCKED and 'lock' prefixes from the interrupt
    nesting level, since (A) the MP lock is held at the time, and (B) since
    the neting level is restored prior to return any interrupted code
    will see a consistent value.

Revision 1.66: download - view: text, markup, annotated - select for diffs
Tue Mar 28 07:16:14 2000 UTC (11 years, 10 months ago) by dillon
Branches: MAIN
Diff to: previous 1.65: preferred, colored
Changes since revision 1.65: +79 -54 lines
    Commit major SMP cleanups and move the BGL (big giant lock) in the
    syscall path inward.  A system call may select whether it needs the MP
    lock or not (the default being that it does need it).

    A great deal of conditional SMP code for various deadended experiments
    has been removed.  'cil' and 'cml' have been removed entirely, and the
    locking around the cpl has been removed.  The conditional
    separately-locked fast-interrupt code has been removed, meaning that
    interrupts must hold the CPL now (but they pretty much had to anyway).
    Another reason for doing this is that the original separate-lock for
    interrupts just doesn't apply to the interrupt thread mechanism being
    contemplated.

    Modifications to the cpl may now ONLY occur while holding the MP
    lock.  For example, if an otherwise MP safe syscall needs to mess with
    the cpl, it must hold the MP lock for the duration and must (as usual)
    save/restore the cpl in a nested fashion.

    This is precursor work for the real meat coming later: avoiding having
    to hold the MP lock for common syscalls and I/O's and interrupt threads.
    It is expected that the spl mechanisms and new interrupt threading
    mechanisms will be able to run in tandem, allowing a slow piecemeal
    transition to occur.

    This patch should result in a moderate performance improvement due to
    the considerable amount of code that has been removed from the critical
    path, especially the simplification of the spl*() calls.  The real
    performance gains will come later.

Approved by: jkh
Reviewed by: current, bde (exception.s)
Some work taken from: luoqi's patch

Revision 1.55.2.3: download - view: text, markup, annotated - select for diffs
Wed Feb 2 03:50:18 2000 UTC (12 years ago) by bde
Branches: old_RELENG_3
CVS tags: old_RELENG_3_5_0_RELEASE
Diff to: previous 1.55.2.2: preferred, colored; branchpoint 1.55: preferred, colored; next MAIN 1.56: preferred, colored
Changes since revision 1.55.2.2: +4 -2 lines
MFC: fixes for profiling of elf kernels.  See the commit logs on
1999/05/10 for identcpu.c and on 1999/05/6 for everything else.
Unlike in -current, no additional fixes are needed for high
resolution profiling.

Revision 1.65: download - view: text, markup, annotated - select for diffs
Fri Nov 26 05:02:06 1999 UTC (12 years, 2 months ago) by julian
Branches: MAIN
CVS tags: old_RELENG_4_BP, old_RELENG_4_0_0_RELEASE
Branch point for: old_RELENG_4
Diff to: previous 1.64: preferred, colored
Changes since revision 1.64: +5 -2 lines
Fix out-of-date comment

Revision 1.9.2.4: download - view: text, markup, annotated - select for diffs
Sun Sep 5 08:29:17 1999 UTC (12 years, 5 months ago) by peter
Branches: old_RELENG_2_1_0
Diff to: previous 1.9.2.3: preferred, colored; branchpoint 1.9: preferred, colored; next MAIN 1.10: preferred, colored
Changes since revision 1.9.2.3: +1 -1 lines
$Id$ -> $FreeBSD$

Revision 1.19.2.2: download - view: text, markup, annotated - select for diffs
Sun Sep 5 08:11:06 1999 UTC (12 years, 5 months ago) by peter
Branches: old_RELENG_2_2
Diff to: previous 1.19.2.1: preferred, colored; branchpoint 1.19: preferred, colored; next MAIN 1.20: preferred, colored
Changes since revision 1.19.2.1: +1 -1 lines
$Id$ -> $FreeBSD$

Revision 1.55.2.2: download - view: text, markup, annotated - select for diffs
Sun Aug 29 16:05:39 1999 UTC (12 years, 5 months ago) by peter
Branches: old_RELENG_3
CVS tags: old_RELENG_3_4_0_RELEASE, old_RELENG_3_3_0_RELEASE
Diff to: previous 1.55.2.1: preferred, colored; branchpoint 1.55: preferred, colored
Changes since revision 1.55.2.1: +1 -1 lines
$Id$ -> $FreeBSD$

Revision 1.64: download - view: text, markup, annotated - select for diffs
Sat Aug 28 00:43:43 1999 UTC (12 years, 5 months ago) by peter
Branches: MAIN
Diff to: previous 1.63: preferred, colored
Changes since revision 1.63: +1 -1 lines
$Id$ -> $FreeBSD$

Revision 1.63: download - view: text, markup, annotated - select for diffs
Sat Jul 10 15:27:55 1999 UTC (12 years, 7 months ago) by bde
Branches: MAIN
Diff to: previous 1.62: preferred, colored
Changes since revision 1.62: +5 -40 lines
Go back to the old (icu.s rev.1.7 1993) way of keeping the AST-pending
bit separate from ipending, since this is simpler and/or necessary for
SMP and may even be better for UP.

Reviewed by:	alc, luoqi, tegge

Revision 1.62: download - view: text, markup, annotated - select for diffs
Sun Jun 27 21:31:43 1999 UTC (12 years, 7 months ago) by alc
Branches: MAIN
Diff to: previous 1.61: preferred, colored
Changes since revision 1.61: +13 -5 lines
An SMP-specific change: Remove an unnecessary lock acquire and release
from every system call.  (Storing a 32-bit constant is inherently
atomic.)

Reviewed by:	Matthew Dillon <dillon@apollo.backplane.com>

Revision 1.61: download - view: text, markup, annotated - select for diffs
Tue Jun 1 18:19:36 1999 UTC (12 years, 8 months ago) by jlemon
Branches: MAIN
Diff to: previous 1.60: preferred, colored
Changes since revision 1.60: +1 -4 lines
Unifdef VM86.

Reviewed by:	silence on on -current

Revision 1.60: download - view: text, markup, annotated - select for diffs
Thu May 6 09:44:49 1999 UTC (12 years, 9 months ago) by bde
Branches: MAIN
Diff to: previous 1.59: preferred, colored
Changes since revision 1.59: +4 -2 lines
Fixed profiling of elf kernels.  Made high resolution profiling compile
for elf kernels (it is broken for all kernels due to lack of egcs support).

Renaming of many assembler labels is avoided by declaring by declaring
the labels that need to be visible to gprof as having type "function"
and depending on the elf version of gprof being zealous about discarding
the others.  A few type declarations are still missing, mainly for SMP.

PR:		9413
Submitted by:	Assar Westerlund <assar@sics.se> (initial parts)

Revision 1.59: download - view: text, markup, annotated - select for diffs
Wed Apr 28 01:03:18 1999 UTC (12 years, 9 months ago) by luoqi
Branches: MAIN
CVS tags: old_PRE_VFS_BIO_NFS_PATCH, old_POST_VFS_BIO_NFS_PATCH, old_POST_SMP_VMSHARE
Diff to: previous 1.58: preferred, colored
Changes since revision 1.58: +25 -9 lines
Enable vmspace sharing on SMP. Major changes are,
- %fs register is added to trapframe and saved/restored upon kernel entry/exit.
- Per-cpu pages are no longer mapped at the same virtual address.
- Each cpu now has a separate gdt selector table. A new segment selector
  is added to point to per-cpu pages, per-cpu global variables are now
  accessed through this new selector (%fs). The selectors in gdt table are
  rearranged for cache line optimization.
- fask_vfork is now on as default for both UP and SMP.
- Some aio code cleanup.

Reviewed by:	Alan Cox	<alc@cs.rice.edu>
		John Dyson	<dyson@iquest.net>
		Julian Elischer	<julian@whistel.com>
		Bruce Evans	<bde@zeta.org.au>
		David Greenman	<dg@root.com>

Revision 1.58: download - view: text, markup, annotated - select for diffs
Fri Apr 16 21:22:12 1999 UTC (12 years, 9 months ago) by peter
Branches: MAIN
CVS tags: old_PRE_SMP_VMSHARE, old_POST_NEWBUS
Diff to: previous 1.57: preferred, colored
Changes since revision 1.57: +3 -3 lines
Bring the 'new-bus' to the i386.  This extensively changes the way the
i386 platform boots, it is no longer ISA-centric, and is fully dynamic.
Most old drivers compile and run without modification via 'compatability
shims' to enable a smoother transition.  eisa, isapnp and pccard* are
not yet using the new resource manager.  Once fully converted, all drivers
will be loadable, including PCI and ISA.

(Some other changes appear to have snuck in, including a port of Soren's
 ATA driver to the Alpha.  Soren, back this out if you need to.)

This is a checkpoint of work-in-progress, but is quite functional.

The bulk of the work was done over the last few years by Doug Rabson and
Garrett Wollman.

Approved by:	core

Revision 1.57: download - view: text, markup, annotated - select for diffs
Sun Feb 28 10:53:28 1999 UTC (12 years, 11 months ago) by bde
Branches: MAIN
CVS tags: old_PRE_NEWBUS
Diff to: previous 1.56: preferred, colored
Changes since revision 1.56: +7 -13 lines
Removed all traces of `p_switchtime'.  The relevant timestamp is per-cpu,
not per-process.  Keep it in `switchtime' consistently.

It is now clear that the timestamp is always valid in fork_trampoline()
except when the child is running on a previously idle cpu, which
can only happen if there are multiple cpus, so don't check or set
the timestamp in fork_trampoline except in the (i386) SMP case.
Just remove the alpha code for setting it unconditionally, since
there is no SMP case for alpha and the code had rotted.

Parts reviewed by:	dfr, phk

Revision 1.55.2.1: download - view: text, markup, annotated - select for diffs
Thu Feb 25 14:36:28 1999 UTC (12 years, 11 months ago) by bde
Branches: old_RELENG_3
CVS tags: old_RELENG_3_2_PAO_BP, old_RELENG_3_2_PAO, old_RELENG_3_2_0_RELEASE
Diff to: previous 1.55: preferred, colored
Changes since revision 1.55: +4 -2 lines
MFC (don't forget to update `switchticks' in corner cases).

Revision 1.56: download - view: text, markup, annotated - select for diffs
Thu Feb 25 11:03:08 1999 UTC (12 years, 11 months ago) by bde
Branches: MAIN
Diff to: previous 1.55: preferred, colored
Changes since revision 1.55: +4 -2 lines
Don't forget to update `switchticks' in corner cases (except for
the alpha fork_trampoline(), forget it because it I believe it is
only necessary for the unsupported SMP case).

Revision 1.19.2.1: download - view: text, markup, annotated - select for diffs
Sun Aug 16 23:05:57 1998 UTC (13 years, 5 months ago) by bde
Branches: old_RELENG_2_2
CVS tags: old_RELENG_2_2_8_RELEASE
Diff to: previous 1.19: preferred, colored
Changes since revision 1.19: +6 -13 lines
MFC (1.55: fix restoring of cpl after a trap).

Revision 1.55: download - view: text, markup, annotated - select for diffs
Mon Aug 10 19:41:07 1998 UTC (13 years, 6 months ago) by bde
Branches: MAIN
CVS tags: old_RELENG_3_BP, old_RELENG_3_1_0_RELEASE, old_RELENG_3_0_0_RELEASE
Branch point for: old_RELENG_3
Diff to: previous 1.54: preferred, colored
Changes since revision 1.54: +10 -41 lines
Fixed restoring of cpl after trap handling.  The wrong cpl (SWI_AST_MASK
instead of 0) was "restored" after handling a trap that occurred while
returning to user mode.  This bug was most noticeable for VM86 and is
still detected and fixed up (on return from the next exception) in doreti
if VM86 is configured.

Revision 1.54: download - view: text, markup, annotated - select for diffs
Tue Jul 28 17:55:37 1998 UTC (13 years, 6 months ago) by bde
Branches: MAIN
Diff to: previous 1.53: preferred, colored
Changes since revision 1.53: +11 -1 lines
Set p->p_switchtime to switchtime instead of to the current time in
fork_trampoline() if switchtime is valid.  This fixes not accounting
for the time between the previous context switch and and the current
time (when the forked child starts up here) in most cases - the time
is now counted in the child's runtime.  I think it actually fixes
all cases, and switchtime is always valid here, since there must have
been a context switch just before the forked child starts up.  Some
code should be removed if this is correct.  The check that switchtime
is valid sometimes gives a false negative because the check isn't
correct until the after the first context switch after the system
has been up for >= 1 second.

Revision 1.53: download - view: text, markup, annotated - select for diffs
Thu May 28 09:29:54 1998 UTC (13 years, 8 months ago) by phk
Branches: MAIN
CVS tags: old_PRE_NOBDEV
Diff to: previous 1.52: preferred, colored
Changes since revision 1.52: +2 -2 lines
Some cleanups related to timecounters and weird ifdefs in <sys/time.h>.

Clean up (or if antipodic: down) some of the msgbuf stuff.

Use an inline function rather than a macro for timecounter delta.

Maintain process "on-cpu" time as 64 bits of microseconds to avoid
needless second rollover overhead.

Avoid calling microuptime the second time in mi_switch() if we do
not pass through _idle in cpu_switch()

This should reduce our context-switch overhead a bit, in particular
on pre-P5 and SMP systems.

WARNING:  Programs which muck about with struct proc in userland
will have to be fixed.

Reviewed, but found imperfect by:       bde

Revision 1.52: download - view: text, markup, annotated - select for diffs
Sun May 17 11:51:53 1998 UTC (13 years, 8 months ago) by phk
Branches: MAIN
Diff to: previous 1.51: preferred, colored
Changes since revision 1.51: +2 -2 lines
s/nanoruntime/nanouptime/g
s/microruntime/microuptime/g

Reviewed by:	bde

Revision 1.51: download - view: text, markup, annotated - select for diffs
Fri Apr 17 22:36:27 1998 UTC (13 years, 9 months ago) by des
Branches: MAIN
CVS tags: old_PRE_DEVFS_SLICE, old_POST_DEVFS_SLICE
Diff to: previous 1.50: preferred, colored
Changes since revision 1.50: +2 -2 lines
Seventy-odd "its" / "it's" typos in comments fixed as per kern/6108.

Revision 1.50: download - view: text, markup, annotated - select for diffs
Wed Apr 15 11:10:28 1998 UTC (13 years, 9 months ago) by bde
Branches: MAIN
Diff to: previous 1.49: preferred, colored
Changes since revision 1.49: +2 -2 lines
Fixed breakage of fork accounting in previous commit.  A fork benchmark
reported about 15 times as much sys time as real time.  getmicroruntime()
is confusing name.

Revision 1.49: download - view: text, markup, annotated - select for diffs
Sat Apr 4 13:24:07 1998 UTC (13 years, 10 months ago) by phk
Branches: MAIN
Diff to: previous 1.48: preferred, colored
Changes since revision 1.48: +5 -3 lines
Time changes mark 2:

    * Figure out UTC relative to boottime.  Four new functions provide
      time relative to boottime.

    * move "runtime" into struct proc.  This helps fix the calcru()
      problem in SMP.

    * kill mono_time.

    * add timespec{add|sub|cmp} macros to time.h.  (XXX: These may change!)

    * nanosleep, select & poll takes long sleeps one day at a time

Reviewed by:    bde
Tested by:      ache and others

Revision 1.48: download - view: text, markup, annotated - select for diffs
Mon Mar 23 19:52:23 1998 UTC (13 years, 10 months ago) by jlemon
Branches: MAIN
Diff to: previous 1.47: preferred, colored
Changes since revision 1.47: +13 -1 lines
Add the ability to make real-mode BIOS calls from the kernel.  Currently,
everything is contained inside #ifdef VM86, so this option must be
present in the config file to use this functionality.

Thanks to Tor Egge, these changes should work on SMP machines.  However,
it may not be throughly SMP-safe.

Currently, the only BIOS calls made are memory-sizing routines at bootup,
these replace reading the RTC values.

Revision 1.47: download - view: text, markup, annotated - select for diffs
Mon Oct 27 17:19:20 1997 UTC (14 years, 3 months ago) by bde
Branches: MAIN
CVS tags: old_PRE_SOFTUPDATE, old_POST_SOFTUPDATE
Diff to: previous 1.46: preferred, colored
Changes since revision 1.46: +1 -3 lines
Oops, <machine/psl.h> is used unconditionally in -current.

Revision 1.46: download - view: text, markup, annotated - select for diffs
Mon Oct 27 16:35:34 1997 UTC (14 years, 3 months ago) by bde
Branches: MAIN
Diff to: previous 1.45: preferred, colored
Changes since revision 1.45: +17 -16 lines
Cleaned up #includes.

Ifdefed conditionally used includes.

Finished changing indentation of per-statement comments to 40.

Revision 1.45: download - view: text, markup, annotated - select for diffs
Fri Oct 10 09:43:57 1997 UTC (14 years, 4 months ago) by peter
Branches: MAIN
Diff to: previous 1.44: preferred, colored
Changes since revision 1.44: +4 -1 lines
Convert the VM86 option from a global option to an option only depended
on by the files that use it.  Changing the VM86 option now only causes
a recompile of a dozen files or so rather than the entire kernel.

Revision 1.44: download - view: text, markup, annotated - select for diffs
Sun Sep 7 22:03:37 1997 UTC (14 years, 5 months ago) by fsmp
Branches: MAIN
Diff to: previous 1.43: preferred, colored
Changes since revision 1.43: +22 -27 lines
General cleanup of the lock pushdown code.  They are grouped and enabled
from machine/smptests.h:

#define PUSHDOWN_LEVEL_1
#define PUSHDOWN_LEVEL_2
#define PUSHDOWN_LEVEL_3
#define PUSHDOWN_LEVEL_4_NOT

Revision 1.43: download - view: text, markup, annotated - select for diffs
Sat Aug 30 08:08:09 1997 UTC (14 years, 5 months ago) by fsmp
Branches: MAIN
Diff to: previous 1.42: preferred, colored
Changes since revision 1.42: +3 -3 lines
Another round of lock pushdown.
Add a simplelock to deal with disable_intr()/enable_intr() as used in UP kernel.
UP kernel expects that this is enough to guarantee exclusive access to
regions of code bracketed by these 2 functions.
Add a simplelock to bracket clock accesses in clock.c: clock_lock.

Help from:	Bruce Evans <bde@zeta.org.au>

Revision 1.42: download - view: text, markup, annotated - select for diffs
Fri Aug 29 18:16:17 1997 UTC (14 years, 5 months ago) by fsmp
Branches: MAIN
Diff to: previous 1.41: preferred, colored
Changes since revision 1.41: +42 -9 lines
Support for the new FAST_HI algorithm.
Improved interrupt handling, fewer silo overflows.

With help from:	dave adkins <adkin003@gold.tc.umn.edu>

Revision 1.41: download - view: text, markup, annotated - select for diffs
Sun Aug 24 00:05:29 1997 UTC (14 years, 5 months ago) by fsmp
Branches: MAIN
Diff to: previous 1.40: preferred, colored
Changes since revision 1.40: +63 -12 lines
The last of the encapsolation of cpl/spl/ipending things into a critical
region protected by the simplelock 'cpl_lock'.

Notes:

 - this code is currently controlled on a section by section basis with
   defines in machine/param.h.  All sections are currently enabled.

 - this code is not as clean as I would like, but that can wait till later.

 - the "giant lock" still surrounds most instances of this "cpl region".
   I still have to do the code that arbitrates setting cpl between the
   top and bottom halves of the kernel.

 - the possibility of deadlock exists, I am committing the code at this
   point so as to exercise it and detect any such cases B4 the "giant lock"
   is removed.

Revision 1.40: download - view: text, markup, annotated - select for diffs
Thu Aug 21 05:08:24 1997 UTC (14 years, 5 months ago) by fsmp
Branches: MAIN
Diff to: previous 1.39: preferred, colored
Changes since revision 1.39: +2 -43 lines
Made PEND_INTS default.
Made NEW_STRATEGY default.
Removed misc. old cruft.

Centralized simple locks into mp_machdep.c
Centralized simple lock macros into param.h

More cleanup in the direction of making splxx()/cpl MP-safe.

Revision 1.39: download - view: text, markup, annotated - select for diffs
Wed Aug 20 05:25:44 1997 UTC (14 years, 5 months ago) by fsmp
Branches: MAIN
Diff to: previous 1.38: preferred, colored
Changes since revision 1.38: +33 -23 lines
Preperation for moving cpl into critical region access.
Several new fine-grained locks.
New FAST_INTR() methods:
 - separate simplelock for FAST_INTR, no more giant lock.
 - FAST_INTR()s no longer checks ipending on way out of ISR.
sio made MP-safe (I hope).

Revision 1.38: download - view: text, markup, annotated - select for diffs
Sun Aug 10 21:18:01 1997 UTC (14 years, 6 months ago) by fsmp
Branches: MAIN
Diff to: previous 1.37: preferred, colored
Changes since revision 1.37: +9 -1 lines
Oops, fix breakage to UP kernel.

Revision 1.37: download - view: text, markup, annotated - select for diffs
Sun Aug 10 20:59:06 1997 UTC (14 years, 6 months ago) by fsmp
Branches: MAIN
Diff to: previous 1.36: preferred, colored
Changes since revision 1.36: +28 -51 lines
Added trap specific lock calls: get_fpu_lock, etc.
All resolve to the GIANT_LOCK at this time, it is purely a logical partitioning.

Revision 1.36: download - view: text, markup, annotated - select for diffs
Sat Aug 9 22:52:59 1997 UTC (14 years, 6 months ago) by fsmp
Branches: MAIN
Diff to: previous 1.35: preferred, colored
Changes since revision 1.35: +4 -1 lines
Minor conditionalization of XXX_MPLOCK on PEND_INTS.

Revision 1.35: download - view: text, markup, annotated - select for diffs
Sat Aug 9 00:02:31 1997 UTC (14 years, 6 months ago) by dyson
Branches: MAIN
Diff to: previous 1.34: preferred, colored
Changes since revision 1.34: +5 -1 lines
VM86 kernel support.
	Work done by BSDI, Jonathan Lemon <jlemon@americantv.com>,
	Mike Smith <msmith@gsoft.com.au>, Sean Eric Fagan <sef@kithrup.com>,
	and probably alot of others.
Submitted by:	Jnathan Lemon <jlemon@americantv.com>

Revision 1.34: download - view: text, markup, annotated - select for diffs
Thu Jul 31 05:43:02 1997 UTC (14 years, 6 months ago) by fsmp
Branches: MAIN
Diff to: previous 1.33: preferred, colored
Changes since revision 1.33: +21 -5 lines
Converted the TEST_LOPRIO code to default.
Created mplock functions that save/restore NO registers.
Minor cleanup.

Revision 1.33: download - view: text, markup, annotated - select for diffs
Wed Jul 23 20:47:18 1997 UTC (14 years, 6 months ago) by fsmp
Branches: MAIN
Diff to: previous 1.32: preferred, colored
Changes since revision 1.32: +18 -1 lines
New simple_lock code in asm:
 - s_lock_init()
 - s_lock()
 - s_lock_try()
 - s_unlock()

Created lock for IO APIC and apic_imen  (SMP version of imen)
 - imen_lock

Code to use imen_lock for access from apic_ipl.s and apic_vector.s.
Moved this code *outside* of mp_lock.

It seems to work!!!

Revision 1.32: download - view: text, markup, annotated - select for diffs
Sun Jul 20 08:37:17 1997 UTC (14 years, 6 months ago) by bde
Branches: MAIN
Diff to: previous 1.31: preferred, colored
Changes since revision 1.31: +1 -4 lines
Removed unused #includes.

Revision 1.31: download - view: text, markup, annotated - select for diffs
Tue Jul 1 01:02:03 1997 UTC (14 years, 7 months ago) by bde
Branches: MAIN
CVS tags: old_WOLLMAN_MBUF, old_BP_WOLLMAN_MBUF
Diff to: previous 1.30: preferred, colored
Changes since revision 1.30: +2 -5 lines
Un-inline a call to spl0().  It is not time critical, and was only inline
because there was no non-inline spl0() to call.

Revision 1.30: download - view: text, markup, annotated - select for diffs
Sun Jun 22 16:03:02 1997 UTC (14 years, 7 months ago) by peter
Branches: MAIN
Diff to: previous 1.29: preferred, colored
Changes since revision 1.29: +2 -8 lines
Preliminary support for per-cpu data pages.

This eliminates a lot of #ifdef SMP type code.  Things like _curproc reside
in a data page that is unique on each cpu, eliminating the expensive macros
like:    #define curproc (SMPcurproc[cpunumber()])

There are some unresolved bootstrap and address space sharing issues at
present, but Steve is waiting on this for other work.  There is still some
strictly temporary code present that isn't exactly pretty.

This is part of a larger change that has run into some bumps, this part is
standalone so it should be safe.  The temporary code goes away when the
full idle cpu support is finished.

Reviewed by: fsmp, dyson

Revision 1.29: download - view: text, markup, annotated - select for diffs
Sat May 31 09:27:28 1997 UTC (14 years, 8 months ago) by peter
Branches: MAIN
Diff to: previous 1.28: preferred, colored
Changes since revision 1.28: +2 -2 lines
Include file updates..  <machine/spl.h> -> <machine/ipl.h>, add
<machine/ipl.h> to those files that were depending on getting SWI_*
implicitly via <machine/cpufunc.h>

Revision 1.28: download - view: text, markup, annotated - select for diffs
Thu May 29 05:11:09 1997 UTC (14 years, 8 months ago) by peter
Branches: MAIN
Diff to: previous 1.27: preferred, colored
Changes since revision 1.27: +1 -2 lines
remove no longer needed opt_smp.h includes

Revision 1.27: download - view: text, markup, annotated - select for diffs
Mon May 26 18:00:34 1997 UTC (14 years, 8 months ago) by fsmp
Branches: MAIN
Diff to: previous 1.26: preferred, colored
Changes since revision 1.26: +21 -17 lines
Changed inclusion of isa/icu.s to isa/ipl.s.
This is part of the breakup of UP/SMP specific INTerrupt code.

Revision 1.26: download - view: text, markup, annotated - select for diffs
Wed May 7 20:07:25 1997 UTC (14 years, 9 months ago) by peter
Branches: MAIN
Diff to: previous 1.25: preferred, colored
Changes since revision 1.25: +6 -1 lines
forgotten comment

Revision 1.25: download - view: text, markup, annotated - select for diffs
Sat Apr 26 11:45:05 1997 UTC (14 years, 9 months ago) by peter
Branches: MAIN
CVS tags: old_post_smp_merge
Diff to: previous 1.24: preferred, colored
Changes since revision 1.24: +21 -1 lines
Man the liferafts!  Here comes the long awaited SMP -> -current merge!

There are various options documented in i386/conf/LINT, there is more to
come over the next few days.

The kernel should run pretty much "as before" without the options to
activate SMP mode.

There are a handful of known "loose ends" that need to be fixed, but
have been put off since the SMP kernel is in a moderately good condition
at the moment.

This commit is the result of the tinkering and testing over the last 14
months by many people.  A special thanks to Steve Passe for implementing
the APIC code!

Revision 1.24: download - view: text, markup, annotated - select for diffs
Sun Apr 13 16:58:08 1997 UTC (14 years, 10 months ago) by bde
Branches: MAIN
CVS tags: old_pre_smp_merge
Diff to: previous 1.23: preferred, colored
Changes since revision 1.23: +7 -7 lines
Don't forget to set `runtime' in fork_trampoline().  The time slice before
switching to a child for the first time was being counted twice.  I think
this only affected unimportant statistics.

Simplified arg handling in fork_trampoline().  splz() doesn't actually
smash the registers of interest.

Revision 1.23: download - view: text, markup, annotated - select for diffs
Mon Apr 7 11:42:09 1997 UTC (14 years, 10 months ago) by peter
Branches: MAIN
Diff to: previous 1.22: preferred, colored
Changes since revision 1.22: +9 -2 lines
Lower the spl() of the new process from splhigh() right away, since
nothing else will lower it until either much later, or never(?) for
kernel processes.

This basically re-fixes what Bruce fixed in rev 1.29 of kern_fork.c,
which was broken again now the child does not execute back up the fork()
calling tree.

Revision 1.22: download - view: text, markup, annotated - select for diffs
Mon Apr 7 07:15:48 1997 UTC (14 years, 10 months ago) by peter
Branches: MAIN
Diff to: previous 1.21: preferred, colored
Changes since revision 1.21: +15 -1 lines
The biggie: Get rid of the UPAGES from the top of the per-process address
space. (!)

Have each process use the kernel stack and pcb in the kvm space.  Since
the stacks are at a different address, we cannot copy the stack at fork()
and allow the child to return up through the function call tree to return
to user mode - create a new execution context and have the new process
begin executing from cpu_switch() and go to user mode directly.
In theory this should speed up fork a bit.

Context switch the tss_esp0 pointer in the common tss.  This is a lot
simpler since than swithching the gdt[GPROC0_SEL].sd.sd_base pointer
to each process's tss since the esp0 pointer is a 32 bit pointer, and the
sd_base setting is split into three different bit sections at non-aligned
boundaries and requires a lot of twiddling to reset.

The 8K of memory at the top of the process space is now empty, and unmapped
(and unmappable, it's higher than VM_MAXUSER_ADDRESS).

Simplity the pmap code to manage process contexts, we no longer have to
double map the UPAGES, this simplifies and should measuably speed up fork().

The following parts came from John Dyson:

Set PG_G on the UPAGES that are now in kernel context, and invalidate
them when swapping them out.

Move the upages object (upobj) from the vmspace to the proc structure.

Now that the UPAGES (pcb and kernel stack) are out of user space, make
rfork(..RFMEM..) do what was intended by sharing the vmspace
entirely via reference counting rather than simply inheriting the mappings.

Revision 1.21: download - view: text, markup, annotated - select for diffs
Sat Feb 22 09:32:16 1997 UTC (14 years, 11 months ago) by peter
Branches: MAIN
Diff to: previous 1.20: preferred, colored
Changes since revision 1.20: +1 -1 lines
Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$.  We are not
ready for it yet.

Revision 1.20: download - view: text, markup, annotated - select for diffs
Tue Jan 14 06:38:45 1997 UTC (15 years ago) by jkh
Branches: MAIN
Diff to: previous 1.19: preferred, colored
Changes since revision 1.19: +1 -1 lines
Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.

Revision 1.19: download - view: text, markup, annotated - select for diffs
Sun Aug 11 17:41:23 1996 UTC (15 years, 6 months ago) by davidg
Branches: MAIN
CVS tags: old_RELENG_2_2_BP, old_RELENG_2_2_7_RELEASE, old_RELENG_2_2_6_RELEASE, old_RELENG_2_2_5_RELEASE, old_RELENG_2_2_2_RELEASE, old_RELENG_2_2_1_RELEASE, old_RELENG_2_2_0_RELEASE
Branch point for: old_RELENG_2_2
Diff to: previous 1.18: preferred, colored
Changes since revision 1.18: +3 -1 lines
Add support for i686 machine check trap.

Revision 1.18: download - view: text, markup, annotated - select for diffs
Fri May 31 01:08:02 1996 UTC (15 years, 8 months ago) by peter
Branches: MAIN
Diff to: previous 1.17: preferred, colored
Changes since revision 1.17: +7 -6 lines
Jump some hoops to have the *.s code being able to be run through both an
ansi and traditional cpp.

The nesting rules of macros are different, which required some changes.
Use __CONCAT(x,y) instead of /**/.
Redo some comments to use /* */ rather than "# comment" because the ansi
  cpp cares about those, and also cares about quote matching.

Revision 1.17: download - view: text, markup, annotated - select for diffs
Thu May 2 09:34:20 1996 UTC (15 years, 9 months ago) by phk
Branches: MAIN
Diff to: previous 1.16: preferred, colored
Changes since revision 1.16: +2 -28 lines
KGDB is dead.  It may come back one day if somebody does it.

Revision 1.16: download - view: text, markup, annotated - select for diffs
Fri Apr 12 12:22:14 1996 UTC (15 years, 10 months ago) by phk
Branches: MAIN
Diff to: previous 1.15: preferred, colored
Changes since revision 1.15: +2 -1 lines
Make alltraps a .globl so that DDB doesn't make people belive they have
an ALIGNFLT on their hands all the time.

Revision 1.15: download - view: text, markup, annotated - select for diffs
Sat Mar 2 19:37:37 1996 UTC (15 years, 11 months ago) by peter
Branches: MAIN
CVS tags: old_wollman_polling
Diff to: previous 1.14: preferred, colored
Changes since revision 1.14: +6 -6 lines
Mega-commit for Linux emulator update..  This has been stress tested under
netscape-2.0 for Linux running all the Java stuff.  The scrollbars are now
working, at least on my machine. (whew! :-)

I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.

The main changes:

COMPAT_LINUX is *GONE*.  Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself.  The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code.  All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first.  Like IBCS2, you can statically compile it in with "options LINUX".

A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality().  The Linux-ELF libraries want
to use some of these.

linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.

Quite a few bugs removed, including incorrect arguments being used in
syscalls..  eg:  mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.

The build for the code has changed.  i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.

Supporting changes elsewhere in the kernel:

The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS).  This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.

The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only.  This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.

makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code.  It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)

At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area.  This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.

Revision 1.9.2.3: download - view: text, markup, annotated - select for diffs
Tue Jan 30 09:19:25 1996 UTC (16 years ago) by davidg
Branches: old_RELENG_2_1_0
CVS tags: old_RELENG_2_1_7_RELEASE, old_RELENG_2_1_6_RELEASE, old_RELENG_2_1_6_1_RELEASE, old_RELENG_2_1_5_RELEASE
Diff to: previous 1.9.2.2: preferred, colored; branchpoint 1.9: preferred, colored
Changes since revision 1.9.2.2: +1 -12 lines
Brought in changes from revs 1.12-1.14 of db_trace.c and related changes:
rewrite of DDB's stack traceback code to fix multiple bugs in it.

Revision 1.9.2.2: download - view: text, markup, annotated - select for diffs
Sat Jan 13 10:46:22 1996 UTC (16 years, 1 month ago) by davidg
Branches: old_RELENG_2_1_0
Diff to: previous 1.9.2.1: preferred, colored; branchpoint 1.9: preferred, colored
Changes since revision 1.9.2.1: +1 -3 lines
Retrofitted my double-fault handler changes from -current. These are too
important to leave out of the next release.

Revision 1.14: download - view: text, markup, annotated - select for diffs
Thu Dec 21 19:20:57 1995 UTC (16 years, 1 month ago) by davidg
Branches: MAIN
Diff to: previous 1.13: preferred, colored
Changes since revision 1.13: +1 -12 lines
Rewrote most of the ddb stack traceback code. These changes are smarter
about decoding trap/syscall/interrupt frames and generally works better
than the previous stuff.
Removed some special (incorrect) frobbing of the frame pointer that
was messing some things up with the new traceback code.

Revision 1.13: download - view: text, markup, annotated - select for diffs
Tue Dec 19 14:30:24 1995 UTC (16 years, 1 month ago) by davidg
Branches: MAIN
Diff to: previous 1.12: preferred, colored
Changes since revision 1.12: +1 -3 lines
Implemented a (sorely needed for years) double fault handler to catch stack
overflows.
It sure would be nice if there was an unmapped page between the PCB and
the stack (and that the size of the stack was configurable!). With the
way things are now, the PCB will get clobbered before the double fault
handler gets control, making somewhat of a mess of things. Despite this,
it is still fairly easy to poke around in the overflowed stack to figure
out the cause.

Revision 1.12: download - view: text, markup, annotated - select for diffs
Thu Dec 14 14:35:33 1995 UTC (16 years, 2 months ago) by peter
Branches: MAIN
Diff to: previous 1.11: preferred, colored
Changes since revision 1.11: +3 -3 lines
GENERIC/LINT: Remove redundant quoting on some option lines.
LINT: add a couple of new/missing/undocumented options
files.i386: add linux code so that you can compile a kernel with static
linux emulation ("options LINUX")
i386/*: use #if defined(COMPAT_LINUX) || defined(LINUX) to enable static
support of linux emulation (just like "IBCS2" makes ibcs2 static)

The main thing this is going to make obvious, is that the LINUX code
(when compiled from LINT) has a lot of warnings, some of which dont look
too pleasant..

Revision 1.11: download - view: text, markup, annotated - select for diffs
Thu Sep 7 21:36:17 1995 UTC (16 years, 5 months ago) by davidg
Branches: MAIN
Diff to: previous 1.10: preferred, colored
Changes since revision 1.10: +13 -15 lines
Minor cleanup and (very) small micro optimization to Xsyscall (and the
linux one)..

Revision 1.9.2.1: download - view: text, markup, annotated - select for diffs
Wed Aug 23 05:22:34 1995 UTC (16 years, 5 months ago) by davidg
Branches: old_RELENG_2_1_0
CVS tags: old_RELENG_2_1_0_RELEASE
Diff to: previous 1.9: preferred, colored
Changes since revision 1.9: +13 -1 lines
Brought in change from rev 1.10: fake a call frame so that debugger stack
tracebacks work correctly for traps.

Revision 1.10: download - view: text, markup, annotated - select for diffs
Tue Aug 15 19:23:33 1995 UTC (16 years, 5 months ago) by bde
Branches: MAIN
Diff to: previous 1.9: preferred, colored
Changes since revision 1.9: +13 -1 lines
Fake a call frame for traps so that `gdb -k' can report where fatal
traps occurred.  This also helps ddb backtrace through trap frames.
Backtracing through syscall and interrupt frames still doesn't work
but it is relatively unimportant and more expensive to fix.

Revision 1.9: download - view: text, markup, annotated - select for diffs
Sun Jun 11 19:31:13 1995 UTC (16 years, 8 months ago) by rgrimes
Branches: MAIN
CVS tags: old_RELENG_2_1_0_BP
Branch point for: old_RELENG_2_1_0
Diff to: previous 1.8: preferred, colored
Changes since revision 1.8: +10 -18 lines
Merge RELENG_2_0_5 into HEAD

Revision 1.8.2.1: download - view: text, markup, annotated - select for diffs
Mon Jun 5 00:22:02 1995 UTC (16 years, 8 months ago) by davidg
Branches: old_RELENG_2_0_5
CVS tags: old_RELENG_2_0_5_RELEASE
Diff to: previous 1.8: preferred, colored; next MAIN 1.9: preferred, colored
Changes since revision 1.8: +10 -18 lines
Various fixes for linux compatibility.

Submitted by:	Soren Schmidt

Revision 1.8: download - view: text, markup, annotated - select for diffs
Tue Feb 14 19:16:40 1995 UTC (16 years, 11 months ago) by sos
Branches: MAIN
CVS tags: old_RELENG_2_0_5_BP, old_RELENG_2_0_5_ALPHA
Branch point for: old_RELENG_2_0_5
Diff to: previous 1.7: preferred, colored
Changes since revision 1.7: +39 -1 lines
First attempt to run linux binaries. This is only the changes needed to
the generic kernel. The actual emulator is a separate LKM. (not finished
yet, sorry).
Submitted by:	sos@freebsd.org & sef@kithrup.com

Revision 1.7: download - view: text, markup, annotated - select for diffs
Sat Jan 14 13:20:05 1995 UTC (17 years, 1 month ago) by bde
Branches: MAIN
Diff to: previous 1.6: preferred, colored
Changes since revision 1.6: +4 -32 lines
Fix security holes in sigreturn(), ptrace() and procfs.  sigreturn()
attempted to check for insecure and fatal eflags and segment
selectors, but missed many cases and got the IOPL check back to
front.  The other syscalls didn't check at all.

sys_process.c, machdep.c:
Only allow PT_WRITE_U to write to the registers (ordinary and FP).

psl.h, locore.s, machdep.c:
Eliminate PSL_MBZ, PSL_MBO and PSL_USERCLR.  We are not supposed
to assume anything about the reserved bits.  Use PSL_USERCHANGE
and PSL_KERNEL instead.  Rename PSL_USERSET to PSL_USER.

exception.s:
Define a private label for use by doreti when returning to user
mode fails.

machdep.c:
In syscalls, allow changing only the eflags that can be changed on
486's in user mode (no longer attempt to allow benign IOPL changes;
allow changing the nasty PSL_NT; don't allow changing the i586
bits).

Don't attempt to check all the cases involving invalid selectors
and %eip's.  Just check for privilege violations and let the invalid
things cause a trap.

procfs_machdep.c:
Call the ptrace register functions to do all the work for reading
and writing ordinary registers and for single stepping.

trap.c:
Ignore traps caused by PSL_NT being set.  Previously, users could
cause a fatal trap in user mode by setting PSL_NT and executing an
iret, and a fatal trap in kernel mode by setting PSL_NT and making
a syscall.  PSL_NT was cleared too late and not in enough modes to
fix the problem.

Make all traps in user mode (except T_NMI) nonfatal.

Recover from traps caused by attempting to load invalid user
registers in doreti by restarting the traps so that they appear to
occur in user mode.
---

Fix bogons that I noticed while fixing the above:

psl.h:
Fix some comments.

Uniformize idempotency ifdef.

exception.s, machdep.c:
Remove rsvd[0-14].  rsvd0 hasn't been reserved since the 486 came
out.  Replace rsvd0 by `align'.  rsvd[0-11] used wrong (magic
non-unique) trap numbers.  Replace rsvd[1-14] by rsvd.

locore.s:
Enable alignment check flag on 486's and 586's.

machdep.c:
Use a better type for kstack[].

Use TFREGP() to find the registers.

Reformat ptrace functions from SEF to something closer to KNF.

procfs_machdep.c:
The wrong pointer to the registers got fixed as a side effect.

Implement reading and writing of FP registers.

/proc/*/*regs now work (only) for processes that are in memory.

Clean up comments.

trap.c, trap.h:
Remove unused trap types.

Revision 1.6: download - view: text, markup, annotated - select for diffs
Sat Dec 3 10:02:19 1994 UTC (17 years, 2 months ago) by bde
Branches: MAIN
Diff to: previous 1.5: preferred, colored
Changes since revision 1.5: +9 -4 lines
i386/exception.s,
	Keep track of interrupt nesting level.  It is normally 0
	for syscalls and traps, but is fudged to 1 for their exit
	processing in case they metamorphose into an interrupt
	handler.

i386/genassym.c;
	Remove support for the obsolete pcb_iml and pcb_cmap2.

	Add support for pcb_inl.

i386/swtch.s:
	Fudge the interrupt nesting level across context switches and in
	the idle loop so that the work for preemptive context switches
	gets counted as interrupt time, the work for voluntary context
	switches gets counted mostly as system time (the part when
	curproc == 0 gets counted as interrupt time), and only truly idle
	time gets counted as idle time.

	Remove obsolete support (commented out and otherwise) for pcb_iml.

	Load curpcb just before curproc instead of just after so that
	curpcb is always valid if curproc is.  A few more changes like
	this may fix tracing through context switches.

	Remove obsolete function swtch_to_inactive().

include/cpu.h:
	Use the new interrupt nesting level variable to implement a
	non-fake CLF_INTR() so that accounting for the interrupt state
	works.

	You can use top, iostat or (best) an up to date systat to see
	interrupt overheads.  I see the expected huge interrupt overheads
	for ISA devices (on a 486DX/33, about 55% for an IDE drive
	transferring 1250K/sec and the same for a WD8013EBT network card
	transferring 1100K/sec).  The huge interrupt overheads for serial
	devices are unfortunately normally invisible.

include/pcb.h:
	Remove the obsolete pcb_iml and pcb_cmap2.  Replace them by
	padding to preserve binary compatibility.

	Use part of the new padding for pcb_inl.

isa/icu.s:
isa/vector.s:
	Keep track of interrupt nesting level.

Revision 1.5: download - view: text, markup, annotated - select for diffs
Wed Sep 28 03:37:49 1994 UTC (17 years, 4 months ago) by bde
Branches: MAIN
CVS tags: old_RELEASE_2_0, old_OLAH_TTCP, old_BETA_2_0, old_ALPHA_2_0
Diff to: previous 1.4: preferred, colored
Changes since revision 1.4: +16 -2 lines
Ensure normal selection and alignment of the text and data sections before
including files.  vector.s sometimes left the data section misaligned
(depending on the configuration) so all the time-critical globals in icu.s
were sometimes misaligned.

Revision 1.4: download - view: text, markup, annotated - select for diffs
Sat Aug 13 03:49:38 1994 UTC (17 years, 6 months ago) by wollman
Branches: MAIN
Diff to: previous 1.3: preferred, colored
Changes since revision 1.3: +7 -7 lines
Change all #includes to follow the current Berkeley style.  Some of these
``changes'' are actually not changes at all, but CVS sometimes has trouble
telling the difference.

This also includes support for second-directory compiles.  This is not
quite complete yet, as `config' doesn't yet do the right thing.  You can
still make it work trivially, however, by doing the following:

rm /sys/compile
mkdir /usr/obj/sys/compile
ln -s M-. /sys/compile
cd /sys/i386/conf
config MYKERNEL
cd ../../compile/MYKERNEL
ln -s /sys @
rm machine
ln -s @/i386/include machine
make depend
make

Revision 1.3: download - view: text, markup, annotated - select for diffs
Sat Apr 2 07:00:23 1994 UTC (17 years, 10 months ago) by davidg
Branches: MAIN
CVS tags: old_REL_before_johndavid_2_0_0, old_MOVED_NEWCVS
Diff to: previous 1.2: preferred, colored
Changes since revision 1.2: +69 -69 lines
   New interrupt code from Bruce Evans. In additional to Bruce's attached
list of changes, I've made the following additional changes:

1) i386/include/ipl.h renamed to spl.h as the name conflicts with the
   file of the same name in i386/isa/ipl.h.
2) changed all use of *mask (i.e. netmask, biomask, ttymask, etc) to
   *_imask (net_imask, etc).
3) changed vestige of splnet use in if_is to splimp.
4) got rid of "impmask" completely (Bruce had gotten rid of netmask),
   and are now using net_imask instead.
5) dozens of minor cruft to glue in Bruce's changes.

   These require changes I made to config(8) as well, and thus it must
be rebuilt.

-DG

from Bruce Evans:

sio:
	o No diff is supplied.  Remove the define of setsofttty().  I hope
	  that is enough.

*.s:
	o i386/isa/debug.h no longer exists.  The event counters became too
	  much trouble to maintain.  All function call entry and exception
	  entry counters can be recovered by using profiling kernel (the new
	  profiling supports all entry points; however, it is too slow to
	  leave enabled all the time; it also).  Only BDBTRAP() from debug.h
	  is now used.  That is moved to exception.s.  It might be worth
	  preserving SHOW_BITS() and calling it from _mcount() (if enabled).
	o T_ASTFLT is now only set just before calling trap().
	o All exception handlers set SWI_AST_MASK in cpl as soon as possible
	  after entry and arrange for _doreti to restore it atomically with
	  exiting.  It is not possible to set it atomically with entering
	  the kernel, so it must be checked against the user mode bits in
	  the trap frame before committing to using it.  There is no place
	  to store the old value of cpl for syscalls or traps, so there are
	  some complications restoring it.

Profiling stuff (mostly in *.s):
	o Changes to kern/subr_mcount.c, gcc and gprof are not supplied yet.
	o All interesting labels `foo' are renamed `_foo' and all
	  uninteresting labels `_bar' are renamed `bar'.  A small change
	  to gprof allows ignoring labels not starting with underscores.
	o MCOUNT_LABEL() is to provide names for counters for times spent
	  in exception handlers.
	o FAKE_MCOUNT() is a version of MCOUNT() suitable for exception
	  handlers.  Its arg is the pc where the exception occurred.  The
	  new mcount() pretends that this was a call from that pc to a
	  suitable MCOUNT_LABEL().
	o MEXITCOUNT is to turn off any timer started by MCOUNT().

/usr/src/sys/i386/i386/exception.s:
	o The non-BDB BPTTRAP() macros were doing a sti even when interrupts
	  were disabled when the trap occurred.  The sti (fixed) sti is
	  actually a no-op unless you have my changes to machdep.c that make
	  the debugger trap gates interrupt gates, but fixing that would
	  make the ifdefs messier.  ddb seems to be unharmed by both
	  interrupts always disabled and always enabled (I had the branch in
	  the fix back to front for some time :-().
	o There is no known pushal bug.
	o tf_err can be left as garbage for syscalls.

/usr/src/sys/i386/i386/locore.s:
	o Fix and update BDE_DEBUGGER support.
	o ENTRY(btext) before initialization was dangerous.
	o Warm boot shot was longer than intended.

/usr/src/sys/i386/i386/machdep.c:
	o DON'T APPLY ALL OF THIS DIFF.  It's what I'm using, but may require
	  other changes.
	  Use the following:
		o Remove aston() and setsoftclock().
	  Maybe use the following:
		o No netisr.h.
		o Spelling fix.
		o Delay to read the Rebooting message.
		o Fix for vm system unmapping a reduced area of memory
		  after bounds_check_with_label() reduces the size of
		  a physical i/o for a partition boundary.  A similar
		  fix is required in kern_physio.c.
		o Correct use of __CONCAT.  It never worked here for non-
		  ANSI cpp's.  Is it time to drop support for non-ANSI?
		o gdt_segs init.  0xffffffffUL is bogus because ssd_limit
		  is not 32 bits.  The replacement may have the same
		  value :-), but is more natural.
		o physmem was one page too low.  Confusing variable names.
	  Don't use the following:
		o Better numbers of buffers.  Each 8K page requires up to
		  16 buffer headers.  On my system, this results in 5576
		  buffers containing [up to] 2854912 bytes of memory.
		  The usual allocation of about 384 buffers only holds
		  192K of disk if you use it on an fs with a block size
		  of 512.
		o gdt changes for bdb.
		o *TGT -> *IDT changes for bdb.
		o #ifdefed changes for bdb.

/usr/src/sys/i386/i386/microtime.s:
	o Use the correct asm macros.  I think asm.h was copied from Mach
	  just for microtime and isn't used now.  It certainly doesn't
	  belong in <sys>.  Various macros are also duplicated in
	  sys/i386/boot.h and libc/i386/*.h.
	o Don't switch to and from the IRR; it is guaranteed to be selected
	  (default after ICU init and explicitly selected in isa.c too, and
	  never changed until the old microtime clobbered it).

/usr/src/sys/i386/i386/support.s:
	o Non-essential changes (none related to spls or profiling).
	o Removed slow loads of %gs again.  The LDT support may require
	  not relying on %gs, but loading it is not the way to fix it!
	  Some places (copyin ...) forgot to load it.  Loading it clobbers
	  the user %gs.  trap() still loads it after certain types of
	  faults so that fuword() etc can rely on it without loading it
	  explicitly.  Exception handlers don't restore it.  If we want
	  to preserve the user %gs, then the fastest method is to not
	  touch it except for context switches.  Comparing with
	  VM_MAXUSER_ADDRESS and branching takes only 2 or 4 cycles on
	  a 486, while loading %gs takes 9 cycles and using it takes
	  another.
	o Fixed a signed branch to unsigned.

/usr/src/sys/i386/i386/swtch.s:
	o Move spl0() outside of idle loop.
	o Remove cli/sti from idle loop.  sw1 does a cli, and in the
	  unlikely event of an interrupt occurring and whichqs becoming
	  zero, sw1 will just jump back to _idle.
	o There's no spl0() function in asm any more, so use splz().
	o swtch() doesn't need to be superaligned, at least with the
	  new mcounting.
	o Fixed a signed branch to unsigned.
	o Removed astoff().

/usr/src/sys/i386/i386/trap.c:
	o The decentralized extern decls were inconsistent, of course.
	o Fixed typo MATH_EMULTATE in comments. */
	o Removed unused variables.
	o Old netmask is now impmask; print it instead.  Perhaps we
	  should print some of the new masks.
	o BTW, trap() should not print anything for normal debugger
	  traps.

/usr/src/sys/i386/include/asmacros.h:
	o DON'T APPLY ALL OF THIS DIFF.  Just use some of the null macros
	  as necessary.

/usr/src/sys/i386/include/cpu.h:
	o CLKF_BASEPRI() changes since cpl == SWI_AST_MASK is now normal
	  while the kernel is running.
	o Don't use var++ to set boolean variables.  It fails after a mere
	  4G times :-) and is slower than storing a constant on [3-4]86s.

/usr/src/sys/i386/include/cpufunc.h:
	o DON'T APPLY ALL OF THIS DIFF.  You need mainly the include of
	  <machine/ipl.h>.  Unfortunately, <machine/ipl.h> is needed by
	  almost everything for the inlines.

/usr/src/sys/i386/include/ipl.h:
	o New file.  Defines spl inlines and SWI macros and declares most
	  variables related to hard and soft interrupt masks.

/usr/src/sys/i386/isa/icu.h:
	o Moved definitions to <machine/ipl.h>

/usr/src/sys/i386/isa/icu.s:
	o Software interrupts (SWIs) and delayed hardware interrupts (HWIs)
	  are now handled uniformally, and dispatching them from splx() is
	  more like dispatching them from _doreti.  The dispatcher is
	  essentially *(handler[ffs(ipending & ~cpl)]().
	o More care (not quite enough) is taken to avoid unbounded nesting
	  of interrupts.
	o The interface to softclock() is changed so that a trap frame is
	  not required.
	o Fast interrupt handlers are now handled more uniformally.
	  Configuration is still too early (new handlers would require
	  bits in <machine/ipl.h> and functions to vector.s).
	o splnnn() and splx() are no longer here; they are inline functions
	  (could be macros for other compilers).  splz() is the nontrivial
	  part of the old splx().

/usr/src/sys/i386/isa/ipl.h
	o New file.  Supposed to have only bus-dependent stuff.  Perhaps
	  the h/w masks should be declared here.

/usr/src/sys/i386/isa/isa.c:
	o DON'T APPLY ALL OF THIS DIFF.  You need only things involving
	  *mask and *MASK and comments about them.  netmask is now a pure
	  software mask.  It works like the softclock mask.

/usr/src/sys/i386/isa/vector.s:
	o Reorganize AUTO_EOI* macros.
	o Option FAST_INTR_HANDLER_USERS_ES for people who don't trust
	  fastintr handlers.
	o fastintr handlers need to metamorphose into ordinary interrupt
	  handlers if their SWI bit has become set.  Previously, sio had
	  unintended latency for handling output completions and input
	  of SLIP framing characters because this was not done.

/usr/src/sys/net/netisr.h:
	o The machine-dependent stuff is now imported from <machine/ipl.h>.

/usr/src/sys/sys/systm.h
	o DON'T APPLY ALL OF THIS DIFF.  You need mainly the different
	  splx() prototype.  The spl*() prototypes are duplicated as
	  inlines in <machine/ipl.h> but they need to be duplicated here
	  in case there are no inlines.  I sent systm.h and cpufunc.h
	  to Garrett.  We agree that spl0 should be replaced by splnone
	  and not the other way around like I've done.

/usr/src/sys/kern/kern_clock.c
	o splsoftclock() now lowers cpl so the direct call to softclock()
	  works as intended.
	o softclock() interface changed to avoid passing the whole frame
	  (some machines may need another change for profile_tick()).
	o profiling renamed _profiling to avoid ANSI namespace pollution.
	  (I had to improve the mcount() interface and may as well fix it.)
	  The GUPROF variant doesn't actually reference profiling here,
	  but the 'U' in GUPROF should mean to select the microtimer
	  mcount() and not change the interface.

Revision 1.2: download - view: text, markup, annotated - select for diffs
Mon Jan 3 07:55:20 1994 UTC (18 years, 1 month ago) by davidg
Branches: MAIN
CVS tags: old_GAMMA_1_1, old_FINAL_1_1, old_BP_BETA_1_1, old_BETA_1_1
Diff to: previous 1.1: preferred, colored
Changes since revision 1.1: +13 -27 lines
Convert syscall to trapframe. Based on work done by John Brezak.

Revision 1.1: download - view: text, markup, annotated - select for diffs
Sat Nov 13 02:24:57 1993 UTC (18 years, 3 months ago) by davidg
Branches: MAIN
First steps in rewriting locore.s, and making info useful
when the machine panics.

i386/i386/locore.s:
1) got rid of most .set directives that were being used like
	#define's, and replaced them with appropriate #define's in
	the appropriate header files (accessed via genassym).
2) added comments to header inclusions and global definitions,
	and global variables
3) replaced some hardcoded constants with cpp defines (such as
	PDESIZE and others)
4) aligned all comments to the same column to make them easier to
	read
5) moved macro definitions for ENTRY, ALIGN, NOP, etc. to
	/sys/i386/include/asmacros.h
6) added #ifdef BDE_DEBUGGER around all of Bruce's debugger code
7) added new global '_KERNend' to store last location+1 of kernel
8) cleaned up zeroing of bss so that only bss is zeroed
9) fix zeroing of page tables so that it really does zero them all
	- not just if they follow the bss.
10) rewrote page table initialization code so that 1) works correctly
	and 2) write protects the kernel text by default
11) properly initialize the kernel page directory, upages, p0stack PT,
	and page tables. The previous scheme was more than a bit
	screwy.
12) change allocation of virtual area of IO hole so that it is
	fixed at KERNBASE + 0xa0000. The previous scheme put it
	right after the kernel page tables and then later expected
	it to be at KERNBASE +0xa0000
13) change multiple bogus settings of user read/write of various
	areas of kernel VM - including the IO hole; we should never
	be accessing the IO hole in user mode through the kernel
	page tables
14) split kernel support routines such as bcopy, bzero, copyin,
	copyout, etc. into a seperate file 'support.s'
15) split swtch and related routines into a seperate 'swtch.s'
16) split routines related to traps, syscalls, and interrupts
	into a seperate file 'exception.s'
17) remove some unused global variables from locore that got
	inserted by Garrett when he pulled them out of some .h
	files.

i386/isa/icu.s:
1) clean up global variable declarations
2) move in declaration of astpending and netisr

i386/i386/pmap.c:
1) fix calculation of virtual_avail. It previously was calculated
	to be right in the middle of the kernel page tables - not
	a good place to start allocating kernel VM.
2) properly allocate kernel page dir/tables etc out of kernel map
	- previously only took out 2 pages.

i386/i386/machdep.c:
1) modify boot() to print a warning that the system will reboot in
	PANIC_REBOOT_WAIT_TIME amount of seconds, and let the user
	abort with a key on the console. The machine will wait for
	ever if a key is typed before the reboot. The default is
	15 seconds, but can be set to 0 to mean don't wait at all,
	-1 to mean wait forever, or any positive value to wait for
	that many seconds.
2) print "Rebooting..." just before doing it.

kern/subr_prf.c:
1) remove PANICWAIT as it is deprecated by the change to machdep.c

i386/i386/trap.c:
1) add table of trap type strings and use it to print a real trap/
	panic message rather than just a number. Lot's of work to
	be done here, but this is the first step. Symbolic traceback
	is in the TODO.

i386/i386/Makefile.i386:
1) add support in to build support.s, exception.s and swtch.s

...and various changes to various header files to make all of the
	above happen.

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