Commit Graph

323 Commits

Author SHA1 Message Date
Peter Wemm
23eeeff7be Split 4.x and 5.x signal handling so that we can keep 4.x signal
handling clean and functional as 5.x evolves.  This allows some of the
nasty bandaids in the 5.x codepaths to be unwound.

Encapsulate 4.x signal handling under COMPAT_FREEBSD4 (there is an
anti-foot-shooting measure in place, 5.x folks need this for a while) and
finish encapsulating the older stuff under COMPAT_43.  Since the ancient
stuff is required on alpha (longjmp(3) passes a 'struct osigcontext *'
to the current sigreturn(2), instead of the 'ucontext_t *' that sigreturn
is supposed to take), add a compile time check to prevent foot shooting
there too.  Add uniform COMPAT_43 stubs for ia64/sparc64/powerpc.

Tested on: i386, alpha, ia64.  Compiled on sparc64 (a few days ago).
Approved by: re
2002-10-25 19:10:58 +00:00
Thomas Moestl
db44ef5176 Initialize tick_MHz and related variables much earlier. After the last
revision of tick.c, this was done at SI_SUB_CLOCKS, which is too late
because tick_MHz is required for DELAY() to work.

Reviewed by:	jake
2002-10-25 17:42:14 +00:00
Jake Burkholder
4d961d24e1 Greatly improve readability of trap() by using a table to convert between
trap types and signals to send.  Rearrange KASSERTs to better handle faults
early before curthread is setup, or in the case that it gets corrupted or
set to 0.
2002-10-25 16:00:47 +00:00
Jake Burkholder
bb56f27799 - Expand struct trapframe to 256 bytes, make all fields fixed width and the
same size.  Add some fields that previously overlapped with something else
  or were missing.
- Make struct regs and struct mcontext (minus floating point) the same as
  struct trapframe so converting between them is easy (null).
- Add space for saving floating point state to struct mcontext.  This requires
  that it be 64 byte aligned.
- Add assertions that none of these structures change size, as they are part
  of the ABI.
- Remove some dead code in sendsig().
- Save and restore %gsr in struct trapframe.  Remember to restore %fsr.
- Add some comments to exception.S.
2002-10-22 18:03:15 +00:00
Thomas Moestl
e381d2455b Add kernel dump support, based on the ia64 version (which was committed
as sparc64/sparc64/dump_machdep.c a while back).
Other than ia64 (which uses ELF), sparc64 uses a homegrown format for
the dumps (headers are required because the physical address and size of
the tsb must be noted, and because physical memory may be discontiguous);
ELF would not offer any advantages here.

Reviewed by:	jake
2002-10-20 17:03:15 +00:00
Thomas Moestl
50d97927da Explicitely specify an alignment for struct pcb. While all regular pcb's
are positioned and aligned by md code, dumppcb is just a static
variable and requires this.
2002-10-19 15:54:34 +00:00
Peter Wemm
af3f249f3a The a.out md_coredump stuff isn't referenced anywhere anymore, and
hasn't been filled in for ages..  Nuked.
2002-10-15 00:02:50 +00:00
Mike Barcroft
af103111f0 #ifdef _KERNEL not #if _KERNEL.
Pointy hat to:	mike
2002-10-13 12:33:38 +00:00
Mike Barcroft
7a77412855 Add standards visibility conditionals. Change any uses of sigset_t to
struct __sigset to avoid depending on objects from <sys/signal.h>.
2002-10-13 00:31:46 +00:00
Mike Barcroft
ddb056b7d4 Add conditionals to allow va_list to be defined in other headers. 2002-10-06 22:02:06 +00:00
Mike Barcroft
0b058e3cbd o Add conditionals to allow va_list to be defined in other headers.
o Standardize on _MACHINE_STDARG_H_ to allow multiple header includes.
o Restrict the definition of va_copy() to C99 environments.
2002-10-06 22:01:07 +00:00
Maxime Henrion
00a3bdc19a Add two extern's for adjkerntz and wall_cmos_clock, all other
archs have them there, alghough the variable are declared in
subr_clock.c.  These should probably be moved into some MI
place.

Approved by:	jake
2002-10-05 20:14:49 +00:00
Mike Barcroft
e61d3b10d7 Fix namespace issues by using visibility conditionals from
<sys/cdefs.h>.
2002-10-05 05:47:56 +00:00
Mike Barcroft
085f8416a2 style(9) <machine/setjmp.h> headers so they look mostly the same. 2002-10-04 22:10:06 +00:00
Sam Leffler
14c17bd293 New bus_dma interfaces for use by crypto device drivers:
o bus_dmamap_load_mbuf
o bus_dmamap_load_uio

Test on i386.  Known to compile on alpha and sparc64, but not tested.
Otherwise untried.
2002-10-04 20:40:39 +00:00
Jake Burkholder
689cd8eeb8 Convert the bus space accessors from macros to inlines. This fixes some
problems with drivers that expect functions rather than function like
macros.

