From 2c1f7f5ef7e2252312ecfa77b2352e89669006bf Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Mon, 7 May 2007 22:04:54 +0000 Subject: 2007-05-07 Thomas Schwinge [bug #15295 --- ``Mach lets processes write to I/O ports''] * i386/Makefrag.am (libkernel_a_SOURCES): Add `i386/i386/io_perm.c', `i386/i386/io_perm.h', `i386/i386/machine_task.c', `i386/i386/task.h' and remove `i386/i386/io_port.h', `i386/i386/iopb.c', `i386/i386/iopb.h'. * i386/i386/io_port.h: Remove file. * i386/i386at/kd.c: Don't include . (vga_port_list, kd_io_device, kd_io_map_open, kd_io_map_close): Don't define and don't use anymore. * include/stddef.h: New file. * i386/i386/io_perm.c: Include , , and don't include . (io_perm_device_emulation_ops): New variable. (dev_open_alloc, setup_no_senders): Remove declarations. (convert_io_perm_to_port, convert_port_to_io_perm, io_perm_deallocate): Rewrite. (no_senders): New function. (i386_io_perm_create, i386_io_perm_modify): Rewrite partially, to adapt to the GNU Mach environment. * i386/i386/io_perm.h: Include and . (io_perm, io_perm_t): New structure and accompanying type definition. (IO_PERM_NULL): Define. * i386/i386/locore.S (ktss): Move variable to... * i386/i386/ktss.c: ... here, make it a ``struct task_tss''. (ktss_init): Initialize the `task_tss' structure and the i/o permission bit map. * i386/i386/ktss.h: Adapt to that. * i386/i386/machine_task.c (machine_task_module_init): Adapt the `zinit' call to the GNU Mach environment. * i386/i386/mp_desc.c: Include . * i386/i386/tss.h: Include . (task_tss): New structure, equivalent to the OSKit-Mach one. * i386/include/mach/i386/mach_i386.defs: Don't include . (device_list_t): Remove type. * i386/include/mach/i386/mach_i386_types.h (device_list_t): Remove type definition. 2007-05-07 Marcus Brinkmann [bug #15295 --- ``Mach lets processes write to I/O ports''] * i386/i386/iopb.h, i386/i386/iopb.c: Obsolete files removed. * i386/i386/pcb.c (switch_context): Update the I/O permission bitmap from stack_handoff() here (not only in stack_handoff()). * i386/i386/machine_task.c (machine_task_module_init): Set ZONE_COLLECTABLE and ZONE_EXHAUSTIBLE flags for the iopb zone. Requested by Roland McGrath . * i386/i386/io_perm.h: New file. * i386/i386/io_perm.c: New file. * i386/i386/machine_task.c: New file. * i386/i386/mp_desc.h: (struct mp_desc_table): Change type of ktss to struct task_tss. (mp_ktss): Likewise for array of pointers to the struct. * i386/i386/mp_desc.c: Include `machine/tss.h' and `machine/io_perm.h'. (mp_ktss): Change type to array of struct task_tss. (mp_desc_init): Cast pointer to x86_tss into pointer to task_tss, and use size of struct task_tss instead size of struct x86_tss. Initialize the task_tss structure. * i386/i386/pcb.c: Include `stddef.h' and `machine/tss.h'. (iopb_create, iopb_destroy): Prototypes removed. (curr_ktss): Cast pointer to base_tss to pointer to struct task_tss. (switch_ktss): Always use kernel TSS. (update_ktss_iopb): New function. (stack_handoff): Call update_ktss_iopb. (pcb_module_init): Do not call iopb_init. (pcb_terminate): Do not call iopb_destroy. (thread_setstatus): Remove local variable tss. (thread_getstatus): Rewrite i386_ISA_PORT_MAP_STATE case handler. * i386/i386/task.h: New file. * i386/i386/thread.h: Do not include `i386/iopb.h'. (struct i386_machine_state): Remove member io_tss. * i386/include/mach/i386/mach_i386.defs [KERNEL_SERVER]: Include `machine/io_perm.h'. Define intran, outtran and destructor. (io_port_t): New type. (io_perm_t): Likewise. (i386_io_port_add): Interface removed. (i386_io_port_remove): Likewise. (i386_io_port_list): Likewise. (i386_io_perm_create): New interface. (i386_io_perm_modify): Likewise. * i386/include/mach/i386/mach_i386_types.h [MACH_KERNEL]: Include `i386/io_perm.h'. [!MACH_KERNEL]: Define types io_port_t and io_perm_t. * kern/task.c (task_init): Call machine_task_module_init. (task_create): Call machine_task_init. (task_deallocate): Call machine_task_terminate. (task_collect_scan): Call machine_task_collect. * task.h: Include `machine/task.h'. (struct task): Add member machine. --- i386/i386at/kd.c | 36 ------------------------------------ 1 file changed, 36 deletions(-) (limited to 'i386/i386at') diff --git a/i386/i386at/kd.c b/i386/i386at/kd.c index 10e1d4e..9dbbd46 100644 --- a/i386/i386at/kd.c +++ b/i386/i386at/kd.c @@ -84,7 +84,6 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include #include /* for struct uio (!) */ -#include #include #include #include @@ -333,33 +332,6 @@ unsigned char key_map[NUMKEYS][WIDTH_KMAP] = { short kd_index_reg = EGA_IDX_REG; short kd_io_reg = EGA_IO_REG; -/* - * IO port sets for different controllers. - */ -io_reg_t vga_port_list[] = { - 0x3b4, 0x3b5, 0x3b8, 0x3b9, 0x3ba, /* MDA/EGA */ - 0x3d4, 0x3d5, 0x3d8, 0x3d9, 0x3da, /* CGA/EGA */ - 0x3c0, 0x3c1, 0x3c2, 0x3c3, 0x3c4, 0x3c5, 0x3c6, 0x3c7, - 0x3c8, 0x3c9, 0x3ca, 0x3cb, 0x3cc, 0x3cd, 0x3ce, 0x3cf, - IO_REG_NULL -}; - -mach_device_t kd_io_device = 0; - -void -kd_io_map_open(device) - mach_device_t device; -{ - kd_io_device = device; - io_port_create(device, vga_port_list); -} - -void -kd_io_map_close() -{ - io_port_destroy(kd_io_device); - kd_io_device = 0; -} /* * Globals used only for bitmap-based controllers. See kdsoft.h for @@ -508,11 +480,6 @@ kdopen(dev, flag, ior) tp->t_ospeed = tp->t_ispeed = B9600; tp->t_flags = ODDP|EVENP|ECHO|CRMOD|XTABS; kdinit(); - - /* XXX kd_io_map_open allocates memory */ - simple_unlock(&tp->t_lock); - kd_io_map_open(ior->io_device); - simple_lock(&tp->t_lock); } tp->t_state |= TS_CARR_ON; simple_unlock(&tp->t_lock); @@ -549,10 +516,7 @@ int flag; splx(s); } - kd_io_map_close(); - return; - } -- cgit v1.2.3