From: Matt Mackall <mpm@selenic.com>
To: Andrew Morton <akpm@osdl.org>, linux-kernel@vger.kernel.org
Subject: [PATCH 8/15] misc: Make vm86 support optional
Date: Fri, 11 Nov 2005 02:35:52 -0600 [thread overview]
Message-ID: <9.282480653@selenic.com> (raw)
In-Reply-To: <8.282480653@selenic.com>
Make vm86 support optional
add/remove: 0/14 grow/shrink: 0/5 up/down: 0/-5221 (-5221)
function old new delta
do_simd_coprocessor_error 133 132 -1
irqbits 4 - -4
irqbits_lock 8 - -8
release_thread 72 52 -20
do_debug 212 186 -26
do_general_protection 475 428 -47
do_trap 196 140 -56
release_vm86_irqs 112 - -112
vm86_irqs 128 - -128
sys_vm86old 146 - -146
irq_handler 151 - -151
mark_screen_rdonly 159 - -159
sys_vm86 199 - -199
handle_vm86_trap 231 - -231
save_v86_state 339 - -339
do_sys_vm86 379 - -379
do_vm86_irq_handling 482 - -482
do_int 508 - -508
handle_vm86_fault 2225 - -2225
Signed-off-by: Matt Mackall <mpm@selenic.com>
Index: 2.6.14-misc/arch/i386/kernel/entry.S
===================================================================
--- 2.6.14-misc.orig/arch/i386/kernel/entry.S 2005-11-09 11:20:20.000000000 -0800
+++ 2.6.14-misc/arch/i386/kernel/entry.S 2005-11-09 11:20:21.000000000 -0800
@@ -313,15 +313,21 @@ work_resched:
work_notifysig: # deal with pending signals and
# notify-resume requests
- testl $VM_MASK, EFLAGS(%esp)
movl %esp, %eax
+
+#ifdef CONFIG_VM86
+ testl $VM_MASK, EFLAGS(%esp)
jne work_notifysig_v86 # returning to kernel-space or
# vm86-space
+#endif
+
xorl %edx, %edx
call do_notify_resume
jmp resume_userspace
ALIGN
+
+#ifdef CONFIG_VM86
work_notifysig_v86:
pushl %ecx # save ti_flags for do_notify_resume
call save_v86_state # %eax contains pt_regs pointer
@@ -333,6 +339,8 @@ work_notifysig_v86:
# perform syscall exit tracing
ALIGN
+#endif
+
syscall_trace_entry:
movl $-ENOSYS,EAX(%esp)
movl %esp, %eax
Index: 2.6.14-misc/arch/i386/kernel/process.c
===================================================================
--- 2.6.14-misc.orig/arch/i386/kernel/process.c 2005-11-09 11:20:20.000000000 -0800
+++ 2.6.14-misc/arch/i386/kernel/process.c 2005-11-09 11:20:21.000000000 -0800
@@ -428,7 +428,9 @@ void release_thread(struct task_struct *
}
}
+#ifdef CONFIG_VM86
release_vm86_irqs(dead_task);
+#endif
}
/*
Index: 2.6.14-misc/arch/i386/kernel/traps.c
===================================================================
--- 2.6.14-misc.orig/arch/i386/kernel/traps.c 2005-11-09 11:20:20.000000000 -0800
+++ 2.6.14-misc/arch/i386/kernel/traps.c 2005-11-09 11:20:21.000000000 -0800
@@ -371,8 +371,10 @@ static void __kprobes do_trap(int trapnr
tsk->thread.trap_no = trapnr;
if (regs->eflags & VM_MASK) {
+#ifdef CONFIG_VM86
if (vm86)
goto vm86_trap;
+#endif
goto trap_signal;
}
@@ -393,11 +395,13 @@ static void __kprobes do_trap(int trapnr
return;
}
+#ifdef CONFIG_VM86
vm86_trap: {
int ret = handle_vm86_trap((struct kernel_vm86_regs *) regs, error_code, trapnr);
if (ret) goto trap_signal;
return;
}
+#endif
}
#define DO_ERROR(trapnr, signr, str, name) \
@@ -452,6 +456,7 @@ DO_VM86_ERROR( 3, SIGTRAP, "int3", int3)
#endif
DO_VM86_ERROR( 4, SIGSEGV, "overflow", overflow)
DO_VM86_ERROR( 5, SIGSEGV, "bounds", bounds)
+
DO_ERROR_INFO( 6, SIGILL, "invalid operand", invalid_op, ILL_ILLOPN, regs->eip)
DO_ERROR( 9, SIGFPE, "coprocessor segment overrun", coprocessor_segment_overrun)
DO_ERROR(10, SIGSEGV, "invalid TSS", invalid_TSS)
@@ -497,8 +502,10 @@ fastcall void __kprobes do_general_prote
current->thread.error_code = error_code;
current->thread.trap_no = 13;
+#ifdef CONFIG_VM86
if (regs->eflags & VM_MASK)
goto gp_in_vm86;
+#endif
if (!user_mode(regs))
goto gp_in_kernel;
@@ -508,10 +515,12 @@ fastcall void __kprobes do_general_prote
force_sig(SIGSEGV, current);
return;
+#ifdef CONFIG_VM86
gp_in_vm86:
local_irq_enable();
handle_vm86_fault((struct kernel_vm86_regs *) regs, error_code);
return;
+#endif
gp_in_kernel:
if (!fixup_exception(regs)) {
@@ -732,8 +741,10 @@ fastcall void __kprobes do_debug(struct
goto clear_dr7;
}
+#ifdef CONFIG_VM86
if (regs->eflags & VM_MASK)
goto debug_vm86;
+#endif
/* Save debug status register where ptrace can see it */
tsk->thread.debugreg[6] = condition;
@@ -762,9 +773,11 @@ clear_dr7:
set_debugreg(0, 7);
return;
+#ifdef CONFIG_VM86
debug_vm86:
handle_vm86_trap((struct kernel_vm86_regs *) regs, error_code, 1);
return;
+#endif
clear_TF_reenable:
set_tsk_thread_flag(tsk, TIF_SINGLESTEP);
@@ -902,11 +915,13 @@ fastcall void do_simd_coprocessor_error(
* Handle strange cache flush from user space exception
* in all other cases. This is undocumented behaviour.
*/
+#ifdef CONFIG_VM86
if (regs->eflags & VM_MASK) {
handle_vm86_fault((struct kernel_vm86_regs *)regs,
error_code);
return;
}
+#endif
current->thread.trap_no = 19;
current->thread.error_code = error_code;
die_if_kernel("cache flush denied", regs, error_code);
Index: 2.6.14-misc/arch/i386/kernel/vm86.c
===================================================================
--- 2.6.14-misc.orig/arch/i386/kernel/vm86.c 2005-11-09 11:20:20.000000000 -0800
+++ 2.6.14-misc/arch/i386/kernel/vm86.c 2005-11-09 11:20:21.000000000 -0800
@@ -805,4 +805,3 @@ static int do_vm86_irq_handling(int subf
}
return -EINVAL;
}
-
Index: 2.6.14-misc/arch/i386/kernel/Makefile
===================================================================
--- 2.6.14-misc.orig/arch/i386/kernel/Makefile 2005-11-09 11:20:20.000000000 -0800
+++ 2.6.14-misc/arch/i386/kernel/Makefile 2005-11-09 11:20:21.000000000 -0800
@@ -4,7 +4,7 @@
extra-y := head.o init_task.o vmlinux.lds
-obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o vm86.o \
+obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o \
ptrace.o time.o ioport.o ldt.o setup.o i8259.o sys_i386.o \
pci-dma.o i386_ksyms.o i387.o dmi_scan.o bootflag.o \
quirks.o i8237.o
@@ -34,6 +34,7 @@ obj-$(CONFIG_ACPI_SRAT) += srat.o
obj-$(CONFIG_HPET_TIMER) += time_hpet.o
obj-$(CONFIG_EFI) += efi.o efi_stub.o
obj-$(CONFIG_DOUBLEFAULT) += doublefault.o
+obj-$(CONFIG_VM86) += vm86.o
obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
EXTRA_AFLAGS := -traditional
Index: 2.6.14-misc/arch/i386/kernel/sys_i386.c
===================================================================
--- 2.6.14-misc.orig/arch/i386/kernel/sys_i386.c 2005-11-09 11:20:20.000000000 -0800
+++ 2.6.14-misc/arch/i386/kernel/sys_i386.c 2005-11-09 11:20:21.000000000 -0800
@@ -22,6 +22,7 @@
#include <asm/uaccess.h>
#include <asm/ipc.h>
+#include <asm/unistd.h>
/*
* sys_pipe() is the normal C calling standard for creating
Index: 2.6.14-misc/init/Kconfig
===================================================================
--- 2.6.14-misc.orig/init/Kconfig 2005-11-09 11:20:20.000000000 -0800
+++ 2.6.14-misc/init/Kconfig 2005-11-09 11:20:39.000000000 -0800
@@ -347,6 +347,16 @@ config EPOLL
Disabling this option will cause the kernel to be built without
support for epoll family of system calls.
+config VM86
+ depends X86
+ default y
+ bool "Enable VM86 support" if EMBEDDED
+ help
+ This option is required by programs like DOSEMU to run 16-bit legacy
+ code on X86 processors. It also may be needed by software like
+ XFree86 to initialize some video cards via BIOS. Disabling this
+ option saves about 6k.
+
config CC_OPTIMIZE_FOR_SIZE
bool "Optimize for size" if EMBEDDED
default y if ARM || H8300
Index: 2.6.14-misc/kernel/sys_ni.c
===================================================================
--- 2.6.14-misc.orig/kernel/sys_ni.c 2005-11-09 11:20:20.000000000 -0800
+++ 2.6.14-misc/kernel/sys_ni.c 2005-11-09 11:20:21.000000000 -0800
@@ -82,6 +82,8 @@ cond_syscall(compat_sys_socketcall);
cond_syscall(sys_inotify_init);
cond_syscall(sys_inotify_add_watch);
cond_syscall(sys_inotify_rm_watch);
+cond_syscall(sys_vm86old);
+cond_syscall(sys_vm86);
/* arch-specific weak syscall entries */
cond_syscall(sys_pciconfig_read);
next prev parent reply other threads:[~2005-11-11 8:41 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-11 8:35 [PATCH 0/15] misc: Miscellaneous bits from -tiny Matt Mackall
2005-11-11 8:35 ` [PATCH 1/15] misc: Add bloat-o-meter to scripts Matt Mackall
2005-11-11 8:35 ` [PATCH 2/15] misc: Uninline some namei.c functions Matt Mackall
2005-11-11 8:35 ` [PATCH 3/15] misc: Uninline some open.c functions Matt Mackall
2005-11-11 8:35 ` [PATCH 4/15] misc: Uninline some inode.c functions Matt Mackall
2005-11-11 8:35 ` [PATCH 5/15] misc: Uninline some fslocks.c functions Matt Mackall
2005-11-11 8:35 ` [PATCH 6/15] misc: Trim non-IPX builds Matt Mackall
2005-11-11 8:35 ` [PATCH 7/15] misc: Make x86 doublefault handling optional Matt Mackall
2005-11-11 8:35 ` Matt Mackall [this message]
2005-11-11 8:35 ` [PATCH 9/15] misc: Make sysenter support optional Matt Mackall
2005-11-11 8:35 ` [PATCH 10/15] misc: Make *[ug]id16 " Matt Mackall
2005-11-11 8:35 ` [PATCH 11/15] misc: Allow dropping panic text strings from kernel image Matt Mackall
2005-11-11 8:35 ` [PATCH 12/15] misc: Configurable panic support Matt Mackall
2005-11-11 8:35 ` [PATCH 13/15] misc: Configure ELF core dump support Matt Mackall
2005-11-11 8:35 ` [PATCH 14/15] misc: Configurable number of supported IDE interfaces Matt Mackall
2005-11-11 8:35 ` [PATCH 15/15] misc: Configurable support for PCI serial ports Matt Mackall
2005-11-11 11:03 ` Geert Uytterhoeven
2006-01-07 16:50 ` Russell King
2006-01-08 2:26 ` Matt Mackall
2005-11-11 10:14 ` [PATCH 14/15] misc: Configurable number of supported IDE interfaces Bartlomiej Zolnierkiewicz
2005-11-11 17:18 ` Matt Mackall
2005-11-11 17:34 ` Roman Zippel
2005-11-11 17:37 ` Matt Mackall
2005-11-11 17:47 ` Matt Mackall
2005-11-11 17:49 ` Roman Zippel
2005-11-11 11:03 ` [PATCH 11/15] misc: Allow dropping panic text strings from kernel image Geert Uytterhoeven
2005-11-11 17:21 ` Matt Mackall
2005-11-12 6:06 ` Andrew Morton
2005-11-11 10:22 ` [PATCH 10/15] misc: Make *[ug]id16 support optional Geert Uytterhoeven
2005-11-16 13:21 ` Rob Landley
2005-11-16 18:01 ` Matt Mackall
2005-12-20 15:46 ` Zdenek Pavlas
2005-12-20 16:50 ` Rob Landley
2005-12-21 17:30 ` Zdenek Pavlas
2005-11-12 5:57 ` [PATCH 9/15] misc: Make sysenter " Andrew Morton
2005-11-12 5:55 ` [PATCH 8/15] misc: Make vm86 " Andrew Morton
2005-11-13 3:30 ` [PATCH 7/15] misc: Make x86 doublefault handling optional Andi Kleen
2005-11-16 13:13 ` Rob Landley
2005-11-16 18:21 ` Matt Mackall
2005-11-16 19:21 ` Scott Garfinkle
2005-11-16 19:45 ` Adrian Bunk
2005-12-12 10:36 ` Ingo Molnar
2005-12-12 16:22 ` Andi Kleen
2005-12-12 15:32 ` Matt Mackall
2005-12-13 8:39 ` Ingo Molnar
2005-11-14 1:57 ` [PATCH 6/15] misc: Trim non-IPX builds Adrian Bunk
2005-11-18 5:22 ` [2.6 patch] move some code to net/ipx/af_ipx.c Adrian Bunk
2005-11-18 17:27 ` Matt Mackall
2005-11-18 20:24 ` Arnaldo Carvalho de Melo
2005-12-05 21:35 ` Adrian Bunk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9.282480653@selenic.com \
--to=mpm@selenic.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.