The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/conf/makegap.sh

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 #!/bin/sh -
    2 
    3 random_uniform() {
    4         local   _upper_bound
    5 
    6         if [[ $1 -gt 0 ]]; then
    7                 _upper_bound=$(($1 - 1))
    8         else
    9                 _upper_bound=0
   10         fi
   11 
   12         echo `jot -r 1 0 $_upper_bound 2>/dev/null`
   13 }
   14 
   15 umask 007
   16 
   17 PAGE_SIZE=`sysctl -n hw.pagesize`
   18 PAD=$1
   19 GAPDUMMY=$2
   20 
   21 RANDOM1=`random_uniform $((3 * PAGE_SIZE))`
   22 RANDOM2=`random_uniform $PAGE_SIZE`
   23 RANDOM3=`random_uniform $PAGE_SIZE`
   24 RANDOM4=`random_uniform $PAGE_SIZE`
   25 RANDOM5=`random_uniform $PAGE_SIZE`
   26 
   27 cat > gap.link << __EOF__
   28 
   29 PHDRS {
   30         text PT_LOAD FILEHDR PHDRS;
   31         rodata PT_LOAD;
   32         data PT_LOAD;
   33         bss PT_LOAD;
   34 }
   35 
   36 SECTIONS {
   37         .text : ALIGN($PAGE_SIZE) {
   38                 LONG($PAD);
   39                 . += $RANDOM1;
   40                 . = ALIGN($PAGE_SIZE);
   41                 endboot = .;
   42                 PROVIDE (endboot = .);
   43                 . = ALIGN($PAGE_SIZE);
   44                 . += $RANDOM2;
   45                 . = ALIGN(16);
   46                 *(.text .text.*)
   47         } :text =$PAD
   48 
   49         .rodata : {
   50                 LONG($PAD);
   51                 . += $RANDOM3;
   52                 . = ALIGN(16);
   53                 *(.rodata .rodata.*)
   54         } :rodata =$PAD
   55 
   56         .data : {
   57                 LONG($PAD);
   58                 . = . + $RANDOM4;       /* fragment of page */
   59                 . = ALIGN(16);
   60                 *(.data .data.*)
   61         } :data =$PAD
   62 
   63         .bss : {
   64                 . = . + $RANDOM5;       /* fragment of page */
   65                 . = ALIGN(16);
   66                 *(.bss .bss.*)
   67         } :bss
   68 }
   69 __EOF__
   70 
   71 $LD $LDFLAGS -r gap.link $GAPDUMMY -o gap.o

Cache object: ab2e20273bf7b704d9dface94c19cd5e


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.