From a9063682da2699793ca5748ca29676d224a31ec3 Mon Sep 17 00:00:00 2001 From: Mike Smith Date: Wed, 28 Jul 1999 20:20:31 +0000 Subject: [PATCH] Remove unused real-mode APM setup support. We've been using the vm86 mode initialiser for a while now, and it's looking happy. --- sys/i386/apm/apm.c | 17 +++- sys/i386/apm/apm_setup.h | 27 ------- sys/i386/apm/apm_setup.s | 162 +------------------------------------- sys/i386/bios/apm.c | 17 +++- sys/i386/bios/apm_setup.h | 27 ------- sys/i386/bios/apm_setup.s | 162 +------------------------------------- 6 files changed, 34 insertions(+), 378 deletions(-) delete mode 100644 sys/i386/apm/apm_setup.h delete mode 100644 sys/i386/bios/apm_setup.h diff --git a/sys/i386/apm/apm.c b/sys/i386/apm/apm.c index e5953f1a3777..da068055a935 100644 --- a/sys/i386/apm/apm.c +++ b/sys/i386/apm/apm.c @@ -15,7 +15,7 @@ * * Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD) * - * $Id: apm.c,v 1.91 1999/07/22 14:45:22 iwasaki Exp $ + * $Id: apm.c,v 1.92 1999/07/28 19:37:32 msmith Exp $ */ #include "opt_devfs.h" @@ -44,7 +44,6 @@ #include #include #include -#include #include #include @@ -57,6 +56,18 @@ static int apm_display __P((int newstate)); static int apm_int __P((u_long *eax, u_long *ebx, u_long *ecx, u_long *edx)); static void apm_resume __P((void)); +extern int apm_bios_call __P((struct apm_bios_arg *)); /* in apm_setup.s */ + +static u_long apm_version; +static u_long apm_cs_entry; +static u_short apm_cs32_base; +static u_short apm_cs16_base; +static u_short apm_ds_base; +static u_short apm_cs32_limit; +static u_short apm_cs16_limit; +static u_short apm_ds_limit; +static u_short apm_flags; + #define APM_NEVENTS 16 #define APM_NPMEV 13 @@ -180,7 +191,7 @@ apm_int(u_long *eax, u_long *ebx, u_long *ecx, u_long *edx) { struct apm_bios_arg apa; int cf; - + apa.eax = *eax; apa.ebx = *ebx; apa.ecx = *ecx; diff --git a/sys/i386/apm/apm_setup.h b/sys/i386/apm/apm_setup.h deleted file mode 100644 index 8a55593689bb..000000000000 --- a/sys/i386/apm/apm_setup.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 1994 by HOSOKAWA, Tatsumi - * - * This software may be used, modified, copied, distributed, and sold, - * in both source and binary form provided that the above copyright and - * these terms are retained. Under no circumstances is the author - * responsible for the proper functioning of this software, nor does - * the author assume any responsibility for damages incurred with its - * use. - * - * Sep., 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD) - * - * $Id: apm_setup.h,v 1.8 1997/03/29 11:06:38 phk Exp $ - */ - -extern u_long apm_version; -extern u_long apm_cs_entry; -extern u_short apm_cs32_base; -extern u_short apm_cs16_base; -extern u_short apm_ds_base; -extern u_short apm_cs32_limit; -extern u_short apm_cs16_limit; -extern u_short apm_ds_limit; -extern u_short apm_flags; -extern u_short kernelbase; - -int apm_bios_call __P((struct apm_bios_arg *)); diff --git a/sys/i386/apm/apm_setup.s b/sys/i386/apm/apm_setup.s index 0f7fb5ed1300..21993d921601 100644 --- a/sys/i386/apm/apm_setup.s +++ b/sys/i386/apm/apm_setup.s @@ -11,13 +11,11 @@ * * Sep., 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD) * - * $Id: apm_setup.s,v 1.12 1997/11/04 18:12:45 nate Exp $ + * $Id: apm_setup.s,v 1.13 1998/06/03 01:59:34 msmith Exp $ + * + * This file now contains no setup code. */ -#include "apm.h" - -#if NAPM > 0 - #define ASSEMBLER #include "assym.s" /* system definitions */ #include /* miscellaneous asm macros */ @@ -27,160 +25,7 @@ .file "apm_setup.s" - .data -_apm_init_image: - .globl _apm_init_image - -1: -#include "i386/apm/apm_init/apm_init.inc" -2: - -_apm_init_image_size: - .globl _apm_init_image_size - .long 2b - 1b - -_apm_version: - .globl _apm_version - .long 0 - -_apm_cs_entry: - .globl _apm_cs_entry - .long 0 - -_apm_cs16_base: - .globl _apm_cs16_base - .word 0 - -_apm_cs32_base: - .globl _apm_cs32_base - .word 0 - -_apm_ds_base: - .globl _apm_ds_base - .word 0 - -_apm_cs32_limit: - .globl _apm_cs32_limit - .word 0 - -_apm_cs16_limit: - .globl _apm_cs16_limit - .word 0 - -_apm_ds_limit: - .globl _apm_ds_limit - .word 0 - -_apm_flags: - .globl _apm_flags - .word 0 - .globl _apm_current_gdt_pdesc /* current GDT pseudo desc. */ -_apm_current_gdt_pdesc: - .word 0, 0, 0 - - .globl _bootstrap_gdt -_bootstrap_gdt: - .space SIZEOF_GDT*BOOTSTRAP_GDT_NUM - .text -_apm_setup: - .globl _apm_setup - - /* - * Setup APM BIOS: - * - * APM BIOS initialization should be done from real mode or V86 mode. - * - * (by HOSOKAWA, Tatsumi ) - */ - - /* - * Don't trust the value of %fs and %gs (some AT-compatible BIOS - * implementations leave junk values in these segment registers - * on bootstrap) - */ - xorl %eax, %eax /* null selector */ - movw %ax, %fs - movw %ax, %gs - - /* - * Copy APM initializer under 1MB boundary: - * - * APM initializer program must switch the CPU to real mode. - * But FreeBSD kernel runs above 1MB boundary. So we must - * copy the initializer code to conventional memory. - */ - movl PADDR(_apm_init_image_size), %ecx /* size */ - lea PADDR(_apm_init_image), %esi /* source */ - movl $ APM_OURADDR, %edi /* destination */ - cld - rep - movsb - - /* get GDT base */ - sgdt PADDR(_apm_current_gdt_pdesc) - - /* copy GDT to _bootstrap_gdt */ - xorl %ecx, %ecx - movw PADDR(_apm_current_gdt_pdesc), %cx - movl PADDR(_apm_current_gdt_pdesc + 2), %esi - lea PADDR(_bootstrap_gdt), %edi - cld - rep - movsb - - /* setup GDT pseudo descriptor */ - movw $(SIZEOF_GDT*BOOTSTRAP_GDT_NUM), %ax - movw %ax, PADDR(_apm_current_gdt_pdesc) - leal PADDR(_bootstrap_gdt), %eax - movl %eax, PADDR(_apm_current_gdt_pdesc + 2) - - /* load new GDTR */ - lgdt PADDR(_apm_current_gdt_pdesc) - - /* setup GDT for APM initializer */ - lea PADDR(_bootstrap_gdt), %ecx - movl $(APM_OURADDR), %eax /* use %ax for 15..0 */ - movl %eax, %ebx - shrl $16, %ebx /* use %bl for 23..16 */ - /* use %bh for 31..24 */ -#define APM_SETUP_GDT(index, attrib) \ - movl $(index), %si ; \ - lea 0(%ecx,%esi,8), %edx ; \ - movw $0xffff, (%edx) ; \ - movw %ax, 2(%edx) ; \ - movb %bl, 4(%edx) ; \ - movw $(attrib), 5(%edx) ; \ - movb %bh, 7(%edx) - - APM_SETUP_GDT(APM_INIT_CS_INDEX , CS32_ATTRIB) - APM_SETUP_GDT(APM_INIT_DS_INDEX , DS32_ATTRIB) - APM_SETUP_GDT(APM_INIT_CS16_INDEX, CS16_ATTRIB) - APM_SETUP_GDT(APM_INIT_DS16_INDEX, DS16_ATTRIB) - - /* - * Call the initializer: - * - * direct intersegment call to conventional memory code - */ - .byte 0x9a /* actually, lcall $APM_INIT_CS_SEL, $0 */ - .long 0 - .word APM_INIT_CS_SEL - - movl %eax, PADDR(_apm_version) - movl %ebx, PADDR(_apm_cs_entry) - movw %cx, PADDR(_apm_cs16_base) - shrl $16, %ecx - movw %cx, PADDR(_apm_cs32_base) - movw %dx, PADDR(_apm_ds_base) - movw %si, PADDR(_apm_cs32_limit) - shrl $16, %esi - movw %si, PADDR(_apm_ds_limit) - movw %di, PADDR(_apm_flags) - - ret - -.text .align 2 .globl _apm_bios_call _apm_bios_call: @@ -213,4 +58,3 @@ _apm_bios_call: popl %esi popl %ebp ret -#endif NAPM > 0 diff --git a/sys/i386/bios/apm.c b/sys/i386/bios/apm.c index e5953f1a3777..da068055a935 100644 --- a/sys/i386/bios/apm.c +++ b/sys/i386/bios/apm.c @@ -15,7 +15,7 @@ * * Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD) * - * $Id: apm.c,v 1.91 1999/07/22 14:45:22 iwasaki Exp $ + * $Id: apm.c,v 1.92 1999/07/28 19:37:32 msmith Exp $ */ #include "opt_devfs.h" @@ -44,7 +44,6 @@ #include #include #include -#include #include #include @@ -57,6 +56,18 @@ static int apm_display __P((int newstate)); static int apm_int __P((u_long *eax, u_long *ebx, u_long *ecx, u_long *edx)); static void apm_resume __P((void)); +extern int apm_bios_call __P((struct apm_bios_arg *)); /* in apm_setup.s */ + +static u_long apm_version; +static u_long apm_cs_entry; +static u_short apm_cs32_base; +static u_short apm_cs16_base; +static u_short apm_ds_base; +static u_short apm_cs32_limit; +static u_short apm_cs16_limit; +static u_short apm_ds_limit; +static u_short apm_flags; + #define APM_NEVENTS 16 #define APM_NPMEV 13 @@ -180,7 +191,7 @@ apm_int(u_long *eax, u_long *ebx, u_long *ecx, u_long *edx) { struct apm_bios_arg apa; int cf; - + apa.eax = *eax; apa.ebx = *ebx; apa.ecx = *ecx; diff --git a/sys/i386/bios/apm_setup.h b/sys/i386/bios/apm_setup.h deleted file mode 100644 index 8a55593689bb..000000000000 --- a/sys/i386/bios/apm_setup.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 1994 by HOSOKAWA, Tatsumi - * - * This software may be used, modified, copied, distributed, and sold, - * in both source and binary form provided that the above copyright and - * these terms are retained. Under no circumstances is the author - * responsible for the proper functioning of this software, nor does - * the author assume any responsibility for damages incurred with its - * use. - * - * Sep., 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD) - * - * $Id: apm_setup.h,v 1.8 1997/03/29 11:06:38 phk Exp $ - */ - -extern u_long apm_version; -extern u_long apm_cs_entry; -extern u_short apm_cs32_base; -extern u_short apm_cs16_base; -extern u_short apm_ds_base; -extern u_short apm_cs32_limit; -extern u_short apm_cs16_limit; -extern u_short apm_ds_limit; -extern u_short apm_flags; -extern u_short kernelbase; - -int apm_bios_call __P((struct apm_bios_arg *)); diff --git a/sys/i386/bios/apm_setup.s b/sys/i386/bios/apm_setup.s index 0f7fb5ed1300..21993d921601 100644 --- a/sys/i386/bios/apm_setup.s +++ b/sys/i386/bios/apm_setup.s @@ -11,13 +11,11 @@ * * Sep., 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD) * - * $Id: apm_setup.s,v 1.12 1997/11/04 18:12:45 nate Exp $ + * $Id: apm_setup.s,v 1.13 1998/06/03 01:59:34 msmith Exp $ + * + * This file now contains no setup code. */ -#include "apm.h" - -#if NAPM > 0 - #define ASSEMBLER #include "assym.s" /* system definitions */ #include /* miscellaneous asm macros */ @@ -27,160 +25,7 @@ .file "apm_setup.s" - .data -_apm_init_image: - .globl _apm_init_image - -1: -#include "i386/apm/apm_init/apm_init.inc" -2: - -_apm_init_image_size: - .globl _apm_init_image_size - .long 2b - 1b - -_apm_version: - .globl _apm_version - .long 0 - -_apm_cs_entry: - .globl _apm_cs_entry - .long 0 - -_apm_cs16_base: - .globl _apm_cs16_base - .word 0 - -_apm_cs32_base: - .globl _apm_cs32_base - .word 0 - -_apm_ds_base: - .globl _apm_ds_base - .word 0 - -_apm_cs32_limit: - .globl _apm_cs32_limit - .word 0 - -_apm_cs16_limit: - .globl _apm_cs16_limit - .word 0 - -_apm_ds_limit: - .globl _apm_ds_limit - .word 0 - -_apm_flags: - .globl _apm_flags - .word 0 - .globl _apm_current_gdt_pdesc /* current GDT pseudo desc. */ -_apm_current_gdt_pdesc: - .word 0, 0, 0 - - .globl _bootstrap_gdt -_bootstrap_gdt: - .space SIZEOF_GDT*BOOTSTRAP_GDT_NUM - .text -_apm_setup: - .globl _apm_setup - - /* - * Setup APM BIOS: - * - * APM BIOS initialization should be done from real mode or V86 mode. - * - * (by HOSOKAWA, Tatsumi ) - */ - - /* - * Don't trust the value of %fs and %gs (some AT-compatible BIOS - * implementations leave junk values in these segment registers - * on bootstrap) - */ - xorl %eax, %eax /* null selector */ - movw %ax, %fs - movw %ax, %gs - - /* - * Copy APM initializer under 1MB boundary: - * - * APM initializer program must switch the CPU to real mode. - * But FreeBSD kernel runs above 1MB boundary. So we must - * copy the initializer code to conventional memory. - */ - movl PADDR(_apm_init_image_size), %ecx /* size */ - lea PADDR(_apm_init_image), %esi /* source */ - movl $ APM_OURADDR, %edi /* destination */ - cld - rep - movsb - - /* get GDT base */ - sgdt PADDR(_apm_current_gdt_pdesc) - - /* copy GDT to _bootstrap_gdt */ - xorl %ecx, %ecx - movw PADDR(_apm_current_gdt_pdesc), %cx - movl PADDR(_apm_current_gdt_pdesc + 2), %esi - lea PADDR(_bootstrap_gdt), %edi - cld - rep - movsb - - /* setup GDT pseudo descriptor */ - movw $(SIZEOF_GDT*BOOTSTRAP_GDT_NUM), %ax - movw %ax, PADDR(_apm_current_gdt_pdesc) - leal PADDR(_bootstrap_gdt), %eax - movl %eax, PADDR(_apm_current_gdt_pdesc + 2) - - /* load new GDTR */ - lgdt PADDR(_apm_current_gdt_pdesc) - - /* setup GDT for APM initializer */ - lea PADDR(_bootstrap_gdt), %ecx - movl $(APM_OURADDR), %eax /* use %ax for 15..0 */ - movl %eax, %ebx - shrl $16, %ebx /* use %bl for 23..16 */ - /* use %bh for 31..24 */ -#define APM_SETUP_GDT(index, attrib) \ - movl $(index), %si ; \ - lea 0(%ecx,%esi,8), %edx ; \ - movw $0xffff, (%edx) ; \ - movw %ax, 2(%edx) ; \ - movb %bl, 4(%edx) ; \ - movw $(attrib), 5(%edx) ; \ - movb %bh, 7(%edx) - - APM_SETUP_GDT(APM_INIT_CS_INDEX , CS32_ATTRIB) - APM_SETUP_GDT(APM_INIT_DS_INDEX , DS32_ATTRIB) - APM_SETUP_GDT(APM_INIT_CS16_INDEX, CS16_ATTRIB) - APM_SETUP_GDT(APM_INIT_DS16_INDEX, DS16_ATTRIB) - - /* - * Call the initializer: - * - * direct intersegment call to conventional memory code - */ - .byte 0x9a /* actually, lcall $APM_INIT_CS_SEL, $0 */ - .long 0 - .word APM_INIT_CS_SEL - - movl %eax, PADDR(_apm_version) - movl %ebx, PADDR(_apm_cs_entry) - movw %cx, PADDR(_apm_cs16_base) - shrl $16, %ecx - movw %cx, PADDR(_apm_cs32_base) - movw %dx, PADDR(_apm_ds_base) - movw %si, PADDR(_apm_cs32_limit) - shrl $16, %esi - movw %si, PADDR(_apm_ds_limit) - movw %di, PADDR(_apm_flags) - - ret - -.text .align 2 .globl _apm_bios_call _apm_bios_call: @@ -213,4 +58,3 @@ _apm_bios_call: popl %esi popl %ebp ret -#endif NAPM > 0