NetBSD Problem Report #33320

From  Thu Apr 20 20:23:06 2006
Return-Path: <>
Received: by (Postfix, from userid 31301)
	id A69E963B8C7; Thu, 20 Apr 2006 20:23:06 +0000 (UTC)
Message-Id: <>
Date: Thu, 20 Apr 2006 20:23:06 +0000 (UTC)
Subject: i386_iopl(2) is not LWP aware
X-Send-Pr-Version: www-1.0

>Number:         33320
>Category:       port-i386
>Synopsis:       i386_iopl(2) is not LWP aware
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    port-i386-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Apr 20 20:25:00 +0000 2006
>Originator:     Matthias Drochner
>Release:        current
KFA Juelich
NetBSD zel216 3.99.18 NetBSD 3.99.18 (ZEL216+ACPI.DEBUG) #26: Thu Apr 20 11:56:4
3 MEST 2006  drochner@zel216:/home/drochner/netbsd/
L216+ACPI.DEBUG i386

i386_iopl(2) does only set the iopl bits for the currently
active LWP. It should work per-process.

This also applies to i386_{get,set}_ioperm(2),
but since this is being revoked (guess by whom:-)
I don't think this needs to be fixed.

#include <stdlib.h>
#include <unistd.h>
#include <err.h>
#include <pthread.h>
#include <sys/types.h>
#include <machine/sysarch.h>
#include <machine/pio.h>

void *
ioperm(void *d)
        int res;
        char buf[1];

        res = i386_iopl(1);
        if (res < 0)
                err(1, "iopl");
        read(0, &buf, sizeof(buf)); /* block, force new LWP */
        return (0);

        int res;
        pthread_t t;

        res = pthread_create(&t, 0, ioperm, 0);
        if (res)
                err(1, "pthread_create");
        sleep(1); /* wait for thread to block */
        exit (0);

The only solution I can imagine which would also work with
multiple threads on multiple processors is to lazy-evaluate
the io permission on faults.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD:,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.