~ubuntu-branches/ubuntu/trusty/grub2/trusty-updates

« back to all changes in this revision

Viewing changes to grub-core/efiemu/runtime/efiemu.c

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2012-09-13 18:02:04 UTC
  • mfrom: (1.17.15 upstream)
  • mto: (17.6.27 experimental)
  • mto: This revision was merged to the branch mainline in revision 145.
  • Revision ID: package-import@ubuntu.com-20120913180204-mojnmocbimlom4im
Tags: upstream-2.00
ImportĀ upstreamĀ versionĀ 2.00

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
   As it emulates only runtime serviceit isn't able
22
22
   to chainload EFI bootloader on non-EFI system (TODO) */
23
23
 
 
24
#ifdef __i386__
 
25
#include <grub/i386/types.h>
 
26
#else
 
27
#include <grub/x86_64/types.h>
 
28
#endif
 
29
 
24
30
#include <grub/symbol.h>
25
31
#include <grub/types.h>
26
32
#include <grub/efi/api.h>
40
46
efiemu_set_wakeup_time (grub_efi_boolean_t enabled,
41
47
                        grub_efi_time_t *time);
42
48
 
43
 
#ifdef APPLE_CC
 
49
#ifdef __APPLE__
44
50
#define PHYSICAL_ATTRIBUTE __attribute__ ((section("_text-physical, _text-physical")));
45
51
#else
46
52
#define PHYSICAL_ATTRIBUTE __attribute__ ((section(".text-physical")));
60
66
 
61
67
grub_efi_status_t
62
68
efiemu_get_variable (grub_efi_char16_t *variable_name,
63
 
                     grub_efi_guid_t *vendor_guid,
 
69
                     const grub_efi_guid_t *vendor_guid,
64
70
                     grub_efi_uint32_t *attributes,
65
71
                     grub_efi_uintn_t *data_size,
66
72
                     void *data);
149
155
}
150
156
 
151
157
static int
152
 
efiemu_memequal (void *a, void *b, grub_size_t n)
 
158
efiemu_memequal (const void *a, const void *b, grub_size_t n)
153
159
{
154
160
  grub_uint8_t *ptr1, *ptr2;
155
161
  for (ptr1 = (grub_uint8_t *) a, ptr2 = (grub_uint8_t *)b;
369
375
      switch (cur_relloc->size)
370
376
        {
371
377
        case 8:
372
 
          *((grub_uint64_t *) UINT_TO_PTR (cur_relloc->addr)) += corr;
 
378
          *((grub_uint64_t *) (grub_addr_t) cur_relloc->addr) += corr;
373
379
          break;
374
380
        case 4:
375
 
          *((grub_uint32_t *) UINT_TO_PTR (cur_relloc->addr)) += corr;
 
381
          *((grub_uint32_t *) (grub_addr_t) cur_relloc->addr) += corr;
376
382
          break;
377
383
        case 2:
378
 
          *((grub_uint16_t *) UINT_TO_PTR (cur_relloc->addr)) += corr;
 
384
          *((grub_uint16_t *) (grub_addr_t) cur_relloc->addr) += corr;
379
385
          break;
380
386
        case 1:
381
 
          *((grub_uint8_t *) UINT_TO_PTR (cur_relloc->addr)) += corr;
 
387
          *((grub_uint8_t *) (grub_addr_t) cur_relloc->addr) += corr;
382
388
          break;
383
389
        }
384
390
    }
410
416
 
411
417
/* Find variable by name and GUID. */
412
418
static struct efi_variable *
413
 
find_variable (grub_efi_guid_t *vendor_guid,
 
419
find_variable (const grub_efi_guid_t *vendor_guid,
414
420
               grub_efi_char16_t *variable_name)
415
421
{
416
422
  grub_uint8_t *ptr;
432
438
 
433
439
grub_efi_status_t
434
440
EFI_FUNC (efiemu_get_variable) (grub_efi_char16_t *variable_name,
435
 
                                   grub_efi_guid_t *vendor_guid,
436
 
                                   grub_efi_uint32_t *attributes,
437
 
                                   grub_efi_uintn_t *data_size,
438
 
                                   void *data)
 
441
                                const grub_efi_guid_t *vendor_guid,
 
442
                                grub_efi_uint32_t *attributes,
 
443
                                grub_efi_uintn_t *data_size,
 
444
                                void *data)
439
445
{
440
446
  struct efi_variable *efivar;
441
447
  LOG ('g');