[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Patch for i/o permission control in GNU Mach (was: I/O permission co
From: |
Samuel Thibault |
Subject: |
Re: Patch for i/o permission control in GNU Mach (was: I/O permission control in OSKit-Mach) |
Date: |
Tue, 1 May 2007 21:03:38 +0200 |
User-agent: |
Mutt/1.5.11 |
Hi,
Thomas Schwinge, le Wed 25 Apr 2007 18:45:44 +0200, a écrit :
> diff -N i386/i386/io_perm.c
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ i386/i386/io_perm.c 25 Apr 2007 16:36:32 -0000
...
> +kern_return_t
> +i386_io_perm_create (ipc_port_t master_port, io_port_t from, io_port_t to,
> + io_perm_t *new)
> +{
> + /* TODO. Check for limits [0;IOPB_MAX)? */
Yes and no. io_port_t is an integer 16, and ports are from 0 to 0xffff
too. I don't know precisely how signedness is handled here, but it
should be.
> + else if (iopb)
> + {
> + target_task->machine.iopb = iopb;
> + io_bitmap_init (iopb);
> + }
> + else
> + /* TODO. Need some unlocking here? */
> + return KERN_RESOURCE_SHORTAGE;
Yes.
> diff -N i386/i386/io_perm.h
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ i386/i386/io_perm.h 25 Apr 2007 16:36:32 -0000
...
> +/* The highest possible I/O port. ISA bus allows ports 0..3ff, but
> + accelerator cards are funky. */
> +#define IOPB_MAX 0xFFFF
And we need PCI too nowadays.
> Index: i386/i386/ktss.h
> ===================================================================
> RCS file: /cvsroot/hurd/gnumach/i386/i386/Attic/ktss.h,v
> retrieving revision 1.2
> diff -u -p -r1.2 ktss.h
> --- i386/i386/ktss.h 5 Apr 2001 06:39:20 -0000 1.2
> +++ i386/i386/ktss.h 25 Apr 2007 16:36:32 -0000
...
> +/* Try to release as much memory from the machine specific data in
> + task TASK. */
> +void
> +machine_task_collect (task_t task)
> +{
> + if (task->machine.iopb_size == 0 && task->machine.iopb)
> + {
> + zfree (machine_task_iopb_zone, (vm_offset_t) task->machine.iopb);
> + task->machine.iopb = 0;
> + }
> +}
Isn't there a lock needed here?
Else the grounds seem fine. Did you already test it on real hardware?
Samuel
- Re: Patch for i/o permission control in GNU Mach (was: I/O permission control in OSKit-Mach),
Samuel Thibault <=