Commit Graph

790 Commits

Author SHA1 Message Date
Jonathan Mini
01ad8a53db Remove unused diagnostic function cread_free_thread().
Approved by:	alfred
2002-06-24 06:22:00 +00:00
Peter Wemm
7022a21abd Update an 'XXX what is this?' type comment about suswintr and fuswintr.
These are 16 bit short values used only by the profiling code.
2002-06-20 07:40:53 +00:00
Peter Wemm
b23619e02a Deorbit suibyte(). It was only used for split address space systems
for supporting UIO_USERISPACE (ie: it wasn't used).
2002-06-20 07:13:35 +00:00
Peter Wemm
8acb9efb5b ia32 %edx return comes from td_retval[1], not td_retval[0]
Obtained from:	dfr
2002-06-20 06:47:44 +00:00
Peter Wemm
6e1f6045c0 Use suword32/64 and fuword32/64 like elsewhere instead of inventing
suhword/fuhword.
2002-06-20 06:45:43 +00:00
Peter Wemm
3800e8732f panic rather than fault and explode if we fail to contigmalloc a kernel
stack.  This is still bad(TM), but at least we have a clue when we get
hit when contigmalloc fails.
2002-06-20 06:25:22 +00:00
Peter Wemm
3c2aff6c15 Use the canonical pmap_{new,dispose,swapin,swapout}_proc() functions,
in this case cut/pasted from sparc64 instead of messing with
contigmalloc where it is not needed.
2002-06-20 06:23:40 +00:00
Peter Wemm
2f9267ec23 Move the "- 1" into the RQB_FFS(mask) macro itself so that
implementations can provide a base zero ffs function if they wish.
This changes
  #define RQB_FFS(mask) (ffs64(mask))
  foo = RQB_FFS(mask) - 1;
to
  #define RQB_FFS(mask) (ffs64(mask) - 1)
  foo = RQB_FFS(mask);
On some platforms we can get the "- 1" for free, eg: those that use the
C code for ffs64().

Reviewed by:	jake (in principle)
2002-06-20 06:21:20 +00:00
John Baldwin
99cca534f3 - Fixup / remove obsolete comments.
- ktrace no longer requires Giant so do ktrace syscall events before and
  after acquiring and releasing Giant, respectively.
- For i386, ia32 syscalls on ia64, powerpc, and sparc64, get rid of the
  goto bad hack and instead use the model on ia64 and alpha were we
  skip the actual syscall invocation if error != 0.  This fixes a bug
  where if we the copyin() of the arguments failed for a syscall that
  was not marked MP safe, we would try to release Giant when we had
  not acquired it.
2002-06-07 05:47:35 +00:00
Marcel Moolenaar
b3e62a9883 Work around a bug in the Linux version of ski, that's specific to
SSC_GET_RTC. This fixes the panic seen shortly after mounting the
root file system.

Thanks to: "K.Sumitani" <ksumitani@mui.biglobe.ne.jp>
2002-06-06 22:49:23 +00:00
Jens Schweikhardt
21dc7d4f57 Fix typo in the BSD copyright: s/withough/without/
Spotted and suggested by:	des
MFC after:	3 weeks
2002-06-02 20:05:59 +00:00
Doug Rabson
99bd783419 Move the definition of ElfN_Hashelt to common headers. The only platform
which has a different definition for this is alpha.
2002-05-30 08:32:18 +00:00
Marcel Moolenaar
60c6f9b332 Remove the definition of struct mca_guid and use the generic
struct uuid defined in <sys/uuid.h>.

Use uuid/UUID instead of guid/GUID to emphasize that the
identifiers are DCE version 1 identifiers and also to avoid
inconsistencies as much a possible.
2002-05-29 05:19:07 +00:00
Jake Burkholder
d2ac231616 Make the run queue parameters machine dependent. Optimize 64 bit
architectures by using a 64 bit word for the bit array which keeps
track of non-empty queues.

Reviewed by:	peter
2002-05-25 01:12:23 +00:00
Marcel Moolenaar
76a0f0f560 o Add records for PCI bus and PCI device errors.
o  Rename mem_platform_id to mem_oem_id.
o  Minor style fixes.
2002-05-22 02:25:06 +00:00
Marcel Moolenaar
96700c9c35 Flesh-out ptrace support. This obviously needs more work. 2002-05-20 05:41:20 +00:00
Marcel Moolenaar
424f97a066 Fix a kernel page fault when accessing user memory. We were
combining too much conditions and as such ended up with the
kernel map instead of the corresponding process map. While
here, remove code to allow access to the stackgap and restyle
slightly to improve readability.

This fix specifically fixes the procfs failure we're having
when reading the process map (cat /proc/curproc/map)
2002-05-19 22:28:57 +00:00
Marcel Moolenaar
d3f6dd2160 It's time to build modules by default. 2002-05-19 20:25:11 +00:00
Marcel Moolenaar
8869375945 Simplify IA64_CMPXCHG to avoid having braced-groups in expressions.
As a minor positive side-effect, code at -O0 is more optimal. As a
minor negative side-effect, certain boundary cases yield no better
code than non-boundary cases. For example, atomic_set_acq_32(p, 0)
does a useless logical OR with value 0. This was previously elimina-
ted as part of if/while optimizations. Non-boundary cases yield
identical code at -O1 and -O2.
2002-05-19 20:19:07 +00:00
Marcel Moolenaar
ce1c850d62 Add record definition for memory checks. 2002-05-19 05:58:24 +00:00
Peter Wemm
bfbdcb3b13 Catch another C++ comment 2002-05-19 05:40:22 +00:00
Marcel Moolenaar
23c12a63cf o Remove namespace pollution from param.h:
-  Don't include ia64_cpu.h and cpu.h
   -  Guard definitions by  _NO_NAMESPACE_POLLUTION
   -  Move definition of KERNBASE to vmparam.h

o  Move definitions of IA64_RR_{BASE|MASK} to vmparam.h
o  Move definitions of IA64_PHYS_TO_RR{6|7} to vmparam.h

o  While here, remove some left-over Alpha references.
2002-05-19 04:42:19 +00:00
Marcel Moolenaar
55f50d95f7 o Move prototypes for restorectx and savectx from cpu.h to pcb.h,
o  Remove Alpha specific contents of struct md_coredump.
2002-05-19 04:14:42 +00:00
Marcel Moolenaar
0c7903d7f0 Remove option ACPI_DEBUG. It causes compile failures in the
function tracing bits due to __func__ being declared as const.
2002-05-19 03:50:54 +00:00
Marcel Moolenaar
c838906228 Cast dumpsize to long long to match printf format. 2002-05-19 03:47:19 +00:00
Tom Rhodes
d394511de3 More s/file system/filesystem/g 2002-05-16 21:28:32 +00:00
Poul-Henning Kamp
6380601f64 Move MI stuff out of MD param.h files.
It can all still be overridden in the MD files should need suddenly arise.
2002-05-14 20:35:29 +00:00
Poul-Henning Kamp
4c51ae2155 Remove the unused definitions of ctod() and dotc(). 2002-05-14 20:01:34 +00:00
Marcel Moolenaar
42f79044e3 s/_ALPHA_/_MACHINE_/ 2002-05-13 05:01:05 +00:00
Marcel Moolenaar
dfef48964d Remove reference to the "Alpha Calling Standard". 2002-05-13 04:58:12 +00:00
Jake Burkholder
26a9c7b7e1 These were repo-copied to dump_machdep.c. 2002-05-13 02:52:35 +00:00
Marcel Moolenaar
f5b454cf25 o Rename ia64_count_aps to ia64_count_cpus and reimplement the
function to return the total number of CPUs and not the highest
   CPU id.
o  Define mp_maxid based on the minimum of the actual number of
   CPUs in the system and MAXCPU.
o  In cpu_mp_add, when the CPU id of the CPU we're trying to add
   is larger than mp_maxid, don't add the CPU. Formerly this was
   based on MAXCPU. Don't count CPUs when we add them. We already
   know how many CPUs exist.
o  Replace MAXCPU with mp_maxid when used in loops that iterate
   over the id space. This avoids a couple of useless iterations.
o  In cpu_mp_unleash, use the number of CPUs to determine if we
   need to launch the CPUs.
o  Remove mp_hardware as it's not used anymore.
o  Move the IPI vector array from mp_machdep.c to sal.c. We use
   the array as a centralized place to collect vector assignments.
   Note that we still assign vectors to SMP specific IPIs in
   non-SMP configurations. Rename the array from mp_ipi_vector to
   ipi_vector.
o  Add IPI_MCA_RENDEZ and IPI_MCA_CMCV. These are used by MCA.
   Note that IPI_MCA_CMCV is not SMP specific.
o  Initialize the ipi_vector array so that we place the IPIs in
   sensible priority classes. The classes are relative to where
   the AP wake-up vector is located to guarantee that it's the
   highest priority (external) interrupt. Class assignment is
   as follows:
	class	IPI		notes
	x	AP wake-up	(normally x=15)
	x-1	MCA rendezvous
	x-2	AST, Rendezvous, stop
	x-3	CMCV, test
2002-05-12 05:54:21 +00:00
Marcel Moolenaar
3ce344cfd3 Add missing #endif 2002-05-10 07:33:11 +00:00
David E. O'Brien
c7e401fbc3 Gcc 3.1 varargs support. 2002-05-10 02:12:04 +00:00
Marcel Moolenaar
bb9c068e14 o Add ar.lc to the pcb.
o  Create pcb_save as the backend for savectx and cpu_switch.
o  While here, use explicit bundling for pcb_save and optimize
   for compactness (~87% density).

o  Not part of the commit is a backend pcb_restore. restorectx()
   still jumps halfway into cpu_switch().
2002-05-07 05:52:27 +00:00
Marcel Moolenaar
e80835fe0e o Add struct mca_guid
o  Add currently known GUIDs
o  Slight restyling
2002-05-05 08:26:25 +00:00
Marcel Moolenaar
33264d92ba o Include md_var.h
o  Remove definition of struct ia64_fdesc
o  Remove prototype of os_boot_rendez
o  Use the FDESC_FUNC and FDESC_GP abstractions
2002-05-05 08:18:42 +00:00
Marcel Moolenaar
fd4a02c900 Remove definition of struct ia64_fdesc. It's been moved to md_var.h 2002-05-05 08:16:10 +00:00
Marcel Moolenaar
8cc99b71a9 o Move definition of struct ia64_fdesc here to remove duplication.
o  Add prototype of os_boot_rendez.
2002-05-05 08:14:32 +00:00
Doug Rabson
9e861cfaa4 Use region 7 addresses for the slabs in the PV and PT zones so that we
don't confuse the zone allocater by translating region 5 addresses to
region 7 addresses (which is unavoidable for PTEs).
2002-05-04 12:21:32 +00:00
Marcel Moolenaar
9a1bf46934 Make sure we don't index the pm_rid array out of bounds in
pmap_ensure_rid(). This can happen because the function is
called for both user and kernel addresses, while the rid array
only has room for user addresses. This bug got exposed by rev
1.58 of ia64/ia64/pmap.c and rev 1.8 of ia64/include/pmap.h.
2002-05-04 08:04:28 +00:00
Doug Rabson
1cae166218 The width of segsz_t should be 64, not 32 on ia64. 2002-05-02 09:04:29 +00:00
Marcel Moolenaar
2a688cec16 In pmap_pinit0, remove duplicate initialization. 2002-05-02 05:35:02 +00:00
Marcel Moolenaar
b905ae4ef9 PCPU(current_pmap) is initialized in pmap_bootstrap. No need to
do it again.
2002-05-02 05:30:42 +00:00
Marcel Moolenaar
b9492ca0a4 Save the MCA info specific to the AP as part of the AP launch. 2002-05-01 22:19:03 +00:00
Marcel Moolenaar
0e09ff93a3 Make ia64_mca_save_state MP safe. Protect access to the info block,
updating the sysctl tree and clearing the SAL state by a spin lock.
2002-05-01 22:10:03 +00:00
Peter Wemm
5a70dcbcc8 Connect up kern_envp *before* we use it for getenv() and console probing.
It is a bit late after that when we have no consoles. :-]

Also, fix a comment nit and print a warning about missing metadata.
2002-05-01 06:52:08 +00:00
Poul-Henning Kamp
2266fe776e Don't export timecounter structures under debug. with sysctl, they
contain no truly interesting data anymore.
2002-04-30 19:34:31 +00:00
Marcel Moolenaar
1f0fa5e154 Add ar.lc and ar.ec to the trapframe. These are not saved for syscalls,
only for exceptions.

While adding this to exception_save and exception_restore, it was hard
to find a good place to put the instructions. The code sequence was
sufficiently arbitrarily ordered that the density was low (roughly 67%).
No explicit bundling was used.
Thus, I rewrote the functions to optimize for density (close to 80% now),
and added explicit bundles and nop instructions. The immediate operand
on the nop instruction has been incremented with each instance, to make
debugging a bit easier when looking at recurring patterns. Redundant
stops have been removed as much as possible. Future optimizations can
focus more on performance. A well-placed lfetch can make all the
difference here!

Also, the FRAME_Fxx defines in frame.h were mostly bogus. FRAME_F10 to
FRAME_F15 were copied from FRAME_F9 and still had the same index. We
don't use them yet, so nothing was broken.
2002-04-30 06:37:25 +00:00
Marcel Moolenaar
d146070aa2 Make this work for ski again. Don't call ia64_mca_init() when we're
in the simulator.
2002-04-30 02:29:00 +00:00
Marcel Moolenaar
54ab759998 Include md_var.h. It has the prototype of ia64_running_in_simulator(). 2002-04-30 02:26:32 +00:00
Marcel Moolenaar
3b7c887b17 Remove KTR_EXTEND. 2002-04-30 02:14:24 +00:00
Peter Wemm
db17c6fc07 Tidy up some loose ends.
i386/ia64/alpha - catch up to sparc64/ppc:
- replace pmap_kernel() with refs to kernel_pmap
- change kernel_pmap pointer to (&kernel_pmap_store)
  (this is a speedup since ld can set these at compile/link time)
