Print this page
12195 acpidump failed under EFI


   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 



  27 
  28 #include <sys/types.h>
  29 #include <sys/inttypes.h>
  30 #include <sys/systm.h>
  31 #include <sys/elf.h>
  32 #include <sys/elf_notes.h>
  33 
  34 #include <util/memcpy.h>
  35 
  36 #include "dboot_xboot.h"
  37 #include "dboot_elfload.h"
  38 #include "dboot_printf.h"
  39 
  40 static caddr_t elf_file = 0;
  41 
  42 #define PGETBYTES(offset)       ((void *)(elf_file + (offset)))
  43 
  44 static void *
  45 getehdr(void)
  46 {


 165                         dboot_printf("copying %ld bytes from ELF offset 0x%lx "
 166                             "to physaddr 0x%lx (va=0x%lx)\n",
 167                             (ulong_t)phdr->p_filesz, (ulong_t)phdr->p_offset,
 168                             (ulong_t)dst, (ulong_t)phdr->p_vaddr);
 169                 (void) memcpy((void *)(uintptr_t)dst,
 170                     (void *)(uintptr_t)src, (size_t)phdr->p_filesz);
 171 
 172                 next_addr = dst + phdr->p_filesz;
 173         }
 174 
 175 
 176         /*
 177          * Next look for bss
 178          */
 179         for (i = 0; i < eh->e_shnum; i++) {
 180                 shdr = (Elf64_Shdr *)(sechdrs + eh->e_shentsize * i);
 181 
 182                 /* zero out bss */
 183                 if (shdr->sh_type == SHT_NOBITS) {
 184                         if (prom_debug)
 185                                 dboot_printf("zeroing BSS %lu bytes from "
 186                                     "physaddr 0x%" PRIx64
 187                                     " (end=0x%" PRIx64 ")\n",
 188                                     (ulong_t)shdr->sh_size,
 189                                     next_addr,
 190                                     next_addr + shdr->sh_size);
 191                         (void) memset((void *)(uintptr_t)next_addr, 0,
 192                             shdr->sh_size);
 193                         break;
 194                 }
 195         }
 196 
 197         /*
 198          * Ignore the intepreter (or should we die if there is one??)
 199          */
 200         return (0);
 201 }


   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 /*
  28  * Copyright 2020 Joyent, Inc.
  29  */
  30 
  31 #include <sys/types.h>
  32 #include <sys/inttypes.h>
  33 #include <sys/systm.h>
  34 #include <sys/elf.h>
  35 #include <sys/elf_notes.h>
  36 
  37 #include <util/memcpy.h>
  38 
  39 #include "dboot_xboot.h"
  40 #include "dboot_elfload.h"
  41 #include "dboot_printf.h"
  42 
  43 static caddr_t elf_file = 0;
  44 
  45 #define PGETBYTES(offset)       ((void *)(elf_file + (offset)))
  46 
  47 static void *
  48 getehdr(void)
  49 {


 168                         dboot_printf("copying %ld bytes from ELF offset 0x%lx "
 169                             "to physaddr 0x%lx (va=0x%lx)\n",
 170                             (ulong_t)phdr->p_filesz, (ulong_t)phdr->p_offset,
 171                             (ulong_t)dst, (ulong_t)phdr->p_vaddr);
 172                 (void) memcpy((void *)(uintptr_t)dst,
 173                     (void *)(uintptr_t)src, (size_t)phdr->p_filesz);
 174 
 175                 next_addr = dst + phdr->p_filesz;
 176         }
 177 
 178 
 179         /*
 180          * Next look for bss
 181          */
 182         for (i = 0; i < eh->e_shnum; i++) {
 183                 shdr = (Elf64_Shdr *)(sechdrs + eh->e_shentsize * i);
 184 
 185                 /* zero out bss */
 186                 if (shdr->sh_type == SHT_NOBITS) {
 187                         if (prom_debug)
 188                                 dboot_printf("zeroing BSS %ld bytes from "
 189                                     "physaddr 0x%" PRIx64
 190                                     " (end=0x%" PRIx64 ")\n",
 191                                     (ulong_t)shdr->sh_size,
 192                                     next_addr,
 193                                     next_addr + shdr->sh_size);
 194                         (void) memset((void *)(uintptr_t)next_addr, 0,
 195                             shdr->sh_size);
 196                         break;
 197                 }
 198         }
 199 
 200         /*
 201          * Ignore the intepreter (or should we die if there is one??)
 202          */
 203         return (0);
 204 }