Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 39745
b: refs/heads/master
c: 3864c48
h: refs/heads/master
i:
  39743: 7224036
v: v3
  • Loading branch information
Peter Zijlstra authored and Linus Torvalds committed Oct 17, 2006
1 parent a39be7f commit 7aec31d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6a15f46c1272afd3010259067451bf0df04f6511
refs/heads/master: 3864c4894a7f4c03d69a90082a5bb0ab10e437ab
37 changes: 27 additions & 10 deletions trunk/arch/i386/kernel/apm.c
Original file line number Diff line number Diff line change
Expand Up @@ -540,11 +540,30 @@ static inline void apm_restore_cpus(cpumask_t mask)
* Also, we KNOW that for the non error case of apm_bios_call, there
* is no useful data returned in the low order 8 bits of eax.
*/
#define APM_DO_CLI \
if (apm_info.allow_ints) \
local_irq_enable(); \
else \

static inline unsigned long __apm_irq_save(void)
{
unsigned long flags;
local_save_flags(flags);
if (apm_info.allow_ints) {
if (irqs_disabled_flags(flags))
local_irq_enable();
} else
local_irq_disable();

return flags;
}

#define apm_irq_save(flags) \
do { flags = __apm_irq_save(); } while (0)

static inline void apm_irq_restore(unsigned long flags)
{
if (irqs_disabled_flags(flags))
local_irq_disable();
else if (irqs_disabled())
local_irq_enable();
}

#ifdef APM_ZERO_SEGS
# define APM_DECL_SEGS \
Expand Down Expand Up @@ -596,12 +615,11 @@ static u8 apm_bios_call(u32 func, u32 ebx_in, u32 ecx_in,
save_desc_40 = gdt[0x40 / 8];
gdt[0x40 / 8] = bad_bios_desc;

local_save_flags(flags);
APM_DO_CLI;
apm_irq_save(flags);
APM_DO_SAVE_SEGS;
apm_bios_call_asm(func, ebx_in, ecx_in, eax, ebx, ecx, edx, esi);
APM_DO_RESTORE_SEGS;
local_irq_restore(flags);
apm_irq_restore(flags);
gdt[0x40 / 8] = save_desc_40;
put_cpu();
apm_restore_cpus(cpus);
Expand Down Expand Up @@ -640,12 +658,11 @@ static u8 apm_bios_call_simple(u32 func, u32 ebx_in, u32 ecx_in, u32 *eax)
save_desc_40 = gdt[0x40 / 8];
gdt[0x40 / 8] = bad_bios_desc;

local_save_flags(flags);
APM_DO_CLI;
apm_irq_save(flags);
APM_DO_SAVE_SEGS;
error = apm_bios_call_simple_asm(func, ebx_in, ecx_in, eax);
APM_DO_RESTORE_SEGS;
local_irq_restore(flags);
apm_irq_restore(flags);
gdt[0x40 / 8] = save_desc_40;
put_cpu();
apm_restore_cpus(cpus);
Expand Down

0 comments on commit 7aec31d

Please sign in to comment.