]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
merge mainline into intwrap
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sun, 29 Aug 2010 21:21:21 +0000 (23:21 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sun, 29 Aug 2010 21:21:21 +0000 (23:21 +0200)
1  2 
grub-core/Makefile.am
grub-core/Makefile.core.def
grub-core/disk/i386/pc/biosdisk.c
grub-core/kern/efi/efi.c
grub-core/kern/i386/coreboot/init.c
grub-core/kern/i386/pc/init.c
grub-core/kern/i386/pc/startup.S
grub-core/kern/i386/qemu/mmap.c
grub-core/loader/i386/pc/linux.c
include/grub/misc.h

index 28346648b25e1731a78fb6a12e6cd2c65eccb8ed,61a0bb35a947bf13f61d640f631600731d050682..2dd34ee78f9bb8f63152cf56e5b9dced16300449
@@@ -104,34 -104,28 +103,25 @@@ KERNEL_HEADER_FILES += $(top_srcdir)/in
  endif
  
  if COND_i386_coreboot
- KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h
- KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h
- KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h
  KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/boot.h
  KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/console.h
 -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/init.h
  KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h
- KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/loader.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h
  endif
  
  if COND_i386_multiboot
- KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h
- KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h
- KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h
  KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/boot.h
  KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/console.h
 -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/init.h
  KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h
- KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/loader.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h
  endif
  
  if COND_i386_qemu
- KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h
- KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h
- KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h
  KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/boot.h
  KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/console.h
 -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/init.h
  KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h
- KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/loader.h
  KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h
  endif
  
  if COND_i386_ieee1275
Simple merge
Simple merge
index 3b349374e3900ad2366bc2a6d20e28ae7c33aa65,e80bc1f19a7f97d1d7d57d7e8a080cf5f9bad6ac..fa1d0c730fab85c9e5d1912b7caa002f46e8f246
@@@ -174,17 -174,15 +174,6 @@@ grub_reboot (void
  }
  #endif
  
- int
- grub_efi_exit_boot_services (grub_efi_uintn_t map_key)
 -void
 -grub_halt (void)
--{
-   grub_efi_boot_services_t *b;
-   grub_efi_status_t status;
-   b = grub_efi_system_table->boot_services;
-   status = efi_call_2 (b->exit_boot_services, grub_efi_image_handle, map_key);
-   return status == GRUB_EFI_SUCCESS;
 -  grub_efi_fini ();
 -  efi_call_4 (grub_efi_system_table->runtime_services->reset_system,
 -              GRUB_EFI_RESET_SHUTDOWN, GRUB_EFI_SUCCESS, 0, NULL);
 -  for (;;) ;
--}
--
  grub_err_t
  grub_efi_set_virtual_address_map (grub_efi_uintn_t memory_map_size,
                                  grub_efi_uintn_t descriptor_size,
Simple merge
Simple merge
index 463f66960b2b52e4ec9fc91a4c9d305d3ec04495,7ae9017129c31041598371cb9219bdbfc30f4a13..b5e9a9b85d8e28823a2dc3afcd1cbef6c58dda0d
@@@ -491,90 -561,220 +489,88 @@@ FUNCTION(grub_chainloader_real_boot
        ljmp    $0, $GRUB_MEMORY_MACHINE_BOOT_LOADER_ADDR
        .code32
  
- #include "../loader.S"
  /*
 - *   int grub_biosdisk_rw_int13_extensions (int ah, int drive, void *dap)
 + * void grub_console_putchar (int c)
   *
 - *   Call IBM/MS INT13 Extensions (int 13 %ah=AH) for DRIVE. DAP
 - *   is passed for disk address packet. If an error occurs, return
 - *   non-zero, otherwise zero.
 - */
 -
 -FUNCTION(grub_biosdisk_rw_int13_extensions)
 -      pushl   %ebp
 -      pushl   %esi
 -
 -      /* compute the address of disk_address_packet */
 -      movw    %cx, %si
 -      xorw    %cx, %cx
 -      shrl    $4, %ecx        /* save the segment to cx */
 -
 -      /* ah */
 -      movb    %al, %dh
 -      /* enter real mode */
 -      call    prot_to_real
 -
 -      .code16
 -      movb    %dh, %ah
 -      movw    %cx, %ds
 -      int     $0x13           /* do the operation */
 -      movb    %ah, %dl        /* save return value */
 -      /* back to protected mode */
 -      DATA32  call    real_to_prot
 -      .code32
 -
 -      movb    %dl, %al        /* return value in %eax */
 -
 -      popl    %esi
 -      popl    %ebp
 -
 -      ret
 -
 -/*
 - *   int grub_biosdisk_rw_standard (int ah, int drive, int coff, int hoff,
 - *                                  int soff, int nsec, int segment)
 + * Put the character C on the console. Because GRUB wants to write a
 + * character with an attribute, this implementation is a bit tricky.
 + * If C is a control character (CR, LF, BEL, BS), use INT 10, AH = 0Eh
 + * (TELETYPE OUTPUT). Otherwise, save the original position, put a space,
 + * save the current position, restore the original position, write the
 + * character and the attribute, and restore the current position.
   *
 - *   Call standard and old INT13 (int 13 %ah=AH) for DRIVE. Read/write
 - *   NSEC sectors from COFF/HOFF/SOFF into SEGMENT. If an error occurs,
 - *   return non-zero, otherwise zero.
 + * The reason why this is so complicated is that there is no easy way to
 + * get the height of the screen, and the TELETYPE OUTPUT BIOS call doesn't
 + * support setting a background attribute.
   */
 +FUNCTION(grub_console_putchar)
 +      /* Retrieve the base character.  */
 +      movl    0(%edx), %edx
 +      pusha
 +      movb    EXT_C(grub_console_cur_color), %bl
  
 -FUNCTION(grub_biosdisk_rw_standard)
 -      pushl   %ebp
 -      movl    %esp, %ebp
 -
 -      pushl   %ebx
 -      pushl   %edi
 -      pushl   %esi
 -
 -      /* set up CHS information */
 -
 -      /* set %ch to low eight bits of cylinder */
 -      xchgb   %cl, %ch
 -      /* set bits 6-7 of %cl to high two bits of cylinder */
 -      shlb    $6, %cl
 -      /* set bits 0-5 of %cl to sector */
 -      addb    0xc(%ebp), %cl
 -      /* set %dh to head */
 -      movb    0x8(%ebp), %dh
 -      /* set %ah to AH */
 -      movb    %al, %ah
 -      /* set %al to NSEC */
 -      movb    0x10(%ebp), %al
 -      /* save %ax in %di */
 -      movw    %ax, %di
 -      /* save SEGMENT in %bx */
 -      movw    0x14(%ebp), %bx
 -
 -      /* enter real mode */
        call    prot_to_real
 -
        .code16
 -      movw    %bx, %es
 -      xorw    %bx, %bx
 -      movw    $3, %si         /* attempt at least three times */
 -
 -1:
 -      movw    %di, %ax
 -      int     $0x13           /* do the operation */
 -      jnc     2f              /* check if successful */
 -
 -      movb    %ah, %bl        /* save return value */
 -      /* if fail, reset the disk system */
 -      xorw    %ax, %ax
 -      int     $0x13
 -
 -      decw    %si
 -      cmpw    $0, %si
 -      je      2f
 -      xorb    %bl, %bl
 -      jmp     1b              /* retry */
 -2:
 -      /* back to protected mode */
 -      DATA32  call    real_to_prot
 -      .code32
 -
 -      movb    %bl, %al        /* return value in %eax */
 -
 -      popl    %esi
 -      popl    %edi
 -      popl    %ebx
 -      popl    %ebp
 -
 -      ret     $(4 * 4)
 -
 -
 -/*
 - *   int grub_biosdisk_check_int13_extensions (int drive)
 - *
 - *   Check if LBA is supported for DRIVE. If it is supported, then return
 - *   the major version of extensions, otherwise zero.
 - */
 +      movb    %dl, %al
 +      xorb    %bh, %bh
  
 -FUNCTION(grub_biosdisk_check_int13_extensions)
 -      pushl   %ebp
 -      pushl   %ebx
 +      /* use teletype output if control character */
 +      cmpb    $0x7, %al
 +      je      1f
 +      cmpb    $0x8, %al
 +      je      1f
 +      cmpb    $0xa, %al
 +      je      1f
 +      cmpb    $0xd, %al
 +      je      1f
  
 -      /* drive */
 -      movb    %al, %dl
 -      /* enter real mode */
 -      call    prot_to_real
 +      /* save the character and the attribute on the stack */
 +      pushw   %ax
 +      pushw   %bx
  
 -      .code16
 -      movb    $0x41, %ah
 -      movw    $0x55aa, %bx
 -      int     $0x13           /* do the operation */
 +      /* get the current position */
 +      movb    $0x3, %ah
 +      int     $0x10
  
 -      /* check the result */
 -      jc      1f
 -      cmpw    $0xaa55, %bx
 -      jne     1f
 +      /* check the column with the width */
 +      cmpb    $79, %dl
 +      jl      2f
  
 -      movb    %ah, %bl        /* save the major version into %bl */
 +      /* print CR and LF, if next write will exceed the width */
 +      movw    $0x0e0d, %ax
 +      int     $0x10
 +      movb    $0x0a, %al
 +      int     $0x10
  
 -      /* check if AH=0x42 is supported */
 -      andw    $1, %cx
 -      jnz     2f
 +      /* get the current position */
 +      movb    $0x3, %ah
 +      int     $0x10
  
 -1:
 -      xorb    %bl, %bl
  2:
 -      /* back to protected mode */
 -      DATA32  call    real_to_prot
 -      .code32
 -
 -      movb    %bl, %al        /* return value in %eax */
 -
 -      popl    %ebx
 -      popl    %ebp
 -
 -      ret
 -
 -
 -/*
 - *   int grub_biosdisk_get_cdinfo_int13_extensions (int drive, void *cdrp)
 - *
 - *   Return the cdrom information of DRIVE in CDRP. If an error occurs,
 - *   then return non-zero, otherwise zero.
 - */
 +      /* restore the character and the attribute */
 +      popw    %bx
 +      popw    %ax
  
 -FUNCTION(grub_biosdisk_get_cdinfo_int13_extensions)
 -      movw    $0x4B01, %cx
 -      jmp     1f
 +      /* write the character with the attribute */
 +      movb    $0x9, %ah
 +      movw    $1, %cx
 +      int     $0x10
  
 -/*
 - *   int grub_biosdisk_get_diskinfo_int13_extensions (int drive, void *drp)
 - *
 - *   Return the geometry of DRIVE in a drive parameters, DRP. If an error
 - *   occurs, then return non-zero, otherwise zero.
 - */
 +      /* move the cursor forward */
 +      incb    %dl
 +      movb    $0x2, %ah
 +      int     $0x10
  
 -FUNCTION(grub_biosdisk_get_diskinfo_int13_extensions)
 -      movb    $0x48, %ch
 -1:
 -      pushl   %ebp
 -      pushl   %ebx
 -      pushl   %esi
 +      jmp     3f
  
 -      /* compute the address of drive parameters */
 -      movw    %dx, %si
 -      andl    $0xf, %esi
 -      shrl    $4, %edx
 -      movw    %dx, %bx        /* save the segment into %bx */
 -      /* drive */
 -      movb    %al, %dl
 -      /* enter real mode */
 -      call    prot_to_real
 +1:    movw    $1, %bx
 +      movb    $0xe, %ah
 +      int     $0x10
  
 -      .code16
 -      movw    %cx, %ax
 -      movw    %bx, %ds
 -      int     $0x13           /* do the operation */
 -      jc      noclean
 -      /* Clean return value if carry isn't set to workaround
 -      some buggy BIOSes.  */
 -      xor     %ax, %ax
 -noclean:
 -      movb    %ah, %bl        /* save return value in %bl */
 -      /* back to protected mode */
 -      DATA32  call    real_to_prot
 +3:    DATA32  call    real_to_prot
        .code32
  
 -      movb    %bl, %al        /* return value in %eax */
 -
 -      popl    %esi
 -      popl    %ebx
 -      popl    %ebp
 -
 +      popa
        ret
  
  
Simple merge
index 04bc6666136a3d5a93f2e72c77d68de01969039d,82640d77df45ca214590bae669df664387b6c632..1e34b6c858a1e0f43617c781984b610c495c6f1e
@@@ -32,7 -32,8 +32,9 @@@
  #include <grub/command.h>
  #include <grub/i18n.h>
  #include <grub/mm.h>
+ #include <grub/cpu/relocator.h>
  #include <grub/video.h>
++#include <grub/floppy.h>
  
  #define GRUB_LINUX_CL_OFFSET          0x9000
  #define GRUB_LINUX_CL_END_OFFSET      0x90FF
@@@ -41,13 -42,26 +43,28 @@@ static grub_dl_t my_mod
  
  static grub_size_t linux_mem_size;
  static int loaded;
+ static struct grub_relocator *relocator = NULL;
+ static grub_addr_t grub_linux_real_target;
+ static char *grub_linux_real_chunk;
+ static grub_size_t grub_linux16_prot_size;
  
  static grub_err_t
- grub_linux_unload (void)
+ grub_linux16_boot (void)
  {
-   grub_dl_unref (my_mod);
-   loaded = 0;
-   return GRUB_ERR_NONE;
+   grub_uint16_t segment;
+   struct grub_relocator16_state state;
+   segment = grub_linux_real_target >> 4;
+   state.gs = state.fs = state.es = state.ds = state.ss = segment;
+   state.sp = GRUB_LINUX_SETUP_STACK;
+   state.cs = segment + 0x20;
+   state.ip = 0;
+   grub_video_set_mode ("text", 0, 0);
++
++  grub_stop_floppy ();
+   
+   return grub_relocator16_boot (relocator, state);
  }
  
  static grub_err_t
Simple merge