Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 79767
b: refs/heads/master
c: 9a211ab
h: refs/heads/master
i:
  79765: 2d24837
  79763: 6d3deac
  79759: ceb8839
v: v3
  • Loading branch information
Thomas Gleixner authored and Ingo Molnar committed Jan 30, 2008
1 parent 553ddf7 commit 1cc0dae
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f2f58178f497ca56501d44d79982621e19c5007f
refs/heads/master: 9a211abeaab74e2634669a64ebd82fac5d94d276
18 changes: 8 additions & 10 deletions trunk/arch/x86/kernel/ioport_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,14 @@ static void set_bitmap(unsigned long *bitmap, unsigned int base,
}
}


/*
* this changes the io permissions bitmap in the current task.
*/
asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on)
{
unsigned long i, max_long, bytes, bytes_updated;
struct thread_struct * t = &current->thread;
struct tss_struct * tss;
unsigned long *bitmap;
unsigned long i, max_long;

if ((from + num <= from) || (from + num > IO_BITMAP_BITS))
return -EINVAL;
Expand All @@ -51,7 +49,8 @@ asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on)
* this is why we delay this operation until now:
*/
if (!t->io_bitmap_ptr) {
bitmap = kmalloc(IO_BITMAP_BYTES, GFP_KERNEL);
unsigned long *bitmap = kmalloc(IO_BITMAP_BYTES, GFP_KERNEL);

if (!bitmap)
return -ENOMEM;

Expand Down Expand Up @@ -80,10 +79,7 @@ asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on)
if (t->io_bitmap_ptr[i] != ~0UL)
max_long = i;

bytes = (max_long + 1) * sizeof(long);
bytes_updated = max(bytes, t->io_bitmap_max);

t->io_bitmap_max = bytes;
t->io_bitmap_max = (max_long + 1) * sizeof(unsigned long);

/*
* Sets the lazy trigger so that the next I/O operation will
Expand All @@ -110,9 +106,9 @@ asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on)
* code.
*/

asmlinkage long sys_iopl(unsigned long unused)
asmlinkage long sys_iopl(unsigned long regsp)
{
volatile struct pt_regs * regs = (struct pt_regs *) &unused;
volatile struct pt_regs *regs = (struct pt_regs *)&regsp;
unsigned int level = regs->ebx;
unsigned int old = (regs->eflags >> 12) & 3;
struct thread_struct *t = &current->thread;
Expand All @@ -124,8 +120,10 @@ asmlinkage long sys_iopl(unsigned long unused)
if (!capable(CAP_SYS_RAWIO))
return -EPERM;
}

t->iopl = level << 12;
regs->eflags = (regs->eflags & ~X86_EFLAGS_IOPL) | t->iopl;
set_iopl_mask(t->iopl);

return 0;
}

0 comments on commit 1cc0dae

Please sign in to comment.