all platforms (as suggested by jake):
- gc unused pmap_reference
- gc unused pmap_destroy
- gc unused struct pmap.pm_count
(we never used pm_count - we track address space sharing at the vmspace)
2002-04-29 07:43:16 +00:00
Marcel Moolenaar
9bedf13fee Initialize MCA in cpu_startup() so that it's ready before we wake-up
the application processors. This allows us to collect unconsumed AP
specific error records as part of the wake-up.
2002-04-26 19:36:25 +00:00
Marcel Moolenaar
6e0be618ed MCA specific code has been moved to a seperate file. It is expected
to grow enough to be in the way here.
2002-04-26 19:33:20 +00:00
Marcel Moolenaar
e477773f01 Machine Check Architecture (MCA) support code. Error records are
collected at boot and made available through sysctl(8). At the
moment, the following MIB names are created:

	hw.mca.count	- The number of error records collected.
	hw.mca.first	- The lowest sequence number present.
	hw.mca.last	- The highest sequence number present.
	hw.mca.<X>	- The error record with sequence number <X>.

Using sysctl(8) allows us to easily detect and analyze the records,
which is very helpful during development of MCA but can also be used
in production as a way to collect machine health statistics.
2002-04-26 19:30:11 +00:00
Marcel Moolenaar
53f1567fc3 Machine Check Architecture (MCA) structures and constants. 2002-04-26 19:16:59 +00:00
Marcel Moolenaar
780a1fb3ca The official name for McKinley is: Itanium 2 2002-04-25 17:51:43 +00:00
Marcel Moolenaar
d297ad160e Don't use the symbol name to lookup the symbol value when we can use
the symbol index defined by the relocation. The elf_lookup() support
function is to be used by elf_reloc() when symbol lookups need to be
done. The elf_lookup() function operates on the symbol index and
will do a symbol name based lookup when such is required, otherwise
it uses the symbol index directly. This solves the problem seen on
ia64 where the symbol hash table does not contain local symbols and
a symbol name based lookup would fail for those symbols.

Don't pass the symbol name to elf_reloc(), as it isn't used any more.
2002-04-25 01:22:16 +00:00
Marcel Moolenaar
d435ac4e91 Add ia64_sal_init_state(). This function will initialize the machine
check handling. In its current form, it only determines the largest
amount of state information it can get from SAL and allocates a region
7 memory block for it.

The next steps involve:
o  get and log any unconsumed (NVM stored) error records across
   reboots,
o  register an OS_MCA handler and enable machine checks.
2002-04-22 06:43:31 +00:00
Marcel Moolenaar
1dc66a63cd Add state information types. 2002-04-22 06:35:40 +00:00
Marcel Moolenaar
7ac993bf17 Fix WAW dependency violation on r17 (line 198) that only exists for
the SMP case. While on the subject, remove unnecessary stops. I don't
know if this resolves the memory corruption I'm seeing, but it does
have the potential. We'll see...
2002-04-21 22:43:50 +00:00
Marcel Moolenaar
0f9d8c9b27 Implement elf_reloc(). The RT specification says that we can expect
both Elf_Rel and Elf_Rela types of relocation, so handle them both
even though we only have Rel_Rela ATM. We don't handle 32-bit and
big-endian variants yet. Support for that is not trivial enough to
implement it without any evidence that we ever need it in the near
future.

For the FPTR relocations, we currently use the fptr_storage used by
_reloc() is locore.s. This is in no way a real solution, but for now
provides the service we need to get the basics going.

