* [PATCH] Make vm86 support optional
@ 2005-12-28 20:27 Matt Mackall
2005-12-28 20:35 ` Roland Dreier
2005-12-29 4:39 ` Adrian Bunk
0 siblings, 2 replies; 5+ messages in thread
From: Matt Mackall @ 2005-12-28 20:27 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel, linux-tiny
This adds an option to remove vm86 support under CONFIG_EMBEDDED.
Saves about 5k.
This version eliminates most of the #ifdefs of the previous version
and instead uses function stubs in vm86.h. Also, release_vm86_irqs is
moved from asm-i386/irq.h to a more appropriate home in vm86.h so that
the stubs can live together.
$ size vmlinux-baseline vmlinux-novm86
text data bss dec hex filename
2920821 523232 190652 3634705 377611 vmlinux-baseline
2916268 523100 190492 3629860 376324 vmlinux-novm86
Signed-off-by: Matt Mackall <mpm@selenic.com>
Index: 2.6.15-misc/arch/i386/kernel/Makefile
===================================================================
--- 2.6.15-misc.orig/arch/i386/kernel/Makefile 2005-12-28 02:01:39.000000000 -0600
+++ 2.6.15-misc/arch/i386/kernel/Makefile 2005-12-28 02:02:02.000000000 -0600
@@ -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
@@ -36,6 +36,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.15-misc/init/Kconfig
===================================================================
--- 2.6.15-misc.orig/init/Kconfig 2005-12-28 02:01:39.000000000 -0600
+++ 2.6.15-misc/init/Kconfig 2005-12-28 02:02:02.000000000 -0600
@@ -342,6 +342,16 @@ config UID16
help
This enables the legacy 16-bit UID syscall wrappers.
+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"
default y if ARM || H8300
Index: 2.6.15-misc/kernel/sys_ni.c
===================================================================
--- 2.6.15-misc.orig/kernel/sys_ni.c 2005-12-28 02:01:39.000000000 -0600
+++ 2.6.15-misc/kernel/sys_ni.c 2005-12-28 02:02:02.000000000 -0600
@@ -102,6 +102,8 @@ cond_syscall(sys_setresgid16);
cond_syscall(sys_setresuid16);
cond_syscall(sys_setreuid16);
cond_syscall(sys_setuid16);
+cond_syscall(sys_vm86old);
+cond_syscall(sys_vm86);
/* arch-specific weak syscall entries */
cond_syscall(sys_pciconfig_read);
Index: 2.6.15-misc/arch/i386/kernel/process.c
===================================================================
--- 2.6.15-misc.orig/arch/i386/kernel/process.c 2005-12-28 02:01:39.000000000 -0600
+++ 2.6.15-misc/arch/i386/kernel/process.c 2005-12-28 02:02:02.000000000 -0600
@@ -48,6 +48,7 @@
#include <asm/processor.h>
#include <asm/i387.h>
#include <asm/desc.h>
+#include <asm/vm86.h>
#ifdef CONFIG_MATH_EMULATION
#include <asm/math_emu.h>
#endif
Index: 2.6.15-misc/include/asm-i386/irq.h
===================================================================
--- 2.6.15-misc.orig/include/asm-i386/irq.h 2005-12-28 02:01:39.000000000 -0600
+++ 2.6.15-misc/include/asm-i386/irq.h 2005-12-28 02:02:02.000000000 -0600
@@ -21,8 +21,6 @@ static __inline__ int irq_canonicalize(i
return ((irq == 2) ? 9 : irq);
}
-extern void release_vm86_irqs(struct task_struct *);
-
#ifdef CONFIG_X86_LOCAL_APIC
# define ARCH_HAS_NMI_WATCHDOG /* See include/linux/nmi.h */
#endif
Index: 2.6.15-misc/include/asm-i386/vm86.h
===================================================================
--- 2.6.15-misc.orig/include/asm-i386/vm86.h 2005-12-28 02:01:39.000000000 -0600
+++ 2.6.15-misc/include/asm-i386/vm86.h 2005-12-28 02:36:48.000000000 -0600
@@ -16,7 +16,11 @@
#define IF_MASK 0x00000200
#define IOPL_MASK 0x00003000
#define NT_MASK 0x00004000
+#ifdef CONFIG_VM86
#define VM_MASK 0x00020000
+#else
+#define VM_MASK 0 /* ignored */
+#endif
#define AC_MASK 0x00040000
#define VIF_MASK 0x00080000 /* virtual interrupt flag */
#define VIP_MASK 0x00100000 /* virtual interrupt pending */
@@ -200,9 +204,25 @@ struct kernel_vm86_struct {
*/
};
+#ifdef CONFIG_VM86
+
void handle_vm86_fault(struct kernel_vm86_regs *, long);
int handle_vm86_trap(struct kernel_vm86_regs *, long, int);
+struct task_struct;
+void release_vm86_irqs(struct task_struct *);
+
+#else
+
+#define handle_vm86_fault(a, b)
+#define release_vm86_irqs(a)
+
+static inline int handle_vm86_trap(struct kernel_vm86_regs *a, long b, int c) {
+ return 0;
+}
+
+#endif /* CONFIG_VM86 */
+
#endif /* __KERNEL__ */
#endif
Index: 2.6.15-misc/arch/i386/kernel/entry.S
===================================================================
--- 2.6.15-misc.orig/arch/i386/kernel/entry.S 2005-12-28 01:48:00.000000000 -0600
+++ 2.6.15-misc/arch/i386/kernel/entry.S 2005-12-28 12:23:44.000000000 -0600
@@ -341,6 +341,7 @@ work_notifysig: # deal with pending s
ALIGN
work_notifysig_v86:
+#ifdef CONFIG_VM86
pushl %ecx # save ti_flags for do_notify_resume
call save_v86_state # %eax contains pt_regs pointer
popl %ecx
@@ -348,6 +349,7 @@ work_notifysig_v86:
xorl %edx, %edx
call do_notify_resume
jmp resume_userspace
+#endif
# perform syscall exit tracing
ALIGN
--
Mathematics is the supreme nostalgia of our time.
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] Make vm86 support optional
2005-12-28 20:27 [PATCH] Make vm86 support optional Matt Mackall
@ 2005-12-28 20:35 ` Roland Dreier
2005-12-29 4:39 ` Adrian Bunk
1 sibling, 0 replies; 5+ messages in thread
From: Roland Dreier @ 2005-12-28 20:35 UTC (permalink / raw)
To: Matt Mackall; +Cc: Andrew Morton, linux-kernel, linux-tiny
> + 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.
I'm not sure if this is even worth pointing out, but there's a
whitespace inconsistency here.
- R. [obviously with too little to do on a slow vacation day]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Make vm86 support optional
2005-12-28 20:27 [PATCH] Make vm86 support optional Matt Mackall
2005-12-28 20:35 ` Roland Dreier
@ 2005-12-29 4:39 ` Adrian Bunk
2005-12-29 18:47 ` Matt Mackall
1 sibling, 1 reply; 5+ messages in thread
From: Adrian Bunk @ 2005-12-29 4:39 UTC (permalink / raw)
To: Matt Mackall; +Cc: Andrew Morton, linux-kernel, linux-tiny
On Wed, Dec 28, 2005 at 02:27:35PM -0600, Matt Mackall wrote:
>...
> +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.
>...
I don't like such space statements ("about 6k") in help texts, since
history has shown that noone updates them when the actual size
changes...
cu
Adrian
--
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] Make vm86 support optional
2005-12-29 4:39 ` Adrian Bunk
@ 2005-12-29 18:47 ` Matt Mackall
2005-12-29 19:06 ` Adrian Bunk
0 siblings, 1 reply; 5+ messages in thread
From: Matt Mackall @ 2005-12-29 18:47 UTC (permalink / raw)
To: Adrian Bunk; +Cc: Andrew Morton, linux-kernel, linux-tiny
On Thu, Dec 29, 2005 at 05:39:00AM +0100, Adrian Bunk wrote:
> On Wed, Dec 28, 2005 at 02:27:35PM -0600, Matt Mackall wrote:
> >...
> > +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.
> >...
>
> I don't like such space statements ("about 6k") in help texts, since
> history has shown that noone updates them when the actual size
> changes...
What would you prefer? It's important to give a relative size vs
functionality savings so people can decide whether they want a feature
and simply saying a little/a lot is insufficient.
--
Mathematics is the supreme nostalgia of our time.
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] Make vm86 support optional
2005-12-29 18:47 ` Matt Mackall
@ 2005-12-29 19:06 ` Adrian Bunk
0 siblings, 0 replies; 5+ messages in thread
From: Adrian Bunk @ 2005-12-29 19:06 UTC (permalink / raw)
To: Matt Mackall; +Cc: Andrew Morton, linux-kernel, linux-tiny
On Thu, Dec 29, 2005 at 12:47:18PM -0600, Matt Mackall wrote:
> On Thu, Dec 29, 2005 at 05:39:00AM +0100, Adrian Bunk wrote:
> > On Wed, Dec 28, 2005 at 02:27:35PM -0600, Matt Mackall wrote:
> > >...
> > > +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.
> > >...
> >
> > I don't like such space statements ("about 6k") in help texts, since
> > history has shown that noone updates them when the actual size
> > changes...
>
> What would you prefer? It's important to give a relative size vs
> functionality savings so people can decide whether they want a feature
> and simply saying a little/a lot is insufficient.
I'd expect people using the "enable only if you know what you are doing"
EMBEDDED option to be able to figure out themselves how big a space
saving is (and even more important whether they can actually live
without the feature).
cu
Adrian
--
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-12-29 19:06 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-28 20:27 [PATCH] Make vm86 support optional Matt Mackall
2005-12-28 20:35 ` Roland Dreier
2005-12-29 4:39 ` Adrian Bunk
2005-12-29 18:47 ` Matt Mackall
2005-12-29 19:06 ` Adrian Bunk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox