Commit Graph

170 Commits

Author SHA1 Message Date
bouyer
1206dd032d Various cleanups in interrupt code, and fix a potential crash in doreti:
if we enter doreti_checkast with only soft interrupt pendings, we would
jump to one of the soft* vector with %esi uninitialized, and the vector
would do a jump *%esi at the end ...
I don't know why nobody ever went into this; I guess in the common case
there's no soft irq pending without a hard irq in this code path ...
2007-06-25 20:09:34 +00:00
bouyer
bf539c16bd Add back a __asm("lock") that got lost in the yamt-idlelwp merge. 2007-06-25 20:02:45 +00:00
bouyer
142ad1ab3e Call p_emul->e_syscall_intern() before sendsig_reset() to match what
i386 does.
2007-06-25 20:01:23 +00:00
bouyer
a7d4fae602 Fix race condition in cpu_idle() on ci_want_resched. From YAMAMOTO Takashi. 2007-06-25 19:57:32 +00:00
dyoung
1ee8f4a418 Extract common code from i386, xen, and sparc64, creating
config_handle_wedges() and read_disk_sectors().  On x86, handle_wedges()
is a thin wrapper for config_handle_wedges().  Share opendisk()
across architectures.

Add kernel code in support of specifying a root partition by wedge
name.  E.g., root specifications "wedge:wd0a", "wedge:David's Root
Volume" are possible.  (Patches for config(1) coming soon.)

In support of moving disks between architectures (esp. i386 <->
evbmips), I've written a routine convertdisklabel() that ensures
that the raw partition is at RAW_DISK by following these steps:

        0 If we have read a disklabel that has a RAW_PART with
          p_offset == 0 and p_size != 0, then use that raw partition.

        1 If we have read a disklabel that has both partitions 'c'
          and 'd', and RAW_PART has p_offset != 0 or p_size == 0,
          but the other partition is suitable for a raw partition
          (p_offset == 0, p_size != 0), then swap the two partitions
          and use the new raw partition.

        2 If the architecture's raw partition is 'd', and if there
          is no partition 'd', but there is a partition 'c' that
          is suitable for a raw partition, then copy partition 'c'
          to partition 'd'.

        3 Determine the drive's last sector, using either the
          d_secperunit the drive reported, or by guessing (0x1fffffff).
          If we cannot read the drive's last sector, then fail.

        4 If we have read a disklabel that has no partition slot
          RAW_PART, then create a partition RAW_PART.  Make it span
          the whole drive.

        5 If there are fewer than MAXPARTITIONS partitions,
          then "slide" the unsuitable raw partition RAW_PART, and
          subsequent partitions, into partition slots RAW_PART+1
          and subsequent slots.  Create a raw partition at RAW_PART.
          Make it span the whole drive.

The convertdisklabel() procedure can probably stand to be simplified,
but it ought to deal with all but an extraordinarily broken disklabel,
now.

i386: compiled and tested, sparc64: compiled, evbmips: compiled.
2007-06-24 01:43:34 +00:00
bouyer
c9054f7661 Support root= as an alias for bootdev=, for consistency with multiboot
support. Suggested by Pavel Cahyna.
2007-06-18 18:56:23 +00:00
bouyer
e0e73c4e83 Make it build again when IPMI is used (caddr_t issue ?) 2007-06-12 18:55:50 +00:00
yamt
f03010953f merge yamt-idlelwp branch. asked by core@. some ports still needs work.
from doc/BRANCHES:

	idle lwp, and some changes depending on it.

	1. separate context switching and thread scheduling.
	   (cf. gmcgarry_ctxsw)
	2. implement idle lwp.
	3. clean up related MD/MI interfaces.
	4. make scheduler(s) modular.
2007-05-17 14:51:11 +00:00
jld
51e5b25976 Convert the xen port to use timecounters; ok'ed by bouyer@. 2007-05-12 07:06:54 +00:00
ad
8aefa8aa0c Share the sysarch stuff between the x86 ports. PR kern/36046. 2007-04-16 19:12:17 +00:00
ad
28c7654399 Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.
2007-03-13 18:30:57 +00:00
ad
59d979c5f1 Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.
2007-03-12 18:18:22 +00:00
yamt
dedaf26748 fix vcpu after recent cpubus changes. 2007-03-06 12:35:39 +00:00
dogcow
b347627ab1 The recent cpu_attach changes broke the xen build; while this compiles,
I'm far from positive it's the correct fix.
2007-03-05 23:26:40 +00:00
drochner
d880082522 clean up how cpus and ioapics are attached at the mainbus:
Seperate "cpubus" and "ioapicbus" -- while they share a common "address
space" (the apic id), the kernel doesn't use this fact. There are different
data passed to cpus and apics, which caused some ugly polymorphism. This
also saves the special "submatch" functions needed to distingush cpus
and ioapics for autoconf. (And it makes that "apid" locators wired
in the kernel configuration are honored now; this allows one to dumb down
an mp box to singleprocessor by userconfig.)
Print "apid" locators in the buses "print" function "as everyone does",
so the per-port cpu drivers don't need to do it.
Being here, constify "struct cpu_functions" and g/c the unused MP_PICMODE
flag.
2007-03-05 16:50:59 +00:00
dogcow
fc8b4c24ce fix more caddr_t -> void * fallout. 2007-03-05 03:22:06 +00:00
christos
53524e44ef Kill caddr_t; there will be some MI fallout, but it will be fixed shortly. 2007-03-04 05:59:00 +00:00
thorpej
ae01c745cb TRUE -> true, FALSE -> false 2007-02-22 06:47:16 +00:00
thorpej
712239e366 Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.
2007-02-21 22:59:35 +00:00
dsl
5c89b1866e Get config(1) to supply the default values for BEEP_ONHALT. 2007-02-18 18:15:41 +00:00
pavel
934634a18c Change the process/lwp flags seen by userland via sysctl back to the
P_*/L_* naming convention, and rename the in-kernel flags to avoid
conflict. (P_ -> PK_, L_ -> LW_ ). Add back the (now unused) LSDEAD
constant.

Restores source compatibility with pre-newlock2 tools like ps or top.

Reviewed by Andrew Doran.
2007-02-17 22:31:36 +00:00
ad
b07ec3fc38 Merge newlock2 to head. 2007-02-09 21:55:00 +00:00
hubertf
eda05c6413 Remove more duplicate headers.
Patch by Slava Semushin <slava.semushin@gmail.com>

Again, this was tested by comparing obj files from a pristine and a patched
source tree against an i386/ALL kernel, and also for src/sbin/fsck_ffs,
src/sbin/fsdb and src/usr.sbin/makefs. Only changes in assert() line numbers
were detected in 'objdump -d' output.
2007-01-29 01:52:43 +00:00
bouyer
89b7593e6a Xen3 linux guests seems to loan a lot of pages for some disk transfers,
and eventually run out of XENSHM_NPAGES for a single transfers.
Bump XENSHM_NPAGES by 10 for xen3 to avoid deadlocks in such case.
2007-01-20 22:01:06 +00:00
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