A static recursive function lookup_fdesc() is used to find the address
of a function in a way that keeps track of the load module so that
we can get the correct GP value if we need to construct an OPD (ie
there's no OPD yet for the function.

For simplicity, we create an OPD for the IPLT relocations as well and
simply fill the user provided function descriptor from the OPD. Since
the the official descriptors are unique, this has no bad side effects.
Note that we ignore the addend for FPTR relocations, but use the
addend for IPLT relocations as an offset to the function address.

This commit allows us to load and relocate modules and modules appear
to work correctly, although we probably need to make sure that we set
GP correctly in all cases when we have inter-module calls. This
especially applies to assembly coded functions that have cross module
calls.
2002-04-21 21:27:57 +00:00
Doug Rabson
fb767b2d4e Setup the child's return values correctly when forking an IA-32 process. 2002-04-21 12:34:58 +00:00
Marcel Moolenaar
76a9e6c9f5 Improve self-relocation and fix ABI misinterpretation. The changes
here mostly mirror the changes made in
	boot/efi/libefi/arch/ia64/start.S rev 1.5

Significant difference: We don't handle the IPLT relocation here.
For barebones KLD support, we make the fptr_storage global.
2002-04-21 08:56:17 +00:00
Marcel Moolenaar
81764c987b Remove the bootinfo kludge. We get the address of the bootinfo
block from the loader.
2002-04-19 06:35:55 +00:00
Alan Cox
3c3f826d7e o Remove vm_map_growstack() from ia64's trap_pfault().
o Remove the acquisition and release of Giant from ia64's trap_pfault().
   (vm_fault() still acquires it.)
2002-04-19 02:08:33 +00:00
Robert Watson
91e007dc70 Since WITNESS doesn't just do mutexes, remove "mutex" from the WITNESS
comment in GENERIC config files of appropriate platforms.  For whatever
reason, powerpc didn't use WITNESS in GENERIC.
2002-04-18 03:44:44 +00:00
Maxime Henrion
d786139c76 Rework the kernel environment subsystem. We now convert the static
environment needed at boot time to a dynamic subsystem when VM is
up.  The dynamic kernel environment is protected by an sx lock.

This adds some new functions to manipulate the kernel environment :
freeenv(), setenv(), unsetenv() and testenv().  freeenv() has to be
called after every getenv() when you have finished using the string.
testenv() only tests if an environment variable is present, and
doesn't require a freeenv() call. setenv() and unsetenv() are self
explanatory.

The kenv(2) syscall exports these new functionalities to userland,
mainly for kenv(1).

Reviewed by:	peter
2002-04-17 13:06:36 +00:00
Alan Cox
87906298f1 Remove code that updates vm->vm_ssize. This duplicates work already performed
by vm_map_growstack().
2002-04-16 05:38:13 +00:00
Peter Wemm
c58d96bb2f Fix an "oops!" that turned out to be mostly harmless (but gave a warning).
I did this right on the sparc64.  Store the direct mapped addresses in
the correct variables.

Submitted by:	jake
2002-04-15 16:07:52 +00:00
Peter Wemm
1a87a0da66 Pass vm_page_t instead of physical addresses to pmap_zero_page[_area]()
and pmap_copy_page().  This gets rid of a couple more physical addresses
in upper layers, with the eventual aim of supporting PAE and dealing with
the physical addressing mostly within pmap.  (We will need either 64 bit
physical addresses or page indexes, possibly both depending on the
circumstances.  Leaving this to pmap itself gives more flexibilitly.)

Reviewed by:	jake
Tested on:	i386, ia64 and (I believe) sparc64. (my alpha was hosed)
2002-04-15 16:00:03 +00:00
Marcel Moolenaar
7c9824f7a1 Dotting the i-s:
o  Use chunk instead of region when we talk about a memory range.
   Region can be confused with region register and we already
   call it chunk in machdep.c
o  Update the twiddle every 16MB
2002-04-14 05:37:18 +00:00
Peter Wemm
421f855923 Allow a kernel to be compiled with both SKI and acpica and still
work on real hardware.  (SKI used to break the sapic probes)
2002-04-14 04:33:41 +00:00
Alan Cox
b7c8cbabf9 Add comment that sigreturn() is MPSAFE. 2002-04-13 23:37:10 +00:00
Doug Rabson
722ff934ee Initialise ar.cflg, which contains the IA-32 registers cr0 and cr4. Since
all IA-32 processes use the same values for cr0 and cr4, we initialise
them at system startup.
2002-04-12 07:43:35 +00:00
Doug Rabson
c85c7b5ff6 Print extra information in printtrap() if the interrupted state was for
an IA-32 process. Don't sign extend arguments in ia32_syscall - its not
normally going to be useful (e.g. pointers need to be zero extended).
2002-04-12 07:41:16 +00:00
Marcel Moolenaar
9ca98629d7 Fix definition of va_start: We don't need to take the address of
va_list. It's a builtin type. gcc 3.1 doesn't care either way,
but gcc 3.2 is more picky and doesn't like the former.
2002-04-12 06:50:51 +00:00
Peter Wemm
a8f559e910 Really fix uniprocessor on IA64. Note to self: do not use variables before
they are initialized.   I had correctly figured out that the UP problem was
the pcpu current_pmap thing, but didn't fix it right last time.
2002-04-12 05:17:15 +00:00
Doug Rabson
5eb29d9b90 Initial support for executing IA-32 binaries. This will not compile
without a few patches for the rest of the kernel to allow the image
activator to override exec_copyout_strings and setregs.

None of the syscall argument translation has been done. Possibly, this
translation layer can be shared with any platform that wants to support
running ILP32 binaries on an LP64 host (e.g. sparc32 binaries?)
2002-04-10 19:34:51 +00:00
Doug Rabson
a989d30598 Save and restore the IA-32 state in cpu_switch(). Probably should only do
this if the thread has been executing IA-32 code.
2002-04-10 19:27:50 +00:00
Doug Rabson
b0685df774 Add suhword() and fuhword() for accessing 32-bit values ("half words") in
userland. All these functions should be renamed to be explicit about the
size of value being read or written.
2002-04-10 19:26:49 +00:00
Doug Rabson
4beaa04bf1 Add exception and syscall support for executing IA-32 binaries. 2002-04-10 19:24:59 +00:00
Doug Rabson
4fc38782f0 Add ucode values for SIGFPE etc. Copied from i386/include/signal.h. 2002-04-10 19:24:08 +00:00
Doug Rabson
02939fd82c Add fields for saving/restoring the IA-32 state. 2002-04-10 19:23:21 +00:00
Doug Rabson
01426578dc Add definitions for IA-32 exceptions, interrupts and intercepts. 2002-04-10 19:22:45 +00:00
Doug Rabson
ba4d213488 Call ast() from the syscall exit path as well as for full exception
restores.
2002-04-10 16:35:44 +00:00
Doug Rabson
794cc3d8ae Initialise PCPU_GET(current_pmap) in pmap_bootstrap - cpu_switch needs
to be sure that it is always correct and this was not true for the first
call to cpu_switch. When thread0 resumed later, it ended up calling
pmap_install with a null pmap, which is bad.
2002-04-10 16:34:52 +00:00
Mike Barcroft
49285705cc Remove the hack for segsz_t from <sys/types.h>; use the normal
_BSD_FOO_T_ method for defining segsz_t.
2002-04-10 15:58:13 +00:00
Mike Barcroft
7f0f1cfd57 Add manifest constants: _LITTLE_ENDIAN, _BIG_ENDIAN, _PDP_ENDIAN, and
_BYTE_ORDER.  These are far more useful than their non-underscored
equivalents as these can be used in restricted namespace environments.
Mark the non-underscored variants as deprecated.
2002-04-10 14:39:14 +00:00
Poul-Henning Kamp
2ce7d7a033 GC various bits and pieces of USERCONFIG from all over the place. 2002-04-09 11:18:46 +00:00
Doug Rabson
63fe680462 Define a complete set of accessors for application and control registers. 2002-04-09 09:03:30 +00:00
Doug Rabson
2d1fae48d5 Don't call make_dev from ssccnattach - its far too early to work properly. 2002-04-09 08:53:57 +00:00
Peter Wemm
3892098bea ia64 depends on ACPICA on actual hardware. It might be worth having a
seperate SKI config (like we had SIMOS for alpha).
2002-04-07 04:36:02 +00:00
Marcel Moolenaar
621342bc34 Add prototype for bootpc_init when BOOTP is defined. 2002-04-06 21:09:08 +00:00
Doug Rabson
ce5c49f1aa Merge fixes for dbtob() and btodb() from alpha/include/param.h. This stops
ffs_snapshot() from using negative numbers for byte offsets in large file
systems.
2002-04-06 12:55:48 +00:00
Marcel Moolenaar
9281a1bd5f Fix a braino in the alignment of the segment contents after dumping
the program headers. As a result of this, dumplo was advanced too
much causing the end of the dump and most notably the trailing
dump header to be written beyond the end of the the dump medium.
2002-04-06 05:56:33 +00:00
John Baldwin
6008862bc2 Change callers of mtx_init() to pass in an appropriate lock type name. In
most cases NULL is passed, but in some cases such as network driver locks
(which use the MTX_NETWORK_LOCK macro) and UMA zone locks, a name is used.

Tested on:	i386, alpha, sparc64
2002-04-04 21:03:38 +00:00
Brian Somers
920987e3c1 Back out the previous commit.
In the i386 case, options BOOTP requires options NFS_ROOT as well as
options NFSCLIENT.  With *both* the NFS options, a bootpc_init()
prototype is brought in by nfsclient/nfsdiskless.h.

In the ia64 case, it just doesn't work and my change just pushes it
further away from working.

Suggested to be wrong by:	bde
2002-04-04 17:58:21 +00:00
Bruce Evans
79065dba2a Moved signal handling and rescheduling from userret() to ast() so that
they aren't in the usual path of execution for syscalls and traps.
The main complication for this is that we have to set flags to control
ast() everywhere that changes the signal mask.

Avoid locking in userret() in most of the remaining cases.

Submitted by:	luoqi (first part only, long ago, reorganized by me)
Reminded by:	dillon
2002-04-04 17:49:48 +00:00
Brian Somers
55d884db38 Pre-declare bootpc_init() so that options BOOTP doesn't break the
build in ia64 and i386 due to -Werror.
2002-04-04 14:27:57 +00:00
Alan Cox
09d30f2c8d o Kill the MD grow_stack(). Call the MI vm_map_growstack()
in its place.
 o Eliminate the use of useracc() and grow_stack() from sendsig().

Reviewed by:	peter
2002-04-04 06:59:18 +00:00
Marcel Moolenaar
35c3b43f7b o Add architecture specific segment types.
o  Add architecture specific segment attributes.
2002-04-04 06:42:49 +00:00
Ruslan Ermilov
12c79eb288 Dike out a highly insecure UCONSOLE option.
TIOCCONS must be able to VOP_ACCESS() /dev/console to succeed.

Obtained from:	OpenBSD
2002-04-03 10:56:59 +00:00
Marcel Moolenaar
5cb87b0c59 Make the kernel dump header endianness invariant by always dumping
in dump byte order (=network byte order). Swap blocksize and dumptime
to avoid extraneous padding on 64-bit architectures. Use CTASSERT
instead of runtime checks to make sure the header is 512 bytes large.
Various style(9) fixes.

Reviewed by: phk, bde, mike
2002-04-03 07:24:12 +00:00
Marcel Moolenaar
daf8eed86e o GC dumplo
o  Replace the string lit. "ia64" with MACHINE
2002-04-03 05:16:09 +00:00
Marcel Moolenaar
b484ea8c69 Use a twiddle to show that we're busy dumping. The initial code
emitted the total number of pages it still had to dump prior to
dumping a block of up to 16 pages. For a 128MB region this would
result in 8M number of printf()s. Barf!

The problem in general is that memory typically has one really
big region and a number of "scattered" smaller regions. Some may
even be just a few pages. The twiddle works best for now, but
it doesn't really give a good progress indication for the large
regions. Those are the cases where you definitely want good PI
to avoid having the user turn into a twiddle :-)
2002-04-03 05:11:59 +00:00
John Baldwin
c53c013bae - Move the MI mutexes sched_lock and Giant from being declared in the
various machdep.c's to being declared in kern_mutex.c.
- Add a new function mutex_init() used to perform early initialization
  needed for mutexes such as setting up thread0's contested lock list
  and initializing MI mutexes.  Change the various MD startup routines
  to call this function instead of duplicating all the code themselves.

