source: patches/aboot-0.9b-fixes-5.patch @ 2d023743

clfs-3.0.0-systemdclfs-3.0.0-sysvinitsystemdsysvinit
Last change on this file since 2d023743 was af04f13, checked in by Joe Ciccone <jciccone@…>, 16 years ago

Forgot patch in last commit.

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

    Submitted By: Joe Ciccone <jciccone@gmail.com>
    Date: 2007-01-01
    Initial Package Version: 0.9b
    Upstream Status: NONE
    Origin: Joe Ciccone
    Description: This patch fixes compilation issues with by creating a basic set
                 of kernel headers as well as a few changes that needed to be made
                 to the code so that it compiles with more modern compilers. A
                 common makefile with variables was also added.
    
    diff -Naur aboot-0.9b.orig/Makefile aboot-0.9b/Makefile
    old new  
    88# Copyright (c) 1995, 1996 by David Mosberger (davidm@cs.arizona.edu)
    99#
    1010
    11 # location of linux kernel sources (must be absolute path):
    12 KSRC            = /usr/src/linux
    13 VMLINUX         = $(KSRC)/vmlinux
    14 VMLINUXGZ       = $(KSRC)/arch/alpha/boot/vmlinux.gz
     11include Makefile.inc
    1512
    1613# for userspace testing
    1714#TESTING        = yes
     
    1916# for boot testing
    2017#CFGDEFS        = -DDEBUG_ISO -DDEBUG_ROCK -DDEBUG
    2118
    22 # root, aka prefix
    23 root            =
    24 bindir          = $(root)/sbin
    25 bootdir         = $(root)/boot
    26 mandir          = /usr/man
    27 
    2819#
    2920# There shouldn't be any need to change anything below this line.
    3021#
     
    3223
    3324ABOOT_LDFLAGS = -static -N -Taboot.lds
    3425
    35 CC              = gcc
    3626TOP             = $(shell pwd)
    3727ifeq ($(TESTING),)
    38 CPPFLAGS        = $(CFGDEFS) -I$(TOP)/include -I$(KSRC)/include
     28CPPFLAGS        = $(CFGDEFS) -I$(TOP)/include
    3929CFLAGS          = $(CPPFLAGS) -D__KERNEL__ -mcpu=ev4 -Os -Wall -fno-builtin -mno-fp-regs -ffixed-8
    4030else
    41 CPPFLAGS        = -DTESTING $(CFGDEFS) -I$(TOP)/include -I$(KSRC)/include
     31CPPFLAGS        = -DTESTING $(CFGDEFS)
    4232CFLAGS          = $(CPPFLAGS) -O -g3 -Wall -D__KERNEL__ -ffixed-8
    4333endif
    4434ASFLAGS         = $(CPPFLAGS)
     
    6656endif
    6757LIBS    = lib/libaboot.a
    6858
     59all: tools/all sdisklabel/all lib/libaboot.a all-local
     60
    6961ifeq ($(TESTING),)
    70 all:    diskboot
     62all-local: diskboot
    7163else
    72 all:    aboot
     64all-local: aboot
    7365endif
    7466
    7567diskboot:       bootlx sdisklabel/sdisklabel sdisklabel/swriteboot \
    7668                tools/e2writeboot tools/isomarkboot tools/abootconf \
    7769                tools/elfencap
    7870
    79 netboot: vmlinux.bootp
    80 
    8171bootlx: aboot tools/objstrip
    8272        tools/objstrip -vb aboot bootlx
    8373
    8474install-man:
    85         make -C doc/man install
     75        $(MAKE) -C doc/man install
    8676
    8777install-man-gz:
    88         make -C doc/man install-gz
     78        $(MAKE) -C doc/man install-gz
    8979
    90 install: tools/abootconf tools/e2writeboot tools/isomarkboot \
    91         sdisklabel/swriteboot install-man
    92         install -d $(bindir) $(bootdir)
    93         install -c -s tools/abootconf $(bindir)
    94         install -c -s tools/e2writeboot $(bindir)
    95         install -c -s tools/isomarkboot $(bindir)
    96         install -c -s sdisklabel/swriteboot $(bindir)
    97         install -c bootlx $(bootdir)
     80install: tools/abootconf tools/e2writeboot tools/isomarkboot sdisklabel/swriteboot install-man
     81        install -d $(DESTDIR)$(BINDIR) $(DESTDIR)$(BOOTDIR)
     82        install -c tools/abootconf $(DESTDIR)$(BINDIR)
     83        install -c tools/e2writeboot $(DESTDIR)$(BINDIR)
     84        install -c tools/isomarkboot $(DESTDIR)$(BINDIR)
     85        install -c sdisklabel/swriteboot $(DESTDIR)$(BINDIR)
     86        install -c bootlx $(DESTDIR)$(BOOTDIR)
    9887
    9988installondisk:  bootlx sdisklabel/swriteboot
    10089        sdisklabel/swriteboot -vf0 /dev/sda bootlx vmlinux.gz
     
    10796        $(CC) $(ABOOT_OBJS) $(DISK_OBJS) -o $@ $(LIBS)
    10897endif
    10998
    110 vmlinux.bootp: net_aboot.nh $(VMLINUXGZ) net_pad
    111         cat net_aboot.nh $(VMLINUXGZ) net_pad > $@
    112 
    11399net_aboot.nh: net_aboot tools/objstrip
    114100        tools/objstrip -vb net_aboot $@
    115101
     
    120106        dd if=/dev/zero of=$@ bs=512 count=1
    121107
    122108clean:  sdisklabel/clean tools/clean lib/clean
    123         rm -f aboot abootconf net_aboot net_aboot.nh net_pad vmlinux.bootp \
    124                 $(ABOOT_OBJS) $(DISK_OBJS) $(NET_OBJS) bootlx \
    125                 include/ksize.h vmlinux.nh
     109        rm -f aboot abootconf net_aboot net_aboot.nh net_pad \
     110                $(ABOOT_OBJS) $(DISK_OBJS) $(NET_OBJS) bootlx
    126111
    127112distclean: clean
    128113        find . -name \*~ | xargs rm -f
    129114
    130115lib/%:
    131         make -C lib $* CPPFLAGS="$(CPPFLAGS)" TESTING="$(TESTING)"
     116        $(MAKE) -C lib $* CPPFLAGS="$(CPPFLAGS)" TESTING="$(TESTING)"
    132117
    133118tools/%:
    134         make -C tools $* CPPFLAGS="$(CPPFLAGS)"
     119        $(MAKE) -C tools $* CPPFLAGS="$(CPPFLAGS)"
    135120
    136121sdisklabel/%:
    137         make -C sdisklabel $* CPPFLAGS="$(CPPFLAGS)"
    138 
    139 vmlinux.nh: $(VMLINUX) tools/objstrip
    140         tools/objstrip -vb $(VMLINUX) vmlinux.nh
    141 
    142 include/ksize.h: vmlinux.nh
    143         echo "#define KERNEL_SIZE `ls -l vmlinux.nh | awk '{print $$5}'` > $@
     122        $(MAKE) -C sdisklabel $* CPPFLAGS="$(CPPFLAGS)"
    144123
    145124dep:
  • Makefile.inc

    diff -Naur aboot-0.9b.orig/Makefile.inc aboot-0.9b/Makefile.inc
    old new  
     1DESTDIR         =
     2PREFIX          = /usr
     3EXEC_PREFIX     = $(PREFIX)
     4BINDIR          = /sbin
     5BOOTDIR         = /boot
     6MANDIR          = $(PREFIX)/man
     7MAN5            = $(MANDIR)/man5
     8MAN8            = $(MANDIR)/man8
     9
     10CROSS_COMPILE   =
     11
     12HOST_CC         = gcc
     13CC              = $(CROSS_COMPILE)gcc
     14AS              = $(CROSS_COMPILE)as
     15LD              = $(CROSS_COMPILE)ld
     16AR              = $(CROSS_COMPILE)ar
  • aboot-0.9b

    diff -Naur aboot-0.9b.orig/aboot.c aboot-0.9b/aboot.c
    old new  
    9090        elf  = (struct elfhdr *) buf;
    9191       
    9292        if (elf->e_ident[0] == 0x7f
    93             && strncmp(elf->e_ident + 1, "ELF", 3) == 0)
     93            && strncmp((char *)elf->e_ident + 1, "ELF", 3) == 0)
    9494        {
    9595                int i;
    9696                /* looks like an ELF binary: */
  • aboot-0.9b

    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...*/
     15//extern long int dispatch();   /* 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  
    121121        buf = malloc(bfs->blocksize);
    122122
    123123        /* read ELF headers: */
    124         nread = (*bfs->bread)(fd, 0, 1, buf);
     124        nread = (*bfs->bread)(fd, 0, 1, (char *)buf);
    125125        if (nread != bfs->blocksize) {
    126126                printf("aboot: read returned %ld instead of %ld bytes\n",
    127127                       nread, sizeof(buf));
     
    142142                }
    143143        }
    144144#endif
    145         if (first_block(buf, bfs->blocksize) < 0) {
     145        if (first_block((char *)buf, bfs->blocksize) < 0) {
    146146                return -1;
    147147        }
    148148
     
    481481                                        *d++ = *p;
    482482                                }
    483483                                break;
    484 
    485                               default:
    486484                        }
    487485                        p++;
    488486                }
  • doc/man/Makefile

    diff -Naur aboot-0.9b.orig/doc/man/Makefile aboot-0.9b/doc/man/Makefile
    old new  
    55# if this is a recursive make, and mandir was set in the top-level Makefile,
    66# use that value. Otherwise default to /usr/man.
    77
    8 ifeq ($(mandir),)
    9 MANDIR=/usr/man
    10 else
    11 MANDIR=$(mandir)
    12 endif
    13 MAN5=$(MANDIR)/man5
    14 MAN8=$(MANDIR)/man8
     8include ../../Makefile.inc
    159
    16 default:
     10all:
    1711
    1812install:
    19         install -d $(MAN5) $(MAN8)
    20         install -c aboot.conf.5 $(MAN5)
    21         install -c aboot.8 abootconf.8 e2writeboot.8 swriteboot.8 $(MAN8)       
    22 install-gz: install
    23         gzip -f9 $(MAN5)/aboot.conf.5
    24         gzip -f9 $(MAN8)/aboot.8 $(MAN8)/abootconf.8 $(MAN8)/e2writeboot.8 \
    25                  $(MAN8)/swriteboot.8
    26 install-gzip: install-gz
     13        install -d $(DESTDIR)$(MAN5) $(DESTDIR)$(MAN8)
     14        install -c aboot.conf.5 $(DESTDIR)$(MAN5)
     15        install -c aboot.8 abootconf.8 e2writeboot.8 swriteboot.8 $(DESTDIR)$(MAN8)     
     16
     17install-gz install-gzip: install
     18        gzip -f9 $(DESTDIR)$(MAN5)/aboot.conf.5
     19        gzip -f9 $(DESTDIR)$(MAN8)/aboot.8 $(DESTDIR)$(MAN8)/abootconf.8 $(DESTDIR)$(MAN8)/e2writeboot.8 \
     20                 $(DESTDIR)$(MAN8)/swriteboot.8
  • aboot-0.9b

    diff -Naur aboot-0.9b.orig/fs/ufs.c aboot-0.9b/fs/ufs.c
    old new  
    361361                return -1;
    362362        }
    363363
    364         component = strtok(namebuf, "/");
     364        component = strtok((char *)namebuf, "/");
    365365        while (component) {
    366366                /* verify that current node is a directory: */
    367367                if ((fp->i_mode & IFMT) != IFDIR) {
  • aboot-0.9b

    diff -Naur aboot-0.9b.orig/head.S aboot-0.9b/head.S
    old new  
    170170        mov     $16,$27
    171171        mov     $17,$30
    172172        jmp     $31,($27)
    173         .end run_kernel
    174  No newline at end of file
     173        .end run_kernel
     174
  • 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
     92#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/console.h

    diff -Naur aboot-0.9b.orig/include/asm/console.h aboot-0.9b/include/asm/console.h
    old new  
     1#ifndef __AXP_CONSOLE_H
     2#define __AXP_CONSOLE_H
     3
     4/*
     5 * Console callback routine numbers
     6 */
     7#define CCB_GETC                0x01
     8#define CCB_PUTS                0x02
     9#define CCB_RESET_TERM          0x03
     10#define CCB_SET_TERM_INT        0x04
     11#define CCB_SET_TERM_CTL        0x05
     12#define CCB_PROCESS_KEYCODE     0x06
     13#define CCB_OPEN_CONSOLE        0x07
     14#define CCB_CLOSE_CONSOLE       0x08
     15
     16#define CCB_OPEN                0x10
     17#define CCB_CLOSE               0x11
     18#define CCB_IOCTL               0x12
     19#define CCB_READ                0x13
     20#define CCB_WRITE               0x14
     21
     22#define CCB_SET_ENV             0x20
     23#define CCB_RESET_ENV           0x21
     24#define CCB_GET_ENV             0x22
     25#define CCB_SAVE_ENV            0x23
     26
     27#define CCB_PSWITCH             0x30
     28#define CCB_BIOS_EMUL           0x32
     29
     30/*
     31 * Environment variable numbers
     32 */
     33#define ENV_AUTO_ACTION         0x01
     34#define ENV_BOOT_DEV            0x02
     35#define ENV_BOOTDEF_DEV         0x03
     36#define ENV_BOOTED_DEV          0x04
     37#define ENV_BOOT_FILE           0x05
     38#define ENV_BOOTED_FILE         0x06
     39#define ENV_BOOT_OSFLAGS        0x07
     40#define ENV_BOOTED_OSFLAGS      0x08
     41#define ENV_BOOT_RESET          0x09
     42#define ENV_DUMP_DEV            0x0A
     43#define ENV_ENABLE_AUDIT        0x0B
     44#define ENV_LICENSE             0x0C
     45#define ENV_CHAR_SET            0x0D
     46#define ENV_LANGUAGE            0x0E
     47#define ENV_TTY_DEV             0x0F
     48
     49
     50#endif /* __AXP_CONSOLE_H */
  • include/asm/elf.h

    diff -Naur aboot-0.9b.orig/include/asm/elf.h aboot-0.9b/include/asm/elf.h
    old new  
     1#ifndef __ASM_ALPHA_ELF_H
     2#define __ASM_ALPHA_ELF_H
     3
     4#include <asm/auxvec.h>
     5
     6/* Special values for the st_other field in the symbol table.  */
     7
     8#define STO_ALPHA_NOPV          0x80
     9#define STO_ALPHA_STD_GPLOAD    0x88
     10
     11/*
     12 * Alpha ELF relocation types
     13 */
     14#define R_ALPHA_NONE            0       /* No reloc */
     15#define R_ALPHA_REFLONG         1       /* Direct 32 bit */
     16#define R_ALPHA_REFQUAD         2       /* Direct 64 bit */
     17#define R_ALPHA_GPREL32         3       /* GP relative 32 bit */
     18#define R_ALPHA_LITERAL         4       /* GP relative 16 bit w/optimization */
     19#define R_ALPHA_LITUSE          5       /* Optimization hint for LITERAL */
     20#define R_ALPHA_GPDISP          6       /* Add displacement to GP */
     21#define R_ALPHA_BRADDR          7       /* PC+4 relative 23 bit shifted */
     22#define R_ALPHA_HINT            8       /* PC+4 relative 16 bit shifted */
     23#define R_ALPHA_SREL16          9       /* PC relative 16 bit */
     24#define R_ALPHA_SREL32          10      /* PC relative 32 bit */
     25#define R_ALPHA_SREL64          11      /* PC relative 64 bit */
     26#define R_ALPHA_GPRELHIGH       17      /* GP relative 32 bit, high 16 bits */
     27#define R_ALPHA_GPRELLOW        18      /* GP relative 32 bit, low 16 bits */
     28#define R_ALPHA_GPREL16         19      /* GP relative 16 bit */
     29#define R_ALPHA_COPY            24      /* Copy symbol at runtime */
     30#define R_ALPHA_GLOB_DAT        25      /* Create GOT entry */
     31#define R_ALPHA_JMP_SLOT        26      /* Create PLT entry */
     32#define R_ALPHA_RELATIVE        27      /* Adjust by program base */
     33#define R_ALPHA_BRSGP           28
     34#define R_ALPHA_TLSGD           29
     35#define R_ALPHA_TLS_LDM         30
     36#define R_ALPHA_DTPMOD64        31
     37#define R_ALPHA_GOTDTPREL       32
     38#define R_ALPHA_DTPREL64        33
     39#define R_ALPHA_DTPRELHI        34
     40#define R_ALPHA_DTPRELLO        35
     41#define R_ALPHA_DTPREL16        36
     42#define R_ALPHA_GOTTPREL        37
     43#define R_ALPHA_TPREL64         38
     44#define R_ALPHA_TPRELHI         39
     45#define R_ALPHA_TPRELLO         40
     46#define R_ALPHA_TPREL16         41
     47
     48#define SHF_ALPHA_GPREL         0x10000000
     49
     50/* Legal values for e_flags field of Elf64_Ehdr.  */
     51
     52#define EF_ALPHA_32BIT          1       /* All addresses are below 2GB */
     53
     54/*
     55 * ELF register definitions..
     56 */
     57
     58/*
     59 * The OSF/1 version of <sys/procfs.h> makes gregset_t 46 entries long.
     60 * I have no idea why that is so.  For now, we just leave it at 33
     61 * (32 general regs + processor status word).
     62 */
     63#define ELF_NGREG       33
     64#define ELF_NFPREG      32
     65
     66typedef unsigned long elf_greg_t;
     67typedef elf_greg_t elf_gregset_t[ELF_NGREG];
     68
     69typedef double elf_fpreg_t;
     70typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
     71
     72/*
     73 * This is used to ensure we don't load something for the wrong architecture.
     74 */
     75#define elf_check_arch(x) ((x)->e_machine == EM_ALPHA)
     76
     77/*
     78 * These are used to set parameters in the core dumps.
     79 */
     80#define ELF_CLASS       ELFCLASS64
     81#define ELF_DATA        ELFDATA2LSB
     82#define ELF_ARCH        EM_ALPHA
     83
     84#define USE_ELF_CORE_DUMP
     85#define ELF_EXEC_PAGESIZE       8192
     86
     87/* This is the location that an ET_DYN program is loaded if exec'ed.  Typical
     88   use of this is to invoke "./ld.so someprog" to test out a new version of
     89   the loader.  We need to make sure that it is out of the way of the program
     90   that it will "exec", and that there is sufficient room for the brk.  */
     91
     92#define ELF_ET_DYN_BASE         (TASK_UNMAPPED_BASE + 0x1000000)
     93
     94/* $0 is set by ld.so to a pointer to a function which might be
     95   registered using atexit.  This provides a mean for the dynamic
     96   linker to call DT_FINI functions for shared libraries that have
     97   been loaded before the code runs.
     98
     99   So that we can use the same startup file with static executables,
     100   we start programs with a value of 0 to indicate that there is no
     101   such function.  */
     102
     103#define ELF_PLAT_INIT(_r, load_addr)    _r->r0 = 0
     104
     105/* The registers are layed out in pt_regs for PAL and syscall
     106   convenience.  Re-order them for the linear elf_gregset_t.  */
     107
     108struct pt_regs;
     109struct thread_info;
     110struct task_struct;
     111extern void dump_elf_thread(elf_greg_t *dest, struct pt_regs *pt,
     112                            struct thread_info *ti);
     113#define ELF_CORE_COPY_REGS(DEST, REGS) \
     114        dump_elf_thread(DEST, REGS, current_thread_info());
     115
     116/* Similar, but for a thread other than current.  */
     117
     118extern int dump_elf_task(elf_greg_t *dest, struct task_struct *task);
     119#define ELF_CORE_COPY_TASK_REGS(TASK, DEST) \
     120        dump_elf_task(*(DEST), TASK)
     121
     122/* Similar, but for the FP registers.  */
     123
     124extern int dump_elf_task_fp(elf_fpreg_t *dest, struct task_struct *task);
     125#define ELF_CORE_COPY_FPREGS(TASK, DEST) \
     126        dump_elf_task_fp(*(DEST), TASK)
     127
     128/* This yields a mask that user programs can use to figure out what
     129   instruction set this CPU supports.  This is trivial on Alpha,
     130   but not so on other machines. */
     131
     132#define ELF_HWCAP  (~amask(-1))
     133
     134/* This yields a string that ld.so will use to load implementation
     135   specific libraries for optimization.  This is more specific in
     136   intent than poking at uname or /proc/cpuinfo.  */
     137
     138#define ELF_PLATFORM                            \
     139({                                              \
     140        enum implver_enum i_ = implver();       \
     141        ( i_ == IMPLVER_EV4 ? "ev4"             \
     142        : i_ == IMPLVER_EV5                     \
     143          ? (amask(AMASK_BWX) ? "ev5" : "ev56") \
     144        : amask (AMASK_CIX) ? "ev6" : "ev67");  \
     145})
     146
     147#ifdef __KERNEL__
     148
     149#define SET_PERSONALITY(EX, IBCS2)                              \
     150        set_personality(((EX).e_flags & EF_ALPHA_32BIT)         \
     151           ? PER_LINUX_32BIT : (IBCS2) ? PER_SVR4 : PER_LINUX)
     152
     153extern int alpha_l1i_cacheshape;
     154extern int alpha_l1d_cacheshape;
     155extern int alpha_l2_cacheshape;
     156extern int alpha_l3_cacheshape;
     157
     158#define ARCH_DLINFO                                             \
     159  do {                                                          \
     160    NEW_AUX_ENT(AT_L1I_CACHESHAPE, alpha_l1i_cacheshape);       \
     161    NEW_AUX_ENT(AT_L1D_CACHESHAPE, alpha_l1d_cacheshape);       \
     162    NEW_AUX_ENT(AT_L2_CACHESHAPE, alpha_l2_cacheshape);         \
     163    NEW_AUX_ENT(AT_L3_CACHESHAPE, alpha_l3_cacheshape);         \
     164  } while (0)
     165
     166#endif /* __KERNEL__ */
     167#endif /* __ASM_ALPHA_ELF_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#ifdef __KERNEL__
     206
     207extern struct hwrpb_struct *hwrpb;
     208
     209static inline void
     210hwrpb_update_checksum(struct hwrpb_struct *h)
     211{
     212        unsigned long sum = 0, *l;
     213        for (l = (unsigned long *) h; l < (unsigned long *) &h->chksum; ++l)
     214                sum += *l;
     215        h->chksum = sum;
     216}
     217
     218#endif /* __KERNEL__ */
     219
     220#endif /* __ALPHA_HWRPB_H */
  • include/asm/ioctl.h

    diff -Naur aboot-0.9b.orig/include/asm/ioctl.h aboot-0.9b/include/asm/ioctl.h
    old new  
     1#ifndef _ALPHA_IOCTL_H
     2#define _ALPHA_IOCTL_H
     3
     4/*
     5 * The original linux ioctl numbering scheme was just a general
     6 * "anything goes" setup, where more or less random numbers were
     7 * assigned.  Sorry, I was clueless when I started out on this.
     8 *
     9 * On the alpha, we'll try to clean it up a bit, using a more sane
     10 * ioctl numbering, and also trying to be compatible with OSF/1 in
     11 * the process. I'd like to clean it up for the i386 as well, but
     12 * it's so painful recognizing both the new and the old numbers..
     13 */
     14
     15#define _IOC_NRBITS     8
     16#define _IOC_TYPEBITS   8
     17#define _IOC_SIZEBITS   13
     18#define _IOC_DIRBITS    3
     19
     20#define _IOC_NRMASK     ((1 << _IOC_NRBITS)-1)
     21#define _IOC_TYPEMASK   ((1 << _IOC_TYPEBITS)-1)
     22#define _IOC_SIZEMASK   ((1 << _IOC_SIZEBITS)-1)
     23#define _IOC_DIRMASK    ((1 << _IOC_DIRBITS)-1)
     24
     25#define _IOC_NRSHIFT    0
     26#define _IOC_TYPESHIFT  (_IOC_NRSHIFT+_IOC_NRBITS)
     27#define _IOC_SIZESHIFT  (_IOC_TYPESHIFT+_IOC_TYPEBITS)
     28#define _IOC_DIRSHIFT   (_IOC_SIZESHIFT+_IOC_SIZEBITS)
     29
     30/*
     31 * Direction bits _IOC_NONE could be 0, but OSF/1 gives it a bit.
     32 * And this turns out useful to catch old ioctl numbers in header
     33 * files for us.
     34 */
     35#define _IOC_NONE       1U
     36#define _IOC_READ       2U
     37#define _IOC_WRITE      4U
     38
     39#define _IOC(dir,type,nr,size)                  \
     40        ((unsigned int)                         \
     41         (((dir)  << _IOC_DIRSHIFT) |           \
     42          ((type) << _IOC_TYPESHIFT) |          \
     43          ((nr)   << _IOC_NRSHIFT) |            \
     44          ((size) << _IOC_SIZESHIFT)))
     45
     46/* used to create numbers */
     47#define _IO(type,nr)            _IOC(_IOC_NONE,(type),(nr),0)
     48#define _IOR(type,nr,size)      _IOC(_IOC_READ,(type),(nr),sizeof(size))
     49#define _IOW(type,nr,size)      _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
     50#define _IOWR(type,nr,size)     _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
     51
     52/* used to decode them.. */
     53#define _IOC_DIR(nr)            (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
     54#define _IOC_TYPE(nr)           (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
     55#define _IOC_NR(nr)             (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
     56#define _IOC_SIZE(nr)           (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
     57
     58/* ...and for the drivers/sound files... */
     59
     60#define IOC_IN          (_IOC_WRITE << _IOC_DIRSHIFT)
     61#define IOC_OUT         (_IOC_READ << _IOC_DIRSHIFT)
     62#define IOC_INOUT       ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
     63#define IOCSIZE_MASK    (_IOC_SIZEMASK << _IOC_SIZESHIFT)
     64#define IOCSIZE_SHIFT   (_IOC_SIZESHIFT)
     65
     66#endif /* _ALPHA_IOCTL_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/* PAGE_SHIFT determines the page size */
     5#define PAGE_SHIFT      13
     6#define PAGE_SIZE       (1UL << PAGE_SHIFT)
     7#define PAGE_MASK       (~(PAGE_SIZE-1))
     8
     9#ifdef __KERNEL__
     10
     11#include <asm/pal.h>
     12
     13#ifndef __ASSEMBLY__
     14
     15#define STRICT_MM_TYPECHECKS
     16
     17extern void clear_page(void *page);
     18#define clear_user_page(page, vaddr, pg)        clear_page(page)
     19
     20#define __alloc_zeroed_user_highpage(movableflags, vma, vaddr) \
     21        alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, 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 virt_to_page(kaddr)     pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
     89
     90#define pfn_valid(pfn)          ((pfn) < max_mapnr)
     91#define virt_addr_valid(kaddr)  pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
     92#endif /* CONFIG_DISCONTIGMEM */
     93
     94#define VM_DATA_DEFAULT_FLAGS           (VM_READ | VM_WRITE | VM_EXEC | \
     95                                         VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
     96
     97#include <asm-generic/memory_model.h>
     98#include <asm-generic/page.h>
     99
     100#endif /* __KERNEL__ */
     101#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/param.h

    diff -Naur aboot-0.9b.orig/include/asm/param.h aboot-0.9b/include/asm/param.h
    old new  
     1#ifndef _ASM_ALPHA_PARAM_H
     2#define _ASM_ALPHA_PARAM_H
     3
     4/* ??? Gross.  I don't want to parameterize this, and supposedly the
     5   hardware ignores reprogramming.  We also need userland buy-in to the
     6   change in HZ, since this is visible in the wait4 resources etc.  */
     7
     8
     9#ifndef HZ
     10# ifndef CONFIG_ALPHA_RAWHIDE
     11#  define HZ    1024
     12# else
     13#  define HZ    1200
     14# endif
     15#endif
     16
     17#define USER_HZ         HZ
     18
     19#define EXEC_PAGESIZE   8192
     20
     21#ifndef NOGROUP
     22#define NOGROUP         (-1)
     23#endif
     24
     25#define MAXHOSTNAMELEN  64      /* max length of hostname */
     26
     27
     28#endif /* _ASM_ALPHA_PARAM_H */
  • include/asm/posix_types.h

    diff -Naur aboot-0.9b.orig/include/asm/posix_types.h aboot-0.9b/include/asm/posix_types.h
    old new  
     1#ifndef _ALPHA_POSIX_TYPES_H
     2#define _ALPHA_POSIX_TYPES_H
     3
     4/*
     5 * This file is generally used by user-level software, so you need to
     6 * be a little careful about namespace pollution etc.  Also, we cannot
     7 * assume GCC is being used.
     8 */
     9
     10typedef unsigned int    __kernel_ino_t;
     11typedef unsigned int    __kernel_mode_t;
     12typedef unsigned int    __kernel_nlink_t;
     13typedef long            __kernel_off_t;
     14typedef long long       __kernel_loff_t;
     15typedef int             __kernel_pid_t;
     16typedef int             __kernel_ipc_pid_t;
     17typedef unsigned int    __kernel_uid_t;
     18typedef unsigned int    __kernel_gid_t;
     19typedef unsigned long   __kernel_size_t;
     20typedef long            __kernel_ssize_t;
     21typedef long            __kernel_ptrdiff_t;
     22typedef long            __kernel_time_t;
     23typedef long            __kernel_suseconds_t;
     24typedef long            __kernel_clock_t;
     25typedef int             __kernel_daddr_t;
     26typedef char *          __kernel_caddr_t;
     27typedef unsigned long   __kernel_sigset_t;      /* at least 32 bits */
     28typedef unsigned short  __kernel_uid16_t;
     29typedef unsigned short  __kernel_gid16_t;
     30typedef int             __kernel_clockid_t;
     31typedef int             __kernel_timer_t;
     32
     33typedef struct {
     34        int     val[2];
     35} __kernel_fsid_t;
     36
     37typedef __kernel_uid_t __kernel_old_uid_t;
     38typedef __kernel_gid_t __kernel_old_gid_t;
     39typedef __kernel_uid_t __kernel_uid32_t;
     40typedef __kernel_gid_t __kernel_gid32_t;
     41
     42typedef unsigned int    __kernel_old_dev_t;
     43
     44
     45#endif /* _ALPHA_POSIX_TYPES_H */
  • include/asm/stat.h

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

    diff -Naur aboot-0.9b.orig/include/asm/types.h aboot-0.9b/include/asm/types.h
    old new  
     1#ifndef _ALPHA_TYPES_H
     2#define _ALPHA_TYPES_H
     3
     4/*
     5 * This file is never included by application software unless
     6 * explicitly requested (e.g., via linux/types.h) in which case the
     7 * application is Linux specific so (user-) name space pollution is
     8 * not a major issue.  However, for interoperability, libraries still
     9 * need to be careful to avoid a name clashes.
     10 */
     11
     12#ifndef __ASSEMBLY__
     13
     14typedef unsigned int umode_t;
     15
     16/*
     17 * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
     18 * header files exported to user space
     19 */
     20
     21typedef __signed__ char __s8;
     22typedef unsigned char __u8;
     23
     24typedef __signed__ short __s16;
     25typedef unsigned short __u16;
     26
     27typedef __signed__ int __s32;
     28typedef unsigned int __u32;
     29
     30typedef __signed__ long __s64;
     31typedef unsigned long __u64;
     32
     33#endif /* __ASSEMBLY__ */
     34
     35/*
     36 * These aren't exported outside the kernel to avoid name space clashes
     37 */
     38#endif /* _ALPHA_TYPES_H */
  • include/asm-generic/memory_model.h

    diff -Naur aboot-0.9b.orig/include/asm-generic/memory_model.h aboot-0.9b/include/asm-generic/memory_model.h
    old new  
     1#ifndef __ASM_MEMORY_MODEL_H
     2#define __ASM_MEMORY_MODEL_H
     3
     4#ifdef __KERNEL__
     5#ifndef __ASSEMBLY__
     6
     7#if defined(CONFIG_FLATMEM)
     8
     9#ifndef ARCH_PFN_OFFSET
     10#define ARCH_PFN_OFFSET         (0UL)
     11#endif
     12
     13#elif defined(CONFIG_DISCONTIGMEM)
     14
     15#ifndef arch_pfn_to_nid
     16#define arch_pfn_to_nid(pfn)    pfn_to_nid(pfn)
     17#endif
     18
     19#ifndef arch_local_page_offset
     20#define arch_local_page_offset(pfn, nid)        \
     21        ((pfn) - NODE_DATA(nid)->node_start_pfn)
     22#endif
     23
     24#endif /* CONFIG_DISCONTIGMEM */
     25
     26/*
     27 * supports 3 memory models.
     28 */
     29#if defined(CONFIG_FLATMEM)
     30
     31#define __pfn_to_page(pfn)      (mem_map + ((pfn) - ARCH_PFN_OFFSET))
     32#define __page_to_pfn(page)     ((unsigned long)((page) - mem_map) + \
     33                                 ARCH_PFN_OFFSET)
     34#elif defined(CONFIG_DISCONTIGMEM)
     35
     36#define __pfn_to_page(pfn)                      \
     37({      unsigned long __pfn = (pfn);            \
     38        unsigned long __nid = arch_pfn_to_nid(pfn);  \
     39        NODE_DATA(__nid)->node_mem_map + arch_local_page_offset(__pfn, __nid);\
     40})
     41
     42#define __page_to_pfn(pg)                                               \
     43({      struct page *__pg = (pg);                                       \
     44        struct pglist_data *__pgdat = NODE_DATA(page_to_nid(__pg));     \
     45        (unsigned long)(__pg - __pgdat->node_mem_map) +                 \
     46         __pgdat->node_start_pfn;                                       \
     47})
     48
     49#elif defined(CONFIG_SPARSEMEM)
     50/*
     51 * Note: section's mem_map is encorded to reflect its start_pfn.
     52 * section[i].section_mem_map == mem_map's address - start_pfn;
     53 */
     54#define __page_to_pfn(pg)                                       \
     55({      struct page *__pg = (pg);                               \
     56        int __sec = page_to_section(__pg);                      \
     57        (unsigned long)(__pg - __section_mem_map_addr(__nr_to_section(__sec))); \
     58})
     59
     60#define __pfn_to_page(pfn)                              \
     61({      unsigned long __pfn = (pfn);                    \
     62        struct mem_section *__sec = __pfn_to_section(__pfn);    \
     63        __section_mem_map_addr(__sec) + __pfn;          \
     64})
     65#endif /* CONFIG_FLATMEM/DISCONTIGMEM/SPARSEMEM */
     66
     67#ifdef CONFIG_OUT_OF_LINE_PFN_TO_PAGE
     68struct page;
     69/* this is useful when inlined pfn_to_page is too big */
     70extern struct page *pfn_to_page(unsigned long pfn);
     71extern unsigned long page_to_pfn(struct page *page);
     72#else
     73#define page_to_pfn __page_to_pfn
     74#define pfn_to_page __pfn_to_page
     75#endif /* CONFIG_OUT_OF_LINE_PFN_TO_PAGE */
     76
     77#endif /* __ASSEMBLY__ */
     78#endif /* __KERNEL__ */
     79
     80#endif
  • include/asm-generic/page.h

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

    diff -Naur aboot-0.9b.orig/include/linux/a.out.h aboot-0.9b/include/linux/a.out.h
    old new  
     1#ifndef __A_OUT_GNU_H__
     2#define __A_OUT_GNU_H__
     3
     4#define __GNU_EXEC_MACROS__
     5
     6#ifndef __STRUCT_EXEC_OVERRIDE__
     7
     8#include <asm/a.out.h>
     9
     10#endif /* __STRUCT_EXEC_OVERRIDE__ */
     11
     12/* these go in the N_MACHTYPE field */
     13enum machine_type {
     14#if defined (M_OLDSUN2)
     15  M__OLDSUN2 = M_OLDSUN2,
     16#else
     17  M_OLDSUN2 = 0,
     18#endif
     19#if defined (M_68010)
     20  M__68010 = M_68010,
     21#else
     22  M_68010 = 1,
     23#endif
     24#if defined (M_68020)
     25  M__68020 = M_68020,
     26#else
     27  M_68020 = 2,
     28#endif
     29#if defined (M_SPARC)
     30  M__SPARC = M_SPARC,
     31#else
     32  M_SPARC = 3,
     33#endif
     34  /* skip a bunch so we don't run into any of sun's numbers */
     35  M_386 = 100,
     36  M_MIPS1 = 151,        /* MIPS R3000/R3000 binary */
     37  M_MIPS2 = 152         /* MIPS R6000/R4000 binary */
     38};
     39
     40#if !defined (N_MAGIC)
     41#define N_MAGIC(exec) ((exec).a_info & 0xffff)
     42#endif
     43#define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff))
     44#define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff)
     45#define N_SET_INFO(exec, magic, type, flags) \
     46        ((exec).a_info = ((magic) & 0xffff) \
     47         | (((int)(type) & 0xff) << 16) \
     48         | (((flags) & 0xff) << 24))
     49#define N_SET_MAGIC(exec, magic) \
     50        ((exec).a_info = (((exec).a_info & 0xffff0000) | ((magic) & 0xffff)))
     51
     52#define N_SET_MACHTYPE(exec, machtype) \
     53        ((exec).a_info = \
     54         ((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16))
     55
     56#define N_SET_FLAGS(exec, flags) \
     57        ((exec).a_info = \
     58         ((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24))
     59
     60/* Code indicating object file or impure executable.  */
     61#define OMAGIC 0407
     62/* Code indicating pure executable.  */
     63#define NMAGIC 0410
     64/* Code indicating demand-paged executable.  */
     65#define ZMAGIC 0413
     66/* This indicates a demand-paged executable with the header in the text.
     67   The first page is unmapped to help trap NULL pointer references */
     68#define QMAGIC 0314
     69
     70/* Code indicating core file.  */
     71#define CMAGIC 0421
     72
     73#if !defined (N_BADMAG)
     74#define N_BADMAG(x)       (N_MAGIC(x) != OMAGIC         \
     75                        && N_MAGIC(x) != NMAGIC         \
     76                        && N_MAGIC(x) != ZMAGIC \
     77                        && N_MAGIC(x) != QMAGIC)
     78#endif
     79
     80#define _N_HDROFF(x) (1024 - sizeof (struct exec))
     81
     82#if !defined (N_TXTOFF)
     83#define N_TXTOFF(x) \
     84 (N_MAGIC(x) == ZMAGIC ? _N_HDROFF((x)) + sizeof (struct exec) : \
     85  (N_MAGIC(x) == QMAGIC ? 0 : sizeof (struct exec)))
     86#endif
     87
     88#if !defined (N_DATOFF)
     89#define N_DATOFF(x) (N_TXTOFF(x) + (x).a_text)
     90#endif
     91
     92#if !defined (N_TRELOFF)
     93#define N_TRELOFF(x) (N_DATOFF(x) + (x).a_data)
     94#endif
     95
     96#if !defined (N_DRELOFF)
     97#define N_DRELOFF(x) (N_TRELOFF(x) + N_TRSIZE(x))
     98#endif
     99
     100#if !defined (N_SYMOFF)
     101#define N_SYMOFF(x) (N_DRELOFF(x) + N_DRSIZE(x))
     102#endif
     103
     104#if !defined (N_STROFF)
     105#define N_STROFF(x) (N_SYMOFF(x) + N_SYMSIZE(x))
     106#endif
     107
     108/* Address of text segment in memory after it is loaded.  */
     109#if !defined (N_TXTADDR)
     110#define N_TXTADDR(x) (N_MAGIC(x) == QMAGIC ? PAGE_SIZE : 0)
     111#endif
     112
     113/* Address of data segment in memory after it is loaded.
     114   Note that it is up to you to define SEGMENT_SIZE
     115   on machines not listed here.  */
     116#if defined(vax) || defined(hp300) || defined(pyr)
     117#define SEGMENT_SIZE page_size
     118#endif
     119#ifdef  sony
     120#define SEGMENT_SIZE    0x2000
     121#endif  /* Sony.  */
     122#ifdef is68k
     123#define SEGMENT_SIZE 0x20000
     124#endif
     125#if defined(m68k) && defined(PORTAR)
     126#define PAGE_SIZE 0x400
     127#define SEGMENT_SIZE PAGE_SIZE
     128#endif
     129
     130#ifdef linux
     131#include <asm/page.h>
     132#if defined(__i386__) || defined(__mc68000__)
     133#define SEGMENT_SIZE    1024
     134#else
     135#ifndef SEGMENT_SIZE
     136#define SEGMENT_SIZE    PAGE_SIZE
     137#endif
     138#endif
     139#endif
     140
     141#define _N_SEGMENT_ROUND(x) ALIGN(x, SEGMENT_SIZE)
     142
     143#define _N_TXTENDADDR(x) (N_TXTADDR(x)+(x).a_text)
     144
     145#ifndef N_DATADDR
     146#define N_DATADDR(x) \
     147    (N_MAGIC(x)==OMAGIC? (_N_TXTENDADDR(x)) \
     148     : (_N_SEGMENT_ROUND (_N_TXTENDADDR(x))))
     149#endif
     150
     151/* Address of bss segment in memory after it is loaded.  */
     152#if !defined (N_BSSADDR)
     153#define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data)
     154#endif
     155
    0156
     157#if !defined (N_NLIST_DECLARED)
     158struct nlist {
     159  union {
     160    char *n_name;
     161    struct nlist *n_next;
     162    long n_strx;
     163  } n_un;
     164  unsigned char n_type;
     165  char n_other;
     166  short n_desc;
     167  unsigned long n_value;
     168};
     169#endif /* no N_NLIST_DECLARED.  */
     170
     171#if !defined (N_UNDF)
     172#define N_UNDF 0
     173#endif
     174#if !defined (N_ABS)
     175#define N_ABS 2
     176#endif
     177#if !defined (N_TEXT)
     178#define N_TEXT 4
     179#endif
     180#if !defined (N_DATA)
     181#define N_DATA 6
     182#endif
     183#if !defined (N_BSS)
     184#define N_BSS 8
     185#endif
     186#if !defined (N_FN)
     187#define N_FN 15
     188#endif
     189
     190#if !defined (N_EXT)
     191#define N_EXT 1
     192#endif
     193#if !defined (N_TYPE)
     194#define N_TYPE 036
     195#endif
     196#if !defined (N_STAB)
     197#define N_STAB 0340
     198#endif
     199
     200/* The following type indicates the definition of a symbol as being
     201   an indirect reference to another symbol.  The other symbol
     202   appears as an undefined reference, immediately following this symbol.
     203
     204   Indirection is asymmetrical.  The other symbol's value will be used
     205   to satisfy requests for the indirect symbol, but not vice versa.
     206   If the other symbol does not have a definition, libraries will
     207   be searched to find a definition.  */
     208#define N_INDR 0xa
     209
     210/* The following symbols refer to set elements.
     211   All the N_SET[ATDB] symbols with the same name form one set.
     212   Space is allocated for the set in the text section, and each set
     213   element's value is stored into one word of the space.
     214   The first word of the space is the length of the set (number of elements).
     215
     216   The address of the set is made into an N_SETV symbol
     217   whose name is the same as the name of the set.
     218   This symbol acts like a N_DATA global symbol
     219   in that it can satisfy undefined external references.  */
     220
     221/* These appear as input to LD, in a .o file.  */
     222#define N_SETA  0x14            /* Absolute set element symbol */
     223#define N_SETT  0x16            /* Text set element symbol */
     224#define N_SETD  0x18            /* Data set element symbol */
     225#define N_SETB  0x1A            /* Bss set element symbol */
     226
     227/* This is output from LD.  */
     228#define N_SETV  0x1C            /* Pointer to set vector in data area.  */
     229
    1230
     231#if !defined (N_RELOCATION_INFO_DECLARED)
     232/* This structure describes a single relocation to be performed.
     233   The text-relocation section of the file is a vector of these structures,
     234   all of which apply to the text section.
     235   Likewise, the data-relocation section applies to the data section.  */
     236
     237struct relocation_info
     238{
     239  /* Address (within segment) to be relocated.  */
     240  int r_address;
     241  /* The meaning of r_symbolnum depends on r_extern.  */
     242  unsigned int r_symbolnum:24;
     243  /* Nonzero means value is a pc-relative offset
     244     and it should be relocated for changes in its own address
     245     as well as for changes in the symbol or section specified.  */
     246  unsigned int r_pcrel:1;
     247  /* Length (as exponent of 2) of the field to be relocated.
     248     Thus, a value of 2 indicates 1<<2 bytes.  */
     249  unsigned int r_length:2;
     250  /* 1 => relocate with value of symbol.
     251          r_symbolnum is the index of the symbol
     252          in file's the symbol table.
     253     0 => relocate with the address of a segment.
     254          r_symbolnum is N_TEXT, N_DATA, N_BSS or N_ABS
     255          (the N_EXT bit may be set also, but signifies nothing).  */
     256  unsigned int r_extern:1;
     257  /* Four bits that aren't used, but when writing an object file
     258     it is desirable to clear them.  */
     259#ifdef NS32K
     260  unsigned r_bsr:1;
     261  unsigned r_disp:1;
     262  unsigned r_pad:2;
     263#else
     264  unsigned int r_pad:4;
     265#endif
     266};
     267#endif /* no N_RELOCATION_INFO_DECLARED.  */
     268
  • include/linux/auxvec.h

    +
    +#endif /* __A_OUT_GNU_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  44 /* Size of auxiliary table.  */
     30
     31#endif /* _LINUX_AUXVEC_H */
  • include/linux/coff.h

    diff -Naur aboot-0.9b.orig/include/linux/coff.h aboot-0.9b/include/linux/coff.h
    old new  
     1/* This file is derived from the GAS 2.1.4 assembler control file.
     2   The GAS product is under the GNU General Public License, version 2 or later.
     3   As such, this file is also under that license.
     4
     5   If the file format changes in the COFF object, this file should be
     6   subsequently updated to reflect the changes.
     7
     8   The actual loader module only uses a few of these structures. The full
     9   set is documented here because I received the full set. If you wish
     10   more information about COFF, then O'Reilly has a very excellent book.
     11*/
     12
     13#define  E_SYMNMLEN  8   /* Number of characters in a symbol name         */
     14#define  E_FILNMLEN 14   /* Number of characters in a file name           */
     15#define  E_DIMNUM    4   /* Number of array dimensions in auxiliary entry */
     16
     17/*
     18 * These defines are byte order independent. There is no alignment of fields
     19 * permitted in the structures. Therefore they are declared as characters
     20 * and the values loaded from the character positions. It also makes it
     21 * nice to have it "endian" independent.
     22 */
     23 
     24/* Load a short int from the following tables with little-endian formats */
     25#define COFF_SHORT_L(ps) ((short)(((unsigned short)((unsigned char)ps[1])<<8)|\
     26                                  ((unsigned short)((unsigned char)ps[0]))))
     27
     28/* Load a long int from the following tables with little-endian formats */
     29#define COFF_LONG_L(ps) (((long)(((unsigned long)((unsigned char)ps[3])<<24) |\
     30                                 ((unsigned long)((unsigned char)ps[2])<<16) |\
     31                                 ((unsigned long)((unsigned char)ps[1])<<8)  |\
     32                                 ((unsigned long)((unsigned char)ps[0])))))
     33 
     34/* Load a short int from the following tables with big-endian formats */
     35#define COFF_SHORT_H(ps) ((short)(((unsigned short)((unsigned char)ps[0])<<8)|\
     36                                  ((unsigned short)((unsigned char)ps[1]))))
     37
     38/* Load a long int from the following tables with big-endian formats */
     39#define COFF_LONG_H(ps) (((long)(((unsigned long)((unsigned char)ps[0])<<24) |\
     40                                 ((unsigned long)((unsigned char)ps[1])<<16) |\
     41                                 ((unsigned long)((unsigned char)ps[2])<<8)  |\
     42                                 ((unsigned long)((unsigned char)ps[3])))))
     43
     44/* These may be overridden later by brain dead implementations which generate
     45   a big-endian header with little-endian data. In that case, generate a
     46   replacement macro which tests a flag and uses either of the two above
     47   as appropriate. */
     48
     49#define COFF_LONG(v)   COFF_LONG_L(v)
     50#define COFF_SHORT(v)  COFF_SHORT_L(v)
     51
     52/*** coff information for Intel 386/486.  */
     53
     54/********************** FILE HEADER **********************/
     55
     56struct COFF_filehdr {
     57        char f_magic[2];        /* magic number                 */
     58        char f_nscns[2];        /* number of sections           */
     59        char f_timdat[4];       /* time & date stamp            */
     60        char f_symptr[4];       /* file pointer to symtab       */
     61        char f_nsyms[4];        /* number of symtab entries     */
     62        char f_opthdr[2];       /* sizeof(optional hdr)         */
     63        char f_flags[2];        /* flags                        */
     64};
     65
     66/*
     67 *   Bits for f_flags:
     68 *
     69 *      F_RELFLG        relocation info stripped from file
     70 *      F_EXEC          file is executable  (i.e. no unresolved external
     71 *                      references)
     72 *      F_LNNO          line numbers stripped from file
     73 *      F_LSYMS         local symbols stripped from file
     74 *      F_MINMAL        this is a minimal object file (".m") output of fextract
     75 *      F_UPDATE        this is a fully bound update file, output of ogen
     76 *      F_SWABD         this file has had its bytes swabbed (in names)
     77 *      F_AR16WR        this file has the byte ordering of an AR16WR
     78 *                      (e.g. 11/70) machine
     79 *      F_AR32WR        this file has the byte ordering of an AR32WR machine
     80 *                      (e.g. vax and iNTEL 386)
     81 *      F_AR32W         this file has the byte ordering of an AR32W machine
     82 *                      (e.g. 3b,maxi)
     83 *      F_PATCH         file contains "patch" list in optional header
     84 *      F_NODF          (minimal file only) no decision functions for
     85 *                      replaced functions
     86 */
     87
     88#define  COFF_F_RELFLG          0000001
     89#define  COFF_F_EXEC            0000002
     90#define  COFF_F_LNNO            0000004
     91#define  COFF_F_LSYMS           0000010
     92#define  COFF_F_MINMAL          0000020
     93#define  COFF_F_UPDATE          0000040
     94#define  COFF_F_SWABD           0000100
     95#define  COFF_F_AR16WR          0000200
     96#define  COFF_F_AR32WR          0000400
     97#define  COFF_F_AR32W           0001000
     98#define  COFF_F_PATCH           0002000
     99#define  COFF_F_NODF            0002000
     100
     101#define COFF_I386MAGIC          0x14c   /* Linux's system    */
     102
     103#if 0   /* Perhaps, someday, these formats may be used.      */
     104#define COFF_I386PTXMAGIC       0x154
     105#define COFF_I386AIXMAGIC       0x175   /* IBM's AIX system  */
     106#define COFF_I386BADMAG(x) ((COFF_SHORT((x).f_magic) != COFF_I386MAGIC) \
     107                          && COFF_SHORT((x).f_magic) != COFF_I386PTXMAGIC \
     108                          && COFF_SHORT((x).f_magic) != COFF_I386AIXMAGIC)
     109#else
     110#define COFF_I386BADMAG(x) (COFF_SHORT((x).f_magic) != COFF_I386MAGIC)
     111#endif
     112
     113#define COFF_FILHDR     struct COFF_filehdr
     114#define COFF_FILHSZ     sizeof(COFF_FILHDR)
     115
     116/********************** AOUT "OPTIONAL HEADER" **********************/
     117
     118/* Linux COFF must have this "optional" header. Standard COFF has no entry
     119   location for the "entry" point. They normally would start with the first
     120   location of the .text section. This is not a good idea for linux. So,
     121   the use of this "optional" header is not optional. It is required.
     122
     123   Do not be tempted to assume that the size of the optional header is
     124   a constant and simply index the next byte by the size of this structure.
     125   Use the 'f_opthdr' field in the main coff header for the size of the
     126   structure actually written to the file!!
     127*/
     128
     129typedef struct
     130{
     131  char  magic[2];               /* type of file                          */
     132  char  vstamp[2];              /* version stamp                         */
     133  char  tsize[4];               /* text size in bytes, padded to FW bdry */
     134  char  dsize[4];               /* initialized   data "   "              */
     135  char  bsize[4];               /* uninitialized data "   "              */
     136  char  entry[4];               /* entry pt.                             */
     137  char  text_start[4];          /* base of text used for this file       */
     138  char  data_start[4];          /* base of data used for this file       */
     139}
     140COFF_AOUTHDR;
     141
     142#define COFF_AOUTSZ (sizeof(COFF_AOUTHDR))
     143
     144#define COFF_STMAGIC    0401
     145#define COFF_OMAGIC     0404
     146#define COFF_JMAGIC     0407    /* dirty text and data image, can't share  */
     147#define COFF_DMAGIC     0410    /* dirty text segment, data aligned        */
     148#define COFF_ZMAGIC     0413    /* The proper magic number for executables  */
     149#define COFF_SHMAGIC    0443    /* shared library header                   */
     150
     151/********************** SECTION HEADER **********************/
     152
     153struct COFF_scnhdr {
     154  char          s_name[8];      /* section name                     */
     155  char          s_paddr[4];     /* physical address, aliased s_nlib */
     156  char          s_vaddr[4];     /* virtual address                  */
     157  char          s_size[4];      /* section size                     */
     158  char          s_scnptr[4];    /* file ptr to raw data for section */
     159  char          s_relptr[4];    /* file ptr to relocation           */
     160  char          s_lnnoptr[4];   /* file ptr to line numbers         */
     161  char          s_nreloc[2];    /* number of relocation entries     */
     162  char          s_nlnno[2];     /* number of line number entries    */
     163  char          s_flags[4];     /* flags                            */
     164};
     165
     166#define COFF_SCNHDR     struct COFF_scnhdr
     167#define COFF_SCNHSZ     sizeof(COFF_SCNHDR)
     168
     169/*
     170 * names of "special" sections
     171 */
     172
     173#define COFF_TEXT       ".text"
     174#define COFF_DATA       ".data"
     175#define COFF_BSS        ".bss"
     176#define COFF_COMMENT    ".comment"
     177#define COFF_LIB        ".lib"
     178
     179#define COFF_SECT_TEXT  0      /* Section for instruction code             */
     180#define COFF_SECT_DATA  1      /* Section for initialized globals          */
     181#define COFF_SECT_BSS   2      /* Section for un-initialized globals       */
     182#define COFF_SECT_REQD  3      /* Minimum number of sections for good file */
     183
     184#define COFF_STYP_REG     0x00 /* regular segment                          */
     185#define COFF_STYP_DSECT   0x01 /* dummy segment                            */
     186#define COFF_STYP_NOLOAD  0x02 /* no-load segment                          */
     187#define COFF_STYP_GROUP   0x04 /* group segment                            */
     188#define COFF_STYP_PAD     0x08 /* .pad segment                             */
     189#define COFF_STYP_COPY    0x10 /* copy section                             */
     190#define COFF_STYP_TEXT    0x20 /* .text segment                            */
     191#define COFF_STYP_DATA    0x40 /* .data segment                            */
     192#define COFF_STYP_BSS     0x80 /* .bss segment                             */
     193#define COFF_STYP_INFO   0x200 /* .comment section                         */
     194#define COFF_STYP_OVER   0x400 /* overlay section                          */
     195#define COFF_STYP_LIB    0x800 /* library section                          */
     196
     197/*
     198 * Shared libraries have the following section header in the data field for
     199 * each library.
     200 */
     201
     202struct COFF_slib {
     203  char          sl_entsz[4];    /* Size of this entry               */
     204  char          sl_pathndx[4];  /* size of the header field         */
     205};
     206
     207#define COFF_SLIBHD     struct COFF_slib
     208#define COFF_SLIBSZ     sizeof(COFF_SLIBHD)
     209
     210/********************** LINE NUMBERS **********************/
     211
     212/* 1 line number entry for every "breakpointable" source line in a section.
     213 * Line numbers are grouped on a per function basis; first entry in a function
     214 * grouping will have l_lnno = 0 and in place of physical address will be the
     215 * symbol table index of the function name.
     216 */
     217
     218struct COFF_lineno {
     219  union {
     220    char l_symndx[4];   /* function name symbol index, iff l_lnno == 0*/
     221    char l_paddr[4];    /* (physical) address of line number    */
     222  } l_addr;
     223  char l_lnno[2];       /* line number          */
     224};
     225
     226#define COFF_LINENO     struct COFF_lineno
     227#define COFF_LINESZ     6
     228
     229/********************** SYMBOLS **********************/
     230
     231#define COFF_E_SYMNMLEN  8      /* # characters in a short symbol name  */
     232#define COFF_E_FILNMLEN 14      /* # characters in a file name          */
     233#define COFF_E_DIMNUM    4      /* # array dimensions in auxiliary entry */
     234
     235/*
     236 *  All symbols and sections have the following definition
     237 */
     238
     239struct COFF_syment
     240{
     241  union {
     242    char e_name[E_SYMNMLEN];    /* Symbol name (first 8 characters) */
     243    struct {
     244      char e_zeroes[4];         /* Leading zeros */
     245      char e_offset[4];         /* Offset if this is a header section */
     246    } e;
     247  } e;
     248
     249  char e_value[4];              /* Value (address) of the segment */
     250  char e_scnum[2];              /* Section number */
     251  char e_type[2];               /* Type of section */
     252  char e_sclass[1];             /* Loader class */
     253  char e_numaux[1];             /* Number of auxiliary entries which follow */
     254};
     255
     256#define COFF_N_BTMASK   (0xf)   /* Mask for important class bits */
     257#define COFF_N_TMASK    (0x30)  /* Mask for important type bits  */
     258#define COFF_N_BTSHFT   (4)     /* # bits to shift class field   */
     259#define COFF_N_TSHIFT   (2)     /* # bits to shift type field    */
     260
     261/*
     262 *  Auxiliary entries because the main table is too limiting.
     263 */
     264 
     265union COFF_auxent {
     266
     267/*
     268 *  Debugger information
     269 */
     270
     271  struct {
     272    char x_tagndx[4];           /* str, un, or enum tag indx */
     273    union {
     274      struct {
     275        char  x_lnno[2];        /* declaration line number */
     276        char  x_size[2];        /* str/union/array size */
     277      } x_lnsz;
     278      char x_fsize[4];          /* size of function */
     279    } x_misc;
     280
     281    union {
     282      struct {                  /* if ISFCN, tag, or .bb */
     283        char x_lnnoptr[4];      /* ptr to fcn line # */
     284        char x_endndx[4];       /* entry ndx past block end */
     285      } x_fcn;
     286
     287      struct {                  /* if ISARY, up to 4 dimen. */
     288        char x_dimen[E_DIMNUM][2];
     289      } x_ary;
     290    } x_fcnary;
     291
     292    char x_tvndx[2];    /* tv index */
     293  } x_sym;
     294
     295/*
     296 *   Source file names (debugger information)
     297 */
     298
     299  union {
     300    char x_fname[E_FILNMLEN];
     301    struct {
     302      char x_zeroes[4];
     303      char x_offset[4];
     304    } x_n;
     305  } x_file;
     306
     307/*
     308 *   Section information
     309 */
     310
     311  struct {
     312    char x_scnlen[4];   /* section length */
     313    char x_nreloc[2];   /* # relocation entries */
     314    char x_nlinno[2];   /* # line numbers */
     315  } x_scn;
     316
     317/*
     318 *   Transfer vector (branch table)
     319 */
     320 
     321  struct {
     322    char x_tvfill[4];   /* tv fill value */
     323    char x_tvlen[2];    /* length of .tv */
     324    char x_tvran[2][2]; /* tv range */
     325  } x_tv;               /* info about .tv section (in auxent of symbol .tv)) */
     326};
     327
     328#define COFF_SYMENT     struct COFF_syment
     329#define COFF_SYMESZ     18     
     330#define COFF_AUXENT     union COFF_auxent
     331#define COFF_AUXESZ     18
     332
     333#define COFF_ETEXT      "etext"
     334
     335/********************** RELOCATION DIRECTIVES **********************/
     336
     337struct COFF_reloc {
     338  char r_vaddr[4];        /* Virtual address of item    */
     339  char r_symndx[4];       /* Symbol index in the symtab */
     340  char r_type[2];         /* Relocation type            */
     341};
     342
     343#define COFF_RELOC struct COFF_reloc
     344#define COFF_RELSZ 10
     345
     346#define COFF_DEF_DATA_SECTION_ALIGNMENT  4
     347#define COFF_DEF_BSS_SECTION_ALIGNMENT   4
     348#define COFF_DEF_TEXT_SECTION_ALIGNMENT  4
     349
     350/* For new sections we haven't heard of before */
     351#define COFF_DEF_SECTION_ALIGNMENT       4
  • include/linux/compiler.h

    diff -Naur aboot-0.9b.orig/include/linux/compiler.h aboot-0.9b/include/linux/compiler.h
    old new  
     1#ifndef __inline__
     2# define __inline__ inline
     3#endif
     4
     5#ifndef __attribute_const__
     6# define __attribute_const__    /* unimplemented */
     7#endif
     8
     9#ifndef __always_inline
     10# define __always_inline inline
     11#endif
  • include/linux/elf-em.h

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

    diff -Naur aboot-0.9b.orig/include/linux/ext2_fs.h aboot-0.9b/include/linux/ext2_fs.h
    old new  
     1/*
     2 *  linux/include/linux/ext2_fs.h
     3 *
     4 * Copyright (C) 1992, 1993, 1994, 1995
     5 * Remy Card (card@masi.ibp.fr)
     6 * Laboratoire MASI - Institut Blaise Pascal
     7 * Universite Pierre et Marie Curie (Paris VI)
     8 *
     9 *  from
     10 *
     11 *  linux/include/linux/minix_fs.h
     12 *
     13 *  Copyright (C) 1991, 1992  Linus Torvalds
     14 */
     15
     16#ifndef _LINUX_EXT2_FS_H
     17#define _LINUX_EXT2_FS_H
     18
     19#include <linux/types.h>
     20#include <linux/magic.h>
     21
     22/*
     23 * The second extended filesystem constants/structures
     24 */
     25
     26/*
     27 * Define EXT2FS_DEBUG to produce debug messages
     28 */
     29#undef EXT2FS_DEBUG
     30
     31/*
     32 * Define EXT2_PREALLOCATE to preallocate data blocks for expanding files
     33 */
     34#define EXT2_PREALLOCATE
     35#define EXT2_DEFAULT_PREALLOC_BLOCKS    8
     36
     37/*
     38 * The second extended file system version
     39 */
     40#define EXT2FS_DATE             "95/08/09"
     41#define EXT2FS_VERSION          "0.5b"
     42
     43/*
     44 * Debug code
     45 */
     46#ifdef EXT2FS_DEBUG
     47#       define ext2_debug(f, a...)      { \
     48                                        printk ("EXT2-fs DEBUG (%s, %d): %s:", \
     49                                                __FILE__, __LINE__, __FUNCTION__); \
     50                                        printk (f, ## a); \
     51                                        }
     52#else
     53#       define ext2_debug(f, a...)      /**/
     54#endif
     55
     56/*
     57 * Special inode numbers
     58 */
     59#define EXT2_BAD_INO             1      /* Bad blocks inode */
     60#define EXT2_ROOT_INO            2      /* Root inode */
     61#define EXT2_BOOT_LOADER_INO     5      /* Boot loader inode */
     62#define EXT2_UNDEL_DIR_INO       6      /* Undelete directory inode */
     63
     64/* First non-reserved inode for old ext2 filesystems */
     65#define EXT2_GOOD_OLD_FIRST_INO 11
     66
     67/* Assume that user mode programs are passing in an ext2fs superblock, not
     68 * a kernel struct super_block.  This will allow us to call the feature-test
     69 * macros from user land. */
     70#define EXT2_SB(sb)     (sb)
     71
     72/*
     73 * Maximal count of links to a file
     74 */
     75#define EXT2_LINK_MAX           32000
     76
     77/*
     78 * Macro-instructions used to manage several block sizes
     79 */
     80#define EXT2_MIN_BLOCK_SIZE             1024
     81#define EXT2_MAX_BLOCK_SIZE             4096
     82#define EXT2_MIN_BLOCK_LOG_SIZE           10
     83# define EXT2_BLOCK_SIZE(s)             (EXT2_MIN_BLOCK_SIZE << (s)->s_log_block_size)
     84#define EXT2_ADDR_PER_BLOCK(s)          (EXT2_BLOCK_SIZE(s) / sizeof (__u32))
     85# define EXT2_BLOCK_SIZE_BITS(s)        ((s)->s_log_block_size + 10)
     86#define EXT2_INODE_SIZE(s)      (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
     87                                 EXT2_GOOD_OLD_INODE_SIZE : \
     88                                 (s)->s_inode_size)
     89#define EXT2_FIRST_INO(s)       (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
     90                                 EXT2_GOOD_OLD_FIRST_INO : \
     91                                 (s)->s_first_ino)
     92
     93/*
     94 * Macro-instructions used to manage fragments
     95 */
     96#define EXT2_MIN_FRAG_SIZE              1024
     97#define EXT2_MAX_FRAG_SIZE              4096
     98#define EXT2_MIN_FRAG_LOG_SIZE            10
     99# define EXT2_FRAG_SIZE(s)              (EXT2_MIN_FRAG_SIZE << (s)->s_log_frag_size)
     100# define EXT2_FRAGS_PER_BLOCK(s)        (EXT2_BLOCK_SIZE(s) / EXT2_FRAG_SIZE(s))
     101
     102/*
     103 * Structure of a blocks group descriptor
     104 */
     105struct ext2_group_desc
     106{
     107        __le32  bg_block_bitmap;                /* Blocks bitmap block */
     108        __le32  bg_inode_bitmap;                /* Inodes bitmap block */
     109        __le32  bg_inode_table;         /* Inodes table block */
     110        __le16  bg_free_blocks_count;   /* Free blocks count */
     111        __le16  bg_free_inodes_count;   /* Free inodes count */
     112        __le16  bg_used_dirs_count;     /* Directories count */
     113        __le16  bg_pad;
     114        __le32  bg_reserved[3];
     115};
     116
     117/*
     118 * Macro-instructions used to manage group descriptors
     119 */
     120# define EXT2_BLOCKS_PER_GROUP(s)       ((s)->s_blocks_per_group)
     121# define EXT2_DESC_PER_BLOCK(s)         (EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_group_desc))
     122# define EXT2_INODES_PER_GROUP(s)       ((s)->s_inodes_per_group)
     123
     124/*
     125 * Constants relative to the data blocks
     126 */
     127#define EXT2_NDIR_BLOCKS                12
     128#define EXT2_IND_BLOCK                  EXT2_NDIR_BLOCKS
     129#define EXT2_DIND_BLOCK                 (EXT2_IND_BLOCK + 1)
     130#define EXT2_TIND_BLOCK                 (EXT2_DIND_BLOCK + 1)
     131#define EXT2_N_BLOCKS                   (EXT2_TIND_BLOCK + 1)
     132
     133/*
     134 * Inode flags (GETFLAGS/SETFLAGS)
     135 */
     136#define EXT2_SECRM_FL                   FS_SECRM_FL     /* Secure deletion */
     137#define EXT2_UNRM_FL                    FS_UNRM_FL      /* Undelete */
     138#define EXT2_COMPR_FL                   FS_COMPR_FL     /* Compress file */
     139#define EXT2_SYNC_FL                    FS_SYNC_FL      /* Synchronous updates */
     140#define EXT2_IMMUTABLE_FL               FS_IMMUTABLE_FL /* Immutable file */
     141#define EXT2_APPEND_FL                  FS_APPEND_FL    /* writes to file may only append */
     142#define EXT2_NODUMP_FL                  FS_NODUMP_FL    /* do not dump file */
     143#define EXT2_NOATIME_FL                 FS_NOATIME_FL   /* do not update atime */
     144/* Reserved for compression usage... */
     145#define EXT2_DIRTY_FL                   FS_DIRTY_FL
     146#define EXT2_COMPRBLK_FL                FS_COMPRBLK_FL  /* One or more compressed clusters */
     147#define EXT2_NOCOMP_FL                  FS_NOCOMP_FL    /* Don't compress */
     148#define EXT2_ECOMPR_FL                  FS_ECOMPR_FL    /* Compression error */
     149/* End compression flags --- maybe not all used */     
     150#define EXT2_BTREE_FL                   FS_BTREE_FL     /* btree format dir */
     151#define EXT2_INDEX_FL                   FS_INDEX_FL     /* hash-indexed directory */
     152#define EXT2_IMAGIC_FL                  FS_IMAGIC_FL    /* AFS directory */
     153#define EXT2_JOURNAL_DATA_FL            FS_JOURNAL_DATA_FL /* Reserved for ext3 */
     154#define EXT2_NOTAIL_FL                  FS_NOTAIL_FL    /* file tail should not be merged */
     155#define EXT2_DIRSYNC_FL                 FS_DIRSYNC_FL   /* dirsync behaviour (directories only) */
     156#define EXT2_TOPDIR_FL                  FS_TOPDIR_FL    /* Top of directory hierarchies*/
     157#define EXT2_RESERVED_FL                FS_RESERVED_FL  /* reserved for ext2 lib */
     158
     159#define EXT2_FL_USER_VISIBLE            FS_FL_USER_VISIBLE      /* User visible flags */
     160#define EXT2_FL_USER_MODIFIABLE         FS_FL_USER_MODIFIABLE   /* User modifiable flags */
     161
     162/*
     163 * ioctl commands
     164 */
     165#define EXT2_IOC_GETFLAGS               FS_IOC_GETFLAGS
     166#define EXT2_IOC_SETFLAGS               FS_IOC_SETFLAGS
     167#define EXT2_IOC_GETVERSION             FS_IOC_GETVERSION
     168#define EXT2_IOC_SETVERSION             FS_IOC_SETVERSION
     169
     170/*
     171 * ioctl commands in 32 bit emulation
     172 */
     173#define EXT2_IOC32_GETFLAGS             FS_IOC32_GETFLAGS
     174#define EXT2_IOC32_SETFLAGS             FS_IOC32_SETFLAGS
     175#define EXT2_IOC32_GETVERSION           FS_IOC32_GETVERSION
     176#define EXT2_IOC32_SETVERSION           FS_IOC32_SETVERSION
     177
     178/*
     179 * Structure of an inode on the disk
     180 */
     181struct ext2_inode {
     182        __le16  i_mode;         /* File mode */
     183        __le16  i_uid;          /* Low 16 bits of Owner Uid */
     184        __le32  i_size;         /* Size in bytes */
     185        __le32  i_atime;        /* Access time */
     186        __le32  i_ctime;        /* Creation time */
     187        __le32  i_mtime;        /* Modification time */
     188        __le32  i_dtime;        /* Deletion Time */
     189        __le16  i_gid;          /* Low 16 bits of Group Id */
     190        __le16  i_links_count;  /* Links count */
     191        __le32  i_blocks;       /* Blocks count */
     192        __le32  i_flags;        /* File flags */
     193        union {
     194                struct {
     195                        __le32  l_i_reserved1;
     196                } linux1;
     197                struct {
     198                        __le32  h_i_translator;
     199                } hurd1;
     200                struct {
     201                        __le32  m_i_reserved1;
     202                } masix1;
     203        } osd1;                         /* OS dependent 1 */
     204        __le32  i_block[EXT2_N_BLOCKS];/* Pointers to blocks */
     205        __le32  i_generation;   /* File version (for NFS) */
     206        __le32  i_file_acl;     /* File ACL */
     207        __le32  i_dir_acl;      /* Directory ACL */
     208        __le32  i_faddr;        /* Fragment address */
     209        union {
     210                struct {
     211                        __u8    l_i_frag;       /* Fragment number */
     212                        __u8    l_i_fsize;      /* Fragment size */
     213                        __u16   i_pad1;
     214                        __le16  l_i_uid_high;   /* these 2 fields    */
     215                        __le16  l_i_gid_high;   /* were reserved2[0] */
     216                        __u32   l_i_reserved2;
     217                } linux2;
     218                struct {
     219                        __u8    h_i_frag;       /* Fragment number */
     220                        __u8    h_i_fsize;      /* Fragment size */
     221                        __le16  h_i_mode_high;
     222                        __le16  h_i_uid_high;
     223                        __le16  h_i_gid_high;
     224                        __le32  h_i_author;
     225                } hurd2;
     226                struct {
     227                        __u8    m_i_frag;       /* Fragment number */
     228                        __u8    m_i_fsize;      /* Fragment size */
     229                        __u16   m_pad1;
     230                        __u32   m_i_reserved2[2];
     231                } masix2;
     232        } osd2;                         /* OS dependent 2 */
     233};
     234
     235#define i_size_high     i_dir_acl
     236
     237#if defined(__KERNEL__) || defined(__linux__)
     238#define i_reserved1     osd1.linux1.l_i_reserved1
     239#define i_frag          osd2.linux2.l_i_frag
     240#define i_fsize         osd2.linux2.l_i_fsize
     241#define i_uid_low       i_uid
     242#define i_gid_low       i_gid
     243#define i_uid_high      osd2.linux2.l_i_uid_high
     244#define i_gid_high      osd2.linux2.l_i_gid_high
     245#define i_reserved2     osd2.linux2.l_i_reserved2
     246#endif
     247
     248#ifdef  __hurd__
     249#define i_translator    osd1.hurd1.h_i_translator
     250#define i_frag          osd2.hurd2.h_i_frag;
     251#define i_fsize         osd2.hurd2.h_i_fsize;
     252#define i_uid_high      osd2.hurd2.h_i_uid_high
     253#define i_gid_high      osd2.hurd2.h_i_gid_high
     254#define i_author        osd2.hurd2.h_i_author
     255#endif
     256
     257#ifdef  __masix__
     258#define i_reserved1     osd1.masix1.m_i_reserved1
     259#define i_frag          osd2.masix2.m_i_frag
     260#define i_fsize         osd2.masix2.m_i_fsize
     261#define i_reserved2     osd2.masix2.m_i_reserved2
     262#endif
     263
     264/*
     265 * File system states
     266 */
     267#define EXT2_VALID_FS                   0x0001  /* Unmounted cleanly */
     268#define EXT2_ERROR_FS                   0x0002  /* Errors detected */
     269
     270/*
     271 * Mount flags
     272 */
     273#define EXT2_MOUNT_CHECK                0x000001  /* Do mount-time checks */
     274#define EXT2_MOUNT_OLDALLOC             0x000002  /* Don't use the new Orlov allocator */
     275#define EXT2_MOUNT_GRPID                0x000004  /* Create files with directory's group */
     276#define EXT2_MOUNT_DEBUG                0x000008  /* Some debugging messages */
     277#define EXT2_MOUNT_ERRORS_CONT          0x000010  /* Continue on errors */
     278#define EXT2_MOUNT_ERRORS_RO            0x000020  /* Remount fs ro on errors */
     279#define EXT2_MOUNT_ERRORS_PANIC         0x000040  /* Panic on errors */
     280#define EXT2_MOUNT_MINIX_DF             0x000080  /* Mimics the Minix statfs */
     281#define EXT2_MOUNT_NOBH                 0x000100  /* No buffer_heads */
     282#define EXT2_MOUNT_NO_UID32             0x000200  /* Disable 32-bit UIDs */
     283#define EXT2_MOUNT_XATTR_USER           0x004000  /* Extended user attributes */
     284#define EXT2_MOUNT_POSIX_ACL            0x008000  /* POSIX Access Control Lists */
     285#define EXT2_MOUNT_XIP                  0x010000  /* Execute in place */
     286#define EXT2_MOUNT_USRQUOTA             0x020000 /* user quota */
     287#define EXT2_MOUNT_GRPQUOTA             0x040000 /* group quota */
     288
     289
     290#define clear_opt(o, opt)               o &= ~EXT2_MOUNT_##opt
     291#define set_opt(o, opt)                 o |= EXT2_MOUNT_##opt
     292#define test_opt(sb, opt)               (EXT2_SB(sb)->s_mount_opt & \
     293                                         EXT2_MOUNT_##opt)
     294/*
     295 * Maximal mount counts between two filesystem checks
     296 */
     297#define EXT2_DFL_MAX_MNT_COUNT          20      /* Allow 20 mounts */
     298#define EXT2_DFL_CHECKINTERVAL          0       /* Don't use interval check */
     299
     300/*
     301 * Behaviour when detecting errors
     302 */
     303#define EXT2_ERRORS_CONTINUE            1       /* Continue execution */
     304#define EXT2_ERRORS_RO                  2       /* Remount fs read-only */
     305#define EXT2_ERRORS_PANIC               3       /* Panic */
     306#define EXT2_ERRORS_DEFAULT             EXT2_ERRORS_CONTINUE
     307
     308/*
     309 * Structure of the super block
     310 */
     311struct ext2_super_block {
     312        __le32  s_inodes_count;         /* Inodes count */
     313        __le32  s_blocks_count;         /* Blocks count */
     314        __le32  s_r_blocks_count;       /* Reserved blocks count */
     315        __le32  s_free_blocks_count;    /* Free blocks count */
     316        __le32  s_free_inodes_count;    /* Free inodes count */
     317        __le32  s_first_data_block;     /* First Data Block */
     318        __le32  s_log_block_size;       /* Block size */
     319        __le32  s_log_frag_size;        /* Fragment size */
     320        __le32  s_blocks_per_group;     /* # Blocks per group */
     321        __le32  s_frags_per_group;      /* # Fragments per group */
     322        __le32  s_inodes_per_group;     /* # Inodes per group */
     323        __le32  s_mtime;                /* Mount time */
     324        __le32  s_wtime;                /* Write time */
     325        __le16  s_mnt_count;            /* Mount count */
     326        __le16  s_max_mnt_count;        /* Maximal mount count */
     327        __le16  s_magic;                /* Magic signature */
     328        __le16  s_state;                /* File system state */
     329        __le16  s_errors;               /* Behaviour when detecting errors */
     330        __le16  s_minor_rev_level;      /* minor revision level */
     331        __le32  s_lastcheck;            /* time of last check */
     332        __le32  s_checkinterval;        /* max. time between checks */
     333        __le32  s_creator_os;           /* OS */
     334        __le32  s_rev_level;            /* Revision level */
     335        __le16  s_def_resuid;           /* Default uid for reserved blocks */
     336        __le16  s_def_resgid;           /* Default gid for reserved blocks */
     337        /*
     338         * These fields are for EXT2_DYNAMIC_REV superblocks only.
     339         *
     340         * Note: the difference between the compatible feature set and
     341         * the incompatible feature set is that if there is a bit set
     342         * in the incompatible feature set that the kernel doesn't
     343         * know about, it should refuse to mount the filesystem.
     344         *
     345         * e2fsck's requirements are more strict; if it doesn't know
     346         * about a feature in either the compatible or incompatible
     347         * feature set, it must abort and not try to meddle with
     348         * things it doesn't understand...
     349         */
     350        __le32  s_first_ino;            /* First non-reserved inode */
     351        __le16   s_inode_size;          /* size of inode structure */
     352        __le16  s_block_group_nr;       /* block group # of this superblock */
     353        __le32  s_feature_compat;       /* compatible feature set */
     354        __le32  s_feature_incompat;     /* incompatible feature set */
     355        __le32  s_feature_ro_compat;    /* readonly-compatible feature set */
     356        __u8    s_uuid[16];             /* 128-bit uuid for volume */
     357        char    s_volume_name[16];      /* volume name */
     358        char    s_last_mounted[64];     /* directory where last mounted */
     359        __le32  s_algorithm_usage_bitmap; /* For compression */
     360        /*
     361         * Performance hints.  Directory preallocation should only
     362         * happen if the EXT2_COMPAT_PREALLOC flag is on.
     363         */
     364        __u8    s_prealloc_blocks;      /* Nr of blocks to try to preallocate*/
     365        __u8    s_prealloc_dir_blocks;  /* Nr to preallocate for dirs */
     366        __u16   s_padding1;
     367        /*
     368         * Journaling support valid if EXT3_FEATURE_COMPAT_HAS_JOURNAL set.
     369         */
     370        __u8    s_journal_uuid[16];     /* uuid of journal superblock */
     371        __u32   s_journal_inum;         /* inode number of journal file */
     372        __u32   s_journal_dev;          /* device number of journal file */
     373        __u32   s_last_orphan;          /* start of list of inodes to delete */
     374        __u32   s_hash_seed[4];         /* HTREE hash seed */
     375        __u8    s_def_hash_version;     /* Default hash version to use */
     376        __u8    s_reserved_char_pad;
     377        __u16   s_reserved_word_pad;
     378        __le32  s_default_mount_opts;
     379        __le32  s_first_meta_bg;        /* First metablock block group */
     380        __u32   s_reserved[190];        /* Padding to the end of the block */
     381};
     382
     383/*
     384 * Codes for operating systems
     385 */
     386#define EXT2_OS_LINUX           0
     387#define EXT2_OS_HURD            1
     388#define EXT2_OS_MASIX           2
     389#define EXT2_OS_FREEBSD         3
     390#define EXT2_OS_LITES           4
     391
     392/*
     393 * Revision levels
     394 */
     395#define EXT2_GOOD_OLD_REV       0       /* The good old (original) format */
     396#define EXT2_DYNAMIC_REV        1       /* V2 format w/ dynamic inode sizes */
     397
     398#define EXT2_CURRENT_REV        EXT2_GOOD_OLD_REV
     399#define EXT2_MAX_SUPP_REV       EXT2_DYNAMIC_REV
     400
     401#define EXT2_GOOD_OLD_INODE_SIZE 128
     402
     403/*
     404 * Feature set definitions
     405 */
     406
     407#define EXT2_HAS_COMPAT_FEATURE(sb,mask)                        \
     408        ( EXT2_SB(sb)->s_es->s_feature_compat & cpu_to_le32(mask) )
     409#define EXT2_HAS_RO_COMPAT_FEATURE(sb,mask)                     \
     410        ( EXT2_SB(sb)->s_es->s_feature_ro_compat & cpu_to_le32(mask) )
     411#define EXT2_HAS_INCOMPAT_FEATURE(sb,mask)                      \
     412        ( EXT2_SB(sb)->s_es->s_feature_incompat & cpu_to_le32(mask) )
     413#define EXT2_SET_COMPAT_FEATURE(sb,mask)                        \
     414        EXT2_SB(sb)->s_es->s_feature_compat |= cpu_to_le32(mask)
     415#define EXT2_SET_RO_COMPAT_FEATURE(sb,mask)                     \
     416        EXT2_SB(sb)->s_es->s_feature_ro_compat |= cpu_to_le32(mask)
     417#define EXT2_SET_INCOMPAT_FEATURE(sb,mask)                      \
     418        EXT2_SB(sb)->s_es->s_feature_incompat |= cpu_to_le32(mask)
     419#define EXT2_CLEAR_COMPAT_FEATURE(sb,mask)                      \
     420        EXT2_SB(sb)->s_es->s_feature_compat &= ~cpu_to_le32(mask)
     421#define EXT2_CLEAR_RO_COMPAT_FEATURE(sb,mask)                   \
     422        EXT2_SB(sb)->s_es->s_feature_ro_compat &= ~cpu_to_le32(mask)
     423#define EXT2_CLEAR_INCOMPAT_FEATURE(sb,mask)                    \
     424        EXT2_SB(sb)->s_es->s_feature_incompat &= ~cpu_to_le32(mask)
     425
     426#define EXT2_FEATURE_COMPAT_DIR_PREALLOC        0x0001
     427#define EXT2_FEATURE_COMPAT_IMAGIC_INODES       0x0002
     428#define EXT3_FEATURE_COMPAT_HAS_JOURNAL         0x0004
     429#define EXT2_FEATURE_COMPAT_EXT_ATTR            0x0008
     430#define EXT2_FEATURE_COMPAT_RESIZE_INO          0x0010
     431#define EXT2_FEATURE_COMPAT_DIR_INDEX           0x0020
     432#define EXT2_FEATURE_COMPAT_ANY                 0xffffffff
     433
     434#define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER     0x0001
     435#define EXT2_FEATURE_RO_COMPAT_LARGE_FILE       0x0002
     436#define EXT2_FEATURE_RO_COMPAT_BTREE_DIR        0x0004
     437#define EXT2_FEATURE_RO_COMPAT_ANY              0xffffffff
     438
     439#define EXT2_FEATURE_INCOMPAT_COMPRESSION       0x0001
     440#define EXT2_FEATURE_INCOMPAT_FILETYPE          0x0002
     441#define EXT3_FEATURE_INCOMPAT_RECOVER           0x0004
     442#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV       0x0008
     443#define EXT2_FEATURE_INCOMPAT_META_BG           0x0010
     444#define EXT2_FEATURE_INCOMPAT_ANY               0xffffffff
     445
     446#define EXT2_FEATURE_COMPAT_SUPP        EXT2_FEATURE_COMPAT_EXT_ATTR
     447#define EXT2_FEATURE_INCOMPAT_SUPP      (EXT2_FEATURE_INCOMPAT_FILETYPE| \
     448                                         EXT2_FEATURE_INCOMPAT_META_BG)
     449#define EXT2_FEATURE_RO_COMPAT_SUPP     (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER| \
     450                                         EXT2_FEATURE_RO_COMPAT_LARGE_FILE| \
     451                                         EXT2_FEATURE_RO_COMPAT_BTREE_DIR)
     452#define EXT2_FEATURE_RO_COMPAT_UNSUPPORTED      ~EXT2_FEATURE_RO_COMPAT_SUPP
     453#define EXT2_FEATURE_INCOMPAT_UNSUPPORTED       ~EXT2_FEATURE_INCOMPAT_SUPP
     454
     455/*
     456 * Default values for user and/or group using reserved blocks
     457 */
     458#define EXT2_DEF_RESUID         0
     459#define EXT2_DEF_RESGID         0
     460
     461/*
     462 * Default mount options
     463 */
     464#define EXT2_DEFM_DEBUG         0x0001
     465#define EXT2_DEFM_BSDGROUPS     0x0002
     466#define EXT2_DEFM_XATTR_USER    0x0004
     467#define EXT2_DEFM_ACL           0x0008
     468#define EXT2_DEFM_UID16         0x0010
     469    /* Not used by ext2, but reserved for use by ext3 */
     470#define EXT3_DEFM_JMODE         0x0060
     471#define EXT3_DEFM_JMODE_DATA    0x0020
     472#define EXT3_DEFM_JMODE_ORDERED 0x0040
     473#define EXT3_DEFM_JMODE_WBACK   0x0060
     474
     475/*
     476 * Structure of a directory entry
     477 */
     478#define EXT2_NAME_LEN 255
     479
     480struct ext2_dir_entry {
     481        __le32  inode;                  /* Inode number */
     482        __le16  rec_len;                /* Directory entry length */
     483        __le16  name_len;               /* Name length */
     484        char    name[EXT2_NAME_LEN];    /* File name */
     485};
     486
     487/*
     488 * The new version of the directory entry.  Since EXT2 structures are
     489 * stored in intel byte order, and the name_len field could never be
     490 * bigger than 255 chars, it's safe to reclaim the extra byte for the
     491 * file_type field.
     492 */
     493struct ext2_dir_entry_2 {
     494        __le32  inode;                  /* Inode number */
     495        __le16  rec_len;                /* Directory entry length */
     496        __u8    name_len;               /* Name length */
     497        __u8    file_type;
     498        char    name[EXT2_NAME_LEN];    /* File name */
     499};
     500
     501/*
     502 * Ext2 directory file types.  Only the low 3 bits are used.  The
     503 * other bits are reserved for now.
     504 */
     505enum {
     506        EXT2_FT_UNKNOWN,
     507        EXT2_FT_REG_FILE,
     508        EXT2_FT_DIR,
     509        EXT2_FT_CHRDEV,
     510        EXT2_FT_BLKDEV,
     511        EXT2_FT_FIFO,
     512        EXT2_FT_SOCK,
     513        EXT2_FT_SYMLINK,
     514        EXT2_FT_MAX
     515};
     516
     517/*
     518 * EXT2_DIR_PAD defines the directory entries boundaries
     519 *
     520 * NOTE: It must be a multiple of 4
     521 */
     522#define EXT2_DIR_PAD                    4
     523#define EXT2_DIR_ROUND                  (EXT2_DIR_PAD - 1)
     524#define EXT2_DIR_REC_LEN(name_len)      (((name_len) + 8 + EXT2_DIR_ROUND) & \
     525                                         ~EXT2_DIR_ROUND)
     526
     527#endif  /* _LINUX_EXT2_FS_H */
  • include/linux/fs.h

    diff -Naur aboot-0.9b.orig/include/linux/fs.h aboot-0.9b/include/linux/fs.h
    old new  
     1#ifndef _LINUX_FS_H
     2#define _LINUX_FS_H
     3
     4/*
     5 * This file has definitions for some important file table
     6 * structures etc.
     7 */
     8
     9#include <linux/limits.h>
     10#include <linux/ioctl.h>
     11
     12/*
     13 * It's silly to have NR_OPEN bigger than NR_FILE, but you can change
     14 * the file limit at runtime and only root can increase the per-process
     15 * nr_file rlimit, so it's safe to set up a ridiculously high absolute
     16 * upper limit on files-per-process.
     17 *
     18 * Some programs (notably those using select()) may have to be
     19 * recompiled to take full advantage of the new limits.. 
     20 */
     21
     22/* Fixed constants first: */
     23#undef NR_OPEN
     24#define NR_OPEN (1024*1024)     /* Absolute upper limit on fd num */
     25#define INR_OPEN 1024           /* Initial setting for nfile rlimits */
     26
     27#define BLOCK_SIZE_BITS 10
     28#define BLOCK_SIZE (1<<BLOCK_SIZE_BITS)
     29
     30#define SEEK_SET        0       /* seek relative to beginning of file */
     31#define SEEK_CUR        1       /* seek relative to current file position */
     32#define SEEK_END        2       /* seek relative to end of file */
     33#define SEEK_MAX        SEEK_END
     34
     35/* And dynamically-tunable limits and defaults: */
     36struct files_stat_struct {
     37        int nr_files;           /* read only */
     38        int nr_free_files;      /* read only */
     39        int max_files;          /* tunable */
     40};
     41extern struct files_stat_struct files_stat;
     42extern int get_max_files(void);
     43
     44struct inodes_stat_t {
     45        int nr_inodes;
     46        int nr_unused;
     47        int dummy[5];           /* padding for sysctl ABI compatibility */
     48};
     49extern struct inodes_stat_t inodes_stat;
     50
     51extern int leases_enable, lease_break_time;
     52
     53#ifdef CONFIG_DNOTIFY
     54extern int dir_notify_enable;
     55#endif
     56
     57#define NR_FILE  8192   /* this can well be larger on a larger system */
     58
     59#define MAY_EXEC 1
     60#define MAY_WRITE 2
     61#define MAY_READ 4
     62#define MAY_APPEND 8
     63
     64#define FMODE_READ 1
     65#define FMODE_WRITE 2
     66
     67/* Internal kernel extensions */
     68#define FMODE_LSEEK     4
     69#define FMODE_PREAD     8
     70#define FMODE_PWRITE    FMODE_PREAD     /* These go hand in hand */
     71
     72/* File is being opened for execution. Primary users of this flag are
     73   distributed filesystems that can use it to achieve correct ETXTBUSY
     74   behavior for cross-node execution/opening_for_writing of files */
     75#define FMODE_EXEC      16
     76
     77#define RW_MASK         1
     78#define RWA_MASK        2
     79#define READ 0
     80#define WRITE 1
     81#define READA 2         /* read-ahead  - don't block if no resources */
     82#define SWRITE 3        /* for ll_rw_block() - wait for buffer lock */
     83#define READ_SYNC       (READ | (1 << BIO_RW_SYNC))
     84#define READ_META       (READ | (1 << BIO_RW_META))
     85#define WRITE_SYNC      (WRITE | (1 << BIO_RW_SYNC))
     86#define WRITE_BARRIER   ((1 << BIO_RW) | (1 << BIO_RW_BARRIER))
     87
     88#define SEL_IN          1
     89#define SEL_OUT         2
     90#define SEL_EX          4
     91
     92/* public flags for file_system_type */
     93#define FS_REQUIRES_DEV 1
     94#define FS_BINARY_MOUNTDATA 2
     95#define FS_HAS_SUBTYPE 4
     96#define FS_REVAL_DOT    16384   /* Check the paths ".", ".." for staleness */
     97#define FS_RENAME_DOES_D_MOVE   32768   /* FS will handle d_move()
     98                                         * during rename() internally.
     99                                         */
     100
     101/*
     102 * These are the fs-independent mount-flags: up to 32 flags are supported
     103 */
     104#define MS_RDONLY        1      /* Mount read-only */
     105#define MS_NOSUID        2      /* Ignore suid and sgid bits */
     106#define MS_NODEV         4      /* Disallow access to device special files */
     107#define MS_NOEXEC        8      /* Disallow program execution */
     108#define MS_SYNCHRONOUS  16      /* Writes are synced at once */
     109#define MS_REMOUNT      32      /* Alter flags of a mounted FS */
     110#define MS_MANDLOCK     64      /* Allow mandatory locks on an FS */
     111#define MS_DIRSYNC      128     /* Directory modifications are synchronous */
     112#define MS_NOATIME      1024    /* Do not update access times. */
     113#define MS_NODIRATIME   2048    /* Do not update directory access times */
     114#define MS_BIND         4096
     115#define MS_MOVE         8192
     116#define MS_REC          16384
     117#define MS_VERBOSE      32768   /* War is peace. Verbosity is silence.
     118                                   MS_VERBOSE is deprecated. */
     119#define MS_SILENT       32768
     120#define MS_POSIXACL     (1<<16) /* VFS does not apply the umask */
     121#define MS_UNBINDABLE   (1<<17) /* change to unbindable */
     122#define MS_PRIVATE      (1<<18) /* change to private */
     123#define MS_SLAVE        (1<<19) /* change to slave */
     124#define MS_SHARED       (1<<20) /* change to shared */
     125#define MS_RELATIME     (1<<21) /* Update atime relative to mtime/ctime. */
     126#define MS_ACTIVE       (1<<30)
     127#define MS_NOUSER       (1<<31)
     128
     129/*
     130 * Superblock flags that can be altered by MS_REMOUNT
     131 */
     132#define MS_RMT_MASK     (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK)
     133
     134/*
     135 * Old magic mount flag and mask
     136 */
     137#define MS_MGC_VAL 0xC0ED0000
     138#define MS_MGC_MSK 0xffff0000
     139
     140/* Inode flags - they have nothing to superblock flags now */
     141
     142#define S_SYNC          1       /* Writes are synced at once */
     143#define S_NOATIME       2       /* Do not update access times */
     144#define S_APPEND        4       /* Append-only file */
     145#define S_IMMUTABLE     8       /* Immutable file */
     146#define S_DEAD          16      /* removed, but still open directory */
     147#define S_NOQUOTA       32      /* Inode is not counted to quota */
     148#define S_DIRSYNC       64      /* Directory modifications are synchronous */
     149#define S_NOCMTIME      128     /* Do not update file c/mtime */
     150#define S_SWAPFILE      256     /* Do not truncate: swapon got its bmaps */
     151#define S_PRIVATE       512     /* Inode is fs-internal */
     152
     153/*
     154 * Note that nosuid etc flags are inode-specific: setting some file-system
     155 * flags just means all the inodes inherit those flags by default. It might be
     156 * possible to override it selectively if you really wanted to with some
     157 * ioctl() that is not currently implemented.
     158 *
     159 * Exception: MS_RDONLY is always applied to the entire file system.
     160 *
     161 * Unfortunately, it is possible to change a filesystems flags with it mounted
     162 * with files in use.  This means that all of the inodes will not have their
     163 * i_flags updated.  Hence, i_flags no longer inherit the superblock mount
     164 * flags, so these have to be checked separately. -- rmk@arm.uk.linux.org
     165 */
     166#define __IS_FLG(inode,flg) ((inode)->i_sb->s_flags & (flg))
     167
     168#define IS_RDONLY(inode) ((inode)->i_sb->s_flags & MS_RDONLY)
     169#define IS_SYNC(inode)          (__IS_FLG(inode, MS_SYNCHRONOUS) || \
     170                                        ((inode)->i_flags & S_SYNC))
     171#define IS_DIRSYNC(inode)       (__IS_FLG(inode, MS_SYNCHRONOUS|MS_DIRSYNC) || \
     172                                        ((inode)->i_flags & (S_SYNC|S_DIRSYNC)))
     173#define IS_MANDLOCK(inode)      __IS_FLG(inode, MS_MANDLOCK)
     174#define IS_NOATIME(inode)   __IS_FLG(inode, MS_RDONLY|MS_NOATIME)
     175
     176#define IS_NOQUOTA(inode)       ((inode)->i_flags & S_NOQUOTA)
     177#define IS_APPEND(inode)        ((inode)->i_flags & S_APPEND)
     178#define IS_IMMUTABLE(inode)     ((inode)->i_flags & S_IMMUTABLE)
     179#define IS_POSIXACL(inode)      __IS_FLG(inode, MS_POSIXACL)
     180
     181#define IS_DEADDIR(inode)       ((inode)->i_flags & S_DEAD)
     182#define IS_NOCMTIME(inode)      ((inode)->i_flags & S_NOCMTIME)
     183#define IS_SWAPFILE(inode)      ((inode)->i_flags & S_SWAPFILE)
     184#define IS_PRIVATE(inode)       ((inode)->i_flags & S_PRIVATE)
     185
     186/* the read-only stuff doesn't really belong here, but any other place is
     187   probably as bad and I don't want to create yet another include file. */
     188
     189#define BLKROSET   _IO(0x12,93) /* set device read-only (0 = read-write) */
     190#define BLKROGET   _IO(0x12,94) /* get read-only status (0 = read_write) */
     191#define BLKRRPART  _IO(0x12,95) /* re-read partition table */
     192#define BLKGETSIZE _IO(0x12,96) /* return device size /512 (long *arg) */
     193#define BLKFLSBUF  _IO(0x12,97) /* flush buffer cache */
     194#define BLKRASET   _IO(0x12,98) /* set read ahead for block device */
     195#define BLKRAGET   _IO(0x12,99) /* get current read ahead setting */
     196#define BLKFRASET  _IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */
     197#define BLKFRAGET  _IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */
     198#define BLKSECTSET _IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */
     199#define BLKSECTGET _IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */
     200#define BLKSSZGET  _IO(0x12,104)/* get block device sector size */
     201#if 0
     202#define BLKPG      _IO(0x12,105)/* See blkpg.h */
     203
     204/* Some people are morons.  Do not use sizeof! */
     205
     206#define BLKELVGET  _IOR(0x12,106,size_t)/* elevator get */
     207#define BLKELVSET  _IOW(0x12,107,size_t)/* elevator set */
     208/* This was here just to show that the number is taken -
     209   probably all these _IO(0x12,*) ioctls should be moved to blkpg.h. */
     210#endif
     211/* A jump here: 108-111 have been used for various private purposes. */
     212#define BLKBSZGET  _IOR(0x12,112,size_t)
     213#define BLKBSZSET  _IOW(0x12,113,size_t)
     214#define BLKGETSIZE64 _IOR(0x12,114,size_t)      /* return device size in bytes (u64 *arg) */
     215#define BLKTRACESETUP _IOWR(0x12,115,struct blk_user_trace_setup)
     216#define BLKTRACESTART _IO(0x12,116)
     217#define BLKTRACESTOP _IO(0x12,117)
     218#define BLKTRACETEARDOWN _IO(0x12,118)
     219
     220#define BMAP_IOCTL 1            /* obsolete - kept for compatibility */
     221#define FIBMAP     _IO(0x00,1)  /* bmap access */
     222#define FIGETBSZ   _IO(0x00,2)  /* get the block size used for bmap */
     223
     224#define FS_IOC_GETFLAGS                 _IOR('f', 1, long)
     225#define FS_IOC_SETFLAGS                 _IOW('f', 2, long)
     226#define FS_IOC_GETVERSION               _IOR('v', 1, long)
     227#define FS_IOC_SETVERSION               _IOW('v', 2, long)
     228#define FS_IOC32_GETFLAGS               _IOR('f', 1, int)
     229#define FS_IOC32_SETFLAGS               _IOW('f', 2, int)
     230#define FS_IOC32_GETVERSION             _IOR('v', 1, int)
     231#define FS_IOC32_SETVERSION             _IOW('v', 2, int)
     232
     233/*
     234 * Inode flags (FS_IOC_GETFLAGS / FS_IOC_SETFLAGS)
     235 */
     236#define FS_SECRM_FL                     0x00000001 /* Secure deletion */
     237#define FS_UNRM_FL                      0x00000002 /* Undelete */
     238#define FS_COMPR_FL                     0x00000004 /* Compress file */
     239#define FS_SYNC_FL                      0x00000008 /* Synchronous updates */
     240#define FS_IMMUTABLE_FL                 0x00000010 /* Immutable file */
     241#define FS_APPEND_FL                    0x00000020 /* writes to file may only append */
     242#define FS_NODUMP_FL                    0x00000040 /* do not dump file */
     243#define FS_NOATIME_FL                   0x00000080 /* do not update atime */
     244/* Reserved for compression usage... */
     245#define FS_DIRTY_FL                     0x00000100
     246#define FS_COMPRBLK_FL                  0x00000200 /* One or more compressed clusters */
     247#define FS_NOCOMP_FL                    0x00000400 /* Don't compress */
     248#define FS_ECOMPR_FL                    0x00000800 /* Compression error */
     249/* End compression flags --- maybe not all used */
     250#define FS_BTREE_FL                     0x00001000 /* btree format dir */
     251#define FS_INDEX_FL                     0x00001000 /* hash-indexed directory */
     252#define FS_IMAGIC_FL                    0x00002000 /* AFS directory */
     253#define FS_JOURNAL_DATA_FL              0x00004000 /* Reserved for ext3 */
     254#define FS_NOTAIL_FL                    0x00008000 /* file tail should not be merged */
     255#define FS_DIRSYNC_FL                   0x00010000 /* dirsync behaviour (directories only) */
     256#define FS_TOPDIR_FL                    0x00020000 /* Top of directory hierarchies*/
     257#define FS_EXTENT_FL                    0x00080000 /* Extents */
     258#define FS_DIRECTIO_FL                  0x00100000 /* Use direct i/o */
     259#define FS_RESERVED_FL                  0x80000000 /* reserved for ext2 lib */
     260
     261#define FS_FL_USER_VISIBLE              0x0003DFFF /* User visible flags */
     262#define FS_FL_USER_MODIFIABLE           0x000380FF /* User modifiable flags */
     263
     264
     265#define SYNC_FILE_RANGE_WAIT_BEFORE     1
     266#define SYNC_FILE_RANGE_WRITE           2
     267#define SYNC_FILE_RANGE_WAIT_AFTER      4
     268
     269#endif /* _LINUX_FS_H */
  • include/linux/hdreg.h

    diff -Naur aboot-0.9b.orig/include/linux/hdreg.h aboot-0.9b/include/linux/hdreg.h
    old new  
     1#ifndef _LINUX_HDREG_H
     2#define _LINUX_HDREG_H
     3
     4
     5#include <linux/types.h>
     6
     7/*
     8 * Command Header sizes for IOCTL commands
     9 */
     10
     11#define HDIO_DRIVE_CMD_HDR_SIZE         (4 * sizeof(__u8))
     12#define HDIO_DRIVE_HOB_HDR_SIZE         (8 * sizeof(__u8))
     13#define HDIO_DRIVE_TASK_HDR_SIZE        (8 * sizeof(__u8))
     14
     15#define IDE_DRIVE_TASK_INVALID          -1
     16#define IDE_DRIVE_TASK_NO_DATA          0
     17#define IDE_DRIVE_TASK_SET_XFER         1
     18
     19#define IDE_DRIVE_TASK_IN               2
     20
     21#define IDE_DRIVE_TASK_OUT              3
     22#define IDE_DRIVE_TASK_RAW_WRITE        4
     23
     24/*
     25 * Define standard taskfile in/out register
     26 */
     27#define IDE_TASKFILE_STD_IN_FLAGS       0xFE
     28#define IDE_HOB_STD_IN_FLAGS            0x3C
     29#define IDE_TASKFILE_STD_OUT_FLAGS      0xFE
     30#define IDE_HOB_STD_OUT_FLAGS           0x3C
     31
     32typedef unsigned char task_ioreg_t;
     33typedef unsigned long sata_ioreg_t;
     34
     35typedef union ide_reg_valid_s {
     36        unsigned all                            : 16;
     37        struct {
     38                unsigned data                   : 1;
     39                unsigned error_feature          : 1;
     40                unsigned sector                 : 1;
     41                unsigned nsector                : 1;
     42                unsigned lcyl                   : 1;
     43                unsigned hcyl                   : 1;
     44                unsigned select                 : 1;
     45                unsigned status_command         : 1;
     46
     47                unsigned data_hob               : 1;
     48                unsigned error_feature_hob      : 1;
     49                unsigned sector_hob             : 1;
     50                unsigned nsector_hob            : 1;
     51                unsigned lcyl_hob               : 1;
     52                unsigned hcyl_hob               : 1;
     53                unsigned select_hob             : 1;
     54                unsigned control_hob            : 1;
     55        } b;
     56} ide_reg_valid_t;
     57
     58typedef struct ide_task_request_s {
     59        task_ioreg_t    io_ports[8];
     60        task_ioreg_t    hob_ports[8];
     61        ide_reg_valid_t out_flags;
     62        ide_reg_valid_t in_flags;
     63        int             data_phase;
     64        int             req_cmd;
     65        unsigned long   out_size;
     66        unsigned long   in_size;
     67} ide_task_request_t;
     68
     69typedef struct ide_ioctl_request_s {
     70        ide_task_request_t      *task_request;
     71        unsigned char           *out_buffer;
     72        unsigned char           *in_buffer;
     73} ide_ioctl_request_t;
     74
     75struct hd_drive_cmd_hdr {
     76        task_ioreg_t command;
     77        task_ioreg_t sector_number;
     78        task_ioreg_t feature;
     79        task_ioreg_t sector_count;
     80};
     81
     82typedef struct hd_drive_task_hdr {
     83        task_ioreg_t data;
     84        task_ioreg_t feature;
     85        task_ioreg_t sector_count;
     86        task_ioreg_t sector_number;
     87        task_ioreg_t low_cylinder;
     88        task_ioreg_t high_cylinder;
     89        task_ioreg_t device_head;
     90        task_ioreg_t command;
     91} task_struct_t;
     92
     93typedef struct hd_drive_hob_hdr {
     94        task_ioreg_t data;
     95        task_ioreg_t feature;
     96        task_ioreg_t sector_count;
     97        task_ioreg_t sector_number;
     98        task_ioreg_t low_cylinder;
     99        task_ioreg_t high_cylinder;
     100        task_ioreg_t device_head;
     101        task_ioreg_t control;
     102} hob_struct_t;
     103
     104#define TASKFILE_INVALID                0x7fff
     105#define TASKFILE_48                     0x8000
     106
     107#define TASKFILE_NO_DATA                0x0000
     108
     109#define TASKFILE_IN                     0x0001
     110#define TASKFILE_MULTI_IN               0x0002
     111
     112#define TASKFILE_OUT                    0x0004
     113#define TASKFILE_MULTI_OUT              0x0008
     114#define TASKFILE_IN_OUT                 0x0010
     115
     116#define TASKFILE_IN_DMA                 0x0020
     117#define TASKFILE_OUT_DMA                0x0040
     118#define TASKFILE_IN_DMAQ                0x0080
     119#define TASKFILE_OUT_DMAQ               0x0100
     120
     121#define TASKFILE_P_IN                   0x0200
     122#define TASKFILE_P_OUT                  0x0400
     123#define TASKFILE_P_IN_DMA               0x0800
     124#define TASKFILE_P_OUT_DMA              0x1000
     125#define TASKFILE_P_IN_DMAQ              0x2000
     126#define TASKFILE_P_OUT_DMAQ             0x4000
     127
     128/* ATA/ATAPI Commands pre T13 Spec */
     129#define WIN_NOP                         0x00
     130/*
     131 *      0x01->0x02 Reserved
     132 */
     133#define CFA_REQ_EXT_ERROR_CODE          0x03 /* CFA Request Extended Error Code */
     134/*
     135 *      0x04->0x07 Reserved
     136 */
     137#define WIN_SRST                        0x08 /* ATAPI soft reset command */
     138#define WIN_DEVICE_RESET                0x08
     139/*
     140 *      0x09->0x0F Reserved
     141 */
     142#define WIN_RECAL                       0x10
     143#define WIN_RESTORE                     WIN_RECAL
     144/*
     145 *      0x10->0x1F Reserved
     146 */
     147#define WIN_READ                        0x20 /* 28-Bit */
     148#define WIN_READ_ONCE                   0x21 /* 28-Bit without retries */
     149#define WIN_READ_LONG                   0x22 /* 28-Bit */
     150#define WIN_READ_LONG_ONCE              0x23 /* 28-Bit without retries */
     151#define WIN_READ_EXT                    0x24 /* 48-Bit */
     152#define WIN_READDMA_EXT                 0x25 /* 48-Bit */
     153#define WIN_READDMA_QUEUED_EXT          0x26 /* 48-Bit */
     154#define WIN_READ_NATIVE_MAX_EXT         0x27 /* 48-Bit */
     155/*
     156 *      0x28
     157 */
     158#define WIN_MULTREAD_EXT                0x29 /* 48-Bit */
     159/*
     160 *      0x2A->0x2F Reserved
     161 */
     162#define WIN_WRITE                       0x30 /* 28-Bit */
     163#define WIN_WRITE_ONCE                  0x31 /* 28-Bit without retries */
     164#define WIN_WRITE_LONG                  0x32 /* 28-Bit */
     165#define WIN_WRITE_LONG_ONCE             0x33 /* 28-Bit without retries */
     166#define WIN_WRITE_EXT                   0x34 /* 48-Bit */
     167#define WIN_WRITEDMA_EXT                0x35 /* 48-Bit */
     168#define WIN_WRITEDMA_QUEUED_EXT         0x36 /* 48-Bit */
     169#define WIN_SET_MAX_EXT                 0x37 /* 48-Bit */
     170#define CFA_WRITE_SECT_WO_ERASE         0x38 /* CFA Write Sectors without erase */
     171#define WIN_MULTWRITE_EXT               0x39 /* 48-Bit */
     172/*
     173 *      0x3A->0x3B Reserved
     174 */
     175#define WIN_WRITE_VERIFY                0x3C /* 28-Bit */
     176/*
     177 *      0x3D->0x3F Reserved
     178 */
     179#define WIN_VERIFY                      0x40 /* 28-Bit - Read Verify Sectors */
     180#define WIN_VERIFY_ONCE                 0x41 /* 28-Bit - without retries */
     181#define WIN_VERIFY_EXT                  0x42 /* 48-Bit */
     182/*
     183 *      0x43->0x4F Reserved
     184 */
     185#define WIN_FORMAT                      0x50
     186/*
     187 *      0x51->0x5F Reserved
     188 */
     189#define WIN_INIT                        0x60
     190/*
     191 *      0x61->0x5F Reserved
     192 */
     193#define WIN_SEEK                        0x70 /* 0x70-0x7F Reserved */
     194
     195#define CFA_TRANSLATE_SECTOR            0x87 /* CFA Translate Sector */
     196#define WIN_DIAGNOSE                    0x90
     197#define WIN_SPECIFY                     0x91 /* set drive geometry translation */
     198#define WIN_DOWNLOAD_MICROCODE          0x92
     199#define WIN_STANDBYNOW2                 0x94
     200#define WIN_STANDBY2                    0x96
     201#define WIN_SETIDLE2                    0x97
     202#define WIN_CHECKPOWERMODE2             0x98
     203#define WIN_SLEEPNOW2                   0x99
     204/*
     205 *      0x9A VENDOR
     206 */
     207#define WIN_PACKETCMD                   0xA0 /* Send a packet command. */
     208#define WIN_PIDENTIFY                   0xA1 /* identify ATAPI device   */
     209#define WIN_QUEUED_SERVICE              0xA2
     210#define WIN_SMART                       0xB0 /* self-monitoring and reporting */
     211#define CFA_ERASE_SECTORS               0xC0
     212#define WIN_MULTREAD                    0xC4 /* read sectors using multiple mode*/
     213#define WIN_MULTWRITE                   0xC5 /* write sectors using multiple mode */
     214#define WIN_SETMULT                     0xC6 /* enable/disable multiple mode */
     215#define WIN_READDMA_QUEUED              0xC7 /* read sectors using Queued DMA transfers */
     216#define WIN_READDMA                     0xC8 /* read sectors using DMA transfers */
     217#define WIN_READDMA_ONCE                0xC9 /* 28-Bit - without retries */
     218#define WIN_WRITEDMA                    0xCA /* write sectors using DMA transfers */
     219#define WIN_WRITEDMA_ONCE               0xCB /* 28-Bit - without retries */
     220#define WIN_WRITEDMA_QUEUED             0xCC /* write sectors using Queued DMA transfers */
     221#define CFA_WRITE_MULTI_WO_ERASE        0xCD /* CFA Write multiple without erase */
     222#define WIN_GETMEDIASTATUS              0xDA
     223#define WIN_ACKMEDIACHANGE              0xDB /* ATA-1, ATA-2 vendor */
     224#define WIN_POSTBOOT                    0xDC
     225#define WIN_PREBOOT                     0xDD
     226#define WIN_DOORLOCK                    0xDE /* lock door on removable drives */
     227#define WIN_DOORUNLOCK                  0xDF /* unlock door on removable drives */
     228#define WIN_STANDBYNOW1                 0xE0
     229#define WIN_IDLEIMMEDIATE               0xE1 /* force drive to become "ready" */
     230#define WIN_STANDBY                     0xE2 /* Set device in Standby Mode */
     231#define WIN_SETIDLE1                    0xE3
     232#define WIN_READ_BUFFER                 0xE4 /* force read only 1 sector */
     233#define WIN_CHECKPOWERMODE1             0xE5
     234#define WIN_SLEEPNOW1                   0xE6
     235#define WIN_FLUSH_CACHE                 0xE7
     236#define WIN_WRITE_BUFFER                0xE8 /* force write only 1 sector */
     237#define WIN_WRITE_SAME                  0xE9 /* read ata-2 to use */
     238        /* SET_FEATURES 0x22 or 0xDD */
     239#define WIN_FLUSH_CACHE_EXT             0xEA /* 48-Bit */
     240#define WIN_IDENTIFY                    0xEC /* ask drive to identify itself    */
     241#define WIN_MEDIAEJECT                  0xED
     242#define WIN_IDENTIFY_DMA                0xEE /* same as WIN_IDENTIFY, but DMA */
     243#define WIN_SETFEATURES                 0xEF /* set special drive features */
     244#define EXABYTE_ENABLE_NEST             0xF0
     245#define WIN_SECURITY_SET_PASS           0xF1
     246#define WIN_SECURITY_UNLOCK             0xF2
     247#define WIN_SECURITY_ERASE_PREPARE      0xF3
     248#define WIN_SECURITY_ERASE_UNIT         0xF4
     249#define WIN_SECURITY_FREEZE_LOCK        0xF5
     250#define WIN_SECURITY_DISABLE            0xF6
     251#define WIN_READ_NATIVE_MAX             0xF8 /* return the native maximum address */
     252#define WIN_SET_MAX                     0xF9
     253#define DISABLE_SEAGATE                 0xFB
     254
     255/* WIN_SMART sub-commands */
     256
     257#define SMART_READ_VALUES               0xD0
     258#define SMART_READ_THRESHOLDS           0xD1
     259#define SMART_AUTOSAVE                  0xD2
     260#define SMART_SAVE                      0xD3
     261#define SMART_IMMEDIATE_OFFLINE         0xD4
     262#define SMART_READ_LOG_SECTOR           0xD5
     263#define SMART_WRITE_LOG_SECTOR          0xD6
     264#define SMART_WRITE_THRESHOLDS          0xD7
     265#define SMART_ENABLE                    0xD8
     266#define SMART_DISABLE                   0xD9
     267#define SMART_STATUS                    0xDA
     268#define SMART_AUTO_OFFLINE              0xDB
     269
     270/* Password used in TF4 & TF5 executing SMART commands */
     271
     272#define SMART_LCYL_PASS                 0x4F
     273#define SMART_HCYL_PASS                 0xC2
     274
     275/* WIN_SETFEATURES sub-commands */
     276#define SETFEATURES_EN_8BIT     0x01    /* Enable 8-Bit Transfers */
     277#define SETFEATURES_EN_WCACHE   0x02    /* Enable write cache */
     278#define SETFEATURES_DIS_DEFECT  0x04    /* Disable Defect Management */
     279#define SETFEATURES_EN_APM      0x05    /* Enable advanced power management */
     280#define SETFEATURES_EN_SAME_R   0x22    /* for a region ATA-1 */
     281#define SETFEATURES_DIS_MSN     0x31    /* Disable Media Status Notification */
     282#define SETFEATURES_DIS_RETRY   0x33    /* Disable Retry */
     283#define SETFEATURES_EN_AAM      0x42    /* Enable Automatic Acoustic Management */
     284#define SETFEATURES_RW_LONG     0x44    /* Set Length of VS bytes */
     285#define SETFEATURES_SET_CACHE   0x54    /* Set Cache segments to SC Reg. Val */
     286#define SETFEATURES_DIS_RLA     0x55    /* Disable read look-ahead feature */
     287#define SETFEATURES_EN_RI       0x5D    /* Enable release interrupt */
     288#define SETFEATURES_EN_SI       0x5E    /* Enable SERVICE interrupt */
     289#define SETFEATURES_DIS_RPOD    0x66    /* Disable reverting to power on defaults */
     290#define SETFEATURES_DIS_ECC     0x77    /* Disable ECC byte count */
     291#define SETFEATURES_DIS_8BIT    0x81    /* Disable 8-Bit Transfers */
     292#define SETFEATURES_DIS_WCACHE  0x82    /* Disable write cache */
     293#define SETFEATURES_EN_DEFECT   0x84    /* Enable Defect Management */
     294#define SETFEATURES_DIS_APM     0x85    /* Disable advanced power management */
     295#define SETFEATURES_EN_ECC      0x88    /* Enable ECC byte count */
     296#define SETFEATURES_EN_MSN      0x95    /* Enable Media Status Notification */
     297#define SETFEATURES_EN_RETRY    0x99    /* Enable Retry */
     298#define SETFEATURES_EN_RLA      0xAA    /* Enable read look-ahead feature */
     299#define SETFEATURES_PREFETCH    0xAB    /* Sets drive prefetch value */
     300#define SETFEATURES_EN_REST     0xAC    /* ATA-1 */
     301#define SETFEATURES_4B_RW_LONG  0xBB    /* Set Lenght of 4 bytes */
     302#define SETFEATURES_DIS_AAM     0xC2    /* Disable Automatic Acoustic Management */
     303#define SETFEATURES_EN_RPOD     0xCC    /* Enable reverting to power on defaults */
     304#define SETFEATURES_DIS_RI      0xDD    /* Disable release interrupt ATAPI */
     305#define SETFEATURES_EN_SAME_M   0xDD    /* for a entire device ATA-1 */
     306#define SETFEATURES_DIS_SI      0xDE    /* Disable SERVICE interrupt ATAPI */
     307
     308/* WIN_SECURITY sub-commands */
     309
     310#define SECURITY_SET_PASSWORD           0xBA
     311#define SECURITY_UNLOCK                 0xBB
     312#define SECURITY_ERASE_PREPARE          0xBC
     313#define SECURITY_ERASE_UNIT             0xBD
     314#define SECURITY_FREEZE_LOCK            0xBE
     315#define SECURITY_DISABLE_PASSWORD       0xBF
     316
     317struct hd_geometry {
     318      unsigned char heads;
     319      unsigned char sectors;
     320      unsigned short cylinders;
     321      unsigned long start;
     322};
     323
     324/* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */
     325#define HDIO_GETGEO             0x0301  /* get device geometry */
     326#define HDIO_GET_UNMASKINTR     0x0302  /* get current unmask setting */
     327#define HDIO_GET_MULTCOUNT      0x0304  /* get current IDE blockmode setting */
     328#define HDIO_GET_QDMA           0x0305  /* get use-qdma flag */
     329
     330#define HDIO_SET_XFER           0x0306  /* set transfer rate via proc */
     331
     332#define HDIO_OBSOLETE_IDENTITY  0x0307  /* OBSOLETE, DO NOT USE: returns 142 bytes */
     333#define HDIO_GET_KEEPSETTINGS   0x0308  /* get keep-settings-on-reset flag */
     334#define HDIO_GET_32BIT          0x0309  /* get current io_32bit setting */
     335#define HDIO_GET_NOWERR         0x030a  /* get ignore-write-error flag */
     336#define HDIO_GET_DMA            0x030b  /* get use-dma flag */
     337#define HDIO_GET_NICE           0x030c  /* get nice flags */
     338#define HDIO_GET_IDENTITY       0x030d  /* get IDE identification info */
     339#define HDIO_GET_WCACHE         0x030e  /* get write cache mode on|off */
     340#define HDIO_GET_ACOUSTIC       0x030f  /* get acoustic value */
     341#define HDIO_GET_ADDRESS        0x0310  /* */
     342
     343#define HDIO_GET_BUSSTATE       0x031a  /* get the bus state of the hwif */
     344#define HDIO_TRISTATE_HWIF      0x031b  /* execute a channel tristate */
     345#define HDIO_DRIVE_RESET        0x031c  /* execute a device reset */
     346#define HDIO_DRIVE_TASKFILE     0x031d  /* execute raw taskfile */
     347#define HDIO_DRIVE_TASK         0x031e  /* execute task and special drive command */
     348#define HDIO_DRIVE_CMD          0x031f  /* execute a special drive command */
     349#define HDIO_DRIVE_CMD_AEB      HDIO_DRIVE_TASK
     350
     351/* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */
     352#define HDIO_SET_MULTCOUNT      0x0321  /* change IDE blockmode */
     353#define HDIO_SET_UNMASKINTR     0x0322  /* permit other irqs during I/O */
     354#define HDIO_SET_KEEPSETTINGS   0x0323  /* keep ioctl settings on reset */
     355#define HDIO_SET_32BIT          0x0324  /* change io_32bit flags */
     356#define HDIO_SET_NOWERR         0x0325  /* change ignore-write-error flag */
     357#define HDIO_SET_DMA            0x0326  /* change use-dma flag */
     358#define HDIO_SET_PIO_MODE       0x0327  /* reconfig interface to new speed */
     359#define HDIO_SCAN_HWIF          0x0328  /* register and (re)scan interface */
     360#define HDIO_SET_NICE           0x0329  /* set nice flags */
     361#define HDIO_UNREGISTER_HWIF    0x032a  /* unregister interface */
     362#define HDIO_SET_WCACHE         0x032b  /* change write cache enable-disable */
     363#define HDIO_SET_ACOUSTIC       0x032c  /* change acoustic behavior */
     364#define HDIO_SET_BUSSTATE       0x032d  /* set the bus state of the hwif */
     365#define HDIO_SET_QDMA           0x032e  /* change use-qdma flag */
     366#define HDIO_SET_ADDRESS        0x032f  /* change lba addressing modes */
     367
     368/* bus states */
     369enum {
     370        BUSSTATE_OFF = 0,
     371        BUSSTATE_ON,
     372        BUSSTATE_TRISTATE
     373};
     374
     375/* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x033n/0x033n */
     376/* 0x330 is reserved - used to be HDIO_GETGEO_BIG */
     377/* 0x331 is reserved - used to be HDIO_GETGEO_BIG_RAW */
     378/* 0x338 is reserved - used to be HDIO_SET_IDE_SCSI */
     379/* 0x339 is reserved - used to be HDIO_SET_SCSI_IDE */
     380
     381#define __NEW_HD_DRIVE_ID
     382
     383/*
     384 * Structure returned by HDIO_GET_IDENTITY, as per ANSI NCITS ATA6 rev.1b spec.
     385 *
     386 * If you change something here, please remember to update fix_driveid() in
     387 * ide/probe.c.
     388 */
     389struct hd_driveid {
     390        unsigned short  config;         /* lots of obsolete bit flags */
     391        unsigned short  cyls;           /* Obsolete, "physical" cyls */
     392        unsigned short  reserved2;      /* reserved (word 2) */
     393        unsigned short  heads;          /* Obsolete, "physical" heads */
     394        unsigned short  track_bytes;    /* unformatted bytes per track */
     395        unsigned short  sector_bytes;   /* unformatted bytes per sector */
     396        unsigned short  sectors;        /* Obsolete, "physical" sectors per track */
     397        unsigned short  vendor0;        /* vendor unique */
     398        unsigned short  vendor1;        /* vendor unique */
     399        unsigned short  vendor2;        /* Retired vendor unique */
     400        unsigned char   serial_no[20];  /* 0 = not_specified */
     401        unsigned short  buf_type;       /* Retired */
     402        unsigned short  buf_size;       /* Retired, 512 byte increments
     403                                         * 0 = not_specified
     404                                         */
     405        unsigned short  ecc_bytes;      /* for r/w long cmds; 0 = not_specified */
     406        unsigned char   fw_rev[8];      /* 0 = not_specified */
     407        unsigned char   model[40];      /* 0 = not_specified */
     408        unsigned char   max_multsect;   /* 0=not_implemented */
     409        unsigned char   vendor3;        /* vendor unique */
     410        unsigned short  dword_io;       /* 0=not_implemented; 1=implemented */
     411        unsigned char   vendor4;        /* vendor unique */
     412        unsigned char   capability;     /* (upper byte of word 49)
     413                                         *  3:  IORDYsup
     414                                         *  2:  IORDYsw
     415                                         *  1:  LBA
     416                                         *  0:  DMA
     417                                         */
     418        unsigned short  reserved50;     /* reserved (word 50) */
     419        unsigned char   vendor5;        /* Obsolete, vendor unique */
     420        unsigned char   tPIO;           /* Obsolete, 0=slow, 1=medium, 2=fast */
     421        unsigned char   vendor6;        /* Obsolete, vendor unique */
     422        unsigned char   tDMA;           /* Obsolete, 0=slow, 1=medium, 2=fast */
     423        unsigned short  field_valid;    /* (word 53)
     424                                         *  2:  ultra_ok        word  88
     425                                         *  1:  eide_ok         words 64-70
     426                                         *  0:  cur_ok          words 54-58
     427                                         */
     428        unsigned short  cur_cyls;       /* Obsolete, logical cylinders */
     429        unsigned short  cur_heads;      /* Obsolete, l heads */
     430        unsigned short  cur_sectors;    /* Obsolete, l sectors per track */
     431        unsigned short  cur_capacity0;  /* Obsolete, l total sectors on drive */
     432        unsigned short  cur_capacity1;  /* Obsolete, (2 words, misaligned int)     */
     433        unsigned char   multsect;       /* current multiple sector count */
     434        unsigned char   multsect_valid; /* when (bit0==1) multsect is ok */
     435        unsigned int    lba_capacity;   /* Obsolete, total number of sectors */
     436        unsigned short  dma_1word;      /* Obsolete, single-word dma info */
     437        unsigned short  dma_mword;      /* multiple-word dma info */
     438        unsigned short  eide_pio_modes; /* bits 0:mode3 1:mode4 */
     439        unsigned short  eide_dma_min;   /* min mword dma cycle time (ns) */
     440        unsigned short  eide_dma_time;  /* recommended mword dma cycle time (ns) */
     441        unsigned short  eide_pio;       /* min cycle time (ns), no IORDY  */
     442        unsigned short  eide_pio_iordy; /* min cycle time (ns), with IORDY */
     443        unsigned short  words69_70[2];  /* reserved words 69-70
     444                                         * future command overlap and queuing
     445                                         */
     446        /* HDIO_GET_IDENTITY currently returns only words 0 through 70 */
     447        unsigned short  words71_74[4];  /* reserved words 71-74
     448                                         * for IDENTIFY PACKET DEVICE command
     449                                         */
     450        unsigned short  queue_depth;    /* (word 75)
     451                                         * 15:5 reserved
     452                                         *  4:0 Maximum queue depth -1
     453                                         */
     454        unsigned short  words76_79[4];  /* reserved words 76-79 */
     455        unsigned short  major_rev_num;  /* (word 80) */
     456        unsigned short  minor_rev_num;  /* (word 81) */
     457        unsigned short  command_set_1;  /* (word 82) supported
     458                                         * 15:  Obsolete
     459                                         * 14:  NOP command
     460                                         * 13:  READ_BUFFER
     461                                         * 12:  WRITE_BUFFER
     462                                         * 11:  Obsolete
     463                                         * 10:  Host Protected Area
     464                                         *  9:  DEVICE Reset
     465                                         *  8:  SERVICE Interrupt
     466                                         *  7:  Release Interrupt
     467                                         *  6:  look-ahead
     468                                         *  5:  write cache
     469                                         *  4:  PACKET Command
     470                                         *  3:  Power Management Feature Set
     471                                         *  2:  Removable Feature Set
     472                                         *  1:  Security Feature Set
     473                                         *  0:  SMART Feature Set
     474                                         */
     475        unsigned short  command_set_2;  /* (word 83)
     476                                         * 15:  Shall be ZERO
     477                                         * 14:  Shall be ONE
     478                                         * 13:  FLUSH CACHE EXT
     479                                         * 12:  FLUSH CACHE
     480                                         * 11:  Device Configuration Overlay
     481                                         * 10:  48-bit Address Feature Set
     482                                         *  9:  Automatic Acoustic Management
     483                                         *  8:  SET MAX security
     484                                         *  7:  reserved 1407DT PARTIES
     485                                         *  6:  SetF sub-command Power-Up
     486                                         *  5:  Power-Up in Standby Feature Set
     487                                         *  4:  Removable Media Notification
     488                                         *  3:  APM Feature Set
     489                                         *  2:  CFA Feature Set
     490                                         *  1:  READ/WRITE DMA QUEUED
     491                                         *  0:  Download MicroCode
     492                                         */
     493        unsigned short  cfsse;          /* (word 84)
     494                                         * cmd set-feature supported extensions
     495                                         * 15:  Shall be ZERO
     496                                         * 14:  Shall be ONE
     497                                         * 13:6 reserved
     498                                         *  5:  General Purpose Logging
     499                                         *  4:  Streaming Feature Set
     500                                         *  3:  Media Card Pass Through
     501                                         *  2:  Media Serial Number Valid
     502                                         *  1:  SMART selt-test supported
     503                                         *  0:  SMART error logging
     504                                         */
     505        unsigned short  cfs_enable_1;   /* (word 85)
     506                                         * command set-feature enabled
     507                                         * 15:  Obsolete
     508                                         * 14:  NOP command
     509                                         * 13:  READ_BUFFER
     510                                         * 12:  WRITE_BUFFER
     511                                         * 11:  Obsolete
     512                                         * 10:  Host Protected Area
     513                                         *  9:  DEVICE Reset
     514                                         *  8:  SERVICE Interrupt
     515                                         *  7:  Release Interrupt
     516                                         *  6:  look-ahead
     517                                         *  5:  write cache
     518                                         *  4:  PACKET Command
     519                                         *  3:  Power Management Feature Set
     520                                         *  2:  Removable Feature Set
     521                                         *  1:  Security Feature Set
     522                                         *  0:  SMART Feature Set
     523                                         */
     524        unsigned short  cfs_enable_2;   /* (word 86)
     525                                         * command set-feature enabled
     526                                         * 15:  Shall be ZERO
     527                                         * 14:  Shall be ONE
     528                                         * 13:  FLUSH CACHE EXT
     529                                         * 12:  FLUSH CACHE
     530                                         * 11:  Device Configuration Overlay
     531                                         * 10:  48-bit Address Feature Set
     532                                         *  9:  Automatic Acoustic Management
     533                                         *  8:  SET MAX security
     534                                         *  7:  reserved 1407DT PARTIES
     535                                         *  6:  SetF sub-command Power-Up
     536                                         *  5:  Power-Up in Standby Feature Set
     537                                         *  4:  Removable Media Notification
     538                                         *  3:  APM Feature Set
     539                                         *  2:  CFA Feature Set
     540                                         *  1:  READ/WRITE DMA QUEUED
     541                                         *  0:  Download MicroCode
     542                                         */
     543        unsigned short  csf_default;    /* (word 87)
     544                                         * command set-feature default
     545                                         * 15:  Shall be ZERO
     546                                         * 14:  Shall be ONE
     547                                         * 13:6 reserved
     548                                         *  5:  General Purpose Logging enabled
     549                                         *  4:  Valid CONFIGURE STREAM executed
     550                                         *  3:  Media Card Pass Through enabled
     551                                         *  2:  Media Serial Number Valid
     552                                         *  1:  SMART selt-test supported
     553                                         *  0:  SMART error logging
     554                                         */
     555        unsigned short  dma_ultra;      /* (word 88) */
     556        unsigned short  trseuc;         /* time required for security erase */
     557        unsigned short  trsEuc;         /* time required for enhanced erase */
     558        unsigned short  CurAPMvalues;   /* current APM values */
     559        unsigned short  mprc;           /* master password revision code */
     560        unsigned short  hw_config;      /* hardware config (word 93)
     561                                         * 15:  Shall be ZERO
     562                                         * 14:  Shall be ONE
     563                                         * 13:
     564                                         * 12:
     565                                         * 11:
     566                                         * 10:
     567                                         *  9:
     568                                         *  8:
     569                                         *  7:
     570                                         *  6:
     571                                         *  5:
     572                                         *  4:
     573                                         *  3:
     574                                         *  2:
     575                                         *  1:
     576                                         *  0:  Shall be ONE
     577                                         */
     578        unsigned short  acoustic;       /* (word 94)
     579                                         * 15:8 Vendor's recommended value
     580                                         *  7:0 current value
     581                                         */
     582        unsigned short  msrqs;          /* min stream request size */
     583        unsigned short  sxfert;         /* stream transfer time */
     584        unsigned short  sal;            /* stream access latency */
     585        unsigned int    spg;            /* stream performance granularity */
     586        unsigned long long lba_capacity_2;/* 48-bit total number of sectors */
     587        unsigned short  words104_125[22];/* reserved words 104-125 */
     588        unsigned short  last_lun;       /* (word 126) */
     589        unsigned short  word127;        /* (word 127) Feature Set
     590                                         * Removable Media Notification
     591                                         * 15:2 reserved
     592                                         *  1:0 00 = not supported
     593                                         *      01 = supported
     594                                         *      10 = reserved
     595                                         *      11 = reserved
     596                                         */
     597        unsigned short  dlf;            /* (word 128)
     598                                         * device lock function
     599                                         * 15:9 reserved
     600                                         *  8   security level 1:max 0:high
     601                                         *  7:6 reserved
     602                                         *  5   enhanced erase
     603                                         *  4   expire
     604                                         *  3   frozen
     605                                         *  2   locked
     606                                         *  1   en/disabled
     607                                         *  0   capability
     608                                         */
     609        unsigned short  csfo;           /*  (word 129)
     610                                         * current set features options
     611                                         * 15:4 reserved
     612                                         *  3:  auto reassign
     613                                         *  2:  reverting
     614                                         *  1:  read-look-ahead
     615                                         *  0:  write cache
     616                                         */
     617        unsigned short  words130_155[26];/* reserved vendor words 130-155 */
     618        unsigned short  word156;        /* reserved vendor word 156 */
     619        unsigned short  words157_159[3];/* reserved vendor words 157-159 */
     620        unsigned short  cfa_power;      /* (word 160) CFA Power Mode
     621                                         * 15 word 160 supported
     622                                         * 14 reserved
     623                                         * 13
     624                                         * 12
     625                                         * 11:0
     626                                         */
     627        unsigned short  words161_175[15];/* Reserved for CFA */
     628        unsigned short  words176_205[30];/* Current Media Serial Number */
     629        unsigned short  words206_254[49];/* reserved words 206-254 */
     630        unsigned short  integrity_word; /* (word 255)
     631                                         * 15:8 Checksum
     632                                         *  7:0 Signature
     633                                         */
     634};
     635
     636/*
     637 * IDE "nice" flags. These are used on a per drive basis to determine
     638 * when to be nice and give more bandwidth to the other devices which
     639 * share the same IDE bus.
     640 */
     641#define IDE_NICE_DSC_OVERLAP    (0)     /* per the DSC overlap protocol */
     642#define IDE_NICE_ATAPI_OVERLAP  (1)     /* not supported yet */
     643#define IDE_NICE_0              (2)     /* when sure that it won't affect us */
     644#define IDE_NICE_1              (3)     /* when probably won't affect us much */
     645#define IDE_NICE_2              (4)     /* when we know it's on our expense */
     646
     647#endif  /* _LINUX_HDREG_H */
  • include/linux/ioctl.h

    diff -Naur aboot-0.9b.orig/include/linux/ioctl.h aboot-0.9b/include/linux/ioctl.h
    old new  
     1#ifndef _LINUX_IOCTL_H
     2#define _LINUX_IOCTL_H
     3
     4#include <asm/ioctl.h>
     5
     6#endif /* _LINUX_IOCTL_H */
     7
  • include/linux/kdev_t.h

    diff -Naur aboot-0.9b.orig/include/linux/kdev_t.h aboot-0.9b/include/linux/kdev_t.h
    old new  
     1#ifndef _LINUX_KDEV_T_H
     2#define _LINUX_KDEV_T_H
     3
     4/*
     5Some programs want their definitions of MAJOR and MINOR and MKDEV
     6from the kernel sources. These must be the externally visible ones.
     7*/
     8#define MAJOR(dev)      ((dev)>>8)
     9#define MINOR(dev)      ((dev) & 0xff)
     10#define MKDEV(ma,mi)    ((ma)<<8 | (mi))
     11#endif
  • include/linux/kernel.h

    diff -Naur aboot-0.9b.orig/include/linux/kernel.h aboot-0.9b/include/linux/kernel.h
    old new  
     1#ifndef _LINUX_KERNEL_H
     2#define _LINUX_KERNEL_H
     3
     4/*
     5 * 'kernel.h' contains some often-used function prototypes etc
     6 */
     7
     8
     9#define SI_LOAD_SHIFT   16
     10struct sysinfo {
     11        long uptime;                    /* Seconds since boot */
     12        unsigned long loads[3];         /* 1, 5, and 15 minute load averages */
     13        unsigned long totalram;         /* Total usable main memory size */
     14        unsigned long freeram;          /* Available memory size */
     15        unsigned long sharedram;        /* Amount of shared memory */
     16        unsigned long bufferram;        /* Memory used by buffers */
     17        unsigned long totalswap;        /* Total swap space size */
     18        unsigned long freeswap;         /* swap space still available */
     19        unsigned short procs;           /* Number of current processes */
     20        unsigned short pad;             /* explicit padding for m68k */
     21        unsigned long totalhigh;        /* Total high memory size */
     22        unsigned long freehigh;         /* Available high memory size */
     23        unsigned int mem_unit;          /* Memory unit size in bytes */
     24        char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */
     25};
     26
     27/* Force a compilation error if condition is true */
     28#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
     29
     30/* Force a compilation error if condition is true, but also produce a
     31   result (of value 0 and type size_t), so the expression can be used
     32   e.g. in a structure initializer (or where-ever else comma expressions
     33   aren't permitted). */
     34#define BUILD_BUG_ON_ZERO(e) (sizeof(char[1 - 2 * !!(e)]) - 1)
     35
     36/* Trap pasters of __FUNCTION__ at compile-time */
     37#define __FUNCTION__ (__func__)
     38
     39/* This helps us to avoid #ifdef CONFIG_NUMA */
     40#ifdef CONFIG_NUMA
     41#define NUMA_BUILD 1
     42#else
     43#define NUMA_BUILD 0
     44#endif
     45
     46#endif
  • include/linux/limits.h

    diff -Naur aboot-0.9b.orig/include/linux/limits.h aboot-0.9b/include/linux/limits.h
    old new  
     1#ifndef _LINUX_LIMITS_H
     2#define _LINUX_LIMITS_H
     3
     4#define NR_OPEN         1024
     5
     6#define NGROUPS_MAX    65536    /* supplemental group IDs are available */
     7#define ARG_MAX       131072    /* # bytes of args + environ for exec() */
     8#define LINK_MAX         127    /* # links a file may have */
     9#define MAX_CANON        255    /* size of the canonical input queue */
     10#define MAX_INPUT        255    /* size of the type-ahead buffer */
     11#define NAME_MAX         255    /* # chars in a file name */
     12#define PATH_MAX        4096    /* # chars in a path name including nul */
     13#define PIPE_BUF        4096    /* # bytes in atomic write to a pipe */
     14#define XATTR_NAME_MAX   255    /* # chars in an extended attribute name */
     15#define XATTR_SIZE_MAX 65536    /* size of an extended attribute value (64k) */
     16#define XATTR_LIST_MAX 65536    /* size of extended attribute namelist (64k) */
     17
     18#define RTSIG_MAX         32
     19
     20#endif
  • include/linux/magic.h

    diff -Naur aboot-0.9b.orig/include/linux/magic.h aboot-0.9b/include/linux/magic.h
    old new  
     1#ifndef __LINUX_MAGIC_H__
     2#define __LINUX_MAGIC_H__
     3
     4#define ADFS_SUPER_MAGIC        0xadf5
     5#define AFFS_SUPER_MAGIC        0xadff
     6#define AFS_SUPER_MAGIC                0x5346414F
     7#define AUTOFS_SUPER_MAGIC      0x0187
     8#define CODA_SUPER_MAGIC        0x73757245
     9#define EFS_SUPER_MAGIC         0x414A53
     10#define EXT2_SUPER_MAGIC        0xEF53
     11#define EXT3_SUPER_MAGIC        0xEF53
     12#define EXT4_SUPER_MAGIC        0xEF53
     13#define HPFS_SUPER_MAGIC        0xf995e849
     14#define ISOFS_SUPER_MAGIC       0x9660
     15#define JFFS2_SUPER_MAGIC       0x72b6
     16#define ANON_INODE_FS_MAGIC     0x09041934
     17
     18#define MINIX_SUPER_MAGIC       0x137F          /* original minix fs */
     19#define MINIX_SUPER_MAGIC2      0x138F          /* minix fs, 30 char names */
     20#define MINIX2_SUPER_MAGIC      0x2468          /* minix V2 fs */
     21#define MINIX2_SUPER_MAGIC2     0x2478          /* minix V2 fs, 30 char names */
     22#define MINIX3_SUPER_MAGIC      0x4d5a          /* minix V3 fs */
     23
     24#define MSDOS_SUPER_MAGIC       0x4d44          /* MD */
     25#define NCP_SUPER_MAGIC         0x564c          /* Guess, what 0x564c is :-) */
     26#define NFS_SUPER_MAGIC         0x6969
     27#define OPENPROM_SUPER_MAGIC    0x9fa1
     28#define PROC_SUPER_MAGIC        0x9fa0
     29#define QNX4_SUPER_MAGIC        0x002f          /* qnx4 fs detection */
     30
     31#define REISERFS_SUPER_MAGIC    0x52654973      /* used by gcc */
     32                                        /* used by file system utilities that
     33                                           look at the superblock, etc.  */
     34#define REISERFS_SUPER_MAGIC_STRING     "ReIsErFs"
     35#define REISER2FS_SUPER_MAGIC_STRING    "ReIsEr2Fs"
     36#define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs"
     37
     38#define SMB_SUPER_MAGIC         0x517B
     39#define USBDEVICE_SUPER_MAGIC   0x9fa2
     40
     41#endif /* __LINUX_MAGIC_H__ */
  • include/linux/param.h

    diff -Naur aboot-0.9b.orig/include/linux/param.h aboot-0.9b/include/linux/param.h
    old new  
     1#ifndef _LINUX_PARAM_H
     2#define _LINUX_PARAM_H
     3
     4#include <asm/param.h>
     5
     6#endif
  • include/linux/posix_types.h

    diff -Naur aboot-0.9b.orig/include/linux/posix_types.h aboot-0.9b/include/linux/posix_types.h
    old new  
     1#ifndef _LINUX_POSIX_TYPES_H
     2#define _LINUX_POSIX_TYPES_H
     3
     4#include <linux/stddef.h>
     5
     6/*
     7 * This allows for 1024 file descriptors: if NR_OPEN is ever grown
     8 * beyond that you'll have to change this too. But 1024 fd's seem to be
     9 * enough even for such "real" unices like OSF/1, so hopefully this is
     10 * one limit that doesn't have to be changed [again].
     11 *
     12 * Note that POSIX wants the FD_CLEAR(fd,fdsetp) defines to be in
     13 * <sys/time.h> (and thus <linux/time.h>) - but this is a more logical
     14 * place for them. Solved by having dummy defines in <sys/time.h>.
     15 */
     16
     17/*
     18 * Those macros may have been defined in <gnu/types.h>. But we always
     19 * use the ones here.
     20 */
     21#undef __NFDBITS
     22#define __NFDBITS       (8 * sizeof(unsigned long))
     23
     24#undef __FD_SETSIZE
     25#define __FD_SETSIZE    1024
     26
     27#undef __FDSET_LONGS
     28#define __FDSET_LONGS   (__FD_SETSIZE/__NFDBITS)
     29
     30#undef __FDELT
     31#define __FDELT(d)      ((d) / __NFDBITS)
     32
     33#undef __FDMASK
     34#define __FDMASK(d)     (1UL << ((d) % __NFDBITS))
     35
     36typedef struct {
     37        unsigned long fds_bits [__FDSET_LONGS];
     38} __kernel_fd_set;
     39
     40/* Type of a signal handler.  */
     41typedef void (*__kernel_sighandler_t)(int);
     42
     43/* Type of a SYSV IPC key.  */
     44typedef int __kernel_key_t;
     45typedef int __kernel_mqd_t;
     46
     47#include <asm/posix_types.h>
     48
     49#endif /* _LINUX_POSIX_TYPES_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
     5#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
     6
     7#define S_IFMT  00170000
     8#define S_IFSOCK 0140000
     9#define S_IFLNK  0120000
     10#define S_IFREG  0100000
     11#define S_IFBLK  0060000
     12#define S_IFDIR  0040000
     13#define S_IFCHR  0020000
     14#define S_IFIFO  0010000
     15#define S_ISUID  0004000
     16#define S_ISGID  0002000
     17#define S_ISVTX  0001000
     18
     19#define S_ISLNK(m)      (((m) & S_IFMT) == S_IFLNK)
     20#define S_ISREG(m)      (((m) & S_IFMT) == S_IFREG)
     21#define S_ISDIR(m)      (((m) & S_IFMT) == S_IFDIR)
     22#define S_ISCHR(m)      (((m) & S_IFMT) == S_IFCHR)
     23#define S_ISBLK(m)      (((m) & S_IFMT) == S_IFBLK)
     24#define S_ISFIFO(m)     (((m) & S_IFMT) == S_IFIFO)
     25#define S_ISSOCK(m)     (((m) & S_IFMT) == S_IFSOCK)
     26
     27#define S_IRWXU 00700
     28#define S_IRUSR 00400
     29#define S_IWUSR 00200
     30#define S_IXUSR 00100
     31
     32#define S_IRWXG 00070
     33#define S_IRGRP 00040
     34#define S_IWGRP 00020
     35#define S_IXGRP 00010
     36
     37#define S_IRWXO 00007
     38#define S_IROTH 00004
     39#define S_IWOTH 00002
     40#define S_IXOTH 00001
     41
     42#endif
     43
     44
     45#endif
  • include/linux/stddef.h

    diff -Naur aboot-0.9b.orig/include/linux/stddef.h aboot-0.9b/include/linux/stddef.h
    old new  
     1#ifndef _LINUX_STDDEF_H
     2#define _LINUX_STDDEF_H
     3
     4
     5#undef NULL
     6#if defined(__cplusplus)
     7#define NULL 0
     8#else
     9#define NULL ((void *)0)
     10#endif
     11
     12
     13#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
     8#include <linux/types.h>        /* for size_t */
     9#include <linux/stddef.h>       /* for NULL */
     10
     11#ifdef __cplusplus
     12extern "C" {
     13#endif
     14
     15//extern char *strndup_user(const char __user *, long);
     16
     17#ifndef __HAVE_ARCH_STRCPY
     18extern char * strcpy(char *,const char *);
     19#endif
     20#ifndef __HAVE_ARCH_STRNCPY
     21extern char * strncpy(char *,const char *, __kernel_size_t);
     22#endif
     23#ifndef __HAVE_ARCH_STRLCPY
     24size_t strlcpy(char *, const char *, size_t);
     25#endif
     26#ifndef __HAVE_ARCH_STRCAT
     27extern char * strcat(char *, const char *);
     28#endif
     29#ifndef __HAVE_ARCH_STRNCAT
     30extern char * strncat(char *, const char *, __kernel_size_t);
     31#endif
     32#ifndef __HAVE_ARCH_STRLCAT
     33extern size_t strlcat(char *, const char *, __kernel_size_t);
     34#endif
     35#ifndef __HAVE_ARCH_STRCMP
     36extern int strcmp(const char *,const char *);
     37#endif
     38#ifndef __HAVE_ARCH_STRNCMP
     39extern int strncmp(const char *,const char *,__kernel_size_t);
     40#endif
     41#ifndef __HAVE_ARCH_STRNICMP
     42extern int strnicmp(const char *, const char *, __kernel_size_t);
     43#endif
     44#ifndef __HAVE_ARCH_STRCASECMP
     45extern int strcasecmp(const char *s1, const char *s2);
     46#endif
     47#ifndef __HAVE_ARCH_STRNCASECMP
     48extern int strncasecmp(const char *s1, const char *s2, size_t n);
     49#endif
     50#ifndef __HAVE_ARCH_STRCHR
     51extern char * strchr(const char *,int);
     52#endif
     53#ifndef __HAVE_ARCH_STRNCHR
     54extern char * strnchr(const char *, size_t, int);
     55#endif
     56#ifndef __HAVE_ARCH_STRRCHR
     57extern char * strrchr(const char *,int);
     58#endif
     59extern char * strstrip(char *);
     60#ifndef __HAVE_ARCH_STRSTR
     61extern char * strstr(const char *,const char *);
     62#endif
     63#ifndef __HAVE_ARCH_STRLEN
     64extern __kernel_size_t strlen(const char *);
     65#endif
     66#ifndef __HAVE_ARCH_STRNLEN
     67extern __kernel_size_t strnlen(const char *,__kernel_size_t);
     68#endif
     69#ifndef __HAVE_ARCH_STRPBRK
     70extern char * strpbrk(const char *,const char *);
     71#endif
     72#ifndef __HAVE_ARCH_STRSEP
     73extern char * strsep(char **,const char *);
     74#endif
     75#ifndef __HAVE_ARCH_STRSPN
     76extern __kernel_size_t strspn(const char *,const char *);
     77#endif
     78#ifndef __HAVE_ARCH_STRCSPN
     79extern __kernel_size_t strcspn(const char *,const char *);
     80#endif
     81
     82#ifndef __HAVE_ARCH_MEMSET
     83extern void * memset(void *,int,__kernel_size_t);
     84#endif
     85#ifndef __HAVE_ARCH_MEMCPY
     86extern void * memcpy(void *,const void *,__kernel_size_t);
     87#endif
     88#ifndef __HAVE_ARCH_MEMMOVE
     89extern void * memmove(void *,const void *,__kernel_size_t);
     90#endif
     91#ifndef __HAVE_ARCH_MEMSCAN
     92extern void * memscan(void *,int,__kernel_size_t);
     93#endif
     94#ifndef __HAVE_ARCH_MEMCMP
     95extern int memcmp(const void *,const void *,__kernel_size_t);
     96#endif
     97#ifndef __HAVE_ARCH_MEMCHR
     98extern void * memchr(const void *,int,__kernel_size_t);
     99#endif
     100
     101//extern char *kstrdup(const char *s, gfp_t gfp);
     102//extern char *kstrndup(const char *s, size_t len, gfp_t gfp);
     103//extern void *kmemdup(const void *src, size_t len, gfp_t gfp);
     104
     105//extern char **argv_split(gfp_t gfp, const char *str, int *argcp);
     106//extern void argv_free(char **argv);
     107
     108#ifdef __cplusplus
     109}
     110#endif
     111
     112#endif
     113#endif /* _LINUX_STRING_H_ */
  • include/linux/types.h

    diff -Naur aboot-0.9b.orig/include/linux/types.h aboot-0.9b/include/linux/types.h
    old new  
     1#ifndef _LINUX_TYPES_H
     2#define _LINUX_TYPES_H
     3
     4
     5#include <linux/posix_types.h>
     6#include <asm/types.h>
     7
     8#ifndef __KERNEL_STRICT_NAMES
     9
     10typedef __u32 __kernel_dev_t;
     11
     12typedef __kernel_fd_set         fd_set;
     13typedef __kernel_dev_t          dev_t;
     14typedef __kernel_ino_t          ino_t;
     15typedef __kernel_mode_t         mode_t;
     16typedef __kernel_nlink_t        nlink_t;
     17typedef __kernel_off_t          off_t;
     18typedef __kernel_pid_t          pid_t;
     19typedef __kernel_daddr_t        daddr_t;
     20typedef __kernel_key_t          key_t;
     21typedef __kernel_suseconds_t    suseconds_t;
     22typedef __kernel_timer_t        timer_t;
     23typedef __kernel_clockid_t      clockid_t;
     24typedef __kernel_mqd_t          mqd_t;
     25
     26typedef __kernel_uid_t          uid_t;
     27typedef __kernel_gid_t          gid_t;
     28
     29#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
     30typedef __kernel_loff_t         loff_t;
     31#endif
     32
     33/*
     34 * The following typedefs are also protected by individual ifdefs for
     35 * historical reasons:
     36 */
     37#ifndef _SIZE_T
     38#define _SIZE_T
     39typedef __kernel_size_t         size_t;
     40#endif
     41
     42#ifndef _SSIZE_T
     43#define _SSIZE_T
     44typedef __kernel_ssize_t        ssize_t;
     45#endif
     46
     47#ifndef _PTRDIFF_T
     48#define _PTRDIFF_T
     49typedef __kernel_ptrdiff_t      ptrdiff_t;
     50#endif
     51
     52#ifndef _TIME_T
     53#define _TIME_T
     54typedef __kernel_time_t         time_t;
     55#endif
     56
     57#ifndef _CLOCK_T
     58#define _CLOCK_T
     59typedef __kernel_clock_t        clock_t;
     60#endif
     61
     62#ifndef _CADDR_T
     63#define _CADDR_T
     64typedef __kernel_caddr_t        caddr_t;
     65#endif
     66
     67/* bsd */
     68typedef unsigned char           u_char;
     69typedef unsigned short          u_short;
     70typedef unsigned int            u_int;
     71typedef unsigned long           u_long;
     72
     73/* sysv */
     74typedef unsigned char           unchar;
     75typedef unsigned short          ushort;
     76typedef unsigned int            uint;
     77typedef unsigned long           ulong;
     78
     79#ifndef __BIT_TYPES_DEFINED__
     80#define __BIT_TYPES_DEFINED__
     81
     82typedef         __u8            u_int8_t;
     83typedef         __s8            int8_t;
     84typedef         __u16           u_int16_t;
     85typedef         __s16           int16_t;
     86typedef         __u32           u_int32_t;
     87typedef         __s32           int32_t;
     88
     89#endif /* !(__BIT_TYPES_DEFINED__) */
     90
     91typedef         __u8            uint8_t;
     92typedef         __u16           uint16_t;
     93typedef         __u32           uint32_t;
     94
     95#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
     96typedef         __u64           uint64_t;
     97typedef         __u64           u_int64_t;
     98typedef         __s64           int64_t;
     99#endif
     100
     101/* this is a special 64bit data type that is 8-byte aligned */
     102#define aligned_u64 unsigned long long __attribute__((aligned(8)))
     103#define aligned_be64 __be64 __attribute__((aligned(8)))
     104#define aligned_le64 __le64 __attribute__((aligned(8)))
     105
     106/**
     107 * The type used for indexing onto a disc or disc partition.
     108 *
     109 * Linux always considers sectors to be 512 bytes long independently
     110 * of the devices real block size.
     111 */
     112#ifdef CONFIG_LBD
     113typedef u64 sector_t;
     114#else
     115typedef unsigned long sector_t;
     116#endif
     117
     118/*
     119 * The type of the inode's block count.
     120 */
     121#ifdef CONFIG_LSF
     122typedef u64 blkcnt_t;
     123#else
     124typedef unsigned long blkcnt_t;
     125#endif
     126
     127/*
     128 * The type of an index into the pagecache.  Use a #define so asm/types.h
     129 * can override it.
     130 */
     131#ifndef pgoff_t
     132#define pgoff_t unsigned long
     133#endif
     134
     135#endif /* __KERNEL_STRICT_NAMES */
     136
     137/*
     138 * Below are truly Linux-specific types that should never collide with
     139 * any application/library that wants linux/types.h.
     140 */
     141
     142#ifdef __CHECKER__
     143#define __bitwise__ __attribute__((bitwise))
     144#else
     145#define __bitwise__
     146#endif
     147#ifdef __CHECK_ENDIAN__
     148#define __bitwise __bitwise__
     149#else
     150#define __bitwise
     151#endif
     152
     153typedef __u16 __bitwise __le16;
     154typedef __u16 __bitwise __be16;
     155typedef __u32 __bitwise __le32;
     156typedef __u32 __bitwise __be32;
     157#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
     158typedef __u64 __bitwise __le64;
     159typedef __u64 __bitwise __be64;
     160#endif
     161typedef __u16 __bitwise __sum16;
     162typedef __u32 __bitwise __wsum;
     163
     164
     165struct ustat {
     166        __kernel_daddr_t        f_tfree;
     167        __kernel_ino_t          f_tinode;
     168        char                    f_fname[6];
     169        char                    f_fpack[6];
     170};
     171
     172#endif /* _LINUX_TYPES_H */
  • include/linux/version.h

    diff -Naur aboot-0.9b.orig/include/linux/version.h aboot-0.9b/include/linux/version.h
    old new  
     1#define LINUX_VERSION_CODE 132631
     2#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
  • include/utils.h

    diff -Naur aboot-0.9b.orig/include/utils.h aboot-0.9b/include/utils.h
    old new  
    1515extern void             getline (char *buf, int maxlen);
    1616#endif
    1717
     18unsigned long simple_strtoul(const char *cp, char **endp, unsigned int base);
     19size_t strnlen(const char * s, size_t count);
     20char * strtok(char * s,const char * ct);
     21
    1822extern unsigned long    memory_end(void);
    1923extern unsigned long    free_mem_ptr;
    2024
  • lib/Makefile

    diff -Naur aboot-0.9b.orig/lib/Makefile aboot-0.9b/lib/Makefile
    old new  
    1 CC      = gcc
     1include ../Makefile.inc
     2
    23CPPFLAGS +=  -D__KERNEL__ -I../include
    34ifeq ($(TESTING),)
    45CFLAGS  = -Os -Wall -mno-fp-regs -fno-builtin
     
    1112libaboot.a: vsprintf.o memcpy.o memset.o string.o _setjmp.o \
    1213        _longjmp.o isolib.o __divqu.o __remqu.o __divlu.o \
    1314        __remlu.o
    14         ar cru $@ $?
     15        $(AR) cru $@ $?
    1516else
    1617libaboot.a: isolib.o
    17         ar cru $@ $?
     18        $(AR) cru $@ $?
    1819endif
    1920
    2021clean:
  • 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 #ifndef TESTING
    10 #  include <linux/string.h>
    11 #endif
    129#include <linux/kernel.h>
    13 #include <linux/config.h>
    1410#include <linux/types.h>
    1511#include <linux/stat.h>
    1612#include <linux/kdev_t.h>
    1713#include <asm/page.h>
    1814
     15#include <string.h>
     16
    1917#include <iso.h>
    2018#include <isolib.h>
    2119#include <utils.h>
     
    488486                  if (dlen) {
    489487                    strcpy(de->name, retname);
    490488                  } else {
    491                     dlen = isonum_711(de->name_len);
     489                    dlen = isonum_711((char *)de->name_len);
    492490                    if(sb.s_mapping == 'n') {
    493491                      for (i = 0; i < dlen; i++) {
    494492                        c = de->name[i];
     
    10351033         * Everything's cool, let's get the filename.
    10361034         * First we need to figure out the length.
    10371035         */
    1038         name_len = isonum_711(dirent->name_len);
     1036        name_len = isonum_711((char *)dirent->name_len);
    10391037#ifdef DEBUG_ISO
    10401038        if (name_len==0) printf("dirent->name_len = 0, skipping.\n");
    10411039#endif
     
    11771175  if (!sb.s_rock) return 0;
    11781176  *retname = '\0';
    11791177
    1180   len = sizeof(struct iso_directory_record) + isonum_711(de->name_len);
     1178  len = sizeof(struct iso_directory_record) + isonum_711((char *)de->name_len);
    11811179  if (len & 1) len++;
    11821180  chr = ((unsigned char *) de) + len;
    11831181  len = *((unsigned char *) de) - len;
     
    15201518#ifdef DEBUG_ROCK
    15211519           printf("Symlink component flag not implemented (%d)\n",slen);
    15221520#endif
     1521           break;
    15231522         };
    15241523         slen -= slp->len + 2;
    15251524         oldslp = slp;
  • lib/vsprintf.c

    diff -Naur aboot-0.9b.orig/lib/vsprintf.c aboot-0.9b/lib/vsprintf.c
    old new  
    1111
    1212#include <stdarg.h>
    1313#include <linux/types.h>
    14 #include <linux/string.h>
     14
     15#include <utils.h>
    1516
    1617/* we use this so that we can do without the ctype library */
    1718#define is_digit(c)     ((c) >= '0' && (c) <= '9')
  • sdisklabel/Makefile

    diff -Naur aboot-0.9b.orig/sdisklabel/Makefile aboot-0.9b/sdisklabel/Makefile
    old new  
    1 CC = gcc -O2
    2 CFLAGS= -I../include $(CPPFLAGS) -Wall
     1include ../Makefile.inc
     2
     3CFLAGS= -O2 -I../include $(CPPFLAGS) -Wall
    34
    45all:    sdisklabel swriteboot
    56
     7%.o: %.c
     8        $(HOST_CC) $(CFLAGS) -c $< -o $@
     9
    610sdisklabel: sdisklabel.o library.o
    7         $(CC) $(LDFLAGS) sdisklabel.o library.o -o sdisklabel
     11        $(HOST_CC) $(LDFLAGS) sdisklabel.o library.o -o sdisklabel
    812
    913swriteboot: swriteboot.o library.o
    10         $(CC) $(LDFLAGS) swriteboot.o library.o -o swriteboot
     14        $(HOST_CC) $(LDFLAGS) swriteboot.o library.o -o swriteboot
    1115
    1216clean:
    1317        rm -f sdisklabel swriteboot *.o
  • sdisklabel/sdisklabel.c

    diff -Naur aboot-0.9b.orig/sdisklabel/sdisklabel.c aboot-0.9b/sdisklabel/sdisklabel.c
    old new  
    3636        d->d_magic2=DISKLABELMAGIC;
    3737        d->d_type=DTYPE_SCSI;
    3838        d->d_secsize=512;
    39         strcpy(d->d_typename,"SCSI");
     39        strcpy((char *)d->d_typename,"SCSI");
    4040}
    4141
    4242void
  • sdisklabel/swriteboot.c

    diff -Naur aboot-0.9b.orig/sdisklabel/swriteboot.c aboot-0.9b/sdisklabel/swriteboot.c
    old new  
    66#include <sys/stat.h>
    77#include <sys/types.h>
    88
    9 #include <asm/system.h>
    109#include <disklabel.h>
    1110#include <config.h>
    1211#include "library.h"
  • tools/Makefile

    diff -Naur aboot-0.9b.orig/tools/Makefile aboot-0.9b/tools/Makefile
    old new  
    1 CC      = gcc
     1
     2include ../Makefile.inc
     3
    24CFLAGS  = -g -O2 -Wall -I. -I../include $(CPPFLAGS)
    35LDFLAGS = -g
    46PGMS    = e2writeboot isomarkboot abootconf elfencap objstrip
    57
    6 EXEC_PREFIX = /usr
    7 
    8 all:    $(PGMS)
     8all: $(PGMS)
    99
    10 install:        $(PGMS)
    11         install -s -c -o root -g root -m 755 $(PGMS) $(EXEC_PREFIX)/bin
     10.c.o:
     11        $(HOST_CC) $(CFLAGS) -c $< -o $@
    1212
    13 clean:
    14         rm -f *~ *.o *.a core $(PGMS)
     13$(PGMS):
     14        $(HOST_CC) $(LDFLAGS) $^ -o $@
    1515
    16 isomarkboot:    isomarkboot.o ../lib/isolib.o
    17 e2writeboot:    e2writeboot.o e2lib.o bio.o
     16abootconf: abootconf.o
     17objstrip: objstrip.o
     18elfencap: elfencap.o
     19isomarkboot: isomarkboot.o isolib.o
     20e2writeboot: e2writeboot.o e2lib.o bio.o
    1821
    19 e2writeboot.o:  e2lib.h
     22e2writeboot.o:  e2lib.h
    2023e2lib.o: e2lib.h
     24isolib.o: ../lib/isolib.c
     25        $(HOST_CC) $(CFLAGS) -c $< -o $@
     26
     27install: $(PGMS)
     28        install -s -c -o root -g root -m 755 $(PGMS) $(DESTDIR)$(EXEC_PREFIX)/bin
     29
     30clean:
     31        rm -f *~ *.o *.a core $(PGMS)
  • tools/elfencap.c

    diff -Naur aboot-0.9b.orig/tools/elfencap.c aboot-0.9b/tools/elfencap.c
    old new  
    3434    memset(&h, 0, sizeof(h));
    3535
    3636    h.ehdr.e_ident[0] = 0x7f;
    37     strcpy(h.ehdr.e_ident + 1, "ELF");
     37    strcpy((char *)h.ehdr.e_ident + 1, "ELF");
    3838    h.ehdr.e_ident[EI_CLASS]    = ELF_CLASS;
    3939    h.ehdr.e_ident[EI_DATA]     = ELF_DATA;
    4040    h.ehdr.e_ident[EI_VERSION]  = EV_CURRENT;
  • tools/objstrip.c

    diff -Naur aboot-0.9b.orig/tools/objstrip.c aboot-0.9b/tools/objstrip.c
    old new  
    152152#ifdef __ELF__
    153153    elf = (struct elfhdr *) buf;
    154154
    155     if (elf->e_ident[0] == 0x7f && strncmp(elf->e_ident + 1, "ELF", 3) == 0) {
     155    if (elf->e_ident[0] == 0x7f && strncmp((char *)elf->e_ident + 1, "ELF", 3) == 0) {
    156156        if (elf->e_type != ET_EXEC) {
    157157            fprintf(stderr, "%s: %s is not an ELF executable\n",
    158158                    prog_name, inname);
  • zip/misc.c

    diff -Naur aboot-0.9b.orig/zip/misc.c aboot-0.9b/zip/misc.c
    old new  
    189189        }
    190190
    191191        nblocks = INBUFSIZ / bfs->blocksize;
    192         nread = (*bfs->bread)(input_fd, block_number, nblocks, inbuf);
     192        nread = (*bfs->bread)(input_fd, block_number, nblocks, (char *)inbuf);
    193193#ifdef DEBUG
    194194        printf("read %ld blocks of %d, got %ld\n", nblocks, bfs->blocksize,
    195195               nread);
     
    230230        updcrc(window, outcnt);
    231231
    232232        if (!bytes_out) /* first block - look for headers */
    233                 if (first_block(window, outcnt) < 0)
     233                if (first_block((char *)window, outcnt) < 0)
    234234                        unzip_error("invalid exec header"); /* does a longjmp() */
    235235
    236236        bytes_out += outcnt;
    237237        while (chunk < nchunks) {
    238238                /* position within the current segment */
    239239                ssize_t chunk_offset = file_offset - chunks[chunk].offset;
    240                 unsigned char *dest = (char *) chunks[chunk].addr + chunk_offset;
     240                unsigned char *dest = (unsigned char *) chunks[chunk].addr + chunk_offset;
    241241                ssize_t to_copy;
    242242                unsigned char *src = window;
    243243
Note: See TracBrowser for help on using the repository browser.