diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2009-07-18 11:11:06 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-07-19 12:27:52 -0400 |
commit | 57594742a2b545f8f114cda34f15650be8ae976d (patch) | |
tree | 2682b10d68f3fb33aa047fa2a3ff6db2061c0740 /arch/x86/kernel/apm_32.c | |
parent | fde0312d01b60a3fd5dc56e69a9613defbbc7097 (diff) |
x86: Introduce set_desc_base() and set_desc_limit()
Rename set_base()/set_limit to set_desc_base()/set_desc_limit()
and rewrite them in C. These are naturally introduced by the
idea of get_desc_base()/get_desc_limit().
The conversion actually found the bug in apm_32.c:
bad_bios_desc is written at run-time, but it is defined const
variable.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
LKML-Reference: <20090718151105.GC11294@localhost.localdomain>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/apm_32.c')
-rw-r--r-- | arch/x86/kernel/apm_32.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c index 79302e9a33a4..b5e841bd60d9 100644 --- a/arch/x86/kernel/apm_32.c +++ b/arch/x86/kernel/apm_32.c | |||
@@ -403,7 +403,7 @@ static DECLARE_WAIT_QUEUE_HEAD(apm_waitqueue); | |||
403 | static DECLARE_WAIT_QUEUE_HEAD(apm_suspend_waitqueue); | 403 | static DECLARE_WAIT_QUEUE_HEAD(apm_suspend_waitqueue); |
404 | static struct apm_user *user_list; | 404 | static struct apm_user *user_list; |
405 | static DEFINE_SPINLOCK(user_list_lock); | 405 | static DEFINE_SPINLOCK(user_list_lock); |
406 | static const struct desc_struct bad_bios_desc = { { { 0, 0x00409200 } } }; | 406 | static struct desc_struct bad_bios_desc = { { { 0, 0x00409200 } } }; |
407 | 407 | ||
408 | static const char driver_version[] = "1.16ac"; /* no spaces */ | 408 | static const char driver_version[] = "1.16ac"; /* no spaces */ |
409 | 409 | ||
@@ -2337,8 +2337,8 @@ static int __init apm_init(void) | |||
2337 | * This is for buggy BIOS's that refer to (real mode) segment 0x40 | 2337 | * This is for buggy BIOS's that refer to (real mode) segment 0x40 |
2338 | * even though they are called in protected mode. | 2338 | * even though they are called in protected mode. |
2339 | */ | 2339 | */ |
2340 | set_base(bad_bios_desc, __va((unsigned long)0x40 << 4)); | 2340 | set_desc_base(&bad_bios_desc, (unsigned long)__va(0x40UL << 4)); |
2341 | _set_limit((char *)&bad_bios_desc, 4095 - (0x40 << 4)); | 2341 | set_desc_limit(&bad_bios_desc, 4095 - (0x40 << 4)); |
2342 | 2342 | ||
2343 | /* | 2343 | /* |
2344 | * Set up the long jump entry point to the APM BIOS, which is called | 2344 | * Set up the long jump entry point to the APM BIOS, which is called |
@@ -2358,12 +2358,12 @@ static int __init apm_init(void) | |||
2358 | * code to that CPU. | 2358 | * code to that CPU. |
2359 | */ | 2359 | */ |
2360 | gdt = get_cpu_gdt_table(0); | 2360 | gdt = get_cpu_gdt_table(0); |
2361 | set_base(gdt[APM_CS >> 3], | 2361 | set_desc_base(&gdt[APM_CS >> 3], |
2362 | __va((unsigned long)apm_info.bios.cseg << 4)); | 2362 | (unsigned long)__va((unsigned long)apm_info.bios.cseg << 4)); |
2363 | set_base(gdt[APM_CS_16 >> 3], | 2363 | set_desc_base(&gdt[APM_CS_16 >> 3], |
2364 | __va((unsigned long)apm_info.bios.cseg_16 << 4)); | 2364 | (unsigned long)__va((unsigned long)apm_info.bios.cseg_16 << 4)); |
2365 | set_base(gdt[APM_DS >> 3], | 2365 | set_desc_base(&gdt[APM_DS >> 3], |
2366 | __va((unsigned long)apm_info.bios.dseg << 4)); | 2366 | (unsigned long)__va((unsigned long)apm_info.bios.dseg << 4)); |
2367 | 2367 | ||
2368 | proc_create("apm", 0, NULL, &apm_file_ops); | 2368 | proc_create("apm", 0, NULL, &apm_file_ops); |
2369 | 2369 | ||