Tested on:	alpha, i386
2002-04-02 22:19:16 +00:00
Marcel Moolenaar
a64f21ce5d Initial implementation of the ia64 kernel dumper. The dumper
constructs an ELF image, consisting of the ELF header, for
each memory region a program header, followed by the memory
contents for each region. It does blocked I/O for the headers
as they are typically smaller than DEV_BSIZE.
2002-04-02 10:51:32 +00:00
Marcel Moolenaar
6cb7cf5826 o GC totalphysmem and resvmem.
o  Rephrase comment describing that the memory region can contain
   the kernel.
2002-04-02 07:20:42 +00:00
Matthew Dillon
182da8209d Stage-2 commit of the critical*() code. This re-inlines cpu_critical_enter()
and cpu_critical_exit() and moves associated critical prototypes into their
own header file, <arch>/<arch>/critical.h, which is only included by the
three MI source files that need it.

Backout and re-apply improperly comitted syntactical cleanups made to files
that were still under active development.  Backout improperly comitted program
structure changes that moved localized declarations to the top of two
procedures.  Partially re-apply one of the program structure changes to
move 'mask' into an intermediate block rather then in three separate
sub-blocks to make the code more readable.  Re-integrate bug fixes that Jake
made to the sparc64 code.

Note: In general, developers should not gratuitously move declarations out
of sub-blocks.  They are where they are for reasons of structure, grouping,
readability, compiler-localizability, and to avoid developer-introduced bugs
similar to several found in recent years in the VFS and VM code.

Reviewed by:	jake
2002-04-01 23:51:23 +00:00
John Baldwin
44731cab3b Change the suser() API to take advantage of td_ucred as well as do a
general cleanup of the API.  The entire API now consists of two functions
similar to the pre-KSE API.  The suser() function takes a thread pointer
as its only argument.  The td_ucred member of this thread must be valid
so the only valid thread pointers are curthread and a few kernel threads
such as thread0.  The suser_cred() function takes a pointer to a struct
ucred as its first argument and an integer flag as its second argument.
The flag is currently only used for the PRISON_ROOT flag.

Discussed on:	smp@
2002-04-01 21:31:13 +00:00
Poul-Henning Kamp
8d19a26558 Centralize the "bootdev" and "dumpdev" variables. They are still pretty
bogus all things considered, but at least now they don't camouflage as
being MD variables.
2002-03-31 07:15:28 +00:00
Marcel Moolenaar
12ae303a12 Transition to a model where the loader passes the address of the
bootinfo block in register r8. In locore.s we save the address
in the global variable 'pa_bootinfo'. In machdep.c we compare
this value against the hardwired address, but don't depend on its
validity yet (ie: we still expect the bootinfo block to be at the
hardwired address). After a small amount of time, we'll flip the
switch and depend on the loader to pass us the address. From that
moment on the loader is free to put it anywhere it likes, provided
the machine itself likes it as well.

Add some verbosity to aid in the transition. We emit a message if
the loader didn't pass the address and we also emit a message if
there's no bootinfo block at the hardwired address.

While in locore.s, reduce the number of redundant serialization
instructions. A srlz.i is a proper superset of a srlz.d and thus
is a valid replacement. Also slightly reorder the movl instructions
to improve bundle density.
2002-03-30 23:25:22 +00:00
Jake Burkholder
d0ce9a7e07 Remove abuse of intr_disable/restore in MI code by moving the loop in ast()
back into the calling MD code.  The MD code must ensure no races between
checking the astpening flag and returning to usermode.

Submitted by:	peter (ia64 bits)
Tested on:	alpha (peter, jeff), i386, ia64 (peter), sparc64
2002-03-29 16:35:26 +00:00
David E. O'Brien
ae7c70d595 style(9)
Approved by:	jake
2002-03-28 02:54:44 +00:00
Jeff Roberson
f22a4b62f5 Add a new mtx_init option "MTX_DUPOK" which allows duplicate acquires of locks
with this flag.  Remove the dup_list and dup_ok code from subr_witness.  Now
we just check for the flag instead of doing string compares.

Also, switch the process lock, process group lock, and uma per cpu locks over
to this interface.  The original mechanism did not work well for uma because
per cpu lock names are unique to each zone.

Approved by:	jhb
2002-03-27 09:23:41 +00:00
Matthew Dillon
d74ac6819b 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
2002-03-27 05:39:23 +00:00
Marcel Moolenaar
d8869cc205 o Revert previous commit in asm.h. There's no need to undefine
__FBSDID first, because it should not be defined at all,
o  Remove inclusion of cdefs.h in locore.s.

Pointed out by: peter
2002-03-27 02:20:09 +00:00
David E. O'Brien
1640869c31 Get the guarding right. The IA-64 has a different organization for this
than our other platforms.
2002-03-26 02:59:00 +00:00
David E. O'Brien
c543d983fa Guard against redefining __gnuc_va_list. 2002-03-24 11:25:46 +00:00
Marcel Moolenaar
9156494211 Undefine __FBSDID before defining it as it's already defined at
that point.
2002-03-24 10:28:04 +00:00
David E. O'Brien
439a4003ab ASM versions of __FBSDID. 2002-03-23 02:01:27 +00:00
Doug Rabson
6720311838 Change critical_t to register_t for intr_disable/restore. 2002-03-21 09:50:11 +00:00
Doug Rabson
77b51ddfcd Change cpu_critical_enter/exit to intr_disable/restore. 2002-03-21 09:35:18 +00:00
Peter Wemm
c302e53c27 In UP mode, the primary cpu's per-cpu current_pmap was not initialized -
this was only done as a side effect of calling cpu_mp_start().  I haven't
actually tested that this fixes UP kernels, but it feels about right.
2002-03-21 07:41:02 +00:00
Jeff Roberson
eca80f82ea Remove references to vm_zone.h and switch over to the new uma API.
Approved by:	peter
2002-03-21 02:46:56 +00:00
Alfred Perlstein
e41ed5da90 Remove __P.
Reviewd by: peter
2002-03-20 23:30:31 +00:00
John Baldwin
f25fcd64b8 Change the way we ensure td_ucred is NULL if DIAGNOSTIC is defined.
Instead of caching the ucred reference, just go ahead and eat the
decerement and increment of the refcount.  Now that Giant is pushed down
into crfree(), we no longer have to get Giant in the common case.  In the
case when we are actually free'ing the ucred, we would normally free it on
the next kernel entry, so the cost there is not new, just in a different
place.  This also removse td_cache_ucred from struct thread.  This is
still only done #ifdef DIAGNOSTIC.

