summaryrefslogtreecommitdiffstats
path: root/arch/i386/kernel/ioport.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1998-03-18 17:17:51 +0000
committerRalf Baechle <ralf@linux-mips.org>1998-03-18 17:17:51 +0000
commitf1382dc4850bb459d24a81c6cb0ef93ea7bd4a79 (patch)
tree225271a3d5dcd4e9dea5ee393556abd754c964b1 /arch/i386/kernel/ioport.c
parent135b00fc2e90e605ac2a96b20b0ebd93851a3f89 (diff)
o Merge with Linux 2.1.90.
o Divide L1 cache sizes by 1024 before printing, makes the numbers a bit more credible ...
Diffstat (limited to 'arch/i386/kernel/ioport.c')
-rw-r--r--arch/i386/kernel/ioport.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/arch/i386/kernel/ioport.c b/arch/i386/kernel/ioport.c
index 9bb150075..44fd26530 100644
--- a/arch/i386/kernel/ioport.c
+++ b/arch/i386/kernel/ioport.c
@@ -13,6 +13,7 @@
#include <linux/mm.h>
#include <linux/smp.h>
#include <linux/smp_lock.h>
+#include <linux/stddef.h>
/* Set EXTENT bits starting at BASE in BITMAP to value TURN_ON. */
static void set_bitmap(unsigned long *bitmap, short base, short extent, int new_value)
@@ -53,12 +54,25 @@ static void set_bitmap(unsigned long *bitmap, short base, short extent, int new_
*/
asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int turn_on)
{
+ struct thread_struct * t = &current->tss;
+
if ((from + num <= from) || (from + num > IO_BITMAP_SIZE*32))
return -EINVAL;
if (!suser())
return -EPERM;
+ /*
+ * If it's the first ioperm() call in this thread's lifetime, set the
+ * IO bitmap up. ioperm() is much less timing critical than clone(),
+ * this is why we delay this operation until now:
+ */
+#define IO_BITMAP_OFFSET offsetof(struct thread_struct,io_bitmap)
+
+ if (t->bitmap != IO_BITMAP_OFFSET) {
+ t->bitmap = IO_BITMAP_OFFSET;
+ memset(t->io_bitmap,0xff,(IO_BITMAP_SIZE+1)*4);
+ }
- set_bitmap((unsigned long *)current->tss.io_bitmap, from, num, !turn_on);
+ set_bitmap((unsigned long *)t->io_bitmap, from, num, !turn_on);
return 0;
}