[Midnightbsd-cvs] src: sys/i386: merge changes

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sat Dec 6 22:50:30 EST 2008


Log Message:
-----------
merge changes

Modified Files:
--------------
    src/sys/i386:
        Makefile (r1.1.1.1 -> r1.2)
    src/sys/i386/acpica:
        Makefile (r1.2 -> r1.3)
        OsdEnvironment.c (r1.2 -> r1.3)
        acpi_machdep.c (r1.2 -> r1.3)
        acpi_wakecode.S (r1.2 -> r1.3)
        acpi_wakeup.c (r1.2 -> r1.3)
        genwakecode.sh (r1.2 -> r1.3)
        madt.c (r1.2 -> r1.3)
    src/sys/i386/bios:
        apm.c (r1.1.1.1 -> r1.2)
        apm.h (r1.1.1.1 -> r1.2)
        smapi.c (r1.1.1.1 -> r1.2)
        smapi_bios.S (r1.1.1.1 -> r1.2)
        smbios.c (r1.1.1.1 -> r1.2)
        vpd.c (r1.1.1.1 -> r1.2)
    src/sys/i386/cpufreq:
        est.c (r1.3 -> r1.4)
        p4tcc.c (r1.2 -> r1.3)
        powernow.c (r1.2 -> r1.3)
        smist.c (r1.2 -> r1.3)
    src/sys/i386/ibcs2:
        Makefile (r1.1.1.2 -> r1.2)
        ibcs2_ipc.c (r1.1.1.1 -> r1.2)
        ibcs2_ipc.h (r1.1.1.1 -> r1.2)
        ibcs2_isc.c (r1.1.1.1 -> r1.2)
        ibcs2_isc_syscall.h (r1.1.1.1 -> r1.2)
        ibcs2_isc_sysent.c (r1.1.1.1 -> r1.2)
        ibcs2_misc.c (r1.1.1.1 -> r1.2)
        ibcs2_msg.c (r1.1.1.1 -> r1.2)
        ibcs2_other.c (r1.1.1.1 -> r1.2)
        ibcs2_proto.h (r1.1.1.1 -> r1.2)
        ibcs2_socksys.c (r1.1.1.1 -> r1.2)
        ibcs2_syscall.h (r1.1.1.1 -> r1.2)
        ibcs2_sysent.c (r1.1.1.1 -> r1.2)
        ibcs2_sysi86.c (r1.1.1.1 -> r1.2)
        ibcs2_sysvec.c (r1.1.1.2 -> r1.2)
        ibcs2_util.h (r1.1.1.1 -> r1.2)
        ibcs2_xenix.c (r1.1.1.1 -> r1.2)
        ibcs2_xenix.h (r1.1.1.1 -> r1.2)
        ibcs2_xenix_syscall.h (r1.1.1.1 -> r1.2)
        ibcs2_xenix_sysent.c (r1.1.1.1 -> r1.2)
        imgact_coff.c (r1.1.1.1 -> r1.2)
        syscalls.conf (r1.1.1.1 -> r1.2)
        syscalls.isc (r1.1.1.1 -> r1.2)
        syscalls.isc.conf (r1.1.1.1 -> r1.2)
        syscalls.master (r1.1.1.1 -> r1.2)
        syscalls.xenix (r1.1.1.1 -> r1.2)
        syscalls.xenix.conf (r1.1.1.1 -> r1.2)
    src/sys/i386/pci:
        pci_bus.c (r1.1.1.1 -> r1.2)
        pci_cfgreg.c (r1.1.1.1 -> r1.2)
        pci_pir.c (r1.1.1.1 -> r1.2)
    src/sys/i386/svr4:
        svr4_machdep.c (r1.1.1.1 -> r1.2)

-------------- next part --------------
Index: Makefile
===================================================================
RCS file: /home/cvs/src/sys/i386/Makefile,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/i386/Makefile -L sys/i386/Makefile -u -r1.1.1.1 -r1.2
--- sys/i386/Makefile
+++ sys/i386/Makefile
@@ -1,11 +1,10 @@
-# $FreeBSD: src/sys/i386/Makefile,v 1.11 2002/06/21 06:18:02 mckusick Exp $
+# $FreeBSD: src/sys/i386/Makefile,v 1.12 2007/05/13 18:21:54 mckusick Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/11/93
 
 # Makefile for i386 links, tags file
 
 # SYS is normally set in Make.tags.inc
-# SYS=/sys
-SYS=/nsys
+SYS=/sys
 
 TAGDIR=	i386
 
@@ -25,7 +24,8 @@
 	-for i in ${DI386}; do \
 	    (cd $$i && { rm -f tags; ln -s ../tags tags; }) done
 
-SI386=	${SYS}/i386/apm/*.[ch] \
+SI386=	${SYS}/i386/acpica/*.[ch] ${SYS}/i386/bios/*.[ch] \
+	${SYS}/i386/cpufreq/*.[ch] ${SYS}/i386/pci/*.[ch] \
 	${SYS}/i386/i386/*.[ch] ${SYS}/i386/ibcs2/*.[ch] \
 	${SYS}/i386/include/*.[ch] ${SYS}/i386/isa/*.[ch] \
 	${SYS}/i386/linux/*.[ch]
Index: madt.c
===================================================================
RCS file: /home/cvs/src/sys/i386/acpica/madt.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/i386/acpica/madt.c -L sys/i386/acpica/madt.c -u -r1.2 -r1.3
--- sys/i386/acpica/madt.c
+++ sys/i386/acpica/madt.c
@@ -28,8 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/acpica/madt.c,v 1.19.2.2 2006/05/11 17:41:00 njl Exp $");
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: src/sys/i386/acpica/madt.c,v 1.28 2007/09/11 22:54:09 attilio Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -54,43 +53,43 @@
 #include <dev/acpica/acpivar.h>
 #include <dev/pci/pcivar.h>
 
-#define	NIOAPICS		32	/* Max number of I/O APICs */
-#define	NLAPICS			32	/* Max number of local APICs */
-
-typedef	void madt_entry_handler(APIC_HEADER *entry, void *arg);
+typedef	void madt_entry_handler(ACPI_SUBTABLE_HEADER *entry, void *arg);
 
 /* These two arrays are indexed by APIC IDs. */
 struct ioapic_info {
 	void *io_apic;
 	UINT32 io_vector;
-} ioapics[NIOAPICS];
+} ioapics[MAX_APIC_ID + 1];
 
 struct lapic_info {
 	u_int la_enabled:1;
 	u_int la_acpi_id:8;
-} lapics[NLAPICS];
+} lapics[MAX_APIC_ID + 1];
 
 static int madt_found_sci_override;
-static MULTIPLE_APIC_TABLE *madt;
+static ACPI_TABLE_MADT *madt;
 static vm_paddr_t madt_physaddr;
 static vm_offset_t madt_length;
 
-MALLOC_DEFINE(M_MADT, "MADT Table", "ACPI MADT Table Items");
+MALLOC_DEFINE(M_MADT, "madt_table", "ACPI MADT Table Items");
 
-static enum intr_polarity interrupt_polarity(UINT16 Polarity, UINT8 Source);
-static enum intr_trigger interrupt_trigger(UINT16 TriggerMode, UINT8 Source);
+static enum intr_polarity interrupt_polarity(UINT16 IntiFlags, UINT8 Source);
+static enum intr_trigger interrupt_trigger(UINT16 IntiFlags, UINT8 Source);
 static int	madt_find_cpu(u_int acpi_id, u_int *apic_id);
 static int	madt_find_interrupt(int intr, void **apic, u_int *pin);
 static void	*madt_map(vm_paddr_t pa, int offset, vm_offset_t length);
 static void	*madt_map_table(vm_paddr_t pa, int offset, const char *sig);
-static void	madt_parse_apics(APIC_HEADER *entry, void *arg);
-static void	madt_parse_interrupt_override(MADT_INTERRUPT_OVERRIDE *intr);
-static void	madt_parse_ints(APIC_HEADER *entry, void *arg __unused);
-static void	madt_parse_local_nmi(MADT_LOCAL_APIC_NMI *nmi);
-static void	madt_parse_nmi(MADT_NMI_SOURCE *nmi);
+static void	madt_parse_apics(ACPI_SUBTABLE_HEADER *entry, void *arg);
+static void	madt_parse_interrupt_override(
+		    ACPI_MADT_INTERRUPT_OVERRIDE *intr);
+static void	madt_parse_ints(ACPI_SUBTABLE_HEADER *entry,
+		    void *arg __unused);
+static void	madt_parse_local_nmi(ACPI_MADT_LOCAL_APIC_NMI *nmi);
+static void	madt_parse_nmi(ACPI_MADT_NMI_SOURCE *nmi);
 static int	madt_probe(void);
 static int	madt_probe_cpus(void);
-static void	madt_probe_cpus_handler(APIC_HEADER *entry, void *arg __unused);
+static void	madt_probe_cpus_handler(ACPI_SUBTABLE_HEADER *entry,
+		    void *arg __unused);
 static int	madt_probe_table(vm_paddr_t address);
 static void	madt_register(void *dummy);
 static int	madt_setup_local(void);
@@ -162,14 +161,14 @@
 	void *table;
 
 	header = madt_map(pa, offset, sizeof(ACPI_TABLE_HEADER));
