I figure it out, the problem is caused by nested function:

int call_hook (grub_uint64_t ino, char *filename)

it would take 3 registry to pass the parameter ! (2 for ino), so %ecx
will be overwritten agian.

NESTED_FUNC_ATTR doesn't help, because there is only 2 parameters
here, so you need to use  __attribute__ ((regparm (1))) explicitly.

diff --git a/fs/xfs.c b/fs/xfs.c
index b3154c7..0e5f323 100644
--- a/fs/xfs.c
+++ b/fs/xfs.c
@@ -306,9 +306,9 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir,
                                grub_fshelp_node_t node))
 {
   struct grub_fshelp_node *diro = (struct grub_fshelp_node *) dir;
-  auto int call_hook (grub_uint64_t ino, char *filename);
+  auto int __attribute__ ((regparm(1))) call_hook (grub_uint64_t ino,
char *filename);

-  int call_hook (grub_uint64_t ino, char *filename)
+  int __attribute__ ((regparm(1))) call_hook (grub_uint64_t ino, char
*filename)
     {
       struct grub_fshelp_node *fdiro;


-- 
Bean


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to