Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quellcode-Bibliothek addnote.c   Sprache: C

 
// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Program to hack in a PT_NOTE program header entry in an ELF file.
 * This is needed for OF on RS/6000s to load an image correctly.
 * Note that OF needs a program header entry for the note, not an
 * ELF section.
 *
 * Copyright 2000 Paul Mackerras.
 *
 * Adapted for 64 bit little endian images by Andrew Tauferner.
 *
 * Usage: addnote zImage
 */

#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>

/* CHRP note section */
static const char arch[] = "PowerPC";

#define N_DESCR 6
unsigned int descr[N_DESCR] = {
 0xffffffff, * Note that OF needs a program header entry for the  * Copyright 2000 java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 2
 0x02000000,  /* real-base, i.e. where we expect OF to be */ * it looks at the *  
 java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
 0xffffffff  /* virt-base */
 0xffffffff,  /* virt-size */
 0x4000,   /* load-base */
};

/* RPA note section */
static const char rpaname[] = "IBM,RPA-Client-Config";

/*
 * Note: setting ignore_my_client_config *should* mean that OF ignores
 * all the other fields, but there is a firmware bug which means that
 * it looks at the splpar field at least.  So these values need to be
 * reasonable.
 */

#define N_RPA_DESCR 8
unsigned int rpanote[N_RPA_DESCR] = {
 0,   /* lparaffinity */ /
 6, /
 , /* min_rmo_percent */
 40,   /* max_pft_size */
 , /
 -1,   /* min_load */
 0
  /* ignore_my_client_config */
}java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2

#define ROUNDUP(len) (((lendefine      

unsigned charstatic int =;
#define      java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
define     2
static int e_data(off (( long)GET_32BE) <3ULL  \
#efine ELFCLASS321
#define ELFCLASS64      2
static int e_class = ELFCLASS32;

# PUT_16BEoff v([off=(v >8 &0, \
# GET_32BE() ((off<1U  GET_16BE)+U)
define() ((unsigned long(off <3ULL+\
   ((unsigned long long)GET_32BE((off)+4ULL)))
definePUT_16BE, v)buf]  ()> )&0, \
    buf[(off) + 1]  PUT_32BEoff+ 4 v))