Tested on:	i386, alpha
2002-03-20 21:09:09 +00:00
Doug Rabson
a2763677ec Change intr_enable to intr_restore for consistency with sparc64. 2002-03-20 17:28:40 +00:00
Doug Rabson
c526161420 Replace calls to cpu_critical_enter/exit with appropriate calls to
either explicitly disable interrupts or use a real critical section,
as appropriate.
2002-03-20 10:04:08 +00:00
Doug Rabson
95f7adfa1a Recreate intr_disable/intr_enable and implement cpu_critical_enter/exit
in terms of that (for now).
2002-03-20 10:00:05 +00:00
Peter Wemm
3acb2ae91f #if 0 some unused variables (only in #if 0 code) 2002-03-19 12:15:29 +00:00
Peter Wemm
bfed03d6df Enabling the SKI option is a guaranteed breakage for me. Interrupts no
longer work.
I can only get a box to boot with 'options SMP'.
2002-03-19 11:21:12 +00:00
Peter Wemm
5044ed104d My ia64 box for some reason likes to fragment the beginning/end of memory
a bit before handing it over to the OS.  I occasionally have 11
segments with several 8K or so fragments depending on nvram settings and
what I have done under loader(8) before booting.  This needs to be
revisited.
2002-03-19 11:18:47 +00:00
Peter Wemm
3b406873c7 Fix some unused variables. 2002-03-19 11:15:26 +00:00
Peter Wemm
12adcbdf35 Move a couple of prototypes together instead of being incompletely
scattered around.
2002-03-19 11:14:52 +00:00
Peter Wemm
6d4a5aee06 __func__ is a const char *, not a "string" that can be concatenated. 2002-03-19 11:11:37 +00:00
Peter Wemm
90f9252584 Fix a pointer/int warning 2002-03-19 11:10:30 +00:00
Peter Wemm
21eec46f33 #ifdef SMP some variables that are only used elsewhere under #ifdef SMP
also.
2002-03-19 11:10:03 +00:00
Peter Wemm
34adf9e4f1 Work around an apparent compiler bug with gcc-3.1, although it might be
a language feature that I do not know about.  gcc is complaining about
a left shift >= sizeof type, even when shifting a (cast) 64 bit type left
by 43 bits.
2002-03-19 11:09:24 +00:00
Peter Wemm
51ea8b33df Believe it or not, I ran into the 32MB stack size limit using a natively
hosted gcc.
2002-03-19 11:07:09 +00:00
Peter Wemm
e42d7cebec #if 0 out some unused code. 2002-03-19 11:06:01 +00:00
Peter Wemm
675ceea82b Add some #includes after things got broken with the last round of
MI include file (<sys/smp.h> I think) tweaks.
2002-03-19 11:05:07 +00:00
Peter Wemm
4ff9e8d5e5 Turn off the ia64 ITC timecounter when SMP is present since it has the
same problem as the TSC on the x86 - ie: it is not synchronized.
#if 0 out some unused functions, ia64 doesn't calibrate clocks yet.
2002-03-19 11:03:48 +00:00
Jeff Roberson
8355f576a9 This is the first part of the new kernel memory allocator. This replaces
malloc(9) and vm_zone with a slab like allocator.

Reviewed by:	arch@
2002-03-19 09:11:49 +00:00
Doug Rabson
568a940b99 Fix spelling. 2002-03-18 09:29:16 +00:00
Dag-Erling Smørgrav
a2e0658045 Move the definition of PT_[GS]ET{,DB,FP}REGS from the MD ptrace.h to the
MI ptrace.h, since all platforms define them.  Keep the MD ptrace.h around
for FIX_SSTEP (which is currently only needed on Alpha).
2002-03-16 00:25:53 +00:00
Doug Rabson
0ab3e3b15a * Stop other cpus when one cpu enters DDB and restart them after it
leaves.
* Add a sync.i instruction to the code which writes out breakpoints to
  ensure that the breakpoint is seem by all cpus in the coherence domain.
2002-03-15 11:12:08 +00:00
Doug Rabson
fa45345e6e * Remove a breakpoint() I accidentally left in for debugging :-(.
* Make cpu_mp_probe() work before the VM system is available and
  initialise mp_maxid accordingly.
2002-03-15 09:47:16 +00:00
Doug Rabson
0f638cfaeb Tweak the AP startup code somewhat. With all the other recent changes,
this now works pretty well for two processors at least.

Submitted by: marcel, mostly.
2002-03-14 19:37:36 +00:00
Doug Rabson
34da0be411 * Initialise pcb_pmap for new threads.
* Add support for forking new threads from &thread0 as well as curthread.
2002-03-14 19:34:50 +00:00
Doug Rabson
92e814dcb6 * Save and restore PCPU_GET(current_pmap) in pcb_pmap so that we don't
lose if a process is preempted while pmap is temporarily switched to
  another pmap.
* For SMP, drop the high-fp state when a thread is switched away from
  so that if another cpu resumes that thread, it doesn't have to play
  games with IPI to get ahold of the correct register values.
2002-03-14 19:33:03 +00:00
Doug Rabson
48f7cc3fed Add pcpu.pc_current_pmap and pcb.pcb_pmap. 2002-03-14 19:20:24 +00:00
Doug Rabson
a9521dec8b Add a field to hold the current pmap of a thread. 2002-03-14 19:19:49 +00:00
Doug Rabson
17ea508863 Add ia64_sync_i(), ia64_get_tpr() and ia64_set_tpr(). 2002-03-14 12:29:55 +00:00
Doug Rabson
0323b941f0 * Add some KTR messages for IPIs.
* Don't call ast() from interrupt() - if we switch, then we will miss
  writing cr.eoi which will prevent the current cpu from receiving
  interrupts until the current thread is resumed. The call to ast()
  happens magically in exception_restore where it is safe.
* Add DDB 'show irq' command to examine interrupt hardware state.
2002-03-14 10:24:00 +00:00
Doug Rabson
838ba419e9 Add debug code to print SAPIC registers. 2002-03-14 10:17:08 +00:00
Doug Rabson
2750f739f9 * Use a mutex to protect the RID allocator.
* Use ptc.g instead of ptc.l so that TLB shootdowns are broadcast to the
  coherence domain.
* Use smp_rendezvous for pmap_invalidate_all to ensure it happens on all
  cpus.
* Dike out a DIAGNOSTIC printf which didn't compile.
* Protect the internals of pmap_install with cpu_critical_enter/exit.
2002-03-14 09:28:05 +00:00
Doug Rabson
26c01501cd Move the call to pmap_bootstrap to after the initialisation of thread0.
This allows us to use mutexes in pmap safely. Also initialise fpcurthread
for cpu0 so that ia64_fpstate_check doesn't barf during boot.
2002-03-14 09:20:07 +00:00
Doug Rabson
b81b083819 Don't restore r13 when returning to kernel mode. We may have migrated to
a different cpu since the exception_save and r13 needs to point at the
current cpu's pcpu structure.
2002-03-14 00:28:10 +00:00
Peter Wemm
841390683c Fix some -Wunused warnings by "using" a macro argument 2002-03-12 00:19:14 +00:00
Peter Wemm
a84c6cd303 Fix a warning (make ucontext_t *ucp a const) 2002-03-12 00:18:20 +00:00
Peter Wemm
db593b65d2 Stop concatenating __func__ with strings 2002-03-12 00:17:45 +00:00
Peter Wemm
e64c73a9f0 Deal with a structure member rename in a recent acpica import 2002-03-12 00:15:57 +00:00
John Baldwin
bb7d54e8c7 Fix a misspelling of mine: s/optomization/optimization/.
Noticed by:	bmilekic
2002-03-11 19:58:53 +00:00
Doug Rabson
a914a17e1d Add an implementation of cpu_throw() and make restorectx() simply branch
to the tail of cpu_switch.
2002-03-10 20:20:31 +00:00
Doug Rabson
f0ec35cae4 Don't try to print the arguments if the value of bsp is outside the
kernel - its asking for trouble.
2002-03-10 20:19:32 +00:00
Doug Rabson
a7f314ea94 Use the right value for the region length in parse_spill_mask. 2002-03-10 17:03:45 +00:00
Mike Barcroft
d846855da8 o Don't require long long support in bswap64() functions.
o In i386's <machine/endian.h>, macros have some advantages over
  inlines, so change some inlines to macros.
o In i386's <machine/endian.h>, ungarbage collect word_swap_int()
  (previously __uint16_swap_uint32), it has some uses on i386's with
  PDP endianness.

Submitted by:	bde

o Move a comment up in <machine/endian.h> that was accidentially moved
  down a few revisions ago.
o Reenable userland's use of optimized inline-asm versions of
  byteorder(3) functions.
o Fix ordering of prototypes vs. redefinition of byteorder(3)
  functions, so that the non-GCC (libc asm) case has proper
  prototypes.
o Add proper prototypes for byteorder(3) functions in <sys/param.h>.
o Prevent redundant duplicate prototypes by making use of the
  _BYTEORDER_PROTOTYPED define.
o Move the bswap16(), bswap32(), bswap64() C functions into MD space
  for platforms in which asm versions don't exist.  This significantly
  reduces the complexity of some things at the cost of duplicate code.

Reviewed by:	bde
2002-03-09 21:02:16 +00:00
Jake Burkholder
74acd9bb58 Include machine/smp.h. 2002-03-07 04:48:17 +00:00
Marcel Moolenaar
2242af42cf Call ast() only when we're handling a user trap. 2002-03-05 06:13:22 +00:00
Doug Rabson
2d0639e55d Add PSEUDOFS. 2002-03-04 18:01:56 +00:00
Doug Rabson
1fc142b38f Add emulation support for PAL_VM_SUMMARY. 2002-03-04 12:47:47 +00:00
Doug Rabson
08cece4091 * Include <sys/ucontext.h> so that this compiles again.
* Move the section which manipulates ia64_pal_base to after cninit() so
  that we don't risk printing anything before we have a console.
* Don't call ia64_probe_sapics() for a SKI build. This should really
  be dependant on ACPICA being present or something.
2002-03-03 19:23:15 +00:00
Andrew R. Reiter
66c862bc1b - Move a comment from being on the same line as a #ifdef to the line
following it.  This should have gone in the previous commit, but
  misviewed Bruce's patch.

Requested by: bde
2002-02-28 21:52:08 +00:00
Andrew R. Reiter
216ae18217 - Fix panic() message and a couple style nits that snuck in from the
recent diagnostics commit (rev. 1.84).
2002-02-28 08:28:14 +00:00
John Baldwin
a854ed9893 Simple p_ucred -> td_ucred changes to start using the per-thread ucred
reference.
2002-02-27 18:32:23 +00:00
Mike Silbersack
7f3a40933b Fix a horribly suboptimal algorithm in the vm_daemon.
In order to determine what to page out, the vm_daemon checks
reference bits on all pages belonging to all processes.  Unfortunately,
the algorithm used reacted badly with shared pages; each shared page
would be checked once per process sharing it; this caused an O(N^2)
growth of tlb invalidations.  The algorithm has been changed so that
each page will be checked only 16 times.

Prior to this change, a fork/sleepbomb of 1300 processes could cause
the vm_daemon to take over 60 seconds to complete, effectively
freezing the system for that time period.  With this change
in place, the vm_daemon completes in less than a second.  Any system
with hundreds of processes sharing pages should benefit from this change.

Note that the vm_daemon is only run when the system is under extreme
memory pressure.  It is likely that many people with loaded systems saw
no symptoms of this problem until they reached the point where swapping
began.

Special thanks go to dillon, peter, and Chuck Cranor, who helped me
get up to speed with vm internals.

PR:		33542, 20393
Reviewed by:	dillon
MFC after:	1 week
2002-02-27 18:03:02 +00:00
Thomas Moestl
90ce56c287 Add the following functions/macros to support byte order conversions and
device drivers for bus system with other endinesses than the CPU (using
interfaces compatible to NetBSD):

- bwap16() and bswap32(). These have optimized implementations on some
  architectures; for those that don't, there exist generic implementations.
- macros to convert from a certain byte order to host byte order and vice
  versa, using a naming scheme like le16toh(), htole16().
  These are implemented using the bswap functions.
- stream bus space access functions, which do not perform a byte order
  conversion (while the normal access functions would if the bus endianess
  differs from the CPU endianess).

htons(), htonl(), ntohs() and ntohl() are implemented using the new
functions above for kernel usage. None of the above interfaces is currently
exported to user land.

Make use of the new functions in a few places where local implementations
of the same functionality existed.

Reviewed by:	mike, bde
Tested on alpha by:	mike
2002-02-27 17:16:18 +00:00
Julian Elischer
77c4066424 Add some DIAGNOSTIC code.
While in userland, keep the thread's ucred reference in a shadow
field so that the usual place to store it is NULL.
If DIAGNOSTIC is not set, the thread ucred is kept valid until the next
kernel entry, at which time it is checked against the process cred
and possibly corrected. Produces a BIG speedup in
kernels with INVARIANTS set. (A previous commit corrected it
for the non INVARIANTS case already)

Reviewed by:	dillon@freebsd.org
2002-02-22 23:58:22 +00:00
Poul-Henning Kamp
1cbb9c3b03 Convert p->p_runtime and PCPU(switchtime) to bintime format. 2002-02-22 13:32:01 +00:00
Julian Elischer
db170a83d5 Duplicate the changes to i386 to keep creds over the user boundary. 2002-02-19 03:16:50 +00:00
Mike Barcroft
d1f7a1b79c Add C++ support. 2002-02-19 02:17:16 +00:00
Mike Barcroft
fd8e4ebc8c o Move NTOHL() and associated macros into <sys/param.h>. These are
deprecated in favor of the POSIX-defined lowercase variants.
o Change all occurrences of NTOHL() and associated marcros in the
  source tree to use the lowercase function variants.
o Add missing license bits to sparc64's <machine/endian.h>.
  Approved by: jake
o Clean up <machine/endian.h> files.
o Remove unused __uint16_swap_uint32() from i386's <machine/endian.h>.
o Remove prototypes for non-existent bswapXX() functions.
o Include <machine/endian.h> in <arpa/inet.h> to define the
  POSIX-required ntohl() family of functions.
o Do similar things to expose the ntohl() family in libstand, <netinet/in.h>,
  and <sys/param.h>.
o Prepend underscores to the ntohl() family to help deal with
  complexities associated with having MD (asm and inline) versions, and
  having to prevent exposure of these functions in other headers that
  happen to make use of endian-specific defines.
o Create weak aliases to the canonical function name to help deal with
  third-party software forgetting to include an appropriate header.
o Remove some now unneeded pollution from <sys/types.h>.
o Add missing <arpa/inet.h> includes in userland.

Tested on:	alpha, i386
Reviewed by:	bde, jake, tmm
2002-02-18 20:35:27 +00:00
Garrett Wollman
3b7a4c4b1d Resurrect one of the easiest changes from my big include files roll-up
patch from a year ago: give file flags their own type.  This does not
(yet) change the type used by system calls or library functions.
The underlying type was chosen to match what is returned by stat().
2002-02-15 22:15:39 +00:00
Robert Watson
92b98fdabe Remove WITNESS from GENERIC by default: as we grow more locks, this gets
slower, and may be impeding adoption of -CURRENT by developers.  We
recommend turning on WITNESS by default on crash boxes, and when doing
locking development.  It will probably get turned on by default for a week
or two following any major locking commits, also.

Approved by:	all and sundry (jhb, phk, ...)
2002-02-13 07:44:59 +00:00
Julian Elischer
079b7badea Pre-KSE/M3 commit.
this is a low-functionality change that changes the kernel to access the main
thread of a process via the linked list of threads rather than
assuming that it is embedded in the process. It IS still embeded there
but remove all teh code that assumes that in preparation for the next commit
which will actually move it out.

Reviewed by: peter@freebsd.org, gallatin@cs.duke.edu, benno rice,
2002-02-07 20:58:47 +00:00
Poul-Henning Kamp
e0ee6f5629 GC the PC_SWITCH* symbols which are not used in assembly anymore. 2002-02-07 10:27:58 +00:00
Bruce Evans
55a9536b65 Compile osigreturn() unconditionally since it will always be needed on
some arches and the syscall table is machine-independent.  It was
(bogusly) conditional on COMPAT_43, so this usually makes no difference.

ia64: in addition:
- replace the bogus cloned comment before osigreturn() by a correct one.
  osigreturn() is just a stub fo ia64's.
- fix the formatting of cloned comment before sigreturn().
- fix the return code.  use nosys() instead of returning ENOSYS to get
  the same semantics as if the syscall is not in the syscall table.
  Generating SIGSYS is actually correct here.
- fix style bugs.

powerpc: copy the cleaned up ia64 stub.  This mainly fixes a bogus comment.

sparc64: copy the cleaned up the ia64 stub, since there was no stub before.
2002-02-01 15:44:03 +00:00
Marcel Moolenaar
57aace23d5 Add a definition of ddb_regs. ddb_regs is declared as extern in
db_machdep.h to fix the link failure (multiple definitions)
caused by disabling the emission of common symbols. As a result,
there were no definitions at all. While here, remove useless
declarations.
2002-01-18 07:55:23 +00:00
Marcel Moolenaar
7fdc2e1a11 Remove the definition of bootverbose. This fixes the link failure
caused by disabling the emission of common symbols.
2002-01-18 07:49:37 +00:00
Marcel Moolenaar
48ceef34eb Declare ddb_regs as extern to avoid creating a tentative definition.
This fixes the link failure caused by disabling the emission of
common symbols.
2002-01-18 07:47:38 +00:00
Peter Wemm
ead8168ac0 Convert a bunch of 1 << PCPU_GET(cpuid) to PCPU_GET(cpumask). 2002-01-05 09:41:37 +00:00
John Baldwin
c86b6ff551 Change the preemption code for software interrupt thread schedules and
mutex releases to not require flags for the cases when preemption is
not allowed:

The purpose of the MTX_NOSWITCH and SWI_NOSWITCH flags is to prevent
switching to a higher priority thread on mutex releease and swi schedule,
respectively when that switch is not safe.  Now that the critical section
API maintains a per-thread nesting count, the kernel can easily check
whether or not it should switch without relying on flags from the
programmer.  This fixes a few bugs in that all current callers of
swi_sched() used SWI_NOSWITCH, when in fact, only the ones called from
fast interrupt handlers and the swi_sched of softclock needed this flag.
Note that to ensure that swi_sched()'s in clock and fast interrupt
handlers do not switch, these handlers have to be explicitly wrapped
in critical_enter/exit pairs.  Presently, just wrapping the handlers is
sufficient, but in the future with the fully preemptive kernel, the
interrupt must be EOI'd before critical_exit() is called.  (critical_exit()
can switch due to a deferred preemption in a fully preemptive kernel.)