Reviewed by:	tmm
2002-10-01 16:32:09 +00:00
Jake Burkholder
eade9db908 Get rid of the TODO macro in the few places that still need work; either
comment it out or change to explicit panics.  It conflicts with things
like #if TODO in drivers.
2002-10-01 06:34:21 +00:00
Jake Burkholder
e557d82ace Add needed include of queue.h. 2002-10-01 02:50:26 +00:00
Jake Burkholder
3297e8c990 Renamed intr_enqueue to intr_vector and intr_dequeue to intr_fast, to
better reflect how they are called.
2002-09-28 03:06:35 +00:00
Mike Barcroft
c0d4804d67 Be careful not to define GCC-specific optimizations in the non-GCC
case.
2002-09-23 04:32:17 +00:00
Maxime Henrion
f30120c393 Don't include opt_bus.h here, it breaks stuff trying to
include machine/bus.h.

Reviewed by:	tmm
2002-09-21 18:12:00 +00:00
Mike Barcroft
86954511d2 Implement C99's va_copy() macro. 2002-09-18 07:33:16 +00:00
Peter Wemm
66422f5b7a Initiate deorbit burn for the i386-only a.out related support. Moves are
under way to move the remnants of the a.out toolchain to ports.  As the
comment in src/Makefile said, this stuff is deprecated and one should not
expect this to remain beyond 4.0-REL.  It has already lasted WAY beyond
that.

Notable exceptions:
gcc - I have not touched the a.out generation stuff there.
ldd/ldconfig - still have some code to interface with a.out rtld.
old as/ld/etc - I have not removed these yet, pending their move to ports.
some includes - necessary for ldd/ldconfig for now.

Tested on: i386 (extensively), alpha
2002-09-17 01:49:00 +00:00
Thomas Moestl
ac9e4b5aea Use the definitions in machine/fsr.h instead of duplicating these magic
numbers here (the values need to correspond to the %fsr ones for some
libc functions to work right).
2002-09-14 18:00:44 +00:00
Thomas Moestl
351c67842f Clean up a bit, and add some more macros to access %fsr fields. 2002-09-14 17:58:54 +00:00
Mike Barcroft
dd1b6791a8 Now that _BSD_CLK_TCK_ and _BSD_CLOCKS_PER_SEC_ are the same on all
architectures, move the definition directly into <time.h> and finish
the removal of <machine/ansi.h>.
2002-09-03 00:06:58 +00:00
Mike Barcroft
d0a18151c9 Align _BSD_CLK_TCK_ and _BSD_CLOCKS_PER_SEC_ with most other
platforms.  This introduces some binary incompatibilities for
dynamically linked programs which make use of clock(3) and times(3).

Approved by:	jake
2002-09-02 22:40:56 +00:00
Peter Wemm
447b3772dc Change hw.physmem and hw.usermem to unsigned long like they used to be
in the original hardwired sysctl implementation.

The buf size calculator still overflows an integer on machines with large
KVA (eg: ia64) where the number of pages does not fit into an int.  Use
'long' there.

Change Maxmem and physmem and related variables to 'long', mostly for
completeness.  Machines are not likely to overflow 'int' pages in the
near term, but then again, 640K ought to be enough for anybody.  This
comes for free on 32 bit machines, so why not?
2002-08-30 04:04:37 +00:00
Jake Burkholder
bafbd49201 Renamed poorly named setregs to exec_setregs. Moved its prototype to
imgact.h with the other exec support functions.
2002-08-29 06:17:48 +00:00
Jake Burkholder
0654f7911f Removed legacy signal trampoline. 2002-08-29 01:59:54 +00:00
Mike Barcroft
bd8e0716d9 Move several MI types from <machine/_types.h> to <sys/_types.h>.
These types are unlikely to ever become very MD.  They include:
clockid_t, ct_rune_t, fflags_t, intrmask_t, mbstate_t, off_t, pid_t,
rune_t, socklen_t, timer_t, wchar_t, and wint_t.

