Commit graph

601 commits

Author SHA1 Message Date
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