source: patches/aboot-0.9b-kernel26_gcc4_fixes-2.patch @ bbf90e8

clfs-1.2clfs-2.1clfs-3.0.0-systemdclfs-3.0.0-sysvinitsystemdsysvinit
Last change on this file since bbf90e8 was 69cde8d, checked in by Jim Gifford <clfs@…>, 18 years ago

Added: All patches needed for the book.

  • Property mode set to 100644
File size: 44.2 KB
  • aboot-0.9b

    Submitted By: Joe Ciccone <joeciccone@crazyeyesoft.com
    Date: 2005-09-16
    Initial Package Version: 0.9b
    Upstream Status: NONE
    Origin: Joe Ciccone
    Description: This patch fixes compilation issues with aboot-0.9b.
    	This patch creates kernel headers that the makefile would
    	normaly take out of the kernel source, which is not desired.
    
    diff -Naur aboot-0.9b.orig/cons.c aboot-0.9b/cons.c
    old new  
    1212#include <utils.h>
    1313
    1414long cons_dev;                  /* console device */
    15 extern long int dispatch();     /* Need the full 64 bit return here...*/
     15long dispatch(long proc, ...);  /* Need the full 64 bit return here...*/
    1616
    1717long
    1818cons_puts(const char *str, long len)
  • aboot-0.9b

    diff -Naur aboot-0.9b.orig/disk.c aboot-0.9b/disk.c
    old new  
    480480                                } else {
    481481                                        *d++ = *p;
    482482                                }
    483                                 break;
    484 
    485                               default:
     483                                break;                 
    486484                        }
    487485                        p++;
    488486                }
  • include/asm/auxvec.h

    diff -Naur aboot-0.9b.orig/include/asm/auxvec.h aboot-0.9b/include/asm/auxvec.h
    old new  
     1#ifndef __ASM_ALPHA_AUXVEC_H
     2#define __ASM_ALPHA_AUXVEC_H
     3
     4/* Reserve these numbers for any future use of a VDSO.  */
     5#if 0
     6#define AT_SYSINFO              32
     7#define AT_SYSINFO_EHDR         33
     8#endif
     9
     10/* More complete cache descriptions than AT_[DIU]CACHEBSIZE.  If the
     11   value is -1, then the cache doesn't exist.  Otherwise:
     12
     13      bit 0-3:    Cache set-associativity; 0 means fully associative.
     14      bit 4-7:    Log2 of cacheline size.
     15      bit 8-31:   Size of the entire cache >> 8.
     16      bit 32-63:  Reserved.
     17*/
     18
     19#define AT_L1I_CACHESHAPE       34
     20#define AT_L1D_CACHESHAPE       35
     21#define AT_L2_CACHESHAPE        36
     22#define AT_L3_CACHESHAPE        37
     23
     24#endif /* __ASM_ALPHA_AUXVEC_H */
  • include/asm/barrier.h

    diff -Naur aboot-0.9b.orig/include/asm/barrier.h aboot-0.9b/include/asm/barrier.h
    old new  
     1#ifndef __BARRIER_H
     2#define __BARRIER_H
     3
     4#define mb() \
     5__asm__ __volatile__("mb": : :"memory")
     6
     7#define rmb() \
     8__asm__ __volatile__("mb": : :"memory")
     9
     10#define wmb() \
     11__asm__ __volatile__("wmb": : :"memory")
     12
     13#define read_barrier_depends() \
     14__asm__ __volatile__("mb": : :"memory")
     15
     16#ifdef CONFIG_SMP
     17#define smp_mb()        mb()
     18#define smp_rmb()       rmb()
     19#define smp_wmb()       wmb()
     20#define smp_read_barrier_depends()      read_barrier_depends()
     21#else
     22#define smp_mb()        barrier()
     23#define smp_rmb()       barrier()
     24#define smp_wmb()       barrier()
     25#define smp_read_barrier_depends()      barrier()
     26#endif
     27
     28#define set_mb(var, value) \
     29do { var = value; mb(); } while (0)
     30
     31#define set_wmb(var, value) \
     32do { var = value; wmb(); } while (0)
     33
     34#endif          /* __BARRIER_H */
  • include/asm/page.h

    diff -Naur aboot-0.9b.orig/include/asm/page.h aboot-0.9b/include/asm/page.h
    old new  
     1#ifndef _ALPHA_PAGE_H
     2#define _ALPHA_PAGE_H
     3
     4#include <linux/config.h>
     5#include <asm/pal.h>
     6
     7/* PAGE_SHIFT determines the page size */
     8#define PAGE_SHIFT      13
     9#define PAGE_SIZE       (1UL << PAGE_SHIFT)
     10#define PAGE_MASK       (~(PAGE_SIZE-1))
     11
     12#ifdef __KERNEL__
     13
     14#ifndef __ASSEMBLY__
     15
     16#define STRICT_MM_TYPECHECKS
     17
     18extern void clear_page(void *page);
     19#define clear_user_page(page, vaddr, pg)        clear_page(page)
     20
     21#define alloc_zeroed_user_highpage(vma, vaddr) alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO, vma, vmaddr)
     22#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
     23
     24extern void copy_page(void * _to, void * _from);
     25#define copy_user_page(to, from, vaddr, pg)     copy_page(to, from)
     26
     27#ifdef STRICT_MM_TYPECHECKS
     28/*
     29 * These are used to make use of C type-checking..
     30 */
     31typedef struct { unsigned long pte; } pte_t;
     32typedef struct { unsigned long pmd; } pmd_t;
     33typedef struct { unsigned long pgd; } pgd_t;
     34typedef struct { unsigned long pgprot; } pgprot_t;
     35
     36#define pte_val(x)      ((x).pte)
     37#define pmd_val(x)      ((x).pmd)
     38#define pgd_val(x)      ((x).pgd)
     39#define pgprot_val(x)   ((x).pgprot)
     40
     41#define __pte(x)        ((pte_t) { (x) } )
     42#define __pmd(x)        ((pmd_t) { (x) } )
     43#define __pgd(x)        ((pgd_t) { (x) } )
     44#define __pgprot(x)     ((pgprot_t) { (x) } )
     45
     46#else
     47/*
     48 * .. while these make it easier on the compiler
     49 */
     50typedef unsigned long pte_t;
     51typedef unsigned long pmd_t;
     52typedef unsigned long pgd_t;
     53typedef unsigned long pgprot_t;
     54
     55#define pte_val(x)      (x)
     56#define pmd_val(x)      (x)
     57#define pgd_val(x)      (x)
     58#define pgprot_val(x)   (x)
     59
     60#define __pte(x)        (x)
     61#define __pgd(x)        (x)
     62#define __pgprot(x)     (x)
     63
     64#endif /* STRICT_MM_TYPECHECKS */
     65
     66#ifdef USE_48_BIT_KSEG
     67#define PAGE_OFFSET             0xffff800000000000UL
     68#else
     69#define PAGE_OFFSET             0xfffffc0000000000UL
     70#endif
     71
     72#else
     73
     74#ifdef USE_48_BIT_KSEG
     75#define PAGE_OFFSET             0xffff800000000000
     76#else
     77#define PAGE_OFFSET             0xfffffc0000000000
     78#endif
     79
     80#endif /* !__ASSEMBLY__ */
     81
     82/* to align the pointer to the (next) page boundary */
     83#define PAGE_ALIGN(addr)        (((addr)+PAGE_SIZE-1)&PAGE_MASK)
     84
     85#define __pa(x)                 ((unsigned long) (x) - PAGE_OFFSET)
     86#define __va(x)                 ((void *)((unsigned long) (x) + PAGE_OFFSET))
     87#ifndef CONFIG_DISCONTIGMEM
     88#define pfn_to_page(pfn)        (mem_map + (pfn))
     89#define page_to_pfn(page)       ((unsigned long)((page) - mem_map))
     90#define virt_to_page(kaddr)     pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
     91
     92#define pfn_valid(pfn)          ((pfn) < max_mapnr)
     93#define virt_addr_valid(kaddr)  pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
     94#endif /* CONFIG_DISCONTIGMEM */
     95
     96#define VM_DATA_DEFAULT_FLAGS           (VM_READ | VM_WRITE | VM_EXEC | \
     97                                         VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
     98
     99#endif /* __KERNEL__ */
     100
     101#include <asm-generic/page.h>
     102
     103#endif /* _ALPHA_PAGE_H */
  • include/asm/string.h

    diff -Naur aboot-0.9b.orig/include/asm/string.h aboot-0.9b/include/asm/string.h
    old new  
     1#ifndef __ALPHA_STRING_H__
     2#define __ALPHA_STRING_H__
     3
     4#ifdef __KERNEL__
     5
     6/*
     7 * GCC of any recent vintage doesn't do stupid things with bcopy.
     8 * EGCS 1.1 knows all about expanding memcpy inline, others don't.
     9 *
     10 * Similarly for a memset with data = 0.
     11 */
     12
     13#define __HAVE_ARCH_MEMCPY
     14extern void * memcpy(void *, const void *, size_t);
     15#define __HAVE_ARCH_MEMMOVE
     16extern void * memmove(void *, const void *, size_t);
     17
     18/* For backward compatibility with modules.  Unused otherwise.  */
     19extern void * __memcpy(void *, const void *, size_t);
     20
     21#define memcpy __builtin_memcpy
     22
     23#define __HAVE_ARCH_MEMSET
     24extern void * __constant_c_memset(void *, unsigned long, size_t);
     25extern void * __memset(void *, int, size_t);
     26extern void * memset(void *, int, size_t);
     27
     28#define memset(s, c, n)                                                     \
     29(__builtin_constant_p(c)                                                    \
     30 ? (__builtin_constant_p(n) && (c) == 0                                     \
     31    ? __builtin_memset((s),0,(n))                                           \
     32    : __constant_c_memset((s),0x0101010101010101UL*(unsigned char)(c),(n))) \
     33 : __memset((s),(c),(n)))
     34
     35#define __HAVE_ARCH_STRCPY
     36extern char * strcpy(char *,const char *);
     37#define __HAVE_ARCH_STRNCPY
     38extern char * strncpy(char *, const char *, size_t);
     39#define __HAVE_ARCH_STRCAT
     40extern char * strcat(char *, const char *);
     41#define __HAVE_ARCH_STRNCAT
     42extern char * strncat(char *, const char *, size_t);
     43#define __HAVE_ARCH_STRCHR
     44extern char * strchr(const char *,int);
     45#define __HAVE_ARCH_STRRCHR
     46extern char * strrchr(const char *,int);
     47#define __HAVE_ARCH_STRLEN
     48extern size_t strlen(const char *);
     49#define __HAVE_ARCH_MEMCHR
     50extern void * memchr(const void *, int, size_t);
     51
     52/* The following routine is like memset except that it writes 16-bit
     53   aligned values.  The DEST and COUNT parameters must be even for
     54   correct operation.  */
     55
     56#define __HAVE_ARCH_MEMSETW
     57extern void * __memsetw(void *dest, unsigned short, size_t count);
     58
     59#define memsetw(s, c, n)                                                 \
     60(__builtin_constant_p(c)                                                 \
     61 ? __constant_c_memset((s),0x0001000100010001UL*(unsigned short)(c),(n)) \
     62 : __memsetw((s),(c),(n)))
     63
     64extern int strcasecmp(const char *, const char *);
     65
     66#endif /* __KERNEL__ */
     67
     68#endif /* __ALPHA_STRING_H__ */
  • include/asm/system.h

    diff -Naur aboot-0.9b.orig/include/asm/system.h aboot-0.9b/include/asm/system.h
    old new  
     1#ifndef __ALPHA_SYSTEM_H
     2#define __ALPHA_SYSTEM_H
     3
     4#include <linux/config.h>
     5#include <asm/pal.h>
     6#include <asm/page.h>
     7#include <asm/barrier.h>
     8
     9/*
     10 * System defines.. Note that this is included both from .c and .S
     11 * files, so it does only defines, not any C code.
     12 */
     13
     14/*
     15 * We leave one page for the initial stack page, and one page for
     16 * the initial process structure. Also, the console eats 3 MB for
     17 * the initial bootloader (one of which we can reclaim later).
     18 */
     19#define BOOT_PCB        0x20000000
     20#define BOOT_ADDR       0x20000000
     21/* Remove when official MILO sources have ELF support: */
     22#define BOOT_SIZE       (16*1024)
     23
     24#ifdef CONFIG_ALPHA_LEGACY_START_ADDRESS
     25#define KERNEL_START_PHYS       0x300000 /* Old bootloaders hardcoded this.  */
     26#else
     27#define KERNEL_START_PHYS       0x1000000 /* required: Wildfire/Titan/Marvel */
     28#endif
     29
     30#define KERNEL_START    (PAGE_OFFSET+KERNEL_START_PHYS)
     31#define SWAPPER_PGD     KERNEL_START
     32#define INIT_STACK      (PAGE_OFFSET+KERNEL_START_PHYS+0x02000)
     33#define EMPTY_PGT       (PAGE_OFFSET+KERNEL_START_PHYS+0x04000)
     34#define EMPTY_PGE       (PAGE_OFFSET+KERNEL_START_PHYS+0x08000)
     35#define ZERO_PGE        (PAGE_OFFSET+KERNEL_START_PHYS+0x0A000)
     36
     37#define START_ADDR      (PAGE_OFFSET+KERNEL_START_PHYS+0x10000)
     38
     39/*
     40 * This is setup by the secondary bootstrap loader.  Because
     41 * the zero page is zeroed out as soon as the vm system is
     42 * initialized, we need to copy things out into a more permanent
     43 * place.
     44 */
     45#define PARAM                   ZERO_PGE
     46#define COMMAND_LINE            ((char*)(PARAM + 0x0000))
     47#define INITRD_START            (*(unsigned long *) (PARAM+0x100))
     48#define INITRD_SIZE             (*(unsigned long *) (PARAM+0x108))
     49
     50#ifndef __ASSEMBLY__
     51#include <linux/kernel.h>
     52
     53/*
     54 * This is the logout header that should be common to all platforms
     55 * (assuming they are running OSF/1 PALcode, I guess).
     56 */
     57struct el_common {
     58        unsigned int    size;           /* size in bytes of logout area */
     59        unsigned int    sbz1    : 30;   /* should be zero */
     60        unsigned int    err2    :  1;   /* second error */
     61        unsigned int    retry   :  1;   /* retry flag */
     62        unsigned int    proc_offset;    /* processor-specific offset */
     63        unsigned int    sys_offset;     /* system-specific offset */
     64        unsigned int    code;           /* machine check code */
     65        unsigned int    frame_rev;      /* frame revision */
     66};
     67
     68/* Machine Check Frame for uncorrectable errors (Large format)
     69 *      --- This is used to log uncorrectable errors such as
     70 *          double bit ECC errors.
     71 *      --- These errors are detected by both processor and systems.
     72 */
     73struct el_common_EV5_uncorrectable_mcheck {
     74        unsigned long   shadow[8];        /* Shadow reg. 8-14, 25           */
     75        unsigned long   paltemp[24];      /* PAL TEMP REGS.                 */
     76        unsigned long   exc_addr;         /* Address of excepting instruction*/
     77        unsigned long   exc_sum;          /* Summary of arithmetic traps.   */
     78        unsigned long   exc_mask;         /* Exception mask (from exc_sum). */
     79        unsigned long   pal_base;         /* Base address for PALcode.      */
     80        unsigned long   isr;              /* Interrupt Status Reg.          */
     81        unsigned long   icsr;             /* CURRENT SETUP OF EV5 IBOX      */
     82        unsigned long   ic_perr_stat;     /* I-CACHE Reg. <11> set Data parity
     83                                                         <12> set TAG parity*/
     84        unsigned long   dc_perr_stat;     /* D-CACHE error Reg. Bits set to 1:
     85                                                     <2> Data error in bank 0
     86                                                     <3> Data error in bank 1
     87                                                     <4> Tag error in bank 0
     88                                                     <5> Tag error in bank 1 */
     89        unsigned long   va;               /* Effective VA of fault or miss. */
     90        unsigned long   mm_stat;          /* Holds the reason for D-stream
     91                                             fault or D-cache parity errors */
     92        unsigned long   sc_addr;          /* Address that was being accessed
     93                                             when EV5 detected Secondary cache
     94                                             failure.                 */
     95        unsigned long   sc_stat;          /* Helps determine if the error was
     96                                             TAG/Data parity(Secondary Cache)*/
     97        unsigned long   bc_tag_addr;      /* Contents of EV5 BC_TAG_ADDR    */
     98        unsigned long   ei_addr;          /* Physical address of any transfer
     99                                             that is logged in EV5 EI_STAT */
     100        unsigned long   fill_syndrome;    /* For correcting ECC errors.     */
     101        unsigned long   ei_stat;          /* Helps identify reason of any
     102                                             processor uncorrectable error
     103                                             at its external interface.     */
     104        unsigned long   ld_lock;          /* Contents of EV5 LD_LOCK register*/
     105};
     106
     107struct el_common_EV6_mcheck {
     108        unsigned int FrameSize;         /* Bytes, including this field */
     109        unsigned int FrameFlags;        /* <31> = Retry, <30> = Second Error */
     110        unsigned int CpuOffset;         /* Offset to CPU-specific info */
     111        unsigned int SystemOffset;      /* Offset to system-specific info */
     112        unsigned int MCHK_Code;
     113        unsigned int MCHK_Frame_Rev;
     114        unsigned long I_STAT;           /* EV6 Internal Processor Registers */
     115        unsigned long DC_STAT;          /* (See the 21264 Spec) */
     116        unsigned long C_ADDR;
     117        unsigned long DC1_SYNDROME;
     118        unsigned long DC0_SYNDROME;
     119        unsigned long C_STAT;
     120        unsigned long C_STS;
     121        unsigned long MM_STAT;
     122        unsigned long EXC_ADDR;
     123        unsigned long IER_CM;
     124        unsigned long ISUM;
     125        unsigned long RESERVED0;
     126        unsigned long PAL_BASE;
     127        unsigned long I_CTL;
     128        unsigned long PCTX;
     129};
     130
     131extern void halt(void) __attribute__((noreturn));
     132#define __halt() __asm__ __volatile__ ("call_pal %0 #halt" : : "i" (PAL_halt))
     133
     134#define switch_to(P,N,L)                                                \
     135  do {                                                                  \
     136    (L) = alpha_switch_to(virt_to_phys(&(N)->thread_info->pcb), (P));   \
     137    check_mmu_context();                                                \
     138  } while (0)
     139
     140struct task_struct;
     141extern struct task_struct *alpha_switch_to(unsigned long, struct task_struct*);
     142
     143#define imb() \
     144__asm__ __volatile__ ("call_pal %0 #imb" : : "i" (PAL_imb) : "memory")
     145
     146#define draina() \
     147__asm__ __volatile__ ("call_pal %0 #draina" : : "i" (PAL_draina) : "memory")
     148
     149enum implver_enum {
     150        IMPLVER_EV4,
     151        IMPLVER_EV5,
     152        IMPLVER_EV6
     153};
     154
     155#ifdef CONFIG_ALPHA_GENERIC
     156#define implver()                               \
     157({ unsigned long __implver;                     \
     158   __asm__ ("implver %0" : "=r"(__implver));    \
     159   (enum implver_enum) __implver; })
     160#else
     161/* Try to eliminate some dead code.  */
     162#ifdef CONFIG_ALPHA_EV4
     163#define implver() IMPLVER_EV4
     164#endif
     165#ifdef CONFIG_ALPHA_EV5
     166#define implver() IMPLVER_EV5
     167#endif
     168#if defined(CONFIG_ALPHA_EV6)
     169#define implver() IMPLVER_EV6
     170#endif
     171#endif
     172
     173enum amask_enum {
     174        AMASK_BWX = (1UL << 0),
     175        AMASK_FIX = (1UL << 1),
     176        AMASK_CIX = (1UL << 2),
     177        AMASK_MAX = (1UL << 8),
     178        AMASK_PRECISE_TRAP = (1UL << 9),
     179};
     180
     181#define amask(mask)                                             \
     182({ unsigned long __amask, __input = (mask);                     \
     183   __asm__ ("amask %1,%0" : "=r"(__amask) : "rI"(__input));     \
     184   __amask; })
     185
     186#define __CALL_PAL_R0(NAME, TYPE)                               \
     187static inline TYPE NAME(void)                                   \
     188{                                                               \
     189        register TYPE __r0 __asm__("$0");                       \
     190        __asm__ __volatile__(                                   \
     191                "call_pal %1 # " #NAME                          \
     192                :"=r" (__r0)                                    \
     193                :"i" (PAL_ ## NAME)                             \
     194                :"$1", "$16", "$22", "$23", "$24", "$25");      \
     195        return __r0;                                            \
     196}
     197
     198#define __CALL_PAL_W1(NAME, TYPE0)                              \
     199static inline void NAME(TYPE0 arg0)                             \
     200{                                                               \
     201        register TYPE0 __r16 __asm__("$16") = arg0;             \
     202        __asm__ __volatile__(                                   \
     203                "call_pal %1 # "#NAME                           \
     204                : "=r"(__r16)                                   \
     205                : "i"(PAL_ ## NAME), "0"(__r16)                 \
     206                : "$1", "$22", "$23", "$24", "$25");            \
     207}
     208
     209#define __CALL_PAL_W2(NAME, TYPE0, TYPE1)                       \
     210static inline void NAME(TYPE0 arg0, TYPE1 arg1)                 \
     211{                                                               \
     212        register TYPE0 __r16 __asm__("$16") = arg0;             \
     213        register TYPE1 __r17 __asm__("$17") = arg1;             \
     214        __asm__ __volatile__(                                   \
     215                "call_pal %2 # "#NAME                           \
     216                : "=r"(__r16), "=r"(__r17)                      \
     217                : "i"(PAL_ ## NAME), "0"(__r16), "1"(__r17)     \
     218                : "$1", "$22", "$23", "$24", "$25");            \
     219}
     220
     221#define __CALL_PAL_RW1(NAME, RTYPE, TYPE0)                      \
     222static inline RTYPE NAME(TYPE0 arg0)                            \
     223{                                                               \
     224        register RTYPE __r0 __asm__("$0");                      \
     225        register TYPE0 __r16 __asm__("$16") = arg0;             \
     226        __asm__ __volatile__(                                   \
     227                "call_pal %2 # "#NAME                           \
     228                : "=r"(__r16), "=r"(__r0)                       \
     229                : "i"(PAL_ ## NAME), "0"(__r16)                 \
     230                : "$1", "$22", "$23", "$24", "$25");            \
     231        return __r0;                                            \
     232}
     233
     234#define __CALL_PAL_RW2(NAME, RTYPE, TYPE0, TYPE1)               \
     235static inline RTYPE NAME(TYPE0 arg0, TYPE1 arg1)                \
     236{                                                               \
     237        register RTYPE __r0 __asm__("$0");                      \
     238        register TYPE0 __r16 __asm__("$16") = arg0;             \
     239        register TYPE1 __r17 __asm__("$17") = arg1;             \
     240        __asm__ __volatile__(                                   \
     241                "call_pal %3 # "#NAME                           \
     242                : "=r"(__r16), "=r"(__r17), "=r"(__r0)          \
     243                : "i"(PAL_ ## NAME), "0"(__r16), "1"(__r17)     \
     244                : "$1", "$22", "$23", "$24", "$25");            \
     245        return __r0;                                            \
     246}
     247
     248__CALL_PAL_W1(cflush, unsigned long);
     249__CALL_PAL_R0(rdmces, unsigned long);
     250__CALL_PAL_R0(rdps, unsigned long);
     251__CALL_PAL_R0(rdusp, unsigned long);
     252__CALL_PAL_RW1(swpipl, unsigned long, unsigned long);
     253__CALL_PAL_R0(whami, unsigned long);
     254__CALL_PAL_W2(wrent, void*, unsigned long);
     255__CALL_PAL_W1(wripir, unsigned long);
     256__CALL_PAL_W1(wrkgp, unsigned long);
     257__CALL_PAL_W1(wrmces, unsigned long);
     258__CALL_PAL_RW2(wrperfmon, unsigned long, unsigned long, unsigned long);
     259__CALL_PAL_W1(wrusp, unsigned long);
     260__CALL_PAL_W1(wrvptptr, unsigned long);
     261
     262#define IPL_MIN         0
     263#define IPL_SW0         1
     264#define IPL_SW1         2
     265#define IPL_DEV0        3
     266#define IPL_DEV1        4
     267#define IPL_TIMER       5
     268#define IPL_PERF        6
     269#define IPL_POWERFAIL   6
     270#define IPL_MCHECK      7
     271#define IPL_MAX         7
     272
     273#ifdef CONFIG_ALPHA_BROKEN_IRQ_MASK
     274#undef IPL_MIN
     275#define IPL_MIN         __min_ipl
     276extern int __min_ipl;
     277#endif
     278
     279#define getipl()                (rdps() & 7)
     280#define setipl(ipl)             ((void) swpipl(ipl))
     281
     282#define local_irq_disable()                     do { setipl(IPL_MAX); barrier(); } while(0)
     283#define local_irq_enable()                      do { barrier(); setipl(IPL_MIN); } while(0)
     284#define local_save_flags(flags) ((flags) = rdps())
     285#define local_irq_save(flags)   do { (flags) = swpipl(IPL_MAX); barrier(); } while(0)
     286#define local_irq_restore(flags)        do { barrier(); setipl(flags); barrier(); } while(0)
     287
     288#define irqs_disabled() (getipl() == IPL_MAX)
     289
     290/*
     291 * TB routines..
     292 */
     293#define __tbi(nr,arg,arg1...)                                   \
     294({                                                              \
     295        register unsigned long __r16 __asm__("$16") = (nr);     \
     296        register unsigned long __r17 __asm__("$17"); arg;       \
     297        __asm__ __volatile__(                                   \
     298                "call_pal %3 #__tbi"                            \
     299                :"=r" (__r16),"=r" (__r17)                      \
     300                :"0" (__r16),"i" (PAL_tbi) ,##arg1              \
     301                :"$0", "$1", "$22", "$23", "$24", "$25");       \
     302})
     303
     304#define tbi(x,y)        __tbi(x,__r17=(y),"1" (__r17))
     305#define tbisi(x)        __tbi(1,__r17=(x),"1" (__r17))
     306#define tbisd(x)        __tbi(2,__r17=(x),"1" (__r17))
     307#define tbis(x)         __tbi(3,__r17=(x),"1" (__r17))
     308#define tbiap()         __tbi(-1, /* no second argument */)
     309#define tbia()          __tbi(-2, /* no second argument */)
     310
     311/*
     312 * Atomic exchange.
     313 * Since it can be used to implement critical sections
     314 * it must clobber "memory" (also for interrupts in UP).
     315 */
     316
     317static inline unsigned long
     318__xchg_u8(volatile char *m, unsigned long val)
     319{
     320        unsigned long ret, tmp, addr64;
     321
     322        __asm__ __volatile__(
     323        "       andnot  %4,7,%3\n"
     324        "       insbl   %1,%4,%1\n"
     325        "1:     ldq_l   %2,0(%3)\n"
     326        "       extbl   %2,%4,%0\n"
     327        "       mskbl   %2,%4,%2\n"
     328        "       or      %1,%2,%2\n"
     329        "       stq_c   %2,0(%3)\n"
     330        "       beq     %2,2f\n"
     331#ifdef CONFIG_SMP
     332        "       mb\n"
     333#endif
     334        ".subsection 2\n"
     335        "2:     br      1b\n"
     336        ".previous"
     337        : "=&r" (ret), "=&r" (val), "=&r" (tmp), "=&r" (addr64)
     338        : "r" ((long)m), "1" (val) : "memory");
     339
     340        return ret;
     341}
     342
     343static inline unsigned long
     344__xchg_u16(volatile short *m, unsigned long val)
     345{
     346        unsigned long ret, tmp, addr64;
     347
     348        __asm__ __volatile__(
     349        "       andnot  %4,7,%3\n"
     350        "       inswl   %1,%4,%1\n"
     351        "1:     ldq_l   %2,0(%3)\n"
     352        "       extwl   %2,%4,%0\n"
     353        "       mskwl   %2,%4,%2\n"
     354        "       or      %1,%2,%2\n"
     355        "       stq_c   %2,0(%3)\n"
     356        "       beq     %2,2f\n"
     357#ifdef CONFIG_SMP
     358        "       mb\n"
     359#endif
     360        ".subsection 2\n"
     361        "2:     br      1b\n"
     362        ".previous"
     363        : "=&r" (ret), "=&r" (val), "=&r" (tmp), "=&r" (addr64)
     364        : "r" ((long)m), "1" (val) : "memory");
     365
     366        return ret;
     367}
     368
     369static inline unsigned long
     370__xchg_u32(volatile int *m, unsigned long val)
     371{
     372        unsigned long dummy;
     373
     374        __asm__ __volatile__(
     375        "1:     ldl_l %0,%4\n"
     376        "       bis $31,%3,%1\n"
     377        "       stl_c %1,%2\n"
     378        "       beq %1,2f\n"
     379#ifdef CONFIG_SMP
     380        "       mb\n"
     381#endif
     382        ".subsection 2\n"
     383        "2:     br 1b\n"
     384        ".previous"
     385        : "=&r" (val), "=&r" (dummy), "=m" (*m)
     386        : "rI" (val), "m" (*m) : "memory");
     387
     388        return val;
     389}
     390
     391static inline unsigned long
     392__xchg_u64(volatile long *m, unsigned long val)
     393{
     394        unsigned long dummy;
     395
     396        __asm__ __volatile__(
     397        "1:     ldq_l %0,%4\n"
     398        "       bis $31,%3,%1\n"
     399        "       stq_c %1,%2\n"
     400        "       beq %1,2f\n"
     401#ifdef CONFIG_SMP
     402        "       mb\n"
     403#endif
     404        ".subsection 2\n"
     405        "2:     br 1b\n"
     406        ".previous"
     407        : "=&r" (val), "=&r" (dummy), "=m" (*m)
     408        : "rI" (val), "m" (*m) : "memory");
     409
     410        return val;
     411}
     412
     413/* This function doesn't exist, so you'll get a linker error
     414   if something tries to do an invalid xchg().  */
     415extern void __xchg_called_with_bad_pointer(void);
     416
     417#define __xchg(ptr, x, size) \
     418({ \
     419        unsigned long __xchg__res; \
     420        volatile void *__xchg__ptr = (ptr); \
     421        switch (size) { \
     422                case 1: __xchg__res = __xchg_u8(__xchg__ptr, x); break; \
     423                case 2: __xchg__res = __xchg_u16(__xchg__ptr, x); break; \
     424                case 4: __xchg__res = __xchg_u32(__xchg__ptr, x); break; \
     425                case 8: __xchg__res = __xchg_u64(__xchg__ptr, x); break; \
     426                default: __xchg_called_with_bad_pointer(); __xchg__res = x; \
     427        } \
     428        __xchg__res; \
     429})
     430
     431#define xchg(ptr,x)                                                          \
     432  ({                                                                         \
     433     __typeof__(*(ptr)) _x_ = (x);                                           \
     434     (__typeof__(*(ptr))) __xchg((ptr), (unsigned long)_x_, sizeof(*(ptr))); \
     435  })
     436
     437#define tas(ptr) (xchg((ptr),1))
     438
     439
     440/*
     441 * Atomic compare and exchange.  Compare OLD with MEM, if identical,
     442 * store NEW in MEM.  Return the initial value in MEM.  Success is
     443 * indicated by comparing RETURN with OLD.
     444 *
     445 * The memory barrier should be placed in SMP only when we actually
     446 * make the change. If we don't change anything (so if the returned
     447 * prev is equal to old) then we aren't acquiring anything new and
     448 * we don't need any memory barrier as far I can tell.
     449 */
     450
     451#define __HAVE_ARCH_CMPXCHG 1
     452
     453static inline unsigned long
     454__cmpxchg_u8(volatile char *m, long old, long new)
     455{
     456        unsigned long prev, tmp, cmp, addr64;
     457
     458        __asm__ __volatile__(
     459        "       andnot  %5,7,%4\n"
     460        "       insbl   %1,%5,%1\n"
     461        "1:     ldq_l   %2,0(%4)\n"
     462        "       extbl   %2,%5,%0\n"
     463        "       cmpeq   %0,%6,%3\n"
     464        "       beq     %3,2f\n"
     465        "       mskbl   %2,%5,%2\n"
     466        "       or      %1,%2,%2\n"
     467        "       stq_c   %2,0(%4)\n"
     468        "       beq     %2,3f\n"
     469#ifdef CONFIG_SMP
     470        "       mb\n"
     471#endif
     472        "2:\n"
     473        ".subsection 2\n"
     474        "3:     br      1b\n"
     475        ".previous"
     476        : "=&r" (prev), "=&r" (new), "=&r" (tmp), "=&r" (cmp), "=&r" (addr64)
     477        : "r" ((long)m), "Ir" (old), "1" (new) : "memory");
     478
     479        return prev;
     480}
     481
     482static inline unsigned long
     483__cmpxchg_u16(volatile short *m, long old, long new)
     484{
     485        unsigned long prev, tmp, cmp, addr64;
     486
     487        __asm__ __volatile__(
     488        "       andnot  %5,7,%4\n"
     489        "       inswl   %1,%5,%1\n"
     490        "1:     ldq_l   %2,0(%4)\n"
     491        "       extwl   %2,%5,%0\n"
     492        "       cmpeq   %0,%6,%3\n"
     493        "       beq     %3,2f\n"
     494        "       mskwl   %2,%5,%2\n"
     495        "       or      %1,%2,%2\n"
     496        "       stq_c   %2,0(%4)\n"
     497        "       beq     %2,3f\n"
     498#ifdef CONFIG_SMP
     499        "       mb\n"
     500#endif
     501        "2:\n"
     502        ".subsection 2\n"
     503        "3:     br      1b\n"
     504        ".previous"
     505        : "=&r" (prev), "=&r" (new), "=&r" (tmp), "=&r" (cmp), "=&r" (addr64)
     506        : "r" ((long)m), "Ir" (old), "1" (new) : "memory");
     507
     508        return prev;
     509}
     510
     511static inline unsigned long
     512__cmpxchg_u32(volatile int *m, int old, int new)
     513{
     514        unsigned long prev, cmp;
     515
     516        __asm__ __volatile__(
     517        "1:     ldl_l %0,%5\n"
     518        "       cmpeq %0,%3,%1\n"
     519        "       beq %1,2f\n"
     520        "       mov %4,%1\n"
     521        "       stl_c %1,%2\n"
     522        "       beq %1,3f\n"
     523#ifdef CONFIG_SMP
     524        "       mb\n"
     525#endif
     526        "2:\n"
     527        ".subsection 2\n"
     528        "3:     br 1b\n"
     529        ".previous"
     530        : "=&r"(prev), "=&r"(cmp), "=m"(*m)
     531        : "r"((long) old), "r"(new), "m"(*m) : "memory");
     532
     533        return prev;
     534}
     535
     536static inline unsigned long
     537__cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new)
     538{
     539        unsigned long prev, cmp;
     540
     541        __asm__ __volatile__(
     542        "1:     ldq_l %0,%5\n"
     543        "       cmpeq %0,%3,%1\n"
     544        "       beq %1,2f\n"
     545        "       mov %4,%1\n"
     546        "       stq_c %1,%2\n"
     547        "       beq %1,3f\n"
     548#ifdef CONFIG_SMP
     549        "       mb\n"
     550#endif
     551        "2:\n"
     552        ".subsection 2\n"
     553        "3:     br 1b\n"
     554        ".previous"
     555        : "=&r"(prev), "=&r"(cmp), "=m"(*m)
     556        : "r"((long) old), "r"(new), "m"(*m) : "memory");
     557
     558        return prev;
     559}
     560
     561/* This function doesn't exist, so you'll get a linker error
     562   if something tries to do an invalid cmpxchg().  */
     563extern void __cmpxchg_called_with_bad_pointer(void);
     564
     565static inline unsigned long
     566__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
     567{
     568        switch (size) {
     569                case 1:
     570                        return __cmpxchg_u8(ptr, old, new);
     571                case 2:
     572                        return __cmpxchg_u16(ptr, old, new);
     573                case 4:
     574                        return __cmpxchg_u32(ptr, old, new);
     575                case 8:
     576                        return __cmpxchg_u64(ptr, old, new);
     577        }
     578        __cmpxchg_called_with_bad_pointer();
     579        return old;
     580}
     581
     582#define cmpxchg(ptr,o,n)                                                 \
     583  ({                                                                     \
     584     __typeof__(*(ptr)) _o_ = (o);                                       \
     585     __typeof__(*(ptr)) _n_ = (n);                                       \
     586     (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_,           \
     587                                    (unsigned long)_n_, sizeof(*(ptr))); \
     588  })
     589
     590#endif /* __ASSEMBLY__ */
     591
     592#define arch_align_stack(x) (x)
     593
     594#endif
  • include/asm-generic/page.h

    diff -Naur aboot-0.9b.orig/include/asm-generic/page.h aboot-0.9b/include/asm-generic/page.h
    old new  
     1#ifndef _ASM_GENERIC_PAGE_H
     2#define _ASM_GENERIC_PAGE_H
     3
     4#ifdef __KERNEL__
     5#ifndef __ASSEMBLY__
     6
     7#include <linux/compiler.h>
     8
     9/* Pure 2^n version of get_order */
     10/*
     11static int get_order(unsigned long size)
     12{
     13        int order;
     14
     15        size = (size - 1) >> (PAGE_SHIFT - 1);
     16        order = -1;
     17        do {
     18                size >>= 1;
     19                order++;
     20        } while (size);
     21        return order;
     22}*/
     23
     24#endif  /* __ASSEMBLY__ */
     25#endif  /* __KERNEL__ */
     26
     27#endif  /* _ASM_GENERIC_PAGE_H */
  • include/linux/auxvec.h

    diff -Naur aboot-0.9b.orig/include/linux/auxvec.h aboot-0.9b/include/linux/auxvec.h
    old new  
     1#ifndef _LINUX_AUXVEC_H
     2#define _LINUX_AUXVEC_H
     3
     4#include <asm/auxvec.h>
     5
     6/* Symbolic values for the entries in the auxiliary table
     7   put on the initial stack */
     8#define AT_NULL   0     /* end of vector */
     9#define AT_IGNORE 1     /* entry should be ignored */
     10#define AT_EXECFD 2     /* file descriptor of program */
     11#define AT_PHDR   3     /* program headers for program */
     12#define AT_PHENT  4     /* size of program header entry */
     13#define AT_PHNUM  5     /* number of program headers */
     14#define AT_PAGESZ 6     /* system page size */
     15#define AT_BASE   7     /* base address of interpreter */
     16#define AT_FLAGS  8     /* flags */
     17#define AT_ENTRY  9     /* entry point of program */
     18#define AT_NOTELF 10    /* program is not ELF */
     19#define AT_UID    11    /* real uid */
     20#define AT_EUID   12    /* effective uid */
     21#define AT_GID    13    /* real gid */
     22#define AT_EGID   14    /* effective gid */
     23#define AT_PLATFORM 15  /* string identifying CPU for optimizations */
     24#define AT_HWCAP  16    /* arch dependent hints at CPU capabilities */
     25#define AT_CLKTCK 17    /* frequency at which times() increments */
     26
     27#define AT_SECURE 23   /* secure mode boolean */
     28
     29#define AT_VECTOR_SIZE  42 /* Size of auxiliary table.  */
     30
     31#endif /* _LINUX_AUXVEC_H */
  • include/linux/elf.h

    diff -Naur aboot-0.9b.orig/include/linux/elf.h aboot-0.9b/include/linux/elf.h
    old new  
     1#ifndef _LINUX_ELF_H
     2#define _LINUX_ELF_H
     3
     4#include <linux/types.h>
     5#include <linux/auxvec.h>
     6#include <asm/elf.h>
     7
     8#ifndef elf_read_implies_exec
     9  /* Executables for which elf_read_implies_exec() returns TRUE will
     10     have the READ_IMPLIES_EXEC personality flag set automatically.
     11     Override in asm/elf.h as needed.  */
     12# define elf_read_implies_exec(ex, have_pt_gnu_stack)   0
     13#endif
     14
     15/* 32-bit ELF base types. */
     16typedef __u32   Elf32_Addr;
     17typedef __u16   Elf32_Half;
     18typedef __u32   Elf32_Off;
     19typedef __s32   Elf32_Sword;
     20typedef __u32   Elf32_Word;
     21
     22/* 64-bit ELF base types. */
     23typedef __u64   Elf64_Addr;
     24typedef __u16   Elf64_Half;
     25typedef __s16   Elf64_SHalf;
     26typedef __u64   Elf64_Off;
     27typedef __s32   Elf64_Sword;
     28typedef __u32   Elf64_Word;
     29typedef __u64   Elf64_Xword;
     30typedef __s64   Elf64_Sxword;
     31
     32/* These constants are for the segment types stored in the image headers */
     33#define PT_NULL    0
     34#define PT_LOAD    1
     35#define PT_DYNAMIC 2
     36#define PT_INTERP  3
     37#define PT_NOTE    4
     38#define PT_SHLIB   5
     39#define PT_PHDR    6
     40#define PT_TLS     7               /* Thread local storage segment */
     41#define PT_LOOS    0x60000000      /* OS-specific */
     42#define PT_HIOS    0x6fffffff      /* OS-specific */
     43#define PT_LOPROC  0x70000000
     44#define PT_HIPROC  0x7fffffff
     45#define PT_GNU_EH_FRAME         0x6474e550
     46
     47#define PT_GNU_STACK    (PT_LOOS + 0x474e551)
     48
     49/* These constants define the different elf file types */
     50#define ET_NONE   0
     51#define ET_REL    1
     52#define ET_EXEC   2
     53#define ET_DYN    3
     54#define ET_CORE   4
     55#define ET_LOPROC 0xff00
     56#define ET_HIPROC 0xffff
     57
     58/* These constants define the various ELF target machines */
     59#define EM_NONE  0
     60#define EM_M32   1
     61#define EM_SPARC 2
     62#define EM_386   3
     63#define EM_68K   4
     64#define EM_88K   5
     65#define EM_486   6   /* Perhaps disused */
     66#define EM_860   7
     67
     68#define EM_MIPS         8       /* MIPS R3000 (officially, big-endian only) */
     69
     70#define EM_MIPS_RS4_BE 10       /* MIPS R4000 big-endian */
     71
     72#define EM_PARISC      15       /* HPPA */
     73
     74#define EM_SPARC32PLUS 18       /* Sun's "v8plus" */
     75
     76#define EM_PPC         20       /* PowerPC */
     77#define EM_PPC64       21       /* PowerPC64 */
     78
     79#define EM_SH          42       /* SuperH */
     80
     81#define EM_SPARCV9     43       /* SPARC v9 64-bit */
     82
     83#define EM_IA_64        50      /* HP/Intel IA-64 */
     84
     85#define EM_X86_64       62      /* AMD x86-64 */
     86
     87#define EM_S390         22      /* IBM S/390 */
     88
     89#define EM_CRIS         76      /* Axis Communications 32-bit embedded processor */
     90
     91#define EM_V850         87      /* NEC v850 */
     92
     93#define EM_M32R         88      /* Renesas M32R */
     94
     95#define EM_H8_300       46      /* Renesas H8/300,300H,H8S */
     96
     97/*
     98 * This is an interim value that we will use until the committee comes
     99 * up with a final number.
     100 */
     101#define EM_ALPHA        0x9026
     102
     103/* Bogus old v850 magic number, used by old tools.  */
     104#define EM_CYGNUS_V850  0x9080
     105
     106/* Bogus old m32r magic number, used by old tools.  */
     107#define EM_CYGNUS_M32R  0x9041
     108
     109/*
     110 * This is the old interim value for S/390 architecture
     111 */
     112#define EM_S390_OLD     0xA390
     113
     114#define EM_FRV          0x5441          /* Fujitsu FR-V */
     115
     116/* This is the info that is needed to parse the dynamic section of the file */
     117#define DT_NULL         0
     118#define DT_NEEDED       1
     119#define DT_PLTRELSZ     2
     120#define DT_PLTGOT       3
     121#define DT_HASH         4
     122#define DT_STRTAB       5
     123#define DT_SYMTAB       6
     124#define DT_RELA         7
     125#define DT_RELASZ       8
     126#define DT_RELAENT      9
     127#define DT_STRSZ        10
     128#define DT_SYMENT       11
     129#define DT_INIT         12
     130#define DT_FINI         13
     131#define DT_SONAME       14
     132#define DT_RPATH        15
     133#define DT_SYMBOLIC     16
     134#define DT_REL          17
     135#define DT_RELSZ        18
     136#define DT_RELENT       19
     137#define DT_PLTREL       20
     138#define DT_DEBUG        21
     139#define DT_TEXTREL      22
     140#define DT_JMPREL       23
     141#define DT_LOPROC       0x70000000
     142#define DT_HIPROC       0x7fffffff
     143
     144/* This info is needed when parsing the symbol table */
     145#define STB_LOCAL  0
     146#define STB_GLOBAL 1
     147#define STB_WEAK   2
     148
     149#define STT_NOTYPE  0
     150#define STT_OBJECT  1
     151#define STT_FUNC    2
     152#define STT_SECTION 3
     153#define STT_FILE    4
     154
     155#define ELF_ST_BIND(x)          ((x) >> 4)
     156#define ELF_ST_TYPE(x)          (((unsigned int) x) & 0xf)
     157#define ELF32_ST_BIND(x)        ELF_ST_BIND(x)
     158#define ELF32_ST_TYPE(x)        ELF_ST_TYPE(x)
     159#define ELF64_ST_BIND(x)        ELF_ST_BIND(x)
     160#define ELF64_ST_TYPE(x)        ELF_ST_TYPE(x)
     161
     162typedef struct dynamic{
     163  Elf32_Sword d_tag;
     164  union{
     165    Elf32_Sword d_val;
     166    Elf32_Addr  d_ptr;
     167  } d_un;
     168} Elf32_Dyn;
     169
     170typedef struct {
     171  Elf64_Sxword d_tag;           /* entry tag value */
     172  union {
     173    Elf64_Xword d_val;
     174    Elf64_Addr d_ptr;
     175  } d_un;
     176} Elf64_Dyn;
     177
     178/* The following are used with relocations */
     179#define ELF32_R_SYM(x) ((x) >> 8)
     180#define ELF32_R_TYPE(x) ((x) & 0xff)
     181
     182#define ELF64_R_SYM(i)                  ((i) >> 32)
     183#define ELF64_R_TYPE(i)                 ((i) & 0xffffffff)
     184
     185typedef struct elf32_rel {
     186  Elf32_Addr    r_offset;
     187  Elf32_Word    r_info;
     188} Elf32_Rel;
     189
     190typedef struct elf64_rel {
     191  Elf64_Addr r_offset;  /* Location at which to apply the action */
     192  Elf64_Xword r_info;   /* index and type of relocation */
     193} Elf64_Rel;
     194
     195typedef struct elf32_rela{
     196  Elf32_Addr    r_offset;
     197  Elf32_Word    r_info;
     198  Elf32_Sword   r_addend;
     199} Elf32_Rela;
     200
     201typedef struct elf64_rela {
     202  Elf64_Addr r_offset;  /* Location at which to apply the action */
     203  Elf64_Xword r_info;   /* index and type of relocation */
     204  Elf64_Sxword r_addend;        /* Constant addend used to compute value */
     205} Elf64_Rela;
     206
     207typedef struct elf32_sym{
     208  Elf32_Word    st_name;
     209  Elf32_Addr    st_value;
     210  Elf32_Word    st_size;
     211  unsigned char st_info;
     212  unsigned char st_other;
     213  Elf32_Half    st_shndx;
     214} Elf32_Sym;
     215
     216typedef struct elf64_sym {
     217  Elf64_Word st_name;           /* Symbol name, index in string tbl */
     218  unsigned char st_info;        /* Type and binding attributes */
     219  unsigned char st_other;       /* No defined meaning, 0 */
     220  Elf64_Half st_shndx;          /* Associated section index */
     221  Elf64_Addr st_value;          /* Value of the symbol */
     222  Elf64_Xword st_size;          /* Associated symbol size */
     223} Elf64_Sym;
     224
     225
     226#define EI_NIDENT       16
     227
     228typedef struct elf32_hdr{
     229  unsigned char e_ident[EI_NIDENT];
     230  Elf32_Half    e_type;
     231  Elf32_Half    e_machine;
     232  Elf32_Word    e_version;
     233  Elf32_Addr    e_entry;  /* Entry point */
     234  Elf32_Off     e_phoff;
     235  Elf32_Off     e_shoff;
     236  Elf32_Word    e_flags;
     237  Elf32_Half    e_ehsize;
     238  Elf32_Half    e_phentsize;
     239  Elf32_Half    e_phnum;
     240  Elf32_Half    e_shentsize;
     241  Elf32_Half    e_shnum;
     242  Elf32_Half    e_shstrndx;
     243} Elf32_Ehdr;
     244
     245typedef struct elf64_hdr {
     246  unsigned char e_ident[16];            /* ELF "magic number" */
     247  Elf64_Half e_type;
     248  Elf64_Half e_machine;
     249  Elf64_Word e_version;
     250  Elf64_Addr e_entry;           /* Entry point virtual address */
     251  Elf64_Off e_phoff;            /* Program header table file offset */
     252  Elf64_Off e_shoff;            /* Section header table file offset */
     253  Elf64_Word e_flags;
     254  Elf64_Half e_ehsize;
     255  Elf64_Half e_phentsize;
     256  Elf64_Half e_phnum;
     257  Elf64_Half e_shentsize;
     258  Elf64_Half e_shnum;
     259  Elf64_Half e_shstrndx;
     260} Elf64_Ehdr;
     261
     262/* These constants define the permissions on sections in the program
     263   header, p_flags. */
     264#define PF_R            0x4
     265#define PF_W            0x2
     266#define PF_X            0x1
     267
     268typedef struct elf32_phdr{
     269  Elf32_Word    p_type;
     270  Elf32_Off     p_offset;
     271  Elf32_Addr    p_vaddr;
     272  Elf32_Addr    p_paddr;
     273  Elf32_Word    p_filesz;
     274  Elf32_Word    p_memsz;
     275  Elf32_Word    p_flags;
     276  Elf32_Word    p_align;
     277} Elf32_Phdr;
     278
     279typedef struct elf64_phdr {
     280  Elf64_Word p_type;
     281  Elf64_Word p_flags;
     282  Elf64_Off p_offset;           /* Segment file offset */
     283  Elf64_Addr p_vaddr;           /* Segment virtual address */
     284  Elf64_Addr p_paddr;           /* Segment physical address */
     285  Elf64_Xword p_filesz;         /* Segment size in file */
     286  Elf64_Xword p_memsz;          /* Segment size in memory */
     287  Elf64_Xword p_align;          /* Segment alignment, file & memory */
     288} Elf64_Phdr;
     289
     290/* sh_type */
     291#define SHT_NULL        0
     292#define SHT_PROGBITS    1
     293#define SHT_SYMTAB      2
     294#define SHT_STRTAB      3
     295#define SHT_RELA        4
     296#define SHT_HASH        5
     297#define SHT_DYNAMIC     6
     298#define SHT_NOTE        7
     299#define SHT_NOBITS      8
     300#define SHT_REL         9
     301#define SHT_SHLIB       10
     302#define SHT_DYNSYM      11
     303#define SHT_NUM         12
     304#define SHT_LOPROC      0x70000000
     305#define SHT_HIPROC      0x7fffffff
     306#define SHT_LOUSER      0x80000000
     307#define SHT_HIUSER      0xffffffff
     308
     309/* sh_flags */
     310#define SHF_WRITE       0x1
     311#define SHF_ALLOC       0x2
     312#define SHF_EXECINSTR   0x4
     313#define SHF_MASKPROC    0xf0000000
     314
     315/* special section indexes */
     316#define SHN_UNDEF       0
     317#define SHN_LORESERVE   0xff00
     318#define SHN_LOPROC      0xff00
     319#define SHN_HIPROC      0xff1f
     320#define SHN_ABS         0xfff1
     321#define SHN_COMMON      0xfff2
     322#define SHN_HIRESERVE   0xffff
     323 
     324typedef struct {
     325  Elf32_Word    sh_name;
     326  Elf32_Word    sh_type;
     327  Elf32_Word    sh_flags;
     328  Elf32_Addr    sh_addr;
     329  Elf32_Off     sh_offset;
     330  Elf32_Word    sh_size;
     331  Elf32_Word    sh_link;
     332  Elf32_Word    sh_info;
     333  Elf32_Word    sh_addralign;
     334  Elf32_Word    sh_entsize;
     335} Elf32_Shdr;
     336
     337typedef struct elf64_shdr {
     338  Elf64_Word sh_name;           /* Section name, index in string tbl */
     339  Elf64_Word sh_type;           /* Type of section */
     340  Elf64_Xword sh_flags;         /* Miscellaneous section attributes */
     341  Elf64_Addr sh_addr;           /* Section virtual addr at execution */
     342  Elf64_Off sh_offset;          /* Section file offset */
     343  Elf64_Xword sh_size;          /* Size of section in bytes */
     344  Elf64_Word sh_link;           /* Index of another section */
     345  Elf64_Word sh_info;           /* Additional section information */
     346  Elf64_Xword sh_addralign;     /* Section alignment */
     347  Elf64_Xword sh_entsize;       /* Entry size if section holds table */
     348} Elf64_Shdr;
     349
     350#define EI_MAG0         0               /* e_ident[] indexes */
     351#define EI_MAG1         1
     352#define EI_MAG2         2
     353#define EI_MAG3         3
     354#define EI_CLASS        4
     355#define EI_DATA         5
     356#define EI_VERSION      6
     357#define EI_OSABI        7
     358#define EI_PAD          8
     359
     360#define ELFMAG0         0x7f            /* EI_MAG */
     361#define ELFMAG1         'E'
     362#define ELFMAG2         'L'
     363#define ELFMAG3         'F'
     364#define ELFMAG          "\177ELF"
     365#define SELFMAG         4
     366
     367#define ELFCLASSNONE    0               /* EI_CLASS */
     368#define ELFCLASS32      1
     369#define ELFCLASS64      2
     370#define ELFCLASSNUM     3
     371
     372#define ELFDATANONE     0               /* e_ident[EI_DATA] */
     373#define ELFDATA2LSB     1
     374#define ELFDATA2MSB     2
     375
     376#define EV_NONE         0               /* e_version, EI_VERSION */
     377#define EV_CURRENT      1
     378#define EV_NUM          2
     379
     380#define ELFOSABI_NONE   0
     381#define ELFOSABI_LINUX  3
     382
     383#ifndef ELF_OSABI
     384#define ELF_OSABI ELFOSABI_NONE
     385#endif
     386
     387/* Notes used in ET_CORE */
     388#define NT_PRSTATUS     1
     389#define NT_PRFPREG      2
     390#define NT_PRPSINFO     3
     391#define NT_TASKSTRUCT   4
     392#define NT_AUXV         6
     393#define NT_PRXFPREG     0x46e62b7f      /* copied from gdb5.1/include/elf/common.h */
     394
     395
     396/* Note header in a PT_NOTE section */
     397typedef struct elf32_note {
     398  Elf32_Word    n_namesz;       /* Name size */
     399  Elf32_Word    n_descsz;       /* Content size */
     400  Elf32_Word    n_type;         /* Content type */
     401} Elf32_Nhdr;
     402
     403/* Note header in a PT_NOTE section */
     404typedef struct elf64_note {
     405  Elf64_Word n_namesz;  /* Name size */
     406  Elf64_Word n_descsz;  /* Content size */
     407  Elf64_Word n_type;    /* Content type */
     408} Elf64_Nhdr;
     409
     410#if ELF_CLASS == ELFCLASS32
     411
     412extern Elf32_Dyn _DYNAMIC [];
     413#define elfhdr          elf32_hdr
     414#define elf_phdr        elf32_phdr
     415#define elf_note        elf32_note
     416
     417#else
     418
     419extern Elf64_Dyn _DYNAMIC [];
     420#define elfhdr          elf64_hdr
     421#define elf_phdr        elf64_phdr
     422#define elf_note        elf64_note
     423
     424#endif
     425
     426
     427#endif /* _LINUX_ELF_H */
  • include/linux/stat.h

    diff -Naur aboot-0.9b.orig/include/linux/stat.h aboot-0.9b/include/linux/stat.h
    old new  
     1#ifndef _LINUX_STAT_H
     2#define _LINUX_STAT_H
     3
     4#ifdef __KERNEL__
     5
     6#include <asm/stat.h>
     7
     8#endif
     9
     10#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
     11
     12#define S_IFMT  00170000
     13#define S_IFSOCK 0140000
     14#define S_IFLNK  0120000
     15#define S_IFREG  0100000
     16#define S_IFBLK  0060000
     17#define S_IFDIR  0040000
     18#define S_IFCHR  0020000
     19#define S_IFIFO  0010000
     20#define S_ISUID  0004000
     21#define S_ISGID  0002000
     22#define S_ISVTX  0001000
     23
     24#define S_ISLNK(m)      (((m) & S_IFMT) == S_IFLNK)
     25#define S_ISREG(m)      (((m) & S_IFMT) == S_IFREG)
     26#define S_ISDIR(m)      (((m) & S_IFMT) == S_IFDIR)
     27#define S_ISCHR(m)      (((m) & S_IFMT) == S_IFCHR)
     28#define S_ISBLK(m)      (((m) & S_IFMT) == S_IFBLK)
     29#define S_ISFIFO(m)     (((m) & S_IFMT) == S_IFIFO)
     30#define S_ISSOCK(m)     (((m) & S_IFMT) == S_IFSOCK)
     31
     32#define S_IRWXU 00700
     33#define S_IRUSR 00400
     34#define S_IWUSR 00200
     35#define S_IXUSR 00100
     36
     37#define S_IRWXG 00070
     38#define S_IRGRP 00040
     39#define S_IWGRP 00020
     40#define S_IXGRP 00010
     41
     42#define S_IRWXO 00007
     43#define S_IROTH 00004
     44#define S_IWOTH 00002
     45#define S_IXOTH 00001
     46
     47#endif
     48
     49#ifdef __KERNEL__
     50#define S_IRWXUGO       (S_IRWXU|S_IRWXG|S_IRWXO)
     51#define S_IALLUGO       (S_ISUID|S_ISGID|S_ISVTX|S_IRWXUGO)
     52#define S_IRUGO         (S_IRUSR|S_IRGRP|S_IROTH)
     53#define S_IWUGO         (S_IWUSR|S_IWGRP|S_IWOTH)
     54#define S_IXUGO         (S_IXUSR|S_IXGRP|S_IXOTH)
     55
     56#include <linux/types.h>
     57#include <sys/time.h>
     58
     59struct kstat {
     60        unsigned long   ino;
     61        dev_t           dev;
     62        umode_t         mode;
     63        unsigned int    nlink;
     64        uid_t           uid;
     65        gid_t           gid;
     66        dev_t           rdev;
     67        loff_t          size;
     68        struct timespec  atime;
     69        struct timespec mtime;
     70        struct timespec ctime;
     71        unsigned long   blksize;
     72        unsigned long   blocks;
     73};
     74
     75#endif
     76
     77#endif
  • include/linux/string.h

    diff -Naur aboot-0.9b.orig/include/linux/string.h aboot-0.9b/include/linux/string.h
    old new  
     1#ifndef _LINUX_STRING_H_
     2#define _LINUX_STRING_H_
     3
     4/* We don't want strings.h stuff being user by user stuff by accident */
     5
     6#ifdef __KERNEL__
     7
     8typedef unsigned gfp_t;
     9
     10#include <linux/compiler.h>     /* for inline */
     11#include <linux/types.h>        /* for size_t */
     12#include <linux/stddef.h>       /* for NULL */
     13
     14#ifdef __cplusplus
     15extern "C" {
     16#endif
     17
     18extern char * strpbrk(const char *,const char *);
     19extern char * strsep(char **,const char *);
     20extern __kernel_size_t strspn(const char *,const char *);
     21extern __kernel_size_t strcspn(const char *,const char *);
     22
     23/*
     24 * Include machine specific inline routines
     25 */
     26#include <asm/string.h>
     27
     28#ifndef __HAVE_ARCH_STRCPY
     29extern char * strcpy(char *,const char *);
     30#endif
     31#ifndef __HAVE_ARCH_STRNCPY
     32extern char * strncpy(char *,const char *, __kernel_size_t);
     33#endif
     34#ifndef __HAVE_ARCH_STRLCPY
     35size_t strlcpy(char *, const char *, size_t);
     36#endif
     37#ifndef __HAVE_ARCH_STRCAT
     38extern char * strcat(char *, const char *);
     39#endif
     40#ifndef __HAVE_ARCH_STRNCAT
     41extern char * strncat(char *, const char *, __kernel_size_t);
     42#endif
     43#ifndef __HAVE_ARCH_STRLCAT
     44extern size_t strlcat(char *, const char *, __kernel_size_t);
     45#endif
     46#ifndef __HAVE_ARCH_STRCMP
     47extern int strcmp(const char *,const char *);
     48#endif
     49#ifndef __HAVE_ARCH_STRNCMP
     50extern int strncmp(const char *,const char *,__kernel_size_t);
     51#endif
     52#ifndef __HAVE_ARCH_STRNICMP
     53extern int strnicmp(const char *, const char *, __kernel_size_t);
     54#endif
     55#ifndef __HAVE_ARCH_STRCHR
     56extern char * strchr(const char *,int);
     57#endif
     58#ifndef __HAVE_ARCH_STRNCHR
     59extern char * strnchr(const char *, size_t, int);
     60#endif
     61#ifndef __HAVE_ARCH_STRRCHR
     62extern char * strrchr(const char *,int);
     63#endif
     64#ifndef __HAVE_ARCH_STRSTR
     65extern char * strstr(const char *,const char *);
     66#endif
     67#ifndef __HAVE_ARCH_STRLEN
     68extern __kernel_size_t strlen(const char *);
     69#endif
     70#ifndef __HAVE_ARCH_STRNLEN
     71extern __kernel_size_t strnlen(const char *,__kernel_size_t);
     72#endif
     73
     74#ifndef __HAVE_ARCH_MEMSET
     75extern void * memset(void *,int,__kernel_size_t);
     76#endif
     77#ifndef __HAVE_ARCH_MEMCPY
     78extern void * memcpy(void *,const void *,__kernel_size_t);
     79#endif
     80#ifndef __HAVE_ARCH_MEMMOVE
     81extern void * memmove(void *,const void *,__kernel_size_t);
     82#endif
     83#ifndef __HAVE_ARCH_MEMSCAN
     84extern void * memscan(void *,int,__kernel_size_t);
     85#endif
     86#ifndef __HAVE_ARCH_MEMCMP
     87extern int memcmp(const void *,const void *,__kernel_size_t);
     88#endif
     89#ifndef __HAVE_ARCH_MEMCHR
     90extern void * memchr(const void *,int,__kernel_size_t);
     91#endif
     92
     93extern char *kstrdup(const char *s, gfp_t gfp);
     94
     95#ifdef __cplusplus
     96}
     97#endif
     98
     99#endif
     100#endif /* _LINUX_STRING_H_ */
  • lib/isolib.c

    diff -Naur aboot-0.9b.orig/lib/isolib.c aboot-0.9b/lib/isolib.c
    old new  
    66 * functionality to the Linux bootstrapper.  All we can do is
    77 * open and read files... but that's all we need 8-)
    88 */
     9#define __KERNEL__
    910#ifndef TESTING
    1011#  include <linux/string.h>
    1112#endif
     
    15201521#ifdef DEBUG_ROCK
    15211522           printf("Symlink component flag not implemented (%d)\n",slen);
    15221523#endif
     1524           break;
    15231525         };
    15241526         slen -= slp->len + 2;
    15251527         oldslp = slp;
Note: See TracBrowser for help on using the repository browser.