Re: [rft] s2ram wakeup moves to .c, could fix few machines

From: Pavel Machek
Date: Fri Feb 08 2008 - 16:56:52 EST


Hi!

>> + .section ".header", "a"
>> +
>> +/* This should match the structure in wakeup.h */
>> + .globl wakeup_header
>> +wakeup_header:
>> +video_mode: .short 0 /* Video mode number */
>> +pmode_return: .byte 0x66, 0xea /* ljmpl */
>> + .long 0 /* offset goes here */
>> + .short __KERNEL_CS
>
> Missing a .short pad here... Pavel fixed that at some point, I thought.

No pad needed, AFAICT.

>> }
>> - memcpy((void *)acpi_wakeup_address, &wakeup_start,
>> - &wakeup_end - &wakeup_start);
>> - acpi_copy_wakeup_routine(acpi_wakeup_address);
>> + memcpy((void *)acpi_realmode, &wakeup_code_start, 4*PAGE_SIZE);
>
> Using a PAGE_SIZE multiplier here isn't a good thing...

Fixed.

>> + header = (struct wakeup_header *)(acpi_realmode + 0x3f00);
>
> ... especially not with magic constants like this.

Fixed.

> If you're putting the "header" at the end, then you should also replace the
> end_signature stuff since that's, then, redundant. Furthermore, by doing
> so, you're also padding the binary out to its maximum length, so you might
> as well just remove the .bss-clearing stuff.

Good, lets remove bss clearing.

>> + header->pmode_efer_low = nx_enabled;
>> + if (header->pmode_efer_low & 1) {
>> + /* This is strange, why not save efer, always? */
>> + rdmsr(MSR_EFER, header->pmode_efer_low,
>> + header->pmode_efer_high);
>> + }
>
> Yes, why not save EFER every time?

Dunno, I copied it from other code, and as it depends on nx setting,
I'd prefer not to touch it for now. Do old CPUs have EFER?

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/