From 4fe13e664b9c5b2ac20e48d0577e6c1f43fd91b1 Mon Sep 17 00:00:00 2001 From: yaya Date: Sat, 1 Jul 2023 09:26:34 +0800 Subject: [PATCH] =?UTF-8?q?=EF=BB=BF.=20=20=E4=BF=AE=E6=AD=A3=20timeout=20?= =?UTF-8?q?=E5=87=BD=E6=95=B0=20issues=20#418?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ChangeLog_chenall.txt | 3 +++ stage2/asm.S | 4 ++-- stage2/stage2.c | 21 +++++++++------------ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/ChangeLog_chenall.txt b/ChangeLog_chenall.txt index 07fa2ec..a21c6b4 100644 --- a/ChangeLog_chenall.txt +++ b/ChangeLog_chenall.txt @@ -1,4 +1,7 @@ 更新说明: +2023-07-01 (yaya) + 修正 timeout 函数。issues #418 + 2023-06-23 (yaya) 碎片数由39增加到126。 避免分区项空洞。issues #416 diff --git a/stage2/asm.S b/stage2/asm.S index 62aadd2..481716e 100644 --- a/stage2/asm.S +++ b/stage2/asm.S @@ -15056,7 +15056,7 @@ ENTRY(console_getkey) cmpl $0xFFFFFFFF, %edx jne 1f - pushl $20 + pushl $1 call defer popl %eax cmpb $0, beep_enable @@ -15217,7 +15217,7 @@ ENTRY(console_checkkey) 9: cmpl $0xFFFFFFFF, %edx jne 3f - pushl $20 + pushl $1 call defer popl %eax cmpb $0, beep_enable diff --git a/stage2/stage2.c b/stage2/stage2.c index 59a30bd..21d5907 100644 --- a/stage2/stage2.c +++ b/stage2/stage2.c @@ -978,10 +978,8 @@ run_menu (char *menu_entries, char *config_entries, /*int num_entries,*/ char *h if (! show_menu) { /* Get current time. */ -// while ((time1 = getrtsecs ()) == 0xFF) -// ; - if (grub_timeout >= 0) - timeout_enable = 1; + while ((time1 = getrtsecs ()) == 0xFF) + ; while (1) { @@ -1018,9 +1016,7 @@ run_menu (char *menu_entries, char *config_entries, /*int num_entries,*/ char *h /* If GRUB_TIMEOUT is expired, boot the default entry. */ if (grub_timeout >=0 -// && (time1 = getrtsecs ()) != time2 - && time1 != time2 - /* && time1 != 0xFF */) + && (time1 = getrtsecs ()) != time2) { if (grub_timeout <= 0) { @@ -1187,8 +1183,9 @@ run_menu (char *menu_entries, char *config_entries, /*int num_entries,*/ char *h if (menu_init_script_file[0] != 0 ) command_func(menu_init_script_file,BUILTIN_MENU); /* XX using RT clock now, need to initialize value */ -// while ((time1 = getrtsecs()) == 0xFF); - if (grub_timeout >= 0) + if (!ext_timer) + while ((time1 = getrtsecs()) == 0xFF); + else if (grub_timeout >= 0) timeout_enable = 1; old_c = 0; @@ -1202,9 +1199,9 @@ run_menu (char *menu_entries, char *config_entries, /*int num_entries,*/ char *h /* Initialize to NULL just in case... */ //cur_entry = NULL; //cur_entry = menu_entries; /* for modified menu */ - -// if (grub_timeout >= 0 && (time1 = getrtsecs()) != time2 /* && time1 != 0xFF */) - if (grub_timeout >= 0 && time1 != time2 /* && time1 != 0xFF */) + if (grub_timeout >= 0 && + ((!ext_timer && ((time1 = getrtsecs()) != time2)) || + (ext_timer && time1 != time2))) { if (grub_timeout <= 0) {