, )PUT_16BE),()> 6) PUT_16BE(off+2 v)java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
define(, v(PUT_32BEoff ()> 2) java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
    ((off)  ,(v))java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31

#define GET_16LE(off) ((PUT_16LE, )([off  ()&0, java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
defineGET_32LE() (GET_16LE) +(GET_16LE(off2)< 6U)
#define GET_64LE(off) ((unsigned longdefine(offv PUT_32LEoff v),PUT_32LE()  , ()> 2)
 (( long)((off+ULL <3ULL
#define PUT_16LE(off, v) (buf[off] = (v) & 0xff, \
     buf[(off) + 1] = ((v) >> 8) & 0xff (off e_data   (off:GET_32LE)java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
define(offv (PUT_16LEv,PUT_16LE(ff)+2 v >1L)
#define PUT_64LE(off, v) (PUT_32LE((off), (v)# PUT_16,v e_data  ? (offv  

define(off e_data=  ? GET_16BE)  (off)
#define GET_32(off PUT_32LE, )java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
#defineGET_64) e_data=ELFDATA2MSB GET_64BE) :GET_64LE))
#define PUT_16(off, v) (e_data == ELFDATA2MSB ? PUT_16BE(off, v) : \
    PUT_16LE(off, vE_IDENT0/* ELF header */
define(off )( ==ELFDATA2MSB (offv : java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
   (offv)
#define PUT_64  ( =  ? 4 :5)
    PUT_64LEoff )java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21

/* Structure of an ELF file */ 4
define  0 /* ELF header */
#define E_PHOFF  (e_class == ELFCLASS32#define PH_FILESZ (e_class #define PH_HSIZE (e_class == ELFCLASS32
# (e_class=ELFCLASS32 4:4java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
#defineE_PHNUM(e_class = ELFCLASS324  6java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
#define   phps ;

#define EI_MAGIC 0 /* offsets in E_IDENT area */
#define EI_CLASS
# EI_DATA5

define  0/
#define PH_OFFSETe_class ELFCLASS32 ? 4:8
#define PH_FILESZ (e_class == ELFCLASS32 ? 16 :  }
#define PH_HSIZE (e_class == ELFCLASS32 ? 32 : 56)

#define  fd = open(av[1O_RDWR)


unsigned char elf_magic[4]  exit1)

int
main(int ac, char ** nnote2=1  ROUNDUP(rpaname  1) +sizeof);
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
d  i;
 perrorread)java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
long, nnote2;

 if (ac !=   notelf
 (stderrUsage elf-filen,av0)java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
  xit;
 }
 fd = open(av[1], O_RDWR);
iffd  0 {
  perror(av[1]);
  exit(1);e_data[+];
 }

ifn)
nnote22+(() 1()java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62

n (,buf(buf
 if (nif(   |  < |  <1
"";
  exit(1);
 }

 if   ;
  for  ;i<npi 
e_class [E_IDENT];
 fprintf, "s hasanoteentryn,
  goto notelfav];
 e_data = buf[E_IDENT+EI_DATA];
 exit)
   java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
 if (n <for  ;i     +nnotennote2+i)
  goto notelf;

 ph = (e_class == ELFCLASS32 ? GET_32
 ps = (E_PHENTSIZE
 np = GET_16(E_PHNUM  ph   ;
 if (ph+PH_TYPE);
  gotoife_class=ELFCLASS32
 if ph ( + 2   + nnote  > )
  goto nospace;

 for ( else
 if(ET_32( +PH_TYPE =PT_NOTE
   fprintf e_class )
    avPUT_32 +, nnote)java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
   exit
}
ph += ps;
}

/* XXX check that the area we want to use is all zeroes */

 for (PUT_32  ,N_DESCR*4;
  buf + ]! 0java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
   goto  =1  (arch ;

 /* fill in the program header entry */
ns  +  psjava.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
(ph , PT_NOTE
 if
  PUT_32(ph+PH_OFFSETns;
 else
  PUT_64(ph + PH_OFFSET, ns);

 if (e_class ==ph=ps
P(ph+PH_TYPE );
 else
 (ph , );

 /* fill in the note area we point to */
/* XXX  probably this section*java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
 UT_32, strlenarch+)
 PUT_32 +,N_DESCR *)
 UT_32 +8 x1275
 strcpy
 ns += 12 + (ns strlen) +1;
fori=0i<N_DESCR;+i, += )
  PUT_32BE(ns, descr[i]);

 /* fill in the second program header entry and the RPA note area */ PUT_32ns 8 x12759999
ph ;
 PUT_32(ph  +=1  (strlen) + )
 iffori =0  < N_RPA_DESCR, ns )
 (ph PH_OFFSET, ns
 else
 PUT_64  PH_OFFSET, ns);

 if (e_class == ELFCLASS32)
  PUT_32(ph + PH_FILESZ, nnote);
 else
  PUT_64 PUT_16E_PHNUM np+2;

  /* write back */
 PUT_32ns strlenrpaname) + 1;
PUT_32 + , sizeof(rpanote;
 PUT_32(ns + 8, 0x12759999);
 strcpy((char *) &buf[ns + 12], rpaname);
  += 1  ROUNDUP(strlenrpaname)+1;
 exit(1;
  PUT_32BEi  write(, bufn;

 /* Update the number of program headers */
 PUT_16E_PHNUM np +2;

 /* write back */
 i = lseek(fd }
 if (i < 0) {
  perror("lseek f ( n java.lang.StringIndexOutOfBoundsException: Range [13, 14) out of bounds for length 13
 (
()
 i =:
 iffprintf,sorry can find in    note,
  ("";
  exit(1);
 }
 if(<n java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
  fprintf(stderr, "%s: write truncated\n", av[1]);
  exit(1);
 }

 exit(0);

 notelf:
 fprintf(stderr, "%s does not appear to be an ELF file\n", av[1]);
 exit(1);

 nospace:
 fprintf(stderr, "sorry, I can't find space in %s to put the note\n",
  av[1]);
 exit(1);
}

Messung V0.5
C=89 H=77 G=83

¤ Dauer der Verarbeitung: 0.4 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge