[af04f13] | 1 | Submitted By: Joe Ciccone <jciccone@gmail.com>
|
---|
| 2 | Date: 2007-01-01
|
---|
| 3 | Initial Package Version: 0.9b
|
---|
| 4 | Upstream Status: NONE
|
---|
| 5 | Origin: Joe Ciccone
|
---|
| 6 | Description: This patch fixes compilation issues with by creating a basic set
|
---|
| 7 | of kernel headers as well as a few changes that needed to be made
|
---|
| 8 | to the code so that it compiles with more modern compilers. A
|
---|
| 9 | common makefile with variables was also added.
|
---|
| 10 |
|
---|
| 11 | diff -Naur aboot-0.9b.orig/Makefile aboot-0.9b/Makefile
|
---|
| 12 | --- aboot-0.9b.orig/Makefile 2002-09-18 15:48:21.000000000 -0400
|
---|
| 13 | +++ aboot-0.9b/Makefile 2008-01-02 13:54:25.000000000 -0500
|
---|
| 14 | @@ -8,10 +8,7 @@
|
---|
| 15 | # Copyright (c) 1995, 1996 by David Mosberger (davidm@cs.arizona.edu)
|
---|
| 16 | #
|
---|
| 17 |
|
---|
| 18 | -# location of linux kernel sources (must be absolute path):
|
---|
| 19 | -KSRC = /usr/src/linux
|
---|
| 20 | -VMLINUX = $(KSRC)/vmlinux
|
---|
| 21 | -VMLINUXGZ = $(KSRC)/arch/alpha/boot/vmlinux.gz
|
---|
| 22 | +include Makefile.inc
|
---|
| 23 |
|
---|
| 24 | # for userspace testing
|
---|
| 25 | #TESTING = yes
|
---|
| 26 | @@ -19,12 +16,6 @@
|
---|
| 27 | # for boot testing
|
---|
| 28 | #CFGDEFS = -DDEBUG_ISO -DDEBUG_ROCK -DDEBUG
|
---|
| 29 |
|
---|
| 30 | -# root, aka prefix
|
---|
| 31 | -root =
|
---|
| 32 | -bindir = $(root)/sbin
|
---|
| 33 | -bootdir = $(root)/boot
|
---|
| 34 | -mandir = /usr/man
|
---|
| 35 | -
|
---|
| 36 | #
|
---|
| 37 | # There shouldn't be any need to change anything below this line.
|
---|
| 38 | #
|
---|
| 39 | @@ -32,13 +23,12 @@
|
---|
| 40 |
|
---|
| 41 | ABOOT_LDFLAGS = -static -N -Taboot.lds
|
---|
| 42 |
|
---|
| 43 | -CC = gcc
|
---|
| 44 | TOP = $(shell pwd)
|
---|
| 45 | ifeq ($(TESTING),)
|
---|
| 46 | -CPPFLAGS = $(CFGDEFS) -I$(TOP)/include -I$(KSRC)/include
|
---|
| 47 | +CPPFLAGS = $(CFGDEFS) -I$(TOP)/include
|
---|
| 48 | CFLAGS = $(CPPFLAGS) -D__KERNEL__ -mcpu=ev4 -Os -Wall -fno-builtin -mno-fp-regs -ffixed-8
|
---|
| 49 | else
|
---|
| 50 | -CPPFLAGS = -DTESTING $(CFGDEFS) -I$(TOP)/include -I$(KSRC)/include
|
---|
| 51 | +CPPFLAGS = -DTESTING $(CFGDEFS)
|
---|
| 52 | CFLAGS = $(CPPFLAGS) -O -g3 -Wall -D__KERNEL__ -ffixed-8
|
---|
| 53 | endif
|
---|
| 54 | ASFLAGS = $(CPPFLAGS)
|
---|
| 55 | @@ -66,35 +56,34 @@
|
---|
| 56 | endif
|
---|
| 57 | LIBS = lib/libaboot.a
|
---|
| 58 |
|
---|
| 59 | +all: tools/all sdisklabel/all lib/libaboot.a all-local
|
---|
| 60 | +
|
---|
| 61 | ifeq ($(TESTING),)
|
---|
| 62 | -all: diskboot
|
---|
| 63 | +all-local: diskboot
|
---|
| 64 | else
|
---|
| 65 | -all: aboot
|
---|
| 66 | +all-local: aboot
|
---|
| 67 | endif
|
---|
| 68 |
|
---|
| 69 | diskboot: bootlx sdisklabel/sdisklabel sdisklabel/swriteboot \
|
---|
| 70 | tools/e2writeboot tools/isomarkboot tools/abootconf \
|
---|
| 71 | tools/elfencap
|
---|
| 72 |
|
---|
| 73 | -netboot: vmlinux.bootp
|
---|
| 74 | -
|
---|
| 75 | bootlx: aboot tools/objstrip
|
---|
| 76 | tools/objstrip -vb aboot bootlx
|
---|
| 77 |
|
---|
| 78 | install-man:
|
---|
| 79 | - make -C doc/man install
|
---|
| 80 | + $(MAKE) -C doc/man install
|
---|
| 81 |
|
---|
| 82 | install-man-gz:
|
---|
| 83 | - make -C doc/man install-gz
|
---|
| 84 | + $(MAKE) -C doc/man install-gz
|
---|
| 85 |
|
---|
| 86 | -install: tools/abootconf tools/e2writeboot tools/isomarkboot \
|
---|
| 87 | - sdisklabel/swriteboot install-man
|
---|
| 88 | - install -d $(bindir) $(bootdir)
|
---|
| 89 | - install -c -s tools/abootconf $(bindir)
|
---|
| 90 | - install -c -s tools/e2writeboot $(bindir)
|
---|
| 91 | - install -c -s tools/isomarkboot $(bindir)
|
---|
| 92 | - install -c -s sdisklabel/swriteboot $(bindir)
|
---|
| 93 | - install -c bootlx $(bootdir)
|
---|
| 94 | +install: tools/abootconf tools/e2writeboot tools/isomarkboot sdisklabel/swriteboot install-man
|
---|
| 95 | + install -d $(DESTDIR)$(BINDIR) $(DESTDIR)$(BOOTDIR)
|
---|
| 96 | + install -c tools/abootconf $(DESTDIR)$(BINDIR)
|
---|
| 97 | + install -c tools/e2writeboot $(DESTDIR)$(BINDIR)
|
---|
| 98 | + install -c tools/isomarkboot $(DESTDIR)$(BINDIR)
|
---|
| 99 | + install -c sdisklabel/swriteboot $(DESTDIR)$(BINDIR)
|
---|
| 100 | + install -c bootlx $(DESTDIR)$(BOOTDIR)
|
---|
| 101 |
|
---|
| 102 | installondisk: bootlx sdisklabel/swriteboot
|
---|
| 103 | sdisklabel/swriteboot -vf0 /dev/sda bootlx vmlinux.gz
|
---|
| 104 | @@ -107,9 +96,6 @@
|
---|
| 105 | $(CC) $(ABOOT_OBJS) $(DISK_OBJS) -o $@ $(LIBS)
|
---|
| 106 | endif
|
---|
| 107 |
|
---|
| 108 | -vmlinux.bootp: net_aboot.nh $(VMLINUXGZ) net_pad
|
---|
| 109 | - cat net_aboot.nh $(VMLINUXGZ) net_pad > $@
|
---|
| 110 | -
|
---|
| 111 | net_aboot.nh: net_aboot tools/objstrip
|
---|
| 112 | tools/objstrip -vb net_aboot $@
|
---|
| 113 |
|
---|
| 114 | @@ -120,26 +106,19 @@
|
---|
| 115 | dd if=/dev/zero of=$@ bs=512 count=1
|
---|
| 116 |
|
---|
| 117 | clean: sdisklabel/clean tools/clean lib/clean
|
---|
| 118 | - rm -f aboot abootconf net_aboot net_aboot.nh net_pad vmlinux.bootp \
|
---|
| 119 | - $(ABOOT_OBJS) $(DISK_OBJS) $(NET_OBJS) bootlx \
|
---|
| 120 | - include/ksize.h vmlinux.nh
|
---|
| 121 | + rm -f aboot abootconf net_aboot net_aboot.nh net_pad \
|
---|
| 122 | + $(ABOOT_OBJS) $(DISK_OBJS) $(NET_OBJS) bootlx
|
---|
| 123 |
|
---|
| 124 | distclean: clean
|
---|
| 125 | find . -name \*~ | xargs rm -f
|
---|
| 126 |
|
---|
| 127 | lib/%:
|
---|
| 128 | - make -C lib $* CPPFLAGS="$(CPPFLAGS)" TESTING="$(TESTING)"
|
---|
| 129 | + $(MAKE) -C lib $* CPPFLAGS="$(CPPFLAGS)" TESTING="$(TESTING)"
|
---|
| 130 |
|
---|
| 131 | tools/%:
|
---|
| 132 | - make -C tools $* CPPFLAGS="$(CPPFLAGS)"
|
---|
| 133 | + $(MAKE) -C tools $* CPPFLAGS="$(CPPFLAGS)"
|
---|
| 134 |
|
---|
| 135 | sdisklabel/%:
|
---|
| 136 | - make -C sdisklabel $* CPPFLAGS="$(CPPFLAGS)"
|
---|
| 137 | -
|
---|
| 138 | -vmlinux.nh: $(VMLINUX) tools/objstrip
|
---|
| 139 | - tools/objstrip -vb $(VMLINUX) vmlinux.nh
|
---|
| 140 | -
|
---|
| 141 | -include/ksize.h: vmlinux.nh
|
---|
| 142 | - echo "#define KERNEL_SIZE `ls -l vmlinux.nh | awk '{print $$5}'` > $@
|
---|
| 143 | + $(MAKE) -C sdisklabel $* CPPFLAGS="$(CPPFLAGS)"
|
---|
| 144 |
|
---|
| 145 | dep:
|
---|
| 146 | diff -Naur aboot-0.9b.orig/Makefile.inc aboot-0.9b/Makefile.inc
|
---|
| 147 | --- aboot-0.9b.orig/Makefile.inc 1969-12-31 19:00:00.000000000 -0500
|
---|
| 148 | +++ aboot-0.9b/Makefile.inc 2008-01-02 13:55:10.000000000 -0500
|
---|
| 149 | @@ -0,0 +1,16 @@
|
---|
| 150 | +DESTDIR =
|
---|
| 151 | +PREFIX = /usr
|
---|
| 152 | +EXEC_PREFIX = $(PREFIX)
|
---|
| 153 | +BINDIR = /sbin
|
---|
| 154 | +BOOTDIR = /boot
|
---|
| 155 | +MANDIR = $(PREFIX)/man
|
---|
| 156 | +MAN5 = $(MANDIR)/man5
|
---|
| 157 | +MAN8 = $(MANDIR)/man8
|
---|
| 158 | +
|
---|
| 159 | +CROSS_COMPILE =
|
---|
| 160 | +
|
---|
| 161 | +HOST_CC = gcc
|
---|
| 162 | +CC = $(CROSS_COMPILE)gcc
|
---|
| 163 | +AS = $(CROSS_COMPILE)as
|
---|
| 164 | +LD = $(CROSS_COMPILE)ld
|
---|
| 165 | +AR = $(CROSS_COMPILE)ar
|
---|
| 166 | diff -Naur aboot-0.9b.orig/aboot.c aboot-0.9b/aboot.c
|
---|
| 167 | --- aboot-0.9b.orig/aboot.c 2001-10-12 02:04:06.000000000 -0400
|
---|
| 168 | +++ aboot-0.9b/aboot.c 2008-01-02 13:53:15.000000000 -0500
|
---|
| 169 | @@ -90,7 +90,7 @@
|
---|
| 170 | elf = (struct elfhdr *) buf;
|
---|
| 171 |
|
---|
| 172 | if (elf->e_ident[0] == 0x7f
|
---|
| 173 | - && strncmp(elf->e_ident + 1, "ELF", 3) == 0)
|
---|
| 174 | + && strncmp((char *)elf->e_ident + 1, "ELF", 3) == 0)
|
---|
| 175 | {
|
---|
| 176 | int i;
|
---|
| 177 | /* looks like an ELF binary: */
|
---|
| 178 | diff -Naur aboot-0.9b.orig/cons.c aboot-0.9b/cons.c
|
---|
| 179 | --- aboot-0.9b.orig/cons.c 2001-10-08 19:03:50.000000000 -0400
|
---|
| 180 | +++ aboot-0.9b/cons.c 2008-01-02 13:53:15.000000000 -0500
|
---|
| 181 | @@ -12,7 +12,7 @@
|
---|
| 182 | #include <utils.h>
|
---|
| 183 |
|
---|
| 184 | long cons_dev; /* console device */
|
---|
| 185 | -extern long int dispatch(); /* Need the full 64 bit return here...*/
|
---|
| 186 | +//extern long int dispatch(); /* Need the full 64 bit return here...*/
|
---|
| 187 |
|
---|
| 188 | long
|
---|
| 189 | cons_puts(const char *str, long len)
|
---|
| 190 | diff -Naur aboot-0.9b.orig/disk.c aboot-0.9b/disk.c
|
---|
| 191 | --- aboot-0.9b.orig/disk.c 2001-10-09 16:45:57.000000000 -0400
|
---|
| 192 | +++ aboot-0.9b/disk.c 2008-01-02 13:53:15.000000000 -0500
|
---|
| 193 | @@ -121,7 +121,7 @@
|
---|
| 194 | buf = malloc(bfs->blocksize);
|
---|
| 195 |
|
---|
| 196 | /* read ELF headers: */
|
---|
| 197 | - nread = (*bfs->bread)(fd, 0, 1, buf);
|
---|
| 198 | + nread = (*bfs->bread)(fd, 0, 1, (char *)buf);
|
---|
| 199 | if (nread != bfs->blocksize) {
|
---|
| 200 | printf("aboot: read returned %ld instead of %ld bytes\n",
|
---|
| 201 | nread, sizeof(buf));
|
---|
| 202 | @@ -142,7 +142,7 @@
|
---|
| 203 | }
|
---|
| 204 | }
|
---|
| 205 | #endif
|
---|
| 206 | - if (first_block(buf, bfs->blocksize) < 0) {
|
---|
| 207 | + if (first_block((char *)buf, bfs->blocksize) < 0) {
|
---|
| 208 | return -1;
|
---|
| 209 | }
|
---|
| 210 |
|
---|
| 211 | @@ -481,8 +481,6 @@
|
---|
| 212 | *d++ = *p;
|
---|
| 213 | }
|
---|
| 214 | break;
|
---|
| 215 | -
|
---|
| 216 | - default:
|
---|
| 217 | }
|
---|
| 218 | p++;
|
---|
| 219 | }
|
---|
| 220 | diff -Naur aboot-0.9b.orig/doc/man/Makefile aboot-0.9b/doc/man/Makefile
|
---|
| 221 | --- aboot-0.9b.orig/doc/man/Makefile 2003-01-14 15:12:14.000000000 -0500
|
---|
| 222 | +++ aboot-0.9b/doc/man/Makefile 2008-01-02 13:53:15.000000000 -0500
|
---|
| 223 | @@ -5,22 +5,16 @@
|
---|
| 224 | # if this is a recursive make, and mandir was set in the top-level Makefile,
|
---|
| 225 | # use that value. Otherwise default to /usr/man.
|
---|
| 226 |
|
---|
| 227 | -ifeq ($(mandir),)
|
---|
| 228 | -MANDIR=/usr/man
|
---|
| 229 | -else
|
---|
| 230 | -MANDIR=$(mandir)
|
---|
| 231 | -endif
|
---|
| 232 | -MAN5=$(MANDIR)/man5
|
---|
| 233 | -MAN8=$(MANDIR)/man8
|
---|
| 234 | +include ../../Makefile.inc
|
---|
| 235 |
|
---|
| 236 | -default:
|
---|
| 237 | +all:
|
---|
| 238 |
|
---|
| 239 | install:
|
---|
| 240 | - install -d $(MAN5) $(MAN8)
|
---|
| 241 | - install -c aboot.conf.5 $(MAN5)
|
---|
| 242 | - install -c aboot.8 abootconf.8 e2writeboot.8 swriteboot.8 $(MAN8)
|
---|
| 243 | -install-gz: install
|
---|
| 244 | - gzip -f9 $(MAN5)/aboot.conf.5
|
---|
| 245 | - gzip -f9 $(MAN8)/aboot.8 $(MAN8)/abootconf.8 $(MAN8)/e2writeboot.8 \
|
---|
| 246 | - $(MAN8)/swriteboot.8
|
---|
| 247 | -install-gzip: install-gz
|
---|
| 248 | + install -d $(DESTDIR)$(MAN5) $(DESTDIR)$(MAN8)
|
---|
| 249 | + install -c aboot.conf.5 $(DESTDIR)$(MAN5)
|
---|
| 250 | + install -c aboot.8 abootconf.8 e2writeboot.8 swriteboot.8 $(DESTDIR)$(MAN8)
|
---|
| 251 | +
|
---|
| 252 | +install-gz install-gzip: install
|
---|
| 253 | + gzip -f9 $(DESTDIR)$(MAN5)/aboot.conf.5
|
---|
| 254 | + gzip -f9 $(DESTDIR)$(MAN8)/aboot.8 $(DESTDIR)$(MAN8)/abootconf.8 $(DESTDIR)$(MAN8)/e2writeboot.8 \
|
---|
| 255 | + $(DESTDIR)$(MAN8)/swriteboot.8
|
---|
| 256 | diff -Naur aboot-0.9b.orig/fs/ufs.c aboot-0.9b/fs/ufs.c
|
---|
| 257 | --- aboot-0.9b.orig/fs/ufs.c 2001-10-08 19:03:52.000000000 -0400
|
---|
| 258 | +++ aboot-0.9b/fs/ufs.c 2008-01-02 13:53:15.000000000 -0500
|
---|
| 259 | @@ -361,7 +361,7 @@
|
---|
| 260 | return -1;
|
---|
| 261 | }
|
---|
| 262 |
|
---|
| 263 | - component = strtok(namebuf, "/");
|
---|
| 264 | + component = strtok((char *)namebuf, "/");
|
---|
| 265 | while (component) {
|
---|
| 266 | /* verify that current node is a directory: */
|
---|
| 267 | if ((fp->i_mode & IFMT) != IFDIR) {
|
---|
| 268 | diff -Naur aboot-0.9b.orig/head.S aboot-0.9b/head.S
|
---|
| 269 | --- aboot-0.9b.orig/head.S 2001-10-08 19:03:51.000000000 -0400
|
---|
| 270 | +++ aboot-0.9b/head.S 2008-01-02 13:53:15.000000000 -0500
|
---|
| 271 | @@ -170,4 +170,5 @@
|
---|
| 272 | mov $16,$27
|
---|
| 273 | mov $17,$30
|
---|
| 274 | jmp $31,($27)
|
---|
| 275 | - .end run_kernel
|
---|
| 276 | \ No newline at end of file
|
---|
| 277 | + .end run_kernel
|
---|
| 278 | +
|
---|
| 279 | diff -Naur aboot-0.9b.orig/include/asm/a.out.h aboot-0.9b/include/asm/a.out.h
|
---|
| 280 | --- aboot-0.9b.orig/include/asm/a.out.h 1969-12-31 19:00:00.000000000 -0500
|
---|
| 281 | +++ aboot-0.9b/include/asm/a.out.h 2008-01-02 13:53:15.000000000 -0500
|
---|
| 282 | @@ -0,0 +1,92 @@
|
---|
| 283 | +#ifndef __ALPHA_A_OUT_H__
|
---|
| 284 | +#define __ALPHA_A_OUT_H__
|
---|
| 285 | +
|
---|
| 286 | +#include <linux/types.h>
|
---|
| 287 | +
|
---|
| 288 | +/*
|
---|
| 289 | + * OSF/1 ECOFF header structs. ECOFF files consist of:
|
---|
| 290 | + * - a file header (struct filehdr),
|
---|
| 291 | + * - an a.out header (struct aouthdr),
|
---|
| 292 | + * - one or more section headers (struct scnhdr).
|
---|
| 293 | + * The filhdr's "f_nscns" field contains the
|
---|
| 294 | + * number of section headers.
|
---|
| 295 | + */
|
---|
| 296 | +
|
---|
| 297 | +struct filehdr
|
---|
| 298 | +{
|
---|
| 299 | + /* OSF/1 "file" header */
|
---|
| 300 | + __u16 f_magic, f_nscns;
|
---|
| 301 | + __u32 f_timdat;
|
---|
| 302 | + __u64 f_symptr;
|
---|
| 303 | + __u32 f_nsyms;
|
---|
| 304 | + __u16 f_opthdr, f_flags;
|
---|
| 305 | +};
|
---|
| 306 | +
|
---|
| 307 | +struct aouthdr
|
---|
| 308 | +{
|
---|
| 309 | + __u64 info; /* after that it looks quite normal.. */
|
---|
| 310 | + __u64 tsize;
|
---|
| 311 | + __u64 dsize;
|
---|
| 312 | + __u64 bsize;
|
---|
| 313 | + __u64 entry;
|
---|
| 314 | + __u64 text_start; /* with a few additions that actually make sense */
|
---|
| 315 | + __u64 data_start;
|
---|
| 316 | + __u64 bss_start;
|
---|
| 317 | + __u32 gprmask, fprmask; /* bitmask of general & floating point regs used in binary */
|
---|
| 318 | + __u64 gpvalue;
|
---|
| 319 | +};
|
---|
| 320 | +
|
---|
| 321 | +struct scnhdr
|
---|
| 322 | +{
|
---|
| 323 | + char s_name[8];
|
---|
| 324 | + __u64 s_paddr;
|
---|
| 325 | + __u64 s_vaddr;
|
---|
| 326 | + __u64 s_size;
|
---|
| 327 | + __u64 s_scnptr;
|
---|
| 328 | + __u64 s_relptr;
|
---|
| 329 | + __u64 s_lnnoptr;
|
---|
| 330 | + __u16 s_nreloc;
|
---|
| 331 | + __u16 s_nlnno;
|
---|
| 332 | + __u32 s_flags;
|
---|
| 333 | +};
|
---|
| 334 | +
|
---|
| 335 | +struct exec
|
---|
| 336 | +{
|
---|
| 337 | + /* OSF/1 "file" header */
|
---|
| 338 | + struct filehdr fh;
|
---|
| 339 | + struct aouthdr ah;
|
---|
| 340 | +};
|
---|
| 341 | +
|
---|
| 342 | +/*
|
---|
| 343 | + * Define's so that the kernel exec code can access the a.out header
|
---|
| 344 | + * fields...
|
---|
| 345 | + */
|
---|
| 346 | +#define a_info ah.info
|
---|
| 347 | +#define a_text ah.tsize
|
---|
| 348 | +#define a_data ah.dsize
|
---|
| 349 | +#define a_bss ah.bsize
|
---|
| 350 | +#define a_entry ah.entry
|
---|
| 351 | +#define a_textstart ah.text_start
|
---|
| 352 | +#define a_datastart ah.data_start
|
---|
| 353 | +#define a_bssstart ah.bss_start
|
---|
| 354 | +#define a_gprmask ah.gprmask
|
---|
| 355 | +#define a_fprmask ah.fprmask
|
---|
| 356 | +#define a_gpvalue ah.gpvalue
|
---|
| 357 | +
|
---|
| 358 | +#define N_TXTADDR(x) ((x).a_textstart)
|
---|
| 359 | +#define N_DATADDR(x) ((x).a_datastart)
|
---|
| 360 | +#define N_BSSADDR(x) ((x).a_bssstart)
|
---|
| 361 | +#define N_DRSIZE(x) 0
|
---|
| 362 | +#define N_TRSIZE(x) 0
|
---|
| 363 | +#define N_SYMSIZE(x) 0
|
---|
| 364 | +
|
---|
| 365 | +#define AOUTHSZ sizeof(struct aouthdr)
|
---|
| 366 | +#define SCNHSZ sizeof(struct scnhdr)
|
---|
| 367 | +#define SCNROUND 16
|
---|
| 368 | +
|
---|
| 369 | +#define N_TXTOFF(x) \
|
---|
| 370 | + ((long) N_MAGIC(x) == ZMAGIC ? 0 : \
|
---|
| 371 | + (sizeof(struct exec) + (x).fh.f_nscns*SCNHSZ + SCNROUND - 1) & ~(SCNROUND - 1))
|
---|
| 372 | +
|
---|
| 373 | +
|
---|
| 374 | +#endif /* __A_OUT_GNU_H__ */
|
---|
| 375 | diff -Naur aboot-0.9b.orig/include/asm/auxvec.h aboot-0.9b/include/asm/auxvec.h
|
---|
| 376 | --- aboot-0.9b.orig/include/asm/auxvec.h 1969-12-31 19:00:00.000000000 -0500
|
---|
| 377 | +++ aboot-0.9b/include/asm/auxvec.h 2008-01-02 13:53:15.000000000 -0500
|
---|
| 378 | @@ -0,0 +1,24 @@
|
---|
| 379 | +#ifndef __ASM_ALPHA_AUXVEC_H
|
---|
| 380 | +#define __ASM_ALPHA_AUXVEC_H
|
---|
| 381 | +
|
---|
| 382 | +/* Reserve these numbers for any future use of a VDSO. */
|
---|
| 383 | +#if 0
|
---|
| 384 | +#define AT_SYSINFO 32
|
---|
| 385 | +#define AT_SYSINFO_EHDR 33
|
---|
| 386 | +#endif
|
---|
| 387 | +
|
---|
| 388 | +/* More complete cache descriptions than AT_[DIU]CACHEBSIZE. If the
|
---|
| 389 | + value is -1, then the cache doesn't exist. Otherwise:
|
---|
| 390 | +
|
---|
| 391 | + bit 0-3: Cache set-associativity; 0 means fully associative.
|
---|
| 392 | + bit 4-7: Log2 of cacheline size.
|
---|
| 393 | + bit 8-31: Size of the entire cache >> 8.
|
---|
| 394 | + bit 32-63: Reserved.
|
---|
| 395 | +*/
|
---|
| 396 | +
|
---|
| 397 | +#define AT_L1I_CACHESHAPE 34
|
---|
| 398 | +#define AT_L1D_CACHESHAPE 35
|
---|
| 399 | +#define AT_L2_CACHESHAPE 36
|
---|
| 400 | +#define AT_L3_CACHESHAPE 37
|
---|
| 401 | +
|
---|
| 402 | +#endif /* __ASM_ALPHA_AUXVEC_H */
|
---|
| 403 | diff -Naur aboot-0.9b.orig/include/asm/console.h aboot-0.9b/include/asm/console.h
|
---|
| 404 | --- aboot-0.9b.orig/include/asm/console.h 1969-12-31 19:00:00.000000000 -0500
|
---|
| 405 | +++ aboot-0.9b/include/asm/console.h 2008-01-02 13:53:15.000000000 -0500
|
---|
| 406 | @@ -0,0 +1,50 @@
|
---|
| 407 | +#ifndef __AXP_CONSOLE_H
|
---|
| 408 | +#define __AXP_CONSOLE_H
|
---|
| 409 | +
|
---|
| 410 | +/*
|
---|
| 411 | + * Console callback routine numbers
|
---|
| 412 | + */
|
---|
| 413 | +#define CCB_GETC 0x01
|
---|
| 414 | +#define CCB_PUTS 0x02
|
---|
| 415 | +#define CCB_RESET_TERM 0x03
|
---|
| 416 | +#define CCB_SET_TERM_INT 0x04
|
---|
| 417 | +#define CCB_SET_TERM_CTL 0x05
|
---|
| 418 | +#define CCB_PROCESS_KEYCODE 0x06
|
---|
| 419 | +#define CCB_OPEN_CONSOLE 0x07
|
---|
| 420 | +#define CCB_CLOSE_CONSOLE 0x08
|
---|
| 421 | +
|
---|
| 422 | +#define CCB_OPEN 0x10
|
---|
| 423 | +#define CCB_CLOSE 0x11
|
---|
| 424 | +#define CCB_IOCTL 0x12
|
---|
| 425 | +#define CCB_READ 0x13
|
---|
| 426 | +#define CCB_WRITE 0x14
|
---|
| 427 | +
|
---|
| 428 | +#define CCB_SET_ENV 0x20
|
---|
| 429 | +#define CCB_RESET_ENV 0x21
|
---|
| 430 | +#define CCB_GET_ENV 0x22
|
---|
| 431 | +#define CCB_SAVE_ENV 0x23
|
---|
| 432 | +
|
---|
| 433 | +#define CCB_PSWITCH 0x30
|
---|
| 434 | +#define CCB_BIOS_EMUL 0x32
|
---|
| 435 | +
|
---|
| 436 | +/*
|
---|
| 437 | + * Environment variable numbers
|
---|
| 438 | + */
|
---|
| 439 | +#define ENV_AUTO_ACTION 0x01
|
---|
| 440 | +#define ENV_BOOT_DEV 0x02
|
---|
| 441 | +#define ENV_BOOTDEF_DEV 0x03
|
---|
| 442 | +#define ENV_BOOTED_DEV 0x04
|
---|
| 443 | +#define ENV_BOOT_FILE 0x05
|
---|
| 444 | +#define ENV_BOOTED_FILE 0x06
|
---|
| 445 | +#define ENV_BOOT_OSFLAGS 0x07
|
---|
| 446 | +#define ENV_BOOTED_OSFLAGS 0x08
|
---|
| 447 | +#define ENV_BOOT_RESET 0x09
|
---|
| 448 | +#define ENV_DUMP_DEV 0x0A
|
---|
| 449 | +#define ENV_ENABLE_AUDIT 0x0B
|
---|
| 450 | +#define ENV_LICENSE 0x0C
|
---|
| 451 | +#define ENV_CHAR_SET 0x0D
|
---|
| 452 | +#define ENV_LANGUAGE 0x0E
|
---|
| 453 | +#define ENV_TTY_DEV 0x0F
|
---|
| 454 | +
|
---|
| 455 | +
|
---|
| 456 | +#endif /* __AXP_CONSOLE_H */
|
---|
| 457 | diff -Naur aboot-0.9b.orig/include/asm/elf.h aboot-0.9b/include/asm/elf.h
|
---|
| 458 | --- aboot-0.9b.orig/include/asm/elf.h 1969-12-31 19:00:00.000000000 -0500
|
---|
| 459 | +++ aboot-0.9b/include/asm/elf.h 2008-01-02 13:53:15.000000000 -0500
|
---|
| 460 | @@ -0,0 +1,167 @@
|
---|
| 461 | +#ifndef __ASM_ALPHA_ELF_H
|
---|
| 462 | +#define __ASM_ALPHA_ELF_H
|
---|
| 463 | +
|
---|
| 464 | +#include <asm/auxvec.h>
|
---|
| 465 | +
|
---|
| 466 | +/* Special values for the st_other field in the symbol table. */
|
---|
| 467 | +
|
---|
| 468 | +#define STO_ALPHA_NOPV 0x80
|
---|
| 469 | +#define STO_ALPHA_STD_GPLOAD 0x88
|
---|
| 470 | +
|
---|
| 471 | +/*
|
---|
| 472 | + * Alpha ELF relocation types
|
---|
| 473 | + */
|
---|
| 474 | +#define R_ALPHA_NONE 0 /* No reloc */
|
---|
| 475 | +#define R_ALPHA_REFLONG 1 /* Direct 32 bit */
|
---|
| 476 | +#define R_ALPHA_REFQUAD 2 /* Direct 64 bit */
|
---|
| 477 | +#define R_ALPHA_GPREL32 3 /* GP relative 32 bit */
|
---|
| 478 | +#define R_ALPHA_LITERAL 4 /* GP relative 16 bit w/optimization */
|
---|
| 479 | +#define R_ALPHA_LITUSE 5 /* Optimization hint for LITERAL */
|
---|
| 480 | +#define R_ALPHA_GPDISP 6 /* Add displacement to GP */
|
---|
| 481 | +#define R_ALPHA_BRADDR 7 /* PC+4 relative 23 bit shifted */
|
---|
| 482 | +#define R_ALPHA_HINT 8 /* PC+4 relative 16 bit shifted */
|
---|
| 483 | +#define R_ALPHA_SREL16 9 /* PC relative 16 bit */
|
---|
| 484 | +#define R_ALPHA_SREL32 10 /* PC relative 32 bit */
|
---|
| 485 | +#define R_ALPHA_SREL64 11 /* PC relative 64 bit */
|
---|
| 486 | +#define R_ALPHA_GPRELHIGH 17 /* GP relative 32 bit, high 16 bits */
|
---|
| 487 | +#define R_ALPHA_GPRELLOW 18 /* GP relative 32 bit, low 16 bits */
|
---|
| 488 | +#define R_ALPHA_GPREL16 19 /* GP relative 16 bit */
|
---|
| 489 | +#define R_ALPHA_COPY 24 /* Copy symbol at runtime */
|
---|
| 490 | +#define R_ALPHA_GLOB_DAT 25 /* Create GOT entry */
|
---|
| 491 | +#define R_ALPHA_JMP_SLOT 26 /* Create PLT entry */
|
---|
| 492 | +#define R_ALPHA_RELATIVE 27 /* Adjust by program base */
|
---|
| 493 | +#define R_ALPHA_BRSGP 28
|
---|
| 494 | +#define R_ALPHA_TLSGD 29
|
---|
| 495 | +#define R_ALPHA_TLS_LDM 30
|
---|
| 496 | +#define R_ALPHA_DTPMOD64 31
|
---|
| 497 | +#define R_ALPHA_GOTDTPREL 32
|
---|
| 498 | +#define R_ALPHA_DTPREL64 33
|
---|
| 499 | +#define R_ALPHA_DTPRELHI 34
|
---|
| 500 | +#define R_ALPHA_DTPRELLO 35
|
---|
| 501 | +#define R_ALPHA_DTPREL16 36
|
---|
| 502 | +#define R_ALPHA_GOTTPREL 37
|
---|
| 503 | +#define R_ALPHA_TPREL64 38
|
---|
| 504 | +#define R_ALPHA_TPRELHI 39
|
---|
| 505 | +#define R_ALPHA_TPRELLO 40
|
---|
| 506 | +#define R_ALPHA_TPREL16 41
|
---|
| 507 | +
|
---|
| 508 | +#define SHF_ALPHA_GPREL 0x10000000
|
---|
| 509 | +
|
---|
| 510 | +/* Legal values for e_flags field of Elf64_Ehdr. */
|
---|
| 511 | +
|
---|
| 512 | +#define EF_ALPHA_32BIT 1 /* All addresses are below 2GB */
|
---|
| 513 | +
|
---|
| 514 | +/*
|
---|
| 515 | + * ELF register definitions..
|
---|
| 516 | + */
|
---|
| 517 | +
|
---|
| 518 | +/*
|
---|
| 519 | + * The OSF/1 version of <sys/procfs.h> makes gregset_t 46 entries long.
|
---|
| 520 | + * I have no idea why that is so. For now, we just leave it at 33
|
---|
| 521 | + * (32 general regs + processor status word).
|
---|
| 522 | + */
|
---|
| 523 | +#define ELF_NGREG 33
|
---|
| 524 | +#define ELF_NFPREG 32
|
---|
| 525 | +
|
---|
| 526 | +typedef unsigned long elf_greg_t;
|
---|
| 527 | +typedef elf_greg_t elf_gregset_t[ELF_NGREG];
|
---|
| 528 | +
|
---|
| 529 | +typedef double elf_fpreg_t;
|
---|
| 530 | +typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
|
---|
| 531 | +
|
---|
| 532 | +/*
|
---|
| 533 | + * This is used to ensure we don't load something for the wrong architecture.
|
---|
| 534 | + */
|
---|
| 535 | +#define elf_check_arch(x) ((x)->e_machine == EM_ALPHA)
|
---|
| 536 | +
|
---|
| 537 | +/*
|
---|
| 538 | + * These are used to set parameters in the core dumps.
|
---|
| 539 | + */
|
---|
| 540 | +#define ELF_CLASS ELFCLASS64
|
---|
| 541 | +#define ELF_DATA ELFDATA2LSB
|
---|
| 542 | +#define ELF_ARCH EM_ALPHA
|
---|
| 543 | +
|
---|
| 544 | +#define USE_ELF_CORE_DUMP
|
---|
| 545 | +#define ELF_EXEC_PAGESIZE 8192
|
---|
| 546 | +
|
---|
| 547 | +/* This is the location that an ET_DYN program is loaded if exec'ed. Typical
|
---|
| 548 | + use of this is to invoke "./ld.so someprog" to test out a new version of
|
---|
| 549 | + the loader. We need to make sure that it is out of the way of the program
|
---|
| 550 | + that it will "exec", and that there is sufficient room for the brk. */
|
---|
| 551 | +
|
---|
| 552 | +#define ELF_ET_DYN_BASE (TASK_UNMAPPED_BASE + 0x1000000)
|
---|
| 553 | +
|
---|
| 554 | +/* $0 is set by ld.so to a pointer to a function which might be
|
---|
| 555 | + registered using atexit. This provides a mean for the dynamic
|
---|
| 556 | + linker to call DT_FINI functions for shared libraries that have
|
---|
| 557 | + been loaded before the code runs.
|
---|
| 558 | +
|
---|
| 559 | + So that we can use the same startup file with static executables,
|
---|
| 560 | + we start programs with a value of 0 to indicate that there is no
|
---|
| 561 | + such function. */
|
---|
| 562 | +
|
---|
| 563 | +#define ELF_PLAT_INIT(_r, load_addr) _r->r0 = 0
|
---|
| 564 | +
|
---|
| 565 | +/* The registers are layed out in pt_regs for PAL and syscall
|
---|
| 566 | + convenience. Re-order them for the linear elf_gregset_t. */
|
---|
| 567 | +
|
---|
| 568 | +struct pt_regs;
|
---|
| 569 | +struct thread_info;
|
---|
| 570 | +struct task_struct;
|
---|
| 571 | +extern void dump_elf_thread(elf_greg_t *dest, struct pt_regs *pt,
|
---|
| 572 | + struct thread_info *ti);
|
---|
| 573 | +#define ELF_CORE_COPY_REGS(DEST, REGS) \
|
---|
| 574 | + dump_elf_thread(DEST, REGS, current_thread_info());
|
---|
| 575 | +
|
---|
| 576 | +/* Similar, but for a thread other than current. */
|
---|
| 577 | +
|
---|
| 578 | +extern int dump_elf_task(elf_greg_t *dest, struct task_struct *task);
|
---|
| 579 | +#define ELF_CORE_COPY_TASK_REGS(TASK, DEST) \
|
---|
| 580 | + dump_elf_task(*(DEST), TASK)
|
---|
| 581 | +
|
---|
| 582 | +/* Similar, but for the FP registers. */
|
---|
| 583 | +
|
---|
| 584 | +extern int dump_elf_task_fp(elf_fpreg_t *dest, struct task_struct *task);
|
---|
| 585 | +#define ELF_CORE_COPY_FPREGS(TASK, DEST) \
|
---|
| 586 | + dump_elf_task_fp(*(DEST), TASK)
|
---|
| 587 | +
|
---|
| 588 | +/* This yields a mask that user programs can use to figure out what
|
---|
| 589 | + instruction set this CPU supports. This is trivial on Alpha,
|
---|
| 590 | + but not so on other machines. */
|
---|
| 591 | +
|
---|
| 592 | +#define ELF_HWCAP (~amask(-1))
|
---|
| 593 | +
|
---|
| 594 | +/* This yields a string that ld.so will use to load implementation
|
---|
| 595 | + specific libraries for optimization. This is more specific in
|
---|
| 596 | + intent than poking at uname or /proc/cpuinfo. */
|
---|
| 597 | +
|
---|
| 598 | +#define ELF_PLATFORM \
|
---|
| 599 | +({ \
|
---|
| 600 | + enum implver_enum i_ = implver(); \
|
---|
| 601 | + ( i_ == IMPLVER_EV4 ? "ev4" \
|
---|
| 602 | + : i_ == IMPLVER_EV5 \
|
---|
| 603 | + ? (amask(AMASK_BWX) ? "ev5" : "ev56") \
|
---|
| 604 | + : amask (AMASK_CIX) ? "ev6" : "ev67"); \
|
---|
| 605 | +})
|
---|
| 606 | +
|
---|
| 607 | +#ifdef __KERNEL__
|
---|
| 608 | +
|
---|
| 609 | +#define SET_PERSONALITY(EX, IBCS2) \
|
---|
| 610 | + set_personality(((EX).e_flags & EF_ALPHA_32BIT) \
|
---|
| 611 | + ? PER_LINUX_32BIT : (IBCS2) ? PER_SVR4 : PER_LINUX)
|
---|
| 612 | +
|
---|
| 613 | +extern int alpha_l1i_cacheshape;
|
---|
| 614 | +extern int alpha_l1d_cacheshape;
|
---|
| 615 | +extern int alpha_l2_cacheshape;
|
---|
| 616 | +extern int alpha_l3_cacheshape;
|
---|
| 617 | +
|
---|
| 618 | +#define ARCH_DLINFO \
|
---|
| 619 | + do { \
|
---|
| 620 | + NEW_AUX_ENT(AT_L1I_CACHESHAPE, alpha_l1i_cacheshape); \
|
---|
| 621 | + NEW_AUX_ENT(AT_L1D_CACHESHAPE, alpha_l1d_cacheshape); \
|
---|
| 622 | + NEW_AUX_ENT(AT_L2_CACHESHAPE, alpha_l2_cacheshape); \
|
---|
| 623 | + NEW_AUX_ENT(AT_L3_CACHESHAPE, alpha_l3_cacheshape); \
|
---|
| 624 | + } while (0)
|
---|
| 625 | +
|
---|
| 626 | +#endif /* __KERNEL__ */
|
---|
| 627 | +#endif /* __ASM_ALPHA_ELF_H */
|
---|
| 628 | diff -Naur aboot-0.9b.orig/include/asm/hwrpb.h aboot-0.9b/include/asm/hwrpb.h
|
---|
| 629 | --- aboot-0.9b.orig/include/asm/hwrpb.h 1969-12-31 19:00:00.000000000 -0500
|
---|
| 630 | +++ aboot-0.9b/include/asm/hwrpb.h 2008-01-02 13:53:15.000000000 -0500
|
---|
| 631 | @@ -0,0 +1,220 @@
|
---|
| 632 | +#ifndef __ALPHA_HWRPB_H
|
---|
| 633 | +#define __ALPHA_HWRPB_H
|
---|
| 634 | +
|
---|
| 635 | +#define INIT_HWRPB ((struct hwrpb_struct *) 0x10000000)
|
---|
| 636 | +
|
---|
| 637 | +/*
|
---|
| 638 | + * DEC processor types for Alpha systems. Found in HWRPB.
|
---|
| 639 | + * These values are architected.
|
---|
| 640 | + */
|
---|
| 641 | +
|
---|
| 642 | +#define EV3_CPU 1 /* EV3 */
|
---|
| 643 | +#define EV4_CPU 2 /* EV4 (21064) */
|
---|
| 644 | +#define LCA4_CPU 4 /* LCA4 (21066/21068) */
|
---|
| 645 | +#define EV5_CPU 5 /* EV5 (21164) */
|
---|
| 646 | +#define EV45_CPU 6 /* EV4.5 (21064/xxx) */
|
---|
| 647 | +#define EV56_CPU 7 /* EV5.6 (21164) */
|
---|
| 648 | +#define EV6_CPU 8 /* EV6 (21264) */
|
---|
| 649 | +#define PCA56_CPU 9 /* PCA56 (21164PC) */
|
---|
| 650 | +#define PCA57_CPU 10 /* PCA57 (notyet) */
|
---|
| 651 | +#define EV67_CPU 11 /* EV67 (21264A) */
|
---|
| 652 | +#define EV68CB_CPU 12 /* EV68CB (21264C) */
|
---|
| 653 | +#define EV68AL_CPU 13 /* EV68AL (21264B) */
|
---|
| 654 | +#define EV68CX_CPU 14 /* EV68CX (21264D) */
|
---|
| 655 | +#define EV7_CPU 15 /* EV7 (21364) */
|
---|
| 656 | +#define EV79_CPU 16 /* EV79 (21364??) */
|
---|
| 657 | +#define EV69_CPU 17 /* EV69 (21264/EV69A) */
|
---|
| 658 | +
|
---|
| 659 | +/*
|
---|
| 660 | + * DEC system types for Alpha systems. Found in HWRPB.
|
---|
| 661 | + * These values are architected.
|
---|
| 662 | + */
|
---|
| 663 | +
|
---|
| 664 | +#define ST_ADU 1 /* Alpha ADU systype */
|
---|
| 665 | +#define ST_DEC_4000 2 /* Cobra systype */
|
---|
| 666 | +#define ST_DEC_7000 3 /* Ruby systype */
|
---|
| 667 | +#define ST_DEC_3000_500 4 /* Flamingo systype */
|
---|
| 668 | +#define ST_DEC_2000_300 6 /* Jensen systype */
|
---|
| 669 | +#define ST_DEC_3000_300 7 /* Pelican systype */
|
---|
| 670 | +#define ST_DEC_2100_A500 9 /* Sable systype */
|
---|
| 671 | +#define ST_DEC_AXPVME_64 10 /* AXPvme system type */
|
---|
| 672 | +#define ST_DEC_AXPPCI_33 11 /* NoName system type */
|
---|
| 673 | +#define ST_DEC_TLASER 12 /* Turbolaser systype */
|
---|
| 674 | +#define ST_DEC_2100_A50 13 /* Avanti systype */
|
---|
| 675 | +#define ST_DEC_MUSTANG 14 /* Mustang systype */
|
---|
| 676 | +#define ST_DEC_ALCOR 15 /* Alcor (EV5) systype */
|
---|
| 677 | +#define ST_DEC_1000 17 /* Mikasa systype */
|
---|
| 678 | +#define ST_DEC_EB64 18 /* EB64 systype */
|
---|
| 679 | +#define ST_DEC_EB66 19 /* EB66 systype */
|
---|
| 680 | +#define ST_DEC_EB64P 20 /* EB64+ systype */
|
---|
| 681 | +#define ST_DEC_BURNS 21 /* laptop systype */
|
---|
| 682 | +#define ST_DEC_RAWHIDE 22 /* Rawhide systype */
|
---|
| 683 | +#define ST_DEC_K2 23 /* K2 systype */
|
---|
| 684 | +#define ST_DEC_LYNX 24 /* Lynx systype */
|
---|
| 685 | +#define ST_DEC_XL 25 /* Alpha XL systype */
|
---|
| 686 | +#define ST_DEC_EB164 26 /* EB164 systype */
|
---|
| 687 | +#define ST_DEC_NORITAKE 27 /* Noritake systype */
|
---|
| 688 | +#define ST_DEC_CORTEX 28 /* Cortex systype */
|
---|
| 689 | +#define ST_DEC_MIATA 30 /* Miata systype */
|
---|
| 690 | +#define ST_DEC_XXM 31 /* XXM systype */
|
---|
| 691 | +#define ST_DEC_TAKARA 32 /* Takara systype */
|
---|
| 692 | +#define ST_DEC_YUKON 33 /* Yukon systype */
|
---|
| 693 | +#define ST_DEC_TSUNAMI 34 /* Tsunami systype */
|
---|
| 694 | +#define ST_DEC_WILDFIRE 35 /* Wildfire systype */
|
---|
| 695 | +#define ST_DEC_CUSCO 36 /* CUSCO systype */
|
---|
| 696 | +#define ST_DEC_EIGER 37 /* Eiger systype */
|
---|
| 697 | +#define ST_DEC_TITAN 38 /* Titan systype */
|
---|
| 698 | +#define ST_DEC_MARVEL 39 /* Marvel systype */
|
---|
| 699 | +
|
---|
| 700 | +/* UNOFFICIAL!!! */
|
---|
| 701 | +#define ST_UNOFFICIAL_BIAS 100
|
---|
| 702 | +#define ST_DTI_RUFFIAN 101 /* RUFFIAN systype */
|
---|
| 703 | +
|
---|
| 704 | +/* Alpha Processor, Inc. systems */
|
---|
| 705 | +#define ST_API_BIAS 200
|
---|
| 706 | +#define ST_API_NAUTILUS 201 /* UP1000 systype */
|
---|
| 707 | +
|
---|
| 708 | +struct pcb_struct {
|
---|
| 709 | + unsigned long ksp;
|
---|
| 710 | + unsigned long usp;
|
---|
| 711 | + unsigned long ptbr;
|
---|
| 712 | + unsigned int pcc;
|
---|
| 713 | + unsigned int asn;
|
---|
| 714 | + unsigned long unique;
|
---|
| 715 | + unsigned long flags;
|
---|
| 716 | + unsigned long res1, res2;
|
---|
| 717 | +};
|
---|
| 718 | +
|
---|
| 719 | +struct percpu_struct {
|
---|
| 720 | + unsigned long hwpcb[16];
|
---|
| 721 | + unsigned long flags;
|
---|
| 722 | + unsigned long pal_mem_size;
|
---|
| 723 | + unsigned long pal_scratch_size;
|
---|
| 724 | + unsigned long pal_mem_pa;
|
---|
| 725 | + unsigned long pal_scratch_pa;
|
---|
| 726 | + unsigned long pal_revision;
|
---|
| 727 | + unsigned long type;
|
---|
| 728 | + unsigned long variation;
|
---|
| 729 | + unsigned long revision;
|
---|
| 730 | + unsigned long serial_no[2];
|
---|
| 731 | + unsigned long logout_area_pa;
|
---|
| 732 | + unsigned long logout_area_len;
|
---|
| 733 | + unsigned long halt_PCBB;
|
---|
| 734 | + unsigned long halt_PC;
|
---|
| 735 | + unsigned long halt_PS;
|
---|
| 736 | + unsigned long halt_arg;
|
---|
| 737 | + unsigned long halt_ra;
|
---|
| 738 | + unsigned long halt_pv;
|
---|
| 739 | + unsigned long halt_reason;
|
---|
| 740 | + unsigned long res;
|
---|
| 741 | + unsigned long ipc_buffer[21];
|
---|
| 742 | + unsigned long palcode_avail[16];
|
---|
| 743 | + unsigned long compatibility;
|
---|
| 744 | + unsigned long console_data_log_pa;
|
---|
| 745 | + unsigned long console_data_log_length;
|
---|
| 746 | + unsigned long bcache_info;
|
---|
| 747 | +};
|
---|
| 748 | +
|
---|
| 749 | +struct procdesc_struct {
|
---|
| 750 | + unsigned long weird_vms_stuff;
|
---|
| 751 | + unsigned long address;
|
---|
| 752 | +};
|
---|
| 753 | +
|
---|
| 754 | +struct vf_map_struct {
|
---|
| 755 | + unsigned long va;
|
---|
| 756 | + unsigned long pa;
|
---|
| 757 | + unsigned long count;
|
---|
| 758 | +};
|
---|
| 759 | +
|
---|
| 760 | +struct crb_struct {
|
---|
| 761 | + struct procdesc_struct * dispatch_va;
|
---|
| 762 | + struct procdesc_struct * dispatch_pa;
|
---|
| 763 | + struct procdesc_struct * fixup_va;
|
---|
| 764 | + struct procdesc_struct * fixup_pa;
|
---|
| 765 | + /* virtual->physical map */
|
---|
| 766 | + unsigned long map_entries;
|
---|
| 767 | + unsigned long map_pages;
|
---|
| 768 | + struct vf_map_struct map[1];
|
---|
| 769 | +};
|
---|
| 770 | +
|
---|
| 771 | +struct memclust_struct {
|
---|
| 772 | + unsigned long start_pfn;
|
---|
| 773 | + unsigned long numpages;
|
---|
| 774 | + unsigned long numtested;
|
---|
| 775 | + unsigned long bitmap_va;
|
---|
| 776 | + unsigned long bitmap_pa;
|
---|
| 777 | + unsigned long bitmap_chksum;
|
---|
| 778 | + unsigned long usage;
|
---|
| 779 | +};
|
---|
| 780 | +
|
---|
| 781 | +struct memdesc_struct {
|
---|
| 782 | + unsigned long chksum;
|
---|
| 783 | + unsigned long optional_pa;
|
---|
| 784 | + unsigned long numclusters;
|
---|
| 785 | + struct memclust_struct cluster[0];
|
---|
| 786 | +};
|
---|
| 787 | +
|
---|
| 788 | +struct dsr_struct {
|
---|
| 789 | + long smm; /* SMM nubber used by LMF */
|
---|
| 790 | + unsigned long lurt_off; /* offset to LURT table */
|
---|
| 791 | + unsigned long sysname_off; /* offset to sysname char count */
|
---|
| 792 | +};
|
---|
| 793 | +
|
---|
| 794 | +struct hwrpb_struct {
|
---|
| 795 | + unsigned long phys_addr; /* check: physical address of the hwrpb */
|
---|
| 796 | + unsigned long id; /* check: "HWRPB\0\0\0" */
|
---|
| 797 | + unsigned long revision;
|
---|
| 798 | + unsigned long size; /* size of hwrpb */
|
---|
| 799 | + unsigned long cpuid;
|
---|
| 800 | + unsigned long pagesize; /* 8192, I hope */
|
---|
| 801 | + unsigned long pa_bits; /* number of physical address bits */
|
---|
| 802 | + unsigned long max_asn;
|
---|
| 803 | + unsigned char ssn[16]; /* system serial number: big bother is watching */
|
---|
| 804 | + unsigned long sys_type;
|
---|
| 805 | + unsigned long sys_variation;
|
---|
| 806 | + unsigned long sys_revision;
|
---|
| 807 | + unsigned long intr_freq; /* interval clock frequency * 4096 */
|
---|
| 808 | + unsigned long cycle_freq; /* cycle counter frequency */
|
---|
| 809 | + unsigned long vptb; /* Virtual Page Table Base address */
|
---|
| 810 | + unsigned long res1;
|
---|
| 811 | + unsigned long tbhb_offset; /* Translation Buffer Hint Block */
|
---|
| 812 | + unsigned long nr_processors;
|
---|
| 813 | + unsigned long processor_size;
|
---|
| 814 | + unsigned long processor_offset;
|
---|
| 815 | + unsigned long ctb_nr;
|
---|
| 816 | + unsigned long ctb_size; /* console terminal block size */
|
---|
| 817 | + unsigned long ctbt_offset; /* console terminal block table offset */
|
---|
| 818 | + unsigned long crb_offset; /* console callback routine block */
|
---|
| 819 | + unsigned long mddt_offset; /* memory data descriptor table */
|
---|
| 820 | + unsigned long cdb_offset; /* configuration data block (or NULL) */
|
---|
| 821 | + unsigned long frut_offset; /* FRU table (or NULL) */
|
---|
| 822 | + void (*save_terminal)(unsigned long);
|
---|
| 823 | + unsigned long save_terminal_data;
|
---|
| 824 | + void (*restore_terminal)(unsigned long);
|
---|
| 825 | + unsigned long restore_terminal_data;
|
---|
| 826 | + void (*CPU_restart)(unsigned long);
|
---|
| 827 | + unsigned long CPU_restart_data;
|
---|
| 828 | + unsigned long res2;
|
---|
| 829 | + unsigned long res3;
|
---|
| 830 | + unsigned long chksum;
|
---|
| 831 | + unsigned long rxrdy;
|
---|
| 832 | + unsigned long txrdy;
|
---|
| 833 | + unsigned long dsr_offset; /* "Dynamic System Recognition Data Block Table" */
|
---|
| 834 | +};
|
---|
| 835 | +
|
---|
| 836 | +#ifdef __KERNEL__
|
---|
| 837 | +
|
---|
| 838 | +extern struct hwrpb_struct *hwrpb;
|
---|
| 839 | +
|
---|
| 840 | +static inline void
|
---|
| 841 | +hwrpb_update_checksum(struct hwrpb_struct *h)
|
---|
| 842 | +{
|
---|
| 843 | + unsigned long sum = 0, *l;
|
---|
| 844 | + for (l = (unsigned long *) h; l < (unsigned long *) &h->chksum; ++l)
|
---|
| 845 | + sum += *l;
|
---|
| 846 | + h->chksum = sum;
|
---|
| 847 | +}
|
---|
| 848 | +
|
---|
| 849 | +#endif /* __KERNEL__ */
|
---|
| 850 | +
|
---|
| 851 | +#endif /* __ALPHA_HWRPB_H */
|
---|
| 852 | diff -Naur aboot-0.9b.orig/include/asm/ioctl.h aboot-0.9b/include/asm/ioctl.h
|
---|
| 853 | --- aboot-0.9b.orig/include/asm/ioctl.h 1969-12-31 19:00:00.000000000 -0500
|
---|
| 854 | +++ aboot-0.9b/include/asm/ioctl.h 2008-01-02 13:53:15.000000000 -0500
|
---|
| 855 | @@ -0,0 +1,66 @@
|
---|
| 856 | +#ifndef _ALPHA_IOCTL_H
|
---|
| 857 | +#define _ALPHA_IOCTL_H
|
---|
| 858 | +
|
---|
| 859 | +/*
|
---|
| 860 | + * The original linux ioctl numbering scheme was just a general
|
---|
| 861 | + * "anything goes" setup, where more or less random numbers were
|
---|
| 862 | + * assigned. Sorry, I was clueless when I started out on this.
|
---|
| 863 | + *
|
---|
| 864 | + * On the alpha, we'll try to clean it up a bit, using a more sane
|
---|
| 865 | + * ioctl numbering, and also trying to be compatible with OSF/1 in
|
---|
| 866 | + * the process. I'd like to clean it up for the i386 as well, but
|
---|
| 867 | + * it's so painful recognizing both the new and the old numbers..
|
---|
| 868 | + */
|
---|
| 869 | +
|
---|
| 870 | +#define _IOC_NRBITS 8
|
---|
| 871 | +#define _IOC_TYPEBITS 8
|
---|
| 872 | +#define _IOC_SIZEBITS 13
|
---|
| 873 | +#define _IOC_DIRBITS 3
|
---|
| 874 | +
|
---|
| 875 | +#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
|
---|
| 876 | +#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
|
---|
| 877 | +#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
|
---|
| 878 | +#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
|
---|
| 879 | +
|
---|
| 880 | +#define _IOC_NRSHIFT 0
|
---|
| 881 | +#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
|
---|
| 882 | +#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
|
---|
| 883 | +#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
|
---|
| 884 | +
|
---|
| 885 | +/*
|
---|
| 886 | + * Direction bits _IOC_NONE could be 0, but OSF/1 gives it a bit.
|
---|
| 887 | + * And this turns out useful to catch old ioctl numbers in header
|
---|
| 888 | + * files for us.
|
---|
| 889 | + */
|
---|
| 890 | +#define _IOC_NONE 1U
|
---|
| 891 | +#define _IOC_READ 2U
|
---|
| 892 | +#define _IOC_WRITE 4U
|
---|
| 893 | +
|
---|
| 894 | +#define _IOC(dir,type,nr,size) \
|
---|
| 895 | + ((unsigned int) \
|
---|
| 896 | + (((dir) << _IOC_DIRSHIFT) | \
|
---|
| 897 | + ((type) << _IOC_TYPESHIFT) | \
|
---|
| 898 | + ((nr) << _IOC_NRSHIFT) | \
|
---|
| 899 | + ((size) << _IOC_SIZESHIFT)))
|
---|
| 900 | +
|
---|
| 901 | +/* used to create numbers */
|
---|
| 902 | +#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
|
---|
| 903 | +#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
|
---|
| 904 | +#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
|
---|
| 905 | +#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
|
---|
| 906 | +
|
---|
| 907 | +/* used to decode them.. */
|
---|
| 908 | +#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
|
---|
| 909 | +#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
|
---|
| 910 | +#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
|
---|
| 911 | +#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
|
---|
| 912 | +
|
---|
| 913 | +/* ...and for the drivers/sound files... */
|
---|
| 914 | +
|
---|
| 915 | +#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
|
---|
| 916 | +#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
|
---|
| 917 | +#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
|
---|
| 918 | +#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
|
---|
| 919 | +#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
|
---|
| 920 | +
|
---|
| 921 | +#endif /* _ALPHA_IOCTL_H */
|
---|
| 922 | diff -Naur aboot-0.9b.orig/include/asm/page.h aboot-0.9b/include/asm/page.h
|
---|
| 923 | --- aboot-0.9b.orig/include/asm/page.h 1969-12-31 19:00:00.000000000 -0500
|
---|
| 924 | +++ aboot-0.9b/include/asm/page.h 2008-01-02 13:53:15.000000000 -0500
|
---|
| 925 | @@ -0,0 +1,101 @@
|
---|
| 926 | +#ifndef _ALPHA_PAGE_H
|
---|
| 927 | +#define _ALPHA_PAGE_H
|
---|
| 928 | +
|
---|
| 929 | +/* PAGE_SHIFT determines the page size */
|
---|
| 930 | +#define PAGE_SHIFT 13
|
---|
| 931 | +#define PAGE_SIZE (1UL << PAGE_SHIFT)
|
---|
| 932 | +#define PAGE_MASK (~(PAGE_SIZE-1))
|
---|
| 933 | +
|
---|
| 934 | +#ifdef __KERNEL__
|
---|
| 935 | +
|
---|
| 936 | +#include <asm/pal.h>
|
---|
| 937 | +
|
---|
| 938 | +#ifndef __ASSEMBLY__
|
---|
| 939 | +
|
---|
| 940 | +#define STRICT_MM_TYPECHECKS
|
---|
| 941 | +
|
---|
| 942 | +extern void clear_page(void *page);
|
---|
| 943 | +#define clear_user_page(page, vaddr, pg) clear_page(page)
|
---|
| 944 | +
|
---|
| 945 | +#define __alloc_zeroed_user_highpage(movableflags, vma, vaddr) \
|
---|
| 946 | + alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vmaddr)
|
---|
| 947 | +#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
|
---|
| 948 | +
|
---|
| 949 | +extern void copy_page(void * _to, void * _from);
|
---|
| 950 | +#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
|
---|
| 951 | +
|
---|
| 952 | +#ifdef STRICT_MM_TYPECHECKS
|
---|
| 953 | +/*
|
---|
| 954 | + * These are used to make use of C type-checking..
|
---|
| 955 | + */
|
---|
| 956 | +typedef struct { unsigned long pte; } pte_t;
|
---|
| 957 | +typedef struct { unsigned long pmd; } pmd_t;
|
---|
| 958 | +typedef struct { unsigned long pgd; } pgd_t;
|
---|
| 959 | +typedef struct { unsigned long pgprot; } pgprot_t;
|
---|
| 960 | +
|
---|
| 961 | +#define pte_val(x) ((x).pte)
|
---|
| 962 | +#define pmd_val(x) ((x).pmd)
|
---|
| 963 | +#define pgd_val(x) ((x).pgd)
|
---|
| 964 | +#define pgprot_val(x) ((x).pgprot)
|
---|
| 965 | +
|
---|
| 966 | +#define __pte(x) ((pte_t) { (x) } )
|
---|
| 967 | +#define __pmd(x) ((pmd_t) { (x) } )
|
---|
| 968 | +#define __pgd(x) ((pgd_t) { (x) } )
|
---|
| 969 | +#define __pgprot(x) ((pgprot_t) { (x) } )
|
---|
| 970 | +
|
---|
| 971 | +#else
|
---|
| 972 | +/*
|
---|
| 973 | + * .. while these make it easier on the compiler
|
---|
| 974 | + */
|
---|
| 975 | +typedef unsigned long pte_t;
|
---|
| 976 | +typedef unsigned long pmd_t;
|
---|
| 977 | +typedef unsigned long pgd_t;
|
---|
| 978 | +typedef unsigned long pgprot_t;
|
---|
| 979 | +
|
---|
| 980 | +#define pte_val(x) (x)
|
---|
| 981 | +#define pmd_val(x) (x)
|
---|
| 982 | +#define pgd_val(x) (x)
|
---|
| 983 | +#define pgprot_val(x) (x)
|
---|
| 984 | +
|
---|
| 985 | +#define __pte(x) (x)
|
---|
| 986 | +#define __pgd(x) (x)
|
---|
| 987 | +#define __pgprot(x) (x)
|
---|
| 988 | +
|
---|
| 989 | +#endif /* STRICT_MM_TYPECHECKS */
|
---|
| 990 | +
|
---|
| 991 | +#ifdef USE_48_BIT_KSEG
|
---|
| 992 | +#define PAGE_OFFSET 0xffff800000000000UL
|
---|
| 993 | +#else
|
---|
| 994 | +#define PAGE_OFFSET 0xfffffc0000000000UL
|
---|
| 995 | +#endif
|
---|
| 996 | +
|
---|
| 997 | +#else
|
---|
| 998 | +
|
---|
| 999 | +#ifdef USE_48_BIT_KSEG
|
---|
| 1000 | +#define PAGE_OFFSET 0xffff800000000000
|
---|
| 1001 | +#else
|
---|
| 1002 | +#define PAGE_OFFSET 0xfffffc0000000000
|
---|
| 1003 | +#endif
|
---|
| 1004 | +
|
---|
| 1005 | +#endif /* !__ASSEMBLY__ */
|
---|
| 1006 | +
|
---|
| 1007 | +/* to align the pointer to the (next) page boundary */
|
---|
| 1008 | +#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
|
---|
| 1009 | +
|
---|
| 1010 | +#define __pa(x) ((unsigned long) (x) - PAGE_OFFSET)
|
---|
| 1011 | +#define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET))
|
---|
| 1012 | +#ifndef CONFIG_DISCONTIGMEM
|
---|
| 1013 | +#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
|
---|
| 1014 | +
|
---|
| 1015 | +#define pfn_valid(pfn) ((pfn) < max_mapnr)
|
---|
| 1016 | +#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
|
---|
| 1017 | +#endif /* CONFIG_DISCONTIGMEM */
|
---|
| 1018 | +
|
---|
| 1019 | +#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
|
---|
| 1020 | + VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
|
---|
| 1021 | +
|
---|
| 1022 | +#include <asm-generic/memory_model.h>
|
---|
| 1023 | +#include <asm-generic/page.h>
|
---|
| 1024 | +
|
---|
| 1025 | +#endif /* __KERNEL__ */
|
---|
| 1026 | +#endif /* _ALPHA_PAGE_H */
|
---|
| 1027 | diff -Naur aboot-0.9b.orig/include/asm/pal.h aboot-0.9b/include/asm/pal.h
|
---|
| 1028 | --- aboot-0.9b.orig/include/asm/pal.h 1969-12-31 19:00:00.000000000 -0500
|
---|
| 1029 | +++ aboot-0.9b/include/asm/pal.h 2008-01-02 13:53:15.000000000 -0500
|
---|
| 1030 | @@ -0,0 +1,51 @@
|
---|
| 1031 | +#ifndef __ALPHA_PAL_H
|
---|
| 1032 | +#define __ALPHA_PAL_H
|
---|
| 1033 | +
|
---|
| 1034 | +/*
|
---|
| 1035 | + * Common PAL-code
|
---|
| 1036 | + */
|
---|
| 1037 | +#define PAL_halt 0
|
---|
| 1038 | +#define PAL_cflush 1
|
---|
| 1039 | +#define PAL_draina 2
|
---|
| 1040 | +#define PAL_bpt 128
|
---|
| 1041 | +#define PAL_bugchk 129
|
---|
| 1042 | +#define PAL_chmk 131
|
---|
| 1043 | +#define PAL_callsys 131
|
---|
| 1044 | +#define PAL_imb 134
|
---|
| 1045 | +#define PAL_rduniq 158
|
---|
| 1046 | +#define PAL_wruniq 159
|
---|
| 1047 | +#define PAL_gentrap 170
|
---|
| 1048 | +#define PAL_nphalt 190
|
---|
| 1049 | +
|
---|
| 1050 | +/*
|
---|
| 1051 | + * VMS specific PAL-code
|
---|
| 1052 | + */
|
---|
| 1053 | +#define PAL_swppal 10
|
---|
| 1054 | +#define PAL_mfpr_vptb 41
|
---|
| 1055 | +
|
---|
| 1056 | +/*
|
---|
| 1057 | + * OSF specific PAL-code
|
---|
| 1058 | + */
|
---|
| 1059 | +#define PAL_cserve 9
|
---|
| 1060 | +#define PAL_wripir 13
|
---|
| 1061 | +#define PAL_rdmces 16
|
---|
| 1062 | +#define PAL_wrmces 17
|
---|
| 1063 | +#define PAL_wrfen 43
|
---|
| 1064 | +#define PAL_wrvptptr 45
|
---|
| 1065 | +#define PAL_jtopal 46
|
---|
| 1066 | +#define PAL_swpctx 48
|
---|
| 1067 | +#define PAL_wrval 49
|
---|
| 1068 | +#define PAL_rdval 50
|
---|
| 1069 | +#define PAL_tbi 51
|
---|
| 1070 | +#define PAL_wrent 52
|
---|
| 1071 | +#define PAL_swpipl 53
|
---|
| 1072 | +#define PAL_rdps 54
|
---|
| 1073 | +#define PAL_wrkgp 55
|
---|
| 1074 | +#define PAL_wrusp 56
|
---|
| 1075 | +#define PAL_wrperfmon 57
|
---|
| 1076 | +#define PAL_rdusp 58
|
---|
| 1077 | +#define PAL_whami 60
|
---|
| 1078 | +#define PAL_retsys 61
|
---|
| 1079 | +#define PAL_rti 63
|
---|
| 1080 | +
|
---|
| 1081 | +#endif /* __ALPHA_PAL_H */
|
---|
| 1082 | diff -Naur aboot-0.9b.orig/include/asm/param.h aboot-0.9b/include/asm/param.h
|
---|
| 1083 | --- aboot-0.9b.orig/include/asm/param.h 1969-12-31 19:00:00.000000000 -0500
|
---|
| 1084 | +++ aboot-0.9b/include/asm/param.h 2008-01-02 13:53:15.000000000 -0500
|
---|
| 1085 | @@ -0,0 +1,28 @@
|
---|
| 1086 | +#ifndef _ASM_ALPHA_PARAM_H
|
---|
| 1087 | +#define _ASM_ALPHA_PARAM_H
|
---|
| 1088 | +
|
---|
| 1089 | +/* ??? Gross. I don't want to parameterize this, and supposedly the
|
---|
| 1090 | + hardware ignores reprogramming. We also need userland buy-in to the
|
---|
| 1091 | + change in HZ, since this is visible in the wait4 resources etc. */
|
---|
| 1092 | +
|
---|
| 1093 | +
|
---|
| 1094 | +#ifndef HZ
|
---|
| 1095 | +# ifndef CONFIG_ALPHA_RAWHIDE
|
---|
| 1096 | +# define HZ 1024
|
---|
| 1097 | +# else
|
---|
| 1098 | +# define HZ 1200
|
---|
| 1099 | +# endif
|
---|
| 1100 | +#endif
|
---|
| 1101 | +
|
---|
| 1102 | +#define USER_HZ HZ
|
---|
| 1103 | +
|
---|
| 1104 | +#define EXEC_PAGESIZE 8192
|
---|
| 1105 | +
|
---|
| 1106 | +#ifndef NOGROUP
|
---|
| 1107 | +#define NOGROUP (-1)
|
---|
| 1108 | +#endif
|
---|
| 1109 | +
|
---|
| 1110 | +#define MAXHOSTNAMELEN 64 /* max length of hostname */
|
---|
| 1111 | +
|
---|
| 1112 | +
|
---|
| 1113 | +#endif /* _ASM_ALPHA_PARAM_H */
|
---|
| 1114 | diff -Naur aboot-0.9b.orig/include/asm/posix_types.h aboot-0.9b/include/asm/posix_types.h
|
---|
| 1115 | --- aboot-0.9b.orig/include/asm/posix_types.h 1969-12-31 19:00:00.000000000 -0500
|
---|
| 1116 | +++ aboot-0.9b/include/asm/posix_types.h 2008-01-02 13:53:15.000000000 -0500
|
---|
| 1117 | @@ -0,0 +1,45 @@
|
---|
| 1118 | +#ifndef _ALPHA_POSIX_TYPES_H
|
---|
| 1119 | +#define _ALPHA_POSIX_TYPES_H
|
---|
| 1120 | +
|
---|
| 1121 | +/*
|
---|
| 1122 | + * This file is generally used by user-level software, so you need to
|
---|
| 1123 | + * be a little careful about namespace pollution etc. Also, we cannot
|
---|
| 1124 | + * assume GCC is being used.
|
---|
| 1125 | + */
|
---|
| 1126 | +
|
---|
| 1127 | +typedef unsigned int __kernel_ino_t;
|
---|
| 1128 | +typedef unsigned int __kernel_mode_t;
|
---|
| 1129 | +typedef unsigned int __kernel_nlink_t;
|
---|
| 1130 | +typedef long __kernel_off_t;
|
---|
| 1131 | +typedef long long __kernel_loff_t;
|
---|
| 1132 | +typedef int __kernel_pid_t;
|
---|
| 1133 | +typedef int __kernel_ipc_pid_t;
|
---|
| 1134 | +typedef unsigned int __kernel_uid_t;
|
---|
| 1135 | +typedef unsigned int __kernel_gid_t;
|
---|
| 1136 | +typedef unsigned long __kernel_size_t;
|
---|
| 1137 | +typedef long __kernel_ssize_t;
|
---|
| 1138 | +typedef long __kernel_ptrdiff_t;
|
---|
| 1139 | +typedef long __kernel_time_t;
|
---|
| 1140 | +typedef long __kernel_suseconds_t;
|
---|
| 1141 | +typedef long __kernel_clock_t;
|
---|
| 1142 | +typedef int __kernel_daddr_t;
|
---|
| 1143 | +typedef char * __kernel_caddr_t;
|
---|
| 1144 | +typedef unsigned long __kernel_sigset_t; /* at least 32 bits */
|
---|
| 1145 | +typedef unsigned short __kernel_uid16_t;
|
---|
| 1146 | +typedef unsigned short __kernel_gid16_t;
|
---|
| 1147 | +typedef int __kernel_clockid_t;
|
---|
| 1148 | +typedef int __kernel_timer_t;
|
---|
| 1149 | +
|
---|
| 1150 | +typedef struct {
|
---|
| 1151 | + int val[2];
|
---|
| 1152 | +} __kernel_fsid_t;
|
---|
| 1153 | +
|
---|
| 1154 | +typedef __kernel_uid_t __kernel_old_uid_t;
|
---|
| 1155 | +typedef __kernel_gid_t __kernel_old_gid_t;
|
---|
| 1156 | +typedef __kernel_uid_t __kernel_uid32_t;
|
---|
| 1157 | +typedef __kernel_gid_t __kernel_gid32_t;
|
---|
| 1158 | +
|
---|
| 1159 | +typedef unsigned int __kernel_old_dev_t;
|
---|
| 1160 | +
|
---|
| 1161 | +
|
---|
| 1162 | +#endif /* _ALPHA_POSIX_TYPES_H */
|
---|
| 1163 | diff -Naur aboot-0.9b.orig/include/asm/stat.h aboot-0.9b/include/asm/stat.h
|
---|
| 1164 | --- aboot-0.9b.orig/include/asm/stat.h 1969-12-31 19:00:00.000000000 -0500
|
---|
| 1165 | +++ aboot-0.9b/include/asm/stat.h 2008-01-02 13:53:15.000000000 -0500
|
---|
| 1166 | @@ -0,0 +1,48 @@
|
---|
| 1167 | +#ifndef _ALPHA_STAT_H
|
---|
| 1168 | +#define _ALPHA_STAT_H
|
---|
| 1169 | +
|
---|
| 1170 | +struct stat {
|
---|
| 1171 | + unsigned int st_dev;
|
---|
| 1172 | + unsigned int st_ino;
|
---|
| 1173 | + unsigned int st_mode;
|
---|
| 1174 | + unsigned int st_nlink;
|
---|
| 1175 | + unsigned int st_uid;
|
---|
| 1176 | + unsigned int st_gid;
|
---|
| 1177 | + unsigned int st_rdev;
|
---|
| 1178 | + long st_size;
|
---|
| 1179 | + unsigned long st_atime;
|
---|
| 1180 | + unsigned long st_mtime;
|
---|
| 1181 | + unsigned long st_ctime;
|
---|
| 1182 | + unsigned int st_blksize;
|
---|
| 1183 | + unsigned int st_blocks;
|
---|
| 1184 | + unsigned int st_flags;
|
---|
| 1185 | + unsigned int st_gen;
|
---|
| 1186 | +};
|
---|
| 1187 | +
|
---|
| 1188 | +/* The stat64 structure increases the size of dev_t, blkcnt_t, adds
|
---|
| 1189 | + nanosecond resolution times, and padding for expansion. */
|
---|
| 1190 | +
|
---|
| 1191 | +struct stat64 {
|
---|
| 1192 | + unsigned long st_dev;
|
---|
| 1193 | + unsigned long st_ino;
|
---|
| 1194 | + unsigned long st_rdev;
|
---|
| 1195 | + long st_size;
|
---|
| 1196 | + unsigned long st_blocks;
|
---|
| 1197 | +
|
---|
| 1198 | + unsigned int st_mode;
|
---|
| 1199 | + unsigned int st_uid;
|
---|
| 1200 | + unsigned int st_gid;
|
---|
| 1201 | + unsigned int st_blksize;
|
---|
| 1202 | + unsigned int st_nlink;
|
---|
| 1203 | + unsigned int __pad0;
|
---|
| 1204 | +
|
---|
| 1205 | + unsigned long st_atime;
|
---|
| 1206 | + unsigned long st_atime_nsec;
|
---|
| 1207 | + unsigned long st_mtime;
|
---|
| 1208 | + unsigned long st_mtime_nsec;
|
---|
| 1209 | + unsigned long st_ctime;
|
---|
| 1210 | + unsigned long st_ctime_nsec;
|
---|
| 1211 | + long __unused[3];
|
---|
| 1212 | +};
|
---|
| 1213 | +
|
---|
| 1214 | +#endif
|
---|
| 1215 | diff -Naur aboot-0.9b.orig/include/asm/system.h aboot-0.9b/include/asm/system.h
|
---|
| 1216 | --- aboot-0.9b.orig/include/asm/system.h 1969-12-31 19:00:00.000000000 -0500
|
---|
| 1217 | +++ aboot-0.9b/include/asm/system.h 2008-01-02 13:53:15.000000000 -0500
|
---|
| 1218 | @@ -0,0 +1,816 @@
|
---|
| 1219 | +#ifndef __ALPHA_SYSTEM_H
|
---|
| 1220 | +#define __ALPHA_SYSTEM_H
|
---|
| 1221 | +
|
---|
| 1222 | +#include <asm/pal.h>
|
---|
| 1223 | +#include <asm/page.h>
|
---|
| 1224 | +
|
---|
| 1225 | +/*
|
---|
| 1226 | + * System defines.. Note that this is included both from .c and .S
|
---|
| 1227 | + * files, so it does only defines, not any C code.
|
---|
| 1228 | + */
|
---|
| 1229 | +
|
---|
| 1230 | +/*
|
---|
| 1231 | + * We leave one page for the initial stack page, and one page for
|
---|
| 1232 | + * the initial process structure. Also, the console eats 3 MB for
|
---|
| 1233 | + * the initial bootloader (one of which we can reclaim later).
|
---|
| 1234 | + */
|
---|
| 1235 | +#define BOOT_PCB 0x20000000
|
---|
| 1236 | +#define BOOT_ADDR 0x20000000
|
---|
| 1237 | +/* Remove when official MILO sources have ELF support: */
|
---|
| 1238 | +#define BOOT_SIZE (16*1024)
|
---|
| 1239 | +
|
---|
| 1240 | +#ifdef CONFIG_ALPHA_LEGACY_START_ADDRESS
|
---|
| 1241 | +#define KERNEL_START_PHYS 0x300000 /* Old bootloaders hardcoded this. */
|
---|
| 1242 | +#else
|
---|
| 1243 | +#define KERNEL_START_PHYS 0x1000000 /* required: Wildfire/Titan/Marvel */
|
---|
| 1244 | +#endif
|
---|
| 1245 | +
|
---|
| 1246 | +#define KERNEL_START (PAGE_OFFSET+KERNEL_START_PHYS)
|
---|
| 1247 | +#define SWAPPER_PGD KERNEL_START
|
---|
| 1248 | +#define INIT_STACK (PAGE_OFFSET+KERNEL_START_PHYS+0x02000)
|
---|
| 1249 | +#define EMPTY_PGT (PAGE_OFFSET+KERNEL_START_PHYS+0x04000)
|
---|
| 1250 | +#define EMPTY_PGE (PAGE_OFFSET+KERNEL_START_PHYS+0x08000)
|
---|
| 1251 | +#define ZERO_PGE (PAGE_OFFSET+KERNEL_START_PHYS+0x0A000)
|
---|
| 1252 | +
|
---|
| 1253 | +#define START_ADDR (PAGE_OFFSET+KERNEL_START_PHYS+0x10000)
|
---|
| 1254 | +
|
---|
| 1255 | +/*
|
---|
| 1256 | + * This is setup by the secondary bootstrap loader. Because
|
---|
| 1257 | + * the zero page is zeroed out as soon as the vm system is
|
---|
| 1258 | + * initialized, we need to copy things out into a more permanent
|
---|
| 1259 | + * place.
|
---|
| 1260 | + */
|
---|
| 1261 | +#define PARAM ZERO_PGE
|
---|
| 1262 | +#define COMMAND_LINE ((char*)(PARAM + 0x0000))
|
---|
| 1263 | +#define INITRD_START (*(unsigned long *) (PARAM+0x100))
|
---|
| 1264 | +#define INITRD_SIZE (*(unsigned long *) (PARAM+0x108))
|
---|
| 1265 | +
|
---|
| 1266 | +#ifndef __ASSEMBLY__
|
---|
| 1267 | +#include <linux/kernel.h>
|
---|
| 1268 | +
|
---|
| 1269 | +/*
|
---|
| 1270 | + * This is the logout header that should be common to all platforms
|
---|
| 1271 | + * (assuming they are running OSF/1 PALcode, I guess).
|
---|
| 1272 | + */
|
---|
| 1273 | +struct el_common {
|
---|
| 1274 | + unsigned int size; /* size in bytes of logout area */
|
---|
| 1275 | + unsigned int sbz1 : 30; /* should be zero */
|
---|
| 1276 | + unsigned int err2 : 1; /* second error */
|
---|
| 1277 | + unsigned int retry : 1; /* retry flag */
|
---|
| 1278 | + unsigned int proc_offset; /* processor-specific offset */
|
---|
| 1279 | + unsigned int sys_offset; /* system-specific offset */
|
---|
| 1280 | + unsigned int code; /* machine check code */
|
---|
| 1281 | + unsigned int frame_rev; /* frame revision */
|
---|
| 1282 | +};
|
---|
| 1283 | +
|
---|
| 1284 | +/* Machine Check Frame for uncorrectable errors (Large format)
|
---|
| 1285 | + * --- This is used to log uncorrectable errors such as
|
---|
| 1286 | + * double bit ECC errors.
|
---|
| 1287 | + * --- These errors are detected by both processor and systems.
|
---|
| 1288 | + */
|
---|
| 1289 | +struct el_common_EV5_uncorrectable_mcheck {
|
---|
| 1290 | + unsigned long shadow[8]; /* Shadow reg. 8-14, 25 */
|
---|
| 1291 | + unsigned long paltemp[24]; /* PAL TEMP REGS. */
|
---|
| 1292 | + unsigned long exc_addr; /* Address of excepting instruction*/
|
---|
| 1293 | + unsigned long exc_sum; /* Summary of arithmetic traps. */
|
---|
| 1294 | + unsigned long exc_mask; /* Exception mask (from exc_sum). */
|
---|
| 1295 | + unsigned long pal_base; /* Base address for PALcode. */
|
---|
| 1296 | + unsigned long isr; /* Interrupt Status Reg. */
|
---|
| 1297 | + unsigned long icsr; /* CURRENT SETUP OF EV5 IBOX */
|
---|
| 1298 | + unsigned long ic_perr_stat; /* I-CACHE Reg. <11> set Data parity
|
---|
| 1299 | + <12> set TAG parity*/
|
---|
| 1300 | + unsigned long dc_perr_stat; /* D-CACHE error Reg. Bits set to 1:
|
---|
| 1301 | + <2> Data error in bank 0
|
---|
| 1302 | + <3> Data error in bank 1
|
---|
| 1303 | + <4> Tag error in bank 0
|
---|
| 1304 | + <5> Tag error in bank 1 */
|
---|
| 1305 | + unsigned long va; /* Effective VA of fault or miss. */
|
---|
| 1306 | + unsigned long mm_stat; /* Holds the reason for D-stream
|
---|
| 1307 | + fault or D-cache parity errors */
|
---|
| 1308 | + unsigned long sc_addr; /* Address that was being accessed
|
---|
| 1309 | + when EV5 detected Secondary cache
|
---|
| 1310 | + failure. */
|
---|
| 1311 | + unsigned long sc_stat; /* Helps determine if the error was
|
---|
| 1312 | + TAG/Data parity(Secondary Cache)*/
|
---|
| 1313 | + unsigned long bc_tag_addr; /* Contents of EV5 BC_TAG_ADDR */
|
---|
| 1314 | + unsigned long ei_addr; /* Physical address of any transfer
|
---|
| 1315 | + that is logged in EV5 EI_STAT */
|
---|
| 1316 | + unsigned long fill_syndrome; /* For correcting ECC errors. */
|
---|
| 1317 | + unsigned long ei_stat; /* Helps identify reason of any
|
---|
| 1318 | + processor uncorrectable error
|
---|
| 1319 | + at its external interface. */
|
---|
| 1320 | + unsigned long ld_lock; /* Contents of EV5 LD_LOCK register*/
|
---|
| 1321 | +};
|
---|
| 1322 | +
|
---|
| 1323 | +struct el_common_EV6_mcheck {
|
---|
| 1324 | + unsigned int FrameSize; /* Bytes, including this field */
|
---|
| 1325 | + unsigned int FrameFlags; /* <31> = Retry, <30> = Second Error */
|
---|
| 1326 | + unsigned int CpuOffset; /* Offset to CPU-specific info */
|
---|
| 1327 | + unsigned int SystemOffset; /* Offset to system-specific info */
|
---|
| 1328 | + unsigned int MCHK_Code;
|
---|
| 1329 | + unsigned int MCHK_Frame_Rev;
|
---|
| 1330 | + unsigned long I_STAT; /* EV6 Internal Processor Registers */
|
---|
| 1331 | + unsigned long DC_STAT; /* (See the 21264 Spec) */
|
---|
| 1332 | + unsigned long C_ADDR;
|
---|
| 1333 | + unsigned long DC1_SYNDROME;
|
---|
| 1334 | + unsigned long DC0_SYNDROME;
|
---|
| 1335 | + unsigned long C_STAT;
|
---|
| 1336 | + unsigned long C_STS;
|
---|
| 1337 | + unsigned long MM_STAT;
|
---|
| 1338 | + unsigned long EXC_ADDR;
|
---|
| 1339 | + unsigned long IER_CM;
|
---|
| 1340 | + unsigned long ISUM;
|
---|
| 1341 | + unsigned long RESERVED0;
|
---|
| 1342 | + unsigned long PAL_BASE;
|
---|
| 1343 | + unsigned long I_CTL;
|
---|
| 1344 | + unsigned long PCTX;
|
---|
| 1345 | +};
|
---|
| 1346 | +
|
---|
| 1347 | +extern void halt(void) __attribute__((noreturn));
|
---|
| 1348 | +#define __halt() __asm__ __volatile__ ("call_pal %0 #halt" : : "i" (PAL_halt))
|
---|
| 1349 | +
|
---|
| 1350 | +#define switch_to(P,N,L) \
|
---|
| 1351 | + do { \
|
---|
| 1352 | + (L) = alpha_switch_to(virt_to_phys(&task_thread_info(N)->pcb), (P)); \
|
---|
| 1353 | + check_mmu_context(); \
|
---|
| 1354 | + } while (0)
|
---|
| 1355 | +
|
---|
| 1356 | +struct task_struct;
|
---|
| 1357 | +extern struct task_struct *alpha_switch_to(unsigned long, struct task_struct*);
|
---|
| 1358 | +
|
---|
| 1359 | +#define imb() \
|
---|
| 1360 | +__asm__ __volatile__ ("call_pal %0 #imb" : : "i" (PAL_imb) : "memory")
|
---|
| 1361 | +
|
---|
| 1362 | +#define draina() \
|
---|
| 1363 | +__asm__ __volatile__ ("call_pal %0 #draina" : : "i" (PAL_draina) : "memory")
|
---|
| 1364 | +
|
---|
| 1365 | +enum implver_enum {
|
---|
| 1366 | + IMPLVER_EV4,
|
---|
| 1367 | + IMPLVER_EV5,
|
---|
| 1368 | + IMPLVER_EV6
|
---|
| 1369 | +};
|
---|
| 1370 | +
|
---|
| 1371 | +#ifdef CONFIG_ALPHA_GENERIC
|
---|
| 1372 | +#define implver() \
|
---|
| 1373 | +({ unsigned long __implver; \
|
---|
| 1374 | + __asm__ ("implver %0" : "=r"(__implver)); \
|
---|
| 1375 | + (enum implver_enum) __implver; })
|
---|
| 1376 | +#else
|
---|
| 1377 | +/* Try to eliminate some dead code. */
|
---|
| 1378 | +#ifdef CONFIG_ALPHA_EV4
|
---|
| 1379 | +#define implver() IMPLVER_EV4
|
---|
| 1380 | +#endif
|
---|
| 1381 | +#ifdef CONFIG_ALPHA_EV5
|
---|
| 1382 | +#define implver() IMPLVER_EV5
|
---|
| 1383 | +#endif
|
---|
| 1384 | +#if defined(CONFIG_ALPHA_EV6)
|
---|
| 1385 | +#define implver() IMPLVER_EV6
|
---|
| 1386 | +#endif
|
---|
| 1387 | +#endif
|
---|
| 1388 | +
|
---|
| 1389 | +enum amask_enum {
|
---|
| 1390 | + AMASK_BWX = (1UL << 0),
|
---|
| 1391 | + AMASK_FIX = (1UL << 1),
|
---|
| 1392 | + AMASK_CIX = (1UL << 2),
|
---|
| 1393 | + AMASK_MAX = (1UL << 8),
|
---|
| 1394 | + AMASK_PRECISE_TRAP = (1UL << 9),
|
---|
| 1395 | +};
|
---|
| 1396 | +
|
---|
| 1397 | +#define amask(mask) \
|
---|
| 1398 | +({ unsigned long __amask, __input = (mask); \
|
---|
| 1399 | + __asm__ ("amask %1,%0" : "=r"(__amask) : "rI"(__input)); \
|
---|
| 1400 | + __amask; })
|
---|
| 1401 | +
|
---|
| 1402 | +#define __CALL_PAL_R0(NAME, TYPE) \
|
---|
| 1403 | +static inline TYPE NAME(void) \
|
---|
| 1404 | +{ \
|
---|
| 1405 | + register TYPE __r0 __asm__("$0"); \
|
---|
| 1406 | + __asm__ __volatile__( \
|
---|
| 1407 | + "call_pal %1 # " #NAME \
|
---|
| 1408 | + :"=r" (__r0) \
|
---|
| 1409 | + :"i" (PAL_ ## NAME) \
|
---|
| 1410 | + :"$1", "$16", "$22", "$23", "$24", "$25"); \
|
---|
| 1411 | + return __r0; \
|
---|
| 1412 | +}
|
---|
| 1413 | +
|
---|
| 1414 | +#define __CALL_PAL_W1(NAME, TYPE0) \
|
---|
| 1415 | +static inline void NAME(TYPE0 arg0) \
|
---|
| 1416 | +{ \
|
---|
| 1417 | + register TYPE0 __r16 __asm__("$16") = arg0; \
|
---|
| 1418 | + __asm__ __volatile__( \
|
---|
| 1419 | + "call_pal %1 # "#NAME \
|
---|
| 1420 | + : "=r"(__r16) \
|
---|
| 1421 | + : "i"(PAL_ ## NAME), "0"(__r16) \
|
---|
| 1422 | + : "$1", "$22", "$23", "$24", "$25"); \
|
---|
| 1423 | +}
|
---|
| 1424 | +
|
---|
| 1425 | +#define __CALL_PAL_W2(NAME, TYPE0, TYPE1) \
|
---|
| 1426 | +static inline void NAME(TYPE0 arg0, TYPE1 arg1) \
|
---|
| 1427 | +{ \
|
---|
| 1428 | + register TYPE0 __r16 __asm__("$16") = arg0; \
|
---|
| 1429 | + register TYPE1 __r17 __asm__("$17") = arg1; \
|
---|
| 1430 | + __asm__ __volatile__( \
|
---|
| 1431 | + "call_pal %2 # "#NAME \
|
---|
| 1432 | + : "=r"(__r16), "=r"(__r17) \
|
---|
| 1433 | + : "i"(PAL_ ## NAME), "0"(__r16), "1"(__r17) \
|
---|
| 1434 | + : "$1", "$22", "$23", "$24", "$25"); \
|
---|
| 1435 | +}
|
---|
| 1436 | +
|
---|
| 1437 | +#define __CALL_PAL_RW1(NAME, RTYPE, TYPE0) \
|
---|
| 1438 | +static inline RTYPE NAME(TYPE0 arg0) \
|
---|
| 1439 | +{ \
|
---|
| 1440 | + register RTYPE __r0 __asm__("$0"); \
|
---|
| 1441 | + register TYPE0 __r16 __asm__("$16") = arg0; \
|
---|
| 1442 | + __asm__ __volatile__( \
|
---|
| 1443 | + "call_pal %2 # "#NAME \
|
---|
| 1444 | + : "=r"(__r16), "=r"(__r0) \
|
---|
| 1445 | + : "i"(PAL_ ## NAME), "0"(__r16) \
|
---|
| 1446 | + : "$1", "$22", "$23", "$24", "$25"); \
|
---|
| 1447 | + return __r0; \
|
---|
| 1448 | +}
|
---|
| 1449 | +
|
---|
| 1450 | +#define __CALL_PAL_RW2(NAME, RTYPE, TYPE0, TYPE1) \
|
---|
| 1451 | +static inline RTYPE NAME(TYPE0 arg0, TYPE1 arg1) \
|
---|
| 1452 | +{ \
|
---|
| 1453 | + register RTYPE __r0 __asm__("$0"); \
|
---|
| 1454 | + register TYPE0 __r16 __asm__("$16") = arg0; \
|
---|
| 1455 | + register TYPE1 __r17 __asm__("$17") = arg1; \
|
---|
| 1456 | + __asm__ __volatile__( \
|
---|
| 1457 | + "call_pal %3 # "#NAME \
|
---|
| 1458 | + : "=r"(__r16), "=r"(__r17), "=r"(__r0) \
|
---|
| 1459 | + : "i"(PAL_ ## NAME), "0"(__r16), "1"(__r17) \
|
---|
| 1460 | + : "$1", "$22", "$23", "$24", "$25"); \
|
---|
| 1461 | + return __r0; \
|
---|
| 1462 | +}
|
---|
| 1463 | +
|
---|
| 1464 | +__CALL_PAL_W1(cflush, unsigned long);
|
---|
| 1465 | +__CALL_PAL_R0(rdmces, unsigned long);
|
---|
| 1466 | +__CALL_PAL_R0(rdps, unsigned long);
|
---|
| 1467 | +__CALL_PAL_R0(rdusp, unsigned long);
|
---|
| 1468 | +__CALL_PAL_RW1(swpipl, unsigned long, unsigned long);
|
---|
| 1469 | +__CALL_PAL_R0(whami, unsigned long);
|
---|
| 1470 | +__CALL_PAL_W2(wrent, void*, unsigned long);
|
---|
| 1471 | +__CALL_PAL_W1(wripir, unsigned long);
|
---|
| 1472 | +__CALL_PAL_W1(wrkgp, unsigned long);
|
---|
| 1473 | +__CALL_PAL_W1(wrmces, unsigned long);
|
---|
| 1474 | +__CALL_PAL_RW2(wrperfmon, unsigned long, unsigned long, unsigned long);
|
---|
| 1475 | +__CALL_PAL_W1(wrusp, unsigned long);
|
---|
| 1476 | +__CALL_PAL_W1(wrvptptr, unsigned long);
|
---|
| 1477 | +
|
---|
| 1478 | +#define IPL_MIN 0
|
---|
| 1479 | +#define IPL_SW0 1
|
---|
| 1480 | +#define IPL_SW1 2
|
---|
| 1481 | +#define IPL_DEV0 3
|
---|
| 1482 | +#define IPL_DEV1 4
|
---|
| 1483 | +#define IPL_TIMER 5
|
---|
| 1484 | +#define IPL_PERF 6
|
---|
| 1485 | +#define IPL_POWERFAIL 6
|
---|
| 1486 | +#define IPL_MCHECK 7
|
---|
| 1487 | +#define IPL_MAX 7
|
---|
| 1488 | +
|
---|
| 1489 | +#ifdef CONFIG_ALPHA_BROKEN_IRQ_MASK
|
---|
| 1490 | +#undef IPL_MIN
|
---|
| 1491 | +#define IPL_MIN __min_ipl
|
---|
| 1492 | +extern int __min_ipl;
|
---|
| 1493 | +#endif
|
---|
| 1494 | +
|
---|
| 1495 | +#define getipl() (rdps() & 7)
|
---|
| 1496 | +#define setipl(ipl) ((void) swpipl(ipl))
|
---|
| 1497 | +
|
---|
| 1498 | +#define local_irq_disable() do { setipl(IPL_MAX); barrier(); } while(0)
|
---|
| 1499 | +#define local_irq_enable() do { barrier(); setipl(IPL_MIN); } while(0)
|
---|
| 1500 | +#define local_save_flags(flags) ((flags) = rdps())
|
---|
| 1501 | +#define local_irq_save(flags) do { (flags) = swpipl(IPL_MAX); barrier(); } while(0)
|
---|
| 1502 | +#define local_irq_restore(flags) do { barrier(); setipl(flags); barrier(); } while(0)
|
---|
| 1503 | +
|
---|
| 1504 | +#define irqs_disabled() (getipl() == IPL_MAX)
|
---|
| 1505 | +
|
---|
| 1506 | +/*
|
---|
| 1507 | + * TB routines..
|
---|
| 1508 | + */
|
---|
| 1509 | +#define __tbi(nr,arg,arg1...) \
|
---|
| 1510 | +({ \
|
---|
| 1511 | + register unsigned long __r16 __asm__("$16") = (nr); \
|
---|
| 1512 | + register unsigned long __r17 __asm__("$17"); arg; \
|
---|
| 1513 | + __asm__ __volatile__( \
|
---|
| 1514 | + "call_pal %3 #__tbi" \
|
---|
| 1515 | + :"=r" (__r16),"=r" (__r17) \
|
---|
| 1516 | + :"0" (__r16),"i" (PAL_tbi) ,##arg1 \
|
---|
| 1517 | + :"$0", "$1", "$22", "$23", "$24", "$25"); \
|
---|
| 1518 | +})
|
---|
| 1519 | +
|
---|
| 1520 | +#define tbi(x,y) __tbi(x,__r17=(y),"1" (__r17))
|
---|
| 1521 | +#define tbisi(x) __tbi(1,__r17=(x),"1" (__r17))
|
---|
| 1522 | +#define tbisd(x) __tbi(2,__r17=(x),"1" (__r17))
|
---|
| 1523 | +#define tbis(x) __tbi(3,__r17=(x),"1" (__r17))
|
---|
| 1524 | +#define tbiap() __tbi(-1, /* no second argument */)
|
---|
| 1525 | +#define tbia() __tbi(-2, /* no second argument */)
|
---|
| 1526 | +
|
---|
| 1527 | +/*
|
---|
| 1528 | + * Atomic exchange.
|
---|
| 1529 | + * Since it can be used to implement critical sections
|
---|
| 1530 | + * it must clobber "memory" (also for interrupts in UP).
|
---|
| 1531 | + */
|
---|
| 1532 | +
|
---|
| 1533 | +static inline unsigned long
|
---|
| 1534 | +__xchg_u8(volatile char *m, unsigned long val)
|
---|
| 1535 | +{
|
---|
| 1536 | + unsigned long ret, tmp, addr64;
|
---|
| 1537 | +
|
---|
| 1538 | + __asm__ __volatile__(
|
---|
| 1539 | + " andnot %4,7,%3\n"
|
---|
| 1540 | + " insbl %1,%4,%1\n"
|
---|
| 1541 | + "1: ldq_l %2,0(%3)\n"
|
---|
| 1542 | + " extbl %2,%4,%0\n"
|
---|
| 1543 | + " mskbl %2,%4,%2\n"
|
---|
| 1544 | + " or %1,%2,%2\n"
|
---|
| 1545 | + " stq_c %2,0(%3)\n"
|
---|
| 1546 | + " beq %2,2f\n"
|
---|
| 1547 | +#ifdef CONFIG_SMP
|
---|
| 1548 | + " mb\n"
|
---|
| 1549 | +#endif
|
---|
| 1550 | + ".subsection 2\n"
|
---|
| 1551 | + "2: br 1b\n"
|
---|
| 1552 | + ".previous"
|
---|
| 1553 | + : "=&r" (ret), "=&r" (val), "=&r" (tmp), "=&r" (addr64)
|
---|
| 1554 | + : "r" ((long)m), "1" (val) : "memory");
|
---|
| 1555 | +
|
---|
| 1556 | + return ret;
|
---|
| 1557 | +}
|
---|
| 1558 | +
|
---|
| 1559 | +static inline unsigned long
|
---|
| 1560 | +__xchg_u16(volatile short *m, unsigned long val)
|
---|
| 1561 | +{
|
---|
| 1562 | + unsigned long ret, tmp, addr64;
|
---|
| 1563 | +
|
---|
| 1564 | + __asm__ __volatile__(
|
---|
| 1565 | + " andnot %4,7,%3\n"
|
---|
| 1566 | + " inswl %1,%4,%1\n"
|
---|
| 1567 | + "1: ldq_l %2,0(%3)\n"
|
---|
| 1568 | + " extwl %2,%4,%0\n"
|
---|
| 1569 | + " mskwl %2,%4,%2\n"
|
---|
| 1570 | + " or %1,%2,%2\n"
|
---|
| 1571 | + " stq_c %2,0(%3)\n"
|
---|
| 1572 | + " beq %2,2f\n"
|
---|
| 1573 | +#ifdef CONFIG_SMP
|
---|
| 1574 | + " mb\n"
|
---|
| 1575 | +#endif
|
---|
| 1576 | + ".subsection 2\n"
|
---|
| 1577 | + "2: br 1b\n"
|
---|
| 1578 | + ".previous"
|
---|
| 1579 | + : "=&r" (ret), "=&r" (val), "=&r" (tmp), "=&r" (addr64)
|
---|
| 1580 | + : "r" ((long)m), "1" (val) : "memory");
|
---|
| 1581 | +
|
---|
| 1582 | + return ret;
|
---|
| 1583 | +}
|
---|
| 1584 | +
|
---|
| 1585 | +static inline unsigned long
|
---|
| 1586 | +__xchg_u32(volatile int *m, unsigned long val)
|
---|
| 1587 | +{
|
---|
| 1588 | + unsigned long dummy;
|
---|
| 1589 | +
|
---|
| 1590 | + __asm__ __volatile__(
|
---|
| 1591 | + "1: ldl_l %0,%4\n"
|
---|
| 1592 | + " bis $31,%3,%1\n"
|
---|
| 1593 | + " stl_c %1,%2\n"
|
---|
| 1594 | + " beq %1,2f\n"
|
---|
| 1595 | +#ifdef CONFIG_SMP
|
---|
| 1596 | + " mb\n"
|
---|
| 1597 | +#endif
|
---|
| 1598 | + ".subsection 2\n"
|
---|
| 1599 | + "2: br 1b\n"
|
---|
| 1600 | + ".previous"
|
---|
| 1601 | + : "=&r" (val), "=&r" (dummy), "=m" (*m)
|
---|
| 1602 | + : "rI" (val), "m" (*m) : "memory");
|
---|
| 1603 | +
|
---|
| 1604 | + return val;
|
---|
| 1605 | +}
|
---|
| 1606 | +
|
---|
| 1607 | +static inline unsigned long
|
---|
| 1608 | +__xchg_u64(volatile long *m, unsigned long val)
|
---|
| 1609 | +{
|
---|
| 1610 | + unsigned long dummy;
|
---|
| 1611 | +
|
---|
| 1612 | + __asm__ __volatile__(
|
---|
| 1613 | + "1: ldq_l %0,%4\n"
|
---|
| 1614 | + " bis $31,%3,%1\n"
|
---|
| 1615 | + " stq_c %1,%2\n"
|
---|
| 1616 | + " beq %1,2f\n"
|
---|
| 1617 | +#ifdef CONFIG_SMP
|
---|
| 1618 | + " mb\n"
|
---|
| 1619 | +#endif
|
---|
| 1620 | + ".subsection 2\n"
|
---|
| 1621 | + "2: br 1b\n"
|
---|
| 1622 | + ".previous"
|
---|
| 1623 | + : "=&r" (val), "=&r" (dummy), "=m" (*m)
|
---|
| 1624 | + : "rI" (val), "m" (*m) : "memory");
|
---|
| 1625 | +
|
---|
| 1626 | + return val;
|
---|
| 1627 | +}
|
---|
| 1628 | +
|
---|
| 1629 | +/* This function doesn't exist, so you'll get a linker error
|
---|
| 1630 | + if something tries to do an invalid xchg(). */
|
---|
| 1631 | +extern void __xchg_called_with_bad_pointer(void);
|
---|
| 1632 | +
|
---|
| 1633 | +#define __xchg(ptr, x, size) \
|
---|
| 1634 | +({ \
|
---|
| 1635 | + unsigned long __xchg__res; \
|
---|
| 1636 | + volatile void *__xchg__ptr = (ptr); \
|
---|
| 1637 | + switch (size) { \
|
---|
| 1638 | + case 1: __xchg__res = __xchg_u8(__xchg__ptr, x); break; \
|
---|
| 1639 | + case 2: __xchg__res = __xchg_u16(__xchg__ptr, x); break; \
|
---|
| 1640 | + case 4: __xchg__res = __xchg_u32(__xchg__ptr, x); break; \
|
---|
| 1641 | + case 8: __xchg__res = __xchg_u64(__xchg__ptr, x); break; \
|
---|
| 1642 | + default: __xchg_called_with_bad_pointer(); __xchg__res = x; \
|
---|
| 1643 | + } \
|
---|
| 1644 | + __xchg__res; \
|
---|
| 1645 | +})
|
---|
| 1646 | +
|
---|
| 1647 | +#define xchg(ptr,x) \
|
---|
| 1648 | + ({ \
|
---|
| 1649 | + __typeof__(*(ptr)) _x_ = (x); \
|
---|
| 1650 | + (__typeof__(*(ptr))) __xchg((ptr), (unsigned long)_x_, sizeof(*(ptr))); \
|
---|
| 1651 | + })
|
---|
| 1652 | +
|
---|
| 1653 | +static inline unsigned long
|
---|
| 1654 | +__xchg_u8_local(volatile char *m, unsigned long val)
|
---|
| 1655 | +{
|
---|
| 1656 | + unsigned long ret, tmp, addr64;
|
---|
| 1657 | +
|
---|
| 1658 | + __asm__ __volatile__(
|
---|
| 1659 | + " andnot %4,7,%3\n"
|
---|
| 1660 | + " insbl %1,%4,%1\n"
|
---|
| 1661 | + "1: ldq_l %2,0(%3)\n"
|
---|
| 1662 | + " extbl %2,%4,%0\n"
|
---|
| 1663 | + " mskbl %2,%4,%2\n"
|
---|
| 1664 | + " or %1,%2,%2\n"
|
---|
| 1665 | + " stq_c %2,0(%3)\n"
|
---|
| 1666 | + " beq %2,2f\n"
|
---|
| 1667 | + ".subsection 2\n"
|
---|
| 1668 | + "2: br 1b\n"
|
---|
| 1669 | + ".previous"
|
---|
| 1670 | + : "=&r" (ret), "=&r" (val), "=&r" (tmp), "=&r" (addr64)
|
---|
| 1671 | + : "r" ((long)m), "1" (val) : "memory");
|
---|
| 1672 | +
|
---|
| 1673 | + return ret;
|
---|
| 1674 | +}
|
---|
| 1675 | +
|
---|
| 1676 | +static inline unsigned long
|
---|
| 1677 | +__xchg_u16_local(volatile short *m, unsigned long val)
|
---|
| 1678 | +{
|
---|
| 1679 | + unsigned long ret, tmp, addr64;
|
---|
| 1680 | +
|
---|
| 1681 | + __asm__ __volatile__(
|
---|
| 1682 | + " andnot %4,7,%3\n"
|
---|
| 1683 | + " inswl %1,%4,%1\n"
|
---|
| 1684 | + "1: ldq_l %2,0(%3)\n"
|
---|
| 1685 | + " extwl %2,%4,%0\n"
|
---|
| 1686 | + " mskwl %2,%4,%2\n"
|
---|
| 1687 | + " or %1,%2,%2\n"
|
---|
| 1688 | + " stq_c %2,0(%3)\n"
|
---|
| 1689 | + " beq %2,2f\n"
|
---|
| 1690 | + ".subsection 2\n"
|
---|
| 1691 | + "2: br 1b\n"
|
---|
| 1692 | + ".previous"
|
---|
| 1693 | + : "=&r" (ret), "=&r" (val), "=&r" (tmp), "=&r" (addr64)
|
---|
| 1694 | + : "r" ((long)m), "1" (val) : "memory");
|
---|
| 1695 | +
|
---|
| 1696 | + return ret;
|
---|
| 1697 | +}
|
---|
| 1698 | +
|
---|
| 1699 | +static inline unsigned long
|
---|
| 1700 | +__xchg_u32_local(volatile int *m, unsigned long val)
|
---|
| 1701 | +{
|
---|
| 1702 | + unsigned long dummy;
|
---|
| 1703 | +
|
---|
| 1704 | + __asm__ __volatile__(
|
---|
| 1705 | + "1: ldl_l %0,%4\n"
|
---|
| 1706 | + " bis $31,%3,%1\n"
|
---|
| 1707 | + " stl_c %1,%2\n"
|
---|
| 1708 | + " beq %1,2f\n"
|
---|
| 1709 | + ".subsection 2\n"
|
---|
| 1710 | + "2: br 1b\n"
|
---|
| 1711 | + ".previous"
|
---|
| 1712 | + : "=&r" (val), "=&r" (dummy), "=m" (*m)
|
---|
| 1713 | + : "rI" (val), "m" (*m) : "memory");
|
---|
| 1714 | +
|
---|
| 1715 | + return val;
|
---|
| 1716 | +}
|
---|
| 1717 | +
|
---|
| 1718 | +static inline unsigned long
|
---|
| 1719 | +__xchg_u64_local(volatile long *m, unsigned long val)
|
---|
| 1720 | +{
|
---|
| 1721 | + unsigned long dummy;
|
---|
| 1722 | +
|
---|
| 1723 | + __asm__ __volatile__(
|
---|
| 1724 | + "1: ldq_l %0,%4\n"
|
---|
| 1725 | + " bis $31,%3,%1\n"
|
---|
| 1726 | + " stq_c %1,%2\n"
|
---|
| 1727 | + " beq %1,2f\n"
|
---|
| 1728 | + ".subsection 2\n"
|
---|
| 1729 | + "2: br 1b\n"
|
---|
| 1730 | + ".previous"
|
---|
| 1731 | + : "=&r" (val), "=&r" (dummy), "=m" (*m)
|
---|
| 1732 | + : "rI" (val), "m" (*m) : "memory");
|
---|
| 1733 | +
|
---|
| 1734 | + return val;
|
---|
| 1735 | +}
|
---|
| 1736 | +
|
---|
| 1737 | +#define __xchg_local(ptr, x, size) \
|
---|
| 1738 | +({ \
|
---|
| 1739 | + unsigned long __xchg__res; \
|
---|
| 1740 | + volatile void *__xchg__ptr = (ptr); \
|
---|
| 1741 | + switch (size) { \
|
---|
| 1742 | + case 1: __xchg__res = __xchg_u8_local(__xchg__ptr, x); break; \
|
---|
| 1743 | + case 2: __xchg__res = __xchg_u16_local(__xchg__ptr, x); break; \
|
---|
| 1744 | + case 4: __xchg__res = __xchg_u32_local(__xchg__ptr, x); break; \
|
---|
| 1745 | + case 8: __xchg__res = __xchg_u64_local(__xchg__ptr, x); break; \
|
---|
| 1746 | + default: __xchg_called_with_bad_pointer(); __xchg__res = x; \
|
---|
| 1747 | + } \
|
---|
| 1748 | + __xchg__res; \
|
---|
| 1749 | +})
|
---|
| 1750 | +
|
---|
| 1751 | +#define xchg_local(ptr,x) \
|
---|
| 1752 | + ({ \
|
---|
| 1753 | + __typeof__(*(ptr)) _x_ = (x); \
|
---|
| 1754 | + (__typeof__(*(ptr))) __xchg_local((ptr), (unsigned long)_x_, \
|
---|
| 1755 | + sizeof(*(ptr))); \
|
---|
| 1756 | + })
|
---|
| 1757 | +
|
---|
| 1758 | +/*
|
---|
| 1759 | + * Atomic compare and exchange. Compare OLD with MEM, if identical,
|
---|
| 1760 | + * store NEW in MEM. Return the initial value in MEM. Success is
|
---|
| 1761 | + * indicated by comparing RETURN with OLD.
|
---|
| 1762 | + *
|
---|
| 1763 | + * The memory barrier should be placed in SMP only when we actually
|
---|
| 1764 | + * make the change. If we don't change anything (so if the returned
|
---|
| 1765 | + * prev is equal to old) then we aren't acquiring anything new and
|
---|
| 1766 | + * we don't need any memory barrier as far I can tell.
|
---|
| 1767 | + */
|
---|
| 1768 | +
|
---|
| 1769 | +#define __HAVE_ARCH_CMPXCHG 1
|
---|
| 1770 | +
|
---|
| 1771 | +static inline unsigned long
|
---|
| 1772 | +__cmpxchg_u8(volatile char *m, long old, long new)
|
---|
| 1773 | +{
|
---|
| 1774 | + unsigned long prev, tmp, cmp, addr64;
|
---|
| 1775 | +
|
---|
| 1776 | + __asm__ __volatile__(
|
---|
| 1777 | + " andnot %5,7,%4\n"
|
---|
| 1778 | + " insbl %1,%5,%1\n"
|
---|
| 1779 | + "1: ldq_l %2,0(%4)\n"
|
---|
| 1780 | + " extbl %2,%5,%0\n"
|
---|
| 1781 | + " cmpeq %0,%6,%3\n"
|
---|
| 1782 | + " beq %3,2f\n"
|
---|
| 1783 | + " mskbl %2,%5,%2\n"
|
---|
| 1784 | + " or %1,%2,%2\n"
|
---|
| 1785 | + " stq_c %2,0(%4)\n"
|
---|
| 1786 | + " beq %2,3f\n"
|
---|
| 1787 | +#ifdef CONFIG_SMP
|
---|
| 1788 | + " mb\n"
|
---|
| 1789 | +#endif
|
---|
| 1790 | + "2:\n"
|
---|
| 1791 | + ".subsection 2\n"
|
---|
| 1792 | + "3: br 1b\n"
|
---|
| 1793 | + ".previous"
|
---|
| 1794 | + : "=&r" (prev), "=&r" (new), "=&r" (tmp), "=&r" (cmp), "=&r" (addr64)
|
---|
| 1795 | + : "r" ((long)m), "Ir" (old), "1" (new) : "memory");
|
---|
| 1796 | +
|
---|
| 1797 | + return prev;
|
---|
| 1798 | +}
|
---|
| 1799 | +
|
---|
| 1800 | +static inline unsigned long
|
---|
| 1801 | +__cmpxchg_u16(volatile short *m, long old, long new)
|
---|
| 1802 | +{
|
---|
| 1803 | + unsigned long prev, tmp, cmp, addr64;
|
---|
| 1804 | +
|
---|
| 1805 | + __asm__ __volatile__(
|
---|
| 1806 | + " andnot %5,7,%4\n"
|
---|
| 1807 | + " inswl %1,%5,%1\n"
|
---|
| 1808 | + "1: ldq_l %2,0(%4)\n"
|
---|
| 1809 | + " extwl %2,%5,%0\n"
|
---|
| 1810 | + " cmpeq %0,%6,%3\n"
|
---|
| 1811 | + " beq %3,2f\n"
|
---|
| 1812 | + " mskwl %2,%5,%2\n"
|
---|
| 1813 | + " or %1,%2,%2\n"
|
---|
| 1814 | + " stq_c %2,0(%4)\n"
|
---|
| 1815 | + " beq %2,3f\n"
|
---|
| 1816 | +#ifdef CONFIG_SMP
|
---|
| 1817 | + " mb\n"
|
---|
| 1818 | +#endif
|
---|
| 1819 | + "2:\n"
|
---|
| 1820 | + ".subsection 2\n"
|
---|
| 1821 | + "3: br 1b\n"
|
---|
| 1822 | + ".previous"
|
---|
| 1823 | + : "=&r" (prev), "=&r" (new), "=&r" (tmp), "=&r" (cmp), "=&r" (addr64)
|
---|
| 1824 | + : "r" ((long)m), "Ir" (old), "1" (new) : "memory");
|
---|
| 1825 | +
|
---|
| 1826 | + return prev;
|
---|
| 1827 | +}
|
---|
| 1828 | +
|
---|
| 1829 | +static inline unsigned long
|
---|
| 1830 | +__cmpxchg_u32(volatile int *m, int old, int new)
|
---|
| 1831 | +{
|
---|
| 1832 | + unsigned long prev, cmp;
|
---|
| 1833 | +
|
---|
| 1834 | + __asm__ __volatile__(
|
---|
| 1835 | + "1: ldl_l %0,%5\n"
|
---|
| 1836 | + " cmpeq %0,%3,%1\n"
|
---|
| 1837 | + " beq %1,2f\n"
|
---|
| 1838 | + " mov %4,%1\n"
|
---|
| 1839 | + " stl_c %1,%2\n"
|
---|
| 1840 | + " beq %1,3f\n"
|
---|
| 1841 | +#ifdef CONFIG_SMP
|
---|
| 1842 | + " mb\n"
|
---|
| 1843 | +#endif
|
---|
| 1844 | + "2:\n"
|
---|
| 1845 | + ".subsection 2\n"
|
---|
| 1846 | + "3: br 1b\n"
|
---|
| 1847 | + ".previous"
|
---|
| 1848 | + : "=&r"(prev), "=&r"(cmp), "=m"(*m)
|
---|
| 1849 | + : "r"((long) old), "r"(new), "m"(*m) : "memory");
|
---|
| 1850 | +
|
---|
| 1851 | + return prev;
|
---|
| 1852 | +}
|
---|
| 1853 | +
|
---|
| 1854 | +static inline unsigned long
|
---|
| 1855 | +__cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new)
|
---|
| 1856 | +{
|
---|
| 1857 | + unsigned long prev, cmp;
|
---|
| 1858 | +
|
---|
| 1859 | + __asm__ __volatile__(
|
---|
| 1860 | + "1: ldq_l %0,%5\n"
|
---|
| 1861 | + " cmpeq %0,%3,%1\n"
|
---|
| 1862 | + " beq %1,2f\n"
|
---|
| 1863 | + " mov %4,%1\n"
|
---|
| 1864 | + " stq_c %1,%2\n"
|
---|
| 1865 | + " beq %1,3f\n"
|
---|
| 1866 | +#ifdef CONFIG_SMP
|
---|
| 1867 | + " mb\n"
|
---|
| 1868 | +#endif
|
---|
| 1869 | + "2:\n"
|
---|
| 1870 | + ".subsection 2\n"
|
---|
| 1871 | + "3: br 1b\n"
|
---|
| 1872 | + ".previous"
|
---|
| 1873 | + : "=&r"(prev), "=&r"(cmp), "=m"(*m)
|
---|
| 1874 | + : "r"((long) old), "r"(new), "m"(*m) : "memory");
|
---|
| 1875 | +
|
---|
| 1876 | + return prev;
|
---|
| 1877 | +}
|
---|
| 1878 | +
|
---|
| 1879 | +/* This function doesn't exist, so you'll get a linker error
|
---|
| 1880 | + if something tries to do an invalid cmpxchg(). */
|
---|
| 1881 | +extern void __cmpxchg_called_with_bad_pointer(void);
|
---|
| 1882 | +
|
---|
| 1883 | +static __always_inline unsigned long
|
---|
| 1884 | +__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
|
---|
| 1885 | +{
|
---|
| 1886 | + switch (size) {
|
---|
| 1887 | + case 1:
|
---|
| 1888 | + return __cmpxchg_u8(ptr, old, new);
|
---|
| 1889 | + case 2:
|
---|
| 1890 | + return __cmpxchg_u16(ptr, old, new);
|
---|
| 1891 | + case 4:
|
---|
| 1892 | + return __cmpxchg_u32(ptr, old, new);
|
---|
| 1893 | + case 8:
|
---|
| 1894 | + return __cmpxchg_u64(ptr, old, new);
|
---|
| 1895 | + }
|
---|
| 1896 | + __cmpxchg_called_with_bad_pointer();
|
---|
| 1897 | + return old;
|
---|
| 1898 | +}
|
---|
| 1899 | +
|
---|
| 1900 | +#define cmpxchg(ptr,o,n) \
|
---|
| 1901 | + ({ \
|
---|
| 1902 | + __typeof__(*(ptr)) _o_ = (o); \
|
---|
| 1903 | + __typeof__(*(ptr)) _n_ = (n); \
|
---|
| 1904 | + (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \
|
---|
| 1905 | + (unsigned long)_n_, sizeof(*(ptr))); \
|
---|
| 1906 | + })
|
---|
| 1907 | +
|
---|
| 1908 | +static inline unsigned long
|
---|
| 1909 | +__cmpxchg_u8_local(volatile char *m, long old, long new)
|
---|
| 1910 | +{
|
---|
| 1911 | + unsigned long prev, tmp, cmp, addr64;
|
---|
| 1912 | +
|
---|
| 1913 | + __asm__ __volatile__(
|
---|
| 1914 | + " andnot %5,7,%4\n"
|
---|
| 1915 | + " insbl %1,%5,%1\n"
|
---|
| 1916 | + "1: ldq_l %2,0(%4)\n"
|
---|
| 1917 | + " extbl %2,%5,%0\n"
|
---|
| 1918 | + " cmpeq %0,%6,%3\n"
|
---|
| 1919 | + " beq %3,2f\n"
|
---|
| 1920 | + " mskbl %2,%5,%2\n"
|
---|
| 1921 | + " or %1,%2,%2\n"
|
---|
| 1922 | + " stq_c %2,0(%4)\n"
|
---|
| 1923 | + " beq %2,3f\n"
|
---|
| 1924 | + "2:\n"
|
---|
| 1925 | + ".subsection 2\n"
|
---|
| 1926 | + "3: br 1b\n"
|
---|
| 1927 | + ".previous"
|
---|
| 1928 | + : "=&r" (prev), "=&r" (new), "=&r" (tmp), "=&r" (cmp), "=&r" (addr64)
|
---|
| 1929 | + : "r" ((long)m), "Ir" (old), "1" (new) : "memory");
|
---|
| 1930 | +
|
---|
| 1931 | + return prev;
|
---|
| 1932 | +}
|
---|
| 1933 | +
|
---|
| 1934 | +static inline unsigned long
|
---|
| 1935 | +__cmpxchg_u16_local(volatile short *m, long old, long new)
|
---|
| 1936 | +{
|
---|
| 1937 | + unsigned long prev, tmp, cmp, addr64;
|
---|
| 1938 | +
|
---|
| 1939 | + __asm__ __volatile__(
|
---|
| 1940 | + " andnot %5,7,%4\n"
|
---|
| 1941 | + " inswl %1,%5,%1\n"
|
---|
| 1942 | + "1: ldq_l %2,0(%4)\n"
|
---|
| 1943 | + " extwl %2,%5,%0\n"
|
---|
| 1944 | + " cmpeq %0,%6,%3\n"
|
---|
| 1945 | + " beq %3,2f\n"
|
---|
| 1946 | + " mskwl %2,%5,%2\n"
|
---|
| 1947 | + " or %1,%2,%2\n"
|
---|
| 1948 | + " stq_c %2,0(%4)\n"
|
---|
| 1949 | + " beq %2,3f\n"
|
---|
| 1950 | + "2:\n"
|
---|
| 1951 | + ".subsection 2\n"
|
---|
| 1952 | + "3: br 1b\n"
|
---|
| 1953 | + ".previous"
|
---|
| 1954 | + : "=&r" (prev), "=&r" (new), "=&r" (tmp), "=&r" (cmp), "=&r" (addr64)
|
---|
| 1955 | + : "r" ((long)m), "Ir" (old), "1" (new) : "memory");
|
---|
| 1956 | +
|
---|
| 1957 | + return prev;
|
---|
| 1958 | +}
|
---|
| 1959 | +
|
---|
| 1960 | +static inline unsigned long
|
---|
| 1961 | +__cmpxchg_u32_local(volatile int *m, int old, int new)
|
---|
| 1962 | +{
|
---|
| 1963 | + unsigned long prev, cmp;
|
---|
| 1964 | +
|
---|
| 1965 | + __asm__ __volatile__(
|
---|
| 1966 | + "1: ldl_l %0,%5\n"
|
---|
| 1967 | + " cmpeq %0,%3,%1\n"
|
---|
| 1968 | + " beq %1,2f\n"
|
---|
| 1969 | + " mov %4,%1\n"
|
---|
| 1970 | + " stl_c %1,%2\n"
|
---|
| 1971 | + " beq %1,3f\n"
|
---|
| 1972 | + "2:\n"
|
---|
| 1973 | + ".subsection 2\n"
|
---|
| 1974 | + "3: br 1b\n"
|
---|
| 1975 | + ".previous"
|
---|
| 1976 | + : "=&r"(prev), "=&r"(cmp), "=m"(*m)
|
---|
| 1977 | + : "r"((long) old), "r"(new), "m"(*m) : "memory");
|
---|
| 1978 | +
|
---|
| 1979 | + return prev;
|
---|
| 1980 | +}
|
---|
| 1981 | +
|
---|
| 1982 | +static inline unsigned long
|
---|
| 1983 | +__cmpxchg_u64_local(volatile long *m, unsigned long old, unsigned long new)
|
---|
| 1984 | +{
|
---|
| 1985 | + unsigned long prev, cmp;
|
---|
| 1986 | +
|
---|
| 1987 | + __asm__ __volatile__(
|
---|
| 1988 | + "1: ldq_l %0,%5\n"
|
---|
| 1989 | + " cmpeq %0,%3,%1\n"
|
---|
| 1990 | + " beq %1,2f\n"
|
---|
| 1991 | + " mov %4,%1\n"
|
---|
| 1992 | + " stq_c %1,%2\n"
|
---|
| 1993 | + " beq %1,3f\n"
|
---|
| 1994 | + "2:\n"
|
---|
| 1995 | + ".subsection 2\n"
|
---|
| 1996 | + "3: br 1b\n"
|
---|
| 1997 | + ".previous"
|
---|
| 1998 | + : "=&r"(prev), "=&r"(cmp), "=m"(*m)
|
---|
| 1999 | + : "r"((long) old), "r"(new), "m"(*m) : "memory");
|
---|
| 2000 | +
|
---|
| 2001 | + return prev;
|
---|
| 2002 | +}
|
---|
| 2003 | +
|
---|
| 2004 | +static __always_inline unsigned long
|
---|
| 2005 | +__cmpxchg_local(volatile void *ptr, unsigned long old, unsigned long new,
|
---|
| 2006 | + int size)
|
---|
| 2007 | +{
|
---|
| 2008 | + switch (size) {
|
---|
| 2009 | + case 1:
|
---|
| 2010 | + return __cmpxchg_u8_local(ptr, old, new);
|
---|
| 2011 | + case 2:
|
---|
| 2012 | + return __cmpxchg_u16_local(ptr, old, new);
|
---|
| 2013 | + case 4:
|
---|
| 2014 | + return __cmpxchg_u32_local(ptr, old, new);
|
---|
| 2015 | + case 8:
|
---|
| 2016 | + return __cmpxchg_u64_local(ptr, old, new);
|
---|
| 2017 | + }
|
---|
| 2018 | + __cmpxchg_called_with_bad_pointer();
|
---|
| 2019 | + return old;
|
---|
| 2020 | +}
|
---|
| 2021 | +
|
---|
| 2022 | +#define cmpxchg_local(ptr,o,n) \
|
---|
| 2023 | + ({ \
|
---|
| 2024 | + __typeof__(*(ptr)) _o_ = (o); \
|
---|
| 2025 | + __typeof__(*(ptr)) _n_ = (n); \
|
---|
| 2026 | + (__typeof__(*(ptr))) __cmpxchg_local((ptr), (unsigned long)_o_, \
|
---|
| 2027 | + (unsigned long)_n_, sizeof(*(ptr))); \
|
---|
| 2028 | + })
|
---|
| 2029 | +
|
---|
| 2030 | +#endif /* __ASSEMBLY__ */
|
---|
| 2031 | +
|
---|
| 2032 | +#define arch_align_stack(x) (x)
|
---|
| 2033 | +
|
---|
| 2034 | +#endif
|
---|
| 2035 | diff -Naur aboot-0.9b.orig/include/asm/types.h aboot-0.9b/include/asm/types.h
|
---|
| 2036 | --- aboot-0.9b.orig/include/asm/types.h 1969-12-31 19:00:00.000000000 -0500
|
---|
| 2037 | +++ aboot-0.9b/include/asm/types.h 2008-01-02 13:53:15.000000000 -0500
|
---|
| 2038 | @@ -0,0 +1,38 @@
|
---|
| 2039 | +#ifndef _ALPHA_TYPES_H
|
---|
| 2040 | +#define _ALPHA_TYPES_H
|
---|
| 2041 | +
|
---|
| 2042 | +/*
|
---|
| 2043 | + * This file is never included by application software unless
|
---|
| 2044 | + * explicitly requested (e.g., via linux/types.h) in which case the
|
---|
| 2045 | + * application is Linux specific so (user-) name space pollution is
|
---|
| 2046 | + * not a major issue. However, for interoperability, libraries still
|
---|
| 2047 | + * need to be careful to avoid a name clashes.
|
---|
| 2048 | + */
|
---|
| 2049 | +
|
---|
| 2050 | +#ifndef __ASSEMBLY__
|
---|
| 2051 | +
|
---|
| 2052 | +typedef unsigned int umode_t;
|
---|
| 2053 | +
|
---|
| 2054 | +/*
|
---|
| 2055 | + * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
|
---|
| 2056 | + * header files exported to user space
|
---|
| 2057 | + */
|
---|
| 2058 | +
|
---|
| 2059 | +typedef __signed__ char __s8;
|
---|
| 2060 | +typedef unsigned char __u8;
|
---|
| 2061 | +
|
---|
| 2062 | +typedef __signed__ short __s16;
|
---|
| 2063 | +typedef unsigned short __u16;
|
---|
| 2064 | +
|
---|
| 2065 | +typedef __signed__ int __s32;
|
---|
| 2066 | +typedef unsigned int __u32;
|
---|
| 2067 | +
|
---|
| 2068 | +typedef __signed__ long __s64;
|
---|
| 2069 | +typedef unsigned long __u64;
|
---|
| 2070 | +
|
---|
| 2071 | +#endif /* __ASSEMBLY__ */
|
---|
| 2072 | +
|
---|
| 2073 | +/*
|
---|
| 2074 | + * These aren't exported outside the kernel to avoid name space clashes
|
---|
| 2075 | + */
|
---|
| 2076 | +#endif /* _ALPHA_TYPES_H */
|
---|
| 2077 | diff -Naur aboot-0.9b.orig/include/asm-generic/memory_model.h aboot-0.9b/include/asm-generic/memory_model.h
|
---|
| 2078 | --- aboot-0.9b.orig/include/asm-generic/memory_model.h 1969-12-31 19:00:00.000000000 -0500
|
---|
| 2079 | +++ aboot-0.9b/include/asm-generic/memory_model.h 2008-01-02 13:53:15.000000000 -0500
|
---|
| 2080 | @@ -0,0 +1,80 @@
|
---|
| 2081 | +#ifndef __ASM_MEMORY_MODEL_H
|
---|
| 2082 | +#define __ASM_MEMORY_MODEL_H
|
---|
| 2083 | +
|
---|
| 2084 | +#ifdef __KERNEL__
|
---|
| 2085 | +#ifndef __ASSEMBLY__
|
---|
| 2086 | +
|
---|
| 2087 | +#if defined(CONFIG_FLATMEM)
|
---|
| 2088 | +
|
---|
| 2089 | +#ifndef ARCH_PFN_OFFSET
|
---|
| 2090 | +#define ARCH_PFN_OFFSET (0UL)
|
---|
| 2091 | +#endif
|
---|
| 2092 | +
|
---|
| 2093 | +#elif defined(CONFIG_DISCONTIGMEM)
|
---|
| 2094 | +
|
---|
| 2095 | +#ifndef arch_pfn_to_nid
|
---|
| 2096 | +#define arch_pfn_to_nid(pfn) pfn_to_nid(pfn)
|
---|
| 2097 | +#endif
|
---|
| 2098 | +
|
---|
| 2099 | +#ifndef arch_local_page_offset
|
---|
| 2100 | +#define arch_local_page_offset(pfn, nid) \
|
---|
| 2101 | + ((pfn) - NODE_DATA(nid)->node_start_pfn)
|
---|
| 2102 | +#endif
|
---|
| 2103 | +
|
---|
| 2104 | +#endif /* CONFIG_DISCONTIGMEM */
|
---|
| 2105 | +
|
---|
| 2106 | +/*
|
---|
| 2107 | + * supports 3 memory models.
|
---|
| 2108 | + */
|
---|
| 2109 | +#if defined(CONFIG_FLATMEM)
|
---|
| 2110 | +
|
---|
| 2111 | +#define __pfn_to_page(pfn) (mem_map + ((pfn) - ARCH_PFN_OFFSET))
|
---|
| 2112 | +#define __page_to_pfn(page) ((unsigned long)((page) - mem_map) + \
|
---|
| 2113 | + ARCH_PFN_OFFSET)
|
---|
| 2114 | +#elif defined(CONFIG_DISCONTIGMEM)
|
---|
| 2115 | +
|
---|
| 2116 | +#define __pfn_to_page(pfn) \
|
---|
| 2117 | +({ unsigned long __pfn = (pfn); \
|
---|
| 2118 | + unsigned long __nid = arch_pfn_to_nid(pfn); \
|
---|
| 2119 | + NODE_DATA(__nid)->node_mem_map + arch_local_page_offset(__pfn, __nid);\
|
---|
| 2120 | +})
|
---|
| 2121 | +
|
---|
| 2122 | +#define __page_to_pfn(pg) \
|
---|
| 2123 | +({ struct page *__pg = (pg); \
|
---|
| 2124 | + struct pglist_data *__pgdat = NODE_DATA(page_to_nid(__pg)); \
|
---|
| 2125 | + (unsigned long)(__pg - __pgdat->node_mem_map) + \
|
---|
| 2126 | + __pgdat->node_start_pfn; \
|
---|
| 2127 | +})
|
---|
| 2128 | +
|
---|
| 2129 | +#elif defined(CONFIG_SPARSEMEM)
|
---|
| 2130 | +/*
|
---|
| 2131 | + * Note: section's mem_map is encorded to reflect its start_pfn.
|
---|
| 2132 | + * section[i].section_mem_map == mem_map's address - start_pfn;
|
---|
| 2133 | + */
|
---|
| 2134 | +#define __page_to_pfn(pg) \
|
---|
| 2135 | +({ struct page *__pg = (pg); \
|
---|
| 2136 | + int __sec = page_to_section(__pg); \
|
---|
| 2137 | + (unsigned long)(__pg - __section_mem_map_addr(__nr_to_section(__sec))); \
|
---|
| 2138 | +})
|
---|
| 2139 | +
|
---|
| 2140 | +#define __pfn_to_page(pfn) \
|
---|
| 2141 | +({ unsigned long __pfn = (pfn); \
|
---|
| 2142 | + struct mem_section *__sec = __pfn_to_section(__pfn); \
|
---|
| 2143 | + __section_mem_map_addr(__sec) + __pfn; \
|
---|
| 2144 | +})
|
---|
| 2145 | +#endif /* CONFIG_FLATMEM/DISCONTIGMEM/SPARSEMEM */
|
---|
| 2146 | +
|
---|
| 2147 | +#ifdef CONFIG_OUT_OF_LINE_PFN_TO_PAGE
|
---|
| 2148 | +struct page;
|
---|
| 2149 | +/* this is useful when inlined pfn_to_page is too big */
|
---|
| 2150 | +extern struct page *pfn_to_page(unsigned long pfn);
|
---|
| 2151 | +extern unsigned long page_to_pfn(struct page *page);
|
---|
| 2152 | +#else
|
---|
| 2153 | +#define page_to_pfn __page_to_pfn
|
---|
| 2154 | +#define pfn_to_page __pfn_to_page
|
---|
| 2155 | +#endif /* CONFIG_OUT_OF_LINE_PFN_TO_PAGE */
|
---|
| 2156 | +
|
---|
| 2157 | +#endif /* __ASSEMBLY__ */
|
---|
| 2158 | +#endif /* __KERNEL__ */
|
---|
| 2159 | +
|
---|
| 2160 | +#endif
|
---|
| 2161 | diff -Naur aboot-0.9b.orig/include/asm-generic/page.h aboot-0.9b/include/asm-generic/page.h
|
---|
| 2162 | --- aboot-0.9b.orig/include/asm-generic/page.h 1969-12-31 19:00:00.000000000 -0500
|
---|
| 2163 | +++ aboot-0.9b/include/asm-generic/page.h 2008-01-02 13:53:15.000000000 -0500
|
---|
| 2164 | @@ -0,0 +1,26 @@
|
---|
| 2165 | +#ifndef _ASM_GENERIC_PAGE_H
|
---|
| 2166 | +#define _ASM_GENERIC_PAGE_H
|
---|
| 2167 | +
|
---|
| 2168 | +#ifdef __KERNEL__
|
---|
| 2169 | +#ifndef __ASSEMBLY__
|
---|
| 2170 | +
|
---|
| 2171 | +#include <linux/compiler.h>
|
---|
| 2172 | +
|
---|
| 2173 | +/* Pure 2^n version of get_order */
|
---|
| 2174 | +static __inline__ __attribute_const__ int get_order(unsigned long size)
|
---|
| 2175 | +{
|
---|
| 2176 | + int order;
|
---|
| 2177 | +
|
---|
| 2178 | + size = (size - 1) >> (PAGE_SHIFT - 1);
|
---|
| 2179 | + order = -1;
|
---|
| 2180 | + do {
|
---|
| 2181 | + size >>= 1;
|
---|
| 2182 | + order++;
|
---|
| 2183 | + } while (size);
|
---|
| 2184 | + return order;
|
---|
| 2185 | +}
|
---|
| 2186 | +
|
---|
| 2187 | +#endif /* __ASSEMBLY__ */
|
---|
| 2188 | +#endif /* __KERNEL__ */
|
---|
| 2189 | +
|
---|
| 2190 | +#endif /* _ASM_GENERIC_PAGE_H */
|
---|
| 2191 | diff -Naur aboot-0.9b.orig/include/linux/a.out.h aboot-0.9b/include/linux/a.out.h
|
---|
| 2192 | --- aboot-0.9b.orig/include/linux/a.out.h 1969-12-31 19:00:00.000000000 -0500
|
---|
| 2193 | +++ aboot-0.9b/include/linux/a.out.h 2008-01-02 13:53:15.000000000 -0500
|
---|
| 2194 | @@ -0,0 +1,268 @@
|
---|
| 2195 | +#ifndef __A_OUT_GNU_H__
|
---|
| 2196 | +#define __A_OUT_GNU_H__
|
---|
| 2197 | +
|
---|
| 2198 | +#define __GNU_EXEC_MACROS__
|
---|
| 2199 | +
|
---|
| 2200 | +#ifndef __STRUCT_EXEC_OVERRIDE__
|
---|
| 2201 | +
|
---|
| 2202 | +#include <asm/a.out.h>
|
---|
| 2203 | +
|
---|
| 2204 | +#endif /* __STRUCT_EXEC_OVERRIDE__ */
|
---|
| 2205 | +
|
---|
| 2206 | +/* these go in the N_MACHTYPE field */
|
---|
| 2207 | +enum machine_type {
|
---|
| 2208 | +#if defined (M_OLDSUN2)
|
---|
| 2209 | + M__OLDSUN2 = M_OLDSUN2,
|
---|
| 2210 | +#else
|
---|
| 2211 | + M_OLDSUN2 = 0,
|
---|
| 2212 | +#endif
|
---|
| 2213 | +#if defined (M_68010)
|
---|
| 2214 | + M__68010 = M_68010,
|
---|
| 2215 | +#else
|
---|
| 2216 | + M_68010 = 1,
|
---|
| 2217 | +#endif
|
---|
| 2218 | +#if defined (M_68020)
|
---|
| 2219 | + M__68020 = M_68020,
|
---|
| 2220 | +#else
|
---|
| 2221 | + M_68020 = 2,
|
---|
| 2222 | +#endif
|
---|
| 2223 | +#if defined (M_SPARC)
|
---|
| 2224 | + M__SPARC = M_SPARC,
|
---|
| 2225 | +#else
|
---|
| 2226 | + M_SPARC = 3,
|
---|
| 2227 | +#endif
|
---|
| 2228 | + /* skip a bunch so we don't run into any of sun's numbers */
|
---|
| 2229 | + M_386 = 100,
|
---|
| 2230 | + M_MIPS1 = 151, /* MIPS R3000/R3000 binary */
|
---|
| 2231 | + M_MIPS2 = 152 /* MIPS R6000/R4000 binary */
|
---|
| 2232 | +};
|
---|
| 2233 | +
|
---|
| 2234 | +#if !defined (N_MAGIC)
|
---|
| 2235 | +#define N_MAGIC(exec) ((exec).a_info & 0xffff)
|
---|
| 2236 | +#endif
|
---|
| 2237 | +#define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff))
|
---|
| 2238 | +#define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff)
|
---|
| 2239 | +#define N_SET_INFO(exec, magic, type, flags) \
|
---|
| 2240 | + ((exec).a_info = ((magic) & 0xffff) \
|
---|
| 2241 | + | (((int)(type) & 0xff) << 16) \
|
---|
| 2242 | + | (((flags) & 0xff) << 24))
|
---|
| 2243 | +#define N_SET_MAGIC(exec, magic) \
|
---|
| 2244 | + ((exec).a_info = (((exec).a_info & 0xffff0000) | ((magic) & 0xffff)))
|
---|
| 2245 | +
|
---|
| 2246 | +#define N_SET_MACHTYPE(exec, machtype) \
|
---|
| 2247 | + ((exec).a_info = \
|
---|
| 2248 | + ((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16))
|
---|
| 2249 | +
|
---|
| 2250 | +#define N_SET_FLAGS(exec, flags) \
|
---|
| 2251 | + ((exec).a_info = \
|
---|
| 2252 | + ((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24))
|
---|
| 2253 | +
|
---|
| 2254 | +/* Code indicating object file or impure executable. */
|
---|
| 2255 | +#define OMAGIC 0407
|
---|
| 2256 | +/* Code indicating pure executable. */
|
---|
| 2257 | +#define NMAGIC 0410
|
---|
| 2258 | +/* Code indicating demand-paged executable. */
|
---|
| 2259 | +#define ZMAGIC 0413
|
---|
| 2260 | +/* This indicates a demand-paged executable with the header in the text.
|
---|
| 2261 | + The first page is unmapped to help trap NULL pointer references */
|
---|
| 2262 | +#define QMAGIC 0314
|
---|
| 2263 | +
|
---|
| 2264 | +/* Code indicating core file. */
|
---|
| 2265 | +#define CMAGIC 0421
|
---|
| 2266 | +
|
---|
| 2267 | +#if !defined (N_BADMAG)
|
---|
| 2268 | +#define N_BADMAG(x) (N_MAGIC(x) != OMAGIC \
|
---|
| 2269 | + && N_MAGIC(x) != NMAGIC \
|
---|
| 2270 | + && N_MAGIC(x) != ZMAGIC \
|
---|
| 2271 | + && N_MAGIC(x) != QMAGIC)
|
---|
| 2272 | +#endif
|
---|
| 2273 | +
|
---|
| 2274 | +#define _N_HDROFF(x) (1024 - sizeof (struct exec))
|
---|
| 2275 | +
|
---|
| 2276 | +#if !defined (N_TXTOFF)
|
---|
| 2277 | +#define N_TXTOFF(x) \
|
---|
| 2278 | + (N_MAGIC(x) == ZMAGIC ? _N_HDROFF((x)) + sizeof (struct exec) : \
|
---|
| 2279 | + (N_MAGIC(x) == QMAGIC ? 0 : sizeof (struct exec)))
|
---|
| 2280 | +#endif
|
---|
| 2281 | +
|
---|
| 2282 | +#if !defined (N_DATOFF)
|
---|
| 2283 | +#define N_DATOFF(x) (N_TXTOFF(x) + (x).a_text)
|
---|
| 2284 | +#endif
|
---|
| 2285 | +
|
---|
| 2286 | +#if !defined (N_TRELOFF)
|
---|
| 2287 | +#define N_TRELOFF(x) (N_DATOFF(x) + (x).a_data)
|
---|
| 2288 | +#endif
|
---|
| 2289 | +
|
---|
| 2290 | +#if !defined (N_DRELOFF)
|
---|
| 2291 | +#define N_DRELOFF(x) (N_TRELOFF(x) + N_TRSIZE(x))
|
---|
| 2292 | +#endif
|
---|
| 2293 | +
|
---|
| 2294 | +#if !defined (N_SYMOFF)
|
---|
| 2295 | +#define N_SYMOFF(x) (N_DRELOFF(x) + N_DRSIZE(x))
|
---|
| 2296 | +#endif
|
---|
| 2297 | +
|
---|
| 2298 | +#if !defined (N_STROFF)
|
---|
| 2299 | +#define N_STROFF(x) (N_SYMOFF(x) + N_SYMSIZE(x))
|
---|
| 2300 | +#endif
|
---|
| 2301 | +
|
---|
| 2302 | +/* Address of text segment in memory after it is loaded. */
|
---|
| 2303 | +#if !defined (N_TXTADDR)
|
---|
| 2304 | +#define N_TXTADDR(x) (N_MAGIC(x) == QMAGIC ? PAGE_SIZE : 0)
|
---|
| 2305 | +#endif
|
---|
| 2306 | +
|
---|
| 2307 | +/* Address of data segment in memory after it is loaded.
|
---|
| 2308 | + Note that it is up to you to define SEGMENT_SIZE
|
---|
| 2309 | + on machines not listed here. */
|
---|
| 2310 | +#if defined(vax) || defined(hp300) || defined(pyr)
|
---|
| 2311 | +#define SEGMENT_SIZE page_size
|
---|
| 2312 | +#endif
|
---|
| 2313 | +#ifdef sony
|
---|
| 2314 | +#define SEGMENT_SIZE 0x2000
|
---|
| 2315 | +#endif /* Sony. */
|
---|
| 2316 | +#ifdef is68k
|
---|
| 2317 | +#define SEGMENT_SIZE 0x20000
|
---|
| 2318 | +#endif
|
---|
| 2319 | +#if defined(m68k) && defined(PORTAR)
|
---|
| 2320 | +#define PAGE_SIZE 0x400
|
---|
| 2321 | +#define SEGMENT_SIZE PAGE_SIZE
|
---|
| 2322 | +#endif
|
---|
| 2323 | +
|
---|
| 2324 | +#ifdef linux
|
---|
| 2325 | +#include <asm/page.h>
|
---|
| 2326 | +#if defined(__i386__) || defined(__mc68000__)
|
---|
| 2327 | +#define SEGMENT_SIZE 1024
|
---|
| 2328 | +#else
|
---|
| 2329 | +#ifndef SEGMENT_SIZE
|
---|
| 2330 | +#define SEGMENT_SIZE PAGE_SIZE
|
---|
| 2331 | +#endif
|
---|
| 2332 | +#endif
|
---|
| 2333 | +#endif
|
---|
| 2334 | +
|
---|
| 2335 | +#define _N_SEGMENT_ROUND(x) ALIGN(x, SEGMENT_SIZE)
|
---|
| 2336 | +
|
---|
| 2337 | +#define _N_TXTENDADDR(x) (N_TXTADDR(x)+(x).a_text)
|
---|
| 2338 | +
|
---|
| 2339 | +#ifndef N_DATADDR
|
---|
| 2340 | +#define N_DATADDR(x) \
|
---|
| 2341 | + (N_MAGIC(x)==OMAGIC? (_N_TXTENDADDR(x)) \
|
---|
| 2342 | + : (_N_SEGMENT_ROUND (_N_TXTENDADDR(x))))
|
---|
| 2343 | +#endif
|
---|
| 2344 | +
|
---|
| 2345 | +/* Address of bss segment in memory after it is loaded. */
|
---|
| 2346 | +#if !defined (N_BSSADDR)
|
---|
| 2347 | +#define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data)
|
---|
| 2348 | +#endif
|
---|
| 2349 | + |
---|
| 2350 |
|
---|
| 2351 | +#if !defined (N_NLIST_DECLARED)
|
---|
| 2352 | +struct nlist {
|
---|
| 2353 | + union {
|
---|
| 2354 | + char *n_name;
|
---|
| 2355 | + struct nlist *n_next;
|
---|
| 2356 | + long n_strx;
|
---|
| 2357 | + } n_un;
|
---|
| 2358 | + unsigned char n_type;
|
---|
| 2359 | + char n_other;
|
---|
| 2360 | + short n_desc;
|
---|
| 2361 | + unsigned long n_value;
|
---|
| 2362 | +};
|
---|
| 2363 | +#endif /* no N_NLIST_DECLARED. */
|
---|
| 2364 | +
|
---|
| 2365 | +#if !defined (N_UNDF)
|
---|
| 2366 | +#define N_UNDF 0
|
---|
| 2367 | +#endif
|
---|
| 2368 | +#if !defined (N_ABS)
|
---|
| 2369 | +#define N_ABS 2
|
---|
| 2370 | +#endif
|
---|
| 2371 | +#if !defined (N_TEXT)
|
---|
| 2372 | +#define N_TEXT 4
|
---|
| 2373 | +#endif
|
---|
| 2374 | +#if !defined (N_DATA)
|
---|
| 2375 | +#define N_DATA 6
|
---|
| 2376 | +#endif
|
---|
| 2377 | +#if !defined (N_BSS)
|
---|
| 2378 | +#define N_BSS 8
|
---|
| 2379 | +#endif
|
---|
| 2380 | +#if !defined (N_FN)
|
---|
| 2381 | +#define N_FN 15
|
---|
| 2382 | +#endif
|
---|
| 2383 | +
|
---|
| 2384 | +#if !defined (N_EXT)
|
---|
| 2385 | +#define N_EXT 1
|
---|
| 2386 | +#endif
|
---|
| 2387 | +#if !defined (N_TYPE)
|
---|
| 2388 | +#define N_TYPE 036
|
---|
| 2389 | +#endif
|
---|
| 2390 | +#if !defined (N_STAB)
|
---|
| 2391 | +#define N_STAB 0340
|
---|
| 2392 | +#endif
|
---|
| 2393 | +
|
---|
| 2394 | +/* The following type indicates the definition of a symbol as being
|
---|
| 2395 | + an indirect reference to another symbol. The other symbol
|
---|
| 2396 | + appears as an undefined reference, immediately following this symbol.
|
---|
| 2397 | +
|
---|
| 2398 | + Indirection is asymmetrical. The other symbol's value will be used
|
---|
| 2399 | + to satisfy requests for the indirect symbol, but not vice versa.
|
---|
| 2400 | + If the other symbol does not have a definition, libraries will
|
---|
| 2401 | + be searched to find a definition. */
|
---|
| 2402 | +#define N_INDR 0xa
|
---|
| 2403 | +
|
---|
| 2404 | +/* The following symbols refer to set elements.
|
---|
| 2405 | + All the N_SET[ATDB] symbols with the same name form one set.
|
---|
| 2406 | + Space is allocated for the set in the text section, and each set
|
---|
| 2407 | + element's value is stored into one word of the space.
|
---|
| 2408 | + The first word of the space is the length of the set (number of elements).
|
---|
| 2409 | +
|
---|
| 2410 | + The address of the set is made into an N_SETV symbol
|
---|
| 2411 | + whose name is the same as the name of the set.
|
---|
| 2412 | + This symbol acts like a N_DATA global symbol
|
---|
| 2413 | + in that it can satisfy undefined external references. */
|
---|
| 2414 | +
|
---|
| 2415 | +/* These appear as input to LD, in a .o file. */
|
---|
| 2416 | +#define N_SETA 0x14 /* Absolute set element symbol */
|
---|
| 2417 | +#define N_SETT 0x16 /* Text set element symbol */
|
---|
| 2418 | +#define N_SETD 0x18 /* Data set element symbol */
|
---|
| 2419 | +#define N_SETB 0x1A /* Bss set element symbol */
|
---|
| 2420 | +
|
---|
| 2421 | +/* This is output from LD. */
|
---|
| 2422 | +#define N_SETV 0x1C /* Pointer to set vector in data area. */
|
---|
| 2423 | + |
---|
| 2424 |
|
---|
| 2425 | +#if !defined (N_RELOCATION_INFO_DECLARED)
|
---|
| 2426 | +/* This structure describes a single relocation to be performed.
|
---|
| 2427 | + The text-relocation section of the file is a vector of these structures,
|
---|
| 2428 | + all of which apply to the text section.
|
---|
| 2429 | + Likewise, the data-relocation section applies to the data section. */
|
---|
| 2430 | +
|
---|
| 2431 | +struct relocation_info
|
---|
| 2432 | +{
|
---|
| 2433 | + /* Address (within segment) to be relocated. */
|
---|
| 2434 | + int r_address;
|
---|
| 2435 | + /* The meaning of r_symbolnum depends on r_extern. */
|
---|
| 2436 | + unsigned int r_symbolnum:24;
|
---|
| 2437 | + /* Nonzero means value is a pc-relative offset
|
---|
| 2438 | + and it should be relocated for changes in its own address
|
---|
| 2439 | + as well as for changes in the symbol or section specified. */
|
---|
| 2440 | + unsigned int r_pcrel:1;
|
---|
| 2441 | + /* Length (as exponent of 2) of the field to be relocated.
|
---|
| 2442 | + Thus, a value of 2 indicates 1<<2 bytes. */
|
---|
| 2443 | + unsigned int r_length:2;
|
---|
| 2444 | + /* 1 => relocate with value of symbol.
|
---|
| 2445 | + r_symbolnum is the index of the symbol
|
---|
| 2446 | + in file's the symbol table.
|
---|
| 2447 | + 0 => relocate with the address of a segment.
|
---|
| 2448 | + r_symbolnum is N_TEXT, N_DATA, N_BSS or N_ABS
|
---|
| 2449 | + (the N_EXT bit may be set also, but signifies nothing). */
|
---|
| 2450 | + unsigned int r_extern:1;
|
---|
| 2451 | + /* Four bits that aren't used, but when writing an object file
|
---|
| 2452 | + it is desirable to clear them. */
|
---|
| 2453 | +#ifdef NS32K
|
---|
| 2454 | + unsigned r_bsr:1;
|
---|
| 2455 | + unsigned r_disp:1;
|
---|
| 2456 | + unsigned r_pad:2;
|
---|
| 2457 | +#else
|
---|
| 2458 | + unsigned int r_pad:4;
|
---|
| 2459 | +#endif
|
---|
| 2460 | +};
|
---|
| 2461 | +#endif /* no N_RELOCATION_INFO_DECLARED. */
|
---|
| 2462 | +
|
---|
| 2463 | +
|
---|
| 2464 | +#endif /* __A_OUT_GNU_H__ */
|
---|
| 2465 | diff -Naur aboot-0.9b.orig/include/linux/auxvec.h aboot-0.9b/include/linux/auxvec.h
|
---|
| 2466 | --- aboot-0.9b.orig/include/linux/auxvec.h 1969-12-31 19:00:00.000000000 -0500
|
---|
| 2467 | +++ aboot-0.9b/include/linux/auxvec.h 2008-01-02 13:53:15.000000000 -0500
|
---|
| 2468 | @@ -0,0 +1,31 @@
|
---|
| 2469 | +#ifndef _LINUX_AUXVEC_H
|
---|
| 2470 | +#define _LINUX_AUXVEC_H
|
---|
| 2471 | +
|
---|
| 2472 | +#include <asm/auxvec.h>
|
---|
| 2473 | +
|
---|
| 2474 | +/* Symbolic values for the entries in the auxiliary table
|
---|
| 2475 | + put on the initial stack */
|
---|
| 2476 | +#define AT_NULL 0 /* end of vector */
|
---|
| 2477 | +#define AT_IGNORE 1 /* entry should be ignored */
|
---|
| 2478 | +#define AT_EXECFD 2 /* file descriptor of program */
|
---|
| 2479 | +#define AT_PHDR 3 /* program headers for program */
|
---|
| 2480 | +#define AT_PHENT 4 /* size of program header entry */
|
---|
| 2481 | +#define AT_PHNUM 5 /* number of program headers */
|
---|
| 2482 | +#define AT_PAGESZ 6 /* system page size */
|
---|
| 2483 | +#define AT_BASE 7 /* base address of interpreter */
|
---|
| 2484 | +#define AT_FLAGS 8 /* flags */
|
---|
| 2485 | +#define AT_ENTRY 9 /* entry point of program */
|
---|
| 2486 | +#define AT_NOTELF 10 /* program is not ELF */
|
---|
| 2487 | +#define AT_UID 11 /* real uid */
|
---|
| 2488 | +#define AT_EUID 12 /* effective uid */
|
---|
| 2489 | +#define AT_GID 13 /* real gid */
|
---|
| 2490 | +#define AT_EGID 14 /* effective gid */
|
---|
| 2491 | +#define AT_PLATFORM 15 /* string identifying CPU for optimizations */
|
---|
| 2492 | +#define AT_HWCAP 16 /* arch dependent hints at CPU capabilities */
|
---|
| 2493 | +#define AT_CLKTCK 17 /* frequency at which times() increments */
|
---|
| 2494 | +
|
---|
| 2495 | +#define AT_SECURE 23 /* secure mode boolean */
|
---|
| 2496 | +
|
---|
| 2497 | +#define AT_VECTOR_SIZE 44 /* Size of auxiliary table. */
|
---|
| 2498 | +
|
---|
| 2499 | +#endif /* _LINUX_AUXVEC_H */
|
---|
| 2500 | diff -Naur aboot-0.9b.orig/include/linux/coff.h aboot-0.9b/include/linux/coff.h
|
---|
| 2501 | --- aboot-0.9b.orig/include/linux/coff.h 1969-12-31 19:00:00.000000000 -0500
|
---|
| 2502 | +++ aboot-0.9b/include/linux/coff.h 2008-01-02 13:53:15.000000000 -0500
|
---|
| 2503 | @@ -0,0 +1,351 @@
|
---|
| 2504 | +/* This file is derived from the GAS 2.1.4 assembler control file.
|
---|
| 2505 | + The GAS product is under the GNU General Public License, version 2 or later.
|
---|
| 2506 | + As such, this file is also under that license.
|
---|
| 2507 | +
|
---|
| 2508 | + If the file format changes in the COFF object, this file should be
|
---|
| 2509 | + subsequently updated to reflect the changes.
|
---|
| 2510 | +
|
---|
| 2511 | + The actual loader module only uses a few of these structures. The full
|
---|
| 2512 | + set is documented here because I received the full set. If you wish
|
---|
| 2513 | + more information about COFF, then O'Reilly has a very excellent book.
|
---|
| 2514 | +*/
|
---|
| 2515 | +
|
---|
| 2516 | +#define E_SYMNMLEN 8 /* Number of characters in a symbol name */
|
---|
| 2517 | +#define E_FILNMLEN 14 /* Number of characters in a file name */
|
---|
| 2518 | +#define E_DIMNUM 4 /* Number of array dimensions in auxiliary entry */
|
---|
| 2519 | +
|
---|
| 2520 | +/*
|
---|
| 2521 | + * These defines are byte order independent. There is no alignment of fields
|
---|
| 2522 | + * permitted in the structures. Therefore they are declared as characters
|
---|
| 2523 | + * and the values loaded from the character positions. It also makes it
|
---|
| 2524 | + * nice to have it "endian" independent.
|
---|
| 2525 | + */
|
---|
| 2526 | +
|
---|
| 2527 | +/* Load a short int from the following tables with little-endian formats */
|
---|
| 2528 | +#define COFF_SHORT_L(ps) ((short)(((unsigned short)((unsigned char)ps[1])<<8)|\
|
---|
| 2529 | + ((unsigned short)((unsigned char)ps[0]))))
|
---|
| 2530 | +
|
---|
| 2531 | +/* Load a long int from the following tables with little-endian formats */
|
---|
| 2532 | +#define COFF_LONG_L(ps) (((long)(((unsigned long)((unsigned char)ps[3])<<24) |\
|
---|
| 2533 | + ((unsigned long)((unsigned char)ps[2])<<16) |\
|
---|
| 2534 | + ((unsigned long)((unsigned char)ps[1])<<8) |\
|
---|
| 2535 | + ((unsigned long)((unsigned char)ps[0])))))
|
---|
| 2536 | +
|
---|
| 2537 | +/* Load a short int from the following tables with big-endian formats */
|
---|
| 2538 | +#define COFF_SHORT_H(ps) ((short)(((unsigned short)((unsigned char)ps[0])<<8)|\
|
---|
| 2539 | + ((unsigned short)((unsigned char)ps[1]))))
|
---|
| 2540 | +
|
---|
| 2541 | +/* Load a long int from the following tables with big-endian formats */
|
---|
| 2542 | +#define COFF_LONG_H(ps) (((long)(((unsigned long)((unsigned char)ps[0])<<24) |\
|
---|
| 2543 | + ((unsigned long)((unsigned char)ps[1])<<16) |\
|
---|
| 2544 | + ((unsigned long)((unsigned char)ps[2])<<8) |\
|
---|
| 2545 | + ((unsigned long)((unsigned char)ps[3])))))
|
---|
| 2546 | +
|
---|
| 2547 | +/* These may be overridden later by brain dead implementations which generate
|
---|
| 2548 | + a big-endian header with little-endian data. In that case, generate a
|
---|
| 2549 | + replacement macro which tests a flag and uses either of the two above
|
---|
| 2550 | + as appropriate. */
|
---|
| 2551 | +
|
---|
| 2552 | +#define COFF_LONG(v) COFF_LONG_L(v)
|
---|
| 2553 | +#define COFF_SHORT(v) COFF_SHORT_L(v)
|
---|
| 2554 | +
|
---|
| 2555 | +/*** coff information for Intel 386/486. */
|
---|
| 2556 | +
|
---|
| 2557 | +/********************** FILE HEADER **********************/
|
---|
| 2558 | +
|
---|
| 2559 | +struct COFF_filehdr {
|
---|
| 2560 | + char f_magic[2]; /* magic number */
|
---|
| 2561 | + char f_nscns[2]; /* number of sections */
|
---|
| 2562 | + char f_timdat[4]; /* time & date stamp */
|
---|
| 2563 | + char f_symptr[4]; /* file pointer to symtab */
|
---|
| 2564 | + char f_nsyms[4]; /* number of symtab entries */
|
---|
| 2565 | + char f_opthdr[2]; /* sizeof(optional hdr) */
|
---|
| 2566 | + char f_flags[2]; /* flags */
|
---|
| 2567 | +};
|
---|
| 2568 | +
|
---|
| 2569 | +/*
|
---|
| 2570 | + * Bits for f_flags:
|
---|
| 2571 | + *
|
---|
| 2572 | + * F_RELFLG relocation info stripped from file
|
---|
| 2573 | + * F_EXEC file is executable (i.e. no unresolved external
|
---|
| 2574 | + * references)
|
---|
| 2575 | + * F_LNNO line numbers stripped from file
|
---|
| 2576 | + * F_LSYMS local symbols stripped from file
|
---|
| 2577 | + * F_MINMAL this is a minimal object file (".m") output of fextract
|
---|
| 2578 | + * F_UPDATE this is a fully bound update file, output of ogen
|
---|
| 2579 | + * F_SWABD this file has had its bytes swabbed (in names)
|
---|
| 2580 | + * F_AR16WR this file has the byte ordering of an AR16WR
|
---|
| 2581 | + * (e.g. 11/70) machine
|
---|
| 2582 | + * F_AR32WR this file has the byte ordering of an AR32WR machine
|
---|
| 2583 | + * (e.g. vax and iNTEL 386)
|
---|
| 2584 | + * F_AR32W this file has the byte ordering of an AR32W machine
|
---|
| 2585 | + * (e.g. 3b,maxi)
|
---|
| 2586 | + * F_PATCH file contains "patch" list in optional header
|
---|
| 2587 | + * F_NODF (minimal file only) no decision functions for
|
---|
| 2588 | + * replaced functions
|
---|
| 2589 | + */
|
---|
| 2590 | +
|
---|
| 2591 | +#define COFF_F_RELFLG 0000001
|
---|
| 2592 | +#define COFF_F_EXEC 0000002
|
---|
| 2593 | +#define COFF_F_LNNO 0000004
|
---|
| 2594 | +#define COFF_F_LSYMS 0000010
|
---|
| 2595 | +#define COFF_F_MINMAL 0000020
|
---|
| 2596 | +#define COFF_F_UPDATE 0000040
|
---|
| 2597 | +#define COFF_F_SWABD 0000100
|
---|
| 2598 | +#define COFF_F_AR16WR 0000200
|
---|
| 2599 | +#define COFF_F_AR32WR 0000400
|
---|
| 2600 | +#define COFF_F_AR32W 0001000
|
---|
| 2601 | +#define COFF_F_PATCH 0002000
|
---|
| 2602 | +#define COFF_F_NODF 0002000
|
---|
| 2603 | +
|
---|
| 2604 | +#define COFF_I386MAGIC 0x14c /* Linux's system */
|
---|
| 2605 | +
|
---|
| 2606 | +#if 0 /* Perhaps, someday, these formats may be used. */
|
---|
| 2607 | +#define COFF_I386PTXMAGIC 0x154
|
---|
| 2608 | +#define COFF_I386AIXMAGIC 0x175 /* IBM's AIX system */
|
---|
| 2609 | +#define COFF_I386BADMAG(x) ((COFF_SHORT((x).f_magic) != COFF_I386MAGIC) \
|
---|
| 2610 | + && COFF_SHORT((x).f_magic) != COFF_I386PTXMAGIC \
|
---|
| 2611 | + && COFF_SHORT((x).f_magic) != COFF_I386AIXMAGIC)
|
---|
| 2612 | +#else
|
---|
| 2613 | +#define COFF_I386BADMAG(x) (COFF_SHORT((x).f_magic) != COFF_I386MAGIC)
|
---|
| 2614 | +#endif
|
---|
| 2615 | +
|
---|
| 2616 | +#define COFF_FILHDR struct COFF_filehdr
|
---|
| 2617 | +#define COFF_FILHSZ sizeof(COFF_FILHDR)
|
---|
| 2618 | +
|
---|
| 2619 | +/********************** AOUT "OPTIONAL HEADER" **********************/
|
---|
| 2620 | +
|
---|
| 2621 | +/* Linux COFF must have this "optional" header. Standard COFF has no entry
|
---|
| 2622 | + location for the "entry" point. They normally would start with the first
|
---|
| 2623 | + location of the .text section. This is not a good idea for linux. So,
|
---|
| 2624 | + the use of this "optional" header is not optional. It is required.
|
---|
| 2625 | +
|
---|
| 2626 | + Do not be tempted to assume that the size of the optional header is
|
---|
| 2627 | + a constant and simply index the next byte by the size of this structure.
|
---|
| 2628 | + Use the 'f_opthdr' field in the main coff header for the size of the
|
---|
| 2629 | + structure actually written to the file!!
|
---|
| 2630 | +*/
|
---|
| 2631 | +
|
---|
| 2632 | +typedef struct
|
---|
| 2633 | +{
|
---|
| 2634 | + char magic[2]; /* type of file */
|
---|
| 2635 | + char vstamp[2]; /* version stamp */
|
---|
| 2636 | + char tsize[4]; /* text size in bytes, padded to FW bdry */
|
---|
| 2637 | + char dsize[4]; /* initialized data " " */
|
---|
| 2638 | + char bsize[4]; /* uninitialized data " " */
|
---|
| 2639 | + char entry[4]; /* entry pt. */
|
---|
| 2640 | + char text_start[4]; /* base of text used for this file */
|
---|
| 2641 | + char data_start[4]; /* base of data used for this file */
|
---|
| 2642 | +}
|
---|
| 2643 | +COFF_AOUTHDR;
|
---|
| 2644 | +
|
---|
| 2645 | +#define COFF_AOUTSZ (sizeof(COFF_AOUTHDR))
|
---|
| 2646 | +
|
---|
| 2647 | +#define COFF_STMAGIC 0401
|
---|
| 2648 | +#define COFF_OMAGIC 0404
|
---|
| 2649 | +#define COFF_JMAGIC 0407 /* dirty text and data image, can't share */
|
---|
| 2650 | +#define COFF_DMAGIC 0410 /* dirty text segment, data aligned */
|
---|
| 2651 | +#define COFF_ZMAGIC 0413 /* The proper magic number for executables */
|
---|
| 2652 | +#define COFF_SHMAGIC 0443 /* shared library header */
|
---|
| 2653 | +
|
---|
| 2654 | +/********************** SECTION HEADER **********************/
|
---|
| 2655 | +
|
---|
| 2656 | +struct COFF_scnhdr {
|
---|
| 2657 | + char s_name[8]; /* section name */
|
---|
| 2658 | + char s_paddr[4]; /* physical address, aliased s_nlib */
|
---|
| 2659 | + char s_vaddr[4]; /* virtual address */
|
---|
| 2660 | + char s_size[4]; /* section size */
|
---|
| 2661 | + char s_scnptr[4]; /* file ptr to raw data for section */
|
---|
| 2662 | + char s_relptr[4]; /* file ptr to relocation */
|
---|
| 2663 | + char s_lnnoptr[4]; /* file ptr to line numbers */
|
---|
| 2664 | + char s_nreloc[2]; /* number of relocation entries */
|
---|
| 2665 | + char s_nlnno[2]; /* number of line number entries */
|
---|
| 2666 | + char s_flags[4]; /* flags */
|
---|
| 2667 | +};
|
---|
| 2668 | +
|
---|
| 2669 | +#define COFF_SCNHDR struct COFF_scnhdr
|
---|
| 2670 | +#define COFF_SCNHSZ sizeof(COFF_SCNHDR)
|
---|
| 2671 | +
|
---|
| 2672 | +/*
|
---|
| 2673 | + * names of "special" sections
|
---|
| 2674 | + */
|
---|
| 2675 | +
|
---|
| 2676 | +#define COFF_TEXT ".text"
|
---|
| 2677 | +#define COFF_DATA ".data"
|
---|
| 2678 | +#define COFF_BSS ".bss"
|
---|
| 2679 | +#define COFF_COMMENT ".comment"
|
---|
| 2680 | +#define COFF_LIB ".lib"
|
---|
| 2681 | +
|
---|
| 2682 | +#define COFF_SECT_TEXT 0 /* Section for instruction code */
|
---|
| 2683 | +#define COFF_SECT_DATA 1 /* Section for initialized globals */
|
---|
| 2684 | +#define COFF_SECT_BSS 2 /* Section for un-initialized globals */
|
---|
| 2685 | +#define COFF_SECT_REQD 3 /* Minimum number of sections for good file */
|
---|
| 2686 | +
|
---|
| 2687 | +#define COFF_STYP_REG 0x00 /* regular segment */
|
---|
| 2688 | +#define COFF_STYP_DSECT 0x01 /* dummy segment */
|
---|
| 2689 | +#define COFF_STYP_NOLOAD 0x02 /* no-load segment */
|
---|
| 2690 | +#define COFF_STYP_GROUP 0x04 /* group segment */
|
---|
| 2691 | +#define COFF_STYP_PAD 0x08 /* .pad segment */
|
---|
| 2692 | +#define COFF_STYP_COPY 0x10 /* copy section */
|
---|
| 2693 | +#define COFF_STYP_TEXT 0x20 /* .text segment */
|
---|
| 2694 | +#define COFF_STYP_DATA 0x40 /* .data segment */
|
---|
| 2695 | +#define COFF_STYP_BSS 0x80 /* .bss segment */
|
---|
| 2696 | +#define COFF_STYP_INFO 0x200 /* .comment section */
|
---|
| 2697 | +#define COFF_STYP_OVER 0x400 /* overlay section */
|
---|
| 2698 | +#define COFF_STYP_LIB 0x800 /* library section */
|
---|
| 2699 | +
|
---|
| 2700 | +/*
|
---|
| 2701 | + * Shared libraries have the following section header in the data field for
|
---|
| 2702 | + * each library.
|
---|
| 2703 | + */
|
---|
| 2704 | +
|
---|
| 2705 | +struct COFF_slib {
|
---|
| 2706 | + char sl_entsz[4]; /* Size of this entry */
|
---|
| 2707 | + char sl_pathndx[4]; /* size of the header field */
|
---|
| 2708 | +};
|
---|
| 2709 | +
|
---|
| 2710 | +#define COFF_SLIBHD struct COFF_slib
|
---|
| 2711 | +#define COFF_SLIBSZ sizeof(COFF_SLIBHD)
|
---|
| 2712 | +
|
---|
| 2713 | +/********************** LINE NUMBERS **********************/
|
---|
| 2714 | +
|
---|
| 2715 | +/* 1 line number entry for every "breakpointable" source line in a section.
|
---|
| 2716 | + * Line numbers are grouped on a per function basis; first entry in a function
|
---|
| 2717 | + * grouping will have l_lnno = 0 and in place of physical address will be the
|
---|
| 2718 | + * symbol table index of the function name.
|
---|
| 2719 | + */
|
---|
| 2720 | +
|
---|
| 2721 | +struct COFF_lineno {
|
---|
| 2722 | + union {
|
---|
| 2723 | + char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/
|
---|
| 2724 | + char l_paddr[4]; /* (physical) address of line number */
|
---|
| 2725 | + } l_addr;
|
---|
| 2726 | + char l_lnno[2]; /* line number */
|
---|
| 2727 | +};
|
---|
| 2728 | +
|
---|
| 2729 | +#define COFF_LINENO struct COFF_lineno
|
---|
| 2730 | +#define COFF_LINESZ 6
|
---|
| 2731 | +
|
---|
| 2732 | +/********************** SYMBOLS **********************/
|
---|
| 2733 | +
|
---|
| 2734 | +#define COFF_E_SYMNMLEN 8 /* # characters in a short symbol name */
|
---|
| 2735 | +#define COFF_E_FILNMLEN 14 /* # characters in a file name */
|
---|
| 2736 | +#define COFF_E_DIMNUM 4 /* # array dimensions in auxiliary entry */
|
---|
| 2737 | +
|
---|
| 2738 | +/*
|
---|
| 2739 | + * All symbols and sections have the following definition
|
---|
| 2740 | + */
|
---|
| 2741 | +
|
---|
| 2742 | +struct COFF_syment
|
---|
| 2743 | +{
|
---|
| 2744 | + union {
|
---|
| 2745 | + char e_name[E_SYMNMLEN]; /* Symbol name (first 8 characters) */
|
---|
| 2746 | + struct {
|
---|
| 2747 | + char e_zeroes[4]; /* Leading zeros */
|
---|
| 2748 | + char e_offset[4]; /* Offset if this is a header section */
|
---|
| 2749 | + } e;
|
---|
| 2750 | + } e;
|
---|
| 2751 | +
|
---|
| 2752 | + char e_value[4]; /* Value (address) of the segment */
|
---|
| 2753 | + char e_scnum[2]; /* Section number */
|
---|
| 2754 | + char e_type[2]; /* Type of section */
|
---|
| 2755 | + char e_sclass[1]; /* Loader class */
|
---|
| 2756 | + char e_numaux[1]; /* Number of auxiliary entries which follow */
|
---|
| 2757 | +};
|
---|
| 2758 | +
|
---|
| 2759 | +#define COFF_N_BTMASK (0xf) /* Mask for important class bits */
|
---|
| 2760 | +#define COFF_N_TMASK (0x30) /* Mask for important type bits */
|
---|
| 2761 | +#define COFF_N_BTSHFT (4) /* # bits to shift class field */
|
---|
| 2762 | +#define COFF_N_TSHIFT (2) /* # bits to shift type field */
|
---|
| 2763 | +
|
---|
| 2764 | +/*
|
---|
| 2765 | + * Auxiliary entries because the main table is too limiting.
|
---|
| 2766 | + */
|
---|
| 2767 | +
|
---|
| 2768 | +union COFF_auxent {
|
---|
| 2769 | +
|
---|
| 2770 | +/*
|
---|
| 2771 | + * Debugger information
|
---|
| 2772 | + */
|
---|
| 2773 | +
|
---|
| 2774 | + struct {
|
---|
| 2775 | + char x_tagndx[4]; /* str, un, or enum tag indx */
|
---|
| 2776 | + union {
|
---|
| 2777 | + struct {
|
---|
| 2778 | + char x_lnno[2]; /* declaration line number */
|
---|
| 2779 | + char x_size[2]; /* str/union/array size */
|
---|
| 2780 | + } x_lnsz;
|
---|
| 2781 | + char x_fsize[4]; /* size of function */
|
---|
| 2782 | + } x_misc;
|
---|
| 2783 | +
|
---|
| 2784 | + union {
|
---|
| 2785 | + struct { /* if ISFCN, tag, or .bb */
|
---|
| 2786 | + char x_lnnoptr[4]; /* ptr to fcn line # */
|
---|
| 2787 | + char x_endndx[4]; /* entry ndx past block end */
|
---|
| 2788 | + } x_fcn;
|
---|
| 2789 | +
|
---|
| 2790 | + struct { /* if ISARY, up to 4 dimen. */
|
---|
| 2791 | + char x_dimen[E_DIMNUM][2];
|
---|
| 2792 | + } x_ary;
|
---|
| 2793 | + } x_fcnary;
|
---|
| 2794 | +
|
---|
| 2795 | + char x_tvndx[2]; /* tv index */
|
---|
| 2796 | + } x_sym;
|
---|
| 2797 | +
|
---|
| 2798 | +/*
|
---|
| 2799 | + * Source file names (debugger information)
|
---|
| 2800 | + */
|
---|
| 2801 | +
|
---|
| 2802 | + union {
|
---|
| 2803 | + char x_fname[E_FILNMLEN];
|
---|
| 2804 | + struct {
|
---|
| 2805 | + char x_zeroes[4];
|
---|
| 2806 | + char x_offset[4];
|
---|
| 2807 | + } x_n;
|
---|
| 2808 | + } x_file;
|
---|
| 2809 | +
|
---|
| 2810 | +/*
|
---|
| 2811 | + * Section information
|
---|
| 2812 | + */
|
---|
| 2813 | +
|
---|
| 2814 | + struct {
|
---|
| 2815 | + char x_scnlen[4]; /* section length */
|
---|
| 2816 | + char x_nreloc[2]; /* # relocation entries */
|
---|
| 2817 | + char x_nlinno[2]; /* # line numbers */
|
---|
| 2818 | + } x_scn;
|
---|
| 2819 | +
|
---|
| 2820 | +/*
|
---|
| 2821 | + * Transfer vector (branch table)
|
---|
| 2822 | + */
|
---|
| 2823 | +
|
---|
| 2824 | + struct {
|
---|
| 2825 | + char x_tvfill[4]; /* tv fill value */
|
---|
| 2826 | + char x_tvlen[2]; /* length of .tv */
|
---|
| 2827 | + char x_tvran[2][2]; /* tv range */
|
---|
| 2828 | + } x_tv; /* info about .tv section (in auxent of symbol .tv)) */
|
---|
| 2829 | +};
|
---|
| 2830 | +
|
---|
| 2831 | +#define COFF_SYMENT struct COFF_syment
|
---|
| 2832 | +#define COFF_SYMESZ 18
|
---|
| 2833 | +#define COFF_AUXENT union COFF_auxent
|
---|
| 2834 | +#define COFF_AUXESZ 18
|
---|
| 2835 | +
|
---|
| 2836 | +#define COFF_ETEXT "etext"
|
---|
| 2837 | +
|
---|
| 2838 | +/********************** RELOCATION DIRECTIVES **********************/
|
---|
| 2839 | +
|
---|
| 2840 | +struct COFF_reloc {
|
---|
| 2841 | + char r_vaddr[4]; /* Virtual address of item */
|
---|
| 2842 | + char r_symndx[4]; /* Symbol index in the symtab */
|
---|
| 2843 | + char r_type[2]; /* Relocation type */
|
---|
| 2844 | +};
|
---|
| 2845 | +
|
---|
| 2846 | +#define COFF_RELOC struct COFF_reloc
|
---|
| 2847 | +#define COFF_RELSZ 10
|
---|
| 2848 | +
|
---|
| 2849 | +#define COFF_DEF_DATA_SECTION_ALIGNMENT 4
|
---|
| 2850 | +#define COFF_DEF_BSS_SECTION_ALIGNMENT 4
|
---|
| 2851 | +#define COFF_DEF_TEXT_SECTION_ALIGNMENT 4
|
---|
| 2852 | +
|
---|
| 2853 | +/* For new sections we haven't heard of before */
|
---|
| 2854 | +#define COFF_DEF_SECTION_ALIGNMENT 4
|
---|
| 2855 | diff -Naur aboot-0.9b.orig/include/linux/compiler.h aboot-0.9b/include/linux/compiler.h
|
---|
| 2856 | --- aboot-0.9b.orig/include/linux/compiler.h 1969-12-31 19:00:00.000000000 -0500
|
---|
| 2857 | +++ aboot-0.9b/include/linux/compiler.h 2008-01-02 13:53:15.000000000 -0500
|
---|
| 2858 | @@ -0,0 +1,11 @@
|
---|
| 2859 | +#ifndef __inline__
|
---|
| 2860 | +# define __inline__ inline
|
---|
| 2861 | +#endif
|
---|
| 2862 | +
|
---|
| 2863 | +#ifndef __attribute_const__
|
---|
| 2864 | +# define __attribute_const__ /* unimplemented */
|
---|
| 2865 | +#endif
|
---|
| 2866 | +
|
---|
| 2867 | +#ifndef __always_inline
|
---|
| 2868 | +# define __always_inline inline
|
---|
| 2869 | +#endif
|
---|
| 2870 | diff -Naur aboot-0.9b.orig/include/linux/elf-em.h aboot-0.9b/include/linux/elf-em.h
|
---|
| 2871 | --- aboot-0.9b.orig/include/linux/elf-em.h 1969-12-31 19:00:00.000000000 -0500
|
---|
| 2872 | +++ aboot-0.9b/include/linux/elf-em.h 2008-01-02 13:53:15.000000000 -0500
|
---|
| 2873 | @@ -0,0 +1,52 @@
|
---|
| 2874 | +#ifndef _LINUX_ELF_EM_H
|
---|
| 2875 | +#define _LINUX_ELF_EM_H
|
---|
| 2876 | +
|
---|
| 2877 | +/* These constants define the various ELF target machines */
|
---|
| 2878 | +#define EM_NONE 0
|
---|
| 2879 | +#define EM_M32 1
|
---|
| 2880 | +#define EM_SPARC 2
|
---|
| 2881 | +#define EM_386 3
|
---|
| 2882 | +#define EM_68K 4
|
---|
| 2883 | +#define EM_88K 5
|
---|
| 2884 | +#define EM_486 6 /* Perhaps disused */
|
---|
| 2885 | +#define EM_860 7
|
---|
| 2886 | +#define EM_MIPS 8 /* MIPS R3000 (officially, big-endian only) */
|
---|
| 2887 | + /* Next two are historical and binaries and
|
---|
| 2888 | + modules of these types will be rejected by
|
---|
| 2889 | + Linux. */
|
---|
| 2890 | +#define EM_MIPS_RS3_LE 10 /* MIPS R3000 little-endian */
|
---|
| 2891 | +#define EM_MIPS_RS4_BE 10 /* MIPS R4000 big-endian */
|
---|
| 2892 | +
|
---|
| 2893 | +#define EM_PARISC 15 /* HPPA */
|
---|
| 2894 | +#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */
|
---|
| 2895 | +#define EM_PPC 20 /* PowerPC */
|
---|
| 2896 | +#define EM_PPC64 21 /* PowerPC64 */
|
---|
| 2897 | +#define EM_SPU 23 /* Cell BE SPU */
|
---|
| 2898 | +#define EM_SH 42 /* SuperH */
|
---|
| 2899 | +#define EM_SPARCV9 43 /* SPARC v9 64-bit */
|
---|
| 2900 | +#define EM_IA_64 50 /* HP/Intel IA-64 */
|
---|
| 2901 | +#define EM_X86_64 62 /* AMD x86-64 */
|
---|
| 2902 | +#define EM_S390 22 /* IBM S/390 */
|
---|
| 2903 | +#define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */
|
---|
| 2904 | +#define EM_V850 87 /* NEC v850 */
|
---|
| 2905 | +#define EM_M32R 88 /* Renesas M32R */
|
---|
| 2906 | +#define EM_H8_300 46 /* Renesas H8/300,300H,H8S */
|
---|
| 2907 | +#define EM_BLACKFIN 106 /* ADI Blackfin Processor */
|
---|
| 2908 | +#define EM_FRV 0x5441 /* Fujitsu FR-V */
|
---|
| 2909 | +#define EM_AVR32 0x18ad /* Atmel AVR32 */
|
---|
| 2910 | +
|
---|
| 2911 | +/*
|
---|
| 2912 | + * This is an interim value that we will use until the committee comes
|
---|
| 2913 | + * up with a final number.
|
---|
| 2914 | + */
|
---|
| 2915 | +#define EM_ALPHA 0x9026
|
---|
| 2916 | +
|
---|
| 2917 | +/* Bogus old v850 magic number, used by old tools. */
|
---|
| 2918 | +#define EM_CYGNUS_V850 0x9080
|
---|
| 2919 | +/* Bogus old m32r magic number, used by old tools. */
|
---|
| 2920 | +#define EM_CYGNUS_M32R 0x9041
|
---|
| 2921 | +/* This is the old interim value for S/390 architecture */
|
---|
| 2922 | +#define EM_S390_OLD 0xA390
|
---|
| 2923 | +
|
---|
| 2924 | +
|
---|
| 2925 | +#endif /* _LINUX_ELF_EM_H */
|
---|
| 2926 | diff -Naur aboot-0.9b.orig/include/linux/elf.h aboot-0.9b/include/linux/elf.h
|
---|
| 2927 | --- aboot-0.9b.orig/include/linux/elf.h 1969-12-31 19:00:00.000000000 -0500
|
---|
| 2928 | +++ aboot-0.9b/include/linux/elf.h 2008-01-02 13:53:15.000000000 -0500
|
---|
| 2929 | @@ -0,0 +1,400 @@
|
---|
| 2930 | +#ifndef _LINUX_ELF_H
|
---|
| 2931 | +#define _LINUX_ELF_H
|
---|
| 2932 | +
|
---|
| 2933 | +#include <linux/types.h>
|
---|
| 2934 | +#include <linux/auxvec.h>
|
---|
| 2935 | +#include <linux/elf-em.h>
|
---|
| 2936 | +#include <asm/elf.h>
|
---|
| 2937 | +
|
---|
| 2938 | +struct file;
|
---|
| 2939 | +
|
---|
| 2940 | +#ifndef elf_read_implies_exec
|
---|
| 2941 | + /* Executables for which elf_read_implies_exec() returns TRUE will
|
---|
| 2942 | + have the READ_IMPLIES_EXEC personality flag set automatically.
|
---|
| 2943 | + Override in asm/elf.h as needed. */
|
---|
| 2944 | +# define elf_read_implies_exec(ex, have_pt_gnu_stack) 0
|
---|
| 2945 | +#endif
|
---|
| 2946 | +
|
---|
| 2947 | +/* 32-bit ELF base types. */
|
---|
| 2948 | +typedef __u32 Elf32_Addr;
|
---|
| 2949 | +typedef __u16 Elf32_Half;
|
---|
| 2950 | +typedef __u32 Elf32_Off;
|
---|
| 2951 | +typedef __s32 Elf32_Sword;
|
---|
| 2952 | +typedef __u32 Elf32_Word;
|
---|
| 2953 | +
|
---|
| 2954 | +/* 64-bit ELF base types. */
|
---|
| 2955 | +typedef __u64 Elf64_Addr;
|
---|
| 2956 | +typedef __u16 Elf64_Half;
|
---|
| 2957 | +typedef __s16 Elf64_SHalf;
|
---|
| 2958 | +typedef __u64 Elf64_Off;
|
---|
| 2959 | +typedef __s32 Elf64_Sword;
|
---|
| 2960 | +typedef __u32 Elf64_Word;
|
---|
| 2961 | +typedef __u64 Elf64_Xword;
|
---|
| 2962 | +typedef __s64 Elf64_Sxword;
|
---|
| 2963 | +
|
---|
| 2964 | +/* These constants are for the segment types stored in the image headers */
|
---|
| 2965 | +#define PT_NULL 0
|
---|
| 2966 | +#define PT_LOAD 1
|
---|
| 2967 | +#define PT_DYNAMIC 2
|
---|
| 2968 | +#define PT_INTERP 3
|
---|
| 2969 | +#define PT_NOTE 4
|
---|
| 2970 | +#define PT_SHLIB 5
|
---|
| 2971 | +#define PT_PHDR 6
|
---|
| 2972 | +#define PT_TLS 7 /* Thread local storage segment */
|
---|
| 2973 | +#define PT_LOOS 0x60000000 /* OS-specific */
|
---|
| 2974 | +#define PT_HIOS 0x6fffffff /* OS-specific */
|
---|
| 2975 | +#define PT_LOPROC 0x70000000
|
---|
| 2976 | +#define PT_HIPROC 0x7fffffff
|
---|
| 2977 | +#define PT_GNU_EH_FRAME 0x6474e550
|
---|
| 2978 | +
|
---|
| 2979 | +#define PT_GNU_STACK (PT_LOOS + 0x474e551)
|
---|
| 2980 | +
|
---|
| 2981 | +/* These constants define the different elf file types */
|
---|
| 2982 | +#define ET_NONE 0
|
---|
| 2983 | +#define ET_REL 1
|
---|
| 2984 | +#define ET_EXEC 2
|
---|
| 2985 | +#define ET_DYN 3
|
---|
| 2986 | +#define ET_CORE 4
|
---|
| 2987 | +#define ET_LOPROC 0xff00
|
---|
| 2988 | +#define ET_HIPROC 0xffff
|
---|
| 2989 | +
|
---|
| 2990 | +/* This is the info that is needed to parse the dynamic section of the file */
|
---|
| 2991 | +#define DT_NULL 0
|
---|
| 2992 | +#define DT_NEEDED 1
|
---|
| 2993 | +#define DT_PLTRELSZ 2
|
---|
| 2994 | +#define DT_PLTGOT 3
|
---|
| 2995 | +#define DT_HASH 4
|
---|
| 2996 | +#define DT_STRTAB 5
|
---|
| 2997 | +#define DT_SYMTAB 6
|
---|
| 2998 | +#define DT_RELA 7
|
---|
| 2999 | +#define DT_RELASZ 8
|
---|
| 3000 | +#define DT_RELAENT 9
|
---|
| 3001 | +#define DT_STRSZ 10
|
---|
| 3002 | +#define DT_SYMENT 11
|
---|
| 3003 | +#define DT_INIT 12
|
---|
| 3004 | +#define DT_FINI 13
|
---|
| 3005 | +#define DT_SONAME 14
|
---|
| 3006 | +#define DT_RPATH 15
|
---|
| 3007 | +#define DT_SYMBOLIC 16
|
---|
| 3008 | +#define DT_REL 17
|
---|
| 3009 | +#define DT_RELSZ 18
|
---|
| 3010 | +#define DT_RELENT 19
|
---|
| 3011 | +#define DT_PLTREL 20
|
---|
| 3012 | +#define DT_DEBUG 21
|
---|
| 3013 | +#define DT_TEXTREL 22
|
---|
| 3014 | +#define DT_JMPREL 23
|
---|
| 3015 | +#define DT_ENCODING 32
|
---|
| 3016 | +#define OLD_DT_LOOS 0x60000000
|
---|
| 3017 | +#define DT_LOOS 0x6000000d
|
---|
| 3018 | +#define DT_HIOS 0x6ffff000
|
---|
| 3019 | +#define DT_VALRNGLO 0x6ffffd00
|
---|
| 3020 | +#define DT_VALRNGHI 0x6ffffdff
|
---|
| 3021 | +#define DT_ADDRRNGLO 0x6ffffe00
|
---|
| 3022 | +#define DT_ADDRRNGHI 0x6ffffeff
|
---|
| 3023 | +#define DT_VERSYM 0x6ffffff0
|
---|
| 3024 | +#define DT_RELACOUNT 0x6ffffff9
|
---|
| 3025 | +#define DT_RELCOUNT 0x6ffffffa
|
---|
| 3026 | +#define DT_FLAGS_1 0x6ffffffb
|
---|
| 3027 | +#define DT_VERDEF 0x6ffffffc
|
---|
| 3028 | +#define DT_VERDEFNUM 0x6ffffffd
|
---|
| 3029 | +#define DT_VERNEED 0x6ffffffe
|
---|
| 3030 | +#define DT_VERNEEDNUM 0x6fffffff
|
---|
| 3031 | +#define OLD_DT_HIOS 0x6fffffff
|
---|
| 3032 | +#define DT_LOPROC 0x70000000
|
---|
| 3033 | +#define DT_HIPROC 0x7fffffff
|
---|
| 3034 | +
|
---|
| 3035 | +/* This info is needed when parsing the symbol table */
|
---|
| 3036 | +#define STB_LOCAL 0
|
---|
| 3037 | +#define STB_GLOBAL 1
|
---|
| 3038 | +#define STB_WEAK 2
|
---|
| 3039 | +
|
---|
| 3040 | +#define STT_NOTYPE 0
|
---|
| 3041 | +#define STT_OBJECT 1
|
---|
| 3042 | +#define STT_FUNC 2
|
---|
| 3043 | +#define STT_SECTION 3
|
---|
| 3044 | +#define STT_FILE 4
|
---|
| 3045 | +#define STT_COMMON 5
|
---|
| 3046 | +#define STT_TLS 6
|
---|
| 3047 | +
|
---|
| 3048 | +#define ELF_ST_BIND(x) ((x) >> 4)
|
---|
| 3049 | +#define ELF_ST_TYPE(x) (((unsigned int) x) & 0xf)
|
---|
| 3050 | +#define ELF32_ST_BIND(x) ELF_ST_BIND(x)
|
---|
| 3051 | +#define ELF32_ST_TYPE(x) ELF_ST_TYPE(x)
|
---|
| 3052 | +#define ELF64_ST_BIND(x) ELF_ST_BIND(x)
|
---|
| 3053 | +#define ELF64_ST_TYPE(x) ELF_ST_TYPE(x)
|
---|
| 3054 | +
|
---|
| 3055 | +typedef struct dynamic{
|
---|
| 3056 | + Elf32_Sword d_tag;
|
---|
| 3057 | + union{
|
---|
| 3058 | + Elf32_Sword d_val;
|
---|
| 3059 | + Elf32_Addr d_ptr;
|
---|
| 3060 | + } d_un;
|
---|
| 3061 | +} Elf32_Dyn;
|
---|
| 3062 | +
|
---|
| 3063 | +typedef struct {
|
---|
| 3064 | + Elf64_Sxword d_tag; /* entry tag value */
|
---|
| 3065 | + union {
|
---|
| 3066 | + Elf64_Xword d_val;
|
---|
| 3067 | + Elf64_Addr d_ptr;
|
---|
| 3068 | + } d_un;
|
---|
| 3069 | +} Elf64_Dyn;
|
---|
| 3070 | +
|
---|
| 3071 | +/* The following are used with relocations */
|
---|
| 3072 | +#define ELF32_R_SYM(x) ((x) >> 8)
|
---|
| 3073 | +#define ELF32_R_TYPE(x) ((x) & 0xff)
|
---|
| 3074 | +
|
---|
| 3075 | +#define ELF64_R_SYM(i) ((i) >> 32)
|
---|
| 3076 | +#define ELF64_R_TYPE(i) ((i) & 0xffffffff)
|
---|
| 3077 | +
|
---|
| 3078 | +typedef struct elf32_rel {
|
---|
| 3079 | + Elf32_Addr r_offset;
|
---|
| 3080 | + Elf32_Word r_info;
|
---|
| 3081 | +} Elf32_Rel;
|
---|
| 3082 | +
|
---|
| 3083 | +typedef struct elf64_rel {
|
---|
| 3084 | + Elf64_Addr r_offset; /* Location at which to apply the action */
|
---|
| 3085 | + Elf64_Xword r_info; /* index and type of relocation */
|
---|
| 3086 | +} Elf64_Rel;
|
---|
| 3087 | +
|
---|
| 3088 | +typedef struct elf32_rela{
|
---|
| 3089 | + Elf32_Addr r_offset;
|
---|
| 3090 | + Elf32_Word r_info;
|
---|
| 3091 | + Elf32_Sword r_addend;
|
---|
| 3092 | +} Elf32_Rela;
|
---|
| 3093 | +
|
---|
| 3094 | +typedef struct elf64_rela {
|
---|
| 3095 | + Elf64_Addr r_offset; /* Location at which to apply the action */
|
---|
| 3096 | + Elf64_Xword r_info; /* index and type of relocation */
|
---|
| 3097 | + Elf64_Sxword r_addend; /* Constant addend used to compute value */
|
---|
| 3098 | +} Elf64_Rela;
|
---|
| 3099 | +
|
---|
| 3100 | +typedef struct elf32_sym{
|
---|
| 3101 | + Elf32_Word st_name;
|
---|
| 3102 | + Elf32_Addr st_value;
|
---|
| 3103 | + Elf32_Word st_size;
|
---|
| 3104 | + unsigned char st_info;
|
---|
| 3105 | + unsigned char st_other;
|
---|
| 3106 | + Elf32_Half st_shndx;
|
---|
| 3107 | +} Elf32_Sym;
|
---|
| 3108 | +
|
---|
| 3109 | +typedef struct elf64_sym {
|
---|
| 3110 | + Elf64_Word st_name; /* Symbol name, index in string tbl */
|
---|
| 3111 | + unsigned char st_info; /* Type and binding attributes */
|
---|
| 3112 | + unsigned char st_other; /* No defined meaning, 0 */
|
---|
| 3113 | + Elf64_Half st_shndx; /* Associated section index */
|
---|
| 3114 | + Elf64_Addr st_value; /* Value of the symbol */
|
---|
| 3115 | + Elf64_Xword st_size; /* Associated symbol size */
|
---|
| 3116 | +} Elf64_Sym;
|
---|
| 3117 | +
|
---|
| 3118 | +
|
---|
| 3119 | +#define EI_NIDENT 16
|
---|
| 3120 | +
|
---|
| 3121 | +typedef struct elf32_hdr{
|
---|
| 3122 | + unsigned char e_ident[EI_NIDENT];
|
---|
| 3123 | + Elf32_Half e_type;
|
---|
| 3124 | + Elf32_Half e_machine;
|
---|
| 3125 | + Elf32_Word e_version;
|
---|
| 3126 | + Elf32_Addr e_entry; /* Entry point */
|
---|
| 3127 | + Elf32_Off e_phoff;
|
---|
| 3128 | + Elf32_Off e_shoff;
|
---|
| 3129 | + Elf32_Word e_flags;
|
---|
| 3130 | + Elf32_Half e_ehsize;
|
---|
| 3131 | + Elf32_Half e_phentsize;
|
---|
| 3132 | + Elf32_Half e_phnum;
|
---|
| 3133 | + Elf32_Half e_shentsize;
|
---|
| 3134 | + Elf32_Half e_shnum;
|
---|
| 3135 | + Elf32_Half e_shstrndx;
|
---|
| 3136 | +} Elf32_Ehdr;
|
---|
| 3137 | +
|
---|
| 3138 | +typedef struct elf64_hdr {
|
---|
| 3139 | + unsigned char e_ident[16]; /* ELF "magic number" */
|
---|
| 3140 | + Elf64_Half e_type;
|
---|
| 3141 | + Elf64_Half e_machine;
|
---|
| 3142 | + Elf64_Word e_version;
|
---|
| 3143 | + Elf64_Addr e_entry; /* Entry point virtual address */
|
---|
| 3144 | + Elf64_Off e_phoff; /* Program header table file offset */
|
---|
| 3145 | + Elf64_Off e_shoff; /* Section header table file offset */
|
---|
| 3146 | + Elf64_Word e_flags;
|
---|
| 3147 | + Elf64_Half e_ehsize;
|
---|
| 3148 | + Elf64_Half e_phentsize;
|
---|
| 3149 | + Elf64_Half e_phnum;
|
---|
| 3150 | + Elf64_Half e_shentsize;
|
---|
| 3151 | + Elf64_Half e_shnum;
|
---|
| 3152 | + Elf64_Half e_shstrndx;
|
---|
| 3153 | +} Elf64_Ehdr;
|
---|
| 3154 | +
|
---|
| 3155 | +/* These constants define the permissions on sections in the program
|
---|
| 3156 | + header, p_flags. */
|
---|
| 3157 | +#define PF_R 0x4
|
---|
| 3158 | +#define PF_W 0x2
|
---|
| 3159 | +#define PF_X 0x1
|
---|
| 3160 | +
|
---|
| 3161 | +typedef struct elf32_phdr{
|
---|
| 3162 | + Elf32_Word p_type;
|
---|
| 3163 | + Elf32_Off p_offset;
|
---|
| 3164 | + Elf32_Addr p_vaddr;
|
---|
| 3165 | + Elf32_Addr p_paddr;
|
---|
| 3166 | + Elf32_Word p_filesz;
|
---|
| 3167 | + Elf32_Word p_memsz;
|
---|
| 3168 | + Elf32_Word p_flags;
|
---|
| 3169 | + Elf32_Word p_align;
|
---|
| 3170 | +} Elf32_Phdr;
|
---|
| 3171 | +
|
---|
| 3172 | +typedef struct elf64_phdr {
|
---|
| 3173 | + Elf64_Word p_type;
|
---|
| 3174 | + Elf64_Word p_flags;
|
---|
| 3175 | + Elf64_Off p_offset; /* Segment file offset */
|
---|
| 3176 | + Elf64_Addr p_vaddr; /* Segment virtual address */
|
---|
| 3177 | + Elf64_Addr p_paddr; /* Segment physical address */
|
---|
| 3178 | + Elf64_Xword p_filesz; /* Segment size in file */
|
---|
| 3179 | + Elf64_Xword p_memsz; /* Segment size in memory */
|
---|
| 3180 | + Elf64_Xword p_align; /* Segment alignment, file & memory */
|
---|
| 3181 | +} Elf64_Phdr;
|
---|
| 3182 | +
|
---|
| 3183 | +/* sh_type */
|
---|
| 3184 | +#define SHT_NULL 0
|
---|
| 3185 | +#define SHT_PROGBITS 1
|
---|
| 3186 | +#define SHT_SYMTAB 2
|
---|
| 3187 | +#define SHT_STRTAB 3
|
---|
| 3188 | +#define SHT_RELA 4
|
---|
| 3189 | +#define SHT_HASH 5
|
---|
| 3190 | +#define SHT_DYNAMIC 6
|
---|
| 3191 | +#define SHT_NOTE 7
|
---|
| 3192 | +#define SHT_NOBITS 8
|
---|
| 3193 | +#define SHT_REL 9
|
---|
| 3194 | +#define SHT_SHLIB 10
|
---|
| 3195 | +#define SHT_DYNSYM 11
|
---|
| 3196 | +#define SHT_NUM 12
|
---|
| 3197 | +#define SHT_LOPROC 0x70000000
|
---|
| 3198 | +#define SHT_HIPROC 0x7fffffff
|
---|
| 3199 | +#define SHT_LOUSER 0x80000000
|
---|
| 3200 | +#define SHT_HIUSER 0xffffffff
|
---|
| 3201 | +
|
---|
| 3202 | +/* sh_flags */
|
---|
| 3203 | +#define SHF_WRITE 0x1
|
---|
| 3204 | +#define SHF_ALLOC 0x2
|
---|
| 3205 | +#define SHF_EXECINSTR 0x4
|
---|
| 3206 | +#define SHF_MASKPROC 0xf0000000
|
---|
| 3207 | +
|
---|
| 3208 | +/* special section indexes */
|
---|
| 3209 | +#define SHN_UNDEF 0
|
---|
| 3210 | +#define SHN_LORESERVE 0xff00
|
---|
| 3211 | +#define SHN_LOPROC 0xff00
|
---|
| 3212 | +#define SHN_HIPROC 0xff1f
|
---|
| 3213 | +#define SHN_ABS 0xfff1
|
---|
| 3214 | +#define SHN_COMMON 0xfff2
|
---|
| 3215 | +#define SHN_HIRESERVE 0xffff
|
---|
| 3216 | +
|
---|
| 3217 | +typedef struct {
|
---|
| 3218 | + Elf32_Word sh_name;
|
---|
| 3219 | + Elf32_Word sh_type;
|
---|
| 3220 | + Elf32_Word sh_flags;
|
---|
| 3221 | + Elf32_Addr sh_addr;
|
---|
| 3222 | + Elf32_Off sh_offset;
|
---|
| 3223 | + Elf32_Word sh_size;
|
---|
| 3224 | + Elf32_Word sh_link;
|
---|
| 3225 | + Elf32_Word sh_info;
|
---|
| 3226 | + Elf32_Word sh_addralign;
|
---|
| 3227 | + Elf32_Word sh_entsize;
|
---|
| 3228 | +} Elf32_Shdr;
|
---|
| 3229 | +
|
---|
| 3230 | +typedef struct elf64_shdr {
|
---|
| 3231 | + Elf64_Word sh_name; /* Section name, index in string tbl */
|
---|
| 3232 | + Elf64_Word sh_type; /* Type of section */
|
---|
| 3233 | + Elf64_Xword sh_flags; /* Miscellaneous section attributes */
|
---|
| 3234 | + Elf64_Addr sh_addr; /* Section virtual addr at execution */
|
---|
| 3235 | + Elf64_Off sh_offset; /* Section file offset */
|
---|
| 3236 | + Elf64_Xword sh_size; /* Size of section in bytes */
|
---|
| 3237 | + Elf64_Word sh_link; /* Index of another section */
|
---|
| 3238 | + Elf64_Word sh_info; /* Additional section information */
|
---|
| 3239 | + Elf64_Xword sh_addralign; /* Section alignment */
|
---|
| 3240 | + Elf64_Xword sh_entsize; /* Entry size if section holds table */
|
---|
| 3241 | +} Elf64_Shdr;
|
---|
| 3242 | +
|
---|
| 3243 | +#define EI_MAG0 0 /* e_ident[] indexes */
|
---|
| 3244 | +#define EI_MAG1 1
|
---|
| 3245 | +#define EI_MAG2 2
|
---|
| 3246 | +#define EI_MAG3 3
|
---|
| 3247 | +#define EI_CLASS 4
|
---|
| 3248 | +#define EI_DATA 5
|
---|
| 3249 | +#define EI_VERSION 6
|
---|
| 3250 | +#define EI_OSABI 7
|
---|
| 3251 | +#define EI_PAD 8
|
---|
| 3252 | +
|
---|
| 3253 | +#define ELFMAG0 0x7f /* EI_MAG */
|
---|
| 3254 | +#define ELFMAG1 'E'
|
---|
| 3255 | +#define ELFMAG2 'L'
|
---|
| 3256 | +#define ELFMAG3 'F'
|
---|
| 3257 | +#define ELFMAG "\177ELF"
|
---|
| 3258 | +#define SELFMAG 4
|
---|
| 3259 | +
|
---|
| 3260 | +#define ELFCLASSNONE 0 /* EI_CLASS */
|
---|
| 3261 | +#define ELFCLASS32 1
|
---|
| 3262 | +#define ELFCLASS64 2
|
---|
| 3263 | +#define ELFCLASSNUM 3
|
---|
| 3264 | +
|
---|
| 3265 | +#define ELFDATANONE 0 /* e_ident[EI_DATA] */
|
---|
| 3266 | +#define ELFDATA2LSB 1
|
---|
| 3267 | +#define ELFDATA2MSB 2
|
---|
| 3268 | +
|
---|
| 3269 | +#define EV_NONE 0 /* e_version, EI_VERSION */
|
---|
| 3270 | +#define EV_CURRENT 1
|
---|
| 3271 | +#define EV_NUM 2
|
---|
| 3272 | +
|
---|
| 3273 | +#define ELFOSABI_NONE 0
|
---|
| 3274 | +#define ELFOSABI_LINUX 3
|
---|
| 3275 | +
|
---|
| 3276 | +#ifndef ELF_OSABI
|
---|
| 3277 | +#define ELF_OSABI ELFOSABI_NONE
|
---|
| 3278 | +#endif
|
---|
| 3279 | +
|
---|
| 3280 | +/* Notes used in ET_CORE */
|
---|
| 3281 | +#define NT_PRSTATUS 1
|
---|
| 3282 | +#define NT_PRFPREG 2
|
---|
| 3283 | +#define NT_PRPSINFO 3
|
---|
| 3284 | +#define NT_TASKSTRUCT 4
|
---|
| 3285 | +#define NT_AUXV 6
|
---|
| 3286 | +#define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */
|
---|
| 3287 | +
|
---|
| 3288 | +
|
---|
| 3289 | +/* Note header in a PT_NOTE section */
|
---|
| 3290 | +typedef struct elf32_note {
|
---|
| 3291 | + Elf32_Word n_namesz; /* Name size */
|
---|
| 3292 | + Elf32_Word n_descsz; /* Content size */
|
---|
| 3293 | + Elf32_Word n_type; /* Content type */
|
---|
| 3294 | +} Elf32_Nhdr;
|
---|
| 3295 | +
|
---|
| 3296 | +/* Note header in a PT_NOTE section */
|
---|
| 3297 | +typedef struct elf64_note {
|
---|
| 3298 | + Elf64_Word n_namesz; /* Name size */
|
---|
| 3299 | + Elf64_Word n_descsz; /* Content size */
|
---|
| 3300 | + Elf64_Word n_type; /* Content type */
|
---|
| 3301 | +} Elf64_Nhdr;
|
---|
| 3302 | +
|
---|
| 3303 | +#if ELF_CLASS == ELFCLASS32
|
---|
| 3304 | +
|
---|
| 3305 | +extern Elf32_Dyn _DYNAMIC [];
|
---|
| 3306 | +#define elfhdr elf32_hdr
|
---|
| 3307 | +#define elf_phdr elf32_phdr
|
---|
| 3308 | +#define elf_note elf32_note
|
---|
| 3309 | +#define elf_addr_t Elf32_Off
|
---|
| 3310 | +
|
---|
| 3311 | +#else
|
---|
| 3312 | +
|
---|
| 3313 | +extern Elf64_Dyn _DYNAMIC [];
|
---|
| 3314 | +#define elfhdr elf64_hdr
|
---|
| 3315 | +#define elf_phdr elf64_phdr
|
---|
| 3316 | +#define elf_note elf64_note
|
---|
| 3317 | +#define elf_addr_t Elf64_Off
|
---|
| 3318 | +
|
---|
| 3319 | +#endif
|
---|
| 3320 | +
|
---|
| 3321 | +#ifndef ARCH_HAVE_EXTRA_ELF_NOTES
|
---|
| 3322 | +static __inline__ int arch_notes_size(void) { return 0; }
|
---|
| 3323 | +static __inline__ void arch_write_notes(struct file *file) { }
|
---|
| 3324 | +
|
---|
| 3325 | +#define ELF_CORE_EXTRA_NOTES_SIZE arch_notes_size()
|
---|
| 3326 | +#define ELF_CORE_WRITE_EXTRA_NOTES arch_write_notes(file)
|
---|
| 3327 | +#endif /* ARCH_HAVE_EXTRA_ELF_NOTES */
|
---|
| 3328 | +
|
---|
| 3329 | +#endif /* _LINUX_ELF_H */
|
---|
| 3330 | diff -Naur aboot-0.9b.orig/include/linux/ext2_fs.h aboot-0.9b/include/linux/ext2_fs.h
|
---|
| 3331 | --- aboot-0.9b.orig/include/linux/ext2_fs.h 1969-12-31 19:00:00.000000000 -0500
|
---|
| 3332 | +++ aboot-0.9b/include/linux/ext2_fs.h 2008-01-02 13:53:15.000000000 -0500
|
---|
| 3333 | @@ -0,0 +1,527 @@
|
---|
| 3334 | +/*
|
---|
| 3335 | + * linux/include/linux/ext2_fs.h
|
---|
| 3336 | + *
|
---|
| 3337 | + * Copyright (C) 1992, 1993, 1994, 1995
|
---|
| 3338 | + * Remy Card (card@masi.ibp.fr)
|
---|
| 3339 | + * Laboratoire MASI - Institut Blaise Pascal
|
---|
| 3340 | + * Universite Pierre et Marie Curie (Paris VI)
|
---|
| 3341 | + *
|
---|
| 3342 | + * from
|
---|
| 3343 | + *
|
---|
| 3344 | + * linux/include/linux/minix_fs.h
|
---|
| 3345 | + *
|
---|
| 3346 | + * Copyright (C) 1991, 1992 Linus Torvalds
|
---|
| 3347 | + */
|
---|
| 3348 | +
|
---|
| 3349 | +#ifndef _LINUX_EXT2_FS_H
|
---|
| 3350 | +#define _LINUX_EXT2_FS_H
|
---|
| 3351 | +
|
---|
| 3352 | +#include <linux/types.h>
|
---|
| 3353 | +#include <linux/magic.h>
|
---|
| 3354 | +
|
---|
| 3355 | +/*
|
---|
| 3356 | + * The second extended filesystem constants/structures
|
---|
| 3357 | + */
|
---|
| 3358 | +
|
---|
| 3359 | +/*
|
---|
| 3360 | + * Define EXT2FS_DEBUG to produce debug messages
|
---|
| 3361 | + */
|
---|
| 3362 | +#undef EXT2FS_DEBUG
|
---|
| 3363 | +
|
---|
| 3364 | +/*
|
---|
| 3365 | + * Define EXT2_PREALLOCATE to preallocate data blocks for expanding files
|
---|
| 3366 | + */
|
---|
| 3367 | +#define EXT2_PREALLOCATE
|
---|
| 3368 | +#define EXT2_DEFAULT_PREALLOC_BLOCKS 8
|
---|
| 3369 | +
|
---|
| 3370 | +/*
|
---|
| 3371 | + * The second extended file system version
|
---|
| 3372 | + */
|
---|
| 3373 | +#define EXT2FS_DATE "95/08/09"
|
---|
| 3374 | +#define EXT2FS_VERSION "0.5b"
|
---|
| 3375 | +
|
---|
| 3376 | +/*
|
---|
| 3377 | + * Debug code
|
---|
| 3378 | + */
|
---|
| 3379 | +#ifdef EXT2FS_DEBUG
|
---|
| 3380 | +# define ext2_debug(f, a...) { \
|
---|
| 3381 | + printk ("EXT2-fs DEBUG (%s, %d): %s:", \
|
---|
| 3382 | + __FILE__, __LINE__, __FUNCTION__); \
|
---|
| 3383 | + printk (f, ## a); \
|
---|
| 3384 | + }
|
---|
| 3385 | +#else
|
---|
| 3386 | +# define ext2_debug(f, a...) /**/
|
---|
| 3387 | +#endif
|
---|
| 3388 | +
|
---|
| 3389 | +/*
|
---|
| 3390 | + * Special inode numbers
|
---|
| 3391 | + */
|
---|
| 3392 | +#define EXT2_BAD_INO 1 /* Bad blocks inode */
|
---|
| 3393 | +#define EXT2_ROOT_INO 2 /* Root inode */
|
---|
| 3394 | +#define EXT2_BOOT_LOADER_INO 5 /* Boot loader inode */
|
---|
| 3395 | +#define EXT2_UNDEL_DIR_INO 6 /* Undelete directory inode */
|
---|
| 3396 | +
|
---|
| 3397 | +/* First non-reserved inode for old ext2 filesystems */
|
---|
| 3398 | +#define EXT2_GOOD_OLD_FIRST_INO 11
|
---|
| 3399 | +
|
---|
| 3400 | +/* Assume that user mode programs are passing in an ext2fs superblock, not
|
---|
| 3401 | + * a kernel struct super_block. This will allow us to call the feature-test
|
---|
| 3402 | + * macros from user land. */
|
---|
| 3403 | +#define EXT2_SB(sb) (sb)
|
---|
| 3404 | +
|
---|
| 3405 | +/*
|
---|
| 3406 | + * Maximal count of links to a file
|
---|
| 3407 | + */
|
---|
| 3408 | +#define EXT2_LINK_MAX 32000
|
---|
| 3409 | +
|
---|
| 3410 | +/*
|
---|
| 3411 | + * Macro-instructions used to manage several block sizes
|
---|
| 3412 | + */
|
---|
| 3413 | +#define EXT2_MIN_BLOCK_SIZE 1024
|
---|
| 3414 | +#define EXT2_MAX_BLOCK_SIZE 4096
|
---|
| 3415 | +#define EXT2_MIN_BLOCK_LOG_SIZE 10
|
---|
| 3416 | +# define EXT2_BLOCK_SIZE(s) (EXT2_MIN_BLOCK_SIZE << (s)->s_log_block_size)
|
---|
| 3417 | +#define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (__u32))
|
---|
| 3418 | +# define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10)
|
---|
| 3419 | +#define EXT2_INODE_SIZE(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
|
---|
| 3420 | + EXT2_GOOD_OLD_INODE_SIZE : \
|
---|
| 3421 | + (s)->s_inode_size)
|
---|
| 3422 | +#define EXT2_FIRST_INO(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
|
---|
| 3423 | + EXT2_GOOD_OLD_FIRST_INO : \
|
---|
| 3424 | + (s)->s_first_ino)
|
---|
| 3425 | +
|
---|
| 3426 | +/*
|
---|
| 3427 | + * Macro-instructions used to manage fragments
|
---|
| 3428 | + */
|
---|
| 3429 | +#define EXT2_MIN_FRAG_SIZE 1024
|
---|
| 3430 | +#define EXT2_MAX_FRAG_SIZE 4096
|
---|
| 3431 | +#define EXT2_MIN_FRAG_LOG_SIZE 10
|
---|
| 3432 | +# define EXT2_FRAG_SIZE(s) (EXT2_MIN_FRAG_SIZE << (s)->s_log_frag_size)
|
---|
| 3433 | +# define EXT2_FRAGS_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / EXT2_FRAG_SIZE(s))
|
---|
| 3434 | +
|
---|
| 3435 | +/*
|
---|
| 3436 | + * Structure of a blocks group descriptor
|
---|
| 3437 | + */
|
---|
| 3438 | +struct ext2_group_desc
|
---|
| 3439 | +{
|
---|
| 3440 | + __le32 bg_block_bitmap; /* Blocks bitmap block */
|
---|
| 3441 | + __le32 bg_inode_bitmap; /* Inodes bitmap block */
|
---|
| 3442 | + __le32 bg_inode_table; /* Inodes table block */
|
---|
| 3443 | + __le16 bg_free_blocks_count; /* Free blocks count */
|
---|
| 3444 | + __le16 bg_free_inodes_count; /* Free inodes count */
|
---|
| 3445 | + __le16 bg_used_dirs_count; /* Directories count */
|
---|
| 3446 | + __le16 bg_pad;
|
---|
| 3447 | + __le32 bg_reserved[3];
|
---|
| 3448 | +};
|
---|
| 3449 | +
|
---|
| 3450 | +/*
|
---|
| 3451 | + * Macro-instructions used to manage group descriptors
|
---|
| 3452 | + */
|
---|
| 3453 | +# define EXT2_BLOCKS_PER_GROUP(s) ((s)->s_blocks_per_group)
|
---|
| 3454 | +# define EXT2_DESC_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_group_desc))
|
---|
| 3455 | +# define EXT2_INODES_PER_GROUP(s) ((s)->s_inodes_per_group)
|
---|
| 3456 | +
|
---|
| 3457 | +/*
|
---|
| 3458 | + * Constants relative to the data blocks
|
---|
| 3459 | + */
|
---|
| 3460 | +#define EXT2_NDIR_BLOCKS 12
|
---|
| 3461 | +#define EXT2_IND_BLOCK EXT2_NDIR_BLOCKS
|
---|
| 3462 | +#define EXT2_DIND_BLOCK (EXT2_IND_BLOCK + 1)
|
---|
| 3463 | +#define EXT2_TIND_BLOCK (EXT2_DIND_BLOCK + 1)
|
---|
| 3464 | +#define EXT2_N_BLOCKS (EXT2_TIND_BLOCK + 1)
|
---|
| 3465 | +
|
---|
| 3466 | +/*
|
---|
| 3467 | + * Inode flags (GETFLAGS/SETFLAGS)
|
---|
| 3468 | + */
|
---|
| 3469 | +#define EXT2_SECRM_FL FS_SECRM_FL /* Secure deletion */
|
---|
| 3470 | +#define EXT2_UNRM_FL FS_UNRM_FL /* Undelete */
|
---|
| 3471 | +#define EXT2_COMPR_FL FS_COMPR_FL /* Compress file */
|
---|
| 3472 | +#define EXT2_SYNC_FL FS_SYNC_FL /* Synchronous updates */
|
---|
| 3473 | +#define EXT2_IMMUTABLE_FL FS_IMMUTABLE_FL /* Immutable file */
|
---|
| 3474 | +#define EXT2_APPEND_FL FS_APPEND_FL /* writes to file may only append */
|
---|
| 3475 | +#define EXT2_NODUMP_FL FS_NODUMP_FL /* do not dump file */
|
---|
| 3476 | +#define EXT2_NOATIME_FL FS_NOATIME_FL /* do not update atime */
|
---|
| 3477 | +/* Reserved for compression usage... */
|
---|
| 3478 | +#define EXT2_DIRTY_FL FS_DIRTY_FL
|
---|
| 3479 | +#define EXT2_COMPRBLK_FL FS_COMPRBLK_FL /* One or more compressed clusters */
|
---|
| 3480 | +#define EXT2_NOCOMP_FL FS_NOCOMP_FL /* Don't compress */
|
---|
| 3481 | +#define EXT2_ECOMPR_FL FS_ECOMPR_FL /* Compression error */
|
---|
| 3482 | +/* End compression flags --- maybe not all used */
|
---|
| 3483 | +#define EXT2_BTREE_FL FS_BTREE_FL /* btree format dir */
|
---|
| 3484 | +#define EXT2_INDEX_FL FS_INDEX_FL /* hash-indexed directory */
|
---|
| 3485 | +#define EXT2_IMAGIC_FL FS_IMAGIC_FL /* AFS directory */
|
---|
| 3486 | +#define EXT2_JOURNAL_DATA_FL FS_JOURNAL_DATA_FL /* Reserved for ext3 */
|
---|
| 3487 | +#define EXT2_NOTAIL_FL FS_NOTAIL_FL /* file tail should not be merged */
|
---|
| 3488 | +#define EXT2_DIRSYNC_FL FS_DIRSYNC_FL /* dirsync behaviour (directories only) */
|
---|
| 3489 | +#define EXT2_TOPDIR_FL FS_TOPDIR_FL /* Top of directory hierarchies*/
|
---|
| 3490 | +#define EXT2_RESERVED_FL FS_RESERVED_FL /* reserved for ext2 lib */
|
---|
| 3491 | +
|
---|
| 3492 | +#define EXT2_FL_USER_VISIBLE FS_FL_USER_VISIBLE /* User visible flags */
|
---|
| 3493 | +#define EXT2_FL_USER_MODIFIABLE FS_FL_USER_MODIFIABLE /* User modifiable flags */
|
---|
| 3494 | +
|
---|
| 3495 | +/*
|
---|
| 3496 | + * ioctl commands
|
---|
| 3497 | + */
|
---|
| 3498 | +#define EXT2_IOC_GETFLAGS FS_IOC_GETFLAGS
|
---|
| 3499 | +#define EXT2_IOC_SETFLAGS FS_IOC_SETFLAGS
|
---|
| 3500 | +#define EXT2_IOC_GETVERSION FS_IOC_GETVERSION
|
---|
| 3501 | +#define EXT2_IOC_SETVERSION FS_IOC_SETVERSION
|
---|
| 3502 | +
|
---|
| 3503 | +/*
|
---|
| 3504 | + * ioctl commands in 32 bit emulation
|
---|
| 3505 | + */
|
---|
| 3506 | +#define EXT2_IOC32_GETFLAGS FS_IOC32_GETFLAGS
|
---|
| 3507 | +#define EXT2_IOC32_SETFLAGS FS_IOC32_SETFLAGS
|
---|
| 3508 | +#define EXT2_IOC32_GETVERSION FS_IOC32_GETVERSION
|
---|
| 3509 | +#define EXT2_IOC32_SETVERSION FS_IOC32_SETVERSION
|
---|
| 3510 | +
|
---|
| 3511 | +/*
|
---|
| 3512 | + * Structure of an inode on the disk
|
---|
| 3513 | + */
|
---|
| 3514 | +struct ext2_inode {
|
---|
| 3515 | + __le16 i_mode; /* File mode */
|
---|
| 3516 | + __le16 i_uid; /* Low 16 bits of Owner Uid */
|
---|
| 3517 | + __le32 i_size; /* Size in bytes */
|
---|
| 3518 | + __le32 i_atime; /* Access time */
|
---|
| 3519 | + __le32 i_ctime; /* Creation time */
|
---|
| 3520 | + __le32 i_mtime; /* Modification time */
|
---|
| 3521 | + __le32 i_dtime; /* Deletion Time */
|
---|
| 3522 | + __le16 i_gid; /* Low 16 bits of Group Id */
|
---|
| 3523 | + __le16 i_links_count; /* Links count */
|
---|
| 3524 | + __le32 i_blocks; /* Blocks count */
|
---|
| 3525 | + __le32 i_flags; /* File flags */
|
---|
| 3526 | + union {
|
---|
| 3527 | + struct {
|
---|
| 3528 | + __le32 l_i_reserved1;
|
---|
| 3529 | + } linux1;
|
---|
| 3530 | + struct {
|
---|
| 3531 | + __le32 h_i_translator;
|
---|
| 3532 | + } hurd1;
|
---|
| 3533 | + struct {
|
---|
| 3534 | + __le32 m_i_reserved1;
|
---|
| 3535 | + } masix1;
|
---|
| 3536 | + } osd1; /* OS dependent 1 */
|
---|
| 3537 | + __le32 i_block[EXT2_N_BLOCKS];/* Pointers to blocks */
|
---|
| 3538 | + __le32 i_generation; /* File version (for NFS) */
|
---|
| 3539 | + __le32 i_file_acl; /* File ACL */
|
---|
| 3540 | + __le32 i_dir_acl; /* Directory ACL */
|
---|
| 3541 | + __le32 i_faddr; /* Fragment address */
|
---|
| 3542 | + union {
|
---|
| 3543 | + struct {
|
---|
| 3544 | + __u8 l_i_frag; /* Fragment number */
|
---|
| 3545 | + __u8 l_i_fsize; /* Fragment size */
|
---|
| 3546 | + __u16 i_pad1;
|
---|
| 3547 | + __le16 l_i_uid_high; /* these 2 fields */
|
---|
| 3548 | + __le16 l_i_gid_high; /* were reserved2[0] */
|
---|
| 3549 | + __u32 l_i_reserved2;
|
---|
| 3550 | + } linux2;
|
---|
| 3551 | + struct {
|
---|
| 3552 | + __u8 h_i_frag; /* Fragment number */
|
---|
| 3553 | + __u8 h_i_fsize; /* Fragment size */
|
---|
| 3554 | + __le16 h_i_mode_high;
|
---|
| 3555 | + __le16 h_i_uid_high;
|
---|
| 3556 | + __le16 h_i_gid_high;
|
---|
| 3557 | + __le32 h_i_author;
|
---|
| 3558 | + } hurd2;
|
---|
| 3559 | + struct {
|
---|
| 3560 | + __u8 m_i_frag; /* Fragment number */
|
---|
| 3561 | + __u8 m_i_fsize; /* Fragment size */
|
---|
| 3562 | + __u16 m_pad1;
|
---|
| 3563 | + __u32 m_i_reserved2[2];
|
---|
| 3564 | + } masix2;
|
---|
| 3565 | + } osd2; /* OS dependent 2 */
|
---|
| 3566 | +};
|
---|
| 3567 | +
|
---|
| 3568 | +#define i_size_high i_dir_acl
|
---|
| 3569 | +
|
---|
| 3570 | +#if defined(__KERNEL__) || defined(__linux__)
|
---|
| 3571 | +#define i_reserved1 osd1.linux1.l_i_reserved1
|
---|
| 3572 | +#define i_frag osd2.linux2.l_i_frag
|
---|
| 3573 | +#define i_fsize osd2.linux2.l_i_fsize
|
---|
| 3574 | +#define i_uid_low i_uid
|
---|
| 3575 | +#define i_gid_low i_gid
|
---|
| 3576 | +#define i_uid_high osd2.linux2.l_i_uid_high
|
---|
| 3577 | +#define i_gid_high osd2.linux2.l_i_gid_high
|
---|
| 3578 | +#define i_reserved2 osd2.linux2.l_i_reserved2
|
---|
| 3579 | +#endif
|
---|
| 3580 | +
|
---|
| 3581 | +#ifdef __hurd__
|
---|
| 3582 | +#define i_translator osd1.hurd1.h_i_translator
|
---|
| 3583 | +#define i_frag osd2.hurd2.h_i_frag;
|
---|
| 3584 | +#define i_fsize osd2.hurd2.h_i_fsize;
|
---|
| 3585 | +#define i_uid_high osd2.hurd2.h_i_uid_high
|
---|
| 3586 | +#define i_gid_high osd2.hurd2.h_i_gid_high
|
---|
| 3587 | +#define i_author osd2.hurd2.h_i_author
|
---|
| 3588 | +#endif
|
---|
| 3589 | +
|
---|
| 3590 | +#ifdef __masix__
|
---|
| 3591 | +#define i_reserved1 osd1.masix1.m_i_reserved1
|
---|
| 3592 | +#define i_frag osd2.masix2.m_i_frag
|
---|
| 3593 | +#define i_fsize osd2.masix2.m_i_fsize
|
---|
| 3594 | +#define i_reserved2 osd2.masix2.m_i_reserved2
|
---|
| 3595 | +#endif
|
---|
| 3596 | +
|
---|
| 3597 | +/*
|
---|
| 3598 | + * File system states
|
---|
| 3599 | + */
|
---|
| 3600 | +#define EXT2_VALID_FS 0x0001 /* Unmounted cleanly */
|
---|
| 3601 | +#define EXT2_ERROR_FS 0x0002 /* Errors detected */
|
---|
| 3602 | +
|
---|
| 3603 | +/*
|
---|
| 3604 | + * Mount flags
|
---|
| 3605 | + */
|
---|
| 3606 | +#define EXT2_MOUNT_CHECK 0x000001 /* Do mount-time checks */
|
---|
| 3607 | +#define EXT2_MOUNT_OLDALLOC 0x000002 /* Don't use the new Orlov allocator */
|
---|
| 3608 | +#define EXT2_MOUNT_GRPID 0x000004 /* Create files with directory's group */
|
---|
| 3609 | +#define EXT2_MOUNT_DEBUG 0x000008 /* Some debugging messages */
|
---|
| 3610 | +#define EXT2_MOUNT_ERRORS_CONT 0x000010 /* Continue on errors */
|
---|
| 3611 | +#define EXT2_MOUNT_ERRORS_RO 0x000020 /* Remount fs ro on errors */
|
---|
| 3612 | +#define EXT2_MOUNT_ERRORS_PANIC 0x000040 /* Panic on errors */
|
---|
| 3613 | +#define EXT2_MOUNT_MINIX_DF 0x000080 /* Mimics the Minix statfs */
|
---|
| 3614 | +#define EXT2_MOUNT_NOBH 0x000100 /* No buffer_heads */
|
---|
| 3615 | +#define EXT2_MOUNT_NO_UID32 0x000200 /* Disable 32-bit UIDs */
|
---|
| 3616 | +#define EXT2_MOUNT_XATTR_USER 0x004000 /* Extended user attributes */
|
---|
| 3617 | +#define EXT2_MOUNT_POSIX_ACL 0x008000 /* POSIX Access Control Lists */
|
---|
| 3618 | +#define EXT2_MOUNT_XIP 0x010000 /* Execute in place */
|
---|
| 3619 | +#define EXT2_MOUNT_USRQUOTA 0x020000 /* user quota */
|
---|
| 3620 | +#define EXT2_MOUNT_GRPQUOTA 0x040000 /* group quota */
|
---|
| 3621 | +
|
---|
| 3622 | +
|
---|
| 3623 | +#define clear_opt(o, opt) o &= ~EXT2_MOUNT_##opt
|
---|
| 3624 | +#define set_opt(o, opt) o |= EXT2_MOUNT_##opt
|
---|
| 3625 | +#define test_opt(sb, opt) (EXT2_SB(sb)->s_mount_opt & \
|
---|
| 3626 | + EXT2_MOUNT_##opt)
|
---|
| 3627 | +/*
|
---|
| 3628 | + * Maximal mount counts between two filesystem checks
|
---|
| 3629 | + */
|
---|
| 3630 | +#define EXT2_DFL_MAX_MNT_COUNT 20 /* Allow 20 mounts */
|
---|
| 3631 | +#define EXT2_DFL_CHECKINTERVAL 0 /* Don't use interval check */
|
---|
| 3632 | +
|
---|
| 3633 | +/*
|
---|
| 3634 | + * Behaviour when detecting errors
|
---|
| 3635 | + */
|
---|
| 3636 | +#define EXT2_ERRORS_CONTINUE 1 /* Continue execution */
|
---|
| 3637 | +#define EXT2_ERRORS_RO 2 /* Remount fs read-only */
|
---|
| 3638 | +#define EXT2_ERRORS_PANIC 3 /* Panic */
|
---|
| 3639 | +#define EXT2_ERRORS_DEFAULT EXT2_ERRORS_CONTINUE
|
---|
| 3640 | +
|
---|
| 3641 | +/*
|
---|
| 3642 | + * Structure of the super block
|
---|
| 3643 | + */
|
---|
| 3644 | +struct ext2_super_block {
|
---|
| 3645 | + __le32 s_inodes_count; /* Inodes count */
|
---|
| 3646 | + __le32 s_blocks_count; /* Blocks count */
|
---|
| 3647 | + __le32 s_r_blocks_count; /* Reserved blocks count */
|
---|
| 3648 | + __le32 s_free_blocks_count; /* Free blocks count */
|
---|
| 3649 | + __le32 s_free_inodes_count; /* Free inodes count */
|
---|
| 3650 | + __le32 s_first_data_block; /* First Data Block */
|
---|
| 3651 | + __le32 s_log_block_size; /* Block size */
|
---|
| 3652 | + __le32 s_log_frag_size; /* Fragment size */
|
---|
| 3653 | + __le32 s_blocks_per_group; /* # Blocks per group */
|
---|
| 3654 | + __le32 s_frags_per_group; /* # Fragments per group */
|
---|
| 3655 | + __le32 s_inodes_per_group; /* # Inodes per group */
|
---|
| 3656 | + __le32 s_mtime; /* Mount time */
|
---|
| 3657 | + __le32 s_wtime; /* Write time */
|
---|
| 3658 | + __le16 s_mnt_count; /* Mount count */
|
---|
| 3659 | + __le16 s_max_mnt_count; /* Maximal mount count */
|
---|
| 3660 | + __le16 s_magic; /* Magic signature */
|
---|
| 3661 | + __le16 s_state; /* File system state */
|
---|
| 3662 | + __le16 s_errors; /* Behaviour when detecting errors */
|
---|
| 3663 | + __le16 s_minor_rev_level; /* minor revision level */
|
---|
| 3664 | + __le32 s_lastcheck; /* time of last check */
|
---|
| 3665 | + __le32 s_checkinterval; /* max. time between checks */
|
---|
| 3666 | + __le32 s_creator_os; /* OS */
|
---|
| 3667 | + __le32 s_rev_level; /* Revision level */
|
---|
| 3668 | + __le16 s_def_resuid; /* Default uid for reserved blocks */
|
---|
| 3669 | + __le16 s_def_resgid; /* Default gid for reserved blocks */
|
---|
| 3670 | + /*
|
---|
| 3671 | + * These fields are for EXT2_DYNAMIC_REV superblocks only.
|
---|
| 3672 | + *
|
---|
| 3673 | + * Note: the difference between the compatible feature set and
|
---|
| 3674 | + * the incompatible feature set is that if there is a bit set
|
---|
| 3675 | + * in the incompatible feature set that the kernel doesn't
|
---|
| 3676 | + * know about, it should refuse to mount the filesystem.
|
---|
| 3677 | + *
|
---|
| 3678 | + * e2fsck's requirements are more strict; if it doesn't know
|
---|
| 3679 | + * about a feature in either the compatible or incompatible
|
---|
| 3680 | + * feature set, it must abort and not try to meddle with
|
---|
| 3681 | + * things it doesn't understand...
|
---|
| 3682 | + */
|
---|
| 3683 | + __le32 s_first_ino; /* First non-reserved inode */
|
---|
| 3684 | + __le16 s_inode_size; /* size of inode structure */
|
---|
| 3685 | + __le16 s_block_group_nr; /* block group # of this superblock */
|
---|
| 3686 | + __le32 s_feature_compat; /* compatible feature set */
|
---|
| 3687 | + __le32 s_feature_incompat; /* incompatible feature set */
|
---|
| 3688 | + __le32 s_feature_ro_compat; /* readonly-compatible feature set */
|
---|
| 3689 | + __u8 s_uuid[16]; /* 128-bit uuid for volume */
|
---|
| 3690 | + char s_volume_name[16]; /* volume name */
|
---|
| 3691 | + char s_last_mounted[64]; /* directory where last mounted */
|
---|
| 3692 | + __le32 s_algorithm_usage_bitmap; /* For compression */
|
---|
| 3693 | + /*
|
---|
| 3694 | + * Performance hints. Directory preallocation should only
|
---|
| 3695 | + * happen if the EXT2_COMPAT_PREALLOC flag is on.
|
---|
| 3696 | + */
|
---|
| 3697 | + __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
|
---|
| 3698 | + __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */
|
---|
| 3699 | + __u16 s_padding1;
|
---|
| 3700 | + /*
|
---|
| 3701 | + * Journaling support valid if EXT3_FEATURE_COMPAT_HAS_JOURNAL set.
|
---|
| 3702 | + */
|
---|
| 3703 | + __u8 s_journal_uuid[16]; /* uuid of journal superblock */
|
---|
| 3704 | + __u32 s_journal_inum; /* inode number of journal file */
|
---|
| 3705 | + __u32 s_journal_dev; /* device number of journal file */
|
---|
| 3706 | + __u32 s_last_orphan; /* start of list of inodes to delete */
|
---|
| 3707 | + __u32 s_hash_seed[4]; /* HTREE hash seed */
|
---|
| 3708 | + __u8 s_def_hash_version; /* Default hash version to use */
|
---|
| 3709 | + __u8 s_reserved_char_pad;
|
---|
| 3710 | + __u16 s_reserved_word_pad;
|
---|
| 3711 | + __le32 s_default_mount_opts;
|
---|
| 3712 | + __le32 s_first_meta_bg; /* First metablock block group */
|
---|
| 3713 | + __u32 s_reserved[190]; /* Padding to the end of the block */
|
---|
| 3714 | +};
|
---|
| 3715 | +
|
---|
| 3716 | +/*
|
---|
| 3717 | + * Codes for operating systems
|
---|
| 3718 | + */
|
---|
| 3719 | +#define EXT2_OS_LINUX 0
|
---|
| 3720 | +#define EXT2_OS_HURD 1
|
---|
| 3721 | +#define EXT2_OS_MASIX 2
|
---|
| 3722 | +#define EXT2_OS_FREEBSD 3
|
---|
| 3723 | +#define EXT2_OS_LITES 4
|
---|
| 3724 | +
|
---|
| 3725 | +/*
|
---|
| 3726 | + * Revision levels
|
---|
| 3727 | + */
|
---|
| 3728 | +#define EXT2_GOOD_OLD_REV 0 /* The good old (original) format */
|
---|
| 3729 | +#define EXT2_DYNAMIC_REV 1 /* V2 format w/ dynamic inode sizes */
|
---|
| 3730 | +
|
---|
| 3731 | +#define EXT2_CURRENT_REV EXT2_GOOD_OLD_REV
|
---|
| 3732 | +#define EXT2_MAX_SUPP_REV EXT2_DYNAMIC_REV
|
---|
| 3733 | +
|
---|
| 3734 | +#define EXT2_GOOD_OLD_INODE_SIZE 128
|
---|
| 3735 | +
|
---|
| 3736 | +/*
|
---|
| 3737 | + * Feature set definitions
|
---|
| 3738 | + */
|
---|
| 3739 | +
|
---|
| 3740 | +#define EXT2_HAS_COMPAT_FEATURE(sb,mask) \
|
---|
| 3741 | + ( EXT2_SB(sb)->s_es->s_feature_compat & cpu_to_le32(mask) )
|
---|
| 3742 | +#define EXT2_HAS_RO_COMPAT_FEATURE(sb,mask) \
|
---|
| 3743 | + ( EXT2_SB(sb)->s_es->s_feature_ro_compat & cpu_to_le32(mask) )
|
---|
| 3744 | +#define EXT2_HAS_INCOMPAT_FEATURE(sb,mask) \
|
---|
| 3745 | + ( EXT2_SB(sb)->s_es->s_feature_incompat & cpu_to_le32(mask) )
|
---|
| 3746 | +#define EXT2_SET_COMPAT_FEATURE(sb,mask) \
|
---|
| 3747 | + EXT2_SB(sb)->s_es->s_feature_compat |= cpu_to_le32(mask)
|
---|
| 3748 | +#define EXT2_SET_RO_COMPAT_FEATURE(sb,mask) \
|
---|
| 3749 | + EXT2_SB(sb)->s_es->s_feature_ro_compat |= cpu_to_le32(mask)
|
---|
| 3750 | +#define EXT2_SET_INCOMPAT_FEATURE(sb,mask) \
|
---|
| 3751 | + EXT2_SB(sb)->s_es->s_feature_incompat |= cpu_to_le32(mask)
|
---|
| 3752 | +#define EXT2_CLEAR_COMPAT_FEATURE(sb,mask) \
|
---|
| 3753 | + EXT2_SB(sb)->s_es->s_feature_compat &= ~cpu_to_le32(mask)
|
---|
| 3754 | +#define EXT2_CLEAR_RO_COMPAT_FEATURE(sb,mask) \
|
---|
| 3755 | + EXT2_SB(sb)->s_es->s_feature_ro_compat &= ~cpu_to_le32(mask)
|
---|
| 3756 | +#define EXT2_CLEAR_INCOMPAT_FEATURE(sb,mask) \
|
---|
| 3757 | + EXT2_SB(sb)->s_es->s_feature_incompat &= ~cpu_to_le32(mask)
|
---|
| 3758 | +
|
---|
| 3759 | +#define EXT2_FEATURE_COMPAT_DIR_PREALLOC 0x0001
|
---|
| 3760 | +#define EXT2_FEATURE_COMPAT_IMAGIC_INODES 0x0002
|
---|
| 3761 | +#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004
|
---|
| 3762 | +#define EXT2_FEATURE_COMPAT_EXT_ATTR 0x0008
|
---|
| 3763 | +#define EXT2_FEATURE_COMPAT_RESIZE_INO 0x0010
|
---|
| 3764 | +#define EXT2_FEATURE_COMPAT_DIR_INDEX 0x0020
|
---|
| 3765 | +#define EXT2_FEATURE_COMPAT_ANY 0xffffffff
|
---|
| 3766 | +
|
---|
| 3767 | +#define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001
|
---|
| 3768 | +#define EXT2_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
|
---|
| 3769 | +#define EXT2_FEATURE_RO_COMPAT_BTREE_DIR 0x0004
|
---|
| 3770 | +#define EXT2_FEATURE_RO_COMPAT_ANY 0xffffffff
|
---|
| 3771 | +
|
---|
| 3772 | +#define EXT2_FEATURE_INCOMPAT_COMPRESSION 0x0001
|
---|
| 3773 | +#define EXT2_FEATURE_INCOMPAT_FILETYPE 0x0002
|
---|
| 3774 | +#define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004
|
---|
| 3775 | +#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008
|
---|
| 3776 | +#define EXT2_FEATURE_INCOMPAT_META_BG 0x0010
|
---|
| 3777 | +#define EXT2_FEATURE_INCOMPAT_ANY 0xffffffff
|
---|
| 3778 | +
|
---|
| 3779 | +#define EXT2_FEATURE_COMPAT_SUPP EXT2_FEATURE_COMPAT_EXT_ATTR
|
---|
| 3780 | +#define EXT2_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE| \
|
---|
| 3781 | + EXT2_FEATURE_INCOMPAT_META_BG)
|
---|
| 3782 | +#define EXT2_FEATURE_RO_COMPAT_SUPP (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER| \
|
---|
| 3783 | + EXT2_FEATURE_RO_COMPAT_LARGE_FILE| \
|
---|
| 3784 | + EXT2_FEATURE_RO_COMPAT_BTREE_DIR)
|
---|
| 3785 | +#define EXT2_FEATURE_RO_COMPAT_UNSUPPORTED ~EXT2_FEATURE_RO_COMPAT_SUPP
|
---|
| 3786 | +#define EXT2_FEATURE_INCOMPAT_UNSUPPORTED ~EXT2_FEATURE_INCOMPAT_SUPP
|
---|
| 3787 | +
|
---|
| 3788 | +/*
|
---|
| 3789 | + * Default values for user and/or group using reserved blocks
|
---|
| 3790 | + */
|
---|
| 3791 | +#define EXT2_DEF_RESUID 0
|
---|
| 3792 | +#define EXT2_DEF_RESGID 0
|
---|
| 3793 | +
|
---|
| 3794 | +/*
|
---|
| 3795 | + * Default mount options
|
---|
| 3796 | + */
|
---|
| 3797 | +#define EXT2_DEFM_DEBUG 0x0001
|
---|
| 3798 | +#define EXT2_DEFM_BSDGROUPS 0x0002
|
---|
| 3799 | +#define EXT2_DEFM_XATTR_USER 0x0004
|
---|
| 3800 | +#define EXT2_DEFM_ACL 0x0008
|
---|
| 3801 | +#define EXT2_DEFM_UID16 0x0010
|
---|
| 3802 | + /* Not used by ext2, but reserved for use by ext3 */
|
---|
| 3803 | +#define EXT3_DEFM_JMODE 0x0060
|
---|
| 3804 | +#define EXT3_DEFM_JMODE_DATA 0x0020
|
---|
| 3805 | +#define EXT3_DEFM_JMODE_ORDERED 0x0040
|
---|
| 3806 | +#define EXT3_DEFM_JMODE_WBACK 0x0060
|
---|
| 3807 | +
|
---|
| 3808 | +/*
|
---|
| 3809 | + * Structure of a directory entry
|
---|
| 3810 | + */
|
---|
| 3811 | +#define EXT2_NAME_LEN 255
|
---|
| 3812 | +
|
---|
| 3813 | +struct ext2_dir_entry {
|
---|
| 3814 | + __le32 inode; /* Inode number */
|
---|
| 3815 | + __le16 rec_len; /* Directory entry length */
|
---|
| 3816 | + __le16 name_len; /* Name length */
|
---|
| 3817 | + char name[EXT2_NAME_LEN]; /* File name */
|
---|
| 3818 | +};
|
---|
| 3819 | +
|
---|
| 3820 | +/*
|
---|
| 3821 | + * The new version of the directory entry. Since EXT2 structures are
|
---|
| 3822 | + * stored in intel byte order, and the name_len field could never be
|
---|
| 3823 | + * bigger than 255 chars, it's safe to reclaim the extra byte for the
|
---|
| 3824 | + * file_type field.
|
---|
| 3825 | + */
|
---|
| 3826 | +struct ext2_dir_entry_2 {
|
---|
| 3827 | + __le32 inode; /* Inode number */
|
---|
| 3828 | + __le16 rec_len; /* Directory entry length */
|
---|
| 3829 | + __u8 name_len; /* Name length */
|
---|
| 3830 | + __u8 file_type;
|
---|
| 3831 | + char name[EXT2_NAME_LEN]; /* File name */
|
---|
| 3832 | +};
|
---|
| 3833 | +
|
---|
| 3834 | +/*
|
---|
| 3835 | + * Ext2 directory file types. Only the low 3 bits are used. The
|
---|
| 3836 | + * other bits are reserved for now.
|
---|
| 3837 | + */
|
---|
| 3838 | +enum {
|
---|
| 3839 | + EXT2_FT_UNKNOWN,
|
---|
| 3840 | + EXT2_FT_REG_FILE,
|
---|
| 3841 | + EXT2_FT_DIR,
|
---|
| 3842 | + EXT2_FT_CHRDEV,
|
---|
| 3843 | + EXT2_FT_BLKDEV,
|
---|
| 3844 | + EXT2_FT_FIFO,
|
---|
| 3845 | + EXT2_FT_SOCK,
|
---|
| 3846 | + EXT2_FT_SYMLINK,
|
---|
| 3847 | + EXT2_FT_MAX
|
---|
| 3848 | +};
|
---|
| 3849 | +
|
---|
| 3850 | +/*
|
---|
| 3851 | + * EXT2_DIR_PAD defines the directory entries boundaries
|
---|
| 3852 | + *
|
---|
| 3853 | + * NOTE: It must be a multiple of 4
|
---|
| 3854 | + */
|
---|
| 3855 | +#define EXT2_DIR_PAD 4
|
---|
| 3856 | +#define EXT2_DIR_ROUND (EXT2_DIR_PAD - 1)
|
---|
| 3857 | +#define EXT2_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT2_DIR_ROUND) & \
|
---|
| 3858 | + ~EXT2_DIR_ROUND)
|
---|
| 3859 | +
|
---|
| 3860 | +#endif /* _LINUX_EXT2_FS_H */
|
---|
| 3861 | diff -Naur aboot-0.9b.orig/include/linux/fs.h aboot-0.9b/include/linux/fs.h
|
---|
| 3862 | --- aboot-0.9b.orig/include/linux/fs.h 1969-12-31 19:00:00.000000000 -0500
|
---|
| 3863 | +++ aboot-0.9b/include/linux/fs.h 2008-01-02 13:53:15.000000000 -0500
|
---|
| 3864 | @@ -0,0 +1,269 @@
|
---|
| 3865 | +#ifndef _LINUX_FS_H
|
---|
| 3866 | +#define _LINUX_FS_H
|
---|
| 3867 | +
|
---|
| 3868 | +/*
|
---|
| 3869 | + * This file has definitions for some important file table
|
---|
| 3870 | + * structures etc.
|
---|
| 3871 | + */
|
---|
| 3872 | +
|
---|
| 3873 | +#include <linux/limits.h>
|
---|
| 3874 | +#include <linux/ioctl.h>
|
---|
| 3875 | +
|
---|
| 3876 | +/*
|
---|
| 3877 | + * It's silly to have NR_OPEN bigger than NR_FILE, but you can change
|
---|
| 3878 | + * the file limit at runtime and only root can increase the per-process
|
---|
| 3879 | + * nr_file rlimit, so it's safe to set up a ridiculously high absolute
|
---|
| 3880 | + * upper limit on files-per-process.
|
---|
| 3881 | + *
|
---|
| 3882 | + * Some programs (notably those using select()) may have to be
|
---|
| 3883 | + * recompiled to take full advantage of the new limits..
|
---|
| 3884 | + */
|
---|
| 3885 | +
|
---|
| 3886 | +/* Fixed constants first: */
|
---|
| 3887 | +#undef NR_OPEN
|
---|
| 3888 | +#define NR_OPEN (1024*1024) /* Absolute upper limit on fd num */
|
---|
| 3889 | +#define INR_OPEN 1024 /* Initial setting for nfile rlimits */
|
---|
| 3890 | +
|
---|
| 3891 | +#define BLOCK_SIZE_BITS 10
|
---|
| 3892 | +#define BLOCK_SIZE (1<<BLOCK_SIZE_BITS)
|
---|
| 3893 | +
|
---|
| 3894 | +#define SEEK_SET 0 /* seek relative to beginning of file */
|
---|
| 3895 | +#define SEEK_CUR 1 /* seek relative to current file position */
|
---|
| 3896 | +#define SEEK_END 2 /* seek relative to end of file */
|
---|
| 3897 | +#define SEEK_MAX SEEK_END
|
---|
| 3898 | +
|
---|
| 3899 | +/* And dynamically-tunable limits and defaults: */
|
---|
| 3900 | +struct files_stat_struct {
|
---|
| 3901 | + int nr_files; /* read only */
|
---|
| 3902 | + int nr_free_files; /* read only */
|
---|
| 3903 | + int max_files; /* tunable */
|
---|
| 3904 | +};
|
---|
| 3905 | +extern struct files_stat_struct files_stat;
|
---|
| 3906 | +extern int get_max_files(void);
|
---|
| 3907 | +
|
---|
| 3908 | +struct inodes_stat_t {
|
---|
| 3909 | + int nr_inodes;
|
---|
| 3910 | + int nr_unused;
|
---|
| 3911 | + int dummy[5]; /* padding for sysctl ABI compatibility */
|
---|
| 3912 | +};
|
---|
| 3913 | +extern struct inodes_stat_t inodes_stat;
|
---|
| 3914 | +
|
---|
| 3915 | +extern int leases_enable, lease_break_time;
|
---|
| 3916 | +
|
---|
| 3917 | +#ifdef CONFIG_DNOTIFY
|
---|
| 3918 | +extern int dir_notify_enable;
|
---|
| 3919 | +#endif
|
---|
| 3920 | +
|
---|
| 3921 | +#define NR_FILE 8192 /* this can well be larger on a larger system */
|
---|
| 3922 | +
|
---|
| 3923 | +#define MAY_EXEC 1
|
---|
| 3924 | +#define MAY_WRITE 2
|
---|
| 3925 | +#define MAY_READ 4
|
---|
| 3926 | +#define MAY_APPEND 8
|
---|
| 3927 | +
|
---|
| 3928 | +#define FMODE_READ 1
|
---|
| 3929 | +#define FMODE_WRITE 2
|
---|
| 3930 | +
|
---|
| 3931 | +/* Internal kernel extensions */
|
---|
| 3932 | +#define FMODE_LSEEK 4
|
---|
| 3933 | +#define FMODE_PREAD 8
|
---|
| 3934 | +#define FMODE_PWRITE FMODE_PREAD /* These go hand in hand */
|
---|
| 3935 | +
|
---|
| 3936 | +/* File is being opened for execution. Primary users of this flag are
|
---|
| 3937 | + distributed filesystems that can use it to achieve correct ETXTBUSY
|
---|
| 3938 | + behavior for cross-node execution/opening_for_writing of files */
|
---|
| 3939 | +#define FMODE_EXEC 16
|
---|
| 3940 | +
|
---|
| 3941 | +#define RW_MASK 1
|
---|
| 3942 | +#define RWA_MASK 2
|
---|
| 3943 | +#define READ 0
|
---|
| 3944 | +#define WRITE 1
|
---|
| 3945 | +#define READA 2 /* read-ahead - don't block if no resources */
|
---|
| 3946 | +#define SWRITE 3 /* for ll_rw_block() - wait for buffer lock */
|
---|
| 3947 | +#define READ_SYNC (READ | (1 << BIO_RW_SYNC))
|
---|
| 3948 | +#define READ_META (READ | (1 << BIO_RW_META))
|
---|
| 3949 | +#define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNC))
|
---|
| 3950 | +#define WRITE_BARRIER ((1 << BIO_RW) | (1 << BIO_RW_BARRIER))
|
---|
| 3951 | +
|
---|
| 3952 | +#define SEL_IN 1
|
---|
| 3953 | +#define SEL_OUT 2
|
---|
| 3954 | +#define SEL_EX 4
|
---|
| 3955 | +
|
---|
| 3956 | +/* public flags for file_system_type */
|
---|
| 3957 | +#define FS_REQUIRES_DEV 1
|
---|
| 3958 | +#define FS_BINARY_MOUNTDATA 2
|
---|
| 3959 | +#define FS_HAS_SUBTYPE 4
|
---|
| 3960 | +#define FS_REVAL_DOT 16384 /* Check the paths ".", ".." for staleness */
|
---|
| 3961 | +#define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move()
|
---|
| 3962 | + * during rename() internally.
|
---|
| 3963 | + */
|
---|
| 3964 | +
|
---|
| 3965 | +/*
|
---|
| 3966 | + * These are the fs-independent mount-flags: up to 32 flags are supported
|
---|
| 3967 | + */
|
---|
| 3968 | +#define MS_RDONLY 1 /* Mount read-only */
|
---|
| 3969 | +#define MS_NOSUID 2 /* Ignore suid and sgid bits */
|
---|
| 3970 | +#define MS_NODEV 4 /* Disallow access to device special files */
|
---|
| 3971 | +#define MS_NOEXEC 8 /* Disallow program execution */
|
---|
| 3972 | +#define MS_SYNCHRONOUS 16 /* Writes are synced at once */
|
---|
| 3973 | +#define MS_REMOUNT 32 /* Alter flags of a mounted FS */
|
---|
| 3974 | +#define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */
|
---|
| 3975 | +#define MS_DIRSYNC 128 /* Directory modifications are synchronous */
|
---|
| 3976 | +#define MS_NOATIME 1024 /* Do not update access times. */
|
---|
| 3977 | +#define MS_NODIRATIME 2048 /* Do not update directory access times */
|
---|
| 3978 | +#define MS_BIND 4096
|
---|
| 3979 | +#define MS_MOVE 8192
|
---|
| 3980 | +#define MS_REC 16384
|
---|
| 3981 | +#define MS_VERBOSE 32768 /* War is peace. Verbosity is silence.
|
---|
| 3982 | + MS_VERBOSE is deprecated. */
|
---|
| 3983 | +#define MS_SILENT 32768
|
---|
| 3984 | +#define MS_POSIXACL (1<<16) /* VFS does not apply the umask */
|
---|
| 3985 | +#define MS_UNBINDABLE (1<<17) /* change to unbindable */
|
---|
| 3986 | +#define MS_PRIVATE (1<<18) /* change to private */
|
---|
| 3987 | +#define MS_SLAVE (1<<19) /* change to slave */
|
---|
| 3988 | +#define MS_SHARED (1<<20) /* change to shared */
|
---|
| 3989 | +#define MS_RELATIME (1<<21) /* Update atime relative to mtime/ctime. */
|
---|
| 3990 | +#define MS_ACTIVE (1<<30)
|
---|
| 3991 | +#define MS_NOUSER (1<<31)
|
---|
| 3992 | +
|
---|
| 3993 | +/*
|
---|
| 3994 | + * Superblock flags that can be altered by MS_REMOUNT
|
---|
| 3995 | + */
|
---|
| 3996 | +#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK)
|
---|
| 3997 | +
|
---|
| 3998 | +/*
|
---|
| 3999 | + * Old magic mount flag and mask
|
---|
| 4000 | + */
|
---|
| 4001 | +#define MS_MGC_VAL 0xC0ED0000
|
---|
| 4002 | +#define MS_MGC_MSK 0xffff0000
|
---|
| 4003 | +
|
---|
| 4004 | +/* Inode flags - they have nothing to superblock flags now */
|
---|
| 4005 | +
|
---|
| 4006 | +#define S_SYNC 1 /* Writes are synced at once */
|
---|
| 4007 | +#define S_NOATIME 2 /* Do not update access times */
|
---|
| 4008 | +#define S_APPEND 4 /* Append-only file */
|
---|
| 4009 | +#define S_IMMUTABLE 8 /* Immutable file */
|
---|
| 4010 | +#define S_DEAD 16 /* removed, but still open directory */
|
---|
| 4011 | +#define S_NOQUOTA 32 /* Inode is not counted to quota */
|
---|
| 4012 | +#define S_DIRSYNC 64 /* Directory modifications are synchronous */
|
---|
| 4013 | +#define S_NOCMTIME 128 /* Do not update file c/mtime */
|
---|
| 4014 | +#define S_SWAPFILE 256 /* Do not truncate: swapon got its bmaps */
|
---|
| 4015 | +#define S_PRIVATE 512 /* Inode is fs-internal */
|
---|
| 4016 | +
|
---|
| 4017 | +/*
|
---|
| 4018 | + * Note that nosuid etc flags are inode-specific: setting some file-system
|
---|
| 4019 | + * flags just means all the inodes inherit those flags by default. It might be
|
---|
| 4020 | + * possible to override it selectively if you really wanted to with some
|
---|
| 4021 | + * ioctl() that is not currently implemented.
|
---|
| 4022 | + *
|
---|
| 4023 | + * Exception: MS_RDONLY is always applied to the entire file system.
|
---|
| 4024 | + *
|
---|
| 4025 | + * Unfortunately, it is possible to change a filesystems flags with it mounted
|
---|
| 4026 | + * with files in use. This means that all of the inodes will not have their
|
---|
| 4027 | + * i_flags updated. Hence, i_flags no longer inherit the superblock mount
|
---|
| 4028 | + * flags, so these have to be checked separately. -- rmk@arm.uk.linux.org
|
---|
| 4029 | + */
|
---|
| 4030 | +#define __IS_FLG(inode,flg) ((inode)->i_sb->s_flags & (flg))
|
---|
| 4031 | +
|
---|
| 4032 | +#define IS_RDONLY(inode) ((inode)->i_sb->s_flags & MS_RDONLY)
|
---|
| 4033 | +#define IS_SYNC(inode) (__IS_FLG(inode, MS_SYNCHRONOUS) || \
|
---|
| 4034 | + ((inode)->i_flags & S_SYNC))
|
---|
| 4035 | +#define IS_DIRSYNC(inode) (__IS_FLG(inode, MS_SYNCHRONOUS|MS_DIRSYNC) || \
|
---|
| 4036 | + ((inode)->i_flags & (S_SYNC|S_DIRSYNC)))
|
---|
| 4037 | +#define IS_MANDLOCK(inode) __IS_FLG(inode, MS_MANDLOCK)
|
---|
| 4038 | +#define IS_NOATIME(inode) __IS_FLG(inode, MS_RDONLY|MS_NOATIME)
|
---|
| 4039 | +
|
---|
| 4040 | +#define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA)
|
---|
| 4041 | +#define IS_APPEND(inode) ((inode)->i_flags & S_APPEND)
|
---|
| 4042 | +#define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE)
|
---|
| 4043 | +#define IS_POSIXACL(inode) __IS_FLG(inode, MS_POSIXACL)
|
---|
| 4044 | +
|
---|
| 4045 | +#define IS_DEADDIR(inode) ((inode)->i_flags & S_DEAD)
|
---|
| 4046 | +#define IS_NOCMTIME(inode) ((inode)->i_flags & S_NOCMTIME)
|
---|
| 4047 | +#define IS_SWAPFILE(inode) ((inode)->i_flags & S_SWAPFILE)
|
---|
| 4048 | +#define IS_PRIVATE(inode) ((inode)->i_flags & S_PRIVATE)
|
---|
| 4049 | +
|
---|
|
---|