While moving them, make a few adjustments (submitted by bde):
o __ct_rune_t needs to be precisely `int', not necessarily __int32_t,
  since the arg type of the ctype functions is int.
o __rune_t, __wchar_t and __wint_t inherit this via a typedef of
  __ct_rune_t.
o Some minor wording changes in the comment blocks for ct_rune_t and
  mbstate_t.

Submitted by:	bde (partially)
2002-08-23 16:49:06 +00:00
Jake Burkholder
0b0fe2194d Removed unneeded include of machine/types.h (which no longer exists). 2002-08-23 05:01:19 +00:00
Mike Barcroft
abbd890233 o Merge <machine/ansi.h> and <machine/types.h> into a new header
called <machine/_types.h>.
o <machine/ansi.h> will continue to live so it can define MD clock
  macros, which are only MD because of gratuitous differences between
  architectures.
o Change all headers to make use of this.  This mainly involves
  changing:
    #ifdef _BSD_FOO_T_
    typedef	_BSD_FOO_T_	foo_t;
    #undef _BSD_FOO_T_
    #endif
  to:
    #ifndef _FOO_T_DECLARED
    typedef	__foo_t	foo_t;
    #define	_FOO_T_DECLARED
    #endif

Concept by:	bde
Reviewed by:	jake, obrien
2002-08-21 16:20:02 +00:00
Jake Burkholder
6d9acb27b1 Fix warning. These structs should probably be removed altogether. 2002-08-18 03:05:55 +00:00
Jake Burkholder
8b53c815ec Add pmap support for user mappings of multiple page sizes (super pages).
This supports all hardware page sizes (8K, 64K, 512K, 4MB), but only 8k
pages are actually used as of yet.
2002-08-18 02:09:27 +00:00
Jake Burkholder
6856ac3294 Minor style. Removed unused declaration. 2002-08-16 01:35:00 +00:00
Jake Burkholder
6df1fae014 Demark sections of code that need special fault handling with labels.
Check if the trapped pc is inside of the demarked sections to implement
fault recovery for copyin etc, instead of pcb_onfault.  Handle recovery
from data access exceptions as well as page faults.

Inspired by:	bde's sys.dif
2002-08-16 00:57:37 +00:00
Jake Burkholder
b5d2ed3047 Store the number of itlb and dtlb entries separately; they may be different.
Find the prom node for the boot cpu earlier and store it in the per-cpu
area, so that cache_init can be called earlier.
2002-08-15 05:24:55 +00:00
Jake Burkholder
5aebb40291 Auto size available kernel virtual address space based on phsyical memory
size.  This avoids blowing out kva in kmeminit() on large memory machines
(4 gigs or more).

Reviewed by:	tmm
2002-08-10 22:14:16 +00:00
Alan Cox
33559722db o Introduce pmap_page_is_mapped(). Its purpose is to obsolete
the PG_MAPPED flag.
2002-08-07 18:03:00 +00:00
Jake Burkholder
4fbe520926 Forgot to commit this.
Spotted by:	scottl
2002-08-01 21:39:54 +00:00
Jake Burkholder
055ca86c52 These file are no longer used (moved to userland and/or merged into
pmap.c).
2002-07-31 16:23:27 +00:00
Jake Burkholder
61f869600d Add definitions for statistical and high-resolution profiling. The calling
conventions for _mcount and __cyg_profile_func_enter are different, so
statistical profiling kernels build and link but don't actually work.
IWBNI one could tell gcc to only generate calls to the former.

Define uintfptr_t properly for userland, but not for the kernel (I hope).
2002-07-30 06:14:34 +00:00
Mike Barcroft
49545b3891 Create a new header <machine/_stdint.h> for storing MD parts of
<stdint.h>.  Previously, parts were defined in <machine/ansi.h> and
<machine/limits.h>.  This resulted in two problems:
  (1) Defining macros in <machine/ansi.h> gets in the way of that
      header only defining types.
  (2) Defining C99 limits in <machine/limits.h> adds pollution to
      <limits.h>.
2002-07-29 17:41:23 +00:00
Jake Burkholder
d40e229819 Add _ALIGN_DATA and _ALIGN_TEXT macros. 2002-07-29 00:38:07 +00:00
Mike Barcroft
7a415ec906 Revert the previous delta; uintfptr_t needs to be available to
userland for libc/gmon to compile, so the typedef in <machine/types.h>
isn't good enough.  This is really ugly since we end up with the
actual value which uintfptr_t is typedef'd from, in multiple places.
This is bug for bug compatible with the other FreeBSD architectures.

Noticed by:	sparc64 tinderbox
2002-07-28 15:59:51 +00:00
Jake Burkholder
839b2e106a Add declarations for btext and etext. 2002-07-28 01:01:14 +00:00
Jake Burkholder
7d8a5be3ea uintfptr_t has moved to machine/types.h. 2002-07-27 23:36:51 +00:00
Jake Burkholder
30bbe52432 Implement a direct mapped address region, like alpha and ia64. This
basically maps all of physical memory 1:1 to a range of virtual addresses
outside of normal kva.  The advantage of doing this instead of accessing
phsyical addresses directly is that memory accesses will go through the
data cache, and will participate in the normal cache coherency algorithm
for invalidating lines in our own and in other cpus' data caches.  So
we don't have to flush the cache manually or send IPIs to do so on other
cpus.  Also, since the mappings never change, we don't have to flush them
from the tlb manually.
This makes pmap_copy_page and pmap_zero_page MP safe, allowing the idle
zero proc to run outside of giant.

Inspired by:	ia64
2002-07-27 21:57:38 +00:00
Jake Burkholder
dab4349561 Remove the tlb argument to tlb_page_demap (itlb or dtlb), in order to better
match the pmap_invalidate api.
2002-07-26 15:54:04 +00:00