Skip to content

Commit

Permalink
. 改进 setkey 命令及帮助,完全支持匈牙利键盘(由 steve 提供)。(issues #193)
Browse files Browse the repository at this point in the history
. 改进 displaymem 及 bootlace 命令。
  • Loading branch information
yaya committed May 7, 2019
1 parent 1069d58 commit 11a3079
Show file tree
Hide file tree
Showing 4 changed files with 144 additions and 23 deletions.
4 changes: 4 additions & 0 deletions ChangeLog_chenall.txt
@@ -1,4 +1,8 @@
更新说明: 更新说明:
2019-05-07(yaya)
改进 setkey 命令及帮助,完全支持匈牙利键盘(由 steve 提供)。
改进 displaymem 及 bootlace 命令。

2019-03-25(yaya) 2019-03-25(yaya)
修正动态 VHD 不再能够支持的问题。 修正动态 VHD 不再能够支持的问题。
条件菜单项目(iftitle )支持图形菜单。 条件菜单项目(iftitle )支持图形菜单。
Expand Down
63 changes: 54 additions & 9 deletions stage2/asm.S
Expand Up @@ -5593,6 +5593,11 @@ minimum_mem_lo_in_map:
.long 0 /* min ram drive base below 16M */ .long 0 /* min ram drive base below 16M */
ENTRY(minimum_mem_hi_in_map) ENTRY(minimum_mem_hi_in_map)
.long 0 /* min ram drive base above 16M */ .long 0 /* min ram drive base above 16M */

ENTRY(prime_end)
.long 0,0
ENTRY(new_end)
.long 0,0


#if 0 #if 0
int15_e820_saved_ebx: int15_e820_saved_ebx:
Expand Down Expand Up @@ -5722,7 +5727,7 @@ int15_e820_handler:
movl %es:16(%di), %eax /* Type: 1 = usable memory. */ movl %es:16(%di), %eax /* Type: 1 = usable memory. */
decl %eax /* is it usable? */ decl %eax /* is it usable? */
jz 5f /* yes, modify usable mem range */ jz 5f /* yes, modify usable mem range */

#if 0
/* it is reserved memory. only modify low mem range at this moment. */ /* it is reserved memory. only modify low mem range at this moment. */
cmpl %edx, %cs:(EXT_C(int15nolow) - int13_handler) /* EDX=0 */ cmpl %edx, %cs:(EXT_C(int15nolow) - int13_handler) /* EDX=0 */
jnz 4f /* int15 will not handle low mem */ jnz 4f /* int15 will not handle low mem */
Expand All @@ -5743,7 +5748,26 @@ int15_e820_handler:
movl $0xA0000, %es:8(%di) movl $0xA0000, %es:8(%di)
subl %eax, %es:8(%di) subl %eax, %es:8(%di)
jmp 4f /* done modifying reserved low mem range */ jmp 4f /* done modifying reserved low mem range */
#endif

andb $0xfe, (prime_end - int13_handler)
movl %es:4(%di), %edx
cmpl %edx, (prime_end + 4 - int13_handler) //0
jne 4f
movl %es:(%di), %eax
cmpl %eax, (prime_end - int13_handler)
jne 4f

subl (new_end - int13_handler), %eax
sbbl (new_end + 4 - int13_handler), %edx
addl %eax, %es:8(%di)
adcl %edx, %es:12(%di)


movl (new_end - int13_handler), %eax
movl (new_end + 4 - int13_handler), %edx
movl %eax, %es:(%di)
movl %edx, %es:4(%di)
jmp 4f
5: 5:
/* it is usable memory. */ /* it is usable memory. */


Expand All @@ -5754,12 +5778,13 @@ int15_e820_handler:
#else #else
movw $(EXT_C(hooked_drive_map)-int13_handler-DRIVE_MAP_SLOT_SIZE), %si movw $(EXT_C(hooked_drive_map)-int13_handler-DRIVE_MAP_SLOT_SIZE), %si
#endif #endif
movw $(DRIVE_MAP_SIZE + 1), %cx movw $(DRIVE_MAP_SIZE + 1), %bp


popl %eax /* available low mem size in bytes */ popl %eax /* available low mem size in bytes */
pushl %eax /* available low mem size in bytes */ pushl %eax /* available low mem size in bytes */


cmpl %edx, %cs:(EXT_C(int15nolow) - int13_handler) /* EDX=0 */ // cmpl %edx, %cs:(EXT_C(int15nolow) - int13_handler) /* EDX=0 */
cmpl $0, %cs:(EXT_C(int15nolow) - int13_handler)
jz 7f /* int15 will handle low mem */ jz 7f /* int15 will handle low mem */
jmp 5f /* this "jmp" instruction can be omitted. */ jmp 5f /* this "jmp" instruction can be omitted. */
6: 6:
Expand Down Expand Up @@ -5795,12 +5820,32 @@ int15_e820_handler:
subl %es:8(%di), %eax subl %es:8(%di), %eax
sbbl %es:12(%di), %edx /* EDX:EAX=difference */ sbbl %es:12(%di), %edx /* EDX:EAX=difference */
jnb 5f /* new length is too big */ jnb 5f /* new length is too big */
addl %eax, %es:8(%di) // addl %eax, %es:8(%di)
adcl %edx, %es:12(%di) /* apply new length */ // adcl %edx, %es:12(%di) /* apply new length */
movl %es:8(%di), %ebx
movl %es:12(%di), %ecx
addl %ebx, %eax
adcl %ecx, %edx
movl %eax, %es:8(%di)
movl %edx, %es:12(%di)
addl %es:(%di), %eax
adcl %es:4(%di), %edx
movl %eax, (new_end - int13_handler)
movl %edx, (new_end + 4 - int13_handler)

testb $1, (prime_end - int13_handler)
jne 5f
addl %es:(%di), %ebx
adcl %es:4(%di), %ecx
movl %ebx, (prime_end - int13_handler)
movl %ecx, (prime_end + 4 - int13_handler)
orb $1, (prime_end - int13_handler)
5: 5:
/* try next slot */ /* try next slot */
addw $DRIVE_MAP_SLOT_SIZE, %si addw $DRIVE_MAP_SLOT_SIZE, %si
loop 6b // loop 6b
dec %bp
jne 6b
/* done modifying usable mem range */ /* done modifying usable mem range */
4: 4:
popl %eax /* available low mem size in bytes */ popl %eax /* available low mem size in bytes */
Expand Down Expand Up @@ -13172,9 +13217,9 @@ ENTRY(get_mmap_entry)
movw %di, %si movw %di, %si


movl $0xe820, %eax movl $0xe820, %eax
//int $0x15 int $0x15
pushfw // pushfw
lcall %cs:*ABS(EXT_C(ROM_int15)) // lcall %cs:*ABS(EXT_C(ROM_int15))


jnc 1f jnc 1f
movl $0, %ebx /* set end indicator */ movl $0, %ebx /* set end indicator */
Expand Down
11 changes: 7 additions & 4 deletions stage2/bootlace.inc
Expand Up @@ -1768,26 +1768,29 @@ sb:
movl 0x20(iSI), %eax movl 0x20(iSI), %eax
subl $16, %eax subl $16, %eax
cmpl %edx, %eax cmpl %edx, %eax
ja 210f jae 210f
movl $ABS(msg_cannot_install_gpt_partition), %ecx movl $ABS(msg_cannot_install_gpt_partition), %ecx
movl $0x7f, %edi
3: 3:
cmpl $0, 0x2c(iSI) cmpl $0, 0x2c(iSI)
jne 4f jne 4f
cmpl $0, 0xa4(iSI) cmpl $0, 0xa4(iSI)
jne 4f jne 4f
movl 0xa0(iSI), %eax movl 0xa0(iSI), %eax
orl %eax, %eax
je 4f
movl 0x28(iSI), %edx movl 0x28(iSI), %edx
addl $1, %edx
subl $16, %eax subl $16, %eax
cmpl %edx, %eax cmpl %edx, %eax
ja 210f jae 210f
addl $0x80, %esi addl $0x80, %esi
cmpl $0, 0x20(iSI) subl $1, %edi
jne 3b jne 3b
jmp 4f jmp 4f
210: 210:
addl $1, %edx
movl $ABS(msg_cannot_install_gpt_partition), %ecx movl $ABS(msg_cannot_install_gpt_partition), %ecx
cmpl $0x800000, %edx cmpl $0x800000, %edx
jae 4f jae 4f
Expand Down
89 changes: 79 additions & 10 deletions stage2/builtins.c
Expand Up @@ -4620,6 +4620,7 @@ displaymem_func (char *arg, int flags)
"Upper memory (to first chipset hole): %uK\n", "Upper memory (to first chipset hole): %uK\n",
(unsigned long)saved_mem_lower, (unsigned long)saved_mem_upper); (unsigned long)saved_mem_lower, (unsigned long)saved_mem_upper);
} }
#if 0
if (mbi.flags & MB_INFO_MEM_MAP) if (mbi.flags & MB_INFO_MEM_MAP)
{ {
struct AddrRangeDesc *map = (struct AddrRangeDesc *) saved_mmap_addr; struct AddrRangeDesc *map = (struct AddrRangeDesc *) saved_mmap_addr;
Expand Down Expand Up @@ -4654,7 +4655,34 @@ displaymem_func (char *arg, int flags)
map = ((struct AddrRangeDesc *) (((int) map) + 4 + map->size)); map = ((struct AddrRangeDesc *) (((int) map) + 4 + map->size));
} }
} }
#else
grub_printf (" [Address Range Descriptor entries "
"immediately follow (values are 64-bit)]\n");


unsigned long cont, addr;
addr = SCRATCHADDR;
cont = 0;
do
{
cont = get_mmap_entry ((void *) addr, cont); /* int15/e820 ------ will write memory! */
struct AddrRangeDesc *map = (struct AddrRangeDesc *) addr;
if (!sector)
{
grub_printf (" %s: Base: 0x%8lX, Length: 0x%8lX\n",
(map->Type == MB_ARD_MEMORY)?"Usable RAM":"Reserved ",
map->BaseAddr,
map->Length);
}
else if (map->Type == MB_ARD_MEMORY)
{
grub_printf (" Usable (Hex sectors): Base: %8lX, Length: %8lX, End: %8lX\n",
map->BaseAddr / 0x200,
map->Length / 0x200,
map->BaseAddr + map->Length / 0x200);
}
}
while (cont);
#endif
return 1; return 1;
} }


Expand Down Expand Up @@ -13984,6 +14012,47 @@ static struct keysym keysym_table[] =
{"ctrlF8", 0x6500}, {"ctrlF8", 0x6500},
{"ctrlF9", 0x6600}, {"ctrlF9", 0x6600},
{"ctrlF10", 0x6700}, {"ctrlF10", 0x6700},

{"Aq", 0x1000}, // A=Alt or AltGr. Provided by steve.
{"Aw", 0x1100},
{"Ae", 0x1200},
{"Ar", 0x1300},
{"At", 0x1400},
{"Ay", 0x1500},
{"Au", 0x1600},
{"Ai", 0x1700},
{"Ao", 0x1800},
{"Ap", 0x1900},
{"Aa", 0x1e00},
{"As", 0x1f00},
{"Ad", 0x2000},
{"Af", 0x2100},
{"Ag", 0x2200},
{"Ah", 0x2300},
{"Aj", 0x2400},
{"Ak", 0x2500},
{"Al", 0x2600},
{"Az", 0x2c00},
{"Ax", 0x2d00},
{"Ac", 0x2e00},
{"Av", 0x2f00},
{"Ab", 0x3000},
{"An", 0x3100},
{"Am", 0x3200},
{"A1", 0x7800},
{"A2", 0x7900},
{"A3", 0x7A00},
{"A4", 0x7B00},
{"A5", 0x7C00},
{"A6", 0x7D00},
{"A7", 0x7E00},
{"A8", 0x7F00},
{"A9", 0x8000},
{"A0", 0x8100},
{"oem102", 0x565c},
{"shiftoem102", 0x567c},


}; };


//static int find_key_code (char *key); //static int find_key_code (char *key);
Expand Down Expand Up @@ -14103,16 +14172,16 @@ static struct builtin builtin_setkey =
"setkey", "setkey",
setkey_func, setkey_func,
BUILTIN_CMDLINE | BUILTIN_SCRIPT | BUILTIN_MENU | BUILTIN_HELP_LIST, BUILTIN_CMDLINE | BUILTIN_SCRIPT | BUILTIN_MENU | BUILTIN_HELP_LIST,
"setkey [TO_KEY FROM_KEY]", "setkey [NEW_KEY FROM_KEY]",
"Change the keyboard map. The key FROM_KEY is mapped to the key TO_KEY." "Map default USA key FROM_KEY to NEW_KEY."
" A key must be an alphabet, a digit, or one of these: escape, exclam," " Key names: 0-9, A-Z, a-z or escape, exclam, at, numbersign, dollar," //Provided by steve.
" at, numbersign, dollar, percent, caret, ampersand, asterisk, parenleft," " percent, caret, ampersand, asterisk, parenleft, parenright, minus,"
" parenright, minus, underscore, equal, plus, backspace, tab, bracketleft," " underscore, equal, plus, backspace, tab, bracketleft, braceleft,"
" braceleft, bracketright, braceright, enter, control, semicolon, colon," " bracketright, braceright, enter, semicolon, colon, quote, doublequote,"
" quote, doublequote, backquote, tilde, shift, backslash, bar, comma," " backquote, tilde, shift, backslash, bar, comma, less, period,"
" less, period, greater, slash, question, alt, space, capslock, FX (X" " greater, slash, question, alt, space, delete, oem102, shiftoem102"
" is a digit), and delete. If no argument is specified, reset key" " [ctrl|shift]F1-10. Use A for Alt+(a-z)(0-9), e.g. 'setkey at Av'."
" mappings." " Reset: 'setkey at at' to reset one key, 'setkey' to reset all. "
}; };




Expand Down

0 comments on commit 11a3079

Please sign in to comment.