I've tested the changes to the interrupt code on i386 and alpha.  I have
not tested ia64, but the interrupt code is almost identical to the alpha
code, so I expect it will work fine.  PowerPC and ARM do not yet have
interrupt code in the tree so they shouldn't be broken.  Sparc64 is
broken, but that's been ok'd by jake and tmm who will be fixing the
interrupt code for sparc64 shortly.

Reviewed by:	peter
Tested on:	i386, alpha
2002-01-05 08:47:13 +00:00
Marcel Moolenaar
200281abc1 Revert previous definition of cpu_throw(). Non-MP configurations
were broken as well.
2001-12-30 23:39:15 +00:00
Marcel Moolenaar
f3366cc25b Better implement SMP support:
o  Do not use a special struct to keep track of CPUs we found;
   instead, use struct pcpu. This handles all the magic WRT
   thread creation (yay!).
o  Respect MAXCPU.
o  Use the vhpt_base and vhpt_size values to initialize the AP.
o  Style fixes.

Note that this commit temporarily breaks SMP configurations.
Previously APs didn't do anything, but they now enter the
scheduler. They hold sched_lock for more than 5 secs though
and cause a panic. That's what I call progress :-)
2001-12-30 09:59:02 +00:00
Marcel Moolenaar
0f0658df4c o Reimplement map_pal_code to work with a global variable
ia64_pal_base instead of scanning the EFI tables. This way
   AP startup code can more easily use the function.
o  Initialize ia64_pal_base in ia64_init(). When the PAL code
   doesn't need explicit mapping or no PAL code has been found,
   ia64_pal_base will be 0.
o  Remove some unused global variables.
o  Also in ia64_init(), allocate only 1 page for struct pcpu
   and remove some Alpha leftovers.
o  Initialize pc_pcb in cpu_pcpu_init().
2001-12-30 09:49:39 +00:00
Marcel Moolenaar
7251648208 Make vhpt_base and vhpt_size globals so that they can be used by
the AP startup code.
2001-12-30 09:42:43 +00:00
Marcel Moolenaar
d9eba830b7 Cleanup the IPIs. 2001-12-30 09:41:29 +00:00