-	if (strncmp(header->Signature, sig, 4) != 0) {
+	if (strncmp(header->Signature, sig, ACPI_NAME_SIZE) != 0) {
 		madt_unmap(header, sizeof(ACPI_TABLE_HEADER));
 		return (NULL);
 	}
 	length = header->Length;
 	madt_unmap(header, sizeof(ACPI_TABLE_HEADER));
 	table = madt_map(pa, offset, length);
-	if (ACPI_FAILURE(AcpiTbVerifyTableChecksum(table))) {
+	if (ACPI_FAILURE(AcpiTbChecksum(table, length))) {
 		if (bootverbose)
 			printf("MADT: Failed checksum for table %s\n", sig);
 		madt_unmap(table, length);
@@ -193,10 +192,10 @@
 static int
 madt_probe(void)
 {
-	ACPI_POINTER rsdp_ptr;
-	RSDP_DESCRIPTOR *rsdp;
-	RSDT_DESCRIPTOR *rsdt;
-	XSDT_DESCRIPTOR *xsdt;
+	ACPI_PHYSICAL_ADDRESS rsdp_ptr;
+	ACPI_TABLE_RSDP *rsdp;
+	ACPI_TABLE_RSDT *rsdt;
+	ACPI_TABLE_XSDT *xsdt;
 	int i, count;
 
 	if (resource_disabled("acpi", 0))
@@ -204,15 +203,12 @@
 
 	/*
 	 * Map in the RSDP.  Since ACPI uses AcpiOsMapMemory() which in turn
-	 * calls pmap_mapdev() to find the RSDP, we assume that we can use
-	 * pmap_mapdev() to map the RSDP.
+	 * calls pmap_mapbios() to find the RSDP, we assume that we can use
+	 * pmap_mapbios() to map the RSDP.
 	 */
-	if (AcpiOsGetRootPointer(ACPI_LOGICAL_ADDRESSING, &rsdp_ptr) != AE_OK)
+	if ((rsdp_ptr = AcpiOsGetRootPointer()) == 0)
 		return (ENXIO);
-#ifdef __i386__
-	KASSERT(rsdp_ptr.Pointer.Physical < KERNLOAD, ("RSDP too high"));
-#endif
-	rsdp = pmap_mapdev(rsdp_ptr.Pointer.Physical, sizeof(RSDP_DESCRIPTOR));
+	rsdp = pmap_mapbios(rsdp_ptr, sizeof(ACPI_TABLE_RSDP));
 	if (rsdp == NULL) {
 		if (bootverbose)
 			printf("MADT: Failed to map RSDP\n");
@@ -231,38 +227,40 @@
 		 * the version 1.0 portion of the RSDP.  Version 2.0 has
 		 * an additional checksum that we verify first.
 		 */
-		if (AcpiTbChecksum(rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0) {
+		if (AcpiTbChecksum((UINT8 *)rsdp, ACPI_RSDP_XCHECKSUM_LENGTH)) {
 			if (bootverbose)
 				printf("MADT: RSDP failed extended checksum\n");
 			return (ENXIO);
 		}
-		xsdt = madt_map_table(rsdp->XsdtPhysicalAddress, 1, XSDT_SIG);
+		xsdt = madt_map_table(rsdp->XsdtPhysicalAddress, 1,
+		    ACPI_SIG_XSDT);
 		if (xsdt == NULL) {
 			if (bootverbose)
 				printf("MADT: Failed to map XSDT\n");
 			return (ENXIO);
 		}
-		count = (xsdt->Length - sizeof(ACPI_TABLE_HEADER)) /
+		count = (xsdt->Header.Length - sizeof(ACPI_TABLE_HEADER)) /
 		    sizeof(UINT64);
 		for (i = 0; i < count; i++)
 			if (madt_probe_table(xsdt->TableOffsetEntry[i]))
 				break;
 		madt_unmap_table(xsdt);
 	} else {
-		rsdt = madt_map_table(rsdp->RsdtPhysicalAddress, 1, RSDT_SIG);
+		rsdt = madt_map_table(rsdp->RsdtPhysicalAddress, 1,
+		    ACPI_SIG_RSDT);
 		if (rsdt == NULL) {
 			if (bootverbose)
 				printf("MADT: Failed to map RSDT\n");
 			return (ENXIO);
 		}
-		count = (rsdt->Length - sizeof(ACPI_TABLE_HEADER)) /
+		count = (rsdt->Header.Length - sizeof(ACPI_TABLE_HEADER)) /
 		    sizeof(UINT32);
 		for (i = 0; i < count; i++)
 			if (madt_probe_table(rsdt->TableOffsetEntry[i]))
 				break;
 		madt_unmap_table(rsdt);
 	}
-	pmap_unmapdev((vm_offset_t)rsdp, sizeof(RSDP_DESCRIPTOR));
+	pmap_unmapbios((vm_offset_t)rsdp, sizeof(ACPI_TABLE_RSDP));
 	if (madt_physaddr == 0) {
 		if (bootverbose)
 			printf("MADT: No MADT table found\n");
@@ -276,7 +274,7 @@
 	 * Verify that we can map the full table and that its checksum is
 	 * correct, etc.
 	 */
-	madt = madt_map_table(madt_physaddr, 0, APIC_SIG);
+	madt = madt_map_table(madt_physaddr, 0, ACPI_SIG_MADT);
 	if (madt == NULL)
 		return (ENXIO);
 	madt_unmap_table(madt);
@@ -304,7 +302,7 @@
 		printf("Table '%.4s' at 0x%jx\n", table->Signature,
 		    (uintmax_t)address);
 
-	if (strncmp(table->Signature, APIC_SIG, 4) != 0) {
+	if (strncmp(table->Signature, ACPI_SIG_MADT, ACPI_NAME_SIZE) != 0) {
 		madt_unmap(table, sizeof(ACPI_TABLE_HEADER));
 		return (0);
 	}
@@ -321,7 +319,7 @@
 madt_probe_cpus(void)
 {
 
-	madt = madt_map_table(madt_physaddr, 0, APIC_SIG);
+	madt = madt_map_table(madt_physaddr, 0, ACPI_SIG_MADT);
 	KASSERT(madt != NULL, ("Unable to re-map MADT"));
 	madt_walk_table(madt_probe_cpus_handler, NULL);
 	madt_unmap_table(madt);
@@ -336,11 +334,11 @@
 madt_setup_local(void)
 {
 
-	madt = pmap_mapdev(madt_physaddr, madt_length);
-	lapic_init((uintptr_t)madt->LocalApicAddress);
+	madt = pmap_mapbios(madt_physaddr, madt_length);
+	lapic_init(madt->Address);
 	printf("ACPI APIC Table: <%.*s %.*s>\n",
-	    (int)sizeof(madt->OemId), madt->OemId,
-	    (int)sizeof(madt->OemTableId), madt->OemTableId);
+	    (int)sizeof(madt->Header.OemId), madt->Header.OemId,
+	    (int)sizeof(madt->Header.OemTableId), madt->Header.OemTableId);
 
 	/*
 	 * We ignore 64-bit local APIC override entries.  Should we
@@ -379,10 +377,10 @@
 	 * force it to use level trigger and active-low polarity.
 	 */
 	if (!madt_found_sci_override) {
-		if (madt_find_interrupt(AcpiGbl_FADT->SciInt, &ioapic, &pin)
-		    != 0)
-			printf("MADT: Could not find APIC for SCI IRQ %d\n",
-			    AcpiGbl_FADT->SciInt);
+		if (madt_find_interrupt(AcpiGbl_FADT.SciInterrupt, &ioapic,
+		    &pin) != 0)
+			printf("MADT: Could not find APIC for SCI IRQ %u\n",
+			    AcpiGbl_FADT.SciInterrupt);
 		else {
 			printf(
 	"MADT: Forcing active-low polarity and level trigger for SCI\n");
@@ -392,7 +390,7 @@
 	}
 
 	/* Third, we register all the I/O APIC's. */
-	for (i = 0; i < NIOAPICS; i++)
+	for (i = 0; i <= MAX_APIC_ID; i++)
 		if (ioapics[i].io_apic != NULL)
 			ioapic_register(ioapics[i].io_apic);
 
@@ -408,7 +406,7 @@
 
 	apic_register_enumerator(&madt_enumerator);
 }
-SYSINIT(madt_register, SI_SUB_CPU - 1, SI_ORDER_FIRST, madt_register, NULL)
+SYSINIT(madt_register, SI_SUB_CPU - 1, SI_ORDER_SECOND, madt_register, NULL)
 
 /*
  * Call the handler routine for each entry in the MADT table.
@@ -416,46 +414,46 @@
 static void
 madt_walk_table(madt_entry_handler *handler, void *arg)
 {
-	APIC_HEADER *entry;
+	ACPI_SUBTABLE_HEADER *entry;
 	u_char *p, *end;
 
-	end = (u_char *)(madt) + madt->Length;
+	end = (u_char *)(madt) + madt->Header.Length;
 	for (p = (u_char *)(madt + 1); p < end; ) {
-		entry = (APIC_HEADER *)p;
+		entry = (ACPI_SUBTABLE_HEADER *)p;
 		handler(entry, arg);
 		p += entry->Length;
 	}
 }
 
 static void
-madt_probe_cpus_handler(APIC_HEADER *entry, void *arg)
+madt_probe_cpus_handler(ACPI_SUBTABLE_HEADER *entry, void *arg)
 {
-	MADT_PROCESSOR_APIC *proc;
+	ACPI_MADT_LOCAL_APIC *proc;
 	struct lapic_info *la;
 
 	switch (entry->Type) {
-	case APIC_PROCESSOR:
+	case ACPI_MADT_TYPE_LOCAL_APIC:
 		/*
 		 * The MADT does not include a BSP flag, so we have to
 		 * let the MP code figure out which CPU is the BSP on
 		 * its own.
 		 */
-		proc = (MADT_PROCESSOR_APIC *)entry;
+		proc = (ACPI_MADT_LOCAL_APIC *)entry;
 		if (bootverbose)
-			printf("MADT: Found CPU APIC ID %d ACPI ID %d: %s\n",
-			    proc->LocalApicId, proc->ProcessorId,
-			    proc->ProcessorEnabled ? "enabled" : "disabled");
-		if (!proc->ProcessorEnabled)
+			printf("MADT: Found CPU APIC ID %u ACPI ID %u: %s\n",
+			    proc->Id, proc->ProcessorId,
+			    (proc->LapicFlags & ACPI_MADT_ENABLED) ?
+			    "enabled" : "disabled");
+		if (!(proc->LapicFlags & ACPI_MADT_ENABLED))
 			break;
-		if (proc->LocalApicId >= NLAPICS)
-			panic("%s: CPU ID %d too high", __func__,
-			    proc->LocalApicId);
-		la = &lapics[proc->LocalApicId];
+		if (proc->Id > MAX_APIC_ID)
+			panic("%s: CPU ID %u too high", __func__, proc->Id);
+		la = &lapics[proc->Id];
 		KASSERT(la->la_enabled == 0,
-		    ("Duplicate local APIC ID %d", proc->LocalApicId));
+		    ("Duplicate local APIC ID %u", proc->Id));
 		la->la_enabled = 1;
 		la->la_acpi_id = proc->ProcessorId;
-		lapic_create(proc->LocalApicId, 0);
+		lapic_create(proc->Id, 0);
 		break;
 	}
 }
@@ -465,27 +463,26 @@
  * Add an I/O APIC from an entry in the table.
  */
 static void
-madt_parse_apics(APIC_HEADER *entry, void *arg __unused)
+madt_parse_apics(ACPI_SUBTABLE_HEADER *entry, void *arg __unused)
 {
-	MADT_IO_APIC *apic;
+	ACPI_MADT_IO_APIC *apic;
 
 	switch (entry->Type) {
-	case APIC_IO:
-		apic = (MADT_IO_APIC *)entry;
+	case ACPI_MADT_TYPE_IO_APIC:
+		apic = (ACPI_MADT_IO_APIC *)entry;
 		if (bootverbose)
-			printf("MADT: Found IO APIC ID %d, Interrupt %d at %p\n",
-			    apic->IoApicId, apic->Interrupt,
+			printf(
+			    "MADT: Found IO APIC ID %u, Interrupt %u at %p\n",
+			    apic->Id, apic->GlobalIrqBase,
 			    (void *)(uintptr_t)apic->Address);
-		if (apic->IoApicId >= NIOAPICS)
-			panic("%s: I/O APIC ID %d too high", __func__,
-			    apic->IoApicId);
-		if (ioapics[apic->IoApicId].io_apic != NULL)
-			panic("%s: Double APIC ID %d", __func__,
-			    apic->IoApicId);
-		ioapics[apic->IoApicId].io_apic = ioapic_create(
-			(uintptr_t)apic->Address, apic->IoApicId,
-			    apic->Interrupt);
-		ioapics[apic->IoApicId].io_vector = apic->Interrupt;
+		if (apic->Id > MAX_APIC_ID)
+			panic("%s: I/O APIC ID %u too high", __func__,
+			    apic->Id);
+		if (ioapics[apic->Id].io_apic != NULL)
+			panic("%s: Double APIC ID %u", __func__, apic->Id);
+		ioapics[apic->Id].io_apic = ioapic_create(apic->Address,
+		    apic->Id, apic->GlobalIrqBase);
+		ioapics[apic->Id].io_vector = apic->GlobalIrqBase;
 		break;
 	default:
 		break;
@@ -499,18 +496,18 @@
  * SCI for which we use Active Lo, Level Triggered.
  */
 static enum intr_polarity
-interrupt_polarity(UINT16 Polarity, UINT8 Source)
+interrupt_polarity(UINT16 IntiFlags, UINT8 Source)
 {
 
-	switch (Polarity) {
-	case POLARITY_CONFORMS:
-		if (Source == AcpiGbl_FADT->SciInt)
+	switch (IntiFlags & ACPI_MADT_POLARITY_MASK) {
+	case ACPI_MADT_POLARITY_CONFORMS:
+		if (Source == AcpiGbl_FADT.SciInterrupt)
 			return (INTR_POLARITY_LOW);
 		else
 			return (INTR_POLARITY_HIGH);
-	case POLARITY_ACTIVE_HIGH:
+	case ACPI_MADT_POLARITY_ACTIVE_HIGH:
 		return (INTR_POLARITY_HIGH);
-	case POLARITY_ACTIVE_LOW:
+	case ACPI_MADT_POLARITY_ACTIVE_LOW:
 		return (INTR_POLARITY_LOW);
 	default:
 		panic("Bogus Interrupt Polarity");
@@ -518,18 +515,18 @@
 }
 
 static enum intr_trigger
-interrupt_trigger(UINT16 TriggerMode, UINT8 Source)
+interrupt_trigger(UINT16 IntiFlags, UINT8 Source)
 {
 
-	switch (TriggerMode) {
-	case TRIGGER_CONFORMS:
-		if (Source == AcpiGbl_FADT->SciInt)
+	switch (IntiFlags & ACPI_MADT_TRIGGER_MASK) {
+	case ACPI_MADT_TRIGGER_CONFORMS:
+		if (Source == AcpiGbl_FADT.SciInterrupt)
 			return (INTR_TRIGGER_LEVEL);
 		else
 			return (INTR_TRIGGER_EDGE);
-	case TRIGGER_EDGE:
+	case ACPI_MADT_TRIGGER_EDGE:
 		return (INTR_TRIGGER_EDGE);
-	case TRIGGER_LEVEL:
+	case ACPI_MADT_TRIGGER_LEVEL:
 		return (INTR_TRIGGER_LEVEL);
 	default:
 		panic("Bogus Interrupt Trigger Mode");
@@ -544,7 +541,7 @@
 {
 	int i;
 
-	for (i = 0; i < NLAPICS; i++) {
+	for (i = 0; i <= MAX_APIC_ID; i++) {
 		if (!lapics[i].la_enabled)
 			continue;
 		if (lapics[i].la_acpi_id != acpi_id)
@@ -565,7 +562,7 @@
 	int i, best;
 
 	best = -1;
-	for (i = 0; i < NIOAPICS; i++) {
+	for (i = 0; i <= MAX_APIC_ID; i++) {
 		if (ioapics[i].io_apic == NULL ||
 		    ioapics[i].io_vector > intr)
 			continue;
@@ -587,7 +584,7 @@
  * Parse an interrupt source override for an ISA interrupt.
  */
 static void
-madt_parse_interrupt_override(MADT_INTERRUPT_OVERRIDE *intr)
+madt_parse_interrupt_override(ACPI_MADT_INTERRUPT_OVERRIDE *intr)
 {
 	void *new_ioapic, *old_ioapic;
 	u_int new_pin, old_pin;
@@ -595,20 +592,19 @@
 	enum intr_polarity pol;
 	char buf[64];
 
-	if (acpi_quirks & ACPI_Q_MADT_IRQ0 && intr->Source == 0 &&
-	    intr->Interrupt == 2) {
+	if (acpi_quirks & ACPI_Q_MADT_IRQ0 && intr->SourceIrq == 0 &&
+	    intr->GlobalIrq == 2) {
 		if (bootverbose)
 			printf("MADT: Skipping timer override\n");
 		return;
 	}
 	if (bootverbose)
 		printf("MADT: Interrupt override: source %u, irq %u\n",
-		    intr->Source, intr->Interrupt);
+		    intr->SourceIrq, intr->GlobalIrq);
 	KASSERT(intr->Bus == 0, ("bus for interrupt overrides must be zero"));
-	if (madt_find_interrupt(intr->Interrupt, &new_ioapic,
-	    &new_pin) != 0) {
-		printf("MADT: Could not find APIC for vector %d (IRQ %d)\n",
-		    intr->Interrupt, intr->Source);
+	if (madt_find_interrupt(intr->GlobalIrq, &new_ioapic, &new_pin) != 0) {
+		printf("MADT: Could not find APIC for vector %u (IRQ %u)\n",
+		    intr->GlobalIrq, intr->SourceIrq);
 		return;
 	}
 
@@ -616,15 +612,15 @@
 	 * Lookup the appropriate trigger and polarity modes for this
 	 * entry.
 	 */
-	trig = interrupt_trigger(intr->TriggerMode, intr->Source);
-	pol = interrupt_polarity(intr->Polarity, intr->Source);
+	trig = interrupt_trigger(intr->IntiFlags, intr->SourceIrq);
+	pol = interrupt_polarity(intr->IntiFlags, intr->SourceIrq);
 	
 	/*
 	 * If the SCI is identity mapped but has edge trigger and
 	 * active-hi polarity or the force_sci_lo tunable is set,
 	 * force it to use level/lo.
 	 */
-	if (intr->Source == AcpiGbl_FADT->SciInt) {
+	if (intr->SourceIrq == AcpiGbl_FADT.SciInterrupt) {
 		madt_found_sci_override = 1;
 		if (getenv_string("hw.acpi.sci.trigger", buf, sizeof(buf))) {
 			if (tolower(buf[0]) == 'e')
@@ -653,23 +649,24 @@
 	}
 
 	/* Remap the IRQ if it is mapped to a different interrupt vector. */
-	if (intr->Source != intr->Interrupt) {
+	if (intr->SourceIrq != intr->GlobalIrq) {
 		/*
 		 * If the SCI is remapped to a non-ISA global interrupt,
 		 * then override the vector we use to setup and allocate
 		 * the interrupt.
 		 */
-		if (intr->Interrupt > 15 &&
-		    intr->Source == AcpiGbl_FADT->SciInt)
-			acpi_OverrideInterruptLevel(intr->Interrupt);
+		if (intr->GlobalIrq > 15 &&
+		    intr->SourceIrq == AcpiGbl_FADT.SciInterrupt)
+			acpi_OverrideInterruptLevel(intr->GlobalIrq);
 		else
-			ioapic_remap_vector(new_ioapic, new_pin, intr->Source);
-		if (madt_find_interrupt(intr->Source, &old_ioapic,
+			ioapic_remap_vector(new_ioapic, new_pin,
+			    intr->SourceIrq);
+		if (madt_find_interrupt(intr->SourceIrq, &old_ioapic,
 		    &old_pin) != 0)
-			printf("MADT: Could not find APIC for source IRQ %d\n",
-			    intr->Source);
+			printf("MADT: Could not find APIC for source IRQ %u\n",
+			    intr->SourceIrq);
 		else if (ioapic_get_vector(old_ioapic, old_pin) ==
-		    intr->Source)
+		    intr->SourceIrq)
 			ioapic_disable_pin(old_ioapic, old_pin);
 	}
 
@@ -682,31 +679,31 @@
  * Parse an entry for an NMI routed to an IO APIC.
  */
 static void
-madt_parse_nmi(MADT_NMI_SOURCE *nmi)
+madt_parse_nmi(ACPI_MADT_NMI_SOURCE *nmi)
 {
 	void *ioapic;
 	u_int pin;
 
-	if (madt_find_interrupt(nmi->Interrupt, &ioapic, &pin) != 0) {
-		printf("MADT: Could not find APIC for vector %d\n",
-		    nmi->Interrupt);
+	if (madt_find_interrupt(nmi->GlobalIrq, &ioapic, &pin) != 0) {
+		printf("MADT: Could not find APIC for vector %u\n",
+		    nmi->GlobalIrq);
 		return;
 	}
 
 	ioapic_set_nmi(ioapic, pin);
-	if (nmi->TriggerMode != TRIGGER_CONFORMS)
+	if (!(nmi->IntiFlags & ACPI_MADT_TRIGGER_CONFORMS))
 		ioapic_set_triggermode(ioapic, pin,
-		    interrupt_trigger(nmi->TriggerMode, 0));
-	if (nmi->Polarity != TRIGGER_CONFORMS)
+		    interrupt_trigger(nmi->IntiFlags, 0));
+	if (!(nmi->IntiFlags & ACPI_MADT_TRIGGER_CONFORMS))
 		ioapic_set_polarity(ioapic, pin,
-		    interrupt_polarity(nmi->Polarity, 0));
+		    interrupt_polarity(nmi->IntiFlags, 0));
 }
 
 /*
  * Parse an entry for an NMI routed to a local APIC LVT pin.
  */
 static void
-madt_parse_local_nmi(MADT_LOCAL_APIC_NMI *nmi)
+madt_parse_local_nmi(ACPI_MADT_LOCAL_APIC_NMI *nmi)
 {
 	u_int apic_id, pin;
 
@@ -714,8 +711,8 @@
 		apic_id = APIC_ID_ALL;
 	else if (madt_find_cpu(nmi->ProcessorId, &apic_id) != 0) {
 		if (bootverbose)
-			printf("MADT: Ignoring local NMI routed to ACPI CPU %u\n",
-			    nmi->ProcessorId);
+			printf("MADT: Ignoring local NMI routed to "
+			    "ACPI CPU %u\n", nmi->ProcessorId);
 		return;
 	}
 	if (nmi->Lint == 0)
@@ -723,31 +720,31 @@
 	else
 		pin = LVT_LINT1;
 	lapic_set_lvt_mode(apic_id, pin, APIC_LVT_DM_NMI);
-	if (nmi->TriggerMode != TRIGGER_CONFORMS)
+	if (!(nmi->IntiFlags & ACPI_MADT_TRIGGER_CONFORMS))
 		lapic_set_lvt_triggermode(apic_id, pin,
-		    interrupt_trigger(nmi->TriggerMode, 0));
-	if (nmi->Polarity != POLARITY_CONFORMS)
+		    interrupt_trigger(nmi->IntiFlags, 0));
+	if (!(nmi->IntiFlags & ACPI_MADT_POLARITY_CONFORMS))
 		lapic_set_lvt_polarity(apic_id, pin,
-		    interrupt_polarity(nmi->Polarity, 0));
+		    interrupt_polarity(nmi->IntiFlags, 0));
 }
 
 /*
  * Parse interrupt entries.
  */
 static void
-madt_parse_ints(APIC_HEADER *entry, void *arg __unused)
+madt_parse_ints(ACPI_SUBTABLE_HEADER *entry, void *arg __unused)
 {
 
 	switch (entry->Type) {
-	case APIC_XRUPT_OVERRIDE:
+	case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE:
 		madt_parse_interrupt_override(
-			(MADT_INTERRUPT_OVERRIDE *)entry);
+			(ACPI_MADT_INTERRUPT_OVERRIDE *)entry);
 		break;
-	case APIC_NMI:
-		madt_parse_nmi((MADT_NMI_SOURCE *)entry);
+	case ACPI_MADT_TYPE_NMI_SOURCE:
+		madt_parse_nmi((ACPI_MADT_NMI_SOURCE *)entry);
 		break;
-	case APIC_LOCAL_NMI:
-		madt_parse_local_nmi((MADT_LOCAL_APIC_NMI *)entry);
+	case ACPI_MADT_TYPE_LOCAL_APIC_NMI:
+		madt_parse_local_nmi((ACPI_MADT_LOCAL_APIC_NMI *)entry);
 		break;
 	}
 }
@@ -768,7 +765,7 @@
 		if (CPU_ABSENT(i))
 			continue;
 		pc = pcpu_find(i);
-		KASSERT(pc != NULL, ("no pcpu data for CPU %d", i));
+		KASSERT(pc != NULL, ("no pcpu data for CPU %u", i));
 		la = &lapics[pc->pc_apic_id];
 		if (!la->la_enabled)
 			panic("APIC: CPU with APIC ID %u is not enabled",
Index: acpi_wakeup.c
===================================================================
RCS file: /home/cvs/src/sys/i386/acpica/acpi_wakeup.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/i386/acpica/acpi_wakeup.c -L sys/i386/acpica/acpi_wakeup.c -u -r1.2 -r1.3
--- sys/i386/acpica/acpi_wakeup.c
+++ sys/i386/acpica/acpi_wakeup.c
@@ -26,8 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/acpica/acpi_wakeup.c,v 1.39.2.4 2006/08/16 04:01:49 njl Exp $");
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: src/sys/i386/acpica/acpi_wakeup.c,v 1.46 2007/03/14 22:30:02 njl Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -193,11 +192,9 @@
 {
 	ACPI_STATUS		status;
 	struct pmap		*pm;
-	vm_page_t		page;
 	int			ret;
 	uint32_t		cr3;
 	u_long			ef;
-	struct proc		*p;
 
 	ret = 0;
 	if (sc->acpi_wakeaddr == 0)
@@ -207,10 +204,12 @@
 
 	ef = read_eflags();
 
-	/* Create Identity Mapping */
-	if ((p = curproc) == NULL)
-		p = &proc0;
-	pm = vmspace_pmap(p->p_vmspace);
+	/*
+	 * Temporarily switch to the kernel pmap because it provides an
+	 * identity mapping (setup at boot) for the low physical memory
+	 * region containing the wakeup code.
+	 */
+	pm = kernel_pmap;
 	cr3 = rcr3();
 #ifdef PAE
 	load_cr3(vtophys(pm->pm_pdpt));
@@ -218,10 +217,6 @@
 	load_cr3(vtophys(pm->pm_pdir));
 #endif
 
-	page = PHYS_TO_VM_PAGE(sc->acpi_wakephys);
-	pmap_enter(pm, sc->acpi_wakephys, page,
-		   VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE, 1);
-
 	ret_addr = 0;
 	ACPI_DISABLE_IRQS();
 	if (acpi_savecpu()) {
@@ -284,7 +279,6 @@
 	}
 
 out:
-	pmap_remove(pm, sc->acpi_wakephys, sc->acpi_wakephys + PAGE_SIZE);
 	load_cr3(cr3);
 	write_eflags(ef);
 
Index: acpi_wakecode.S
===================================================================
RCS file: /home/cvs/src/sys/i386/acpica/acpi_wakecode.S,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/i386/acpica/acpi_wakecode.S -L sys/i386/acpica/acpi_wakecode.S -u -r1.2 -r1.3
--- sys/i386/acpica/acpi_wakecode.S
+++ sys/i386/acpica/acpi_wakecode.S
@@ -24,8 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/i386/acpica/acpi_wakecode.S,v 1.10.2.1 2006/08/16 04:01:49 njl Exp $
- * $MidnightBSD$
+ * $FreeBSD: src/sys/i386/acpica/acpi_wakecode.S,v 1.13 2006/06/10 08:20:03 njl Exp $
  */
 
 #define LOCORE
Index: OsdEnvironment.c
===================================================================
RCS file: /home/cvs/src/sys/i386/acpica/OsdEnvironment.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/i386/acpica/OsdEnvironment.c -L sys/i386/acpica/OsdEnvironment.c -u -r1.2 -r1.3
--- sys/i386/acpica/OsdEnvironment.c
+++ sys/i386/acpica/OsdEnvironment.c
@@ -26,17 +26,18 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/acpica/OsdEnvironment.c,v 1.10.8.1 2005/11/07 09:53:24 obrien Exp $");
-__MBSDID("$MidnightBSD");
+__FBSDID("$FreeBSD: src/sys/i386/acpica/OsdEnvironment.c,v 1.12 2007/03/22 18:16:41 jkim Exp $");
 
 /*
  * 6.1 : Environmental support
  */
 #include <sys/types.h>
+#include <sys/bus.h>
 #include <sys/linker_set.h>
 #include <sys/sysctl.h>
 
 #include <contrib/dev/acpica/acpi.h>
+#include <contrib/dev/acpica/actables.h>
 
 static u_long i386_acpi_root;
 
@@ -55,25 +56,16 @@
 	return(0);
 }
 
-ACPI_STATUS
-AcpiOsGetRootPointer(UINT32 Flags, ACPI_POINTER *RsdpPhysicalAddress)
+ACPI_PHYSICAL_ADDRESS
+AcpiOsGetRootPointer(void)
 {
-	ACPI_POINTER ptr;
-	ACPI_STATUS status;
+	u_long	ptr;
+
+	if (i386_acpi_root == 0 &&
+	    (resource_long_value("acpi", 0, "rsdp", (long *)&ptr) == 0 ||
+	    AcpiFindRootPointer((ACPI_NATIVE_UINT *)&ptr) == AE_OK) &&
+	    ptr != 0)
+		i386_acpi_root = ptr;
 
-	if (i386_acpi_root == 0) {
-		/*
-		 * The loader passes the physical address at which it found the
-		 * RSDP in a hint.  We could recover this rather than searching
-		 * manually here.
-		 */
-		status = AcpiFindRootPointer(Flags, &ptr);
-		if (status == AE_OK)
-			i386_acpi_root = ptr.Pointer.Physical;
-	} else
-		status = AE_OK;
-
-	RsdpPhysicalAddress->PointerType = ACPI_PHYSICAL_POINTER;
-	RsdpPhysicalAddress->Pointer.Physical = i386_acpi_root;
-	return (status);
+	return (i386_acpi_root);
 }
Index: genwakecode.sh
===================================================================
RCS file: /home/cvs/src/sys/i386/acpica/genwakecode.sh,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/i386/acpica/genwakecode.sh -L sys/i386/acpica/genwakecode.sh -u -r1.2 -r1.3
--- sys/i386/acpica/genwakecode.sh
+++ sys/i386/acpica/genwakecode.sh
@@ -1,6 +1,5 @@
 #!/bin/sh
 # $FreeBSD: src/sys/i386/acpica/genwakecode.sh,v 1.3 2004/12/12 06:59:14 njl Exp $
-# $MidnightBSD$
 #
 file2c 'static char wakecode[] = {' '};' <acpi_wakecode.bin
 
Index: acpi_machdep.c
===================================================================
RCS file: /home/cvs/src/sys/i386/acpica/acpi_machdep.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/i386/acpica/acpi_machdep.c -L sys/i386/acpica/acpi_machdep.c -u -r1.2 -r1.3
--- sys/i386/acpica/acpi_machdep.c
+++ sys/i386/acpica/acpi_machdep.c
@@ -25,14 +25,16 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/acpica/acpi_machdep.c,v 1.28.2.2 2005/11/07 09:53:24 obrien Exp $");
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: src/sys/i386/acpica/acpi_machdep.c,v 1.37 2007/07/07 17:54:33 njl Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
+#include <sys/condvar.h>
 #include <sys/conf.h>
 #include <sys/fcntl.h>
 #include <sys/kernel.h>
+#include <sys/malloc.h>
+#include <sys/poll.h>
 #include <sys/sysctl.h>
 #include <sys/uio.h>
 #include <vm/vm.h>
@@ -46,8 +48,6 @@
  * APM driver emulation 
  */
 
-#include <sys/selinfo.h>
-
 #include <machine/apm_bios.h>
 #include <machine/pc/bios.h>
 
@@ -57,28 +57,38 @@
 
 uint32_t acpi_resume_beep;
 TUNABLE_INT("debug.acpi.resume_beep", &acpi_resume_beep);
-SYSCTL_UINT(_debug_acpi, OID_AUTO, resume_beep, CTLFLAG_RW,
-&acpi_resume_beep, 0, "Beep the PC speaker when resuming");
+SYSCTL_UINT(_debug_acpi, OID_AUTO, resume_beep, CTLFLAG_RW, &acpi_resume_beep,
+    0, "Beep the PC speaker when resuming");
 uint32_t acpi_reset_video;
 TUNABLE_INT("hw.acpi.reset_video", &acpi_reset_video);
 
 static int intr_model = ACPI_INTR_PIC;
 static int apm_active;
+static struct clonedevs *apm_clones;
+
+MALLOC_DEFINE(M_APMDEV, "apmdev", "APM device emulation");
 
-static d_open_t apmopen;
-static d_close_t apmclose;
-static d_write_t apmwrite;
-static d_ioctl_t apmioctl;
-static d_poll_t apmpoll;
+static d_open_t		apmopen;
+static d_close_t	apmclose;
+static d_write_t	apmwrite;
+static d_ioctl_t	apmioctl;
+static d_poll_t		apmpoll;
+static d_kqfilter_t	apmkqfilter;
+static void		apmreadfiltdetach(struct knote *kn);
+static int		apmreadfilt(struct knote *kn, long hint);
+static struct filterops	apm_readfiltops =
+	{ 1, NULL, apmreadfiltdetach, apmreadfilt };
 
 static struct cdevsw apm_cdevsw = {
 	.d_version =	D_VERSION,
+	.d_flags =	D_TRACKCLOSE,
 	.d_open =	apmopen,
 	.d_close =	apmclose,
 	.d_write =	apmwrite,
 	.d_ioctl =	apmioctl,
 	.d_poll =	apmpoll,
 	.d_name =	"apm",
+	.d_kqfilter =	apmkqfilter
 };
 
 static int
@@ -202,44 +212,169 @@
 	return (0);
 }
 
+/* Create single-use devices for /dev/apm and /dev/apmctl. */
+static void
+apm_clone(void *arg, struct ucred *cred, char *name, int namelen,
+    struct cdev **dev)
+{
+	int ctl_dev, unit;
+
+	if (*dev != NULL)
+		return;
+	if (strcmp(name, "apmctl") == 0)
+		ctl_dev = TRUE;
+	else if (strcmp(name, "apm") == 0)
+		ctl_dev = FALSE;
+	else
+		return;
+
+	/* Always create a new device and unit number. */
+	unit = -1;
+	if (clone_create(&apm_clones, &apm_cdevsw, &unit, dev, 0)) {
+		if (ctl_dev) {
+			*dev = make_dev(&apm_cdevsw, unit2minor(unit),
+			    UID_ROOT, GID_OPERATOR, 0660, "apmctl%d", unit);
+		} else {
+			*dev = make_dev(&apm_cdevsw, unit2minor(unit),
+			    UID_ROOT, GID_OPERATOR, 0664, "apm%d", unit);
+		}
+		if (*dev != NULL) {
+			dev_ref(*dev);
+			(*dev)->si_flags |= SI_CHEAPCLONE;
+		}
+	}
+}
+
+/* Create a struct for tracking per-device suspend notification. */
+static struct apm_clone_data *
+apm_create_clone(struct cdev *dev, struct acpi_softc *acpi_sc)
+{
+	struct apm_clone_data *clone;
+
+	clone = malloc(sizeof(*clone), M_APMDEV, M_WAITOK);
+	clone->cdev = dev;
+	clone->acpi_sc = acpi_sc;
+	clone->notify_status = APM_EV_NONE;
+	bzero(&clone->sel_read, sizeof(clone->sel_read));
+	knlist_init(&clone->sel_read.si_note, &acpi_mutex, NULL, NULL, NULL);
+
+	/*
+	 * The acpi device is always managed by devd(8) and is considered
+	 * writable (i.e., ack is required to allow suspend to proceed.)
+	 */
+	if (strcmp("acpi", devtoname(dev)) == 0)
+		clone->flags = ACPI_EVF_DEVD | ACPI_EVF_WRITE;
+	else
+		clone->flags = ACPI_EVF_NONE;
+
+	ACPI_LOCK(acpi);
+	STAILQ_INSERT_TAIL(&acpi_sc->apm_cdevs, clone, entries);
+	ACPI_UNLOCK(acpi);
+	return (clone);
+}
+
 static int
 apmopen(struct cdev *dev, int flag, int fmt, d_thread_t *td)
 {
+	struct	acpi_softc *acpi_sc;
+	struct 	apm_clone_data *clone;
+
+	acpi_sc = devclass_get_softc(devclass_find("acpi"), 0);
+	clone = apm_create_clone(dev, acpi_sc);
+	dev->si_drv1 = clone;
+
+	/* If the device is opened for write, record that. */
+	if ((flag & FWRITE) != 0)
+		clone->flags |= ACPI_EVF_WRITE;
+
 	return (0);
 }
 
 static int
 apmclose(struct cdev *dev, int flag, int fmt, d_thread_t *td)
 {
+	struct	apm_clone_data *clone;
+	struct	acpi_softc *acpi_sc;
+
+	clone = dev->si_drv1;
+	acpi_sc = clone->acpi_sc;
+
+	/* We are about to lose a reference so check if suspend should occur */
+	if (acpi_sc->acpi_next_sstate != 0 &&
+	    clone->notify_status != APM_EV_ACKED)
+		acpi_AckSleepState(clone, 0);
+
+	/* Remove this clone's data from the list and free it. */
+	ACPI_LOCK(acpi);
+	STAILQ_REMOVE(&acpi_sc->apm_cdevs, clone, apm_clone_data, entries);
+	knlist_destroy(&clone->sel_read.si_note);
+	ACPI_UNLOCK(acpi);
+	free(clone, M_APMDEV);
+	destroy_dev_sched(dev);
 	return (0);
 }
 
 static int
 apmioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, d_thread_t *td)
 {
-	int	error = 0;
+	int	error;
+	struct	apm_clone_data *clone;
 	struct	acpi_softc *acpi_sc;
-	struct apm_info info;
+	struct	apm_info info;
+	struct 	apm_event_info *ev_info;
 	apm_info_old_t aiop;
 
-	acpi_sc = devclass_get_softc(devclass_find("acpi"), 0);
+	error = 0;
+	clone = dev->si_drv1;
+	acpi_sc = clone->acpi_sc;
 
 	switch (cmd) {
 	case APMIO_SUSPEND:
 		if ((flag & FWRITE) == 0)
 			return (EPERM);
-		if (apm_active)
-			acpi_SetSleepState(acpi_sc, acpi_sc->acpi_suspend_sx);
-		else
-			error = EINVAL;
+		if (acpi_sc->acpi_next_sstate == 0) {
+			if (acpi_sc->acpi_suspend_sx != ACPI_STATE_S5) {
+				error = acpi_ReqSleepState(acpi_sc,
+				    acpi_sc->acpi_suspend_sx);
+			} else {
+				printf(
+			"power off via apm suspend not supported\n");
+				error = ENXIO;
+			}
+		} else
+			error = acpi_AckSleepState(clone, 0);
 		break;
 	case APMIO_STANDBY:
 		if ((flag & FWRITE) == 0)
 			return (EPERM);
-		if (apm_active)
-			acpi_SetSleepState(acpi_sc, acpi_sc->acpi_standby_sx);
-		else
-			error = EINVAL;
+		if (acpi_sc->acpi_next_sstate == 0) {
+			if (acpi_sc->acpi_standby_sx != ACPI_STATE_S5) {
+				error = acpi_ReqSleepState(acpi_sc,
+				    acpi_sc->acpi_standby_sx);
+			} else {
+				printf(
+			"power off via apm standby not supported\n");
+				error = ENXIO;
+			}
+		} else
+			error = acpi_AckSleepState(clone, 0);
+		break;
+	case APMIO_NEXTEVENT:
+		printf("apm nextevent start\n");
+		ACPI_LOCK(acpi);
+		if (acpi_sc->acpi_next_sstate != 0 && clone->notify_status ==
+		    APM_EV_NONE) {
+			ev_info = (struct apm_event_info *)addr;
+			if (acpi_sc->acpi_next_sstate <= ACPI_STATE_S3)
+				ev_info->type = PMEV_STANDBYREQ;
+			else
+				ev_info->type = PMEV_SUSPENDREQ;
+			ev_info->index = 0;
+			clone->notify_status = APM_EV_NOTIFIED;
+			printf("apm event returning %d\n", ev_info->type);
+		} else
+			error = EAGAIN;
+		ACPI_UNLOCK(acpi);
 		break;
 	case APMIO_GETINFO_OLD:
 		if (acpi_capm_get_info(&info))
@@ -300,33 +435,80 @@
 static int
 apmpoll(struct cdev *dev, int events, d_thread_t *td)
 {
+	struct	apm_clone_data *clone;
+	int revents;
+
+	revents = 0;
+	ACPI_LOCK(acpi);
+	clone = dev->si_drv1;
+	if (clone->acpi_sc->acpi_next_sstate)
+		revents |= events & (POLLIN | POLLRDNORM);
+	else
+		selrecord(td, &clone->sel_read);
+	ACPI_UNLOCK(acpi);
+	return (revents);
+}
+
+static int
+apmkqfilter(struct cdev *dev, struct knote *kn)
+{
+	struct	apm_clone_data *clone;
+
+	ACPI_LOCK(acpi);
+	clone = dev->si_drv1;
+	kn->kn_hook = clone;
+	kn->kn_fop = &apm_readfiltops;
+	knlist_add(&clone->sel_read.si_note, kn, 0);
+	ACPI_UNLOCK(acpi);
 	return (0);
 }
 
 static void
-acpi_capm_init(struct acpi_softc *sc)
+apmreadfiltdetach(struct knote *kn)
+{
+	struct	apm_clone_data *clone;
+
+	ACPI_LOCK(acpi);
+	clone = kn->kn_hook;
+	knlist_remove(&clone->sel_read.si_note, kn, 0);
+	ACPI_UNLOCK(acpi);
+}
+
+static int
+apmreadfilt(struct knote *kn, long hint)
 {
-        make_dev(&apm_cdevsw, 0, 0, 5, 0664, "apm");
+	struct	apm_clone_data *clone;
+	int	sleeping;
+
+	ACPI_LOCK(acpi);
+	clone = kn->kn_hook;
+	sleeping = clone->acpi_sc->acpi_next_sstate ? 1 : 0;
+	ACPI_UNLOCK(acpi);
+	return (sleeping);
 }
 
 int
 acpi_machdep_init(device_t dev)
 {
-	struct	acpi_softc *sc;
+	struct	acpi_softc *acpi_sc;
 
-	sc = devclass_get_softc(devclass_find("acpi"), 0);
-	acpi_capm_init(sc);
+	acpi_sc = devclass_get_softc(devclass_find("acpi"), 0);
 
-	acpi_install_wakeup_handler(sc);
+	/* Create a clone for /dev/acpi also. */
+	STAILQ_INIT(&acpi_sc->apm_cdevs);
+	acpi_sc->acpi_clone = apm_create_clone(acpi_sc->acpi_dev_t, acpi_sc);
+	clone_setup(&apm_clones);
+	EVENTHANDLER_REGISTER(dev_clone, apm_clone, 0, 1000);
+	acpi_install_wakeup_handler(acpi_sc);
 
 	if (intr_model == ACPI_INTR_PIC)
-		BUS_CONFIG_INTR(dev, AcpiGbl_FADT->SciInt, INTR_TRIGGER_LEVEL,
-		    INTR_POLARITY_LOW);
+		BUS_CONFIG_INTR(dev, AcpiGbl_FADT.SciInterrupt,
+		    INTR_TRIGGER_LEVEL, INTR_POLARITY_LOW);
 	else
 		acpi_SetIntrModel(intr_model);
 
-	SYSCTL_ADD_UINT(&sc->acpi_sysctl_ctx,
-	    SYSCTL_CHILDREN(sc->acpi_sysctl_tree), OID_AUTO,
+	SYSCTL_ADD_UINT(&acpi_sc->acpi_sysctl_ctx,
+	    SYSCTL_CHILDREN(acpi_sc->acpi_sysctl_tree), OID_AUTO,
 	    "reset_video", CTLFLAG_RW, &acpi_reset_video, 0,
 	    "Call the VESA reset BIOS vector on the resume path");
 
@@ -348,9 +530,9 @@
 	int year;
 
 	/* BIOS address 0xffff5 contains the date in the format mm/dd/yy. */
-	va = pmap_mapdev(0xffff0, 16);
+	va = pmap_mapbios(0xffff0, 16);
 	sscanf(va + 11, "%2d", &year);
-	pmap_unmapdev((vm_offset_t)va, 16);
+	pmap_unmapbios((vm_offset_t)va, 16);
 
 	/* 
 	 * Date must be >= 1/1/1999 or we don't trust ACPI.  Note that this
Index: Makefile
===================================================================
RCS file: /home/cvs/src/sys/i386/acpica/Makefile,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/i386/acpica/Makefile -L sys/i386/acpica/Makefile -u -r1.2 -r1.3
--- sys/i386/acpica/Makefile
+++ sys/i386/acpica/Makefile
@@ -1,5 +1,4 @@
-# $MidnightBSD$
-# $FreeBSD: src/sys/i386/acpica/Makefile,v 1.6 2004/04/13 13:43:11 des Exp $
+# $FreeBSD: src/sys/i386/acpica/Makefile,v 1.8 2006/10/19 05:55:09 ru Exp $
 
 # Correct path for kernel builds
 # Don't rely on the kernel's .depend file
Index: apm.c
===================================================================
RCS file: /home/cvs/src/sys/i386/bios/apm.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/i386/bios/apm.c -L sys/i386/bios/apm.c -u -r1.1.1.1 -r1.2
--- sys/i386/bios/apm.c
+++ sys/i386/bios/apm.c
@@ -17,16 +17,21 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/bios/apm.c,v 1.145 2005/04/12 20:14:56 mdodd Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/bios/apm.c,v 1.147.2.1 2007/12/09 00:24:16 njl Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/bus.h>
+#include <sys/clock.h>
 #include <sys/conf.h>
+#include <sys/condvar.h>
 #include <sys/eventhandler.h>
 #include <sys/fcntl.h>
 #include <sys/kernel.h>
+#include <sys/kthread.h>
+#include <sys/lock.h>
 #include <sys/module.h>
+#include <sys/mutex.h>
 #include <sys/poll.h>
 #include <sys/power.h>
 #include <sys/reboot.h>
@@ -98,10 +103,6 @@
 /* Map version number to integer (keeps ordering of version numbers) */
 #define INTVERSION(major, minor)	((major)*100 + (minor))
 
-static struct callout_handle apm_timeout_ch = 
-    CALLOUT_HANDLE_INITIALIZER(&apm_timeout_ch);
-
-static timeout_t apm_timeout;
 static d_open_t apmopen;
 static d_close_t apmclose;
 static d_write_t apmwrite;
@@ -484,9 +485,16 @@
 	apm_op_inprog = 0;
 	sc->suspends = sc->suspend_countdown = 0;
 
+	/*
+	 * Be sure to hold Giant across DEVICE_SUSPEND/RESUME since
+	 * non-MPSAFE drivers need this.
+	 */
+	mtx_lock(&Giant);
 	error = DEVICE_SUSPEND(root_bus);
-	if (error)
+	if (error) {
+		mtx_unlock(&Giant);
 		return;
+	}
 
 	apm_execute_hook(hook[APM_HOOK_SUSPEND]);
 	if (apm_suspend_system(PMST_SUSPEND) == 0) {
@@ -497,6 +505,7 @@
 		apm_execute_hook(hook[APM_HOOK_RESUME]);
 		DEVICE_RESUME(root_bus);
 	}
+	mtx_unlock(&Giant);
 	return;
 }
 
@@ -601,7 +610,9 @@
 
 	sc->suspending = 0;
 	apm_execute_hook(hook[APM_HOOK_RESUME]);
+	mtx_lock(&Giant);
 	DEVICE_RESUME(root_bus);
+	mtx_unlock(&Giant);
 	return;
 }
 
@@ -728,31 +739,32 @@
 
 
 /*
- * APM timeout routine:
+ * APM thread loop.
  *
- * This routine is automatically called by timer once per second.
+ * This routine wakes up from time to time to deal with delaying the
+ * suspend of the system, or other events.
  */
-
 static void
-apm_timeout(void *dummy)
+apm_event_thread(void *arg)
 {
 	struct apm_softc *sc = &apm_softc;
 
-	if (apm_op_inprog)
-		apm_lastreq_notify();
-
-	if (sc->standbys && sc->standby_countdown-- <= 0)
-		apm_do_standby();
-
-	if (sc->suspends && sc->suspend_countdown-- <= 0)
-		apm_do_suspend();
-
-	if (!sc->bios_busy)
-		apm_processevent();
-
-	if (sc->active == 1)
-		/* Run slightly more oftan than 1 Hz */
-		apm_timeout_ch = timeout(apm_timeout, NULL, hz - 1);
+	sc->running = 1;
+	while (sc->active) {
+		if (apm_op_inprog)
+			apm_lastreq_notify();
+		if (sc->standbys && sc->standby_countdown-- <= 0)
+			apm_do_standby();
+		if (sc->suspends && sc->suspend_countdown-- <= 0)
+			apm_do_suspend();
+		if (!sc->bios_busy)
+			apm_processevent();
+		mtx_lock(&sc->mtx);
+		cv_timedwait(&sc->cv, &sc->mtx, 10 * hz / 9);
+		mtx_unlock(&sc->mtx);
+	}
+	sc->running = 0;
+	kthread_exit(0);
 }
 
 /* enable APM BIOS */
@@ -766,8 +778,11 @@
 	if (sc == NULL || sc->initialized == 0)
 		return;
 
+	/* Start the thread */
 	sc->active = 1;
-	apm_timeout(sc);
+	if (kthread_create(apm_event_thread, sc, &sc->event_thread, 0, 0,
+	    "apm worker"))
+		panic("Cannot create apm worker thread");
 
 	return;
 }
@@ -783,9 +798,14 @@
 	if (sc == NULL || sc->initialized == 0)
 		return;
 
-	untimeout(apm_timeout, NULL, apm_timeout_ch);
+	mtx_lock(&sc->mtx);
 	sc->active = 0;
-
+	while (sc->running) {
+		cv_broadcast(&sc->cv);
+		msleep(sc->event_thread, &sc->mtx, PWAIT, "apmdie", 0);
+	}
+	mtx_unlock(&sc->mtx);
+	sc->event_thread = NULL;
 	return;
 }
 
@@ -1132,6 +1152,8 @@
 #ifdef PC98
 	int			rid;
 #endif
+	mtx_init(&sc->mtx, device_get_nameunit(dev), "apm", MTX_DEF);
+	cv_init(&sc->cv, "cbb cv");
 
 	if (device_get_flags(dev) & 0x20)
 		statclock_disable = 1;
@@ -1223,6 +1245,7 @@
 
 	sc->initialized = 1;
 	sc->suspending = 0;
+	sc->running = 0;
 
 	make_dev(&apm_cdevsw, 0, 0, 5, 0664, "apm");
 	make_dev(&apm_cdevsw, 8, 0, 5, 0660, "apmctl");
Index: smapi.c
===================================================================
RCS file: /home/cvs/src/sys/i386/bios/smapi.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/i386/bios/smapi.c -L sys/i386/bios/smapi.c -u -r1.1.1.1 -r1.2
--- sys/i386/bios/smapi.c
+++ sys/i386/bios/smapi.c
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/bios/smapi.c,v 1.13 2004/06/16 09:47:07 phk Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/bios/smapi.c,v 1.14 2007/03/20 20:21:44 jhb Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -166,7 +166,7 @@
 		rid = 0;
 		length = ADDR2HDR(addr)->length;
 
-		child = BUS_ADD_CHILD(parent, 0, "smapi", -1);
+		child = BUS_ADD_CHILD(parent, 5, "smapi", -1);
 		device_set_driver(child, driver);
 		bus_set_resource(child, SYS_RES_MEMORY, rid, addr, length);
 		device_set_desc(child, "SMAPI BIOS");
Index: smbios.c
===================================================================
RCS file: /home/cvs/src/sys/i386/bios/smbios.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/i386/bios/smbios.c -L sys/i386/bios/smbios.c -u -r1.1.1.1 -r1.2
--- sys/i386/bios/smbios.c
+++ sys/i386/bios/smbios.c
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/bios/smbios.c,v 1.4.8.1 2005/10/06 20:43:44 jkim Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/bios/smbios.c,v 1.6 2007/03/20 20:21:44 jhb Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -131,7 +131,7 @@
 				return;
 		}
 
-		child = BUS_ADD_CHILD(parent, 0, "smbios", -1);
+		child = BUS_ADD_CHILD(parent, 5, "smbios", -1);
 		device_set_driver(child, driver);
 		bus_set_resource(child, SYS_RES_MEMORY, rid, addr, length);
 		device_set_desc(child, "System Management BIOS");
Index: vpd.c
===================================================================
RCS file: /home/cvs/src/sys/i386/bios/vpd.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/i386/bios/vpd.c -L sys/i386/bios/vpd.c -u -r1.1.1.1 -r1.2
--- sys/i386/bios/vpd.c
+++ sys/i386/bios/vpd.c
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/bios/vpd.c,v 1.5 2004/08/31 21:45:30 mdodd Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/bios/vpd.c,v 1.6 2007/03/20 20:21:44 jhb Exp $");
 
 /*
  * VPD decoder for IBM systems (Thinkpads)
@@ -128,7 +128,7 @@
 		rid = 0;
 		length = ADDR2VPD(addr)->Length;
 
-		child = BUS_ADD_CHILD(parent, 0, "vpd", -1);
+		child = BUS_ADD_CHILD(parent, 5, "vpd", -1);
 		device_set_driver(child, driver);
 		bus_set_resource(child, SYS_RES_MEMORY, rid, addr, length);
 		device_set_desc(child, "Vital Product Data Area");
Index: smapi_bios.S
===================================================================
RCS file: /home/cvs/src/sys/i386/bios/smapi_bios.S,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/i386/bios/smapi_bios.S -L sys/i386/bios/smapi_bios.S -u -r1.1.1.1 -r1.2
--- sys/i386/bios/smapi_bios.S
+++ sys/i386/bios/smapi_bios.S
@@ -1,7 +1,5 @@
 #include <machine/asm.h>
-__FBSDID("$FreeBSD: src/sys/i386/bios/smapi_bios.S,v 1.4 2003/06/13 00:36:03 mdodd Exp $");
-
-#include <machine/asmacros.h>
+__FBSDID("$FreeBSD: src/sys/i386/bios/smapi_bios.S,v 1.5 2005/07/22 15:01:07 ru Exp $");
 
 /*
  * This is cribbed from the Linux thinkpad-4.1 driver by
Index: apm.h
===================================================================
RCS file: /home/cvs/src/sys/i386/bios/apm.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/i386/bios/apm.h -L sys/i386/bios/apm.h -u -r1.1.1.1 -r1.2
--- sys/i386/bios/apm.h
+++ sys/i386/bios/apm.h
@@ -15,7 +15,7 @@
  *
  * Sep, 1994	Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
  *
- * $FreeBSD: src/sys/i386/bios/apm.h,v 1.5 2005/01/06 22:18:15 imp Exp $
+ * $FreeBSD: src/sys/i386/bios/apm.h,v 1.6 2006/05/25 23:06:38 imp Exp $
  */
 
 #define APM_NEVENTS 16
@@ -29,7 +29,10 @@
 	bus_space_handle_t	sc_ioh;
 	struct resource 	*sc_res;
 #endif
-	int	initialized, active, bios_busy;
+	struct mtx	mtx;
+	struct cv	cv;
+	struct proc	*event_thread;
+	int	initialized, active, running, bios_busy;
 	int	always_halt_cpu, slow_idle_cpu;
 	int	disabled, disengaged;
 	int	suspending;
Index: est.c
===================================================================
RCS file: /home/cvs/src/sys/i386/cpufreq/est.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -L sys/i386/cpufreq/est.c -L sys/i386/cpufreq/est.c -u -r1.3 -r1.4
--- sys/i386/cpufreq/est.c
+++ sys/i386/cpufreq/est.c
@@ -26,8 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-/* $FreeBSD: /repoman/r/ncvs/src/sys/i386/cpufreq/est.c,v 1.7.2.1 2006/05/29 22:40:03 njl Exp $ */
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: src/sys/i386/cpufreq/est.c,v 1.11 2006/05/11 17:35:44 njl Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
Index: powernow.c
===================================================================
RCS file: /home/cvs/src/sys/i386/cpufreq/powernow.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/i386/cpufreq/powernow.c -L sys/i386/cpufreq/powernow.c -u -r1.2 -r1.3
--- sys/i386/cpufreq/powernow.c
+++ sys/i386/cpufreq/powernow.c
@@ -29,8 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-/*$FreeBSD: src/sys/i386/cpufreq/powernow.c,v 1.4 2007/01/23 19:20:30 bruno Exp $ */
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: src/sys/i386/cpufreq/powernow.c,v 1.4 2007/01/23 19:20:30 bruno Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
Index: p4tcc.c
===================================================================
RCS file: /home/cvs/src/sys/i386/cpufreq/p4tcc.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/i386/cpufreq/p4tcc.c -L sys/i386/cpufreq/p4tcc.c -u -r1.2 -r1.3
--- sys/i386/cpufreq/p4tcc.c
+++ sys/i386/cpufreq/p4tcc.c
@@ -37,8 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-/* $FreeBSD: src/sys/i386/cpufreq/p4tcc.c,v 1.11.2.1 2005/10/25 20:52:44 njl Exp $ */
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: src/sys/i386/cpufreq/p4tcc.c,v 1.12 2005/10/23 19:38:06 njl Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
Index: smist.c
===================================================================
RCS file: /home/cvs/src/sys/i386/cpufreq/smist.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/i386/cpufreq/smist.c -L sys/i386/cpufreq/smist.c -u -r1.2 -r1.3
--- sys/i386/cpufreq/smist.c
+++ sys/i386/cpufreq/smist.c
@@ -42,9 +42,7 @@
 #include <sys/bus.h>
 #include <sys/cpu.h>
 #include <sys/kernel.h>
-#include <sys/lock.h>
 #include <sys/module.h>
-#include <sys/mutex.h>
 #include <sys/systm.h>
 
 #include <machine/bus.h>
Index: syscalls.xenix.conf
===================================================================
RCS file: /home/cvs/src/sys/i386/ibcs2/syscalls.xenix.conf,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/i386/ibcs2/syscalls.xenix.conf -L sys/i386/ibcs2/syscalls.xenix.conf -u -r1.1.1.1 -r1.2
--- sys/i386/ibcs2/syscalls.xenix.conf
+++ sys/i386/ibcs2/syscalls.xenix.conf
@@ -1,4 +1,4 @@
-#	syscalls.conf $FreeBSD: src/sys/i386/ibcs2/syscalls.xenix.conf,v 1.6 2003/12/24 00:32:07 peter Exp $
+#	syscalls.conf $FreeBSD: src/sys/i386/ibcs2/syscalls.xenix.conf,v 1.7 2006/08/15 17:25:54 jhb Exp $
 sysnames="/dev/null"
 sysproto="ibcs2_xenix.h"
 sysproto_h=_IBCS2_XENIX_H_
@@ -8,4 +8,4 @@
 syscallprefix="IBCS2_XENIX_"
 switchname="xenix_sysent"
 namesname="xenix_syscallnames"
-sysvec="\n"
+systrace="/dev/null"
Index: syscalls.master
===================================================================
RCS file: /home/cvs/src/sys/i386/ibcs2/syscalls.master,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/i386/ibcs2/syscalls.master -L sys/i386/ibcs2/syscalls.master -u -r1.1.1.1 -r1.2
--- sys/i386/ibcs2/syscalls.master
+++ sys/i386/ibcs2/syscalls.master
@@ -1,10 +1,10 @@
- $FreeBSD: src/sys/i386/ibcs2/syscalls.master,v 1.20.2.1 2005/07/20 17:42:15 jhb Exp $
+ $FreeBSD: src/sys/i386/ibcs2/syscalls.master,v 1.28 2006/07/28 19:05:27 jhb Exp $
 
 ;	@(#)syscalls.master	8.1 (Berkeley) 7/19/93
 ; System call name/number master file (or rather, slave, from IBCS2).
 ; Processed to created ibcs2_sysent.c, ibcs2_syscalls.c and ibcs2_syscall.h.
 
-; Columns: number type nargs name alt{name,tag,rtyp}/comments
+; Columns: number audit type nargs name alt{name,tag,rtyp}/comments
 ;	number	system call number, must be in order
 ;	audit	the audit event associated with the system call
 ;		A value of AUE_NULL means no auditing, but it also means that
@@ -35,100 +35,100 @@
 
 ; #ifdef's, etc. may be included, and are copied to the output files.
 
-0	AUE_NULL	MNOPROTO	{ int nosys(void); } syscall nosys_args int
-1	AUE_NULL	MNOPROTO { void sys_exit(int rval); } exit \
+0	AUE_NULL	NOPROTO	{ int nosys(void); } syscall nosys_args int
+1	AUE_EXIT	NOPROTO	{ void sys_exit(int rval); } exit \
 				    sys_exit_args void
-2	AUE_NULL	MNOPROTO { int fork(void); }
+2	AUE_FORK	NOPROTO	{ int fork(void); }
 3	AUE_NULL	STD	{ int ibcs2_read(int fd, char *buf, \
 				    u_int nbytes); }
-4	AUE_NULL	MNOPROTO { int write(int fd, char *buf, \
+4	AUE_NULL	NOPROTO	{ int write(int fd, char *buf, \
 				    u_int nbytes); }
-5	AUE_NULL	MSTD	{ int ibcs2_open(char *path, int flags, \
+5	AUE_OPEN_RWTC	STD	{ int ibcs2_open(char *path, int flags, \
 				    int mode); }
-6	AUE_NULL	MNOPROTO { int close(int fd); }
-7	AUE_NULL	MSTD	{ int ibcs2_wait(int a1, int a2, int a3); }
-8	AUE_NULL	MSTD	{ int ibcs2_creat(char *path, int mode); }
-9	AUE_NULL	MNOPROTO	{ int link(char *path, char *link); }
-10	AUE_NULL	MSTD	{ int ibcs2_unlink(char *path); }
-11	AUE_NULL	MSTD	{ int ibcs2_execv(char *path, char **argp); }
-12	AUE_NULL	MSTD	{ int ibcs2_chdir(char *path); }
-13	AUE_NULL	MSTD	{ int ibcs2_time(ibcs2_time_t *tp); }
-14	AUE_NULL	MSTD	{ int ibcs2_mknod(char* path, int mode, \
+6	AUE_CLOSE	NOPROTO	{ int close(int fd); }
+7	AUE_WAIT4	STD	{ int ibcs2_wait(int a1, int a2, int a3); }
+8	AUE_CREAT	STD	{ int ibcs2_creat(char *path, int mode); }
+9	AUE_LINK	NOPROTO	{ int link(char *path, char *link); }
+10	AUE_UNLINK	STD	{ int ibcs2_unlink(char *path); }
+11	AUE_EXECVE	STD	{ int ibcs2_execv(char *path, char **argp); }
+12	AUE_CHDIR	STD	{ int ibcs2_chdir(char *path); }
+13	AUE_NULL	STD	{ int ibcs2_time(ibcs2_time_t *tp); }
+14	AUE_MKNOD	STD	{ int ibcs2_mknod(char* path, int mode, \
 				    int dev); }
-15	AUE_NULL	MSTD	{ int ibcs2_chmod(char *path, int mode); }
-16	AUE_NULL	MSTD	{ int ibcs2_chown(char *path, int uid, \
+15	AUE_CHMOD	STD	{ int ibcs2_chmod(char *path, int mode); }
+16	AUE_CHOWN	STD	{ int ibcs2_chown(char *path, int uid, \
 				    int gid); }
-17	AUE_NULL	MNOPROTO	{ int obreak(caddr_t nsize); }
-18	AUE_NULL	MSTD	{ int ibcs2_stat(char* path, \
+17	AUE_NULL	NOPROTO	{ int obreak(caddr_t nsize); }
+18	AUE_STAT	STD	{ int ibcs2_stat(char* path, \
 				    struct ibcs2_stat *st); }
-19	AUE_NULL	MSTD	{ long ibcs2_lseek(int fd, long offset, \
+19	AUE_LSEEK	STD	{ long ibcs2_lseek(int fd, long offset, \
 				    int whence); }
-20	AUE_NULL	MNOPROTO { pid_t getpid(void); }
-21	AUE_NULL	STD	{ int ibcs2_mount(char *special, char *dir, \
+20	AUE_NULL	NOPROTO	{ pid_t getpid(void); }
+21	AUE_MOUNT	STD	{ int ibcs2_mount(char *special, char *dir, \
 				    int flags, int fstype, char *data, \
 				    int len); }
-22	AUE_NULL	STD	{ int ibcs2_umount(char *name); }
-23	AUE_NULL	MSTD	{ int ibcs2_setuid(int uid); }
-24	AUE_NULL	MNOPROTO { uid_t getuid(void); }
-25	AUE_NULL	MSTD	{ int ibcs2_stime(long *timep); }
-26	AUE_NULL	MNOPROTO { int ptrace(int req, pid_t pid, \
+22	AUE_UMOUNT	STD	{ int ibcs2_umount(char *name); }
+23	AUE_SETUID	STD	{ int ibcs2_setuid(int uid); }
+24	AUE_GETUID	NOPROTO	{ uid_t getuid(void); }
+25	AUE_SETTIMEOFDAY	STD	{ int ibcs2_stime(long *timep); }
+26	AUE_PTRACE	NOPROTO	{ int ptrace(int req, pid_t pid, \
 				    caddr_t addr, int data); }
-27	AUE_NULL	MSTD	{ int ibcs2_alarm(unsigned sec); }
-28	AUE_NULL	MSTD	{ int ibcs2_fstat(int fd, \
+27	AUE_NULL	STD	{ int ibcs2_alarm(unsigned sec); }
+28	AUE_FSTAT	STD	{ int ibcs2_fstat(int fd, \
 				    struct ibcs2_stat *st); }
-29	AUE_NULL	MSTD	{ int ibcs2_pause(void); }
-30	AUE_NULL	MSTD	{ int ibcs2_utime(char *path, \
+29	AUE_NULL	STD	{ int ibcs2_pause(void); }
+30	AUE_NULL	STD	{ int ibcs2_utime(char *path, \
 				    struct ibcs2_utimbuf *buf); }
-31	AUE_NULL	MSTD	{ int ibcs2_stty(int fd, \
+31	AUE_NULL	STD	{ int ibcs2_stty(int fd, \
 				    struct sgttyb *buf); }
-32	AUE_NULL	MSTD	{ int ibcs2_gtty(int fd, \
+32	AUE_NULL	STD	{ int ibcs2_gtty(int fd, \
 				    struct sgttyb *buf); }
-33	AUE_NULL	MSTD	{ int ibcs2_access(char *path, int flags); }
-34	AUE_NULL	MSTD	{ int ibcs2_nice(int incr); }
-35	AUE_NULL	MSTD	{ int ibcs2_statfs(char *path, \
+33	AUE_ACCESS	STD	{ int ibcs2_access(char *path, int flags); }
+34	AUE_NICE	STD	{ int ibcs2_nice(int incr); }
+35	AUE_STATFS	STD	{ int ibcs2_statfs(char *path, \
 				    struct ibcs2_statfs *buf, int len, \
 				    int fstype); }
-36	AUE_NULL	MNOPROTO	{ int sync(void); }
-37	AUE_NULL	MSTD	{ int ibcs2_kill(int pid, int signo); }
-38	AUE_NULL	MSTD	{ int ibcs2_fstatfs(int fd, \
+36	AUE_NULL	NOPROTO	{ int sync(void); }
+37	AUE_KILL	STD	{ int ibcs2_kill(int pid, int signo); }
+38	AUE_FSTATFS	STD	{ int ibcs2_fstatfs(int fd, \
 				    struct ibcs2_statfs *buf, int len, \
 				    int fstype); }
-39	AUE_NULL	MSTD	{ int ibcs2_pgrpsys(int type, caddr_t dummy, \
+39	AUE_NULL	STD	{ int ibcs2_pgrpsys(int type, caddr_t dummy, \
 				    int pid, int pgid); }
-40	AUE_NULL	MSTD	{ int ibcs2_xenix(int a1, int a2, int a3, \
+40	AUE_NULL	STD	{ int ibcs2_xenix(int a1, int a2, int a3, \
 				    int a4, int a5); }
-41	AUE_NULL	MNOPROTO { int dup(u_int fd); }
-42	AUE_NULL	MNOPROTO { int pipe(void); }
-43	AUE_NULL	MSTD	{ int ibcs2_times(struct tms *tp); }
-44	AUE_NULL	MNOPROTO { int profil(caddr_t samples, u_int size, \
+41	AUE_NULL	NOPROTO	{ int dup(u_int fd); }
+42	AUE_PIPE	NOPROTO	{ int pipe(void); }
+43	AUE_NULL	STD	{ int ibcs2_times(struct tms *tp); }
+44	AUE_PROFILE	NOPROTO	{ int profil(caddr_t samples, u_int size, \
 				    u_int offset, u_int scale); }
-45	AUE_NULL	MSTD	{ int ibcs2_plock(int cmd); }
-46	AUE_NULL	MSTD	{ int ibcs2_setgid(int gid); }
-47	AUE_NULL	MNOPROTO { gid_t getgid(void); }
-48	AUE_NULL	MSTD	{ int ibcs2_sigsys(int sig, ibcs2_sig_t fp); }
-49	AUE_NULL	STD	{ int ibcs2_msgsys(int which, int a2, \
+45	AUE_NULL	STD	{ int ibcs2_plock(int cmd); }
+46	AUE_SETGID	STD	{ int ibcs2_setgid(int gid); }
+47	AUE_GETGID	NOPROTO	{ gid_t getgid(void); }
+48	AUE_NULL	STD	{ int ibcs2_sigsys(int sig, ibcs2_sig_t fp); }
+49	AUE_MSGSYS	STD	{ int ibcs2_msgsys(int which, int a2, \
 				    int a3, int a4, int a5, int a6); }
-50	AUE_NULL	MSTD	{ int ibcs2_sysi86(int cmd, int *arg); }
+50	AUE_NULL	STD	{ int ibcs2_sysi86(int cmd, int *arg); }
 51	AUE_NULL	UNIMPL	ibcs2_acct
-52	AUE_NULL	STD	{ int ibcs2_shmsys(int which, int a2, \
+52	AUE_SHMSYS	STD	{ int ibcs2_shmsys(int which, int a2, \
 				    int a3, int a4); }
-53	AUE_NULL	STD	{ int ibcs2_semsys(int which, int a2, \
+53	AUE_SEMSYS	STD	{ int ibcs2_semsys(int which, int a2, \
 				    int a3, int a4, int a5); }
-54	AUE_NULL	STD	{ int ibcs2_ioctl(int fd, int cmd, \
+54	AUE_IOCTL	STD	{ int ibcs2_ioctl(int fd, int cmd, \
 				    caddr_t data); }
-55	AUE_NULL	MSTD	{ int ibcs2_uadmin(int cmd, int func, \
+55	AUE_NULL	STD	{ int ibcs2_uadmin(int cmd, int func, \
 				    caddr_t data); }
 56	AUE_NULL	UNIMPL	nosys
-57	AUE_NULL	MSTD	{ int ibcs2_utssys(int a1, int a2, \
+57	AUE_NULL	STD	{ int ibcs2_utssys(int a1, int a2, \
 				    int flag); }
-58      AUE_NULL	MNOPROTO { int fsync(int fd); }
-59	AUE_NULL	MSTD	{ int ibcs2_execve(char *path, char **argp, \
+58      AUE_FSYNC	NOPROTO	{ int fsync(int fd); }
+59	AUE_EXECVE	STD	{ int ibcs2_execve(char *path, char **argp, \
 				    char **envp); }
-60	AUE_NULL	MNOPROTO { int umask(int newmask); }
-61	AUE_NULL	MNOPROTO	{ int chroot(char *path); }
-62	AUE_NULL	MSTD	{ int ibcs2_fcntl(int fd, int cmd, \
+60	AUE_UMASK	NOPROTO	{ int umask(int newmask); }
+61	AUE_CHROOT	NOPROTO	{ int chroot(char *path); }
+62	AUE_FCNTL	STD	{ int ibcs2_fcntl(int fd, int cmd, \
 				    char *arg); }
-63	AUE_NULL	MSTD	{ long ibcs2_ulimit(int cmd, int newlimit); }
+63	AUE_NULL	STD	{ long ibcs2_ulimit(int cmd, int newlimit); }
 64	AUE_NULL	UNIMPL	reserved for unix/pc
 65	AUE_NULL	UNIMPL	reserved for unix/pc
 66	AUE_NULL	UNIMPL	reserved for unix/pc
@@ -144,30 +144,30 @@
 76	AUE_NULL	OBSOL	rfs_rdebug
 77	AUE_NULL	OBSOL	rfs_rfstop
 78	AUE_NULL	UNIMPL	rfs_rfsys
-79	AUE_NULL	MSTD	{ int ibcs2_rmdir(char *path); }
-80	AUE_NULL	MSTD	{ int ibcs2_mkdir(char *path, int mode); }
-81	AUE_NULL	STD	{ int ibcs2_getdents(int fd, char *buf, \
+79	AUE_RMDIR	STD	{ int ibcs2_rmdir(char *path); }
+80	AUE_MKDIR	STD	{ int ibcs2_mkdir(char *path, int mode); }
+81	AUE_GETDIRENTRIES	STD	{ int ibcs2_getdents(int fd, char *buf, \
 				    int nbytes); }
 82	AUE_NULL	UNIMPL	nosys
 83	AUE_NULL	UNIMPL	nosys
-84	AUE_NULL	MSTD	{ int ibcs2_sysfs(int cmd, caddr_t d1, \
+84	AUE_NULL	STD	{ int ibcs2_sysfs(int cmd, caddr_t d1, \
 				    char *buf); }
-85	AUE_NULL	MSTD	{ int ibcs2_getmsg(int fd, \
+85	AUE_GETMSG	STD	{ int ibcs2_getmsg(int fd, \
 				    struct ibcs2_stropts *ctl, \
 				    struct ibcs2_stropts *dat, int *flags); }
-86	AUE_NULL	MSTD	{ int ibcs2_putmsg(int fd, \
+86	AUE_PUTMSG	STD	{ int ibcs2_putmsg(int fd, \
 				    struct ibcs2_stropts *ctl, \
 				    struct ibcs2_stropts *dat, int flags); }
-87	AUE_NULL	STD	{ int ibcs2_poll(struct ibcs2_poll *fds, \
-				    long nfds, int timeout); }
+87	AUE_POLL	NOPROTO	{ int poll(struct pollfd *fds, u_int nfds, \
+				    int timeout); }
 88	AUE_NULL	UNIMPL	nosys
-89	AUE_NULL	MSTD	{ int ibcs2_secure(int cmd, int a1, int a2, \
+89	AUE_NULL	STD	{ int ibcs2_secure(int cmd, int a1, int a2, \
 				    int a3, int a4, int a5); }
-90	AUE_NULL	MSTD	{ int ibcs2_symlink(char *path, \
+90	AUE_SYMLINK	STD	{ int ibcs2_symlink(char *path, \
 				    char *link); }
-91	AUE_NULL	MSTD	{ int ibcs2_lstat(char *path, \
+91	AUE_LSTAT	STD	{ int ibcs2_lstat(char *path, \
 				    struct ibcs2_stat *st); }
-92	AUE_NULL	MSTD	{ int ibcs2_readlink(char *path, char *buf, \
+92	AUE_READLINK	STD	{ int ibcs2_readlink(char *path, char *buf, \
 				    int count); }
 93	AUE_NULL	UNIMPL	nosys
 94	AUE_NULL	UNIMPL	nosys
@@ -179,10 +179,10 @@
 100	AUE_NULL	UNIMPL	nosys
 101	AUE_NULL	UNIMPL	nosys
 102	AUE_NULL	UNIMPL	nosys
-103	AUE_NULL	MNOPROTO { int sigreturn( \
+103	AUE_NULL	NOPROTO	{ int sigreturn( \
 				    struct sigcontext *sigcntxp); }
 104	AUE_NULL	UNIMPL	nosys
-105	AUE_NULL	MSTD	{ int ibcs2_isc(void); }
+105	AUE_NULL	STD	{ int ibcs2_isc(void); }
 106	AUE_NULL	UNIMPL	nosys
 107	AUE_NULL	UNIMPL	nosys
 108	AUE_NULL	UNIMPL	nosys
Index: ibcs2_xenix_syscall.h
===================================================================
RCS file: /home/cvs/src/sys/i386/ibcs2/ibcs2_xenix_syscall.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/i386/ibcs2/ibcs2_xenix_syscall.h -L sys/i386/ibcs2/ibcs2_xenix_syscall.h -u -r1.1.1.1 -r1.2
--- sys/i386/ibcs2/ibcs2_xenix_syscall.h
+++ sys/i386/ibcs2/ibcs2_xenix_syscall.h
@@ -2,8 +2,8 @@
  * System call numbers.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/i386/ibcs2/ibcs2_xenix_syscall.h,v 1.11.2.1 2005/07/20 17:43:53 jhb Exp $
- * created from FreeBSD: src/sys/i386/ibcs2/syscalls.xenix,v 1.9.2.1 2005/07/20 17:42:15 jhb Exp 
+ * $FreeBSD: src/sys/i386/ibcs2/ibcs2_xenix_syscall.h,v 1.17 2006/08/15 17:37:00 jhb Exp $
+ * created from FreeBSD: src/sys/i386/ibcs2/syscalls.xenix,v 1.14 2006/07/28 19:05:27 jhb Exp 
  */
 
 #define	IBCS2_XENIX_xenix_rdchk	7
Index: ibcs2_sysi86.c
===================================================================
RCS file: /home/cvs/src/sys/i386/ibcs2/ibcs2_sysi86.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/i386/ibcs2/ibcs2_sysi86.c -L sys/i386/ibcs2/ibcs2_sysi86.c -u -r1.1.1.1 -r1.2
--- sys/i386/ibcs2/ibcs2_sysi86.c
+++ sys/i386/ibcs2/ibcs2_sysi86.c
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/ibcs2/ibcs2_sysi86.c,v 1.22 2005/07/07 19:30:30 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/ibcs2/ibcs2_sysi86.c,v 1.23 2006/11/06 13:41:59 rwatson Exp $");
 
 #include <sys/param.h>
 #include <sys/lock.h>
@@ -76,8 +76,6 @@
 	        int name[2];
 	        int error;
 
-		if ((error = suser(td)))
-		  return (error);
 		name[0] = CTL_KERN;
 		name[1] = KERN_HOSTNAME;
 		mtx_lock(&Giant);
Index: ibcs2_sysent.c
===================================================================
RCS file: /home/cvs/src/sys/i386/ibcs2/ibcs2_sysent.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/i386/ibcs2/ibcs2_sysent.c -L sys/i386/ibcs2/ibcs2_sysent.c -u -r1.1.1.1 -r1.2
--- sys/i386/ibcs2/ibcs2_sysent.c
+++ sys/i386/ibcs2/ibcs2_sysent.c
@@ -2,8 +2,8 @@
  * System call switch table.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/i386/ibcs2/ibcs2_sysent.c,v 1.23.2.1 2005/07/20 17:43:53 jhb Exp $
- * created from FreeBSD: src/sys/i386/ibcs2/syscalls.master,v 1.20.2.1 2005/07/20 17:42:15 jhb Exp 
+ * $FreeBSD: src/sys/i386/ibcs2/ibcs2_sysent.c,v 1.32 2006/08/15 17:37:00 jhb Exp $
+ * created from FreeBSD: src/sys/i386/ibcs2/syscalls.master,v 1.28 2006/07/28 19:05:27 jhb Exp 
  */
 
 #include <bsm/audit_kevents.h>
@@ -18,132 +18,132 @@
 
 /* The casts are bogus but will do for now. */
 struct sysent ibcs2_sysent[] = {
-	{ SYF_MPSAFE | 0, (sy_call_t *)nosys, AUE_NULL },	/* 0 = syscall */
-	{ SYF_MPSAFE | AS(sys_exit_args), (sy_call_t *)sys_exit, AUE_NULL },	/* 1 = exit */
-	{ SYF_MPSAFE | 0, (sy_call_t *)fork, AUE_NULL },	/* 2 = fork */
-	{ AS(ibcs2_read_args), (sy_call_t *)ibcs2_read, AUE_NULL },	/* 3 = ibcs2_read */
-	{ SYF_MPSAFE | AS(write_args), (sy_call_t *)write, AUE_NULL },	/* 4 = write */
-	{ SYF_MPSAFE | AS(ibcs2_open_args), (sy_call_t *)ibcs2_open, AUE_NULL },	/* 5 = ibcs2_open */
-	{ SYF_MPSAFE | AS(close_args), (sy_call_t *)close, AUE_NULL },	/* 6 = close */
-	{ SYF_MPSAFE | AS(ibcs2_wait_args), (sy_call_t *)ibcs2_wait, AUE_NULL },	/* 7 = ibcs2_wait */
-	{ SYF_MPSAFE | AS(ibcs2_creat_args), (sy_call_t *)ibcs2_creat, AUE_NULL },	/* 8 = ibcs2_creat */
-	{ SYF_MPSAFE | AS(link_args), (sy_call_t *)link, AUE_NULL },	/* 9 = link */
-	{ SYF_MPSAFE | AS(ibcs2_unlink_args), (sy_call_t *)ibcs2_unlink, AUE_NULL },	/* 10 = ibcs2_unlink */
-	{ SYF_MPSAFE | AS(ibcs2_execv_args), (sy_call_t *)ibcs2_execv, AUE_NULL },	/* 11 = ibcs2_execv */
-	{ SYF_MPSAFE | AS(ibcs2_chdir_args), (sy_call_t *)ibcs2_chdir, AUE_NULL },	/* 12 = ibcs2_chdir */
-	{ SYF_MPSAFE | AS(ibcs2_time_args), (sy_call_t *)ibcs2_time, AUE_NULL },	/* 13 = ibcs2_time */
-	{ SYF_MPSAFE | AS(ibcs2_mknod_args), (sy_call_t *)ibcs2_mknod, AUE_NULL },	/* 14 = ibcs2_mknod */
-	{ SYF_MPSAFE | AS(ibcs2_chmod_args), (sy_call_t *)ibcs2_chmod, AUE_NULL },	/* 15 = ibcs2_chmod */
-	{ SYF_MPSAFE | AS(ibcs2_chown_args), (sy_call_t *)ibcs2_chown, AUE_NULL },	/* 16 = ibcs2_chown */
-	{ SYF_MPSAFE | AS(obreak_args), (sy_call_t *)obreak, AUE_NULL },	/* 17 = obreak */
-	{ SYF_MPSAFE | AS(ibcs2_stat_args), (sy_call_t *)ibcs2_stat, AUE_NULL },	/* 18 = ibcs2_stat */
-	{ SYF_MPSAFE | AS(ibcs2_lseek_args), (sy_call_t *)ibcs2_lseek, AUE_NULL },	/* 19 = ibcs2_lseek */
-	{ SYF_MPSAFE | 0, (sy_call_t *)getpid, AUE_NULL },	/* 20 = getpid */
-	{ AS(ibcs2_mount_args), (sy_call_t *)ibcs2_mount, AUE_NULL },	/* 21 = ibcs2_mount */
-	{ AS(ibcs2_umount_args), (sy_call_t *)ibcs2_umount, AUE_NULL },	/* 22 = ibcs2_umount */
-	{ SYF_MPSAFE | AS(ibcs2_setuid_args), (sy_call_t *)ibcs2_setuid, AUE_NULL },	/* 23 = ibcs2_setuid */
-	{ SYF_MPSAFE | 0, (sy_call_t *)getuid, AUE_NULL },	/* 24 = getuid */
-	{ SYF_MPSAFE | AS(ibcs2_stime_args), (sy_call_t *)ibcs2_stime, AUE_NULL },	/* 25 = ibcs2_stime */
-	{ SYF_MPSAFE | AS(ptrace_args), (sy_call_t *)ptrace, AUE_NULL },	/* 26 = ptrace */
-	{ SYF_MPSAFE | AS(ibcs2_alarm_args), (sy_call_t *)ibcs2_alarm, AUE_NULL },	/* 27 = ibcs2_alarm */
-	{ SYF_MPSAFE | AS(ibcs2_fstat_args), (sy_call_t *)ibcs2_fstat, AUE_NULL },	/* 28 = ibcs2_fstat */
-	{ SYF_MPSAFE | 0, (sy_call_t *)ibcs2_pause, AUE_NULL },	/* 29 = ibcs2_pause */
-	{ SYF_MPSAFE | AS(ibcs2_utime_args), (sy_call_t *)ibcs2_utime, AUE_NULL },	/* 30 = ibcs2_utime */
-	{ SYF_MPSAFE | AS(ibcs2_stty_args), (sy_call_t *)ibcs2_stty, AUE_NULL },	/* 31 = ibcs2_stty */
-	{ SYF_MPSAFE | AS(ibcs2_gtty_args), (sy_call_t *)ibcs2_gtty, AUE_NULL },	/* 32 = ibcs2_gtty */
-	{ SYF_MPSAFE | AS(ibcs2_access_args), (sy_call_t *)ibcs2_access, AUE_NULL },	/* 33 = ibcs2_access */
-	{ SYF_MPSAFE | AS(ibcs2_nice_args), (sy_call_t *)ibcs2_nice, AUE_NULL },	/* 34 = ibcs2_nice */
-	{ SYF_MPSAFE | AS(ibcs2_statfs_args), (sy_call_t *)ibcs2_statfs, AUE_NULL },	/* 35 = ibcs2_statfs */
-	{ SYF_MPSAFE | 0, (sy_call_t *)sync, AUE_NULL },	/* 36 = sync */
-	{ SYF_MPSAFE | AS(ibcs2_kill_args), (sy_call_t *)ibcs2_kill, AUE_NULL },	/* 37 = ibcs2_kill */
-	{ SYF_MPSAFE | AS(ibcs2_fstatfs_args), (sy_call_t *)ibcs2_fstatfs, AUE_NULL },	/* 38 = ibcs2_fstatfs */
-	{ SYF_MPSAFE | AS(ibcs2_pgrpsys_args), (sy_call_t *)ibcs2_pgrpsys, AUE_NULL },	/* 39 = ibcs2_pgrpsys */
-	{ SYF_MPSAFE | AS(ibcs2_xenix_args), (sy_call_t *)ibcs2_xenix, AUE_NULL },	/* 40 = ibcs2_xenix */
-	{ SYF_MPSAFE | AS(dup_args), (sy_call_t *)dup, AUE_NULL },	/* 41 = dup */
-	{ SYF_MPSAFE | 0, (sy_call_t *)pipe, AUE_NULL },	/* 42 = pipe */
-	{ SYF_MPSAFE | AS(ibcs2_times_args), (sy_call_t *)ibcs2_times, AUE_NULL },	/* 43 = ibcs2_times */
-	{ SYF_MPSAFE | AS(profil_args), (sy_call_t *)profil, AUE_NULL },	/* 44 = profil */
-	{ SYF_MPSAFE | AS(ibcs2_plock_args), (sy_call_t *)ibcs2_plock, AUE_NULL },	/* 45 = ibcs2_plock */
-	{ SYF_MPSAFE | AS(ibcs2_setgid_args), (sy_call_t *)ibcs2_setgid, AUE_NULL },	/* 46 = ibcs2_setgid */
-	{ SYF_MPSAFE | 0, (sy_call_t *)getgid, AUE_NULL },	/* 47 = getgid */
-	{ SYF_MPSAFE | AS(ibcs2_sigsys_args), (sy_call_t *)ibcs2_sigsys, AUE_NULL },	/* 48 = ibcs2_sigsys */
-	{ AS(ibcs2_msgsys_args), (sy_call_t *)ibcs2_msgsys, AUE_NULL },	/* 49 = ibcs2_msgsys */
-	{ SYF_MPSAFE | AS(ibcs2_sysi86_args), (sy_call_t *)ibcs2_sysi86, AUE_NULL },	/* 50 = ibcs2_sysi86 */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 51 = ibcs2_acct */
-	{ AS(ibcs2_shmsys_args), (sy_call_t *)ibcs2_shmsys, AUE_NULL },	/* 52 = ibcs2_shmsys */
-	{ AS(ibcs2_semsys_args), (sy_call_t *)ibcs2_semsys, AUE_NULL },	/* 53 = ibcs2_semsys */
-	{ AS(ibcs2_ioctl_args), (sy_call_t *)ibcs2_ioctl, AUE_NULL },	/* 54 = ibcs2_ioctl */
-	{ SYF_MPSAFE | AS(ibcs2_uadmin_args), (sy_call_t *)ibcs2_uadmin, AUE_NULL },	/* 55 = ibcs2_uadmin */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 56 = nosys */
-	{ SYF_MPSAFE | AS(ibcs2_utssys_args), (sy_call_t *)ibcs2_utssys, AUE_NULL },	/* 57 = ibcs2_utssys */
-	{ SYF_MPSAFE | AS(fsync_args), (sy_call_t *)fsync, AUE_NULL },	/* 58 = fsync */
-	{ SYF_MPSAFE | AS(ibcs2_execve_args), (sy_call_t *)ibcs2_execve, AUE_NULL },	/* 59 = ibcs2_execve */
-	{ SYF_MPSAFE | AS(umask_args), (sy_call_t *)umask, AUE_NULL },	/* 60 = umask */
-	{ SYF_MPSAFE | AS(chroot_args), (sy_call_t *)chroot, AUE_NULL },	/* 61 = chroot */
-	{ SYF_MPSAFE | AS(ibcs2_fcntl_args), (sy_call_t *)ibcs2_fcntl, AUE_NULL },	/* 62 = ibcs2_fcntl */
-	{ SYF_MPSAFE | AS(ibcs2_ulimit_args), (sy_call_t *)ibcs2_ulimit, AUE_NULL },	/* 63 = ibcs2_ulimit */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 64 = reserved for unix/pc */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 65 = reserved for unix/pc */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 66 = reserved for unix/pc */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 67 = reserved for unix/pc */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 68 = reserved for unix/pc */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 69 = reserved for unix/pc */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 70 = obsolete rfs_advfs */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 71 = obsolete rfs_unadvfs */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 72 = obsolete rfs_rmount */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 73 = obsolete rfs_rumount */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 74 = obsolete rfs_rfstart */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 75 = obsolete rfs_sigret */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 76 = obsolete rfs_rdebug */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 77 = obsolete rfs_rfstop */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 78 = rfs_rfsys */
-	{ SYF_MPSAFE | AS(ibcs2_rmdir_args), (sy_call_t *)ibcs2_rmdir, AUE_NULL },	/* 79 = ibcs2_rmdir */
-	{ SYF_MPSAFE | AS(ibcs2_mkdir_args), (sy_call_t *)ibcs2_mkdir, AUE_NULL },	/* 80 = ibcs2_mkdir */
-	{ AS(ibcs2_getdents_args), (sy_call_t *)ibcs2_getdents, AUE_NULL },	/* 81 = ibcs2_getdents */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 82 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 83 = nosys */
-	{ SYF_MPSAFE | AS(ibcs2_sysfs_args), (sy_call_t *)ibcs2_sysfs, AUE_NULL },	/* 84 = ibcs2_sysfs */
-	{ SYF_MPSAFE | AS(ibcs2_getmsg_args), (sy_call_t *)ibcs2_getmsg, AUE_NULL },	/* 85 = ibcs2_getmsg */
-	{ SYF_MPSAFE | AS(ibcs2_putmsg_args), (sy_call_t *)ibcs2_putmsg, AUE_NULL },	/* 86 = ibcs2_putmsg */
-	{ AS(ibcs2_poll_args), (sy_call_t *)ibcs2_poll, AUE_NULL },	/* 87 = ibcs2_poll */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 88 = nosys */
-	{ SYF_MPSAFE | AS(ibcs2_secure_args), (sy_call_t *)ibcs2_secure, AUE_NULL },	/* 89 = ibcs2_secure */
-	{ SYF_MPSAFE | AS(ibcs2_symlink_args), (sy_call_t *)ibcs2_symlink, AUE_NULL },	/* 90 = ibcs2_symlink */
-	{ SYF_MPSAFE | AS(ibcs2_lstat_args), (sy_call_t *)ibcs2_lstat, AUE_NULL },	/* 91 = ibcs2_lstat */
-	{ SYF_MPSAFE | AS(ibcs2_readlink_args), (sy_call_t *)ibcs2_readlink, AUE_NULL },	/* 92 = ibcs2_readlink */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 93 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 94 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 95 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 96 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 97 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 98 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 99 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 100 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 101 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 102 = nosys */
-	{ SYF_MPSAFE | AS(sigreturn_args), (sy_call_t *)sigreturn, AUE_NULL },	/* 103 = sigreturn */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 104 = nosys */
-	{ SYF_MPSAFE | 0, (sy_call_t *)ibcs2_isc, AUE_NULL },	/* 105 = ibcs2_isc */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 106 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 107 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 108 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 109 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 110 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 111 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 112 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 113 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 114 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 115 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 116 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 117 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 118 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 119 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 120 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 121 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 122 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 123 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 124 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 125 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 126 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 127 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },		/* 0 = syscall */
+	{ AS(sys_exit_args), (sy_call_t *)sys_exit, AUE_EXIT, NULL, 0, 0 },	/* 1 = exit */
+	{ 0, (sy_call_t *)fork, AUE_FORK, NULL, 0, 0 },		/* 2 = fork */
+	{ AS(ibcs2_read_args), (sy_call_t *)ibcs2_read, AUE_NULL, NULL, 0, 0 },	/* 3 = ibcs2_read */
+	{ AS(write_args), (sy_call_t *)write, AUE_NULL, NULL, 0, 0 },	/* 4 = write */
+	{ AS(ibcs2_open_args), (sy_call_t *)ibcs2_open, AUE_OPEN_RWTC, NULL, 0, 0 },	/* 5 = ibcs2_open */
+	{ AS(close_args), (sy_call_t *)close, AUE_CLOSE, NULL, 0, 0 },	/* 6 = close */
+	{ AS(ibcs2_wait_args), (sy_call_t *)ibcs2_wait, AUE_WAIT4, NULL, 0, 0 },	/* 7 = ibcs2_wait */
+	{ AS(ibcs2_creat_args), (sy_call_t *)ibcs2_creat, AUE_CREAT, NULL, 0, 0 },	/* 8 = ibcs2_creat */
+	{ AS(link_args), (sy_call_t *)link, AUE_LINK, NULL, 0, 0 },	/* 9 = link */
+	{ AS(ibcs2_unlink_args), (sy_call_t *)ibcs2_unlink, AUE_UNLINK, NULL, 0, 0 },	/* 10 = ibcs2_unlink */
+	{ AS(ibcs2_execv_args), (sy_call_t *)ibcs2_execv, AUE_EXECVE, NULL, 0, 0 },	/* 11 = ibcs2_execv */
+	{ AS(ibcs2_chdir_args), (sy_call_t *)ibcs2_chdir, AUE_CHDIR, NULL, 0, 0 },	/* 12 = ibcs2_chdir */
+	{ AS(ibcs2_time_args), (sy_call_t *)ibcs2_time, AUE_NULL, NULL, 0, 0 },	/* 13 = ibcs2_time */
+	{ AS(ibcs2_mknod_args), (sy_call_t *)ibcs2_mknod, AUE_MKNOD, NULL, 0, 0 },	/* 14 = ibcs2_mknod */
+	{ AS(ibcs2_chmod_args), (sy_call_t *)ibcs2_chmod, AUE_CHMOD, NULL, 0, 0 },	/* 15 = ibcs2_chmod */
+	{ AS(ibcs2_chown_args), (sy_call_t *)ibcs2_chown, AUE_CHOWN, NULL, 0, 0 },	/* 16 = ibcs2_chown */
+	{ AS(obreak_args), (sy_call_t *)obreak, AUE_NULL, NULL, 0, 0 },	/* 17 = obreak */
+	{ AS(ibcs2_stat_args), (sy_call_t *)ibcs2_stat, AUE_STAT, NULL, 0, 0 },	/* 18 = ibcs2_stat */
+	{ AS(ibcs2_lseek_args), (sy_call_t *)ibcs2_lseek, AUE_LSEEK, NULL, 0, 0 },	/* 19 = ibcs2_lseek */
+	{ 0, (sy_call_t *)getpid, AUE_NULL, NULL, 0, 0 },		/* 20 = getpid */
+	{ AS(ibcs2_mount_args), (sy_call_t *)ibcs2_mount, AUE_MOUNT, NULL, 0, 0 },	/* 21 = ibcs2_mount */
+	{ AS(ibcs2_umount_args), (sy_call_t *)ibcs2_umount, AUE_UMOUNT, NULL, 0, 0 },	/* 22 = ibcs2_umount */
+	{ AS(ibcs2_setuid_args), (sy_call_t *)ibcs2_setuid, AUE_SETUID, NULL, 0, 0 },	/* 23 = ibcs2_setuid */
+	{ 0, (sy_call_t *)getuid, AUE_GETUID, NULL, 0, 0 },		/* 24 = getuid */
+	{ AS(ibcs2_stime_args), (sy_call_t *)ibcs2_stime, AUE_SETTIMEOFDAY, NULL, 0, 0 },	/* 25 = ibcs2_stime */
+	{ AS(ptrace_args), (sy_call_t *)ptrace, AUE_PTRACE, NULL, 0, 0 },	/* 26 = ptrace */
+	{ AS(ibcs2_alarm_args), (sy_call_t *)ibcs2_alarm, AUE_NULL, NULL, 0, 0 },	/* 27 = ibcs2_alarm */
+	{ AS(ibcs2_fstat_args), (sy_call_t *)ibcs2_fstat, AUE_FSTAT, NULL, 0, 0 },	/* 28 = ibcs2_fstat */
+	{ 0, (sy_call_t *)ibcs2_pause, AUE_NULL, NULL, 0, 0 },	/* 29 = ibcs2_pause */
+	{ AS(ibcs2_utime_args), (sy_call_t *)ibcs2_utime, AUE_NULL, NULL, 0, 0 },	/* 30 = ibcs2_utime */
+	{ AS(ibcs2_stty_args), (sy_call_t *)ibcs2_stty, AUE_NULL, NULL, 0, 0 },	/* 31 = ibcs2_stty */
+	{ AS(ibcs2_gtty_args), (sy_call_t *)ibcs2_gtty, AUE_NULL, NULL, 0, 0 },	/* 32 = ibcs2_gtty */
+	{ AS(ibcs2_access_args), (sy_call_t *)ibcs2_access, AUE_ACCESS, NULL, 0, 0 },	/* 33 = ibcs2_access */
+	{ AS(ibcs2_nice_args), (sy_call_t *)ibcs2_nice, AUE_NICE, NULL, 0, 0 },	/* 34 = ibcs2_nice */
+	{ AS(ibcs2_statfs_args), (sy_call_t *)ibcs2_statfs, AUE_STATFS, NULL, 0, 0 },	/* 35 = ibcs2_statfs */
+	{ 0, (sy_call_t *)sync, AUE_NULL, NULL, 0, 0 },		/* 36 = sync */
+	{ AS(ibcs2_kill_args), (sy_call_t *)ibcs2_kill, AUE_KILL, NULL, 0, 0 },	/* 37 = ibcs2_kill */
+	{ AS(ibcs2_fstatfs_args), (sy_call_t *)ibcs2_fstatfs, AUE_FSTATFS, NULL, 0, 0 },	/* 38 = ibcs2_fstatfs */
+	{ AS(ibcs2_pgrpsys_args), (sy_call_t *)ibcs2_pgrpsys, AUE_NULL, NULL, 0, 0 },	/* 39 = ibcs2_pgrpsys */
+	{ AS(ibcs2_xenix_args), (sy_call_t *)ibcs2_xenix, AUE_NULL, NULL, 0, 0 },	/* 40 = ibcs2_xenix */
+	{ AS(dup_args), (sy_call_t *)dup, AUE_NULL, NULL, 0, 0 },	/* 41 = dup */
+	{ 0, (sy_call_t *)pipe, AUE_PIPE, NULL, 0, 0 },		/* 42 = pipe */
+	{ AS(ibcs2_times_args), (sy_call_t *)ibcs2_times, AUE_NULL, NULL, 0, 0 },	/* 43 = ibcs2_times */
+	{ AS(profil_args), (sy_call_t *)profil, AUE_PROFILE, NULL, 0, 0 },	/* 44 = profil */
+	{ AS(ibcs2_plock_args), (sy_call_t *)ibcs2_plock, AUE_NULL, NULL, 0, 0 },	/* 45 = ibcs2_plock */
+	{ AS(ibcs2_setgid_args), (sy_call_t *)ibcs2_setgid, AUE_SETGID, NULL, 0, 0 },	/* 46 = ibcs2_setgid */
+	{ 0, (sy_call_t *)getgid, AUE_GETGID, NULL, 0, 0 },		/* 47 = getgid */
+	{ AS(ibcs2_sigsys_args), (sy_call_t *)ibcs2_sigsys, AUE_NULL, NULL, 0, 0 },	/* 48 = ibcs2_sigsys */
+	{ AS(ibcs2_msgsys_args), (sy_call_t *)ibcs2_msgsys, AUE_MSGSYS, NULL, 0, 0 },	/* 49 = ibcs2_msgsys */
+	{ AS(ibcs2_sysi86_args), (sy_call_t *)ibcs2_sysi86, AUE_NULL, NULL, 0, 0 },	/* 50 = ibcs2_sysi86 */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 51 = ibcs2_acct */
+	{ AS(ibcs2_shmsys_args), (sy_call_t *)ibcs2_shmsys, AUE_SHMSYS, NULL, 0, 0 },	/* 52 = ibcs2_shmsys */
+	{ AS(ibcs2_semsys_args), (sy_call_t *)ibcs2_semsys, AUE_SEMSYS, NULL, 0, 0 },	/* 53 = ibcs2_semsys */
+	{ AS(ibcs2_ioctl_args), (sy_call_t *)ibcs2_ioctl, AUE_IOCTL, NULL, 0, 0 },	/* 54 = ibcs2_ioctl */
+	{ AS(ibcs2_uadmin_args), (sy_call_t *)ibcs2_uadmin, AUE_NULL, NULL, 0, 0 },	/* 55 = ibcs2_uadmin */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 56 = nosys */
+	{ AS(ibcs2_utssys_args), (sy_call_t *)ibcs2_utssys, AUE_NULL, NULL, 0, 0 },	/* 57 = ibcs2_utssys */
+	{ AS(fsync_args), (sy_call_t *)fsync, AUE_FSYNC, NULL, 0, 0 },	/* 58 = fsync */
+	{ AS(ibcs2_execve_args), (sy_call_t *)ibcs2_execve, AUE_EXECVE, NULL, 0, 0 },	/* 59 = ibcs2_execve */
+	{ AS(umask_args), (sy_call_t *)umask, AUE_UMASK, NULL, 0, 0 },	/* 60 = umask */
+	{ AS(chroot_args), (sy_call_t *)chroot, AUE_CHROOT, NULL, 0, 0 },	/* 61 = chroot */
+	{ AS(ibcs2_fcntl_args), (sy_call_t *)ibcs2_fcntl, AUE_FCNTL, NULL, 0, 0 },	/* 62 = ibcs2_fcntl */
+	{ AS(ibcs2_ulimit_args), (sy_call_t *)ibcs2_ulimit, AUE_NULL, NULL, 0, 0 },	/* 63 = ibcs2_ulimit */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 64 = reserved for unix/pc */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 65 = reserved for unix/pc */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 66 = reserved for unix/pc */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 67 = reserved for unix/pc */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 68 = reserved for unix/pc */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 69 = reserved for unix/pc */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 70 = obsolete rfs_advfs */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 71 = obsolete rfs_unadvfs */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 72 = obsolete rfs_rmount */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 73 = obsolete rfs_rumount */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 74 = obsolete rfs_rfstart */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 75 = obsolete rfs_sigret */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 76 = obsolete rfs_rdebug */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 77 = obsolete rfs_rfstop */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 78 = rfs_rfsys */
+	{ AS(ibcs2_rmdir_args), (sy_call_t *)ibcs2_rmdir, AUE_RMDIR, NULL, 0, 0 },	/* 79 = ibcs2_rmdir */
+	{ AS(ibcs2_mkdir_args), (sy_call_t *)ibcs2_mkdir, AUE_MKDIR, NULL, 0, 0 },	/* 80 = ibcs2_mkdir */
+	{ AS(ibcs2_getdents_args), (sy_call_t *)ibcs2_getdents, AUE_GETDIRENTRIES, NULL, 0, 0 },	/* 81 = ibcs2_getdents */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 82 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 83 = nosys */
+	{ AS(ibcs2_sysfs_args), (sy_call_t *)ibcs2_sysfs, AUE_NULL, NULL, 0, 0 },	/* 84 = ibcs2_sysfs */
+	{ AS(ibcs2_getmsg_args), (sy_call_t *)ibcs2_getmsg, AUE_GETMSG, NULL, 0, 0 },	/* 85 = ibcs2_getmsg */
+	{ AS(ibcs2_putmsg_args), (sy_call_t *)ibcs2_putmsg, AUE_PUTMSG, NULL, 0, 0 },	/* 86 = ibcs2_putmsg */
+	{ AS(poll_args), (sy_call_t *)poll, AUE_POLL, NULL, 0, 0 },	/* 87 = poll */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 88 = nosys */
+	{ AS(ibcs2_secure_args), (sy_call_t *)ibcs2_secure, AUE_NULL, NULL, 0, 0 },	/* 89 = ibcs2_secure */
+	{ AS(ibcs2_symlink_args), (sy_call_t *)ibcs2_symlink, AUE_SYMLINK, NULL, 0, 0 },	/* 90 = ibcs2_symlink */
+	{ AS(ibcs2_lstat_args), (sy_call_t *)ibcs2_lstat, AUE_LSTAT, NULL, 0, 0 },	/* 91 = ibcs2_lstat */
+	{ AS(ibcs2_readlink_args), (sy_call_t *)ibcs2_readlink, AUE_READLINK, NULL, 0, 0 },	/* 92 = ibcs2_readlink */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 93 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 94 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 95 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 96 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 97 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 98 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 99 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 100 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 101 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 102 = nosys */
+	{ AS(sigreturn_args), (sy_call_t *)sigreturn, AUE_NULL, NULL, 0, 0 },	/* 103 = sigreturn */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 104 = nosys */
+	{ 0, (sy_call_t *)ibcs2_isc, AUE_NULL, NULL, 0, 0 },		/* 105 = ibcs2_isc */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 106 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 107 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 108 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 109 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 110 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 111 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 112 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 113 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 114 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 115 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 116 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 117 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 118 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 119 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 120 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 121 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 122 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 123 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 124 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 125 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 126 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 127 = nosys */
 };
Index: syscalls.xenix
===================================================================
RCS file: /home/cvs/src/sys/i386/ibcs2/syscalls.xenix,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/i386/ibcs2/syscalls.xenix -L sys/i386/ibcs2/syscalls.xenix -u -r1.1.1.1 -r1.2
--- sys/i386/ibcs2/syscalls.xenix
+++ sys/i386/ibcs2/syscalls.xenix
@@ -1,4 +1,4 @@
- $FreeBSD: src/sys/i386/ibcs2/syscalls.xenix,v 1.9.2.1 2005/07/20 17:42:15 jhb Exp $
+ $FreeBSD: src/sys/i386/ibcs2/syscalls.xenix,v 1.14 2006/07/28 19:05:27 jhb Exp $
 
 #include <sys/param.h>
 #include <sys/sysent.h>
@@ -17,9 +17,9 @@
 7	AUE_NULL	STD	{ int xenix_rdchk(int fd); }
 8	AUE_NULL	UNIMPL	nosys
 9	AUE_NULL	UNIMPL	nosys
-10	AUE_NULL	MSTD	{ int xenix_chsize(int fd, long size); }
-11	AUE_NULL	MSTD	{ int xenix_ftime(struct timeb *tp); }
-12	AUE_NULL	MSTD	{ int xenix_nap(int millisec); }
+10	AUE_FTRUNCATE	STD	{ int xenix_chsize(int fd, long size); }
+11	AUE_NULL	STD	{ int xenix_ftime(struct timeb *tp); }
+12	AUE_NULL	STD	{ int xenix_nap(int millisec); }
 13	AUE_NULL	UNIMPL	xenix_sdget
 14	AUE_NULL	UNIMPL	xenix_sdfree
 15	AUE_NULL	UNIMPL	xenix_sdenter
@@ -28,7 +28,7 @@
 18	AUE_NULL	UNIMPL	xenix_sdwaitv
 19	AUE_NULL	UNIMPL	nosys
 20	AUE_NULL	UNIMPL	nosys
-21	AUE_NULL	MSTD	{ int xenix_scoinfo(void); }
+21	AUE_NULL	STD	{ int xenix_scoinfo(void); }
 22	AUE_NULL	UNIMPL	nosys
 23	AUE_NULL	UNIMPL	nosys
 24	AUE_NULL	UNIMPL	nosys
@@ -43,35 +43,35 @@
 33	AUE_NULL	UNIMPL	xenix_execseg
 34	AUE_NULL	UNIMPL	xenix_unexecseg
 35	AUE_NULL	UNIMPL	nosys
-36	AUE_NULL	MNOPROTO	{ int select(u_int nd, fd_set *in, \
+36	AUE_SELECT	NOPROTO	{ int select(u_int nd, fd_set *in, \
 				    fd_set *ou, fd_set *ex, \
 				    struct timeval *tv); }
-37	AUE_NULL	MSTD	{ int xenix_eaccess(char *path, int flags); }
+37	AUE_EACCESS	STD	{ int xenix_eaccess(char *path, int flags); }
 38	AUE_NULL	UNIMPL	xenix_paccess
-39	AUE_NULL	MSTD	{ int ibcs2_sigaction(int sig, \
+39	AUE_NULL	STD	{ int ibcs2_sigaction(int sig, \
 				    struct ibcs2_sigaction *act, \
 				    struct ibcs2_sigaction *oact); }
-40	AUE_NULL	MSTD	{ int ibcs2_sigprocmask(int how, \
+40	AUE_NULL	STD	{ int ibcs2_sigprocmask(int how, \
 				    ibcs2_sigset_t *set, \
 				    ibcs2_sigset_t *oset); }
-41	AUE_NULL	MSTD	{ int ibcs2_sigpending(ibcs2_sigset_t *mask); }
-42	AUE_NULL	MSTD	{ int ibcs2_sigsuspend(ibcs2_sigset_t *mask); }
-43	AUE_NULL	STD	{ int ibcs2_getgroups(int gidsetsize, \
+41	AUE_NULL	STD	{ int ibcs2_sigpending(ibcs2_sigset_t *mask); }
+42	AUE_NULL	STD	{ int ibcs2_sigsuspend(ibcs2_sigset_t *mask); }
+43	AUE_GETGROUPS	STD	{ int ibcs2_getgroups(int gidsetsize, \
 				    ibcs2_gid_t *gidset); }
-44	AUE_NULL	STD	{ int ibcs2_setgroups(int gidsetsize, \
+44	AUE_SETGROUPS	STD	{ int ibcs2_setgroups(int gidsetsize, \
 				    ibcs2_gid_t *gidset); }
-45	AUE_NULL	MSTD	{ int ibcs2_sysconf(int name); }
-46	AUE_NULL	MSTD	{ int ibcs2_pathconf(char *path, int name); }
-47	AUE_NULL	MSTD	{ int ibcs2_fpathconf(int fd, int name); }
-48	AUE_NULL	MSTD	{ int ibcs2_rename(char *from, char *to); }
+45	AUE_NULL	STD	{ int ibcs2_sysconf(int name); }
+46	AUE_PATHCONF	STD	{ int ibcs2_pathconf(char *path, int name); }
+47	AUE_FPATHCONF	STD	{ int ibcs2_fpathconf(int fd, int name); }
+48	AUE_RENAME	STD	{ int ibcs2_rename(char *from, char *to); }
 49	AUE_NULL	UNIMPL	nosys
-50	AUE_NULL	MSTD	{ int xenix_utsname(long addr); }
+50	AUE_NULL	STD	{ int xenix_utsname(long addr); }
 51	AUE_NULL	UNIMPL	nosys
 52	AUE_NULL	UNIMPL	nosys
 53	AUE_NULL	UNIMPL	nosys
 54	AUE_NULL	UNIMPL	nosys
-55	AUE_NULL	MNOPROTO	{ int getitimer(u_int which, \
+55	AUE_GETITIMER	NOPROTO	{ int getitimer(u_int which, \
 				    struct itimerval *itv); }
-56	AUE_NULL	MNOPROTO	{ int setitimer(u_int which, \
+56	AUE_SETITIMER	NOPROTO	{ int setitimer(u_int which, \
 				    struct itimerval *itv, \
 				    struct itimerval *otv); }
Index: imgact_coff.c
===================================================================
RCS file: /home/cvs/src/sys/i386/ibcs2/imgact_coff.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/i386/ibcs2/imgact_coff.c -L sys/i386/ibcs2/imgact_coff.c -u -r1.1.1.1 -r1.2
--- sys/i386/ibcs2/imgact_coff.c
+++ sys/i386/ibcs2/imgact_coff.c
@@ -28,10 +28,11 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/ibcs2/imgact_coff.c,v 1.65 2005/04/27 09:05:19 jeff Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/ibcs2/imgact_coff.c,v 1.67.4.1 2008/01/19 18:15:03 kib Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
+#include <sys/exec.h>
 #include <sys/fcntl.h>
 #include <sys/imgact.h>
 #include <sys/kernel.h>
@@ -203,7 +204,7 @@
   	if ((error = VOP_ACCESS(vp, VEXEC, td->td_ucred, td)) != 0)
     		goto fail;
 
-  	if ((error = VOP_OPEN(vp, FREAD, td->td_ucred, td, -1)) != 0)
+  	if ((error = VOP_OPEN(vp, FREAD, td->td_ucred, td, NULL)) != 0)
     		goto fail;
 
 	/*
@@ -336,7 +337,9 @@
 
 	VOP_UNLOCK(imgp->vp, 0, td);
 
-	exec_new_vmspace(imgp, &ibcs2_svr3_sysvec);
+	error = exec_new_vmspace(imgp, &ibcs2_svr3_sysvec);
+	if (error)
+		goto fail;
 	vmspace = imgp->proc->p_vmspace;
 
 	for (i = 0; i < nscns; i++) {
Index: ibcs2_ipc.c
===================================================================
RCS file: /home/cvs/src/sys/i386/ibcs2/ibcs2_ipc.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/i386/ibcs2/ibcs2_ipc.c -L sys/i386/ibcs2/ibcs2_ipc.c -u -r1.1.1.1 -r1.2
--- sys/i386/ibcs2/ibcs2_ipc.c
+++ sys/i386/ibcs2/ibcs2_ipc.c
@@ -24,13 +24,14 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/ibcs2/ibcs2_ipc.c,v 1.22 2005/01/06 23:22:04 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/ibcs2/ibcs2_ipc.c,v 1.24 2006/07/08 19:54:12 jhb Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/msg.h>
 #include <sys/sem.h>
 #include <sys/shm.h>
+#include <sys/syscallsubr.h>
 #include <sys/sysproto.h>
 
 #include <i386/ibcs2/ibcs2_types.h>
@@ -102,50 +103,118 @@
 	return;
 }
 
+struct ibcs2_msgget_args {
+	int what;
+	ibcs2_key_t key;
+	int msgflg;
+};
+
+static int
+ibcs2_msgget(struct thread *td, void *v)
+{
+	struct ibcs2_msgget_args *uap = v;
+	struct msgget_args ap;
+
+	ap.key = uap->key;
+	ap.msgflg = uap->msgflg;
+	return msgget(td, &ap);
+}
+
+struct ibcs2_msgctl_args {
+	int what;
+	int msqid;
+	int cmd;
+	struct ibcs2_msqid_ds *buf;
+};
+
+static int
+ibcs2_msgctl(struct thread *td, void *v)
+{
+	struct ibcs2_msgctl_args *uap = v;
+	struct ibcs2_msqid_ds is;
+	struct msqid_ds bs;
+	int error;
+
+	switch (uap->cmd) {
+	case IBCS2_IPC_STAT:
+		error = kern_msgctl(td, uap->msqid, IPC_STAT, &bs);
+		if (!error) {
+			cvt_msqid2imsqid(&bs, &is);
+			error = copyout(&is, uap->buf, sizeof(is));
+		}
+		return (error);
+	case IBCS2_IPC_SET:
+		error = copyin(uap->buf, &is, sizeof(is));
+		if (error)
+			return (error);
+		cvt_imsqid2msqid(&is, &bs);
+		return (kern_msgctl(td, uap->msqid, IPC_SET, &bs));
+	case IBCS2_IPC_RMID:
+		return (kern_msgctl(td, uap->msqid, IPC_RMID, NULL));
+	}
+	return (EINVAL);
+}
+
+struct ibcs2_msgrcv_args {
+	int what;
+	int msqid;
+	void *msgp;
+	size_t msgsz;
+	long msgtyp;
+	int msgflg;
+};
+
+static int
+ibcs2_msgrcv(struct thread *td, void *v)
+{
+	struct ibcs2_msgrcv_args *uap = v;
+	struct msgrcv_args ap;
+
+	ap.msqid = uap->msqid;
+	ap.msgp = uap->msgp;
+	ap.msgsz = uap->msgsz;
+	ap.msgtyp = uap->msgtyp;
+	ap.msgflg = uap->msgflg;
+	return (msgrcv(td, &ap));
+}
+
+struct ibcs2_msgsnd_args {
+	int what;
+	int msqid;
+	void *msgp;
+	size_t msgsz;
+	int msgflg;
+};
+
+static int
+ibcs2_msgsnd(struct thread *td, void *v)
+{
+	struct ibcs2_msgsnd_args *uap = v;
+	struct msgsnd_args ap;
+
+	ap.msqid = uap->msqid;
+	ap.msgp = uap->msgp;
+	ap.msgsz = uap->msgsz;
+	ap.msgflg = uap->msgflg;
+	return (msgsnd(td, &ap));
+}
+
 int
 ibcs2_msgsys(td, uap)
 	struct thread *td;
 	struct ibcs2_msgsys_args *uap;
 {
 	switch (uap->which) {
-	case 0:				/* msgget */
-		uap->which = 1;
-		return msgsys(td, (struct msgsys_args *)uap);
-	case 1: {			/* msgctl */
-		int error;
-		struct msgsys_args margs;
-		caddr_t sg = stackgap_init();
-
-		margs.which = 0;
-		margs.a2 = uap->a2;
-		margs.a4 =
-		    (int)stackgap_alloc(&sg, sizeof(struct msqid_ds));
-		margs.a3 = uap->a3;
-		switch (margs.a3) {
-		case IBCS2_IPC_STAT:
-			error = msgsys(td, &margs);
-			if (!error)
-				cvt_msqid2imsqid(
-				    (struct msqid_ds *)margs.a4,
-				    (struct ibcs2_msqid_ds *)uap->a4);
-			return error;
-		case IBCS2_IPC_SET:
-			cvt_imsqid2msqid((struct ibcs2_msqid_ds *)uap->a4,
-					 (struct msqid_ds *)margs.a4);
-			return msgsys(td, &margs);
-		case IBCS2_IPC_RMID:
-			return msgsys(td, &margs);
-		}
-		return EINVAL;
-	}
-	case 2:				/* msgrcv */
-		uap->which = 3;
-		return msgsys(td, (struct msgsys_args *)uap);
-	case 3:				/* msgsnd */
-		uap->which = 2;
-		return msgsys(td, (struct msgsys_args *)uap);
+	case 0:
+		return (ibcs2_msgget(td, uap));
+	case 1:
+		return (ibcs2_msgctl(td, uap));
+	case 2:
+		return (ibcs2_msgrcv(td, uap));
+	case 3:
+		return (ibcs2_msgsnd(td, uap));
 	default:
-		return EINVAL;
+		return (EINVAL);
 	}
 }
 
@@ -232,77 +301,104 @@
 	return;
 }
 
+struct ibcs2_semctl_args {
+	int what;
+	int semid;
+	int semnum;
+	int cmd;
+	union semun arg;
+};
+
+static int
+ibcs2_semctl(struct thread *td, void *v)
+{
+	struct ibcs2_semctl_args *uap = v;
+	struct ibcs2_semid_ds is;
+	struct semid_ds bs;
+	union semun semun;
+	register_t rval;
+	int error;
+
+	switch(uap->cmd) {
+	case IBCS2_IPC_STAT:
+		semun.buf = &bs;
+		error = kern_semctl(td, uap->semid, uap->semnum, IPC_STAT,
+		    &semun, &rval);
+		if (error)
+			return (error);
+		cvt_semid2isemid(&bs, &is);
+		error = copyout(&is, uap->arg.buf, sizeof(is));
+		if (error == 0)
+			td->td_retval[0] = rval;
+		return (error);
+
+	case IBCS2_IPC_SET:
+		error = copyin(uap->arg.buf, &is, sizeof(is));
+		if (error)
+			return (error);
+		cvt_isemid2semid(&is, &bs);
+		semun.buf = &bs;
+		return (kern_semctl(td, uap->semid, uap->semnum, IPC_SET,
+		    &semun, td->td_retval));
+	}
+
+	return (kern_semctl(td, uap->semid, uap->semnum, uap->cmd, &uap->arg,
+	    td->td_retval));
+}
+
+struct ibcs2_semget_args {
+	int what;
+	ibcs2_key_t key;
+	int nsems;
+	int semflg;
+};
+
+static int
+ibcs2_semget(struct thread *td, void *v)
+{
+	struct ibcs2_semget_args *uap = v;
+	struct semget_args ap;
+
+	ap.key = uap->key;
+	ap.nsems = uap->nsems;
+	ap.semflg = uap->semflg;
+	return (semget(td, &ap));
+}
+
+struct ibcs2_semop_args {
+	int what;
+	int semid;
+	struct sembuf *sops;
+	size_t nsops;
+};
+
+static int
+ibcs2_semop(struct thread *td, void *v)
+{
+	struct ibcs2_semop_args *uap = v;
+	struct semop_args ap;
+
+	ap.semid = uap->semid;
+	ap.sops = uap->sops;
+	ap.nsops = uap->nsops;
+	return (semop(td, &ap));
+}
+
 int
 ibcs2_semsys(td, uap)
 	struct thread *td;
 	struct ibcs2_semsys_args *uap;
 {
-	int error;
 
 	switch (uap->which) {
-	case 0:					/* semctl */
-		switch(uap->a4) {
-		case IBCS2_IPC_STAT:
-		    {
-			struct ibcs2_semid_ds *isp;
-			struct semid_ds *sp;
-			union semun *sup, ssu;
-			caddr_t sg = stackgap_init();
-
-
-			ssu = (union semun) uap->a5;
-			sp = stackgap_alloc(&sg, sizeof(struct semid_ds));
-			sup = stackgap_alloc(&sg, sizeof(union semun));
-			sup->buf = sp;
-			uap->a5 = (int)sup;
-			error = semsys(td, (struct semsys_args *)uap);
-			if (!error) {
-				uap->a5 = (int)ssu.buf;
-				isp = stackgap_alloc(&sg, sizeof(*isp));
-				cvt_semid2isemid(sp, isp);
-				error = copyout((caddr_t)isp,
-						(caddr_t)ssu.buf,
-						sizeof(*isp));
-			}
-			return error;
-		    }
-		case IBCS2_IPC_SET:
-		    {
-			struct ibcs2_semid_ds *isp;
-			struct semid_ds *sp;
-			caddr_t sg = stackgap_init();
-
-			isp = stackgap_alloc(&sg, sizeof(*isp));
-			sp = stackgap_alloc(&sg, sizeof(*sp));
-			error = copyin((caddr_t)uap->a5, (caddr_t)isp,
-				       sizeof(*isp));
-			if (error)
-				return error;
-			cvt_isemid2semid(isp, sp);
-			uap->a5 = (int)sp;
-			return semsys(td, (struct semsys_args *)uap);
-		    }
-		case IBCS2_SETVAL:
-		    {
-			union semun *sp;
-			caddr_t sg = stackgap_init();
-
-			sp = stackgap_alloc(&sg, sizeof(*sp));
-			sp->val = (int) uap->a5;
-			uap->a5 = (int)sp;
-			return semsys(td, (struct semsys_args *)uap);
-		    }
-		}
-
-		return semsys(td, (struct semsys_args *)uap);
-
-	case 1:				/* semget */
-		return semsys(td, (struct semsys_args *)uap);
-
-	case 2:				/* semop */
-		return semsys(td, (struct semsys_args *)uap);
+	case 0:
+		return (ibcs2_semctl(td, uap));
+	case 1:
+		return (ibcs2_semget(td, uap));
+	case 2:
+		return (ibcs2_semop(td, uap));
 	}
-	return EINVAL;
+	return (EINVAL);
 }
 
 
@@ -344,64 +440,118 @@
 	return;
 }
 
+struct ibcs2_shmat_args {
+	int what;
+	int shmid;
+	const void *shmaddr;
+	int shmflg;
+};
+
+static int
+ibcs2_shmat(struct thread *td, void *v)
+{
+	struct ibcs2_shmat_args *uap = v;
+	struct shmat_args ap;
+
+	ap.shmid = uap->shmid;
+	ap.shmaddr = uap->shmaddr;
+	ap.shmflg = uap->shmflg;
+	return (shmat(td, &ap));
+}
+
+struct ibcs2_shmctl_args {
+	int what;
+	int shmid;
+	int cmd;
+	struct ibcs2_shmid_ds *buf;
+};
+
+static int
+ibcs2_shmctl(struct thread *td, void *v)
+{
+	struct ibcs2_shmctl_args *uap = v;
+	struct ibcs2_shmid_ds is;
+	struct shmid_ds bs;
+	int error;
+
+	switch(uap->cmd) {
+	case IBCS2_IPC_STAT:
+		error = kern_shmctl(td, uap->shmid, IPC_STAT, &bs, NULL);
+		if (error)
+			return (error);
+		cvt_shmid2ishmid(&bs, &is);
+		return (copyout(&is, uap->buf, sizeof(is)));
+
+	case IBCS2_IPC_SET:
+		error = copyin(uap->buf, &is, sizeof(is));
+		if (error)
+			return (error);
+		cvt_ishmid2shmid(&is, &bs);
+		return (kern_shmctl(td, uap->shmid, IPC_SET, &bs, NULL));
+
+	case IPC_INFO:
+	case SHM_INFO:
+	case SHM_STAT:
+		/* XXX: */
+		return (EINVAL);
+	}
+
+	return (kern_shmctl(td, uap->shmid, uap->cmd, NULL, NULL));
+}
+
+struct ibcs2_shmdt_args {
+	int what;
+	const void *shmaddr;
+};
+
+static int
+ibcs2_shmdt(struct thread *td, void *v)
+{
+	struct ibcs2_shmdt_args *uap = v;
+	struct shmdt_args ap;
+
+	ap.shmaddr = uap->shmaddr;
+	return (shmdt(td, &ap));
+}
+
+struct ibcs2_shmget_args {
+	int what;
+	ibcs2_key_t key;
+	size_t size;
+	int shmflg;
+};
+
+static int
+ibcs2_shmget(struct thread *td, void *v)
+{
+	struct ibcs2_shmget_args *uap = v;
+	struct shmget_args ap;
+
+	ap.key = uap->key;
+	ap.size = uap->size;
+	ap.shmflg = uap->shmflg;
+	return (shmget(td, &ap));
+}
+
 int
 ibcs2_shmsys(td, uap)
 	struct thread *td;
 	struct ibcs2_shmsys_args *uap;
 {
-	int error;
 
 	switch (uap->which) {
-	case 0:						/* shmat */
-		return shmsys(td, (struct shmsys_args *)uap);
-
-	case 1:						/* shmctl */
-		switch(uap->a3) {
-		case IBCS2_IPC_STAT:
-		    {
-			struct ibcs2_shmid_ds *isp;
-			struct shmid_ds *sp;
-			caddr_t sg = stackgap_init();
-
-			isp = (struct ibcs2_shmid_ds *)uap->a4;
-			sp = stackgap_alloc(&sg, sizeof(*sp));
-			uap->a4 = (int)sp;
-			error = shmsys(td, (struct shmsys_args *)uap);
-			if (!error) {
-				uap->a4 = (int)isp;
-				isp = stackgap_alloc(&sg, sizeof(*isp));
-				cvt_shmid2ishmid(sp, isp);
-				error = copyout((caddr_t)isp,
-						(caddr_t)uap->a4,
-						sizeof(*isp));
-			}
-			return error;
-		    }
-		case IBCS2_IPC_SET:
-		    {
-			struct ibcs2_shmid_ds *isp;
-			struct shmid_ds *sp;
-			caddr_t sg = stackgap_init();
-
-			isp = stackgap_alloc(&sg, sizeof(*isp));
-			sp = stackgap_alloc(&sg, sizeof(*sp));
-			error = copyin((caddr_t)uap->a4, (caddr_t)isp,
-				       sizeof(*isp));
-			if (error)
-				return error;
-			cvt_ishmid2shmid(isp, sp);
-			uap->a4 = (int)sp;
-			return shmsys(td, (struct shmsys_args *)uap);
-		    }
-		}
-
-		return shmsys(td, (struct shmsys_args *)uap);
-
-	case 2:						/* shmdt */
-		return shmsys(td, (struct shmsys_args *)uap);
-
-	case 3:						/* shmget */
-		return shmsys(td, (struct shmsys_args *)uap);
+	case 0:
+		return (ibcs2_shmat(td, uap));
+	case 1:
+		return (ibcs2_shmctl(td, uap));
+	case 2:
+		return (ibcs2_shmdt(td, uap));
+	case 3:
+		return (ibcs2_shmget(td, uap));
 	}
-	return EINVAL;
+	return (EINVAL);
 }
+
+MODULE_DEPEND(ibcs2, sysvmsg, 1, 1, 1);
+MODULE_DEPEND(ibcs2, sysvsem, 1, 1, 1);
+MODULE_DEPEND(ibcs2, sysvshm, 1, 1, 1);
Index: ibcs2_isc.c
===================================================================
RCS file: /home/cvs/src/sys/i386/ibcs2/ibcs2_isc.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/i386/ibcs2/ibcs2_isc.c -L sys/i386/ibcs2/ibcs2_isc.c -u -r1.1.1.1 -r1.2
--- sys/i386/ibcs2/ibcs2_isc.c
+++ sys/i386/ibcs2/ibcs2_isc.c
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/ibcs2/ibcs2_isc.c,v 1.18 2005/07/07 19:28:55 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/ibcs2/ibcs2_isc.c,v 1.19 2006/07/28 19:05:27 jhb Exp $");
 
 #include <sys/param.h>
 #include <sys/lock.h>
@@ -58,13 +58,9 @@
 	code = (tf->tf_eax & 0xffffff00) >> 8;
 	callp = &isc_sysent[code];
 
-	if (code < IBCS2_ISC_MAXSYSCALL) {
-		if ((callp->sy_narg & SYF_MPSAFE) == 0)
-			mtx_lock(&Giant);
+	if (code < IBCS2_ISC_MAXSYSCALL)
 		error = (*callp->sy_call)(td, (void *)uap);
-		if ((callp->sy_narg & SYF_MPSAFE) == 0)
-			mtx_unlock(&Giant);
-	} else
+	else
 		error = ENOSYS;
 	return (error);
 }
Index: ibcs2_misc.c
===================================================================
RCS file: /home/cvs/src/sys/i386/ibcs2/ibcs2_misc.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/i386/ibcs2/ibcs2_misc.c -L sys/i386/ibcs2/ibcs2_misc.c -u -r1.1.1.1 -r1.2
--- sys/i386/ibcs2/ibcs2_misc.c
+++ sys/i386/ibcs2/ibcs2_misc.c
@@ -47,7 +47,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/ibcs2/ibcs2_misc.c,v 1.61 2005/07/07 19:29:42 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/ibcs2/ibcs2_misc.c,v 1.67 2007/03/26 15:39:49 jhb Exp $");
 
 /*
  * IBCS2 compatibility module.
@@ -65,10 +65,10 @@
 #include <sys/imgact.h>
 #include <sys/kernel.h>
 #include <sys/lock.h>
-#include <sys/mac.h>
 #include <sys/malloc.h>
 #include <sys/file.h>			/* Must come after sys/malloc.h */
 #include <sys/mutex.h>
+#include <sys/priv.h>
 #include <sys/reboot.h>
 #include <sys/resourcevar.h>
 #include <sys/stat.h>
@@ -90,6 +90,8 @@
 #include <i386/ibcs2/ibcs2_utime.h>
 #include <i386/ibcs2/ibcs2_xenix.h>
 
+#include <security/mac/mac_framework.h>
+
 int
 ibcs2_ulimit(td, uap)
 	struct thread *td;
@@ -207,7 +209,6 @@
 	free(path, M_TEMP);
 	if (error == 0)
 		error = kern_execve(td, &eargs, NULL);
-	exec_free_args(&eargs);
 	return (error);
 }
 
@@ -227,7 +228,6 @@
 	free(path, M_TEMP);
 	if (error == 0)
 		error = kern_execve(td, &eargs, NULL);
-	exec_free_args(&eargs);
 	return (error);
 }
 
@@ -331,7 +331,7 @@
 	struct iovec aiov;
 	struct ibcs2_dirent idb;
 	off_t off;			/* true file offset */
-	int buflen, error, eofflag;
+	int buflen, error, eofflag, vfslocked;
 	u_long *cookies = NULL, *cookiep;
 	int ncookies;
 #define	BSD_DIRENT(cp)		((struct dirent *)(cp))
@@ -344,7 +344,9 @@
 		return (EBADF);
 	}
 	vp = fp->f_vnode;
+	vfslocked = VFS_LOCK_GIANT(vp->v_mount);
 	if (vp->v_type != VDIR) {	/* XXX  vnode readdir op should do this */
+		VFS_UNLOCK_GIANT(vfslocked);
 		fdrop(fp, td);
 		return (EINVAL);
 	}
@@ -461,6 +463,7 @@
 	td->td_retval[0] = uap->nbytes - resid;
 out:
 	VOP_UNLOCK(vp, 0, td);
+	VFS_UNLOCK_GIANT(vfslocked);
 	fdrop(fp, td);
 	if (cookies)
 		free(cookies, M_TEMP);
@@ -486,7 +489,7 @@
 		char name[14];
 	} idb;
 	off_t off;			/* true file offset */
-	int buflen, error, eofflag, size;
+	int buflen, error, eofflag, size, vfslocked;
 	u_long *cookies = NULL, *cookiep;
 	int ncookies;
 
@@ -501,7 +504,9 @@
 		return (EBADF);
 	}
 	vp = fp->f_vnode;
+	vfslocked = VFS_LOCK_GIANT(vp->v_mount);
 	if (vp->v_type != VDIR) {
+		VFS_UNLOCK_GIANT(vfslocked);
 		fdrop(fp, td);
 		return read(td, (struct read_args *)uap);
 	}
@@ -624,6 +629,7 @@
 	td->td_retval[0] = uap->nbytes - resid;
 out:
 	VOP_UNLOCK(vp, 0, td);
+	VFS_UNLOCK_GIANT(vfslocked);
 	fdrop(fp, td);
 	if (cookies)
 		free(cookies, M_TEMP);
@@ -653,35 +659,25 @@
 	struct thread *td;
 	struct ibcs2_getgroups_args *uap;
 {
-	int error, i;
-	ibcs2_gid_t *iset = NULL;
-	struct getgroups_args sa;
-	gid_t *gp;
-	caddr_t sg = stackgap_init();
+	ibcs2_gid_t iset[NGROUPS_MAX];
+	gid_t gp[NGROUPS_MAX];
+	u_int i, ngrp;
+	int error;
 
 	if (uap->gidsetsize < 0)
 		return (EINVAL);
-	if (uap->gidsetsize > NGROUPS_MAX)
-		uap->gidsetsize = NGROUPS_MAX;
-	sa.gidsetsize = uap->gidsetsize;
-	if (uap->gidsetsize) {
-		sa.gidset = stackgap_alloc(&sg, NGROUPS_MAX *
-						    sizeof(gid_t *));
-		iset = stackgap_alloc(&sg, uap->gidsetsize *
-				      sizeof(ibcs2_gid_t));
+	ngrp = MIN(uap->gidsetsize, NGROUPS_MAX);
+	error = kern_getgroups(td, &ngrp, gp);
+	if (error)
+		return (error);
+	if (uap->gidsetsize > 0) {
+		for (i = 0; i < ngrp; i++)
+			iset[i] = (ibcs2_gid_t)gp[i];
+		error = copyout(iset, uap->gidset, ngrp * sizeof(ibcs2_gid_t));
 	}
-	if ((error = getgroups(td, &sa)) != 0)
-		return error;
-	if (uap->gidsetsize == 0)
-		return 0;
-
-	for (i = 0, gp = sa.gidset; i < td->td_retval[0]; i++)
-		iset[i] = (ibcs2_gid_t)*gp++;
-	if (td->td_retval[0] && (error = copyout((caddr_t)iset,
-					  (caddr_t)uap->gidset,
-					  sizeof(ibcs2_gid_t) * td->td_retval[0])))
-		return error;
-        return 0;
+	if (error == 0)
+		td->td_retval[0] = ngrp;
+	return (error);
 }
 
 int
@@ -689,28 +685,21 @@
 	struct thread *td;
 	struct ibcs2_setgroups_args *uap;
 {
+	ibcs2_gid_t iset[NGROUPS_MAX];
+	gid_t gp[NGROUPS_MAX];
 	int error, i;
-	ibcs2_gid_t *iset;
-	struct setgroups_args sa;
-	gid_t *gp;
-	caddr_t sg = stackgap_init();
 
 	if (uap->gidsetsize < 0 || uap->gidsetsize > NGROUPS_MAX)
 		return (EINVAL);
-	sa.gidsetsize = uap->gidsetsize;
-	sa.gidset = stackgap_alloc(&sg, sa.gidsetsize *
-					    sizeof(gid_t *));
-	iset = stackgap_alloc(&sg, sa.gidsetsize *
-			      sizeof(ibcs2_gid_t *));
-	if (sa.gidsetsize) {
-		if ((error = copyin((caddr_t)uap->gidset, (caddr_t)iset, 
-				   sizeof(ibcs2_gid_t *) *
-				   uap->gidsetsize)) != 0)
-			return error;
+	if (uap->gidsetsize && uap->gidset) {
+		error = copyin(uap->gidset, iset, sizeof(ibcs2_gid_t) *
+		    uap->gidsetsize);
+		if (error)
+			return (error);
+		for (i = 0; i < uap->gidsetsize; i++)
+			gp[i] = (gid_t)iset[i];
 	}
-	for (i = 0, gp = sa.gidset; i < sa.gidsetsize; i++)
-		*gp++ = (gid_t)iset[i];
-	return setgroups(td, &sa);
+	return (kern_setgroups(td, uap->gidsetsize, gp));
 }
 
 int
@@ -1020,14 +1009,22 @@
 #define IBCS2_DATALOCK	4
 
 	
-        if ((error = suser(td)) != 0)
-                return EPERM;
 	switch(uap->cmd) {
 	case IBCS2_UNLOCK:
+        	error = priv_check(td, PRIV_VM_MUNLOCK);
+		if (error)
+			return (error);
+		/* XXX - TODO */
+		return (0);
+
 	case IBCS2_PROCLOCK:
 	case IBCS2_TEXTLOCK:
 	case IBCS2_DATALOCK:
-		return 0;	/* XXX - TODO */
+        	error = priv_check(td, PRIV_VM_MLOCK);
+		if (error)
+			return (error);
+		/* XXX - TODO */
+		return 0;
 	}
 	return EINVAL;
 }
@@ -1055,9 +1052,6 @@
 #define SCO_AD_GETBMAJ      0
 #define SCO_AD_GETCMAJ      1
 
-        if (suser(td))
-                return EPERM;
-
 	switch(uap->cmd) {
 	case SCO_A_REBOOT:
 	case SCO_A_SHUTDOWN:
@@ -1067,11 +1061,11 @@
 		case SCO_AD_PWRDOWN:
 		case SCO_AD_PWRNAP:
 			r.opt = RB_HALT;
-			reboot(td, &r);
+			return (reboot(td, &r));
 		case SCO_AD_BOOT:
 		case SCO_AD_IBOOT:
 			r.opt = RB_AUTOBOOT;
-			reboot(td, &r);
+			return (reboot(td, &r));
 		}
 		return EINVAL;
 	case SCO_A_REMOUNT:
@@ -1226,7 +1220,7 @@
 	 * errors.
 	 */
 	error = ibcs2_emul_find(td, uap->to, UIO_USERSPACE, &to, 1);
-	if (link == NULL) {
+	if (to == NULL) {
 		free(from, M_TEMP);
 		return (error);
 	}
Index: ibcs2_other.c
===================================================================
RCS file: /home/cvs/src/sys/i386/ibcs2/ibcs2_other.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/i386/ibcs2/ibcs2_other.c -L sys/i386/ibcs2/ibcs2_other.c -u -r1.1.1.1 -r1.2
--- sys/i386/ibcs2/ibcs2_other.c
+++ sys/i386/ibcs2/ibcs2_other.c
@@ -23,7 +23,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/ibcs2/ibcs2_other.c,v 1.17 2005/02/07 22:02:18 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/ibcs2/ibcs2_other.c,v 1.18 2006/07/08 20:05:04 jhb Exp $");
 
 /*
  * IBCS2 compatibility module.
@@ -35,7 +35,9 @@
 #include <sys/systm.h>
 #include <sys/lock.h>
 #include <sys/mutex.h>
+#include <sys/syscallsubr.h>
 #include <sys/sysproto.h>
+#include <sys/un.h>
 
 #include <i386/ibcs2/ibcs2_types.h>
 #include <i386/ibcs2/ibcs2_signal.h>
@@ -85,10 +87,8 @@
 spx_open(struct thread *td)
 {
 	struct socket_args sock;
-	struct connect_args conn;
-	struct sockaddr_un *Xaddr;
+	struct sockaddr_un sun;
 	int fd, error;
-	caddr_t sg = stackgap_init();
 
 	/* obtain a socket. */
 	DPRINTF(("SPX: open socket\n"));
@@ -98,23 +98,18 @@
 	error = socket(td, &sock);
 	if (error)
 		return error;
+	fd = td->td_retval[0];
 
 	/* connect the socket to standard X socket */
 	DPRINTF(("SPX: connect to /tmp/X11-unix/X0\n"));
-	Xaddr = stackgap_alloc(&sg, sizeof(struct sockaddr_un));
-	Xaddr->sun_family = AF_UNIX;
-	Xaddr->sun_len = sizeof(struct sockaddr_un) - sizeof(Xaddr->sun_path) +
-	  strlen(Xaddr->sun_path) + 1;
-	copyout("/tmp/.X11-unix/X0", Xaddr->sun_path, 18);
-
-	conn.s = fd = td->td_retval[0];
-	conn.name = (caddr_t)Xaddr;
-	conn.namelen = sizeof(struct sockaddr_un);
-	error = connect(td, &conn);
+	sun.sun_family = AF_UNIX;
+	strcpy(sun.sun_path, "/tmp/.X11-unix/X0");
+	sun.sun_len = sizeof(struct sockaddr_un) - sizeof(sun.sun_path) +
+	    strlen(sun.sun_path) + 1;
+
+	error = kern_connect(td, fd, (struct sockaddr *)&sun);
 	if (error) {
-		struct close_args cl;
-		cl.fd = fd;
-		close(td, &cl);
+		kern_close(td, fd);
 		return error;
 	}
 	td->td_retval[0] = fd;
Index: ibcs2_xenix.c
===================================================================
RCS file: /home/cvs/src/sys/i386/ibcs2/ibcs2_xenix.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/i386/ibcs2/ibcs2_xenix.c -L sys/i386/ibcs2/ibcs2_xenix.c -u -r1.1.1.1 -r1.2
--- sys/i386/ibcs2/ibcs2_xenix.c
+++ sys/i386/ibcs2/ibcs2_xenix.c
@@ -29,12 +29,13 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/ibcs2/ibcs2_xenix.c,v 1.35 2005/07/07 19:28:55 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/ibcs2/ibcs2_xenix.c,v 1.42 2007/07/05 05:32:44 peter Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/namei.h> 
 #include <sys/sysproto.h>
+#include <sys/clock.h>
 #include <sys/jail.h>
 #include <sys/kernel.h>
 #include <sys/malloc.h>
@@ -42,6 +43,7 @@
 #include <sys/vnode.h>
 #include <sys/syscallsubr.h>
 #include <sys/sysctl.h>
+#include <sys/sysent.h>
 #include <sys/unistd.h>
 
 #include <machine/cpu.h>
@@ -68,13 +70,9 @@
 	code = (tf->tf_eax & 0xff00) >> 8;
 	callp = &xenix_sysent[code];
 
-	if (code < IBCS2_XENIX_MAXSYSCALL) {
-		if ((callp->sy_narg & SYF_MPSAFE) == 0)
-			mtx_lock(&Giant);
+	if (code < IBCS2_XENIX_MAXSYSCALL)
 		error = ((*callp->sy_call)(td, (void *)uap));
-		if ((callp->sy_narg & SYF_MPSAFE) == 0)
-			mtx_unlock(&Giant);
-	} else
+	else
 		error = ENOSYS;
 	return (error);
 }
@@ -84,18 +82,15 @@
 	struct thread *td;
 	struct xenix_rdchk_args *uap;
 {
-	int error;
-	struct ioctl_args sa;
-	caddr_t sg = stackgap_init();
+	int data, error;
 
 	DPRINTF(("IBCS2: 'xenix rdchk'\n"));
-	sa.fd = uap->fd;
-	sa.com = FIONREAD;
-	sa.data = stackgap_alloc(&sg, sizeof(int));
-	if ((error = ioctl(td, &sa)) != 0)
-		return error;
-	td->td_retval[0] = (*((int*)sa.data)) ? 1 : 0;
-	return 0;
+	
+	error = kern_ioctl(td, uap->fd, FIONREAD, (caddr_t)&data);
+	if (error)
+		return (error);
+	td->td_retval[0] = data ? 1 : 0;
+	return (0);
 }
 
 int
@@ -107,7 +102,6 @@
 
 	DPRINTF(("IBCS2: 'xenix chsize'\n"));
 	sa.fd = uap->fd;
-	sa.pad = 0;
 	sa.length = uap->size;
 	return ftruncate(td, &sa);
 }
@@ -145,8 +139,7 @@
 	DPRINTF(("IBCS2: 'xenix nap %d ms'\n", uap->millisec));
 	period = (long)uap->millisec / (1000/hz);
 	if (period)
-		while (tsleep(&period, PPAUSE, "nap", period) 
-		       != EWOULDBLOCK) ;
+		pause("nap", period);
 	return 0;
 }
 
@@ -216,7 +209,7 @@
 		bsd_flags |= X_OK;
 
 	CHECKALTEXIST(td, uap->path, &path);
-	error = kern_access(td, path, UIO_SYSSPACE, bsd_flags);
+	error = kern_eaccess(td, path, UIO_SYSSPACE, bsd_flags);
 	free(path, M_TEMP);
         return (error);
 }
Index: ibcs2_util.h
===================================================================
RCS file: /home/cvs/src/sys/i386/ibcs2/ibcs2_util.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/i386/ibcs2/ibcs2_util.h -L sys/i386/ibcs2/ibcs2_util.h -u -r1.1.1.1 -r1.2
--- sys/i386/ibcs2/ibcs2_util.h
+++ sys/i386/ibcs2/ibcs2_util.h
@@ -29,7 +29,7 @@
  * from: svr4_util.h,v 1.5 1994/11/18 02:54:31 christos Exp
  * from: linux_util.h,v 1.2 1995/03/05 23:23:50 fvdl Exp
  *
- * $FreeBSD: src/sys/i386/ibcs2/ibcs2_util.h,v 1.19 2005/02/07 22:02:18 jhb Exp $
+ * $FreeBSD: src/sys/i386/ibcs2/ibcs2_util.h,v 1.20 2006/07/10 17:59:26 jhb Exp $
  */
 
 /*
@@ -40,41 +40,9 @@
 #ifndef	_IBCS2_UTIL_H_
 #define	_IBCS2_UTIL_H_
 
-/*
- * XXX the inlines have obnoxious prerequisites, only some of which are
- * included here.
- */
-#include <vm/vm.h>
-#include <vm/pmap.h>
-#include <machine/vmparam.h>
-#include <sys/exec.h>
-#include <sys/sysent.h>
 #include <sys/proc.h>
 #include <sys/uio.h>
 
-static __inline caddr_t stackgap_init(void);
-static __inline void *stackgap_alloc(caddr_t *, size_t);
-
-static __inline caddr_t
-stackgap_init()
-{
-#define szsigcode (*(curthread->td_proc->p_sysent->sv_szsigcode))
-        return (caddr_t)(PS_STRINGS - szsigcode - SPARE_USRSPACE);
-}
-
-static __inline void *
-stackgap_alloc(sgp, sz)
-	caddr_t	*sgp;
-	size_t   sz;
-{
-	void	*p = (void *) *sgp;
-	sz = ALIGN(sz);
-	if (*sgp + sz > (caddr_t)(PS_STRINGS - szsigcode))
-		return NULL;
-	*sgp += sz;
-	return p;
-}
-
 #ifdef DEBUG_IBCS2
 #define DPRINTF(a)      printf a;
 #else
Index: Makefile
===================================================================
RCS file: /home/cvs/src/sys/i386/ibcs2/Makefile,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/i386/ibcs2/Makefile -L sys/i386/ibcs2/Makefile -u -r1.1.1.2 -r1.2
--- sys/i386/ibcs2/Makefile
+++ sys/i386/ibcs2/Makefile
@@ -1,6 +1,6 @@
 # Makefile for syscall tables
 #
-# $FreeBSD: src/sys/i386/ibcs2/Makefile,v 1.3.14.1 2006/02/13 23:48:26 rwatson Exp $
+# $FreeBSD: src/sys/i386/ibcs2/Makefile,v 1.4 2006/02/05 23:25:19 rwatson Exp $
 
 all:
 	@echo "make sysent, isc_sysent or xenix_sysent only"
Index: syscalls.conf
===================================================================
RCS file: /home/cvs/src/sys/i386/ibcs2/syscalls.conf,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/i386/ibcs2/syscalls.conf -L sys/i386/ibcs2/syscalls.conf -u -r1.1.1.1 -r1.2
--- sys/i386/ibcs2/syscalls.conf
+++ sys/i386/ibcs2/syscalls.conf
@@ -1,4 +1,4 @@
-#	syscalls.conf $FreeBSD: src/sys/i386/ibcs2/syscalls.conf,v 1.7 2003/12/24 00:32:07 peter Exp $
+#	syscalls.conf $FreeBSD: src/sys/i386/ibcs2/syscalls.conf,v 1.8 2006/08/15 17:25:54 jhb Exp $
 sysnames="/dev/null"
 sysproto="ibcs2_proto.h"
 sysproto_h=_IBCS2_SYSPROTO_H_
@@ -8,4 +8,4 @@
 syscallprefix="IBCS2_SYS_"
 switchname="ibcs2_sysent"
 namesname="ibcs2_syscallnames"
-sysvec="\n"
+systrace="/dev/null"
Index: ibcs2_socksys.c
===================================================================
RCS file: /home/cvs/src/sys/i386/ibcs2/ibcs2_socksys.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/i386/ibcs2/ibcs2_socksys.c -L sys/i386/ibcs2/ibcs2_socksys.c -u -r1.1.1.1 -r1.2
--- sys/i386/ibcs2/ibcs2_socksys.c
+++ sys/i386/ibcs2/ibcs2_socksys.c
@@ -24,7 +24,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/ibcs2/ibcs2_socksys.c,v 1.21 2005/01/06 23:22:04 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/ibcs2/ibcs2_socksys.c,v 1.22 2006/11/06 13:41:59 rwatson Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -174,9 +174,6 @@
 	char hname[MAXHOSTNAMELEN], *ptr;
 	int error, sctl[2], hlen;
 
-	if ((error = suser(td)))
-		return (error);
-
 	/* W/out a hostname a domain-name is nonsense */
 	if ( strlen(hostname) == 0 )
 		return EINVAL;
Index: syscalls.isc.conf
===================================================================
RCS file: /home/cvs/src/sys/i386/ibcs2/syscalls.isc.conf,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/i386/ibcs2/syscalls.isc.conf -L sys/i386/ibcs2/syscalls.isc.conf -u -r1.1.1.1 -r1.2
--- sys/i386/ibcs2/syscalls.isc.conf
+++ sys/i386/ibcs2/syscalls.isc.conf
@@ -1,4 +1,4 @@
-#	syscalls.conf $FreeBSD: src/sys/i386/ibcs2/syscalls.isc.conf,v 1.6 2003/12/24 00:32:07 peter Exp $
+#	syscalls.conf $FreeBSD: src/sys/i386/ibcs2/syscalls.isc.conf,v 1.7 2006/08/15 17:25:54 jhb Exp $
 sysnames="/dev/null"
 #sysproto="ibcs2_isc.h"
 sysproto="/dev/null"
@@ -9,4 +9,4 @@
 syscallprefix="IBCS2_ISC_"
 switchname="isc_sysent"
 namesname="isc_syscallnames"
-sysvec="\n"
+systrace="/dev/null"
Index: syscalls.isc
===================================================================
RCS file: /home/cvs/src/sys/i386/ibcs2/syscalls.isc,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/i386/ibcs2/syscalls.isc -L sys/i386/ibcs2/syscalls.isc -u -r1.1.1.1 -r1.2
--- sys/i386/ibcs2/syscalls.isc
+++ sys/i386/ibcs2/syscalls.isc
@@ -1,4 +1,4 @@
- $FreeBSD: src/sys/i386/ibcs2/syscalls.isc,v 1.8.2.1 2005/07/20 17:42:15 jhb Exp $
+ $FreeBSD: src/sys/i386/ibcs2/syscalls.isc,v 1.12 2006/07/28 19:05:27 jhb Exp $
 
 #include <sys/param.h>
 #include <sys/sysent.h>
@@ -10,28 +10,29 @@
 
 0	AUE_NULL	UNIMPL	nosys
 1	AUE_NULL	UNIMPL	isc_setostype
-2	AUE_NULL	MNOPROTO	{ int ibcs2_rename(char *from, char *to); }
-3	AUE_NULL	MNOPROTO	{ int ibcs2_sigaction(int sig, \
-			    struct ibcs2_sigaction *act, \
-			    struct ibcs2_sigaction *oact); }
-4	AUE_NULL	MNOPROTO	{ int ibcs2_sigprocmask(int how, \
-			    ibcs2_sigset_t *set, ibcs2_sigset_t *oset); }
-5	AUE_NULL	MNOPROTO	{ int ibcs2_sigpending(ibcs2_sigset_t *mask); }
-6	AUE_NULL	MNOPROTO	{ int getgroups(u_int gidsetsize, \
-			    gid_t *gidset); }
-7	AUE_NULL	MNOPROTO	{ int setgroups(u_int gidsetsize, \
-			    gid_t *gidset); }
-8	AUE_NULL	MNOPROTO	{ int ibcs2_pathconf(char *path, int name); }
-9	AUE_NULL	MNOPROTO	{ int ibcs2_fpathconf(int fd, int name); }
+2	AUE_RENAME	NOPROTO	{ int ibcs2_rename(char *from, char *to); }
+3	AUE_NULL	NOPROTO	{ int ibcs2_sigaction(int sig, \
+				    struct ibcs2_sigaction *act, \
+				    struct ibcs2_sigaction *oact); }
+4	AUE_NULL	NOPROTO	{ int ibcs2_sigprocmask(int how, \
+				    ibcs2_sigset_t *set, \
+				    ibcs2_sigset_t *oset); }
+5	AUE_NULL	NOPROTO	{ int ibcs2_sigpending(ibcs2_sigset_t *mask); }
+6	AUE_GETGROUPS	NOPROTO	{ int getgroups(u_int gidsetsize, \
+				    gid_t *gidset); }
+7	AUE_SETGROUPS	NOPROTO	{ int setgroups(u_int gidsetsize, \
+				    gid_t *gidset); }
+8	AUE_PATHCONF	NOPROTO	{ int ibcs2_pathconf(char *path, int name); }
+9	AUE_FPATHCONF	NOPROTO	{ int ibcs2_fpathconf(int fd, int name); }
 10	AUE_NULL	UNIMPL	nosys
-11	AUE_NULL	MNOPROTO	{ int ibcs2_wait(int a1, int a2, int a3); }
-12	AUE_NULL	MNOPROTO	{ int setsid(void); }
-13	AUE_NULL	MNOPROTO	{ pid_t getpid(void); }
+11	AUE_WAIT4	NOPROTO	{ int ibcs2_wait(int a1, int a2, int a3); }
+12	AUE_SETSID	NOPROTO	{ int setsid(void); }
+13	AUE_GETPID	NOPROTO	{ pid_t getpid(void); }
 14	AUE_NULL	UNIMPL	isc_adduser
 15	AUE_NULL	UNIMPL	isc_setuser
-16	AUE_NULL	MNOPROTO { int ibcs2_sysconf(int name); }
-17	AUE_NULL	MNOPROTO	{ int ibcs2_sigsuspend(ibcs2_sigset_t *mask); }
-18	AUE_NULL	MNOPROTO	{ int ibcs2_symlink(char *path, char *link); }
-19	AUE_NULL	MNOPROTO	{ int ibcs2_readlink(char *path, char *buf, \
-			    int count); }
+16	AUE_NULL	NOPROTO	{ int ibcs2_sysconf(int name); }
+17	AUE_NULL	NOPROTO	{ int ibcs2_sigsuspend(ibcs2_sigset_t *mask); }
+18	AUE_SYMLINK	NOPROTO	{ int ibcs2_symlink(char *path, char *link); }
+19	AUE_READLINK	NOPROTO	{ int ibcs2_readlink(char *path, char *buf, \
+				    int count); }
 20	AUE_NULL	UNIMPL	isc_getmajor
Index: ibcs2_xenix.h
===================================================================
RCS file: /home/cvs/src/sys/i386/ibcs2/ibcs2_xenix.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/i386/ibcs2/ibcs2_xenix.h -L sys/i386/ibcs2/ibcs2_xenix.h -u -r1.1.1.1 -r1.2
--- sys/i386/ibcs2/ibcs2_xenix.h
+++ sys/i386/ibcs2/ibcs2_xenix.h
@@ -2,8 +2,8 @@
  * System call prototypes.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/i386/ibcs2/ibcs2_xenix.h,v 1.15.2.1 2005/07/20 17:43:53 jhb Exp $
- * created from FreeBSD: src/sys/i386/ibcs2/syscalls.xenix,v 1.9.2.1 2005/07/20 17:42:15 jhb Exp 
+ * $FreeBSD: src/sys/i386/ibcs2/ibcs2_xenix.h,v 1.22 2006/11/11 16:26:56 trhodes Exp $
+ * created from FreeBSD: src/sys/i386/ibcs2/syscalls.xenix,v 1.14 2006/07/28 19:05:27 jhb Exp 
  */
 
 #ifndef _IBCS2_XENIX_H_
@@ -11,12 +11,11 @@
 
 #include <sys/signal.h>
 #include <sys/acl.h>
-#include <sys/thr.h>
-#include <sys/umtx.h>
-#include <posix4/_semaphore.h>
-
+#include <sys/_semaphore.h>
 #include <sys/ucontext.h>
 
+#include <bsm/audit_kevents.h>
+
 struct proc;
 
 struct thread;
@@ -123,6 +122,24 @@
 
 #endif /* COMPAT_FREEBSD4 */
 
+#define	IBCS2_XENIX_AUE_xenix_rdchk	AUE_NULL
+#define	IBCS2_XENIX_AUE_xenix_chsize	AUE_FTRUNCATE
+#define	IBCS2_XENIX_AUE_xenix_ftime	AUE_NULL
+#define	IBCS2_XENIX_AUE_xenix_nap	AUE_NULL
+#define	IBCS2_XENIX_AUE_xenix_scoinfo	AUE_NULL
+#define	IBCS2_XENIX_AUE_xenix_eaccess	AUE_EACCESS
+#define	IBCS2_XENIX_AUE_ibcs2_sigaction	AUE_NULL
+#define	IBCS2_XENIX_AUE_ibcs2_sigprocmask	AUE_NULL
+#define	IBCS2_XENIX_AUE_ibcs2_sigpending	AUE_NULL
+#define	IBCS2_XENIX_AUE_ibcs2_sigsuspend	AUE_NULL
+#define	IBCS2_XENIX_AUE_ibcs2_getgroups	AUE_GETGROUPS
+#define	IBCS2_XENIX_AUE_ibcs2_setgroups	AUE_SETGROUPS
+#define	IBCS2_XENIX_AUE_ibcs2_sysconf	AUE_NULL
+#define	IBCS2_XENIX_AUE_ibcs2_pathconf	AUE_PATHCONF
+#define	IBCS2_XENIX_AUE_ibcs2_fpathconf	AUE_FPATHCONF
+#define	IBCS2_XENIX_AUE_ibcs2_rename	AUE_RENAME
+#define	IBCS2_XENIX_AUE_xenix_utsname	AUE_NULL
+
 #undef PAD_
 #undef PADL_
 #undef PADR_
Index: ibcs2_msg.c
===================================================================
RCS file: /home/cvs/src/sys/i386/ibcs2/ibcs2_msg.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/i386/ibcs2/ibcs2_msg.c -L sys/i386/ibcs2/ibcs2_msg.c -u -r1.1.1.1 -r1.2
--- sys/i386/ibcs2/ibcs2_msg.c
+++ sys/i386/ibcs2/ibcs2_msg.c
@@ -23,7 +23,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/ibcs2/ibcs2_msg.c,v 1.12 2005/02/25 20:15:11 sam Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/ibcs2/ibcs2_msg.c,v 1.13 2006/07/06 21:29:05 jhb Exp $");
 
 /*
  * IBCS2 message compatibility module.
@@ -38,7 +38,6 @@
 #include <i386/ibcs2/ibcs2_types.h>
 #include <i386/ibcs2/ibcs2_signal.h>
 #include <i386/ibcs2/ibcs2_util.h>
-#include <i386/ibcs2/ibcs2_poll.h>
 #include <i386/ibcs2/ibcs2_proto.h>
 
 
@@ -57,79 +56,3 @@
 {
 	return 0; /* fake */
 }
-
-
-int
-ibcs2_poll(td, uap)
-	struct thread *td;
-	struct ibcs2_poll_args *uap;
-{
-	int error, i, nfds;
-	fd_set *readfds, *writefds, *exceptfds;
-	struct timeval timeout, *tp;
-	struct ibcs2_poll conv;
-	caddr_t sg = stackgap_init();
-
-	if (uap->nfds > FD_SETSIZE)
-		return EINVAL;
-	readfds   = stackgap_alloc(&sg, sizeof(fd_set *));
-	writefds  = stackgap_alloc(&sg, sizeof(fd_set *));
-	exceptfds = stackgap_alloc(&sg, sizeof(fd_set *));
-
-	FD_ZERO(readfds);
-	FD_ZERO(writefds);
-	FD_ZERO(exceptfds);
-	if (uap->timeout == -1)
-		tp = NULL;
-	else {
-		timeout.tv_usec = (uap->timeout % 1000)*1000;
-		timeout.tv_sec  = uap->timeout / 1000;
-		tp = &timeout;
-	}
-
-	nfds = 0;
-	for (i = 0; i < uap->nfds; i++) {
-		if ((error = copyin(uap->fds + i*sizeof(struct ibcs2_poll),
-				   &conv, sizeof(conv))) != 0)
-			return error;
-		conv.revents = 0;
-		if (conv.fd < 0 || conv.fd >= FD_SETSIZE)
-			continue;
-		if (conv.fd >= nfds)
-			nfds = conv.fd + 1;
-		if (conv.events & IBCS2_READPOLL)
-			FD_SET(conv.fd, readfds);
-		if (conv.events & IBCS2_WRITEPOLL)
-			FD_SET(conv.fd, writefds);
-		FD_SET(conv.fd, exceptfds);
-	}
-	error = kern_select(td, nfds, readfds, writefds, exceptfds, tp);
-	if (error != 0)
-		return error;
-	if (td->td_retval[0] == 0)
-		return 0;
-	td->td_retval[0] = 0;
-	for (td->td_retval[0] = 0, i = 0; i < uap->nfds; i++) {
-		copyin(uap->fds + i*sizeof(struct ibcs2_poll),
-		       &conv, sizeof(conv));
-		conv.revents = 0;
-		if (conv.fd < 0 || conv.fd > FD_SETSIZE)
-			/* should check for open as well */
-			conv.revents |= IBCS2_POLLNVAL;
-		else {
-			if (FD_ISSET(conv.fd, readfds))
-				conv.revents |= IBCS2_POLLIN;
-			if (FD_ISSET(conv.fd, writefds))
-				conv.revents |= IBCS2_POLLOUT;
-			if (FD_ISSET(conv.fd, exceptfds))
-				conv.revents |= IBCS2_POLLERR;
-			if (conv.revents)
-				++td->td_retval[0];
-		}
-		if ((error = copyout(&conv,
-				    uap->fds + i*sizeof(struct ibcs2_poll),
-				    sizeof(conv))) != 0)
-			return error;
-	}
-	return 0;
-}
Index: ibcs2_syscall.h
===================================================================
RCS file: /home/cvs/src/sys/i386/ibcs2/ibcs2_syscall.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/i386/ibcs2/ibcs2_syscall.h -L sys/i386/ibcs2/ibcs2_syscall.h -u -r1.1.1.1 -r1.2
--- sys/i386/ibcs2/ibcs2_syscall.h
+++ sys/i386/ibcs2/ibcs2_syscall.h
@@ -2,8 +2,8 @@
  * System call numbers.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/i386/ibcs2/ibcs2_syscall.h,v 1.18.2.1 2005/07/20 17:43:53 jhb Exp $
- * created from FreeBSD: src/sys/i386/ibcs2/syscalls.master,v 1.20.2.1 2005/07/20 17:42:15 jhb Exp 
+ * $FreeBSD: src/sys/i386/ibcs2/ibcs2_syscall.h,v 1.27 2006/08/15 17:37:00 jhb Exp $
+ * created from FreeBSD: src/sys/i386/ibcs2/syscalls.master,v 1.28 2006/07/28 19:05:27 jhb Exp 
  */
 
 #define	IBCS2_SYS_syscall	0
@@ -82,7 +82,7 @@
 #define	IBCS2_SYS_ibcs2_sysfs	84
 #define	IBCS2_SYS_ibcs2_getmsg	85
 #define	IBCS2_SYS_ibcs2_putmsg	86
-#define	IBCS2_SYS_ibcs2_poll	87
+#define	IBCS2_SYS_poll	87
 #define	IBCS2_SYS_ibcs2_secure	89
 #define	IBCS2_SYS_ibcs2_symlink	90
 #define	IBCS2_SYS_ibcs2_lstat	91
Index: ibcs2_isc_syscall.h
===================================================================
RCS file: /home/cvs/src/sys/i386/ibcs2/ibcs2_isc_syscall.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/i386/ibcs2/ibcs2_isc_syscall.h -L sys/i386/ibcs2/ibcs2_isc_syscall.h -u -r1.1.1.1 -r1.2
--- sys/i386/ibcs2/ibcs2_isc_syscall.h
+++ sys/i386/ibcs2/ibcs2_isc_syscall.h
@@ -2,8 +2,8 @@
  * System call numbers.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/i386/ibcs2/ibcs2_isc_syscall.h,v 1.9.2.1 2005/07/20 17:43:53 jhb Exp $
- * created from FreeBSD: src/sys/i386/ibcs2/syscalls.isc,v 1.8.2.1 2005/07/20 17:42:15 jhb Exp 
+ * $FreeBSD: src/sys/i386/ibcs2/ibcs2_isc_syscall.h,v 1.15 2006/08/15 17:37:00 jhb Exp $
+ * created from FreeBSD: src/sys/i386/ibcs2/syscalls.isc,v 1.12 2006/07/28 19:05:27 jhb Exp 
  */
 
 #define	IBCS2_ISC_ibcs2_rename	2
Index: ibcs2_xenix_sysent.c
===================================================================
RCS file: /home/cvs/src/sys/i386/ibcs2/ibcs2_xenix_sysent.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/i386/ibcs2/ibcs2_xenix_sysent.c -L sys/i386/ibcs2/ibcs2_xenix_sysent.c -u -r1.1.1.1 -r1.2
--- sys/i386/ibcs2/ibcs2_xenix_sysent.c
+++ sys/i386/ibcs2/ibcs2_xenix_sysent.c
@@ -2,8 +2,8 @@
  * System call switch table.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/i386/ibcs2/ibcs2_xenix_sysent.c,v 1.13.2.1 2005/07/20 17:43:53 jhb Exp $
- * created from FreeBSD: src/sys/i386/ibcs2/syscalls.xenix,v 1.9.2.1 2005/07/20 17:42:15 jhb Exp 
+ * $FreeBSD: src/sys/i386/ibcs2/ibcs2_xenix_sysent.c,v 1.19 2006/08/15 17:37:00 jhb Exp $
+ * created from FreeBSD: src/sys/i386/ibcs2/syscalls.xenix,v 1.14 2006/07/28 19:05:27 jhb Exp 
  */
 
 #include <bsm/audit_kevents.h>
@@ -18,61 +18,61 @@
 
 /* The casts are bogus but will do for now. */
 struct sysent xenix_sysent[] = {
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 0 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 1 = xenix_xlocking */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 2 = xenix_creatsem */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 3 = xenix_opensem */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 4 = xenix_sigsem */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 5 = xenix_waitsem */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 6 = xenix_nbwaitsem */
-	{ AS(xenix_rdchk_args), (sy_call_t *)xenix_rdchk, AUE_NULL },	/* 7 = xenix_rdchk */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 8 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 9 = nosys */
-	{ SYF_MPSAFE | AS(xenix_chsize_args), (sy_call_t *)xenix_chsize, AUE_NULL },	/* 10 = xenix_chsize */
-	{ SYF_MPSAFE | AS(xenix_ftime_args), (sy_call_t *)xenix_ftime, AUE_NULL },	/* 11 = xenix_ftime */
-	{ SYF_MPSAFE | AS(xenix_nap_args), (sy_call_t *)xenix_nap, AUE_NULL },	/* 12 = xenix_nap */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 13 = xenix_sdget */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 14 = xenix_sdfree */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 15 = xenix_sdenter */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 16 = xenix_sdleave */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 17 = xenix_sdgetv */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 18 = xenix_sdwaitv */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 19 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 20 = nosys */
-	{ SYF_MPSAFE | 0, (sy_call_t *)xenix_scoinfo, AUE_NULL },	/* 21 = xenix_scoinfo */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 22 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 23 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 24 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 25 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 26 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 27 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 28 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 29 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 30 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 31 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 32 = xenix_proctl */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 33 = xenix_execseg */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 34 = xenix_unexecseg */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 35 = nosys */
-	{ SYF_MPSAFE | AS(select_args), (sy_call_t *)select, AUE_NULL },	/* 36 = select */
-	{ SYF_MPSAFE | AS(xenix_eaccess_args), (sy_call_t *)xenix_eaccess, AUE_NULL },	/* 37 = xenix_eaccess */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 38 = xenix_paccess */
-	{ SYF_MPSAFE | AS(ibcs2_sigaction_args), (sy_call_t *)ibcs2_sigaction, AUE_NULL },	/* 39 = ibcs2_sigaction */
-	{ SYF_MPSAFE | AS(ibcs2_sigprocmask_args), (sy_call_t *)ibcs2_sigprocmask, AUE_NULL },	/* 40 = ibcs2_sigprocmask */
-	{ SYF_MPSAFE | AS(ibcs2_sigpending_args), (sy_call_t *)ibcs2_sigpending, AUE_NULL },	/* 41 = ibcs2_sigpending */
-	{ SYF_MPSAFE | AS(ibcs2_sigsuspend_args), (sy_call_t *)ibcs2_sigsuspend, AUE_NULL },	/* 42 = ibcs2_sigsuspend */
-	{ AS(ibcs2_getgroups_args), (sy_call_t *)ibcs2_getgroups, AUE_NULL },	/* 43 = ibcs2_getgroups */
-	{ AS(ibcs2_setgroups_args), (sy_call_t *)ibcs2_setgroups, AUE_NULL },	/* 44 = ibcs2_setgroups */
-	{ SYF_MPSAFE | AS(ibcs2_sysconf_args), (sy_call_t *)ibcs2_sysconf, AUE_NULL },	/* 45 = ibcs2_sysconf */
-	{ SYF_MPSAFE | AS(ibcs2_pathconf_args), (sy_call_t *)ibcs2_pathconf, AUE_NULL },	/* 46 = ibcs2_pathconf */
-	{ SYF_MPSAFE | AS(ibcs2_fpathconf_args), (sy_call_t *)ibcs2_fpathconf, AUE_NULL },	/* 47 = ibcs2_fpathconf */
-	{ SYF_MPSAFE | AS(ibcs2_rename_args), (sy_call_t *)ibcs2_rename, AUE_NULL },	/* 48 = ibcs2_rename */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 49 = nosys */
-	{ SYF_MPSAFE | AS(xenix_utsname_args), (sy_call_t *)xenix_utsname, AUE_NULL },	/* 50 = xenix_utsname */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 51 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 52 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 53 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 54 = nosys */
-	{ SYF_MPSAFE | AS(getitimer_args), (sy_call_t *)getitimer, AUE_NULL },	/* 55 = getitimer */
-	{ SYF_MPSAFE | AS(setitimer_args), (sy_call_t *)setitimer, AUE_NULL },	/* 56 = setitimer */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 0 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 1 = xenix_xlocking */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 2 = xenix_creatsem */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 3 = xenix_opensem */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 4 = xenix_sigsem */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 5 = xenix_waitsem */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 6 = xenix_nbwaitsem */
+	{ AS(xenix_rdchk_args), (sy_call_t *)xenix_rdchk, AUE_NULL, NULL, 0, 0 },	/* 7 = xenix_rdchk */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 8 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 9 = nosys */
+	{ AS(xenix_chsize_args), (sy_call_t *)xenix_chsize, AUE_FTRUNCATE, NULL, 0, 0 },	/* 10 = xenix_chsize */
+	{ AS(xenix_ftime_args), (sy_call_t *)xenix_ftime, AUE_NULL, NULL, 0, 0 },	/* 11 = xenix_ftime */
+	{ AS(xenix_nap_args), (sy_call_t *)xenix_nap, AUE_NULL, NULL, 0, 0 },	/* 12 = xenix_nap */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 13 = xenix_sdget */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 14 = xenix_sdfree */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 15 = xenix_sdenter */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 16 = xenix_sdleave */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 17 = xenix_sdgetv */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 18 = xenix_sdwaitv */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 19 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 20 = nosys */
+	{ 0, (sy_call_t *)xenix_scoinfo, AUE_NULL, NULL, 0, 0 },	/* 21 = xenix_scoinfo */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 22 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 23 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 24 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 25 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 26 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 27 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 28 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 29 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 30 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 31 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 32 = xenix_proctl */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 33 = xenix_execseg */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 34 = xenix_unexecseg */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 35 = nosys */
+	{ AS(select_args), (sy_call_t *)select, AUE_SELECT, NULL, 0, 0 },	/* 36 = select */
+	{ AS(xenix_eaccess_args), (sy_call_t *)xenix_eaccess, AUE_EACCESS, NULL, 0, 0 },	/* 37 = xenix_eaccess */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 38 = xenix_paccess */
+	{ AS(ibcs2_sigaction_args), (sy_call_t *)ibcs2_sigaction, AUE_NULL, NULL, 0, 0 },	/* 39 = ibcs2_sigaction */
+	{ AS(ibcs2_sigprocmask_args), (sy_call_t *)ibcs2_sigprocmask, AUE_NULL, NULL, 0, 0 },	/* 40 = ibcs2_sigprocmask */
+	{ AS(ibcs2_sigpending_args), (sy_call_t *)ibcs2_sigpending, AUE_NULL, NULL, 0, 0 },	/* 41 = ibcs2_sigpending */
+	{ AS(ibcs2_sigsuspend_args), (sy_call_t *)ibcs2_sigsuspend, AUE_NULL, NULL, 0, 0 },	/* 42 = ibcs2_sigsuspend */
+	{ AS(ibcs2_getgroups_args), (sy_call_t *)ibcs2_getgroups, AUE_GETGROUPS, NULL, 0, 0 },	/* 43 = ibcs2_getgroups */
+	{ AS(ibcs2_setgroups_args), (sy_call_t *)ibcs2_setgroups, AUE_SETGROUPS, NULL, 0, 0 },	/* 44 = ibcs2_setgroups */
+	{ AS(ibcs2_sysconf_args), (sy_call_t *)ibcs2_sysconf, AUE_NULL, NULL, 0, 0 },	/* 45 = ibcs2_sysconf */
+	{ AS(ibcs2_pathconf_args), (sy_call_t *)ibcs2_pathconf, AUE_PATHCONF, NULL, 0, 0 },	/* 46 = ibcs2_pathconf */
+	{ AS(ibcs2_fpathconf_args), (sy_call_t *)ibcs2_fpathconf, AUE_FPATHCONF, NULL, 0, 0 },	/* 47 = ibcs2_fpathconf */
+	{ AS(ibcs2_rename_args), (sy_call_t *)ibcs2_rename, AUE_RENAME, NULL, 0, 0 },	/* 48 = ibcs2_rename */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 49 = nosys */
+	{ AS(xenix_utsname_args), (sy_call_t *)xenix_utsname, AUE_NULL, NULL, 0, 0 },	/* 50 = xenix_utsname */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 51 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 52 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 53 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 54 = nosys */
+	{ AS(getitimer_args), (sy_call_t *)getitimer, AUE_GETITIMER, NULL, 0, 0 },	/* 55 = getitimer */
+	{ AS(setitimer_args), (sy_call_t *)setitimer, AUE_SETITIMER, NULL, 0, 0 },	/* 56 = setitimer */
 };
Index: ibcs2_isc_sysent.c
===================================================================
RCS file: /home/cvs/src/sys/i386/ibcs2/ibcs2_isc_sysent.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/i386/ibcs2/ibcs2_isc_sysent.c -L sys/i386/ibcs2/ibcs2_isc_sysent.c -u -r1.1.1.1 -r1.2
--- sys/i386/ibcs2/ibcs2_isc_sysent.c
+++ sys/i386/ibcs2/ibcs2_isc_sysent.c
@@ -2,8 +2,8 @@
  * System call switch table.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/i386/ibcs2/ibcs2_isc_sysent.c,v 1.12.2.1 2005/07/20 17:43:53 jhb Exp $
- * created from FreeBSD: src/sys/i386/ibcs2/syscalls.isc,v 1.8.2.1 2005/07/20 17:42:15 jhb Exp 
+ * $FreeBSD: src/sys/i386/ibcs2/ibcs2_isc_sysent.c,v 1.18 2006/08/15 17:37:00 jhb Exp $
+ * created from FreeBSD: src/sys/i386/ibcs2/syscalls.isc,v 1.12 2006/07/28 19:05:27 jhb Exp 
  */
 
 #include <bsm/audit_kevents.h>
@@ -19,25 +19,25 @@
 
 /* The casts are bogus but will do for now. */
 struct sysent isc_sysent[] = {
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 0 = nosys */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 1 = isc_setostype */
-	{ SYF_MPSAFE | AS(ibcs2_rename_args), (sy_call_t *)ibcs2_rename, AUE_NULL },	/* 2 = ibcs2_rename */
-	{ SYF_MPSAFE | AS(ibcs2_sigaction_args), (sy_call_t *)ibcs2_sigaction, AUE_NULL },	/* 3 = ibcs2_sigaction */
-	{ SYF_MPSAFE | AS(ibcs2_sigprocmask_args), (sy_call_t *)ibcs2_sigprocmask, AUE_NULL },	/* 4 = ibcs2_sigprocmask */
-	{ SYF_MPSAFE | AS(ibcs2_sigpending_args), (sy_call_t *)ibcs2_sigpending, AUE_NULL },	/* 5 = ibcs2_sigpending */
-	{ SYF_MPSAFE | AS(getgroups_args), (sy_call_t *)getgroups, AUE_NULL },	/* 6 = getgroups */
-	{ SYF_MPSAFE | AS(setgroups_args), (sy_call_t *)setgroups, AUE_NULL },	/* 7 = setgroups */
-	{ SYF_MPSAFE | AS(ibcs2_pathconf_args), (sy_call_t *)ibcs2_pathconf, AUE_NULL },	/* 8 = ibcs2_pathconf */
-	{ SYF_MPSAFE | AS(ibcs2_fpathconf_args), (sy_call_t *)ibcs2_fpathconf, AUE_NULL },	/* 9 = ibcs2_fpathconf */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 10 = nosys */
-	{ SYF_MPSAFE | AS(ibcs2_wait_args), (sy_call_t *)ibcs2_wait, AUE_NULL },	/* 11 = ibcs2_wait */
-	{ SYF_MPSAFE | 0, (sy_call_t *)setsid, AUE_NULL },	/* 12 = setsid */
-	{ SYF_MPSAFE | 0, (sy_call_t *)getpid, AUE_NULL },	/* 13 = getpid */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 14 = isc_adduser */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 15 = isc_setuser */
-	{ SYF_MPSAFE | AS(ibcs2_sysconf_args), (sy_call_t *)ibcs2_sysconf, AUE_NULL },	/* 16 = ibcs2_sysconf */
-	{ SYF_MPSAFE | AS(ibcs2_sigsuspend_args), (sy_call_t *)ibcs2_sigsuspend, AUE_NULL },	/* 17 = ibcs2_sigsuspend */
-	{ SYF_MPSAFE | AS(ibcs2_symlink_args), (sy_call_t *)ibcs2_symlink, AUE_NULL },	/* 18 = ibcs2_symlink */
-	{ SYF_MPSAFE | AS(ibcs2_readlink_args), (sy_call_t *)ibcs2_readlink, AUE_NULL },	/* 19 = ibcs2_readlink */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 20 = isc_getmajor */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 0 = nosys */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 1 = isc_setostype */
+	{ AS(ibcs2_rename_args), (sy_call_t *)ibcs2_rename, AUE_RENAME, NULL, 0, 0 },	/* 2 = ibcs2_rename */
+	{ AS(ibcs2_sigaction_args), (sy_call_t *)ibcs2_sigaction, AUE_NULL, NULL, 0, 0 },	/* 3 = ibcs2_sigaction */
+	{ AS(ibcs2_sigprocmask_args), (sy_call_t *)ibcs2_sigprocmask, AUE_NULL, NULL, 0, 0 },	/* 4 = ibcs2_sigprocmask */
+	{ AS(ibcs2_sigpending_args), (sy_call_t *)ibcs2_sigpending, AUE_NULL, NULL, 0, 0 },	/* 5 = ibcs2_sigpending */
+	{ AS(getgroups_args), (sy_call_t *)getgroups, AUE_GETGROUPS, NULL, 0, 0 },	/* 6 = getgroups */
+	{ AS(setgroups_args), (sy_call_t *)setgroups, AUE_SETGROUPS, NULL, 0, 0 },	/* 7 = setgroups */
+	{ AS(ibcs2_pathconf_args), (sy_call_t *)ibcs2_pathconf, AUE_PATHCONF, NULL, 0, 0 },	/* 8 = ibcs2_pathconf */
+	{ AS(ibcs2_fpathconf_args), (sy_call_t *)ibcs2_fpathconf, AUE_FPATHCONF, NULL, 0, 0 },	/* 9 = ibcs2_fpathconf */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 10 = nosys */
+	{ AS(ibcs2_wait_args), (sy_call_t *)ibcs2_wait, AUE_WAIT4, NULL, 0, 0 },	/* 11 = ibcs2_wait */
+	{ 0, (sy_call_t *)setsid, AUE_SETSID, NULL, 0, 0 },		/* 12 = setsid */
+	{ 0, (sy_call_t *)getpid, AUE_GETPID, NULL, 0, 0 },		/* 13 = getpid */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 14 = isc_adduser */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 15 = isc_setuser */
+	{ AS(ibcs2_sysconf_args), (sy_call_t *)ibcs2_sysconf, AUE_NULL, NULL, 0, 0 },	/* 16 = ibcs2_sysconf */
+	{ AS(ibcs2_sigsuspend_args), (sy_call_t *)ibcs2_sigsuspend, AUE_NULL, NULL, 0, 0 },	/* 17 = ibcs2_sigsuspend */
+	{ AS(ibcs2_symlink_args), (sy_call_t *)ibcs2_symlink, AUE_SYMLINK, NULL, 0, 0 },	/* 18 = ibcs2_symlink */
+	{ AS(ibcs2_readlink_args), (sy_call_t *)ibcs2_readlink, AUE_READLINK, NULL, 0, 0 },	/* 19 = ibcs2_readlink */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 20 = isc_getmajor */
 };
Index: ibcs2_proto.h
===================================================================
RCS file: /home/cvs/src/sys/i386/ibcs2/ibcs2_proto.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/i386/ibcs2/ibcs2_proto.h -L sys/i386/ibcs2/ibcs2_proto.h -u -r1.1.1.1 -r1.2
--- sys/i386/ibcs2/ibcs2_proto.h
+++ sys/i386/ibcs2/ibcs2_proto.h
@@ -2,8 +2,8 @@
  * System call prototypes.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/i386/ibcs2/ibcs2_proto.h,v 1.21.2.1 2005/07/20 17:43:53 jhb Exp $
- * created from FreeBSD: src/sys/i386/ibcs2/syscalls.master,v 1.20.2.1 2005/07/20 17:42:15 jhb Exp 
+ * $FreeBSD: src/sys/i386/ibcs2/ibcs2_proto.h,v 1.31 2006/11/11 16:26:56 trhodes Exp $
+ * created from FreeBSD: src/sys/i386/ibcs2/syscalls.master,v 1.28 2006/07/28 19:05:27 jhb Exp 
  */
 
 #ifndef _IBCS2_SYSPROTO_H_
@@ -11,12 +11,11 @@
 
 #include <sys/signal.h>
 #include <sys/acl.h>
-#include <sys/thr.h>
-#include <sys/umtx.h>
-#include <posix4/_semaphore.h>
-
+#include <sys/_semaphore.h>
 #include <sys/ucontext.h>
 
+#include <bsm/audit_kevents.h>
+
 struct proc;
 
 struct thread;
@@ -258,11 +257,6 @@
 	char dat_l_[PADL_(struct ibcs2_stropts *)]; struct ibcs2_stropts * dat; char dat_r_[PADR_(struct ibcs2_stropts *)];
 	char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
 };
-struct ibcs2_poll_args {
-	char fds_l_[PADL_(struct ibcs2_poll *)]; struct ibcs2_poll * fds; char fds_r_[PADR_(struct ibcs2_poll *)];
-	char nfds_l_[PADL_(long)]; long nfds; char nfds_r_[PADR_(long)];
-	char timeout_l_[PADL_(int)]; int timeout; char timeout_r_[PADR_(int)];
-};
 struct ibcs2_secure_args {
 	char cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)];
 	char a1_l_[PADL_(int)]; int a1; char a1_r_[PADR_(int)];
@@ -337,7 +331,6 @@
 int	ibcs2_sysfs(struct thread *, struct ibcs2_sysfs_args *);
 int	ibcs2_getmsg(struct thread *, struct ibcs2_getmsg_args *);
 int	ibcs2_putmsg(struct thread *, struct ibcs2_putmsg_args *);
-int	ibcs2_poll(struct thread *, struct ibcs2_poll_args *);
 int	ibcs2_secure(struct thread *, struct ibcs2_secure_args *);
 int	ibcs2_symlink(struct thread *, struct ibcs2_symlink_args *);
 int	ibcs2_lstat(struct thread *, struct ibcs2_lstat_args *);
@@ -355,6 +348,62 @@
 
 #endif /* COMPAT_FREEBSD4 */
 
+#define	IBCS2_SYS_AUE_ibcs2_read	AUE_NULL
+#define	IBCS2_SYS_AUE_ibcs2_open	AUE_OPEN_RWTC
+#define	IBCS2_SYS_AUE_ibcs2_wait	AUE_WAIT4
+#define	IBCS2_SYS_AUE_ibcs2_creat	AUE_CREAT
+#define	IBCS2_SYS_AUE_ibcs2_unlink	AUE_UNLINK
+#define	IBCS2_SYS_AUE_ibcs2_execv	AUE_EXECVE
+#define	IBCS2_SYS_AUE_ibcs2_chdir	AUE_CHDIR
+#define	IBCS2_SYS_AUE_ibcs2_time	AUE_NULL
+#define	IBCS2_SYS_AUE_ibcs2_mknod	AUE_MKNOD
+#define	IBCS2_SYS_AUE_ibcs2_chmod	AUE_CHMOD
+#define	IBCS2_SYS_AUE_ibcs2_chown	AUE_CHOWN
+#define	IBCS2_SYS_AUE_ibcs2_stat	AUE_STAT
+#define	IBCS2_SYS_AUE_ibcs2_lseek	AUE_LSEEK
+#define	IBCS2_SYS_AUE_ibcs2_mount	AUE_MOUNT
+#define	IBCS2_SYS_AUE_ibcs2_umount	AUE_UMOUNT
+#define	IBCS2_SYS_AUE_ibcs2_setuid	AUE_SETUID
+#define	IBCS2_SYS_AUE_ibcs2_stime	AUE_SETTIMEOFDAY
+#define	IBCS2_SYS_AUE_ibcs2_alarm	AUE_NULL
+#define	IBCS2_SYS_AUE_ibcs2_fstat	AUE_FSTAT
+#define	IBCS2_SYS_AUE_ibcs2_pause	AUE_NULL
+#define	IBCS2_SYS_AUE_ibcs2_utime	AUE_NULL
+#define	IBCS2_SYS_AUE_ibcs2_stty	AUE_NULL
+#define	IBCS2_SYS_AUE_ibcs2_gtty	AUE_NULL
+#define	IBCS2_SYS_AUE_ibcs2_access	AUE_ACCESS
+#define	IBCS2_SYS_AUE_ibcs2_nice	AUE_NICE
+#define	IBCS2_SYS_AUE_ibcs2_statfs	AUE_STATFS
+#define	IBCS2_SYS_AUE_ibcs2_kill	AUE_KILL
+#define	IBCS2_SYS_AUE_ibcs2_fstatfs	AUE_FSTATFS
+#define	IBCS2_SYS_AUE_ibcs2_pgrpsys	AUE_NULL
+#define	IBCS2_SYS_AUE_ibcs2_xenix	AUE_NULL
+#define	IBCS2_SYS_AUE_ibcs2_times	AUE_NULL
+#define	IBCS2_SYS_AUE_ibcs2_plock	AUE_NULL
+#define	IBCS2_SYS_AUE_ibcs2_setgid	AUE_SETGID
+#define	IBCS2_SYS_AUE_ibcs2_sigsys	AUE_NULL
+#define	IBCS2_SYS_AUE_ibcs2_msgsys	AUE_MSGSYS
+#define	IBCS2_SYS_AUE_ibcs2_sysi86	AUE_NULL
+#define	IBCS2_SYS_AUE_ibcs2_shmsys	AUE_SHMSYS
+#define	IBCS2_SYS_AUE_ibcs2_semsys	AUE_SEMSYS
+#define	IBCS2_SYS_AUE_ibcs2_ioctl	AUE_IOCTL
+#define	IBCS2_SYS_AUE_ibcs2_uadmin	AUE_NULL
+#define	IBCS2_SYS_AUE_ibcs2_utssys	AUE_NULL
+#define	IBCS2_SYS_AUE_ibcs2_execve	AUE_EXECVE
+#define	IBCS2_SYS_AUE_ibcs2_fcntl	AUE_FCNTL
+#define	IBCS2_SYS_AUE_ibcs2_ulimit	AUE_NULL
+#define	IBCS2_SYS_AUE_ibcs2_rmdir	AUE_RMDIR
+#define	IBCS2_SYS_AUE_ibcs2_mkdir	AUE_MKDIR
+#define	IBCS2_SYS_AUE_ibcs2_getdents	AUE_GETDIRENTRIES
+#define	IBCS2_SYS_AUE_ibcs2_sysfs	AUE_NULL
+#define	IBCS2_SYS_AUE_ibcs2_getmsg	AUE_GETMSG
+#define	IBCS2_SYS_AUE_ibcs2_putmsg	AUE_PUTMSG
+#define	IBCS2_SYS_AUE_ibcs2_secure	AUE_NULL
+#define	IBCS2_SYS_AUE_ibcs2_symlink	AUE_SYMLINK
+#define	IBCS2_SYS_AUE_ibcs2_lstat	AUE_LSTAT
+#define	IBCS2_SYS_AUE_ibcs2_readlink	AUE_READLINK
+#define	IBCS2_SYS_AUE_ibcs2_isc	AUE_NULL
+
 #undef PAD_
 #undef PADL_
 #undef PADR_
Index: ibcs2_ipc.h
===================================================================
RCS file: /home/cvs/src/sys/i386/ibcs2/ibcs2_ipc.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/i386/ibcs2/ibcs2_ipc.h -L sys/i386/ibcs2/ibcs2_ipc.h -u -r1.1.1.1 -r1.2
--- sys/i386/ibcs2/ibcs2_ipc.h
+++ sys/i386/ibcs2/ibcs2_ipc.h
@@ -27,7 +27,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/i386/ibcs2/ibcs2_ipc.h,v 1.8 2005/01/06 23:22:04 imp Exp $
+ * $FreeBSD: src/sys/i386/ibcs2/ibcs2_ipc.h,v 1.9 2006/07/08 19:52:49 jhb Exp $
  */
 
 
@@ -38,7 +38,7 @@
 	u_short	cgid;	/* creator group id */
 	u_short	mode;	/* r/w permission */
 	u_short	seq;	/* sequence # (to generate unique msg/sem/shm id) */
-	key_t	key;	/* user specified msg/sem/shm key */
+	ibcs2_key_t key; /* user specified msg/sem/shm key */
 };
 
 struct ibcs2_msqid_ds {
Index: ibcs2_sysvec.c
===================================================================
RCS file: /home/cvs/src/sys/i386/ibcs2/ibcs2_sysvec.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/i386/ibcs2/ibcs2_sysvec.c -L sys/i386/ibcs2/ibcs2_sysvec.c -u -r1.1.1.2 -r1.2
--- sys/i386/ibcs2/ibcs2_sysvec.c
+++ sys/i386/ibcs2/ibcs2_sysvec.c
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/ibcs2/ibcs2_sysvec.c,v 1.30.2.1 2006/01/10 21:44:58 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/ibcs2/ibcs2_sysvec.c,v 1.32 2007/01/17 15:05:52 delphij Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -110,7 +110,7 @@
 	case MOD_UNLOAD:
 		/* if this was an ELF module we'd use elf_brand_inuse()... */
 		sx_slock(&allproc_lock);
-		LIST_FOREACH(p, &allproc, p_list) {
+		FOREACH_PROC_IN_SYSTEM(p) {
 			if (p->p_sysent == &ibcs2_svr3_sysvec) {
 				rval = EBUSY;
 				break;
Index: pci_bus.c
===================================================================
RCS file: /home/cvs/src/sys/i386/pci/pci_bus.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/i386/pci/pci_bus.c -L sys/i386/pci/pci_bus.c -u -r1.1.1.1 -r1.2
--- sys/i386/pci/pci_bus.c
+++ sys/i386/pci/pci_bus.c
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/pci/pci_bus.c,v 1.119.2.1 2005/09/18 02:55:10 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/pci/pci_bus.c,v 1.128 2007/09/30 11:05:16 marius Exp $");
 
 #include "opt_cpu.h"
 
@@ -77,6 +77,38 @@
 	pci_cfgregwrite(bus, slot, func, reg, data, bytes);
 }
 
+/* Pass MSI requests up to the nexus. */
+
+static int
+legacy_pcib_alloc_msi(device_t pcib, device_t dev, int count, int maxcount,
+    int *irqs)
+{
+	device_t bus;
+
+	bus = device_get_parent(pcib);
+	return (PCIB_ALLOC_MSI(device_get_parent(bus), dev, count, maxcount,
+	    irqs));
+}
+
+static int
+legacy_pcib_alloc_msix(device_t pcib, device_t dev, int *irq)
+{
+	device_t bus;
+
+	bus = device_get_parent(pcib);
+	return (PCIB_ALLOC_MSIX(device_get_parent(bus), dev, irq));
+}
+
+static int
+legacy_pcib_map_msi(device_t pcib, device_t dev, int irq, uint64_t *addr,
+    uint32_t *data)
+{
+	device_t bus;
+
+	bus = device_get_parent(pcib);
+	return (PCIB_MAP_MSI(device_get_parent(bus), dev, irq, addr, data));
+}
+
 static const char *
 legacy_pcib_is_host_bridge(int bus, int slot, int func,
 			  uint32_t id, uint8_t class, uint8_t subclass,
@@ -456,6 +488,9 @@
 {
 
 	switch (which) {
+	case  PCIB_IVAR_DOMAIN:
+		*result = 0;
+		return 0;
 	case  PCIB_IVAR_BUS:
 		*result = legacy_get_pcibus(dev);
 		return 0;
@@ -469,6 +504,8 @@
 {
 
 	switch (which) {
+	case  PCIB_IVAR_DOMAIN:
+		return EINVAL;
 	case  PCIB_IVAR_BUS:
 		legacy_set_pcibus(dev, value);
 		return 0;
@@ -534,75 +571,19 @@
 	DEVMETHOD(pcib_read_config,	legacy_pcib_read_config),
 	DEVMETHOD(pcib_write_config,	legacy_pcib_write_config),
 	DEVMETHOD(pcib_route_interrupt,	pcibios_pcib_route_interrupt),
+	DEVMETHOD(pcib_alloc_msi,	legacy_pcib_alloc_msi),
+	DEVMETHOD(pcib_release_msi,	pcib_release_msi),
+	DEVMETHOD(pcib_alloc_msix,	legacy_pcib_alloc_msix),
+	DEVMETHOD(pcib_release_msix,	pcib_release_msix),
+	DEVMETHOD(pcib_map_msi,		legacy_pcib_map_msi),
 
 	{ 0, 0 }
 };
 
-static driver_t legacy_pcib_driver = {
-	"pcib",
-	legacy_pcib_methods,
-	1,
-};
+static devclass_t hostb_devclass;
 
-DRIVER_MODULE(pcib, legacy, legacy_pcib_driver, pcib_devclass, 0, 0);
-
-
-/*
- * Provide a device to "eat" the host->pci bridges that we dug up above
- * and stop them showing up twice on the probes.  This also stops them
- * showing up as 'none' in pciconf -l.
- */
-static int
-pci_hostb_probe(device_t dev)
-{
-	u_int32_t id;
-
-	id = pci_get_devid(dev);
-
-	switch (id) {
-
-	/* VIA VT82C596 Power Managment Function */
-	case 0x30501106:
-		return ENXIO;
-
-	default:
-		break;
-	}
-
-	if (pci_get_class(dev) == PCIC_BRIDGE &&
-	    pci_get_subclass(dev) == PCIS_BRIDGE_HOST) {
-		device_set_desc(dev, "Host to PCI bridge");
-		device_quiet(dev);
-		return -10000;
-	}
-	return ENXIO;
-}
-
-static int
-pci_hostb_attach(device_t dev)
-{
-
-	return 0;
-}
-
-static device_method_t pci_hostb_methods[] = {
-	/* Device interface */
-	DEVMETHOD(device_probe,		pci_hostb_probe),
-	DEVMETHOD(device_attach,	pci_hostb_attach),
-	DEVMETHOD(device_shutdown,	bus_generic_shutdown),
-	DEVMETHOD(device_suspend,	bus_generic_suspend),
-	DEVMETHOD(device_resume,	bus_generic_resume),
-
-	{ 0, 0 }
-};
-static driver_t pci_hostb_driver = {
-	"hostb",
-	pci_hostb_methods,
-	1,
-};
-static devclass_t pci_hostb_devclass;
-
-DRIVER_MODULE(hostb, pci, pci_hostb_driver, pci_hostb_devclass, 0, 0);
+DEFINE_CLASS_0(pcib, legacy_pcib_driver, legacy_pcib_methods, 1);
+DRIVER_MODULE(pcib, legacy, legacy_pcib_driver, hostb_devclass, 0, 0);
 
 
 /*
@@ -647,14 +628,9 @@
 	{ 0, 0 }
 };
 
-static driver_t pcibus_pnp_driver = {
-	"pcibus_pnp",
-	pcibus_pnp_methods,
-	1,		/* no softc */
-};
-
 static devclass_t pcibus_pnp_devclass;
 
+DEFINE_CLASS_0(pcibus_pnp, pcibus_pnp_driver, pcibus_pnp_methods, 1);
 DRIVER_MODULE(pcibus_pnp, isa, pcibus_pnp_driver, pcibus_pnp_devclass, 0, 0);
 
 
@@ -689,16 +665,19 @@
 	DEVMETHOD(pcib_read_config,	pcib_read_config),
 	DEVMETHOD(pcib_write_config,	pcib_write_config),
 	DEVMETHOD(pcib_route_interrupt,	pcibios_pcib_route_interrupt),
+	DEVMETHOD(pcib_alloc_msi,	pcib_alloc_msi),
+	DEVMETHOD(pcib_release_msi,	pcib_release_msi),
+	DEVMETHOD(pcib_alloc_msix,	pcib_alloc_msix),
+	DEVMETHOD(pcib_release_msix,	pcib_release_msix),
+	DEVMETHOD(pcib_map_msi,		pcib_map_msi),
 
 	{0, 0}
 };
 
-static driver_t pcibios_pcib_driver = {
-	"pcib",
-	pcibios_pcib_pci_methods,
-	sizeof(struct pcib_softc),
-};
+static devclass_t pcib_devclass;
 
+DEFINE_CLASS_0(pcib, pcibios_pcib_driver, pcibios_pcib_pci_methods,
+    sizeof(struct pcib_softc));
 DRIVER_MODULE(pcibios_pcib, pci, pcibios_pcib_driver, pcib_devclass, 0, 0);
 
 static int
Index: pci_pir.c
===================================================================
RCS file: /home/cvs/src/sys/i386/pci/pci_pir.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/i386/pci/pci_pir.c -L sys/i386/pci/pci_pir.c -u -r1.1.1.1 -r1.2
--- sys/i386/pci/pci_pir.c
+++ sys/i386/pci/pci_pir.c
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/pci/pci_pir.c,v 1.117.2.1 2005/07/18 19:45:21 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/pci/pci_pir.c,v 1.120 2006/11/09 18:03:36 jhb Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -92,9 +92,6 @@
 static void	pci_pir_initial_irqs(struct PIR_entry *entry,
 		    struct PIR_intpin *intpin, void *arg);
 static void	pci_pir_parse(void);
-static void	pci_pir_print_intpin(struct PIR_entry *entry,
-		    struct PIR_intpin *intpin, void *arg);
-static void	pci_pir_print_table(void);
 static uint8_t	pci_pir_search_irq(int bus, int device, int pin);
 static int	pci_pir_valid_irq(struct pci_link *pci_link, int irq);
 static void	pci_pir_walk_table(pir_entry_handler *handler, void *arg);
@@ -110,6 +107,7 @@
 /* sysctl vars */
 SYSCTL_DECL(_hw_pci);
 
+/* XXX this likely should live in a header file */
 #ifdef PC98
 /* IRQs 3, 5, 7, 9, 10, 11, 12, 13 */
 #define PCI_IRQ_OVERRIDE_MASK 0x3e68
@@ -167,11 +165,6 @@
 	pci_route_count = (pt->pt_header.ph_length -
 	    sizeof(struct PIR_header)) / 
 	    sizeof(struct PIR_entry);
-	if (bootverbose) {
-		printf("Found $PIR table, %d entries at %p\n",
-		    pci_route_count, pci_route_table);
-		pci_pir_print_table();
-	}
 }
 
 /*
@@ -623,37 +616,6 @@
 }
 
 /*
- * Dump the contents of a single intpin entry to the console.
- */
-static void
-pci_pir_print_intpin(struct PIR_entry *entry, struct PIR_intpin *intpin,
-    void *arg)
-{
-
-	if (entry->pe_slot == 0)
-		printf("embedded ");
-	else
-		printf("slot %-3d ", entry->pe_slot);
-	printf(" %3d  %3d    %c   0x%02x  ", entry->pe_bus, entry->pe_device,
-	    intpin - entry->pe_intpin + 'A', intpin->link);
-	pci_print_irqmask(intpin->irqs);
-	printf("\n");
-}
-
-/*
- * Dump the contents of a PCI BIOS Interrupt Routing Table to the console.
- */
-static void
-pci_pir_print_table(void)
-{
-
-	printf("PCI-Only Interrupts: ");
-	pci_print_irqmask(pci_route_table->pt_header.ph_pci_irqs);
-	printf("\nLocation  Bus Device Pin  Link  IRQs\n");
-	pci_pir_walk_table(pci_pir_print_intpin, NULL);
-}
-
-/*
  * Display link devices.
  */
 static void
Index: pci_cfgreg.c
===================================================================
RCS file: /home/cvs/src/sys/i386/pci/pci_cfgreg.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/i386/pci/pci_cfgreg.c -L sys/i386/pci/pci_cfgreg.c -u -r1.1.1.1 -r1.2
--- sys/i386/pci/pci_cfgreg.c
+++ sys/i386/pci/pci_cfgreg.c
@@ -28,7 +28,9 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/pci/pci_cfgreg.c,v 1.116 2005/01/06 22:18:17 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/pci/pci_cfgreg.c,v 1.124.2.2 2007/12/06 08:25:43 jhb Exp $");
+
+#include "opt_xbox.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -49,6 +51,10 @@
 #include <vm/pmap.h>
 #include <machine/pmap.h>
 
+#ifdef XBOX
+#include <machine/xbox.h>
+#endif
+
 #define PRVERB(a) do {							\
 	if (bootverbose)						\
 		printf a ;						\
@@ -153,15 +159,19 @@
 	 * This also implies that it can do PCIe extended config cycles.
 	 */
 
-	/* Check for the Intel 7520 and 925 chipsets */
-	vid = pci_cfgregread(0, 0, 0, 0x0, 2);
-	did = pci_cfgregread(0, 0, 0, 0x2, 2);
-	if ((vid == 0x8086) && (did == 0x3590)) {
-		pciebar = pci_cfgregread(0, 0, 0, 0xce, 2) << 16;
-		pciereg_cfgopen();
-	} else if ((vid == 0x8086) && (did == 0x2580)) {
-		pciebar = pci_cfgregread(0, 0, 0, 0x48, 4);
-		pciereg_cfgopen();
+	/* Check for supported chipsets */
+	vid = pci_cfgregread(0, 0, 0, PCIR_VENDOR, 2);
+	did = pci_cfgregread(0, 0, 0, PCIR_DEVICE, 2);
+	if (vid == 0x8086) {
+		if (did == 0x3590 || did == 0x3592) {
+			/* Intel 7520 or 7320 */
+			pciebar = pci_cfgregread(0, 0, 0, 0xce, 2) << 16;
+			pciereg_cfgopen();
+		} else if (did == 0x2580 || did == 0x2584) {
+			/* Intel 915 or 925 */
+			pciebar = pci_cfgregread(0, 0, 0, 0x48, 4);
+			pciereg_cfgopen();
+		}
 	}
 
 	return(1);
@@ -207,6 +217,39 @@
 {
 	int dataport = 0;
 
+#ifdef XBOX
+	if (arch_i386_is_xbox) {
+		/*
+		 * The Xbox MCPX chipset is a derivative of the nForce 1
+		 * chipset. It almost has the same bus layout; some devices
+		 * cannot be used, because they have been removed.
+		 */
+
+		/*
+		 * Devices 00:00.1 and 00:00.2 used to be memory controllers on
+		 * the nForce chipset, but on the Xbox, using them will lockup
+		 * the chipset.
+		 */
+		if (bus == 0 && slot == 0 && (func == 1 || func == 2))
+			return dataport;
+		
+		/*
+		 * Bus 1 only contains a VGA controller at 01:00.0. When you try
+		 * to probe beyond that device, you only get garbage, which
+		 * could cause lockups.
+		 */
+		if (bus == 1 && (slot != 0 || func != 0))
+			return dataport;
+		
+		/*
+		 * Bus 2 used to contain the AGP controller, but the Xbox MCPX
+		 * doesn't have one. Probing it can cause lockups.
+		 */
+		if (bus >= 2)
+			return dataport;
+	}
+#endif
+
 	if (bus <= PCI_BUSMAX
 	    && slot < devmax
 	    && func <= PCI_FUNCMAX
@@ -237,11 +280,15 @@
 {
 	switch (cfgmech) {
 	case CFGMECH_1:
-		outl(CONF1_ADDR_PORT, 0);
+		/*
+		 * Do nothing for the config mechanism 1 case.
+		 * Writing a 0 to the address port can apparently
+		 * confuse some bridges and cause spurious
+		 * access failures.
+		 */
 		break;
 	case CFGMECH_2:
 		outb(CONF2_ENABLE_PORT, 0);
-		outb(CONF2_FORWARD_PORT, 0);
 		break;
 	}
 }
@@ -360,6 +407,7 @@
 	uint32_t mode1res, oldval1;
 	uint8_t mode2res, oldval2;
 
+	/* Check for type #1 first. */
 	oldval1 = inl(CONF1_ADDR_PORT);
 
 	if (bootverbose) {
@@ -367,39 +415,37 @@
 		    oldval1);
 	}
 
-	if ((oldval1 & CONF1_ENABLE_MSK) == 0) {
-
-		cfgmech = CFGMECH_1;
-		devmax = 32;
+	cfgmech = CFGMECH_1;
+	devmax = 32;
 
-		outl(CONF1_ADDR_PORT, CONF1_ENABLE_CHK);
-		DELAY(1);
-		mode1res = inl(CONF1_ADDR_PORT);
-		outl(CONF1_ADDR_PORT, oldval1);
+	outl(CONF1_ADDR_PORT, CONF1_ENABLE_CHK);
+	DELAY(1);
+	mode1res = inl(CONF1_ADDR_PORT);
+	outl(CONF1_ADDR_PORT, oldval1);
 
-		if (bootverbose)
-			printf("pci_open(1a):\tmode1res=0x%08x (0x%08lx)\n", 
-			    mode1res, CONF1_ENABLE_CHK);
+	if (bootverbose)
+		printf("pci_open(1a):\tmode1res=0x%08x (0x%08lx)\n",  mode1res,
+		    CONF1_ENABLE_CHK);
 
-		if (mode1res) {
-			if (pci_cfgcheck(32)) 
-				return (cfgmech);
-		}
+	if (mode1res) {
+		if (pci_cfgcheck(32)) 
+			return (cfgmech);
+	}
 
-		outl(CONF1_ADDR_PORT, CONF1_ENABLE_CHK1);
-		mode1res = inl(CONF1_ADDR_PORT);
-		outl(CONF1_ADDR_PORT, oldval1);
+	outl(CONF1_ADDR_PORT, CONF1_ENABLE_CHK1);
+	mode1res = inl(CONF1_ADDR_PORT);
+	outl(CONF1_ADDR_PORT, oldval1);
 
-		if (bootverbose)
-			printf("pci_open(1b):\tmode1res=0x%08x (0x%08lx)\n", 
-			    mode1res, CONF1_ENABLE_CHK1);
+	if (bootverbose)
+		printf("pci_open(1b):\tmode1res=0x%08x (0x%08lx)\n",  mode1res,
+		    CONF1_ENABLE_CHK1);
 
-		if ((mode1res & CONF1_ENABLE_MSK1) == CONF1_ENABLE_RES1) {
-			if (pci_cfgcheck(32)) 
-				return (cfgmech);
-		}
+	if ((mode1res & CONF1_ENABLE_MSK1) == CONF1_ENABLE_RES1) {
+		if (pci_cfgcheck(32)) 
+			return (cfgmech);
 	}
 
+	/* Type #1 didn't work, so try type #2. */
 	oldval2 = inb(CONF2_ENABLE_PORT);
 
 	if (bootverbose) {
@@ -429,6 +475,7 @@
 		}
 	}
 
+	/* Nothing worked, so punt. */
 	cfgmech = CFGMECH_NONE;
 	devmax = 0;
 	return (cfgmech);
Index: svr4_machdep.c
===================================================================
RCS file: /home/cvs/src/sys/i386/svr4/svr4_machdep.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/i386/svr4/svr4_machdep.c -L sys/i386/svr4/svr4_machdep.c -u -r1.1.1.1 -r1.2
--- sys/i386/svr4/svr4_machdep.c
+++ sys/i386/svr4/svr4_machdep.c
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/svr4/svr4_machdep.c,v 1.35 2005/01/06 22:18:17 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/svr4/svr4_machdep.c,v 1.38 2005/10/19 14:59:54 rwatson Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -314,84 +314,84 @@
 	u_long			 code;
 	caddr_t			 addr;
 {
-	si->si_signo = bsd_to_svr4_sig[sig];
-	si->si_errno = 0;
-	si->si_addr  = addr;
+	si->svr4_si_signo = bsd_to_svr4_sig[sig];
+	si->svr4_si_errno = 0;
+	si->svr4_si_addr  = addr;
 
 	switch (code) {
 	case T_PRIVINFLT:
-		si->si_code = SVR4_ILL_PRVOPC;
-		si->si_trap = SVR4_T_PRIVINFLT;
+		si->svr4_si_code = SVR4_ILL_PRVOPC;
+		si->svr4_si_trap = SVR4_T_PRIVINFLT;
 		break;
 
 	case T_BPTFLT:
-		si->si_code = SVR4_TRAP_BRKPT;
-		si->si_trap = SVR4_T_BPTFLT;
+		si->svr4_si_code = SVR4_TRAP_BRKPT;
+		si->svr4_si_trap = SVR4_T_BPTFLT;
 		break;
 
 	case T_ARITHTRAP:
-		si->si_code = SVR4_FPE_INTOVF;
-		si->si_trap = SVR4_T_DIVIDE;
+		si->svr4_si_code = SVR4_FPE_INTOVF;
+		si->svr4_si_trap = SVR4_T_DIVIDE;
 		break;
 
 	case T_PROTFLT:
-		si->si_code = SVR4_SEGV_ACCERR;
-		si->si_trap = SVR4_T_PROTFLT;
+		si->svr4_si_code = SVR4_SEGV_ACCERR;
+		si->svr4_si_trap = SVR4_T_PROTFLT;
 		break;
 
 	case T_TRCTRAP:
-		si->si_code = SVR4_TRAP_TRACE;
-		si->si_trap = SVR4_T_TRCTRAP;
+		si->svr4_si_code = SVR4_TRAP_TRACE;
+		si->svr4_si_trap = SVR4_T_TRCTRAP;
 		break;
 
 	case T_PAGEFLT:
-		si->si_code = SVR4_SEGV_ACCERR;
-		si->si_trap = SVR4_T_PAGEFLT;
+		si->svr4_si_code = SVR4_SEGV_ACCERR;
+		si->svr4_si_trap = SVR4_T_PAGEFLT;
 		break;
 
 	case T_ALIGNFLT:
-		si->si_code = SVR4_BUS_ADRALN;
-		si->si_trap = SVR4_T_ALIGNFLT;
+		si->svr4_si_code = SVR4_BUS_ADRALN;
+		si->svr4_si_trap = SVR4_T_ALIGNFLT;
 		break;
 
 	case T_DIVIDE:
-		si->si_code = SVR4_FPE_FLTDIV;
-		si->si_trap = SVR4_T_DIVIDE;
+		si->svr4_si_code = SVR4_FPE_FLTDIV;
+		si->svr4_si_trap = SVR4_T_DIVIDE;
 		break;
 
 	case T_OFLOW:
-		si->si_code = SVR4_FPE_FLTOVF;
-		si->si_trap = SVR4_T_DIVIDE;
+		si->svr4_si_code = SVR4_FPE_FLTOVF;
+		si->svr4_si_trap = SVR4_T_DIVIDE;
 		break;
 
 	case T_BOUND:
-		si->si_code = SVR4_FPE_FLTSUB;
-		si->si_trap = SVR4_T_BOUND;
+		si->svr4_si_code = SVR4_FPE_FLTSUB;
+		si->svr4_si_trap = SVR4_T_BOUND;
 		break;
 
 	case T_DNA:
-		si->si_code = SVR4_FPE_FLTINV;
-		si->si_trap = SVR4_T_DNA;
+		si->svr4_si_code = SVR4_FPE_FLTINV;
+		si->svr4_si_trap = SVR4_T_DNA;
 		break;
 
 	case T_FPOPFLT:
-		si->si_code = SVR4_FPE_FLTINV;
-		si->si_trap = SVR4_T_FPOPFLT;
+		si->svr4_si_code = SVR4_FPE_FLTINV;
+		si->svr4_si_trap = SVR4_T_FPOPFLT;
 		break;
 
 	case T_SEGNPFLT:
-		si->si_code = SVR4_SEGV_MAPERR;
-		si->si_trap = SVR4_T_SEGNPFLT;
+		si->svr4_si_code = SVR4_SEGV_MAPERR;
+		si->svr4_si_trap = SVR4_T_SEGNPFLT;
 		break;
 
 	case T_STKFLT:
-		si->si_code = SVR4_ILL_BADSTK;
-		si->si_trap = SVR4_T_STKFLT;
+		si->svr4_si_code = SVR4_ILL_BADSTK;
+		si->svr4_si_trap = SVR4_T_STKFLT;
 		break;
 
 	default:
-		si->si_code = 0;
-		si->si_trap = 0;
+		si->svr4_si_code = 0;
+		si->svr4_si_trap = 0;
 #if defined(DEBUG_SVR4)
 		printf("sig %d code %ld\n", sig, code);
 /*		panic("svr4_getsiginfo");*/
@@ -411,11 +411,10 @@
  * will return to the user pc, psl.
  */
 void
-svr4_sendsig(catcher, sig, mask, code)
+svr4_sendsig(catcher, ksi, mask)
 	sig_t catcher;
-	int sig;
+	ksiginfo_t *ksi;
 	sigset_t *mask;
-	u_long code;
 {
 	register struct thread *td = curthread;
 	struct proc *p = td->td_proc;
@@ -423,11 +422,15 @@
 	struct svr4_sigframe *fp, frame;
 	struct sigacts *psp;
 	int oonstack;
+	int sig;
+	int code;
 
+	PROC_LOCK_ASSERT(p, MA_OWNED);
+	sig = ksi->ksi_signo;
 #if defined(DEBUG_SVR4)
 	printf("svr4_sendsig(%d)\n", sig);
 #endif
-	PROC_LOCK_ASSERT(p, MA_OWNED);
+	code = ksi->ksi_trapno; /* use trap No. */
 	psp = p->p_sigacts;
 	mtx_assert(&psp->ps_mtx, MA_OWNED);
 
@@ -466,7 +469,7 @@
 #if defined(DEBUG_SVR4)
 	printf("obtained siginfo\n");
 #endif
-	frame.sf_signum = frame.sf_si.si_signo;
+	frame.sf_signum = frame.sf_si.svr4_si_signo;
 	frame.sf_sip = &fp->sf_si;
 	frame.sf_ucp = &fp->sf_uc;
 	frame.sf_handler = catcher;


More information about the Midnightbsd-cvs mailing list