aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2009-08-09 04:03:52 -0400
committerIngo Molnar <mingo@elte.hu>2009-08-10 05:10:52 -0400
commitc7425314c755d5f94da7c978205c85a7c6201212 (patch)
treeef0e1152756a6e113a6d6b0cebc53b263eb78974
parent4c711576b90cc36c13b94816a953a8de6a53d03c (diff)
x86: Introduce GDT_ENTRY_INIT(), initialize bad_bios_desc statically
Fully initialize bad_bios_desc statically instead of doing some fields statically and some dynamically. Suggested-by: "H. Peter Anvin" <hpa@zytor.com> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> LKML-Reference: <20090809080350.GA4765@localhost.localdomain> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--arch/x86/kernel/apm_32.c19
-rw-r--r--drivers/pnp/pnpbios/bioscalls.c5
2 files changed, 11 insertions, 13 deletions
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c
index febb2dab254f..39a4462ef8a7 100644
--- a/arch/x86/kernel/apm_32.c
+++ b/arch/x86/kernel/apm_32.c
@@ -403,7 +403,15 @@ static DECLARE_WAIT_QUEUE_HEAD(apm_waitqueue);
403static DECLARE_WAIT_QUEUE_HEAD(apm_suspend_waitqueue); 403static DECLARE_WAIT_QUEUE_HEAD(apm_suspend_waitqueue);
404static struct apm_user *user_list; 404static struct apm_user *user_list;
405static DEFINE_SPINLOCK(user_list_lock); 405static DEFINE_SPINLOCK(user_list_lock);
406static struct desc_struct bad_bios_desc = GDT_ENTRY_INIT(0x4092, 0, 0); 406
407/*
408 * Set up a segment that references the real mode segment 0x40
409 * that extends up to the end of page zero (that we have reserved).
410 * This is for buggy BIOS's that refer to (real mode) segment 0x40
411 * even though they are called in protected mode.
412 */
413static struct desc_struct bad_bios_desc = GDT_ENTRY_INIT(0x4092,
414 (unsigned long)__va(0x400UL), PAGE_SIZE - 0x400 - 1);
407 415
408static const char driver_version[] = "1.16ac"; /* no spaces */ 416static const char driver_version[] = "1.16ac"; /* no spaces */
409 417
@@ -2332,15 +2340,6 @@ static int __init apm_init(void)
2332 pm_flags |= PM_APM; 2340 pm_flags |= PM_APM;
2333 2341
2334 /* 2342 /*
2335 * Set up a segment that references the real mode segment 0x40
2336 * that extends up to the end of page zero (that we have reserved).
2337 * This is for buggy BIOS's that refer to (real mode) segment 0x40
2338 * even though they are called in protected mode.
2339 */
2340 set_desc_base(&bad_bios_desc, (unsigned long)__va(0x40UL << 4));
2341 set_desc_limit(&bad_bios_desc, 4095 - (0x40 << 4));
2342
2343 /*
2344 * Set up the long jump entry point to the APM BIOS, which is called 2343 * Set up the long jump entry point to the APM BIOS, which is called
2345 * from inline assembly. 2344 * from inline assembly.
2346 */ 2345 */
diff --git a/drivers/pnp/pnpbios/bioscalls.c b/drivers/pnp/pnpbios/bioscalls.c
index bd035e3d3550..fc83783c3a96 100644
--- a/drivers/pnp/pnpbios/bioscalls.c
+++ b/drivers/pnp/pnpbios/bioscalls.c
@@ -60,7 +60,8 @@ do { \
60 set_desc_limit(&gdt[(selname) >> 3], (size) - 1); \ 60 set_desc_limit(&gdt[(selname) >> 3], (size) - 1); \
61} while(0) 61} while(0)
62 62
63static struct desc_struct bad_bios_desc = GDT_ENTRY_INIT(0x4092, 0, 0); 63static struct desc_struct bad_bios_desc = GDT_ENTRY_INIT(0x4092,
64 (unsigned long)__va(0x400UL), PAGE_SIZE - 0x400 - 1);
64 65
65/* 66/*
66 * At some point we want to use this stack frame pointer to unwind 67 * At some point we want to use this stack frame pointer to unwind
@@ -476,8 +477,6 @@ void pnpbios_calls_init(union pnp_bios_install_struct *header)
476 pnp_bios_callpoint.offset = header->fields.pm16offset; 477 pnp_bios_callpoint.offset = header->fields.pm16offset;
477 pnp_bios_callpoint.segment = PNP_CS16; 478 pnp_bios_callpoint.segment = PNP_CS16;
478 479
479 set_desc_base(&bad_bios_desc, (unsigned long)__va(0x40UL << 4));
480 set_desc_limit(&bad_bios_desc, 4095 - (0x40 << 4));
481 for_each_possible_cpu(i) { 480 for_each_possible_cpu(i) {
482 struct desc_struct *gdt = get_cpu_gdt_table(i); 481 struct desc_struct *gdt = get_cpu_gdt_table(i);
483 if (!gdt) 482 if (!gdt)