merge mainline into arm
This commit is contained in:
commit
8e71d87482
490 changed files with 29659 additions and 8612 deletions
|
@ -158,7 +158,7 @@ grub_arg_show_help (grub_extcmd_t cmd)
|
|||
show_usage (cmd);
|
||||
grub_printf ("%s\n\n", _(cmd->cmd->description));
|
||||
|
||||
for (opt = cmd->options; opt->doc; opt++)
|
||||
for (opt = cmd->options; opt && opt->doc; opt++)
|
||||
switch (opt->shortarg)
|
||||
{
|
||||
case 'h':
|
||||
|
|
|
@ -96,10 +96,10 @@ grub_relocator_firmware_alloc_region (grub_addr_t start, grub_size_t size)
|
|||
|
||||
if (grub_efi_is_finished)
|
||||
return 1;
|
||||
|
||||
#ifdef DEBUG_RELOCATOR_NOMEM_DPRINTF
|
||||
grub_dprintf ("relocator", "EFI alloc: %llx, %llx\n",
|
||||
(unsigned long long) start, (unsigned long long) size);
|
||||
|
||||
#endif
|
||||
b = grub_efi_system_table->boot_services;
|
||||
status = efi_call_4 (b->allocate_pages, GRUB_EFI_ALLOCATE_ADDRESS,
|
||||
GRUB_EFI_LOADER_DATA, size >> 12, &address);
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
#include <grub/misc.h>
|
||||
#include <grub/acpi.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/pci.h>
|
||||
#include <grub/mm.h>
|
||||
|
||||
const char bochs_shutdown[] = "Shutdown";
|
||||
|
||||
|
@ -37,6 +39,23 @@ stop (void)
|
|||
}
|
||||
}
|
||||
|
||||
static int
|
||||
grub_shutdown_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid,
|
||||
void *data __attribute__ ((unused)))
|
||||
{
|
||||
/* QEMU. */
|
||||
if (pciid == 0x71138086)
|
||||
{
|
||||
grub_pci_address_t addr;
|
||||
addr = grub_pci_make_address (dev, 0x40);
|
||||
grub_pci_write (addr, 0x7001);
|
||||
addr = grub_pci_make_address (dev, 0x80);
|
||||
grub_pci_write (addr, grub_pci_read (addr) | 1);
|
||||
grub_outw (0x2000, 0x7004);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
grub_halt (void)
|
||||
{
|
||||
|
@ -49,10 +68,12 @@ grub_halt (void)
|
|||
/* Disable interrupts. */
|
||||
__asm__ __volatile__ ("cli");
|
||||
|
||||
/* Bochs, QEMU, etc. */
|
||||
/* Bochs, QEMU, etc. Removed in newer QEMU releases. */
|
||||
for (i = 0; i < sizeof (bochs_shutdown) - 1; i++)
|
||||
grub_outb (bochs_shutdown[i], 0x8900);
|
||||
|
||||
grub_pci_iterate (grub_shutdown_pci_iter, NULL);
|
||||
|
||||
grub_puts_ (N_("GRUB doesn't know how to halt this machine yet!"));
|
||||
|
||||
/* In order to return we'd have to check what the previous status of IF
|
||||
|
|
|
@ -25,8 +25,8 @@ grub_halt (void)
|
|||
{
|
||||
/* Not standardized. We try three known commands. */
|
||||
|
||||
grub_ieee1275_interpret ("shut-down", 0);
|
||||
grub_ieee1275_interpret ("power-off", 0);
|
||||
grub_ieee1275_interpret ("shut-down", 0);
|
||||
grub_ieee1275_interpret ("poweroff", 0);
|
||||
|
||||
while (1);
|
||||
|
|
|
@ -38,7 +38,7 @@ grub_relocator_firmware_get_max_events (void)
|
|||
{
|
||||
int counter = 0;
|
||||
|
||||
if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_CANNOT_INTERPRET))
|
||||
if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_FORCE_CLAIM))
|
||||
return 0;
|
||||
grub_machine_mmap_iterate (count, &counter);
|
||||
return 2 * counter;
|
||||
|
@ -92,7 +92,7 @@ grub_relocator_firmware_fill_events (struct grub_relocator_mmap_event *events)
|
|||
.counter = 0
|
||||
};
|
||||
|
||||
if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_CANNOT_INTERPRET))
|
||||
if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_FORCE_CLAIM))
|
||||
return 0;
|
||||
grub_machine_mmap_iterate (grub_relocator_firmware_fill_events_iter, &ctx);
|
||||
return ctx.counter;
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#define USHRT_MAX GRUB_USHRT_MAX
|
||||
#define UINT_MAX GRUB_UINT_MAX
|
||||
#define ULONG_MAX GRUB_ULONG_MAX
|
||||
#define SIZE_MAX GRUB_SIZE_MAX
|
||||
|
||||
#define SHRT_MAX GRUB_SHRT_MAX
|
||||
#define INT_MAX GRUB_INT_MAX
|
||||
|
|
|
@ -51,6 +51,8 @@ typedef grub_uint16_t u16;
|
|||
#define HAVE_BYTE_TYPEDEF 1
|
||||
typedef grub_uint8_t byte;
|
||||
|
||||
typedef grub_addr_t uintptr_t;
|
||||
|
||||
#define SIZEOF_UNSIGNED_LONG GRUB_CPU_SIZEOF_LONG
|
||||
#define SIZEOF_UNSIGNED_INT 4
|
||||
#define SIZEOF_UNSIGNED_LONG_LONG 8
|
||||
|
@ -58,7 +60,7 @@ typedef grub_uint8_t byte;
|
|||
#define SIZEOF_UINT64_T 8
|
||||
|
||||
#ifdef GRUB_CPU_WORDS_BIGENDIAN
|
||||
#define WORDS_BIGENDIAN
|
||||
#define WORDS_BIGENDIAN 1
|
||||
#else
|
||||
#undef WORDS_BIGENDIAN
|
||||
#endif
|
||||
|
|
|
@ -16,37 +16,12 @@
|
|||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TEST
|
||||
#include <grub/priority_queue.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/dl.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
#else
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <queue>
|
||||
|
||||
using namespace std;
|
||||
|
||||
typedef size_t grub_size_t;
|
||||
typedef int (*grub_comparator_t) (const void *a, const void *b);
|
||||
typedef unsigned char grub_uint8_t;
|
||||
#define grub_malloc malloc
|
||||
#define grub_memcpy memcpy
|
||||
#define grub_realloc realloc
|
||||
#define grub_free free
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GRUB_ERR_NONE,
|
||||
grub_errno
|
||||
} grub_err_t;
|
||||
#endif
|
||||
|
||||
struct grub_priority_queue
|
||||
{
|
||||
grub_size_t elsize;
|
||||
|
@ -56,10 +31,6 @@ struct grub_priority_queue
|
|||
void *els;
|
||||
};
|
||||
|
||||
#ifdef TEST
|
||||
typedef struct grub_priority_queue *grub_priority_queue_t;
|
||||
#endif
|
||||
|
||||
static inline void *
|
||||
element (struct grub_priority_queue *pq, grub_size_t k)
|
||||
{
|
||||
|
@ -189,69 +160,4 @@ grub_priority_queue_pop (grub_priority_queue_t pq)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef TEST
|
||||
|
||||
static int
|
||||
compar (const void *a_, const void *b_)
|
||||
{
|
||||
int a = *(int *) a_;
|
||||
int b = *(int *) b_;
|
||||
if (a < b)
|
||||
return -1;
|
||||
if (a > b)
|
||||
return +1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
priority_queue <int> pq;
|
||||
grub_priority_queue_t pq2;
|
||||
int counter;
|
||||
int s = 0;
|
||||
pq2 = grub_priority_queue_new (sizeof (int), compar);
|
||||
if (!pq2)
|
||||
return 1;
|
||||
srand (1);
|
||||
|
||||
for (counter = 0; counter < 1000000; counter++)
|
||||
{
|
||||
int op = rand () % 10;
|
||||
if (s && *(int *) grub_priority_queue_top (pq2) != pq.top ())
|
||||
{
|
||||
printf ("Error at %d\n", counter);
|
||||
return 2;
|
||||
}
|
||||
if (op < 3 && s)
|
||||
{
|
||||
grub_priority_queue_pop (pq2);
|
||||
pq.pop ();
|
||||
s--;
|
||||
}
|
||||
else
|
||||
{
|
||||
int v = rand ();
|
||||
int e;
|
||||
pq.push (v);
|
||||
e = grub_priority_queue_push (pq2, &v);
|
||||
if (e)
|
||||
return 3;
|
||||
s++;
|
||||
}
|
||||
}
|
||||
while (s)
|
||||
{
|
||||
if (*(int *) grub_priority_queue_top (pq2) != pq.top ())
|
||||
{
|
||||
printf ("Error at the end. %d elements remaining.\n", s);
|
||||
return 4;
|
||||
}
|
||||
grub_priority_queue_pop (pq2);
|
||||
pq.pop ();
|
||||
s--;
|
||||
}
|
||||
printf ("All tests passed successfully\n");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -599,7 +599,8 @@ malloc_in_range (struct grub_relocator *rel,
|
|||
do
|
||||
{
|
||||
if (p->magic != GRUB_MM_FREE_MAGIC)
|
||||
grub_fatal (__FILE__":%d free magic broken at %p (0x%x)\n",
|
||||
grub_fatal ("%s:%d free magic broken at %p (0x%x)\n",
|
||||
__FILE__,
|
||||
__LINE__, p, p->magic);
|
||||
if (p == (grub_mm_header_t) (r + 1))
|
||||
{
|
||||
|
@ -984,9 +985,11 @@ malloc_in_range (struct grub_relocator *rel,
|
|||
alloc_end = min (events[j].pos, target + size);
|
||||
if (alloc_end > alloc_start)
|
||||
{
|
||||
#ifdef DEBUG_RELOCATOR_NOMEM_DPRINTF
|
||||
grub_dprintf ("relocator", "subchunk 0x%lx-0x%lx, %d\n",
|
||||
(unsigned long) alloc_start,
|
||||
(unsigned long) alloc_end, typepre);
|
||||
#endif
|
||||
curschu->type = typepre;
|
||||
curschu->start = alloc_start;
|
||||
curschu->size = alloc_end - alloc_start;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue