lkml.org 
[lkml]   [2011]   [Feb]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] x86: use bitmap library functions
From
2011/2/17 Ingo Molnar <mingo@elte.hu>:
>
> * Akinobu Mita <akinobu.mita@gmail.com> wrote:
>
>> Use bitmap_set()/bitmap_clear() to fill/zero a region of a bitmap
>> instead of doing set_bit()/clear_bit() each bit.
>>
>> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
>> Cc: Thomas Gleixner <tglx@linutronix.de>
>> Cc: Ingo Molnar <mingo@redhat.com>
>> Cc: "H. Peter Anvin" <hpa@zytor.com>
>> Cc: x86@kernel.org
>> ---
>>  arch/x86/kernel/ioport.c |   20 +++++---------------
>>  1 files changed, 5 insertions(+), 15 deletions(-)
>
> Before we can merge this it would be nice to tested this using sys_ioperm(), to make
> sure port IO still gets denied/allowed as expected. You can check /proc/ioperm to
> see which ports are (probably) safe to read: 0x80/0xed is usually safe to
> read/write.

I have tested with this program and there is no difference in behavior
with this patch.

#include <sys/io.h>
#include <stdio.h>
#include <err.h>

int main(void)
{
unsigned long from = 0xed;
unsigned long num = 1;
int ret;
int i;

ret = ioperm(from, num, 1);
if (ret)
err(1, "ioperm");

for (i = 0; i < num; i++)
ret = inb(from + i);

printf("OK\n");

ret = ioperm(from, num, 0);
if (ret)
err(1, "ioperm");

printf("will receive a segmentation fault\n");

ret = inb(from);
errx(1, "Oops");
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2011-02-17 06:03    [W:0.131 / U:0.380 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site