Commit Graph

146 Commits

Author SHA1 Message Date
pavel
104e8925ea remove some leftover msgbuf manipulation from pmap.c, as done for the i386
and amd64 versions before. Inspired by PR port-i386/34186 from Wolfgang
Stukenbrock.
2007-01-06 17:48:52 +00:00
yamt
35374d3155 bring in wedge handling code from arch/x86/x86/x86_autoconf.c.
unlike i386, we can't rely on the bootloader.
2007-01-01 02:59:50 +00:00
elad
504c71d9fe Make machdep scope architecture-agnostic by removing all arch-specific
requests and centralizing them all. The result is that some of these
are not used on some architectures, but the documentation was updated
to reflect that.
2006-12-26 10:43:43 +00:00
wiz
3ed1aa9185 Spell "separate" correctly. From Zafer Aydogan. 2006-12-25 18:39:47 +00:00
yamt
98cfc473c8 - pass intrframe by-pointer, not by-value.
- make i386 and xen use per-cpu interrupt stack.

xen part is reviewed by Manuel Bouyer.
2006-12-08 15:05:18 +00:00
wiz
6919c6578c s/independant/independent/, from Zafer. 2006-11-24 22:04:21 +00:00
oster
d4240170d8 xen_shm_errintvl is only used in the DEBUG case. Fixes build for non-DEBUG. 2006-11-16 22:38:18 +00:00
yamt
730ba489f6 xen_shm: make some variables static. 2006-11-16 05:43:47 +00:00
gson
3b3814b873 const correctness 2006-10-23 18:10:44 +00:00
yamt
6a98028817 use vmem for xen_shm. 2006-10-22 09:44:55 +00:00
mrg
065b4dbdca fix errors in the previous changes. 2006-10-21 08:09:58 +00:00
mrg
648bbec934 in cpu_dumpconf(), don't panic() if we can't bdevsw_lookup() the
dumpdev.  this occurs when we try to set the dumpdev to a device
with no driver loaded.  this fixes PR#34872.

in sys_swapctl, if bdevsw_lookup() fails, set dumpdev = NODEV
before calling cpu_dumpconf().  (this also fixes PR#34872.)

XXX: cpu_dumpconf() should probably be changed to take a dumpdev
XXX: and return an error in such cases, but that is a much more
XXX: intrusive change.

XXX2: this is only run-tested on sparc64 and compile tested on a
XXX2: couple of platforms.
2006-10-21 05:54:31 +00:00
bouyer
f3366866dc Change BSD_SYMTAB to BSD_SYMTAB=yes. Xen-3.0.2 wants it, and xen-3.0.3
doesn't care.
2006-10-17 22:16:20 +00:00
bouyer
abd9ea51ce XEN_NO_HYPERCALLPAGE is redundant with XEN_COMPAT_030001; make
XEN_COMPAT_030001 disable the hypercall page too and remove
XEN_NO_HYPERCALLPAGE
2006-10-17 19:57:24 +00:00
bouyer
754514a443 Add ELF_PADDR_OFFSET and VIRT_ENTRY strings to __xen_guest ELF section,
so that our kernels works with newer xen-3 hypervisors; and correct the value
of VIRT_BASE for dom0.
Now that we can embed the values of KERNBASE and KERNTEXTOFF in the binary
for Xen, make the domU memory layout the same as dom0 for Xen3 (making
it the other way round doens't work; probably because of alignement
constraints in the hypervisor). The old domU layout is used if options
XEN_COMPAT_030001 is present in the kernel config file. Enable this the
domU kernel config files for now, in case someone wants to run a NetBSD
domU on an older Xen3 installation.
2006-10-17 18:53:03 +00:00
bouyer
6d83e141d6 Map the ISA hole on Xen, which allows us to access the SMBios, which allows
us to find the IPMI address. Add IPMI support on Xen (commented out for now)
2006-10-01 21:36:11 +00:00
bouyer
f23d3bb7be Add Xen3 support for ACPI and/or MPBIOS + IOAPIC. To help with this, physical
CPUs are now configured on mainbus only in dom0, and only to know about
their APIC id. virtual CPUs are attached to hypervisor as:
vcpu* at hypervisor?
and this is what's used as curcpu(). The kernel config files needs to be
updated for this, see XEN3_DOM0 or XEN3_DOMU for examples.
XEN3_DOM0 now has acpi, MPBIOS and ioapic by default.
Note that a Xen dom0 kernel doens't have access to the lapic.
2006-09-28 18:53:15 +00:00
bouyer
f99383d432 The Xen folks says everyone should use hypercall call page now, make it so.
Old hypercall call method still still available with
options XEN_NO_HYPERCALLPAGE
but this is disabled by default (xen-3.0.2-2 supports hypercall call page
just fine).
While there add a VIRT_BASE= string in __xen_guest section; from
Bastian Blank on port-xen@.
2006-09-24 18:14:44 +00:00
elad
6ecd7be983 Lose (void *) casts on the machdep scope authorization wrapper. Update
documentation.
2006-09-19 22:03:10 +00:00
elad
5f7169ccb1 First take at security model abstraction.
- Add a few scopes to the kernel: system, network, and machdep.

- Add a few more actions/sub-actions (requests), and start using them as
  opposed to the KAUTH_GENERIC_ISSUSER place-holders.

- Introduce a basic set of listeners that implement our "traditional"
  security model, called "bsd44". This is the default (and only) model we
  have at the moment.

- Update all relevant documentation.

- Add some code and docs to help folks who want to actually use this stuff:

  * There's a sample overlay model, sitting on-top of "bsd44", for
    fast experimenting with tweaking just a subset of an existing model.

    This is pretty cool because it's *really* straightforward to do stuff
    you had to use ugly hacks for until now...

  * And of course, documentation describing how to do the above for quick
    reference, including code samples.

All of these changes were tested for regressions using a Python-based
testsuite that will be (I hope) available soon via pkgsrc. Information
about the tests, and how to write new ones, can be found on:

	http://kauth.linbsd.org/kauthwiki

NOTE FOR DEVELOPERS: *PLEASE* don't add any code that does any of the
following:

  - Uses a KAUTH_GENERIC_ISSUSER kauth(9) request,
  - Checks 'securelevel' directly,
  - Checks a uid/gid directly.

(or if you feel you have to, contact me first)

This is still work in progress; It's far from being done, but now it'll
be a lot easier.

Relevant mailing list threads:

http://mail-index.netbsd.org/tech-security/2006/01/25/0011.html
http://mail-index.netbsd.org/tech-security/2006/03/24/0001.html
http://mail-index.netbsd.org/tech-security/2006/04/18/0000.html
http://mail-index.netbsd.org/tech-security/2006/05/15/0000.html
http://mail-index.netbsd.org/tech-security/2006/08/01/0000.html
http://mail-index.netbsd.org/tech-security/2006/08/25/0000.html

Many thanks to YAMAMOTO Takashi, Matt Thomas, and Christos Zoulas for help
stablizing kauth(9).

Full credit for the regression tests, making sure these changes didn't break
anything, goes to Matt Fleming and Jaime Fournier.

Happy birthday Randi! :)
2006-09-08 20:58:56 +00:00
ad
f474dceb13 Use the LWP cached credentials where sane. 2006-07-23 22:06:03 +00:00
ad
2b79369c7e - Hold a reference to the process credentials in each struct lwp.
- Update the reference on syscall and user trap if p_cred has changed.
- Collect accounting flags in the LWP, and collate on LWP exit.
2006-07-19 21:11:37 +00:00
bouyer
65918da968 DTRT when the number of grants to map or unmap is more than one. 2006-06-25 18:03:49 +00:00
bouyer
b063155744 Allow xen_shm_map() to map multiple grants in a contigous virtual address
space.
While here garbage-collect unused xen_shm_vaddr2ma()
2006-06-25 15:18:53 +00:00
bouyer
5ff62d8d84 On my system the CPU frequency reported at boot is off by about 10% (maybe
because of the jitter caused by the serial console), which is not only
cosmetic but is bad for clock accuracy. Introducing a 1s delay before reading
Xen's idea of the CPU frequency fixes this.
2006-05-27 20:48:40 +00:00
bouyer
d1d1596e1e Convert xen_shm_map() and xen_shm_unmap() to the Xen3 grant table
interface.
2006-05-25 21:26:20 +00:00
yamt
7445825948 i386 and xen: move struct user to the highest address in uarea
and reduce UPAGES from 4 to 3 in the case of !NOREDZONE.
2006-05-22 13:44:53 +00:00
dogcow
e04236d6b3 remove bitrotted functions that have never been used, and have been
cargo-culted from one port to another.
2006-05-15 12:47:42 +00:00
yamt
394475baf3 include sys/kauth.h for NOCRED. 2006-05-15 00:55:57 +00:00
yamt
dfae4593ce include sys/kauth.h for kauth_cred_geteuid. 2006-05-15 00:55:29 +00:00
elad
8ccb6c9341 integrate kauth. 2006-05-14 21:55:09 +00:00
skrll
214053461e Fix some more comments. 2006-05-13 08:56:08 +00:00
christos
19e3773ffa Apply fix from FreeBSD's advisory: fxrstor on AMD FPU's does not restore
FIP,FDP,FOP thus leaking other process's execution history.
2006-04-19 17:19:48 +00:00
bouyer
aab0004b68 Add support for ACPI in xen-3 dom0 support. We can now boot a xen-3 dom0
kernel with a default xen comamnd line.
2006-04-09 19:28:00 +00:00
thorpej
2be6494fc9 Use device_cfdata(). 2006-03-29 04:16:44 +00:00
thorpej
39cd836ee1 Use device_unit(). 2006-03-28 17:38:24 +00:00
bouyer
03999c340c For unknown CPU, if family >= CPU_MAXFAMILY set family to CPU_MINFAMILY instead
of CPU_MAXFAMILY. This effectively causes to downgrade to i386 class
instead of a nonexistant class, and overrunning  classnames[] by one.
Coverity ID 1472.
2006-03-27 20:59:35 +00:00
jld
2ae09ef648 Fix handling of physmem (and the hw.usermem sysctl) to better reflect
reality -- the memory taken by the kernel image should be counted in the
former, but not the latter, as is the case on other ports.

