gnewsense-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnewsense-dev] Re: [loongson-PATCH-v1 22/27] Hibernation Support in mip


From: Hongbing Hu
Subject: [Gnewsense-dev] Re: [loongson-PATCH-v1 22/27] Hibernation Support in mips system
Date: Tue, 26 May 2009 10:27:47 +0800
User-agent: Mozilla-Thunderbird 2.0.0.9 (X11/20080110)

yanh 写道:
在 2009-05-23六的 21:30 +0900,Atsushi Nemoto写道:
On Sat, 23 May 2009 16:06:43 +0800, yanh <address@hidden> wrote:
+unsigned long
+       saved_ra,
+       saved_sp,
...
+       saved_v0,
+       saved_v1;
Instead of enumerating them, I would prefer something like "struct
pt_regs saved_regs" or "unsigned long saved_regs[32]".
This implementation is referencing the x86 platform. Not all the 32 reigsters are needed to save. Maybe the whole registers needed to save can still be reduced.
I did not mean save/restore all registers.  I just mean using only one
symbol (struct or array).  Though the struct or array contains some
unused members, it saves many instructions in
swsusp_arch_{suspend,resume}.

For saving N registers, (N * 2) instructions are required to save to
individual variables, but (N + 2) instructions are required to save to
array or struct.

Yes, the struct array method is more efficient, we will change to it.
The length of registers is different between 32bit kernel and 64bit kernel. That means the file hibernate.S wiil be divided into hibernate_32.S and hibernate_64.S ?

+void save_processor_state(void)
+{
+       saved_status = read_c0_status();
+}
No need to save/restore floating point registers?
the floating point registers are not used by kernel, for user part, they
are already saved while entering into kernel mode.
No, floating point registers are not saved on entering into kernel.
They are saved on context switch.
Yes, suspend to disk will freeze processes at first,and i think the process wiil save the float point regs.
So there is no need to save them.
It's my mistake. But I think, if there is need to save floating point
registers, the kernel have already done for it. What's need to save should be for the resuming parts. Those registers which are used while in suspending path are needed to save.

create_image()

   in_suspend = 1;
    save_processor_state();
    error = swsusp_arch_suspend();
    if (error)
        printk(KERN_ERR "PM: Error %d creating hibernation image\n",
            error);
when resuming this functions is executed for righ after the swsusp_arch_suspend().
  This is not a normal function return.
  So the registers need to save are those damaged by swsusp_arch_suspend and 
what it calls.
because this is not a normal function call, the callee saved registers can not be restored, so we need to save
it explicitly. For caller saved temporary registers, they are already saved in 
create_image.  Are this right?
---
Atsushi Nemoto





--
---------------------------------------------------------
Hongbing,Hu (Software Department)
Tel:    0512-52308631
E-mail: address@hidden
MSN:    address@hidden
JiangSu Lemote Corp. Ltd.
MengLan, Yushan, Changshu, JiangSu Province, China
---------------------------------------------------------





reply via email to

[Prev in Thread] Current Thread [Next in Thread]