source: patches/aboot-0.9b-kernel26_gcc4_fixes-4.patch@ 83be575

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 83be575 was 6742797, checked in by Joe Ciccone <jciccone@…>, 18 years ago

Added aboot-0.9b-kernel26_gcc4_fixes-4.patch

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

    Submitted By: Joe Ciccone <jciccone@linuxfromscratch.org>
    Date: 2006-06-25
    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 or that are not
            included with the linux-headers package installed in the
            system.
    
    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                }
  • doc/man/Makefile

    diff -Naur aboot-0.9b.orig/doc/man/Makefile aboot-0.9b/doc/man/Makefile
    old new  
    66# use that value. Otherwise default to /usr/man.
    77
    88ifeq ($(mandir),)
    9 MANDIR=/usr/man
     9MANDIR=$(root)/usr/man
    1010else
    1111MANDIR=$(mandir)
    1212endif
  • include/asm/a.out.h

    diff -Naur aboot-0.9b.orig/include/asm/a.out.h aboot-0.9b/include/asm/a.out.h
    old new  
     1#ifndef __ALPHA_A_OUT_H__
     2#define __ALPHA_A_OUT_H__
     3
     4#include <linux/types.h>
     5
     6/*
     7 * OSF/1 ECOFF header structs.  ECOFF files consist of:
     8 *      - a file header (struct filehdr),
     9 *      - an a.out header (struct aouthdr),
     10 *      - one or more section headers (struct scnhdr).
     11 *        The filhdr's "f_nscns" field contains the
     12 *        number of section headers.
     13 */
     14
     15struct filehdr
     16{
     17        /* OSF/1 "file" header */
     18        __u16 f_magic, f_nscns;
     19        __u32 f_timdat;
     20        __u64 f_symptr;
     21        __u32 f_nsyms;
     22        __u16 f_opthdr, f_flags;
     23};
     24
     25struct aouthdr
     26{
     27        __u64 info;             /* after that it looks quite normal.. */
     28        __u64 tsize;
     29        __u64 dsize;
     30        __u64 bsize;
     31        __u64 entry;
     32        __u64 text_start;       /* with a few additions that actually make sense */
     33        __u64 data_start;
     34        __u64 bss_start;
     35        __u32 gprmask, fprmask; /* bitmask of general & floating point regs used in binary */
     36        __u64 gpvalue;
     37};
     38
     39struct scnhdr
     40{
     41        char    s_name[8];
     42        __u64   s_paddr;
     43        __u64   s_vaddr;
     44        __u64   s_size;
     45        __u64   s_scnptr;
     46        __u64   s_relptr;
     47        __u64   s_lnnoptr;
     48        __u16   s_nreloc;
     49        __u16   s_nlnno;
     50        __u32   s_flags;
     51};
     52
     53struct exec
     54{
     55        /* OSF/1 "file" header */
     56        struct filehdr          fh;
     57        struct aouthdr          ah;
     58};
     59
     60/*
     61 * Define's so that the kernel exec code can access the a.out header
     62 * fields...
     63 */
     64#define a_info          ah.info
     65#define a_text          ah.tsize
     66#define a_data          ah.dsize
     67#define a_bss           ah.bsize
     68#define a_entry         ah.entry
     69#define a_textstart     ah.text_start
     70#define a_datastart     ah.data_start
     71#define a_bssstart      ah.bss_start
     72#define a_gprmask       ah.gprmask
     73#define a_fprmask       ah.fprmask
     74#define a_gpvalue       ah.gpvalue
     75
     76#define N_TXTADDR(x) ((x).a_textstart)
     77#define N_DATADDR(x) ((x).a_datastart)
     78#define N_BSSADDR(x) ((x).a_bssstart)
     79#define N_DRSIZE(x) 0
     80#define N_TRSIZE(x) 0
     81#define N_SYMSIZE(x) 0
     82
     83#define AOUTHSZ         sizeof(struct aouthdr)
     84#define SCNHSZ          sizeof(struct scnhdr)
     85#define SCNROUND        16
     86
     87#define N_TXTOFF(x) \
     88  ((long) N_MAGIC(x) == ZMAGIC ? 0 : \
     89   (sizeof(struct exec) + (x).fh.f_nscns*SCNHSZ + SCNROUND - 1) & ~(SCNROUND - 1))
     90
     91#endif /* __A_OUT_GNU_H__ */
  • 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/hwrpb.h

    diff -Naur aboot-0.9b.orig/include/asm/hwrpb.h aboot-0.9b/include/asm/hwrpb.h
    old new  
     1#ifndef __ALPHA_HWRPB_H
     2#define __ALPHA_HWRPB_H
     3
     4#define INIT_HWRPB ((struct hwrpb_struct *) 0x10000000)
     5
     6/*
     7 * DEC processor types for Alpha systems.  Found in HWRPB.
     8 * These values are architected.
     9 */
     10
     11#define EV3_CPU                 1       /* EV3                  */
     12#define EV4_CPU                 2       /* EV4 (21064)          */
     13#define LCA4_CPU                4       /* LCA4 (21066/21068)   */
     14#define EV5_CPU                 5       /* EV5 (21164)          */
     15#define EV45_CPU                6       /* EV4.5 (21064/xxx)    */
     16#define EV56_CPU                7       /* EV5.6 (21164)        */
     17#define EV6_CPU                 8       /* EV6 (21264)          */
     18#define PCA56_CPU               9       /* PCA56 (21164PC)      */
     19#define PCA57_CPU               10      /* PCA57 (notyet)       */
     20#define EV67_CPU                11      /* EV67 (21264A)        */
     21#define EV68CB_CPU              12      /* EV68CB (21264C)      */
     22#define EV68AL_CPU              13      /* EV68AL (21264B)      */
     23#define EV68CX_CPU              14      /* EV68CX (21264D)      */
     24#define EV7_CPU                 15      /* EV7 (21364)          */
     25#define EV79_CPU                16      /* EV79 (21364??)       */
     26#define EV69_CPU                17      /* EV69 (21264/EV69A)   */
     27
     28/*
     29 * DEC system types for Alpha systems.  Found in HWRPB.
     30 * These values are architected.
     31 */
     32
     33#define ST_ADU                    1     /* Alpha ADU systype    */
     34#define ST_DEC_4000               2     /* Cobra systype        */
     35#define ST_DEC_7000               3     /* Ruby systype         */
     36#define ST_DEC_3000_500           4     /* Flamingo systype     */
     37#define ST_DEC_2000_300           6     /* Jensen systype       */
     38#define ST_DEC_3000_300           7     /* Pelican systype      */
     39#define ST_DEC_2100_A500          9     /* Sable systype        */
     40#define ST_DEC_AXPVME_64         10     /* AXPvme system type   */
     41#define ST_DEC_AXPPCI_33         11     /* NoName system type   */
     42#define ST_DEC_TLASER            12     /* Turbolaser systype   */
     43#define ST_DEC_2100_A50          13     /* Avanti systype       */
     44#define ST_DEC_MUSTANG           14     /* Mustang systype      */
     45#define ST_DEC_ALCOR             15     /* Alcor (EV5) systype  */
     46#define ST_DEC_1000              17     /* Mikasa systype       */
     47#define ST_DEC_EB64              18     /* EB64 systype         */
     48#define ST_DEC_EB66              19     /* EB66 systype         */
     49#define ST_DEC_EB64P             20     /* EB64+ systype        */
     50#define ST_DEC_BURNS             21     /* laptop systype       */
     51#define ST_DEC_RAWHIDE           22     /* Rawhide systype      */
     52#define ST_DEC_K2                23     /* K2 systype           */
     53#define ST_DEC_LYNX              24     /* Lynx systype         */
     54#define ST_DEC_XL                25     /* Alpha XL systype     */
     55#define ST_DEC_EB164             26     /* EB164 systype        */
     56#define ST_DEC_NORITAKE          27     /* Noritake systype     */
     57#define ST_DEC_CORTEX            28     /* Cortex systype       */
     58#define ST_DEC_MIATA             30     /* Miata systype        */
     59#define ST_DEC_XXM               31     /* XXM systype          */
     60#define ST_DEC_TAKARA            32     /* Takara systype       */
     61#define ST_DEC_YUKON             33     /* Yukon systype        */
     62#define ST_DEC_TSUNAMI           34     /* Tsunami systype      */
     63#define ST_DEC_WILDFIRE          35     /* Wildfire systype     */
     64#define ST_DEC_CUSCO             36     /* CUSCO systype        */
     65#define ST_DEC_EIGER             37     /* Eiger systype        */
     66#define ST_DEC_TITAN             38     /* Titan systype        */
     67#define ST_DEC_MARVEL            39     /* Marvel systype       */
     68
     69/* UNOFFICIAL!!! */
     70#define ST_UNOFFICIAL_BIAS      100
     71#define ST_DTI_RUFFIAN          101     /* RUFFIAN systype      */
     72
     73/* Alpha Processor, Inc. systems */
     74#define ST_API_BIAS             200
     75#define ST_API_NAUTILUS         201     /* UP1000 systype       */
     76
     77struct pcb_struct {
     78        unsigned long ksp;
     79        unsigned long usp;
     80        unsigned long ptbr;
     81        unsigned int pcc;
     82        unsigned int asn;
     83        unsigned long unique;
     84        unsigned long flags;
     85        unsigned long res1, res2;
     86};
     87
     88struct percpu_struct {
     89        unsigned long hwpcb[16];
     90        unsigned long flags;
     91        unsigned long pal_mem_size;
     92        unsigned long pal_scratch_size;
     93        unsigned long pal_mem_pa;
     94        unsigned long pal_scratch_pa;
     95        unsigned long pal_revision;
     96        unsigned long type;
     97        unsigned long variation;
     98        unsigned long revision;
     99        unsigned long serial_no[2];
     100        unsigned long logout_area_pa;
     101        unsigned long logout_area_len;
     102        unsigned long halt_PCBB;
     103        unsigned long halt_PC;
     104        unsigned long halt_PS;
     105        unsigned long halt_arg;
     106        unsigned long halt_ra;
     107        unsigned long halt_pv;
     108        unsigned long halt_reason;
     109        unsigned long res;
     110        unsigned long ipc_buffer[21];
     111        unsigned long palcode_avail[16];
     112        unsigned long compatibility;
     113        unsigned long console_data_log_pa;
     114        unsigned long console_data_log_length;
     115        unsigned long bcache_info;
     116};
     117
     118struct procdesc_struct {
     119        unsigned long weird_vms_stuff;
     120        unsigned long address;
     121};
     122
     123struct vf_map_struct {
     124        unsigned long va;
     125        unsigned long pa;
     126        unsigned long count;
     127};
     128
     129struct crb_struct {
     130        struct procdesc_struct * dispatch_va;
     131        struct procdesc_struct * dispatch_pa;
     132        struct procdesc_struct * fixup_va;
     133        struct procdesc_struct * fixup_pa;
     134        /* virtual->physical map */
     135        unsigned long map_entries;
     136        unsigned long map_pages;
     137        struct vf_map_struct map[1];
     138};
     139
     140struct memclust_struct {
     141        unsigned long start_pfn;
     142        unsigned long numpages;
     143        unsigned long numtested;
     144        unsigned long bitmap_va;
     145        unsigned long bitmap_pa;
     146        unsigned long bitmap_chksum;
     147        unsigned long usage;
     148};
     149
     150struct memdesc_struct {
     151        unsigned long chksum;
     152        unsigned long optional_pa;
     153        unsigned long numclusters;
     154        struct memclust_struct cluster[0];
     155};
     156
     157struct dsr_struct {
     158        long smm;                       /* SMM nubber used by LMF       */
     159        unsigned long  lurt_off;        /* offset to LURT table         */
     160        unsigned long  sysname_off;     /* offset to sysname char count */
     161};
     162
     163struct hwrpb_struct {
     164        unsigned long phys_addr;        /* check: physical address of the hwrpb */
     165        unsigned long id;               /* check: "HWRPB\0\0\0" */
     166        unsigned long revision;
     167        unsigned long size;             /* size of hwrpb */
     168        unsigned long cpuid;
     169        unsigned long pagesize;         /* 8192, I hope */
     170        unsigned long pa_bits;          /* number of physical address bits */
     171        unsigned long max_asn;
     172        unsigned char ssn[16];          /* system serial number: big bother is watching */
     173        unsigned long sys_type;
     174        unsigned long sys_variation;
     175        unsigned long sys_revision;
     176        unsigned long intr_freq;        /* interval clock frequency * 4096 */
     177        unsigned long cycle_freq;       /* cycle counter frequency */
     178        unsigned long vptb;             /* Virtual Page Table Base address */
     179        unsigned long res1;
     180        unsigned long tbhb_offset;      /* Translation Buffer Hint Block */
     181        unsigned long nr_processors;
     182        unsigned long processor_size;
     183        unsigned long processor_offset;
     184        unsigned long ctb_nr;
     185        unsigned long ctb_size;         /* console terminal block size */
     186        unsigned long ctbt_offset;      /* console terminal block table offset */
     187        unsigned long crb_offset;       /* console callback routine block */
     188        unsigned long mddt_offset;      /* memory data descriptor table */
     189        unsigned long cdb_offset;       /* configuration data block (or NULL) */
     190        unsigned long frut_offset;      /* FRU table (or NULL) */
     191        void (*save_terminal)(unsigned long);
     192        unsigned long save_terminal_data;
     193        void (*restore_terminal)(unsigned long);
     194        unsigned long restore_terminal_data;
     195        void (*CPU_restart)(unsigned long);
     196        unsigned long CPU_restart_data;
     197        unsigned long res2;
     198        unsigned long res3;
     199        unsigned long chksum;
     200        unsigned long rxrdy;
     201        unsigned long txrdy;
     202        unsigned long dsr_offset;       /* "Dynamic System Recognition Data Block Table" */
     203};
     204
     205#endif /* __ALPHA_HWRPB_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/pal.h

    diff -Naur aboot-0.9b.orig/include/asm/pal.h aboot-0.9b/include/asm/pal.h
    old new  
     1#ifndef __ALPHA_PAL_H
     2#define __ALPHA_PAL_H
     3
     4/*
     5 * Common PAL-code
     6 */
     7#define PAL_halt          0
     8#define PAL_cflush        1
     9#define PAL_draina        2
     10#define PAL_bpt         128
     11#define PAL_bugchk      129
     12#define PAL_chmk        131
     13#define PAL_callsys     131
     14#define PAL_imb         134
     15#define PAL_rduniq      158
     16#define PAL_wruniq      159
     17#define PAL_gentrap     170
     18#define PAL_nphalt      190
     19
     20/*
     21 * VMS specific PAL-code
     22 */
     23#define PAL_swppal      10
     24#define PAL_mfpr_vptb   41
     25
     26/*
     27 * OSF specific PAL-code
     28 */
     29#define PAL_cserve       9
     30#define PAL_wripir      13
     31#define PAL_rdmces      16
     32#define PAL_wrmces      17
     33#define PAL_wrfen       43
     34#define PAL_wrvptptr    45
     35#define PAL_jtopal      46
     36#define PAL_swpctx      48
     37#define PAL_wrval       49
     38#define PAL_rdval       50
     39#define PAL_tbi         51
     40#define PAL_wrent       52
     41#define PAL_swpipl      53
     42#define PAL_rdps        54
     43#define PAL_wrkgp       55
     44#define PAL_wrusp       56
     45#define PAL_wrperfmon   57
     46#define PAL_rdusp       58
     47#define PAL_whami       60
     48#define PAL_retsys      61
     49#define PAL_rti         63
     50
     51#endif /* __ALPHA_PAL_H */
  • include/asm/spinlock.h

    diff -Naur aboot-0.9b.orig/include/asm/spinlock.h aboot-0.9b/include/asm/spinlock.h
    old new  
     1#ifndef _ALPHA_SPINLOCK_H
     2#define _ALPHA_SPINLOCK_H
     3
     4#include <linux/config.h>
     5#include <asm/system.h>
     6#include <linux/kernel.h>
     7#include <asm/current.h>
     8
     9/*
     10 * Simple spin lock operations.  There are two variants, one clears IRQ's
     11 * on the local processor, one does not.
     12 *
     13 * We make no fairness assumptions. They have a cost.
     14 */
     15
     16#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock)
     17#define __raw_spin_is_locked(x) ((x)->lock != 0)
     18#define __raw_spin_unlock_wait(x) \
     19                do { cpu_relax(); } while ((x)->lock)
     20
     21static inline void __raw_spin_unlock(raw_spinlock_t * lock)
     22{
     23        mb();
     24        lock->lock = 0;
     25}
     26
     27static inline void __raw_spin_lock(raw_spinlock_t * lock)
     28{
     29        long tmp;
     30
     31        __asm__ __volatile__(
     32        "1:     ldl_l   %0,%1\n"
     33        "       bne     %0,2f\n"
     34        "       lda     %0,1\n"
     35        "       stl_c   %0,%1\n"
     36        "       beq     %0,2f\n"
     37        "       mb\n"
     38        ".subsection 2\n"
     39        "2:     ldl     %0,%1\n"
     40        "       bne     %0,2b\n"
     41        "       br      1b\n"
     42        ".previous"
     43        : "=&r" (tmp), "=m" (lock->lock)
     44        : "m"(lock->lock) : "memory");
     45}
     46
     47static inline int __raw_spin_trylock(raw_spinlock_t *lock)
     48{
     49        return !test_and_set_bit(0, &lock->lock);
     50}
     51
     52/***********************************************************/
     53
     54static inline int __raw_read_can_lock(raw_rwlock_t *lock)
     55{
     56        return (lock->lock & 1) == 0;
     57}
     58
     59static inline int __raw_write_can_lock(raw_rwlock_t *lock)
     60{
     61        return lock->lock == 0;
     62}
     63
     64static inline void __raw_read_lock(raw_rwlock_t *lock)
     65{
     66        long regx;
     67
     68        __asm__ __volatile__(
     69        "1:     ldl_l   %1,%0\n"
     70        "       blbs    %1,6f\n"
     71        "       subl    %1,2,%1\n"
     72        "       stl_c   %1,%0\n"
     73        "       beq     %1,6f\n"
     74        "       mb\n"
     75        ".subsection 2\n"
     76        "6:     ldl     %1,%0\n"
     77        "       blbs    %1,6b\n"
     78        "       br      1b\n"
     79        ".previous"
     80        : "=m" (*lock), "=&r" (regx)
     81        : "m" (*lock) : "memory");
     82}
     83
     84static inline void __raw_write_lock(raw_rwlock_t *lock)
     85{
     86        long regx;
     87
     88        __asm__ __volatile__(
     89        "1:     ldl_l   %1,%0\n"
     90        "       bne     %1,6f\n"
     91        "       lda     %1,1\n"
     92        "       stl_c   %1,%0\n"
     93        "       beq     %1,6f\n"
     94        "       mb\n"
     95        ".subsection 2\n"
     96        "6:     ldl     %1,%0\n"
     97        "       bne     %1,6b\n"
     98        "       br      1b\n"
     99        ".previous"
     100        : "=m" (*lock), "=&r" (regx)
     101        : "m" (*lock) : "memory");
     102}
     103
     104static inline int __raw_read_trylock(raw_rwlock_t * lock)
     105{
     106        long regx;
     107        int success;
     108
     109        __asm__ __volatile__(
     110        "1:     ldl_l   %1,%0\n"
     111        "       lda     %2,0\n"
     112        "       blbs    %1,2f\n"
     113        "       subl    %1,2,%2\n"
     114        "       stl_c   %2,%0\n"
     115        "       beq     %2,6f\n"
     116        "2:     mb\n"
     117        ".subsection 2\n"
     118        "6:     br      1b\n"
     119        ".previous"
     120        : "=m" (*lock), "=&r" (regx), "=&r" (success)
     121        : "m" (*lock) : "memory");
     122
     123        return success;
     124}
     125
     126static inline int __raw_write_trylock(raw_rwlock_t * lock)
     127{
     128        long regx;
     129        int success;
     130
     131        __asm__ __volatile__(
     132        "1:     ldl_l   %1,%0\n"
     133        "       lda     %2,0\n"
     134        "       bne     %1,2f\n"
     135        "       lda     %2,1\n"
     136        "       stl_c   %2,%0\n"
     137        "       beq     %2,6f\n"
     138        "2:     mb\n"
     139        ".subsection 2\n"
     140        "6:     br      1b\n"
     141        ".previous"
     142        : "=m" (*lock), "=&r" (regx), "=&r" (success)
     143        : "m" (*lock) : "memory");
     144
     145        return success;
     146}
     147
     148static inline void __raw_read_unlock(raw_rwlock_t * lock)
     149{
     150        long regx;
     151        __asm__ __volatile__(
     152        "       mb\n"
     153        "1:     ldl_l   %1,%0\n"
     154        "       addl    %1,2,%1\n"
     155        "       stl_c   %1,%0\n"
     156        "       beq     %1,6f\n"
     157        ".subsection 2\n"
     158        "6:     br      1b\n"
     159        ".previous"
     160        : "=m" (*lock), "=&r" (regx)
     161        : "m" (*lock) : "memory");
     162}
     163
     164static inline void __raw_write_unlock(raw_rwlock_t * lock)
     165{
     166        mb();
     167        lock->lock = 0;
     168}
     169
     170#endif /* _ALPHA_SPINLOCK_H */
  • include/asm/spinlock_types.h

    diff -Naur aboot-0.9b.orig/include/asm/spinlock_types.h aboot-0.9b/include/asm/spinlock_types.h
    old new  
     1#ifndef _ALPHA_SPINLOCK_TYPES_H
     2#define _ALPHA_SPINLOCK_TYPES_H
     3
     4#ifndef __LINUX_SPINLOCK_TYPES_H
     5# error "please don't include this file directly"
     6#endif
     7
     8typedef struct {
     9        volatile unsigned int lock;
     10} raw_spinlock_t;
     11
     12#define __RAW_SPIN_LOCK_UNLOCKED        { 0 }
     13
     14typedef struct {
     15        volatile unsigned int lock;
     16} raw_rwlock_t;
     17
     18#define __RAW_RW_LOCK_UNLOCKED          { 0 }
     19
     20#endif
  • 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/thread_info.h

    diff -Naur aboot-0.9b.orig/include/asm/thread_info.h aboot-0.9b/include/asm/thread_info.h
    old new  
     1#ifndef _ALPHA_THREAD_INFO_H
     2#define _ALPHA_THREAD_INFO_H
     3
     4#ifdef __KERNEL__
     5
     6#ifndef __ASSEMBLY__
     7#include <asm/processor.h>
     8#include <asm/types.h>
     9#include <asm/hwrpb.h>
     10#endif
     11
     12#ifndef __ASSEMBLY__
     13struct thread_info {
     14        struct pcb_struct       pcb;            /* palcode state */
     15
     16        struct task_struct      *task;          /* main task structure */
     17        unsigned int            flags;          /* low level flags */
     18        unsigned int            ieee_state;     /* see fpu.h */
     19
     20        struct exec_domain      *exec_domain;   /* execution domain */
     21        mm_segment_t            addr_limit;     /* thread address space */
     22        unsigned                cpu;            /* current CPU */
     23        int                     preempt_count; /* 0 => preemptable, <0 => BUG */
     24
     25        int bpt_nsaved;
     26        unsigned long bpt_addr[2];              /* breakpoint handling  */
     27        unsigned int bpt_insn[2];
     28
     29        struct restart_block    restart_block;
     30};
     31
     32/*
     33 * Macros/functions for gaining access to the thread information structure.
     34 */
     35#define INIT_THREAD_INFO(tsk)                   \
     36{                                               \
     37        .task           = &tsk,                 \
     38        .exec_domain    = &default_exec_domain, \
     39        .addr_limit     = KERNEL_DS,            \
     40        .restart_block = {                      \
     41                .fn = do_no_restart_syscall,    \
     42        },                                      \
     43}
     44
     45#define init_thread_info        (init_thread_union.thread_info)
     46#define init_stack              (init_thread_union.stack)
     47
     48/* How to get the thread information struct from C.  */
     49register struct thread_info *__current_thread_info __asm__("$8");
     50#define current_thread_info()  __current_thread_info
     51
     52/* Thread information allocation.  */
     53#define THREAD_SIZE (2*PAGE_SIZE)
     54#define alloc_thread_info(tsk) \
     55  ((struct thread_info *) __get_free_pages(GFP_KERNEL,1))
     56#define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
     57
     58#endif /* __ASSEMBLY__ */
     59
     60#define PREEMPT_ACTIVE          0x40000000
     61
     62/*
     63 * Thread information flags:
     64 * - these are process state flags and used from assembly
     65 * - pending work-to-be-done flags come first to fit in and immediate operand.
     66 *
     67 * TIF_SYSCALL_TRACE is known to be 0 via blbs.
     68 */
     69#define TIF_SYSCALL_TRACE       0       /* syscall trace active */
     70#define TIF_NOTIFY_RESUME       1       /* resumption notification requested */
     71#define TIF_SIGPENDING          2       /* signal pending */
     72#define TIF_NEED_RESCHED        3       /* rescheduling necessary */
     73#define TIF_POLLING_NRFLAG      4       /* poll_idle is polling NEED_RESCHED */
     74#define TIF_DIE_IF_KERNEL       5       /* dik recursion lock */
     75#define TIF_UAC_NOPRINT         6       /* see sysinfo.h */
     76#define TIF_UAC_NOFIX           7
     77#define TIF_UAC_SIGBUS          8
     78#define TIF_MEMDIE              9
     79
     80#define _TIF_SYSCALL_TRACE      (1<<TIF_SYSCALL_TRACE)
     81#define _TIF_NOTIFY_RESUME      (1<<TIF_NOTIFY_RESUME)
     82#define _TIF_SIGPENDING         (1<<TIF_SIGPENDING)
     83#define _TIF_NEED_RESCHED       (1<<TIF_NEED_RESCHED)
     84#define _TIF_POLLING_NRFLAG     (1<<TIF_POLLING_NRFLAG)
     85
     86/* Work to do on interrupt/exception return.  */
     87#define _TIF_WORK_MASK          (_TIF_NOTIFY_RESUME     \
     88                                 | _TIF_SIGPENDING      \
     89                                 | _TIF_NEED_RESCHED)
     90
     91/* Work to do on any return to userspace.  */
     92#define _TIF_ALLWORK_MASK       (_TIF_WORK_MASK         \
     93                                 | _TIF_SYSCALL_TRACE)
     94
     95#endif /* __KERNEL__ */
     96#endif /* _ALPHA_THREAD_INFO_H */
  • include/asm-generic/bitops/find.h

    diff -Naur aboot-0.9b.orig/include/asm-generic/bitops/find.h aboot-0.9b/include/asm-generic/bitops/find.h
    old new  
     1/* Dummy Header */
  • 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/blockgroup_lock.h

    diff -Naur aboot-0.9b.orig/include/linux/blockgroup_lock.h aboot-0.9b/include/linux/blockgroup_lock.h
    old new  
     1#ifndef _LINUX_BLOCKGROUP_LOCK_H
     2#define _LINUX_BLOCKGROUP_LOCK_H
     3/*
     4 * Per-blockgroup locking for ext2 and ext3.
     5 *
     6 * Simple hashed spinlocking.
     7 */
     8
     9#include <linux/config.h>
     10#include <linux/spinlock.h>
     11#include <linux/cache.h>
     12
     13#ifdef CONFIG_SMP
     14
     15/*
     16 * We want a power-of-two.  Is there a better way than this?
     17 */
     18
     19#if NR_CPUS >= 32
     20#define NR_BG_LOCKS     128
     21#elif NR_CPUS >= 16
     22#define NR_BG_LOCKS     64
     23#elif NR_CPUS >= 8
     24#define NR_BG_LOCKS     32
     25#elif NR_CPUS >= 4
     26#define NR_BG_LOCKS     16
     27#elif NR_CPUS >= 2
     28#define NR_BG_LOCKS     8
     29#else
     30#define NR_BG_LOCKS     4
     31#endif
     32
     33#else   /* CONFIG_SMP */
     34#define NR_BG_LOCKS     1
     35#endif  /* CONFIG_SMP */
     36
     37struct bgl_lock {
     38        spinlock_t lock;
     39} ____cacheline_aligned_in_smp;
     40
     41struct blockgroup_lock {
     42        struct bgl_lock locks[NR_BG_LOCKS];
     43};
     44
     45static inline void bgl_lock_init(struct blockgroup_lock *bgl)
     46{
     47        int i;
     48
     49        for (i = 0; i < NR_BG_LOCKS; i++)
     50                spin_lock_init(&bgl->locks[i].lock);
     51}
     52
     53/*
     54 * The accessor is a macro so we can embed a blockgroup_lock into different
     55 * superblock types
     56 */
     57#define sb_bgl_lock(sb, block_group) \
     58        (&(sb)->s_blockgroup_lock.locks[(block_group) & (NR_BG_LOCKS-1)].lock)
     59
     60#endif
  • include/linux/config.h

    diff -Naur aboot-0.9b.orig/include/linux/config.h aboot-0.9b/include/linux/config.h
    old new  
     1/* Dummy Config.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/spinlock_api_smp.h

    diff -Naur aboot-0.9b.orig/include/linux/spinlock_api_smp.h aboot-0.9b/include/linux/spinlock_api_smp.h
    old new  
     1#ifndef __LINUX_SPINLOCK_API_SMP_H
     2#define __LINUX_SPINLOCK_API_SMP_H
     3
     4#ifndef __LINUX_SPINLOCK_H
     5# error "please don't include this file directly"
     6#endif
     7
     8/*
     9 * include/linux/spinlock_api_smp.h
     10 *
     11 * spinlock API declarations on SMP (and debug)
     12 * (implemented in kernel/spinlock.c)
     13 *
     14 * portions Copyright 2005, Red Hat, Inc., Ingo Molnar
     15 * Released under the General Public License (GPL).
     16 */
     17
     18int in_lock_functions(unsigned long addr);
     19
     20#define assert_spin_locked(x)   BUG_ON(!spin_is_locked(x))
     21
     22void __lockfunc _spin_lock(spinlock_t *lock)            __acquires(spinlock_t);
     23void __lockfunc _read_lock(rwlock_t *lock)              __acquires(rwlock_t);
     24void __lockfunc _write_lock(rwlock_t *lock)             __acquires(rwlock_t);
     25void __lockfunc _spin_lock_bh(spinlock_t *lock)         __acquires(spinlock_t);
     26void __lockfunc _read_lock_bh(rwlock_t *lock)           __acquires(rwlock_t);
     27void __lockfunc _write_lock_bh(rwlock_t *lock)          __acquires(rwlock_t);
     28void __lockfunc _spin_lock_irq(spinlock_t *lock)        __acquires(spinlock_t);
     29void __lockfunc _read_lock_irq(rwlock_t *lock)          __acquires(rwlock_t);
     30void __lockfunc _write_lock_irq(rwlock_t *lock)         __acquires(rwlock_t);
     31unsigned long __lockfunc _spin_lock_irqsave(spinlock_t *lock)
     32                                                        __acquires(spinlock_t);
     33unsigned long __lockfunc _read_lock_irqsave(rwlock_t *lock)
     34                                                        __acquires(rwlock_t);
     35unsigned long __lockfunc _write_lock_irqsave(rwlock_t *lock)
     36                                                        __acquires(rwlock_t);
     37int __lockfunc _spin_trylock(spinlock_t *lock);
     38int __lockfunc _read_trylock(rwlock_t *lock);
     39int __lockfunc _write_trylock(rwlock_t *lock);
     40int __lockfunc _spin_trylock_bh(spinlock_t *lock);
     41void __lockfunc _spin_unlock(spinlock_t *lock)          __releases(spinlock_t);
     42void __lockfunc _read_unlock(rwlock_t *lock)            __releases(rwlock_t);
     43void __lockfunc _write_unlock(rwlock_t *lock)           __releases(rwlock_t);
     44void __lockfunc _spin_unlock_bh(spinlock_t *lock)       __releases(spinlock_t);
     45void __lockfunc _read_unlock_bh(rwlock_t *lock)         __releases(rwlock_t);
     46void __lockfunc _write_unlock_bh(rwlock_t *lock)        __releases(rwlock_t);
     47void __lockfunc _spin_unlock_irq(spinlock_t *lock)      __releases(spinlock_t);
     48void __lockfunc _read_unlock_irq(rwlock_t *lock)        __releases(rwlock_t);
     49void __lockfunc _write_unlock_irq(rwlock_t *lock)       __releases(rwlock_t);
     50void __lockfunc _spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags)
     51                                                        __releases(spinlock_t);
     52void __lockfunc _read_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
     53                                                        __releases(rwlock_t);
     54void __lockfunc _write_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
     55                                                        __releases(rwlock_t);
     56
     57#endif /* __LINUX_SPINLOCK_API_SMP_H */
  • include/linux/spinlock_api_up.h

    diff -Naur aboot-0.9b.orig/include/linux/spinlock_api_up.h aboot-0.9b/include/linux/spinlock_api_up.h
    old new  
     1#ifndef __LINUX_SPINLOCK_API_UP_H
     2#define __LINUX_SPINLOCK_API_UP_H
     3
     4#ifndef __LINUX_SPINLOCK_H
     5# error "please don't include this file directly"
     6#endif
     7
     8/*
     9 * include/linux/spinlock_api_up.h
     10 *
     11 * spinlock API implementation on UP-nondebug (inlined implementation)
     12 *
     13 * portions Copyright 2005, Red Hat, Inc., Ingo Molnar
     14 * Released under the General Public License (GPL).
     15 */
     16
     17#define in_lock_functions(ADDR)         0
     18
     19#define assert_spin_locked(lock)        do { (void)(lock); } while (0)
     20
     21/*
     22 * In the UP-nondebug case there's no real locking going on, so the
     23 * only thing we have to do is to keep the preempt counts and irq
     24 * flags straight, to supress compiler warnings of unused lock
     25 * variables, and to add the proper checker annotations:
     26 */
     27#define __LOCK(lock) \
     28  do { preempt_disable(); __acquire(lock); (void)(lock); } while (0)
     29
     30#define __LOCK_BH(lock) \
     31  do { local_bh_disable(); __LOCK(lock); } while (0)
     32
     33#define __LOCK_IRQ(lock) \
     34  do { local_irq_disable(); __LOCK(lock); } while (0)
     35
     36#define __LOCK_IRQSAVE(lock, flags) \
     37  do { local_irq_save(flags); __LOCK(lock); } while (0)
     38
     39#define __UNLOCK(lock) \
     40  do { preempt_enable(); __release(lock); (void)(lock); } while (0)
     41
     42#define __UNLOCK_BH(lock) \
     43  do { preempt_enable_no_resched(); local_bh_enable(); __release(lock); (void)(lock); } while (0)
     44
     45#define __UNLOCK_IRQ(lock) \
     46  do { local_irq_enable(); __UNLOCK(lock); } while (0)
     47
     48#define __UNLOCK_IRQRESTORE(lock, flags) \
     49  do { local_irq_restore(flags); __UNLOCK(lock); } while (0)
     50
     51#define _spin_lock(lock)                        __LOCK(lock)
     52#define _read_lock(lock)                        __LOCK(lock)
     53#define _write_lock(lock)                       __LOCK(lock)
     54#define _spin_lock_bh(lock)                     __LOCK_BH(lock)
     55#define _read_lock_bh(lock)                     __LOCK_BH(lock)
     56#define _write_lock_bh(lock)                    __LOCK_BH(lock)
     57#define _spin_lock_irq(lock)                    __LOCK_IRQ(lock)
     58#define _read_lock_irq(lock)                    __LOCK_IRQ(lock)
     59#define _write_lock_irq(lock)                   __LOCK_IRQ(lock)
     60#define _spin_lock_irqsave(lock, flags)         __LOCK_IRQSAVE(lock, flags)
     61#define _read_lock_irqsave(lock, flags)         __LOCK_IRQSAVE(lock, flags)
     62#define _write_lock_irqsave(lock, flags)        __LOCK_IRQSAVE(lock, flags)
     63#define _spin_trylock(lock)                     ({ __LOCK(lock); 1; })
     64#define _read_trylock(lock)                     ({ __LOCK(lock); 1; })
     65#define _write_trylock(lock)                    ({ __LOCK(lock); 1; })
     66#define _spin_trylock_bh(lock)                  ({ __LOCK_BH(lock); 1; })
     67#define _spin_unlock(lock)                      __UNLOCK(lock)
     68#define _read_unlock(lock)                      __UNLOCK(lock)
     69#define _write_unlock(lock)                     __UNLOCK(lock)
     70#define _spin_unlock_bh(lock)                   __UNLOCK_BH(lock)
     71#define _write_unlock_bh(lock)                  __UNLOCK_BH(lock)
     72#define _read_unlock_bh(lock)                   __UNLOCK_BH(lock)
     73#define _spin_unlock_irq(lock)                  __UNLOCK_IRQ(lock)
     74#define _read_unlock_irq(lock)                  __UNLOCK_IRQ(lock)
     75#define _write_unlock_irq(lock)                 __UNLOCK_IRQ(lock)
     76#define _spin_unlock_irqrestore(lock, flags)    __UNLOCK_IRQRESTORE(lock, flags)
     77#define _read_unlock_irqrestore(lock, flags)    __UNLOCK_IRQRESTORE(lock, flags)
     78#define _write_unlock_irqrestore(lock, flags)   __UNLOCK_IRQRESTORE(lock, flags)
     79
     80#endif /* __LINUX_SPINLOCK_API_UP_H */
  • include/linux/spinlock.h

    diff -Naur aboot-0.9b.orig/include/linux/spinlock.h aboot-0.9b/include/linux/spinlock.h
    old new  
     1#ifndef __LINUX_SPINLOCK_H
     2#define __LINUX_SPINLOCK_H
     3
     4/*
     5 * include/linux/spinlock.h - generic spinlock/rwlock declarations
     6 *
     7 * here's the role of the various spinlock/rwlock related include files:
     8 *
     9 * on SMP builds:
     10 *
     11 *  asm/spinlock_types.h: contains the raw_spinlock_t/raw_rwlock_t and the
     12 *                        initializers
     13 *
     14 *  linux/spinlock_types.h:
     15 *                        defines the generic type and initializers
     16 *
     17 *  asm/spinlock.h:       contains the __raw_spin_*()/etc. lowlevel
     18 *                        implementations, mostly inline assembly code
     19 *
     20 *   (also included on UP-debug builds:)
     21 *
     22 *  linux/spinlock_api_smp.h:
     23 *                        contains the prototypes for the _spin_*() APIs.
     24 *
     25 *  linux/spinlock.h:     builds the final spin_*() APIs.
     26 *
     27 * on UP builds:
     28 *
     29 *  linux/spinlock_type_up.h:
     30 *                        contains the generic, simplified UP spinlock type.
     31 *                        (which is an empty structure on non-debug builds)
     32 *
     33 *  linux/spinlock_types.h:
     34 *                        defines the generic type and initializers
     35 *
     36 *  linux/spinlock_up.h:
     37 *                        contains the __raw_spin_*()/etc. version of UP
     38 *                        builds. (which are NOPs on non-debug, non-preempt
     39 *                        builds)
     40 *
     41 *   (included on UP-non-debug builds:)
     42 *
     43 *  linux/spinlock_api_up.h:
     44 *                        builds the _spin_*() APIs.
     45 *
     46 *  linux/spinlock.h:     builds the final spin_*() APIs.
     47 */
     48
     49#include <linux/config.h>
     50#include <linux/preempt.h>
     51#include <linux/linkage.h>
     52#include <linux/compiler.h>
     53#include <linux/thread_info.h>
     54#include <linux/kernel.h>
     55#include <linux/stringify.h>
     56
     57#include <asm/system.h>
     58
     59/*
     60 * Must define these before including other files, inline functions need them
     61 */
     62#define LOCK_SECTION_NAME ".text.lock."KBUILD_BASENAME
     63
     64#define LOCK_SECTION_START(extra)               \
     65        ".subsection 1\n\t"                     \
     66        extra                                   \
     67        ".ifndef " LOCK_SECTION_NAME "\n\t"     \
     68        LOCK_SECTION_NAME ":\n\t"               \
     69        ".endif\n"
     70
     71#define LOCK_SECTION_END                        \
     72        ".previous\n\t"
     73
     74#define __lockfunc fastcall __attribute__((section(".spinlock.text")))
     75
     76/*
     77 * Pull the raw_spinlock_t and raw_rwlock_t definitions:
     78 */
     79#include <linux/spinlock_types.h>
     80
     81extern int __lockfunc generic__raw_read_trylock(raw_rwlock_t *lock);
     82
     83/*
     84 * Pull the __raw*() functions/declarations (UP-nondebug doesnt need them):
     85 */
     86#if defined(CONFIG_SMP)
     87# include <asm/spinlock.h>
     88#else
     89# include <linux/spinlock_up.h>
     90#endif
     91
     92#define spin_lock_init(lock)    do { *(lock) = SPIN_LOCK_UNLOCKED; } while (0)
     93#define rwlock_init(lock)       do { *(lock) = RW_LOCK_UNLOCKED; } while (0)
     94
     95#define spin_is_locked(lock)    __raw_spin_is_locked(&(lock)->raw_lock)
     96
     97/**
     98 * spin_unlock_wait - wait until the spinlock gets unlocked
     99 * @lock: the spinlock in question.
     100 */
     101#define spin_unlock_wait(lock)  __raw_spin_unlock_wait(&(lock)->raw_lock)
     102
     103/*
     104 * Pull the _spin_*()/_read_*()/_write_*() functions/declarations:
     105 */
     106#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
     107# include <linux/spinlock_api_smp.h>
     108#else
     109# include <linux/spinlock_api_up.h>
     110#endif
     111
     112#ifdef CONFIG_DEBUG_SPINLOCK
     113 extern void _raw_spin_lock(spinlock_t *lock);
     114#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock)
     115 extern int _raw_spin_trylock(spinlock_t *lock);
     116 extern void _raw_spin_unlock(spinlock_t *lock);
     117
     118 extern void _raw_read_lock(rwlock_t *lock);
     119 extern int _raw_read_trylock(rwlock_t *lock);
     120 extern void _raw_read_unlock(rwlock_t *lock);
     121 extern void _raw_write_lock(rwlock_t *lock);
     122 extern int _raw_write_trylock(rwlock_t *lock);
     123 extern void _raw_write_unlock(rwlock_t *lock);
     124#else
     125# define _raw_spin_unlock(lock)         __raw_spin_unlock(&(lock)->raw_lock)
     126# define _raw_spin_trylock(lock)        __raw_spin_trylock(&(lock)->raw_lock)
     127# define _raw_spin_lock(lock)           __raw_spin_lock(&(lock)->raw_lock)
     128# define _raw_spin_lock_flags(lock, flags) \
     129                __raw_spin_lock_flags(&(lock)->raw_lock, *(flags))
     130# define _raw_read_lock(rwlock)         __raw_read_lock(&(rwlock)->raw_lock)
     131# define _raw_write_lock(rwlock)        __raw_write_lock(&(rwlock)->raw_lock)
     132# define _raw_read_unlock(rwlock)       __raw_read_unlock(&(rwlock)->raw_lock)
     133# define _raw_write_unlock(rwlock)      __raw_write_unlock(&(rwlock)->raw_lock)
     134# define _raw_read_trylock(rwlock)      __raw_read_trylock(&(rwlock)->raw_lock)
     135# define _raw_write_trylock(rwlock)     __raw_write_trylock(&(rwlock)->raw_lock)
     136#endif
     137
     138#define read_can_lock(rwlock)           __raw_read_can_lock(&(rwlock)->raw_lock)
     139#define write_can_lock(rwlock)          __raw_write_can_lock(&(rwlock)->raw_lock)
     140
     141/*
     142 * Define the various spin_lock and rw_lock methods.  Note we define these
     143 * regardless of whether CONFIG_SMP or CONFIG_PREEMPT are set. The various
     144 * methods are defined as nops in the case they are not required.
     145 */
     146#define spin_trylock(lock)              __cond_lock(_spin_trylock(lock))
     147#define read_trylock(lock)              __cond_lock(_read_trylock(lock))
     148#define write_trylock(lock)             __cond_lock(_write_trylock(lock))
     149
     150#define spin_lock(lock)                 _spin_lock(lock)
     151#define write_lock(lock)                _write_lock(lock)
     152#define read_lock(lock)                 _read_lock(lock)
     153
     154#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
     155#define spin_lock_irqsave(lock, flags)  flags = _spin_lock_irqsave(lock)
     156#define read_lock_irqsave(lock, flags)  flags = _read_lock_irqsave(lock)
     157#define write_lock_irqsave(lock, flags) flags = _write_lock_irqsave(lock)
     158#else
     159#define spin_lock_irqsave(lock, flags)  _spin_lock_irqsave(lock, flags)
     160#define read_lock_irqsave(lock, flags)  _read_lock_irqsave(lock, flags)
     161#define write_lock_irqsave(lock, flags) _write_lock_irqsave(lock, flags)
     162#endif
     163
     164#define spin_lock_irq(lock)             _spin_lock_irq(lock)
     165#define spin_lock_bh(lock)              _spin_lock_bh(lock)
     166
     167#define read_lock_irq(lock)             _read_lock_irq(lock)
     168#define read_lock_bh(lock)              _read_lock_bh(lock)
     169
     170#define write_lock_irq(lock)            _write_lock_irq(lock)
     171#define write_lock_bh(lock)             _write_lock_bh(lock)
     172
     173/*
     174 * We inline the unlock functions in the nondebug case:
     175 */
     176#if defined(CONFIG_DEBUG_SPINLOCK) || defined(CONFIG_PREEMPT) || !defined(CONFIG_SMP)
     177# define spin_unlock(lock)              _spin_unlock(lock)
     178# define read_unlock(lock)              _read_unlock(lock)
     179# define write_unlock(lock)             _write_unlock(lock)
     180#else
     181# define spin_unlock(lock)              __raw_spin_unlock(&(lock)->raw_lock)
     182# define read_unlock(lock)              __raw_read_unlock(&(lock)->raw_lock)
     183# define write_unlock(lock)             __raw_write_unlock(&(lock)->raw_lock)
     184#endif
     185
     186#if defined(CONFIG_DEBUG_SPINLOCK) || defined(CONFIG_PREEMPT) || !defined(CONFIG_SMP)
     187# define spin_unlock_irq(lock)          _spin_unlock_irq(lock)
     188# define read_unlock_irq(lock)          _read_unlock_irq(lock)
     189# define write_unlock_irq(lock)         _write_unlock_irq(lock)
     190#else
     191# define spin_unlock_irq(lock) \
     192    do { __raw_spin_unlock(&(lock)->raw_lock); local_irq_enable(); } while (0)
     193# define read_unlock_irq(lock) \
     194    do { __raw_read_unlock(&(lock)->raw_lock); local_irq_enable(); } while (0)
     195# define write_unlock_irq(lock) \
     196    do { __raw_write_unlock(&(lock)->raw_lock); local_irq_enable(); } while (0)
     197#endif
     198
     199#define spin_unlock_irqrestore(lock, flags) \
     200                                        _spin_unlock_irqrestore(lock, flags)
     201#define spin_unlock_bh(lock)            _spin_unlock_bh(lock)
     202
     203#define read_unlock_irqrestore(lock, flags) \
     204                                        _read_unlock_irqrestore(lock, flags)
     205#define read_unlock_bh(lock)            _read_unlock_bh(lock)
     206
     207#define write_unlock_irqrestore(lock, flags) \
     208                                        _write_unlock_irqrestore(lock, flags)
     209#define write_unlock_bh(lock)           _write_unlock_bh(lock)
     210
     211#define spin_trylock_bh(lock)           __cond_lock(_spin_trylock_bh(lock))
     212
     213#define spin_trylock_irq(lock) \
     214({ \
     215        local_irq_disable(); \
     216        _spin_trylock(lock) ? \
     217        1 : ({ local_irq_enable(); 0;  }); \
     218})
     219
     220#define spin_trylock_irqsave(lock, flags) \
     221({ \
     222        local_irq_save(flags); \
     223        _spin_trylock(lock) ? \
     224        1 : ({ local_irq_restore(flags); 0; }); \
     225})
     226
     227/*
     228 * Pull the atomic_t declaration:
     229 * (asm-mips/atomic.h needs above definitions)
     230 */
     231#include <asm/atomic.h>
     232/**
     233 * atomic_dec_and_lock - lock on reaching reference count zero
     234 * @atomic: the atomic counter
     235 * @lock: the spinlock in question
     236 */
     237extern int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock);
     238#define atomic_dec_and_lock(atomic, lock) \
     239                __cond_lock(_atomic_dec_and_lock(atomic, lock))
     240
     241/**
     242 * spin_can_lock - would spin_trylock() succeed?
     243 * @lock: the spinlock in question.
     244 */
     245#define spin_can_lock(lock)     (!spin_is_locked(lock))
     246
     247#endif /* __LINUX_SPINLOCK_H */
  • include/linux/spinlock_types.h

    diff -Naur aboot-0.9b.orig/include/linux/spinlock_types.h aboot-0.9b/include/linux/spinlock_types.h
    old new  
     1#ifndef __LINUX_SPINLOCK_TYPES_H
     2#define __LINUX_SPINLOCK_TYPES_H
     3
     4/*
     5 * include/linux/spinlock_types.h - generic spinlock type definitions
     6 *                                  and initializers
     7 *
     8 * portions Copyright 2005, Red Hat, Inc., Ingo Molnar
     9 * Released under the General Public License (GPL).
     10 */
     11
     12#if defined(CONFIG_SMP)
     13# include <asm/spinlock_types.h>
     14#else
     15# include <linux/spinlock_types_up.h>
     16#endif
     17
     18typedef struct {
     19        raw_spinlock_t raw_lock;
     20#if defined(CONFIG_PREEMPT) && defined(CONFIG_SMP)
     21        unsigned int break_lock;
     22#endif
     23#ifdef CONFIG_DEBUG_SPINLOCK
     24        unsigned int magic, owner_cpu;
     25        void *owner;
     26#endif
     27} spinlock_t;
     28
     29#define SPINLOCK_MAGIC          0xdead4ead
     30
     31typedef struct {
     32        raw_rwlock_t raw_lock;
     33#if defined(CONFIG_PREEMPT) && defined(CONFIG_SMP)
     34        unsigned int break_lock;
     35#endif
     36#ifdef CONFIG_DEBUG_SPINLOCK
     37        unsigned int magic, owner_cpu;
     38        void *owner;
     39#endif
     40} rwlock_t;
     41
     42#define RWLOCK_MAGIC            0xdeaf1eed
     43
     44#define SPINLOCK_OWNER_INIT     ((void *)-1L)
     45
     46#ifdef CONFIG_DEBUG_SPINLOCK
     47# define SPIN_LOCK_UNLOCKED                                             \
     48        (spinlock_t)    {       .raw_lock = __RAW_SPIN_LOCK_UNLOCKED,   \
     49                                .magic = SPINLOCK_MAGIC,                \
     50                                .owner = SPINLOCK_OWNER_INIT,           \
     51                                .owner_cpu = -1 }
     52#define RW_LOCK_UNLOCKED                                                \
     53        (rwlock_t)      {       .raw_lock = __RAW_RW_LOCK_UNLOCKED,     \
     54                                .magic = RWLOCK_MAGIC,                  \
     55                                .owner = SPINLOCK_OWNER_INIT,           \
     56                                .owner_cpu = -1 }
     57#else
     58# define SPIN_LOCK_UNLOCKED \
     59        (spinlock_t)    {       .raw_lock = __RAW_SPIN_LOCK_UNLOCKED }
     60#define RW_LOCK_UNLOCKED \
     61        (rwlock_t)      {       .raw_lock = __RAW_RW_LOCK_UNLOCKED }
     62#endif
     63
     64#define DEFINE_SPINLOCK(x)      spinlock_t x = SPIN_LOCK_UNLOCKED
     65#define DEFINE_RWLOCK(x)        rwlock_t x = RW_LOCK_UNLOCKED
     66
     67#endif /* __LINUX_SPINLOCK_TYPES_H */
  • include/linux/spinlock_types_up.h

    diff -Naur aboot-0.9b.orig/include/linux/spinlock_types_up.h aboot-0.9b/include/linux/spinlock_types_up.h
    old new  
     1#ifndef __LINUX_SPINLOCK_TYPES_UP_H
     2#define __LINUX_SPINLOCK_TYPES_UP_H
     3
     4#ifndef __LINUX_SPINLOCK_TYPES_H
     5# error "please don't include this file directly"
     6#endif
     7
     8/*
     9 * include/linux/spinlock_types_up.h - spinlock type definitions for UP
     10 *
     11 * portions Copyright 2005, Red Hat, Inc., Ingo Molnar
     12 * Released under the General Public License (GPL).
     13 */
     14
     15#ifdef CONFIG_DEBUG_SPINLOCK
     16
     17typedef struct {
     18        volatile unsigned int slock;
     19} raw_spinlock_t;
     20
     21#define __RAW_SPIN_LOCK_UNLOCKED { 1 }
     22
     23#else
     24
     25typedef struct { } raw_spinlock_t;
     26
     27#define __RAW_SPIN_LOCK_UNLOCKED { }
     28
     29#endif
     30
     31typedef struct {
     32        /* no debug version on UP */
     33} raw_rwlock_t;
     34
     35#define __RAW_RW_LOCK_UNLOCKED { }
     36
     37#endif /* __LINUX_SPINLOCK_TYPES_UP_H */
  • include/linux/spinlock_up.h

    diff -Naur aboot-0.9b.orig/include/linux/spinlock_up.h aboot-0.9b/include/linux/spinlock_up.h
    old new  
     1#ifndef __LINUX_SPINLOCK_UP_H
     2#define __LINUX_SPINLOCK_UP_H
     3
     4#ifndef __LINUX_SPINLOCK_H
     5# error "please don't include this file directly"
     6#endif
     7
     8/*
     9 * include/linux/spinlock_up.h - UP-debug version of spinlocks.
     10 *
     11 * portions Copyright 2005, Red Hat, Inc., Ingo Molnar
     12 * Released under the General Public License (GPL).
     13 *
     14 * In the debug case, 1 means unlocked, 0 means locked. (the values
     15 * are inverted, to catch initialization bugs)
     16 *
     17 * No atomicity anywhere, we are on UP.
     18 */
     19
     20#ifdef CONFIG_DEBUG_SPINLOCK
     21
     22#define __raw_spin_is_locked(x)         ((x)->slock == 0)
     23
     24static inline void __raw_spin_lock(raw_spinlock_t *lock)
     25{
     26        lock->slock = 0;
     27}
     28
     29static inline void
     30__raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long flags)
     31{
     32        local_irq_save(flags);
     33        lock->slock = 0;
     34}
     35
     36static inline int __raw_spin_trylock(raw_spinlock_t *lock)
     37{
     38        char oldval = lock->slock;
     39
     40        lock->slock = 0;
     41
     42        return oldval > 0;
     43}
     44
     45static inline void __raw_spin_unlock(raw_spinlock_t *lock)
     46{
     47        lock->slock = 1;
     48}
     49
     50/*
     51 * Read-write spinlocks. No debug version.
     52 */
     53#define __raw_read_lock(lock)           do { (void)(lock); } while (0)
     54#define __raw_write_lock(lock)          do { (void)(lock); } while (0)
     55#define __raw_read_trylock(lock)        ({ (void)(lock); 1; })
     56#define __raw_write_trylock(lock)       ({ (void)(lock); 1; })
     57#define __raw_read_unlock(lock)         do { (void)(lock); } while (0)
     58#define __raw_write_unlock(lock)        do { (void)(lock); } while (0)
     59
     60#else /* DEBUG_SPINLOCK */
     61#define __raw_spin_is_locked(lock)      ((void)(lock), 0)
     62/* for sched.c and kernel_lock.c: */
     63# define __raw_spin_lock(lock)          do { (void)(lock); } while (0)
     64# define __raw_spin_unlock(lock)        do { (void)(lock); } while (0)
     65# define __raw_spin_trylock(lock)       ({ (void)(lock); 1; })
     66#endif /* DEBUG_SPINLOCK */
     67
     68#define __raw_read_can_lock(lock)       (((void)(lock), 1))
     69#define __raw_write_can_lock(lock)      (((void)(lock), 1))
     70
     71#define __raw_spin_unlock_wait(lock) \
     72                do { cpu_relax(); } while (__raw_spin_is_locked(lock))
     73
     74#endif /* __LINUX_SPINLOCK_UP_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_ */
  • include/linux/thread_info.h

    diff -Naur aboot-0.9b.orig/include/linux/thread_info.h aboot-0.9b/include/linux/thread_info.h
    old new  
     1/* thread_info.h: common low-level thread information accessors
     2 *
     3 * Copyright (C) 2002  David Howells (dhowells@redhat.com)
     4 * - Incorporating suggestions made by Linus Torvalds
     5 */
     6
     7#ifndef _LINUX_THREAD_INFO_H
     8#define _LINUX_THREAD_INFO_H
     9
     10/*
     11 * System call restart block.
     12 */
     13struct restart_block {
     14        long (*fn)(struct restart_block *);
     15        unsigned long arg0, arg1, arg2, arg3;
     16};
     17
     18extern long do_no_restart_syscall(struct restart_block *parm);
     19
     20#include <linux/bitops.h>
     21#include <asm/thread_info.h>
     22
     23#ifdef __KERNEL__
     24
     25/*
     26 * flag set/clear/test wrappers
     27 * - pass TIF_xxxx constants to these functions
     28 */
     29
     30static inline void set_ti_thread_flag(struct thread_info *ti, int flag)
     31{
     32        set_bit(flag,&ti->flags);
     33}
     34
     35static inline void clear_ti_thread_flag(struct thread_info *ti, int flag)
     36{
     37        clear_bit(flag,&ti->flags);
     38}
     39
     40static inline int test_and_set_ti_thread_flag(struct thread_info *ti, int flag)
     41{
     42        return test_and_set_bit(flag,&ti->flags);
     43}
     44
     45static inline int test_and_clear_ti_thread_flag(struct thread_info *ti, int flag)
     46{
     47        return test_and_clear_bit(flag,&ti->flags);
     48}
     49
     50static inline int test_ti_thread_flag(struct thread_info *ti, int flag)
     51{
     52        return test_bit(flag,&ti->flags);
     53}
     54
     55#define set_thread_flag(flag) \
     56        set_ti_thread_flag(current_thread_info(), flag)
     57#define clear_thread_flag(flag) \
     58        clear_ti_thread_flag(current_thread_info(), flag)
     59#define test_and_set_thread_flag(flag) \
     60        test_and_set_ti_thread_flag(current_thread_info(), flag)
     61#define test_and_clear_thread_flag(flag) \
     62        test_and_clear_ti_thread_flag(current_thread_info(), flag)
     63#define test_thread_flag(flag) \
     64        test_ti_thread_flag(current_thread_info(), flag)
     65
     66#define set_need_resched()      set_thread_flag(TIF_NEED_RESCHED)
     67#define clear_need_resched()    clear_thread_flag(TIF_NEED_RESCHED)
     68
     69#endif
     70
     71#endif /* _LINUX_THREAD_INFO_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;
  • aboot-0.9b

    diff -Naur aboot-0.9b.orig/Makefile aboot-0.9b/Makefile
    old new  
    2323root            =
    2424bindir          = $(root)/sbin
    2525bootdir         = $(root)/boot
    26 mandir          = /usr/man
     26mandir          = $(root)/usr/man
    2727
    2828#
    2929# There shouldn't be any need to change anything below this line.
     
    8282        tools/objstrip -vb aboot bootlx
    8383
    8484install-man:
    85         make -C doc/man install
     85        $(MAKE) -C doc/man install
    8686
    8787install-man-gz:
    88         make -C doc/man install-gz
     88        $(MAKE) -C doc/man install-gz
    8989
    9090install: tools/abootconf tools/e2writeboot tools/isomarkboot \
    9191        sdisklabel/swriteboot install-man
     
    128128        find . -name \*~ | xargs rm -f
    129129
    130130lib/%:
    131         make -C lib $* CPPFLAGS="$(CPPFLAGS)" TESTING="$(TESTING)"
     131        $(MAKE) -C lib $* CPPFLAGS="$(CPPFLAGS)" TESTING="$(TESTING)"
    132132
    133133tools/%:
    134         make -C tools $* CPPFLAGS="$(CPPFLAGS)"
     134        $(MAKE) -C tools $* CPPFLAGS="$(CPPFLAGS)"
    135135
    136136sdisklabel/%:
    137         make -C sdisklabel $* CPPFLAGS="$(CPPFLAGS)"
     137        $(MAKE) -C sdisklabel $* CPPFLAGS="$(CPPFLAGS)"
    138138
    139139vmlinux.nh: $(VMLINUX) tools/objstrip
    140140        tools/objstrip -vb $(VMLINUX) vmlinux.nh
  • sdisklabel/Makefile

    diff -Naur aboot-0.9b.orig/sdisklabel/Makefile aboot-0.9b/sdisklabel/Makefile
    old new  
    1 CC = gcc -O2
     1HOST_CC = gcc -O2
    22CFLAGS= -I../include $(CPPFLAGS) -Wall
    33
    44all:    sdisklabel swriteboot
    55
     6%.o: %.c
     7        $(HOST_CC) $(CFLAGS) -c $< -o $@
     8
    69sdisklabel: sdisklabel.o library.o
    7         $(CC) $(LDFLAGS) sdisklabel.o library.o -o sdisklabel
     10        $(HOST_CC) $(LDFLAGS) sdisklabel.o library.o -o sdisklabel
    811
    912swriteboot: swriteboot.o library.o
    10         $(CC) $(LDFLAGS) swriteboot.o library.o -o swriteboot
     13        $(HOST_CC) $(LDFLAGS) swriteboot.o library.o -o swriteboot
    1114
    1215clean:
    1316        rm -f sdisklabel swriteboot *.o
  • tools/Makefile

    diff -Naur aboot-0.9b.orig/tools/Makefile aboot-0.9b/tools/Makefile
    old new  
    1 CC      = gcc
     1HOST_CC = gcc
    22CFLAGS  = -g -O2 -Wall -I. -I../include $(CPPFLAGS)
    33LDFLAGS = -g
    44PGMS    = e2writeboot isomarkboot abootconf elfencap objstrip
    55
    6 EXEC_PREFIX = /usr
     6EXEC_PREFIX = $(root)/usr
    77
    8 all:    $(PGMS)
     8all: $(PGMS)
    99
    10 install:        $(PGMS)
    11         install -s -c -o root -g root -m 755 $(PGMS) $(EXEC_PREFIX)/bin
     10install: $(PGMS)
     11        install -s -c -m 755 $(PGMS) $(EXEC_PREFIX)/bin
    1212
    1313clean:
    1414        rm -f *~ *.o *.a core $(PGMS)
    1515
    16 isomarkboot:    isomarkboot.o ../lib/isolib.o
    17 e2writeboot:    e2writeboot.o e2lib.o bio.o
     16isolib.o: ../lib/isolib.c
     17        $(HOST_CC) $(CFLAGS) -c $< -o $@
    1818
    19 e2writeboot.o:  e2lib.h
     19%.o: %.c
     20        $(HOST_CC) $(CFLAGS) -c $< -o $@
     21
     22e2writeboot.o:  e2lib.h
    2023e2lib.o: e2lib.h
     24
     25e2writeboot: e2writeboot.o e2lib.o bio.o
     26        $(HOST_CC) $(LDFLAGS) e2writeboot.o e2lib.o bio.o -o $@
     27
     28isomarkboot: isomarkboot.o isolib.o
     29        $(HOST_CC) $(LDFLAGS) isomarkboot.o isolib.o -o $@
     30
     31abootconf elfencap objstrip: $(@:%=%.c)
     32        $(HOST_CC) $(CFLAGS) $(LDFLAGS) $(@:%=%.c) -o $@
  • tools/Makefile.orig

    diff -Naur aboot-0.9b.orig/tools/Makefile.orig aboot-0.9b/tools/Makefile.orig
    old new  
     1CC      = gcc
     2CFLAGS  = -g -O2 -Wall -I. -I../include $(CPPFLAGS)
     3LDFLAGS = -g
     4PGMS    = e2writeboot isomarkboot abootconf elfencap objstrip
     5
     6EXEC_PREFIX = /usr
     7
     8all:    $(PGMS)
     9
     10install:        $(PGMS)
     11        install -s -c -o root -g root -m 755 $(PGMS) $(EXEC_PREFIX)/bin
     12
     13clean:
     14        rm -f *~ *.o *.a core $(PGMS)
     15
     16isomarkboot:    isomarkboot.o ../lib/isolib.o
     17e2writeboot:    e2writeboot.o e2lib.o bio.o
     18
     19e2writeboot.o:  e2lib.h
     20e2lib.o: e2lib.h
  • tools/objstrip.c

    diff -Naur aboot-0.9b.orig/tools/objstrip.c aboot-0.9b/tools/objstrip.c
    old new  
    77 */
    88/*
    99 * Converts an ECOFF or ELF object file into a bootable file.  The
    10  * object file must be a OMAGIC file (i.e., data and bss follow immediatly
     10 * object file must be a OMAGIC file (i.e., data and bss follow immediately
    1111 * behind the text).  See DEC "Assembly Language Programmer's Guide"
    1212 * documentation for details.  The SRM boot process is documented in
    1313 * the Alpha AXP Architecture Reference Manual, Second Edition by
    1414 * Richard L. Sites and Richard T. Witek.
    1515 */
    16 #include <stdlib.h>
    1716#include <stdio.h>
     17#include <string.h>
     18#include <stdlib.h>
    1819#include <unistd.h>
     20#include <string.h>
    1921
    2022#include <sys/fcntl.h>
    2123#include <sys/stat.h>
     
    2426#include <linux/a.out.h>
    2527#include <linux/coff.h>
    2628#include <linux/param.h>
    27 #include <string.h>
    28 
    2929#ifdef __ELF__
    30 # include <asm/elf.h>
    3130# include <linux/elf.h>
    32 # include <linux/version.h>
    33 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
    34 #  define aboot_elf_check_arch(e)        elf_check_arch(e)
    35 # else
    36 #  define aboot_elf_check_arch(e)        elf_check_arch(e->e_machine)
    37 # endif
    3831#endif
    3932
    4033/* bootfile size must be multiple of BLOCK_SIZE: */
     
    6255    struct exec * aout;         /* includes file & aout header */
    6356    long offset;
    6457#ifdef __ELF__
    65     struct elfhdr *elf;
    66     struct elf_phdr *elf_phdr;  /* program header */
     58    Elf64_Ehdr *elf;
     59    Elf64_Phdr *elf_phdr;       /* program header */
    6760    unsigned long long e_entry;
    6861#endif
    6962
     
    150143    }
    151144
    152145#ifdef __ELF__
    153     elf = (struct elfhdr *) buf;
     146    elf = (Elf64_Ehdr *) buf;
    154147
    155     if (elf->e_ident[0] == 0x7f && strncmp(elf->e_ident + 1, "ELF", 3) == 0) {
     148    if (elf->e_ident[0] == 0x7f && strncmp((char *)elf->e_ident + 1, "ELF", 3) == 0) {
    156149        if (elf->e_type != ET_EXEC) {
    157150            fprintf(stderr, "%s: %s is not an ELF executable\n",
    158151                    prog_name, inname);
    159152            exit(1);
    160153        }
    161         if (!aboot_elf_check_arch(elf)) {
    162             fprintf(stderr, "%s: is not for this processor (e_machine=%d)\n",
    163                     prog_name, elf->e_machine);
    164             exit(1);
    165         }
    166154        if (elf->e_phnum != 1) {
    167155            fprintf(stderr,
    168156                    "%s: %d program headers (forgot to link with -N?)\n",
     
    177165            exit(1);
    178166        }
    179167
    180         elf_phdr = (struct elf_phdr *) buf;
     168        elf_phdr = (Elf64_Phdr *) buf;
    181169        offset   = elf_phdr->p_offset;
    182170        mem_size = elf_phdr->p_memsz;
    183171        fil_size = elf_phdr->p_filesz;
Note: See TracBrowser for help on using the repository browser.