Discussed on port-xen; approved by bouyer@.
2006-03-23 04:14:33 +00:00
drochner
47fbb9d86b adapt to uvm_fault() interface cleanup: kill the useless 3rd argument 2006-03-15 18:12:02 +00:00
jld
25ab6c9464 Improve timekeeping under Xen. Specifically, replace use of
cc_microtime with a MD function that isn't affected by erratic "clock
interrupts" and instead takes more advantage of time information
provided by the hypervisor.  Fixes, most importantly, a case where the
clock as seen by userland would sometimes bounce back and forth by up to
1<<31 us (~35 min).

Approved by bouyer@; explained in more detail in
http://mail-index.netbsd.org/port-xen/2006/02/28/0002.html
2006-03-07 23:08:14 +00:00
bouyer
be18814951 Fix build issues that didn't show up in my private tree. 2006-03-06 22:04:18 +00:00
bouyer
8adab3e01b Map the XenStore shared page for non-domain0. 2006-03-06 20:32:28 +00:00
thorpej
a4f36d5d21 Use device_is_a(). 2006-02-26 06:17:00 +00:00
thorpej
458b3e43f7 Use device_parent(). 2006-02-23 05:37:46 +00:00
thorpej
58853410ae Use device_class() instead of accessing dv_class directly. 2006-02-21 04:32:38 +00:00
yamt
3bf197127a merge xen pmap_enter, pmap_enter_ma, pmap_remap_pages.
ok'ed by Manuel Bouyer.
2006-01-23 20:19:08 +00:00
bouyer
4021f3f608 Fix bad cut'n'paste: use the target of strncpy() in sizeof(). 2006-01-22 20:15:51 +00:00
bouyer
8f162b7ed8 Snapshot of work in progress on NetBSD port to Xen3:
- kernel (both dom0 and domU) boot, console is functionnal and it can starts
  software from a ramdisk
- there is no driver front-end expect console for domU yet.
- dom0 can probe devices and ex(4) work when Xen3 is booted without acpi
  and apic support. But the on-board IDE doens't get interrupts.
  The PCI code still needs work (it's hardcoded to mode 1). Some of this
  code should be shared with ../x86
  The physical insterrupt code needs to get MPBIOS and ACPI support, and
  do interrupt routing to properly interract with Xen.
To enable Xen-3.0 support, add
options XEN3
to your kernel config file (this will disable Xen2 support)
Changes affecting Xen-2.0 support (no functionnal changes intended):
- get more constants from genassym for assembly code
- remove some unneeded registers move from start()
- map the shared info page from start(), and remove the pte = 0xffffffff hack
- vector.S: in hypervisor_callback() make sure %esi points to
  HYPERVISOR_shared_info before accessing the info page. Remplace some
  hand-written assembly with the equivalent macro defined in frameasm.h
- more debug code, dissabled by default.

while here added my copyright on some files I worked on in 2005.
2006-01-15 22:09:51 +00:00
bouyer
3c69e23dad ctrl_if.h isn't needed here. 2006-01-08 19:00:59 +00:00
bouyer
4f02289d67 Make stts a no-op as clts already is
Always call HYPERVISOR_fpu_taskswitch() at the end of npxsave_lwp().

This fixes the FPU problems detected by paranoia on a NetBSD/Xen guest.
Based on patch sent by Paul Ripke on port-xen, but reworked by me.
Should fix port-xen/30977.
2006-01-03 20:18:51 +00:00