Merge branch 'mainline' into relocator
This commit is contained in:
commit
8f2e29a2a3
99 changed files with 3333 additions and 732 deletions
|
@ -112,6 +112,13 @@ grub_file_read (grub_file_t file, void *buf, grub_size_t len)
|
|||
{
|
||||
grub_ssize_t res;
|
||||
|
||||
if (file->offset > file->size)
|
||||
{
|
||||
grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
"Attempt to read past the end of file.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (len == 0 || len > file->size - file->offset)
|
||||
len = file->size - file->offset;
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
* Note: GRUB is compiled with the options -mrtd and -mregparm=3.
|
||||
* So the first three arguments are passed in %eax, %edx, and %ecx,
|
||||
* respectively, and if a function has a fixed number of arguments
|
||||
* and the number if greater than three, the function must return
|
||||
* and the number is greater than three, the function must return
|
||||
* with "ret $N" where N is ((the number of arguments) - 3) * 4.
|
||||
*/
|
||||
|
||||
|
@ -1761,18 +1761,18 @@ FUNCTION(grub_vbe_bios_getset_dac_palette_width)
|
|||
movw $0x4f08, %ax
|
||||
int $0x10
|
||||
|
||||
movw %ax, %dx /* real_to_prot destroys %eax. */
|
||||
movw %ax, %cx /* real_to_prot destroys %eax. */
|
||||
|
||||
DATA32 call real_to_prot
|
||||
.code32
|
||||
|
||||
/* Move result back to *dac_mask_size. */
|
||||
xorl %eax, %eax
|
||||
movb %bh, %al
|
||||
movl %eax, (%edx)
|
||||
|
||||
/* Return value in %eax. */
|
||||
xorl %eax, %eax
|
||||
movw %dx, %ax
|
||||
movw %cx, %ax
|
||||
|
||||
popl %ebx
|
||||
popl %ebp
|
||||
|
|
108
kern/misc.c
108
kern/misc.c
|
@ -24,6 +24,12 @@
|
|||
#include <grub/term.h>
|
||||
#include <grub/env.h>
|
||||
|
||||
static int
|
||||
grub_iswordseparator (int c)
|
||||
{
|
||||
return (grub_isspace (c) || c == ',' || c == ';' || c == '|' || c == '&');
|
||||
}
|
||||
|
||||
void *
|
||||
grub_memmove (void *dest, const void *src, grub_size_t n)
|
||||
{
|
||||
|
@ -97,42 +103,6 @@ grub_stpcpy (char *dest, const char *src)
|
|||
return d - 1;
|
||||
}
|
||||
|
||||
char *
|
||||
grub_strcat (char *dest, const char *src)
|
||||
{
|
||||
char *p = dest;
|
||||
|
||||
while (*p)
|
||||
p++;
|
||||
|
||||
while ((*p = *src) != '\0')
|
||||
{
|
||||
p++;
|
||||
src++;
|
||||
}
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
char *
|
||||
grub_strncat (char *dest, const char *src, int c)
|
||||
{
|
||||
char *p = dest;
|
||||
|
||||
while (*p)
|
||||
p++;
|
||||
|
||||
while ((*p = *src) != '\0' && c--)
|
||||
{
|
||||
p++;
|
||||
src++;
|
||||
}
|
||||
|
||||
*p = '\0';
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
int
|
||||
grub_printf (const char *fmt, ...)
|
||||
{
|
||||
|
@ -250,39 +220,6 @@ grub_strncmp (const char *s1, const char *s2, grub_size_t n)
|
|||
return (int) *s1 - (int) *s2;
|
||||
}
|
||||
|
||||
int
|
||||
grub_strcasecmp (const char *s1, const char *s2)
|
||||
{
|
||||
while (*s1 && *s2)
|
||||
{
|
||||
if (grub_tolower (*s1) != grub_tolower (*s2))
|
||||
break;
|
||||
|
||||
s1++;
|
||||
s2++;
|
||||
}
|
||||
|
||||
return (int) grub_tolower (*s1) - (int) grub_tolower (*s2);
|
||||
}
|
||||
|
||||
int
|
||||
grub_strncasecmp (const char *s1, const char *s2, grub_size_t n)
|
||||
{
|
||||
if (n == 0)
|
||||
return 0;
|
||||
|
||||
while (*s1 && *s2 && --n)
|
||||
{
|
||||
if (grub_tolower (*s1) != grub_tolower (*s2))
|
||||
break;
|
||||
|
||||
s1++;
|
||||
s2++;
|
||||
}
|
||||
|
||||
return (int) grub_tolower (*s1) - (int) grub_tolower (*s2);
|
||||
}
|
||||
|
||||
char *
|
||||
grub_strchr (const char *s, int c)
|
||||
{
|
||||
|
@ -394,12 +331,6 @@ grub_strword (const char *haystack, const char *needle)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
grub_iswordseparator (int c)
|
||||
{
|
||||
return (grub_isspace (c) || c == ',' || c == ';' || c == '|' || c == '&');
|
||||
}
|
||||
|
||||
int
|
||||
grub_isspace (int c)
|
||||
{
|
||||
|
@ -412,33 +343,6 @@ grub_isprint (int c)
|
|||
return (c >= ' ' && c <= '~');
|
||||
}
|
||||
|
||||
int
|
||||
grub_isalpha (int c)
|
||||
{
|
||||
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
|
||||
}
|
||||
|
||||
int
|
||||
grub_isdigit (int c)
|
||||
{
|
||||
return (c >= '0' && c <= '9');
|
||||
}
|
||||
|
||||
int
|
||||
grub_isgraph (int c)
|
||||
{
|
||||
return (c >= '!' && c <= '~');
|
||||
}
|
||||
|
||||
int
|
||||
grub_tolower (int c)
|
||||
{
|
||||
if (c >= 'A' && c <= 'Z')
|
||||
return c - 'A' + 'a';
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
unsigned long
|
||||
grub_strtoul (const char *str, char **end, int base)
|
||||
|
|
|
@ -61,7 +61,8 @@ grub_rescue_parse_line (char *line, grub_reader_getline_t getline)
|
|||
else
|
||||
{
|
||||
grub_printf ("Unknown command `%s'\n", name);
|
||||
grub_printf ("Try `help' for usage\n");
|
||||
if (grub_command_find ("help"))
|
||||
grub_printf ("Try `help' for usage\n");
|
||||
}
|
||||
|
||||
quit:
|
||||
|
|
|
@ -140,6 +140,15 @@ grub_checkkey (void)
|
|||
return (grub_cur_term_input->checkkey) ();
|
||||
}
|
||||
|
||||
int
|
||||
grub_getkeystatus (void)
|
||||
{
|
||||
if (grub_cur_term_input->getkeystatus)
|
||||
return (grub_cur_term_input->getkeystatus) ();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
grub_uint16_t
|
||||
grub_getxy (void)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue