[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 | +#if !defined (N_NLIST_DECLARED) |
---|
| 2351 | +struct nlist { |
---|
| 2352 | + union { |
---|
| 2353 | + char *n_name; |
---|
| 2354 | + struct nlist *n_next; |
---|
| 2355 | + long n_strx; |
---|
| 2356 | + } n_un; |
---|
| 2357 | + unsigned char n_type; |
---|
| 2358 | + char n_other; |
---|
| 2359 | + short n_desc; |
---|
| 2360 | + unsigned long n_value; |
---|
| 2361 | +}; |
---|
| 2362 | +#endif /* no N_NLIST_DECLARED. */ |
---|
| 2363 | + |
---|
| 2364 | +#if !defined (N_UNDF) |
---|
| 2365 | +#define N_UNDF 0 |
---|
| 2366 | +#endif |
---|
| 2367 | +#if !defined (N_ABS) |
---|
| 2368 | +#define N_ABS 2 |
---|
| 2369 | +#endif |
---|
| 2370 | +#if !defined (N_TEXT) |
---|
| 2371 | +#define N_TEXT 4 |
---|
| 2372 | +#endif |
---|
| 2373 | +#if !defined (N_DATA) |
---|
| 2374 | +#define N_DATA 6 |
---|
| 2375 | +#endif |
---|
| 2376 | +#if !defined (N_BSS) |
---|
| 2377 | +#define N_BSS 8 |
---|
| 2378 | +#endif |
---|
| 2379 | +#if !defined (N_FN) |
---|
| 2380 | +#define N_FN 15 |
---|
| 2381 | +#endif |
---|
| 2382 | + |
---|
| 2383 | +#if !defined (N_EXT) |
---|
| 2384 | +#define N_EXT 1 |
---|
| 2385 | +#endif |
---|
| 2386 | +#if !defined (N_TYPE) |
---|
| 2387 | +#define N_TYPE 036 |
---|
| 2388 | +#endif |
---|
| 2389 | +#if !defined (N_STAB) |
---|
| 2390 | +#define N_STAB 0340 |
---|
| 2391 | +#endif |
---|
| 2392 | + |
---|
| 2393 | +/* The following type indicates the definition of a symbol as being |
---|
| 2394 | + an indirect reference to another symbol. The other symbol |
---|
| 2395 | + appears as an undefined reference, immediately following this symbol. |
---|
| 2396 | + |
---|
| 2397 | + Indirection is asymmetrical. The other symbol's value will be used |
---|
| 2398 | + to satisfy requests for the indirect symbol, but not vice versa. |
---|
| 2399 | + If the other symbol does not have a definition, libraries will |
---|
| 2400 | + be searched to find a definition. */ |
---|
| 2401 | +#define N_INDR 0xa |
---|
| 2402 | + |
---|
| 2403 | +/* The following symbols refer to set elements. |
---|
| 2404 | + All the N_SET[ATDB] symbols with the same name form one set. |
---|
| 2405 | + Space is allocated for the set in the text section, and each set |
---|
| 2406 | + element's value is stored into one word of the space. |
---|
| 2407 | + The first word of the space is the length of the set (number of elements). |
---|
| 2408 | + |
---|
| 2409 | + The address of the set is made into an N_SETV symbol |
---|
| 2410 | + whose name is the same as the name of the set. |
---|
| 2411 | + This symbol acts like a N_DATA global symbol |
---|
| 2412 | + in that it can satisfy undefined external references. */ |
---|
| 2413 | + |
---|
| 2414 | +/* These appear as input to LD, in a .o file. */ |
---|
| 2415 | +#define N_SETA 0x14 /* Absolute set element symbol */ |
---|
| 2416 | +#define N_SETT 0x16 /* Text set element symbol */ |
---|
| 2417 | +#define N_SETD 0x18 /* Data set element symbol */ |
---|
| 2418 | +#define N_SETB 0x1A /* Bss set element symbol */ |
---|
| 2419 | + |
---|
| 2420 | +/* This is output from LD. */ |
---|
| 2421 | +#define N_SETV 0x1C /* Pointer to set vector in data area. */ |
---|
| 2422 | + |
---|
| 2423 | +#if !defined (N_RELOCATION_INFO_DECLARED) |
---|
| 2424 | +/* This structure describes a single relocation to be performed. |
---|
| 2425 | + The text-relocation section of the file is a vector of these structures, |
---|
| 2426 | + all of which apply to the text section. |
---|
| 2427 | + Likewise, the data-relocation section applies to the data section. */ |
---|
| 2428 | + |
---|
| 2429 | +struct relocation_info |
---|
| 2430 | +{ |
---|
| 2431 | + /* Address (within segment) to be relocated. */ |
---|
| 2432 | + int r_address; |
---|
| 2433 | + /* The meaning of r_symbolnum depends on r_extern. */ |
---|
| 2434 | + unsigned int r_symbolnum:24; |
---|
| 2435 | + /* Nonzero means value is a pc-relative offset |
---|
| 2436 | + and it should be relocated for changes in its own address |
---|
| 2437 | + as well as for changes in the symbol or section specified. */ |
---|
| 2438 | + unsigned int r_pcrel:1; |
---|
| 2439 | + /* Length (as exponent of 2) of the field to be relocated. |
---|
| 2440 | + Thus, a value of 2 indicates 1<<2 bytes. */ |
---|
| 2441 | + unsigned int r_length:2; |
---|
| 2442 | + /* 1 => relocate with value of symbol. |
---|
| 2443 | + r_symbolnum is the index of the symbol |
---|
| 2444 | + in file's the symbol table. |
---|
| 2445 | + 0 => relocate with the address of a segment. |
---|
| 2446 | + r_symbolnum is N_TEXT, N_DATA, N_BSS or N_ABS |
---|
| 2447 | + (the N_EXT bit may be set also, but signifies nothing). */ |
---|
| 2448 | + unsigned int r_extern:1; |
---|
| 2449 | + /* Four bits that aren't used, but when writing an object file |
---|
| 2450 | + it is desirable to clear them. */ |
---|
| 2451 | +#ifdef NS32K |
---|
| 2452 | + unsigned r_bsr:1; |
---|
| 2453 | + unsigned r_disp:1; |
---|
| 2454 | + unsigned r_pad:2; |
---|
| 2455 | +#else |
---|
| 2456 | + unsigned int r_pad:4; |
---|
| 2457 | +#endif |
---|
| 2458 | +}; |
---|
| 2459 | +#endif /* no N_RELOCATION_INFO_DECLARED. */ |
---|
| 2460 | + |
---|
| 2461 | + |
---|
| 2462 | +#endif /* __A_OUT_GNU_H__ */ |
---|
| 2463 | diff -Naur aboot-0.9b.orig/include/linux/auxvec.h aboot-0.9b/include/linux/auxvec.h |
---|
| 2464 | --- aboot-0.9b.orig/include/linux/auxvec.h 1969-12-31 19:00:00.000000000 -0500 |
---|
| 2465 | +++ aboot-0.9b/include/linux/auxvec.h 2008-01-02 13:53:15.000000000 -0500 |
---|
| 2466 | @@ -0,0 +1,31 @@ |
---|
| 2467 | +#ifndef _LINUX_AUXVEC_H |
---|
| 2468 | +#define _LINUX_AUXVEC_H |
---|
| 2469 | + |
---|
| 2470 | +#include <asm/auxvec.h> |
---|
| 2471 | + |
---|
| 2472 | +/* Symbolic values for the entries in the auxiliary table |
---|
| 2473 | + put on the initial stack */ |
---|
| 2474 | +#define AT_NULL 0 /* end of vector */ |
---|
| 2475 | +#define AT_IGNORE 1 /* entry should be ignored */ |
---|
| 2476 | +#define AT_EXECFD 2 /* file descriptor of program */ |
---|
| 2477 | +#define AT_PHDR 3 /* program headers for program */ |
---|
| 2478 | +#define AT_PHENT 4 /* size of program header entry */ |
---|
| 2479 | +#define AT_PHNUM 5 /* number of program headers */ |
---|
| 2480 | +#define AT_PAGESZ 6 /* system page size */ |
---|
| 2481 | +#define AT_BASE 7 /* base address of interpreter */ |
---|
| 2482 | +#define AT_FLAGS 8 /* flags */ |
---|
| 2483 | +#define AT_ENTRY 9 /* entry point of program */ |
---|
| 2484 | +#define AT_NOTELF 10 /* program is not ELF */ |
---|
| 2485 | +#define AT_UID 11 /* real uid */ |
---|
| 2486 | +#define AT_EUID 12 /* effective uid */ |
---|
| 2487 | +#define AT_GID 13 /* real gid */ |
---|
| 2488 | +#define AT_EGID 14 /* effective gid */ |
---|
| 2489 | +#define AT_PLATFORM 15 /* string identifying CPU for optimizations */ |
---|
| 2490 | +#define AT_HWCAP 16 /* arch dependent hints at CPU capabilities */ |
---|
| 2491 | +#define AT_CLKTCK 17 /* frequency at which times() increments */ |
---|
| 2492 | + |
---|
| 2493 | +#define AT_SECURE 23 /* secure mode boolean */ |
---|
| 2494 | + |
---|
| 2495 | +#define AT_VECTOR_SIZE 44 /* Size of auxiliary table. */ |
---|
| 2496 | + |
---|
| 2497 | +#endif /* _LINUX_AUXVEC_H */ |
---|
| 2498 | diff -Naur aboot-0.9b.orig/include/linux/coff.h aboot-0.9b/include/linux/coff.h |
---|
| 2499 | --- aboot-0.9b.orig/include/linux/coff.h 1969-12-31 19:00:00.000000000 -0500 |
---|
| 2500 | +++ aboot-0.9b/include/linux/coff.h 2008-01-02 13:53:15.000000000 -0500 |
---|
| 2501 | @@ -0,0 +1,351 @@ |
---|
| 2502 | +/* This file is derived from the GAS 2.1.4 assembler control file. |
---|
| 2503 | + The GAS product is under the GNU General Public License, version 2 or later. |
---|
| 2504 | + As such, this file is also under that license. |
---|
| 2505 | + |
---|
| 2506 | + If the file format changes in the COFF object, this file should be |
---|
| 2507 | + subsequently updated to reflect the changes. |
---|
| 2508 | + |
---|
| 2509 | + The actual loader module only uses a few of these structures. The full |
---|
| 2510 | + set is documented here because I received the full set. If you wish |
---|
| 2511 | + more information about COFF, then O'Reilly has a very excellent book. |
---|
| 2512 | +*/ |
---|
| 2513 | + |
---|
| 2514 | +#define E_SYMNMLEN 8 /* Number of characters in a symbol name */ |
---|
| 2515 | +#define E_FILNMLEN 14 /* Number of characters in a file name */ |
---|
| 2516 | +#define E_DIMNUM 4 /* Number of array dimensions in auxiliary entry */ |
---|
| 2517 | + |
---|
| 2518 | +/* |
---|
| 2519 | + * These defines are byte order independent. There is no alignment of fields |
---|
| 2520 | + * permitted in the structures. Therefore they are declared as characters |
---|
| 2521 | + * and the values loaded from the character positions. It also makes it |
---|
| 2522 | + * nice to have it "endian" independent. |
---|
| 2523 | + */ |
---|
| 2524 | + |
---|
| 2525 | +/* Load a short int from the following tables with little-endian formats */ |
---|
| 2526 | +#define COFF_SHORT_L(ps) ((short)(((unsigned short)((unsigned char)ps[1])<<8)|\ |
---|
| 2527 | + ((unsigned short)((unsigned char)ps[0])))) |
---|
| 2528 | + |
---|
| 2529 | +/* Load a long int from the following tables with little-endian formats */ |
---|
| 2530 | +#define COFF_LONG_L(ps) (((long)(((unsigned long)((unsigned char)ps[3])<<24) |\ |
---|
| 2531 | + ((unsigned long)((unsigned char)ps[2])<<16) |\ |
---|
| 2532 | + ((unsigned long)((unsigned char)ps[1])<<8) |\ |
---|
| 2533 | + ((unsigned long)((unsigned char)ps[0]))))) |
---|
| 2534 | + |
---|
| 2535 | +/* Load a short int from the following tables with big-endian formats */ |
---|
| 2536 | +#define COFF_SHORT_H(ps) ((short)(((unsigned short)((unsigned char)ps[0])<<8)|\ |
---|
| 2537 | + ((unsigned short)((unsigned char)ps[1])))) |
---|
| 2538 | + |
---|
| 2539 | +/* Load a long int from the following tables with big-endian formats */ |
---|
| 2540 | +#define COFF_LONG_H(ps) (((long)(((unsigned long)((unsigned char)ps[0])<<24) |\ |
---|
| 2541 | + ((unsigned long)((unsigned char)ps[1])<<16) |\ |
---|
| 2542 | + ((unsigned long)((unsigned char)ps[2])<<8) |\ |
---|
| 2543 | + ((unsigned long)((unsigned char)ps[3]))))) |
---|
| 2544 | + |
---|
| 2545 | +/* These may be overridden later by brain dead implementations which generate |
---|
| 2546 | + a big-endian header with little-endian data. In that case, generate a |
---|
| 2547 | + replacement macro which tests a flag and uses either of the two above |
---|
| 2548 | + as appropriate. */ |
---|
| 2549 | + |
---|
| 2550 | +#define COFF_LONG(v) COFF_LONG_L(v) |
---|
| 2551 | +#define COFF_SHORT(v) COFF_SHORT_L(v) |
---|
| 2552 | + |
---|
| 2553 | +/*** coff information for Intel 386/486. */ |
---|
| 2554 | + |
---|
| 2555 | +/********************** FILE HEADER **********************/ |
---|
| 2556 | + |
---|
| 2557 | +struct COFF_filehdr { |
---|
| 2558 | + char f_magic[2]; /* magic number */ |
---|
| 2559 | + char f_nscns[2]; /* number of sections */ |
---|
| 2560 | + char f_timdat[4]; /* time & date stamp */ |
---|
| 2561 | + char f_symptr[4]; /* file pointer to symtab */ |
---|
| 2562 | + char f_nsyms[4]; /* number of symtab entries */ |
---|
| 2563 | + char f_opthdr[2]; /* sizeof(optional hdr) */ |
---|
| 2564 | + char f_flags[2]; /* flags */ |
---|
| 2565 | +}; |
---|
| 2566 | + |
---|
| 2567 | +/* |
---|
| 2568 | + * Bits for f_flags: |
---|
| 2569 | + * |
---|
| 2570 | + * F_RELFLG relocation info stripped from file |
---|
| 2571 | + * F_EXEC file is executable (i.e. no unresolved external |
---|
| 2572 | + * references) |
---|
| 2573 | + * F_LNNO line numbers stripped from file |
---|
| 2574 | + * F_LSYMS local symbols stripped from file |
---|
| 2575 | + * F_MINMAL this is a minimal object file (".m") output of fextract |
---|
| 2576 | + * F_UPDATE this is a fully bound update file, output of ogen |
---|
| 2577 | + * F_SWABD this file has had its bytes swabbed (in names) |
---|
| 2578 | + * F_AR16WR this file has the byte ordering of an AR16WR |
---|
| 2579 | + * (e.g. 11/70) machine |
---|
| 2580 | + * F_AR32WR this file has the byte ordering of an AR32WR machine |
---|
| 2581 | + * (e.g. vax and iNTEL 386) |
---|
| 2582 | + * F_AR32W this file has the byte ordering of an AR32W machine |
---|
| 2583 | + * (e.g. 3b,maxi) |
---|
| 2584 | + * F_PATCH file contains "patch" list in optional header |
---|
| 2585 | + * F_NODF (minimal file only) no decision functions for |
---|
| 2586 | + * replaced functions |
---|
| 2587 | + */ |
---|
| 2588 | + |
---|
| 2589 | +#define COFF_F_RELFLG 0000001 |
---|
| 2590 | +#define COFF_F_EXEC 0000002 |
---|
| 2591 | +#define COFF_F_LNNO 0000004 |
---|
| 2592 | +#define COFF_F_LSYMS 0000010 |
---|
| 2593 | +#define COFF_F_MINMAL 0000020 |
---|
| 2594 | +#define COFF_F_UPDATE 0000040 |
---|
| 2595 | +#define COFF_F_SWABD 0000100 |
---|
| 2596 | +#define COFF_F_AR16WR 0000200 |
---|
| 2597 | +#define COFF_F_AR32WR 0000400 |
---|
| 2598 | +#define COFF_F_AR32W 0001000 |
---|
| 2599 | +#define COFF_F_PATCH 0002000 |
---|
| 2600 | +#define COFF_F_NODF 0002000 |
---|
| 2601 | + |
---|
| 2602 | +#define COFF_I386MAGIC 0x14c /* Linux's system */ |
---|
| 2603 | + |
---|
| 2604 | +#if 0 /* Perhaps, someday, these formats may be used. */ |
---|
| 2605 | +#define COFF_I386PTXMAGIC 0x154 |
---|
| 2606 | +#define COFF_I386AIXMAGIC 0x175 /* IBM's AIX system */ |
---|
| 2607 | +#define COFF_I386BADMAG(x) ((COFF_SHORT((x).f_magic) != COFF_I386MAGIC) \ |
---|
| 2608 | + && COFF_SHORT((x).f_magic) != COFF_I386PTXMAGIC \ |
---|
| 2609 | + && COFF_SHORT((x).f_magic) != COFF_I386AIXMAGIC) |
---|
| 2610 | +#else |
---|
| 2611 | +#define COFF_I386BADMAG(x) (COFF_SHORT((x).f_magic) != COFF_I386MAGIC) |
---|
| 2612 | +#endif |
---|
| 2613 | + |
---|
| 2614 | +#define COFF_FILHDR struct COFF_filehdr |
---|
| 2615 | +#define COFF_FILHSZ sizeof(COFF_FILHDR) |
---|
| 2616 | + |
---|
| 2617 | +/********************** AOUT "OPTIONAL HEADER" **********************/ |
---|
| 2618 | + |
---|
| 2619 | +/* Linux COFF must have this "optional" header. Standard COFF has no entry |
---|
| 2620 | + location for the "entry" point. They normally would start with the first |
---|
| 2621 | + location of the .text section. This is not a good idea for linux. So, |
---|
| 2622 | + the use of this "optional" header is not optional. It is required. |
---|
| 2623 | + |
---|
| 2624 | + Do not be tempted to assume that the size of the optional header is |
---|
| 2625 | + a constant and simply index the next byte by the size of this structure. |
---|
| 2626 | + Use the 'f_opthdr' field in the main coff header for the size of the |
---|
| 2627 | + structure actually written to the file!! |
---|
| 2628 | +*/ |
---|
| 2629 | + |
---|
| 2630 | +typedef struct |
---|
| 2631 | +{ |
---|
| 2632 | + char magic[2]; /* type of file */ |
---|
| 2633 | + char vstamp[2]; /* version stamp */ |
---|
| 2634 | + char tsize[4]; /* text size in bytes, padded to FW bdry */ |
---|
| 2635 | + char dsize[4]; /* initialized data " " */ |
---|
| 2636 | + char bsize[4]; /* uninitialized data " " */ |
---|
| 2637 | + char entry[4]; /* entry pt. */ |
---|
| 2638 | + char text_start[4]; /* base of text used for this file */ |
---|
| 2639 | + char data_start[4]; /* base of data used for this file */ |
---|
| 2640 | +} |
---|
| 2641 | +COFF_AOUTHDR; |
---|
| 2642 | + |
---|
| 2643 | +#define COFF_AOUTSZ (sizeof(COFF_AOUTHDR)) |
---|
| 2644 | + |
---|
| 2645 | +#define COFF_STMAGIC 0401 |
---|
| 2646 | +#define COFF_OMAGIC 0404 |
---|
| 2647 | +#define COFF_JMAGIC 0407 /* dirty text and data image, can't share */ |
---|
| 2648 | +#define COFF_DMAGIC 0410 /* dirty text segment, data aligned */ |
---|
| 2649 | +#define COFF_ZMAGIC 0413 /* The proper magic number for executables */ |
---|
| 2650 | +#define COFF_SHMAGIC 0443 /* shared library header */ |
---|
| 2651 | + |
---|
| 2652 | +/********************** SECTION HEADER **********************/ |
---|
| 2653 | + |
---|
| 2654 | +struct COFF_scnhdr { |
---|
| 2655 | + char s_name[8]; /* section name */ |
---|
| 2656 | + char s_paddr[4]; /* physical address, aliased s_nlib */ |
---|
| 2657 | + char s_vaddr[4]; /* virtual address */ |
---|
| 2658 | + char s_size[4]; /* section size */ |
---|
| 2659 | + char s_scnptr[4]; /* file ptr to raw data for section */ |
---|
| 2660 | + char s_relptr[4]; /* file ptr to relocation */ |
---|
| 2661 | + char s_lnnoptr[4]; /* file ptr to line numbers */ |
---|
| 2662 | + char s_nreloc[2]; /* number of relocation entries */ |
---|
| 2663 | + char s_nlnno[2]; /* number of line number entries */ |
---|
| 2664 | + char s_flags[4]; /* flags */ |
---|
| 2665 | +}; |
---|
| 2666 | + |
---|
| 2667 | +#define COFF_SCNHDR struct COFF_scnhdr |
---|
| 2668 | +#define COFF_SCNHSZ sizeof(COFF_SCNHDR) |
---|
| 2669 | + |
---|
| 2670 | +/* |
---|
| 2671 | + * names of "special" sections |
---|
| 2672 | + */ |
---|
| 2673 | + |
---|
| 2674 | +#define COFF_TEXT ".text" |
---|
| 2675 | +#define COFF_DATA ".data" |
---|
| 2676 | +#define COFF_BSS ".bss" |
---|
| 2677 | +#define COFF_COMMENT ".comment" |
---|
| 2678 | +#define COFF_LIB ".lib" |
---|
| 2679 | + |
---|
| 2680 | +#define COFF_SECT_TEXT 0 /* Section for instruction code */ |
---|
| 2681 | +#define COFF_SECT_DATA 1 /* Section for initialized globals */ |
---|
| 2682 | +#define COFF_SECT_BSS 2 /* Section for un-initialized globals */ |
---|
| 2683 | +#define COFF_SECT_REQD 3 /* Minimum number of sections for good file */ |
---|
| 2684 | + |
---|
| 2685 | +#define COFF_STYP_REG 0x00 /* regular segment */ |
---|
| 2686 | +#define COFF_STYP_DSECT 0x01 /* dummy segment */ |
---|
| 2687 | +#define COFF_STYP_NOLOAD 0x02 /* no-load segment */ |
---|
| 2688 | +#define COFF_STYP_GROUP 0x04 /* group segment */ |
---|
| 2689 | +#define COFF_STYP_PAD 0x08 /* .pad segment */ |
---|
| 2690 | +#define COFF_STYP_COPY 0x10 /* copy section */ |
---|
| 2691 | +#define COFF_STYP_TEXT 0x20 /* .text segment */ |
---|
| 2692 | +#define COFF_STYP_DATA 0x40 /* .data segment */ |
---|
| 2693 | +#define COFF_STYP_BSS 0x80 /* .bss segment */ |
---|
| 2694 | +#define COFF_STYP_INFO 0x200 /* .comment section */ |
---|
| 2695 | +#define COFF_STYP_OVER 0x400 /* overlay section */ |
---|
| 2696 | +#define COFF_STYP_LIB 0x800 /* library section */ |
---|
| 2697 | + |
---|
| 2698 | +/* |
---|
| 2699 | + * Shared libraries have the following section header in the data field for |
---|
| 2700 | + * each library. |
---|
| 2701 | + */ |
---|
| 2702 | + |
---|
| 2703 | +struct COFF_slib { |
---|
| 2704 | + char sl_entsz[4]; /* Size of this entry */ |
---|
| 2705 | + char sl_pathndx[4]; /* size of the header field */ |
---|
| 2706 | +}; |
---|
| 2707 | + |
---|
| 2708 | +#define COFF_SLIBHD struct COFF_slib |
---|
| 2709 | +#define COFF_SLIBSZ sizeof(COFF_SLIBHD) |
---|
| 2710 | + |
---|
| 2711 | +/********************** LINE NUMBERS **********************/ |
---|
| 2712 | + |
---|
| 2713 | +/* 1 line number entry for every "breakpointable" source line in a section. |
---|
| 2714 | + * Line numbers are grouped on a per function basis; first entry in a function |
---|
| 2715 | + * grouping will have l_lnno = 0 and in place of physical address will be the |
---|
| 2716 | + * symbol table index of the function name. |
---|
| 2717 | + */ |
---|
| 2718 | + |
---|
| 2719 | +struct COFF_lineno { |
---|
| 2720 | + union { |
---|
| 2721 | + char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/ |
---|
| 2722 | + char l_paddr[4]; /* (physical) address of line number */ |
---|
| 2723 | + } l_addr; |
---|
| 2724 | + char l_lnno[2]; /* line number */ |
---|
| 2725 | +}; |
---|
| 2726 | + |
---|
| 2727 | +#define COFF_LINENO struct COFF_lineno |
---|
| 2728 | +#define COFF_LINESZ 6 |
---|
| 2729 | + |
---|
| 2730 | +/********************** SYMBOLS **********************/ |
---|
| 2731 | + |
---|
| 2732 | +#define COFF_E_SYMNMLEN 8 /* # characters in a short symbol name */ |
---|
| 2733 | +#define COFF_E_FILNMLEN 14 /* # characters in a file name */ |
---|
| 2734 | +#define COFF_E_DIMNUM 4 /* # array dimensions in auxiliary entry */ |
---|
| 2735 | + |
---|
| 2736 | +/* |
---|
| 2737 | + * All symbols and sections have the following definition |
---|
| 2738 | + */ |
---|
| 2739 | + |
---|
| 2740 | +struct COFF_syment |
---|
| 2741 | +{ |
---|
| 2742 | + union { |
---|
| 2743 | + char e_name[E_SYMNMLEN]; /* Symbol name (first 8 characters) */ |
---|
| 2744 | + struct { |
---|
| 2745 | + char e_zeroes[4]; /* Leading zeros */ |
---|
| 2746 | + char e_offset[4]; /* Offset if this is a header section */ |
---|
| 2747 | + } e; |
---|
| 2748 | + } e; |
---|
| 2749 | + |
---|
| 2750 | + char e_value[4]; /* Value (address) of the segment */ |
---|
| 2751 | + char e_scnum[2]; /* Section number */ |
---|
| 2752 | + char e_type[2]; /* Type of section */ |
---|
| 2753 | + char e_sclass[1]; /* Loader class */ |
---|
| 2754 | + char e_numaux[1]; /* Number of auxiliary entries which follow */ |
---|
| 2755 | +}; |
---|
| 2756 | + |
---|
| 2757 | +#define COFF_N_BTMASK (0xf) /* Mask for important class bits */ |
---|
| 2758 | +#define COFF_N_TMASK (0x30) /* Mask for important type bits */ |
---|
| 2759 | +#define COFF_N_BTSHFT (4) /* # bits to shift class field */ |
---|
| 2760 | +#define COFF_N_TSHIFT (2) /* # bits to shift type field */ |
---|
| 2761 | + |
---|
| 2762 | +/* |
---|
| 2763 | + * Auxiliary entries because the main table is too limiting. |
---|
| 2764 | + */ |
---|
| 2765 | + |
---|
| 2766 | +union COFF_auxent { |
---|
| 2767 | + |
---|
| 2768 | +/* |
---|
| 2769 | + * Debugger information |
---|
| 2770 | + */ |
---|
| 2771 | + |
---|
| 2772 | + struct { |
---|
| 2773 | + char x_tagndx[4]; /* str, un, or enum tag indx */ |
---|
| 2774 | + union { |
---|
| 2775 | + struct { |
---|
| 2776 | + char x_lnno[2]; /* declaration line number */ |
---|
| 2777 | + char x_size[2]; /* str/union/array size */ |
---|
| 2778 | + } x_lnsz; |
---|
| 2779 | + char x_fsize[4]; /* size of function */ |
---|
| 2780 | + } x_misc; |
---|
| 2781 | + |
---|
| 2782 | + union { |
---|
| 2783 | + struct { /* if ISFCN, tag, or .bb */ |
---|
| 2784 | + char x_lnnoptr[4]; /* ptr to fcn line # */ |
---|
| 2785 | + char x_endndx[4]; /* entry ndx past block end */ |
---|
| 2786 | + } x_fcn; |
---|
| 2787 | + |
---|
| 2788 | + struct { /* if ISARY, up to 4 dimen. */ |
---|
| 2789 | + char x_dimen[E_DIMNUM][2]; |
---|
| 2790 | + } x_ary; |
---|
| 2791 | + } x_fcnary; |
---|
| 2792 | + |
---|
| 2793 | + char x_tvndx[2]; /* tv index */ |
---|
| 2794 | + } x_sym; |
---|
| 2795 | + |
---|
| 2796 | +/* |
---|
| 2797 | + * Source file names (debugger information) |
---|
| 2798 | + */ |
---|
| 2799 | + |
---|
| 2800 | + union { |
---|
| 2801 | + char x_fname[E_FILNMLEN]; |
---|
| 2802 | + struct { |
---|
| 2803 | + char x_zeroes[4]; |
---|
| 2804 | + char x_offset[4]; |
---|
| 2805 | + } x_n; |
---|
| 2806 | + } x_file; |
---|
| 2807 | + |
---|
| 2808 | +/* |
---|
| 2809 | + * Section information |
---|
| 2810 | + */ |
---|
| 2811 | + |
---|
| 2812 | + struct { |
---|
| 2813 | + char x_scnlen[4]; /* section length */ |
---|
| 2814 | + char x_nreloc[2]; /* # relocation entries */ |
---|
| 2815 | + char x_nlinno[2]; /* # line numbers */ |
---|
| 2816 | + } x_scn; |
---|
| 2817 | + |
---|
| 2818 | +/* |
---|
| 2819 | + * Transfer vector (branch table) |
---|
| 2820 | + */ |
---|
| 2821 | + |
---|
| 2822 | + struct { |
---|
| 2823 | + char x_tvfill[4]; /* tv fill value */ |
---|
| 2824 | + char x_tvlen[2]; /* length of .tv */ |
---|
| 2825 | + char x_tvran[2][2]; /* tv range */ |
---|
| 2826 | + } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ |
---|
| 2827 | +}; |
---|
| 2828 | + |
---|
| 2829 | +#define COFF_SYMENT struct COFF_syment |
---|
| 2830 | +#define COFF_SYMESZ 18 |
---|
| 2831 | +#define COFF_AUXENT union COFF_auxent |
---|
| 2832 | +#define COFF_AUXESZ 18 |
---|
| 2833 | + |
---|
| 2834 | +#define COFF_ETEXT "etext" |
---|
| 2835 | + |
---|
| 2836 | +/********************** RELOCATION DIRECTIVES **********************/ |
---|
| 2837 | + |
---|
| 2838 | +struct COFF_reloc { |
---|
| 2839 | + char r_vaddr[4]; /* Virtual address of item */ |
---|
| 2840 | + char r_symndx[4]; /* Symbol index in the symtab */ |
---|
| 2841 | + char r_type[2]; /* Relocation type */ |
---|
| 2842 | +}; |
---|
| 2843 | + |
---|
| 2844 | +#define COFF_RELOC struct COFF_reloc |
---|
| 2845 | +#define COFF_RELSZ 10 |
---|
| 2846 | + |
---|
| 2847 | +#define COFF_DEF_DATA_SECTION_ALIGNMENT 4 |
---|
| 2848 | +#define COFF_DEF_BSS_SECTION_ALIGNMENT 4 |
---|
| 2849 | +#define COFF_DEF_TEXT_SECTION_ALIGNMENT 4 |
---|
| 2850 | + |
---|
| 2851 | +/* For new sections we haven't heard of before */ |
---|
| 2852 | +#define COFF_DEF_SECTION_ALIGNMENT 4 |
---|
| 2853 | diff -Naur aboot-0.9b.orig/include/linux/compiler.h aboot-0.9b/include/linux/compiler.h |
---|
| 2854 | --- aboot-0.9b.orig/include/linux/compiler.h 1969-12-31 19:00:00.000000000 -0500 |
---|
| 2855 | +++ aboot-0.9b/include/linux/compiler.h 2008-01-02 13:53:15.000000000 -0500 |
---|
| 2856 | @@ -0,0 +1,11 @@ |
---|
| 2857 | +#ifndef __inline__ |
---|
| 2858 | +# define __inline__ inline |
---|
| 2859 | +#endif |
---|
| 2860 | + |
---|
| 2861 | +#ifndef __attribute_const__ |
---|
| 2862 | +# define __attribute_const__ /* unimplemented */ |
---|
| 2863 | +#endif |
---|
| 2864 | + |
---|
| 2865 | +#ifndef __always_inline |
---|
| 2866 | +# define __always_inline inline |
---|
| 2867 | +#endif |
---|
| 2868 | diff -Naur aboot-0.9b.orig/include/linux/elf-em.h aboot-0.9b/include/linux/elf-em.h |
---|
| 2869 | --- aboot-0.9b.orig/include/linux/elf-em.h 1969-12-31 19:00:00.000000000 -0500 |
---|
| 2870 | +++ aboot-0.9b/include/linux/elf-em.h 2008-01-02 13:53:15.000000000 -0500 |
---|
| 2871 | @@ -0,0 +1,52 @@ |
---|
| 2872 | +#ifndef _LINUX_ELF_EM_H |
---|
| 2873 | +#define _LINUX_ELF_EM_H |
---|
| 2874 | + |
---|
| 2875 | +/* These constants define the various ELF target machines */ |
---|
| 2876 | +#define EM_NONE 0 |
---|
| 2877 | +#define EM_M32 1 |
---|
| 2878 | +#define EM_SPARC 2 |
---|
| 2879 | +#define EM_386 3 |
---|
| 2880 | +#define EM_68K 4 |
---|
| 2881 | +#define EM_88K 5 |
---|
| 2882 | +#define EM_486 6 /* Perhaps disused */ |
---|
| 2883 | +#define EM_860 7 |
---|
| 2884 | +#define EM_MIPS 8 /* MIPS R3000 (officially, big-endian only) */ |
---|
| 2885 | + /* Next two are historical and binaries and |
---|
| 2886 | + modules of these types will be rejected by |
---|
| 2887 | + Linux. */ |
---|
| 2888 | +#define EM_MIPS_RS3_LE 10 /* MIPS R3000 little-endian */ |
---|
| 2889 | +#define EM_MIPS_RS4_BE 10 /* MIPS R4000 big-endian */ |
---|
| 2890 | + |
---|
| 2891 | +#define EM_PARISC 15 /* HPPA */ |
---|
| 2892 | +#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */ |
---|
| 2893 | +#define EM_PPC 20 /* PowerPC */ |
---|
| 2894 | +#define EM_PPC64 21 /* PowerPC64 */ |
---|
| 2895 | +#define EM_SPU 23 /* Cell BE SPU */ |
---|
| 2896 | +#define EM_SH 42 /* SuperH */ |
---|
| 2897 | +#define EM_SPARCV9 43 /* SPARC v9 64-bit */ |
---|
| 2898 | +#define EM_IA_64 50 /* HP/Intel IA-64 */ |
---|
| 2899 | +#define EM_X86_64 62 /* AMD x86-64 */ |
---|
| 2900 | +#define EM_S390 22 /* IBM S/390 */ |
---|
| 2901 | +#define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */ |
---|
| 2902 | +#define EM_V850 87 /* NEC v850 */ |
---|
| 2903 | +#define EM_M32R 88 /* Renesas M32R */ |
---|
| 2904 | +#define EM_H8_300 46 /* Renesas H8/300,300H,H8S */ |
---|
| 2905 | +#define EM_BLACKFIN 106 /* ADI Blackfin Processor */ |
---|
| 2906 | +#define EM_FRV 0x5441 /* Fujitsu FR-V */ |
---|
| 2907 | +#define EM_AVR32 0x18ad /* Atmel AVR32 */ |
---|
| 2908 | + |
---|
| 2909 | +/* |
---|
| 2910 | + * This is an interim value that we will use until the committee comes |
---|
| 2911 | + * up with a final number. |
---|
| 2912 | + */ |
---|
| 2913 | +#define EM_ALPHA 0x9026 |
---|
| 2914 | + |
---|
| 2915 | +/* Bogus old v850 magic number, used by old tools. */ |
---|
| 2916 | +#define EM_CYGNUS_V850 0x9080 |
---|
| 2917 | +/* Bogus old m32r magic number, used by old tools. */ |
---|
| 2918 | +#define EM_CYGNUS_M32R 0x9041 |
---|
| 2919 | +/* This is the old interim value for S/390 architecture */ |
---|
| 2920 | +#define EM_S390_OLD 0xA390 |
---|
| 2921 | + |
---|
| 2922 | + |
---|
| 2923 | +#endif /* _LINUX_ELF_EM_H */ |
---|
| 2924 | diff -Naur aboot-0.9b.orig/include/linux/elf.h aboot-0.9b/include/linux/elf.h |
---|
| 2925 | --- aboot-0.9b.orig/include/linux/elf.h 1969-12-31 19:00:00.000000000 -0500 |
---|
| 2926 | +++ aboot-0.9b/include/linux/elf.h 2008-01-02 13:53:15.000000000 -0500 |
---|
| 2927 | @@ -0,0 +1,400 @@ |
---|
| 2928 | +#ifndef _LINUX_ELF_H |
---|
| 2929 | +#define _LINUX_ELF_H |
---|
| 2930 | + |
---|
| 2931 | +#include <linux/types.h> |
---|
| 2932 | +#include <linux/auxvec.h> |
---|
| 2933 | +#include <linux/elf-em.h> |
---|
| 2934 | +#include <asm/elf.h> |
---|
| 2935 | + |
---|
| 2936 | +struct file; |
---|
| 2937 | + |
---|
| 2938 | +#ifndef elf_read_implies_exec |
---|
| 2939 | + /* Executables for which elf_read_implies_exec() returns TRUE will |
---|
| 2940 | + have the READ_IMPLIES_EXEC personality flag set automatically. |
---|
| 2941 | + Override in asm/elf.h as needed. */ |
---|
| 2942 | +# define elf_read_implies_exec(ex, have_pt_gnu_stack) 0 |
---|
| 2943 | +#endif |
---|
| 2944 | + |
---|
| 2945 | +/* 32-bit ELF base types. */ |
---|
| 2946 | +typedef __u32 Elf32_Addr; |
---|
| 2947 | +typedef __u16 Elf32_Half; |
---|
| 2948 | +typedef __u32 Elf32_Off; |
---|
| 2949 | +typedef __s32 Elf32_Sword; |
---|
| 2950 | +typedef __u32 Elf32_Word; |
---|
| 2951 | + |
---|
| 2952 | +/* 64-bit ELF base types. */ |
---|
| 2953 | +typedef __u64 Elf64_Addr; |
---|
| 2954 | +typedef __u16 Elf64_Half; |
---|
| 2955 | +typedef __s16 Elf64_SHalf; |
---|
| 2956 | +typedef __u64 Elf64_Off; |
---|
| 2957 | +typedef __s32 Elf64_Sword; |
---|
| 2958 | +typedef __u32 Elf64_Word; |
---|
| 2959 | +typedef __u64 Elf64_Xword; |
---|
| 2960 | +typedef __s64 Elf64_Sxword; |
---|
| 2961 | + |
---|
| 2962 | +/* These constants are for the segment types stored in the image headers */ |
---|
| 2963 | +#define PT_NULL 0 |
---|
| 2964 | +#define PT_LOAD 1 |
---|
| 2965 | +#define PT_DYNAMIC 2 |
---|
| 2966 | +#define PT_INTERP 3 |
---|
| 2967 | +#define PT_NOTE 4 |
---|
| 2968 | +#define PT_SHLIB 5 |
---|
| 2969 | +#define PT_PHDR 6 |
---|
| 2970 | +#define PT_TLS 7 /* Thread local storage segment */ |
---|
| 2971 | +#define PT_LOOS 0x60000000 /* OS-specific */ |
---|
| 2972 | +#define PT_HIOS 0x6fffffff /* OS-specific */ |
---|
| 2973 | +#define PT_LOPROC 0x70000000 |
---|
| 2974 | +#define PT_HIPROC 0x7fffffff |
---|
| 2975 | +#define PT_GNU_EH_FRAME 0x6474e550 |
---|
| 2976 | + |
---|
| 2977 | +#define PT_GNU_STACK (PT_LOOS + 0x474e551) |
---|
| 2978 | + |
---|
| 2979 | +/* These constants define the different elf file types */ |
---|
| 2980 | +#define ET_NONE 0 |
---|
| 2981 | +#define ET_REL 1 |
---|
| 2982 | +#define ET_EXEC 2 |
---|
| 2983 | +#define ET_DYN 3 |
---|
| 2984 | +#define ET_CORE 4 |
---|
| 2985 | +#define ET_LOPROC 0xff00 |
---|
| 2986 | +#define ET_HIPROC 0xffff |
---|
| 2987 | + |
---|
| 2988 | +/* This is the info that is needed to parse the dynamic section of the file */ |
---|
| 2989 | +#define DT_NULL 0 |
---|
| 2990 | +#define DT_NEEDED 1 |
---|
| 2991 | +#define DT_PLTRELSZ 2 |
---|
| 2992 | +#define DT_PLTGOT 3 |
---|
| 2993 | +#define DT_HASH 4 |
---|
| 2994 | +#define DT_STRTAB 5 |
---|
| 2995 | +#define DT_SYMTAB 6 |
---|
| 2996 | +#define DT_RELA 7 |
---|
| 2997 | +#define DT_RELASZ 8 |
---|
| 2998 | +#define DT_RELAENT 9 |
---|
| 2999 | +#define DT_STRSZ 10 |
---|
| 3000 | +#define DT_SYMENT 11 |
---|
| 3001 | +#define DT_INIT 12 |
---|
| 3002 | +#define DT_FINI 13 |
---|
| 3003 | +#define DT_SONAME 14 |
---|
| 3004 | +#define DT_RPATH 15 |
---|
| 3005 | +#define DT_SYMBOLIC 16 |
---|
| 3006 | +#define DT_REL 17 |
---|
| 3007 | +#define DT_RELSZ 18 |
---|
| 3008 | +#define DT_RELENT 19 |
---|
| 3009 | +#define DT_PLTREL 20 |
---|
| 3010 | +#define DT_DEBUG 21 |
---|
| 3011 | +#define DT_TEXTREL 22 |
---|
| 3012 | +#define DT_JMPREL 23 |
---|
| 3013 | +#define DT_ENCODING 32 |
---|
| 3014 | +#define OLD_DT_LOOS 0x60000000 |
---|
| 3015 | +#define DT_LOOS 0x6000000d |
---|
| 3016 | +#define DT_HIOS 0x6ffff000 |
---|
| 3017 | +#define DT_VALRNGLO 0x6ffffd00 |
---|
| 3018 | +#define DT_VALRNGHI 0x6ffffdff |
---|
| 3019 | +#define DT_ADDRRNGLO 0x6ffffe00 |
---|
| 3020 | +#define DT_ADDRRNGHI 0x6ffffeff |
---|
| 3021 | +#define DT_VERSYM 0x6ffffff0 |
---|
| 3022 | +#define DT_RELACOUNT 0x6ffffff9 |
---|
| 3023 | +#define DT_RELCOUNT 0x6ffffffa |
---|
| 3024 | +#define DT_FLAGS_1 0x6ffffffb |
---|
| 3025 | +#define DT_VERDEF 0x6ffffffc |
---|
| 3026 | +#define DT_VERDEFNUM 0x6ffffffd |
---|
| 3027 | +#define DT_VERNEED 0x6ffffffe |
---|
| 3028 | +#define DT_VERNEEDNUM 0x6fffffff |
---|
| 3029 | +#define OLD_DT_HIOS 0x6fffffff |
---|
| 3030 | +#define DT_LOPROC 0x70000000 |
---|
| 3031 | +#define DT_HIPROC 0x7fffffff |
---|
| 3032 | + |
---|
| 3033 | +/* This info is needed when parsing the symbol table */ |
---|
| 3034 | +#define STB_LOCAL 0 |
---|
| 3035 | +#define STB_GLOBAL 1 |
---|
| 3036 | +#define STB_WEAK 2 |
---|
| 3037 | + |
---|
| 3038 | +#define STT_NOTYPE 0 |
---|
| 3039 | +#define STT_OBJECT 1 |
---|
| 3040 | +#define STT_FUNC 2 |
---|
| 3041 | +#define STT_SECTION 3 |
---|
| 3042 | +#define STT_FILE 4 |
---|
| 3043 | +#define STT_COMMON 5 |
---|
| 3044 | +#define STT_TLS 6 |
---|
| 3045 | + |
---|
| 3046 | +#define ELF_ST_BIND(x) ((x) >> 4) |
---|
| 3047 | +#define ELF_ST_TYPE(x) (((unsigned int) x) & 0xf) |
---|
| 3048 | +#define ELF32_ST_BIND(x) ELF_ST_BIND(x) |
---|
| 3049 | +#define ELF32_ST_TYPE(x) ELF_ST_TYPE(x) |
---|
| 3050 | +#define ELF64_ST_BIND(x) ELF_ST_BIND(x) |
---|
| 3051 | +#define ELF64_ST_TYPE(x) ELF_ST_TYPE(x) |
---|
| 3052 | + |
---|
| 3053 | +typedef struct dynamic{ |
---|
| 3054 | + Elf32_Sword d_tag; |
---|
| 3055 | + union{ |
---|
| 3056 | + Elf32_Sword d_val; |
---|
| 3057 | + Elf32_Addr d_ptr; |
---|
| 3058 | + } d_un; |
---|
| 3059 | +} Elf32_Dyn; |
---|
| 3060 | + |
---|
| 3061 | +typedef struct { |
---|
| 3062 | + Elf64_Sxword d_tag; /* entry tag value */ |
---|
| 3063 | + union { |
---|
| 3064 | + Elf64_Xword d_val; |
---|
| 3065 | + Elf64_Addr d_ptr; |
---|
| 3066 | + } d_un; |
---|
| 3067 | +} Elf64_Dyn; |
---|
| 3068 | + |
---|
| 3069 | +/* The following are used with relocations */ |
---|
| 3070 | +#define ELF32_R_SYM(x) ((x) >> 8) |
---|
| 3071 | +#define ELF32_R_TYPE(x) ((x) & 0xff) |
---|
| 3072 | + |
---|
| 3073 | +#define ELF64_R_SYM(i) ((i) >> 32) |
---|
| 3074 | +#define ELF64_R_TYPE(i) ((i) & 0xffffffff) |
---|
| 3075 | + |
---|
| 3076 | +typedef struct elf32_rel { |
---|
| 3077 | + Elf32_Addr r_offset; |
---|
| 3078 | + Elf32_Word r_info; |
---|
| 3079 | +} Elf32_Rel; |
---|
| 3080 | + |
---|
| 3081 | +typedef struct elf64_rel { |
---|
| 3082 | + Elf64_Addr r_offset; /* Location at which to apply the action */ |
---|
| 3083 | + Elf64_Xword r_info; /* index and type of relocation */ |
---|
| 3084 | +} Elf64_Rel; |
---|
| 3085 | + |
---|
| 3086 | +typedef struct elf32_rela{ |
---|
| 3087 | + Elf32_Addr r_offset; |
---|
| 3088 | + Elf32_Word r_info; |
---|
| 3089 | + Elf32_Sword r_addend; |
---|
| 3090 | +} Elf32_Rela; |
---|
| 3091 | + |
---|
| 3092 | +typedef struct elf64_rela { |
---|
| 3093 | + Elf64_Addr r_offset; /* Location at which to apply the action */ |
---|
| 3094 | + Elf64_Xword r_info; /* index and type of relocation */ |
---|
| 3095 | + Elf64_Sxword r_addend; /* Constant addend used to compute value */ |
---|
| 3096 | +} Elf64_Rela; |
---|
| 3097 | + |
---|
| 3098 | +typedef struct elf32_sym{ |
---|
| 3099 | + Elf32_Word st_name; |
---|
| 3100 | + Elf32_Addr st_value; |
---|
| 3101 | + Elf32_Word st_size; |
---|
| 3102 | + unsigned char st_info; |
---|
| 3103 | + unsigned char st_other; |
---|
| 3104 | + Elf32_Half st_shndx; |
---|
| 3105 | +} Elf32_Sym; |
---|
| 3106 | + |
---|
| 3107 | +typedef struct elf64_sym { |
---|
| 3108 | + Elf64_Word st_name; /* Symbol name, index in string tbl */ |
---|
| 3109 | + unsigned char st_info; /* Type and binding attributes */ |
---|
| 3110 | + unsigned char st_other; /* No defined meaning, 0 */ |
---|
| 3111 | + Elf64_Half st_shndx; /* Associated section index */ |
---|
| 3112 | + Elf64_Addr st_value; /* Value of the symbol */ |
---|
| 3113 | + Elf64_Xword st_size; /* Associated symbol size */ |
---|
| 3114 | +} Elf64_Sym; |
---|
| 3115 | + |
---|
| 3116 | + |
---|
| 3117 | +#define EI_NIDENT 16 |
---|
| 3118 | + |
---|
| 3119 | +typedef struct elf32_hdr{ |
---|
| 3120 | + unsigned char e_ident[EI_NIDENT]; |
---|
| 3121 | + Elf32_Half e_type; |
---|
| 3122 | + Elf32_Half e_machine; |
---|
| 3123 | + Elf32_Word e_version; |
---|
| 3124 | + Elf32_Addr e_entry; /* Entry point */ |
---|
| 3125 | + Elf32_Off e_phoff; |
---|
| 3126 | + Elf32_Off e_shoff; |
---|
| 3127 | + Elf32_Word e_flags; |
---|
| 3128 | + Elf32_Half e_ehsize; |
---|
| 3129 | + Elf32_Half e_phentsize; |
---|
| 3130 | + Elf32_Half e_phnum; |
---|
| 3131 | + Elf32_Half e_shentsize; |
---|
| 3132 | + Elf32_Half e_shnum; |
---|
| 3133 | + Elf32_Half e_shstrndx; |
---|
| 3134 | +} Elf32_Ehdr; |
---|
| 3135 | + |
---|
| 3136 | +typedef struct elf64_hdr { |
---|
| 3137 | + unsigned char e_ident[16]; /* ELF "magic number" */ |
---|
| 3138 | + Elf64_Half e_type; |
---|
| 3139 | + Elf64_Half e_machine; |
---|
| 3140 | + Elf64_Word e_version; |
---|
| 3141 | + Elf64_Addr e_entry; /* Entry point virtual address */ |
---|
| 3142 | + Elf64_Off e_phoff; /* Program header table file offset */ |
---|
| 3143 | + Elf64_Off e_shoff; /* Section header table file offset */ |
---|
| 3144 | + Elf64_Word e_flags; |
---|
| 3145 | + Elf64_Half e_ehsize; |
---|
| 3146 | + Elf64_Half e_phentsize; |
---|
| 3147 | + Elf64_Half e_phnum; |
---|
| 3148 | + Elf64_Half e_shentsize; |
---|
| 3149 | + Elf64_Half e_shnum; |
---|
| 3150 | + Elf64_Half e_shstrndx; |
---|
| 3151 | +} Elf64_Ehdr; |
---|
| 3152 | + |
---|
| 3153 | +/* These constants define the permissions on sections in the program |
---|
| 3154 | + header, p_flags. */ |
---|
| 3155 | +#define PF_R 0x4 |
---|
| 3156 | +#define PF_W 0x2 |
---|
| 3157 | +#define PF_X 0x1 |
---|
| 3158 | + |
---|
| 3159 | +typedef struct elf32_phdr{ |
---|
| 3160 | + Elf32_Word p_type; |
---|
| 3161 | + Elf32_Off p_offset; |
---|
| 3162 | + Elf32_Addr p_vaddr; |
---|
| 3163 | + Elf32_Addr p_paddr; |
---|
| 3164 | + Elf32_Word p_filesz; |
---|
| 3165 | + Elf32_Word p_memsz; |
---|
| 3166 | + Elf32_Word p_flags; |
---|
| 3167 | + Elf32_Word p_align; |
---|
| 3168 | +} Elf32_Phdr; |
---|
| 3169 | + |
---|
| 3170 | +typedef struct elf64_phdr { |
---|
| 3171 | + Elf64_Word p_type; |
---|
| 3172 | + Elf64_Word p_flags; |
---|
| 3173 | + Elf64_Off p_offset; /* Segment file offset */ |
---|
| 3174 | + Elf64_Addr p_vaddr; /* Segment virtual address */ |
---|
| 3175 | + Elf64_Addr p_paddr; /* Segment physical address */ |
---|
| 3176 | + Elf64_Xword p_filesz; /* Segment size in file */ |
---|
| 3177 | + Elf64_Xword p_memsz; /* Segment size in memory */ |
---|
| 3178 | + Elf64_Xword p_align; /* Segment alignment, file & memory */ |
---|
| 3179 | +} Elf64_Phdr; |
---|
| 3180 | + |
---|
| 3181 | +/* sh_type */ |
---|
| 3182 | +#define SHT_NULL 0 |
---|
| 3183 | +#define SHT_PROGBITS 1 |
---|
| 3184 | +#define SHT_SYMTAB 2 |
---|
| 3185 | +#define SHT_STRTAB 3 |
---|
| 3186 | +#define SHT_RELA 4 |
---|
| 3187 | +#define SHT_HASH 5 |
---|
| 3188 | +#define SHT_DYNAMIC 6 |
---|
| 3189 | +#define SHT_NOTE 7 |
---|
| 3190 | +#define SHT_NOBITS 8 |
---|
| 3191 | +#define SHT_REL 9 |
---|
| 3192 | +#define SHT_SHLIB 10 |
---|
| 3193 | +#define SHT_DYNSYM 11 |
---|
| 3194 | +#define SHT_NUM 12 |
---|
| 3195 | +#define SHT_LOPROC 0x70000000 |
---|
| 3196 | +#define SHT_HIPROC 0x7fffffff |
---|
| 3197 | +#define SHT_LOUSER 0x80000000 |
---|
| 3198 | +#define SHT_HIUSER 0xffffffff |
---|
| 3199 | + |
---|
| 3200 | +/* sh_flags */ |
---|
| 3201 | +#define SHF_WRITE 0x1 |
---|
| 3202 | +#define SHF_ALLOC 0x2 |
---|
| 3203 | +#define SHF_EXECINSTR 0x4 |
---|
| 3204 | +#define SHF_MASKPROC 0xf0000000 |
---|
| 3205 | + |
---|
| 3206 | +/* special section indexes */ |
---|
| 3207 | +#define SHN_UNDEF 0 |
---|
| 3208 | +#define SHN_LORESERVE 0xff00 |
---|
| 3209 | +#define SHN_LOPROC 0xff00 |
---|
| 3210 | +#define SHN_HIPROC 0xff1f |
---|
| 3211 | +#define SHN_ABS 0xfff1 |
---|
| 3212 | +#define SHN_COMMON 0xfff2 |
---|
| 3213 | +#define SHN_HIRESERVE 0xffff |
---|
| 3214 | + |
---|
| 3215 | +typedef struct { |
---|
| 3216 | + Elf32_Word sh_name; |
---|
| 3217 | + Elf32_Word sh_type; |
---|
| 3218 | + Elf32_Word sh_flags; |
---|
| 3219 | + Elf32_Addr sh_addr; |
---|
| 3220 | + Elf32_Off sh_offset; |
---|
| 3221 | + Elf32_Word sh_size; |
---|
| 3222 | + Elf32_Word sh_link; |
---|
| 3223 | + Elf32_Word sh_info; |
---|
| 3224 | + Elf32_Word sh_addralign; |
---|
| 3225 | + Elf32_Word sh_entsize; |
---|
| 3226 | +} Elf32_Shdr; |
---|
| 3227 | + |
---|
| 3228 | +typedef struct elf64_shdr { |
---|
| 3229 | + Elf64_Word sh_name; /* Section name, index in string tbl */ |
---|
| 3230 | + Elf64_Word sh_type; /* Type of section */ |
---|
| 3231 | + Elf64_Xword sh_flags; /* Miscellaneous section attributes */ |
---|
| 3232 | + Elf64_Addr sh_addr; /* Section virtual addr at execution */ |
---|
| 3233 | + Elf64_Off sh_offset; /* Section file offset */ |
---|
| 3234 | + Elf64_Xword sh_size; /* Size of section in bytes */ |
---|
| 3235 | + Elf64_Word sh_link; /* Index of another section */ |
---|
| 3236 | + Elf64_Word sh_info; /* Additional section information */ |
---|
| 3237 | + Elf64_Xword sh_addralign; /* Section alignment */ |
---|
| 3238 | + Elf64_Xword sh_entsize; /* Entry size if section holds table */ |
---|
| 3239 | +} Elf64_Shdr; |
---|
| 3240 | + |
---|
| 3241 | +#define EI_MAG0 0 /* e_ident[] indexes */ |
---|
| 3242 | +#define EI_MAG1 1 |
---|
| 3243 | +#define EI_MAG2 2 |
---|
| 3244 | +#define EI_MAG3 3 |
---|
| 3245 | +#define EI_CLASS 4 |
---|
| 3246 | +#define EI_DATA 5 |
---|
| 3247 | +#define EI_VERSION 6 |
---|
| 3248 | +#define EI_OSABI 7 |
---|
| 3249 | +#define EI_PAD 8 |
---|
| 3250 | + |
---|
| 3251 | +#define ELFMAG0 0x7f /* EI_MAG */ |
---|
| 3252 | +#define ELFMAG1 'E' |
---|
| 3253 | +#define ELFMAG2 'L' |
---|
| 3254 | +#define ELFMAG3 'F' |
---|
| 3255 | +#define ELFMAG "\177ELF" |
---|
| 3256 | +#define SELFMAG 4 |
---|
| 3257 | + |
---|
| 3258 | +#define ELFCLASSNONE 0 /* EI_CLASS */ |
---|
| 3259 | +#define ELFCLASS32 1 |
---|
| 3260 | +#define ELFCLASS64 2 |
---|
| 3261 | +#define ELFCLASSNUM 3 |
---|
| 3262 | + |
---|
| 3263 | +#define ELFDATANONE 0 /* e_ident[EI_DATA] */ |
---|
| 3264 | +#define ELFDATA2LSB 1 |
---|
| 3265 | +#define ELFDATA2MSB 2 |
---|
| 3266 | + |
---|
| 3267 | +#define EV_NONE 0 /* e_version, EI_VERSION */ |
---|
| 3268 | +#define EV_CURRENT 1 |
---|
| 3269 | +#define EV_NUM 2 |
---|
| 3270 | + |
---|
| 3271 | +#define ELFOSABI_NONE 0 |
---|
| 3272 | +#define ELFOSABI_LINUX 3 |
---|
| 3273 | + |
---|
| 3274 | +#ifndef ELF_OSABI |
---|
| 3275 | +#define ELF_OSABI ELFOSABI_NONE |
---|
| 3276 | +#endif |
---|
| 3277 | + |
---|
| 3278 | +/* Notes used in ET_CORE */ |
---|
| 3279 | +#define NT_PRSTATUS 1 |
---|
| 3280 | +#define NT_PRFPREG 2 |
---|
| 3281 | +#define NT_PRPSINFO 3 |
---|
| 3282 | +#define NT_TASKSTRUCT 4 |
---|
| 3283 | +#define NT_AUXV 6 |
---|
| 3284 | +#define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */ |
---|
| 3285 | + |
---|
| 3286 | + |
---|
| 3287 | +/* Note header in a PT_NOTE section */ |
---|
| 3288 | +typedef struct elf32_note { |
---|
| 3289 | + Elf32_Word n_namesz; /* Name size */ |
---|
| 3290 | + Elf32_Word n_descsz; /* Content size */ |
---|
| 3291 | + Elf32_Word n_type; /* Content type */ |
---|
| 3292 | +} Elf32_Nhdr; |
---|
| 3293 | + |
---|
| 3294 | +/* Note header in a PT_NOTE section */ |
---|
| 3295 | +typedef struct elf64_note { |
---|
| 3296 | + Elf64_Word n_namesz; /* Name size */ |
---|
| 3297 | + Elf64_Word n_descsz; /* Content size */ |
---|
| 3298 | + Elf64_Word n_type; /* Content type */ |
---|
| 3299 | +} Elf64_Nhdr; |
---|
| 3300 | + |
---|
| 3301 | +#if ELF_CLASS == ELFCLASS32 |
---|
| 3302 | + |
---|
| 3303 | +extern Elf32_Dyn _DYNAMIC []; |
---|
| 3304 | +#define elfhdr elf32_hdr |
---|
| 3305 | +#define elf_phdr elf32_phdr |
---|
| 3306 | +#define elf_note elf32_note |
---|
| 3307 | +#define elf_addr_t Elf32_Off |
---|
| 3308 | + |
---|
| 3309 | +#else |
---|
| 3310 | + |
---|
| 3311 | +extern Elf64_Dyn _DYNAMIC []; |
---|
| 3312 | +#define elfhdr elf64_hdr |
---|
| 3313 | +#define elf_phdr elf64_phdr |
---|
| 3314 | +#define elf_note elf64_note |
---|
| 3315 | +#define elf_addr_t Elf64_Off |
---|
| 3316 | + |
---|
| 3317 | +#endif |
---|
| 3318 | + |
---|
| 3319 | +#ifndef ARCH_HAVE_EXTRA_ELF_NOTES |
---|
| 3320 | +static __inline__ int arch_notes_size(void) { return 0; } |
---|
| 3321 | +static __inline__ void arch_write_notes(struct file *file) { } |
---|
| 3322 | + |
---|
| 3323 | +#define ELF_CORE_EXTRA_NOTES_SIZE arch_notes_size() |
---|
| 3324 | +#define ELF_CORE_WRITE_EXTRA_NOTES arch_write_notes(file) |
---|
| 3325 | +#endif /* ARCH_HAVE_EXTRA_ELF_NOTES */ |
---|
| 3326 | + |
---|
| 3327 | +#endif /* _LINUX_ELF_H */ |
---|
| 3328 | diff -Naur aboot-0.9b.orig/include/linux/ext2_fs.h aboot-0.9b/include/linux/ext2_fs.h |
---|
| 3329 | --- aboot-0.9b.orig/include/linux/ext2_fs.h 1969-12-31 19:00:00.000000000 -0500 |
---|
| 3330 | +++ aboot-0.9b/include/linux/ext2_fs.h 2008-01-02 13:53:15.000000000 -0500 |
---|
| 3331 | @@ -0,0 +1,527 @@ |
---|
| 3332 | +/* |
---|
| 3333 | + * linux/include/linux/ext2_fs.h |
---|
| 3334 | + * |
---|
| 3335 | + * Copyright (C) 1992, 1993, 1994, 1995 |
---|
| 3336 | + * Remy Card (card@masi.ibp.fr) |
---|
| 3337 | + * Laboratoire MASI - Institut Blaise Pascal |
---|
| 3338 | + * Universite Pierre et Marie Curie (Paris VI) |
---|
| 3339 | + * |
---|
| 3340 | + * from |
---|
| 3341 | + * |
---|
| 3342 | + * linux/include/linux/minix_fs.h |
---|
| 3343 | + * |
---|
| 3344 | + * Copyright (C) 1991, 1992 Linus Torvalds |
---|
| 3345 | + */ |
---|
| 3346 | + |
---|
| 3347 | +#ifndef _LINUX_EXT2_FS_H |
---|
| 3348 | +#define _LINUX_EXT2_FS_H |
---|
| 3349 | + |
---|
| 3350 | +#include <linux/types.h> |
---|
| 3351 | +#include <linux/magic.h> |
---|
| 3352 | + |
---|
| 3353 | +/* |
---|
| 3354 | + * The second extended filesystem constants/structures |
---|
| 3355 | + */ |
---|
| 3356 | + |
---|
| 3357 | +/* |
---|
| 3358 | + * Define EXT2FS_DEBUG to produce debug messages |
---|
| 3359 | + */ |
---|
| 3360 | +#undef EXT2FS_DEBUG |
---|
| 3361 | + |
---|
| 3362 | +/* |
---|
| 3363 | + * Define EXT2_PREALLOCATE to preallocate data blocks for expanding files |
---|
| 3364 | + */ |
---|
| 3365 | +#define EXT2_PREALLOCATE |
---|
| 3366 | +#define EXT2_DEFAULT_PREALLOC_BLOCKS 8 |
---|
| 3367 | + |
---|
| 3368 | +/* |
---|
| 3369 | + * The second extended file system version |
---|
| 3370 | + */ |
---|
| 3371 | +#define EXT2FS_DATE "95/08/09" |
---|
| 3372 | +#define EXT2FS_VERSION "0.5b" |
---|
| 3373 | + |
---|
| 3374 | +/* |
---|
| 3375 | + * Debug code |
---|
| 3376 | + */ |
---|
| 3377 | +#ifdef EXT2FS_DEBUG |
---|
| 3378 | +# define ext2_debug(f, a...) { \ |
---|
| 3379 | + printk ("EXT2-fs DEBUG (%s, %d): %s:", \ |
---|
| 3380 | + __FILE__, __LINE__, __FUNCTION__); \ |
---|
| 3381 | + printk (f, ## a); \ |
---|
| 3382 | + } |
---|
| 3383 | +#else |
---|
| 3384 | +# define ext2_debug(f, a...) /**/ |
---|
| 3385 | +#endif |
---|
| 3386 | + |
---|
| 3387 | +/* |
---|
| 3388 | + * Special inode numbers |
---|
| 3389 | + */ |
---|
| 3390 | +#define EXT2_BAD_INO 1 /* Bad blocks inode */ |
---|
| 3391 | +#define EXT2_ROOT_INO 2 /* Root inode */ |
---|
| 3392 | +#define EXT2_BOOT_LOADER_INO 5 /* Boot loader inode */ |
---|
| 3393 | +#define EXT2_UNDEL_DIR_INO 6 /* Undelete directory inode */ |
---|
| 3394 | + |
---|
| 3395 | +/* First non-reserved inode for old ext2 filesystems */ |
---|
| 3396 | +#define EXT2_GOOD_OLD_FIRST_INO 11 |
---|
| 3397 | + |
---|
| 3398 | +/* Assume that user mode programs are passing in an ext2fs superblock, not |
---|
| 3399 | + * a kernel struct super_block. This will allow us to call the feature-test |
---|
| 3400 | + * macros from user land. */ |
---|
| 3401 | +#define EXT2_SB(sb) (sb) |
---|
| 3402 | + |
---|
| 3403 | +/* |
---|
| 3404 | + * Maximal count of links to a file |
---|
| 3405 | + */ |
---|
| 3406 | +#define EXT2_LINK_MAX 32000 |
---|
| 3407 | + |
---|
| 3408 | +/* |
---|
| 3409 | + * Macro-instructions used to manage several block sizes |
---|
| 3410 | + */ |
---|
| 3411 | +#define EXT2_MIN_BLOCK_SIZE 1024 |
---|
| 3412 | +#define EXT2_MAX_BLOCK_SIZE 4096 |
---|
| 3413 | +#define EXT2_MIN_BLOCK_LOG_SIZE 10 |
---|
| 3414 | +# define EXT2_BLOCK_SIZE(s) (EXT2_MIN_BLOCK_SIZE << (s)->s_log_block_size) |
---|
| 3415 | +#define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (__u32)) |
---|
| 3416 | +# define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10) |
---|
| 3417 | +#define EXT2_INODE_SIZE(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \ |
---|
| 3418 | + EXT2_GOOD_OLD_INODE_SIZE : \ |
---|
| 3419 | + (s)->s_inode_size) |
---|
| 3420 | +#define EXT2_FIRST_INO(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \ |
---|
| 3421 | + EXT2_GOOD_OLD_FIRST_INO : \ |
---|
| 3422 | + (s)->s_first_ino) |
---|
| 3423 | + |
---|
| 3424 | +/* |
---|
| 3425 | + * Macro-instructions used to manage fragments |
---|
| 3426 | + */ |
---|
| 3427 | +#define EXT2_MIN_FRAG_SIZE 1024 |
---|
| 3428 | +#define EXT2_MAX_FRAG_SIZE 4096 |
---|
| 3429 | +#define EXT2_MIN_FRAG_LOG_SIZE 10 |
---|
| 3430 | +# define EXT2_FRAG_SIZE(s) (EXT2_MIN_FRAG_SIZE << (s)->s_log_frag_size) |
---|
| 3431 | +# define EXT2_FRAGS_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / EXT2_FRAG_SIZE(s)) |
---|
| 3432 | + |
---|
| 3433 | +/* |
---|
| 3434 | + * Structure of a blocks group descriptor |
---|
| 3435 | + */ |
---|
| 3436 | +struct ext2_group_desc |
---|
| 3437 | +{ |
---|
| 3438 | + __le32 bg_block_bitmap; /* Blocks bitmap block */ |
---|
| 3439 | + __le32 bg_inode_bitmap; /* Inodes bitmap block */ |
---|
| 3440 | + __le32 bg_inode_table; /* Inodes table block */ |
---|
| 3441 | + __le16 bg_free_blocks_count; /* Free blocks count */ |
---|
| 3442 | + __le16 bg_free_inodes_count; /* Free inodes count */ |
---|
| 3443 | + __le16 bg_used_dirs_count; /* Directories count */ |
---|
| 3444 | + __le16 bg_pad; |
---|
| 3445 | + __le32 bg_reserved[3]; |
---|
| 3446 | +}; |
---|
| 3447 | + |
---|
| 3448 | +/* |
---|
| 3449 | + * Macro-instructions used to manage group descriptors |
---|
| 3450 | + */ |
---|
| 3451 | +# define EXT2_BLOCKS_PER_GROUP(s) ((s)->s_blocks_per_group) |
---|
| 3452 | +# define EXT2_DESC_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_group_desc)) |
---|
| 3453 | +# define EXT2_INODES_PER_GROUP(s) ((s)->s_inodes_per_group) |
---|
| 3454 | + |
---|
| 3455 | +/* |
---|
| 3456 | + * Constants relative to the data blocks |
---|
| 3457 | + */ |
---|
| 3458 | +#define EXT2_NDIR_BLOCKS 12 |
---|
| 3459 | +#define EXT2_IND_BLOCK EXT2_NDIR_BLOCKS |
---|
| 3460 | +#define EXT2_DIND_BLOCK (EXT2_IND_BLOCK + 1) |
---|
| 3461 | +#define EXT2_TIND_BLOCK (EXT2_DIND_BLOCK + 1) |
---|
| 3462 | +#define EXT2_N_BLOCKS (EXT2_TIND_BLOCK + 1) |
---|
| 3463 | + |
---|
| 3464 | +/* |
---|
| 3465 | + * Inode flags (GETFLAGS/SETFLAGS) |
---|
| 3466 | + */ |
---|
| 3467 | +#define EXT2_SECRM_FL FS_SECRM_FL /* Secure deletion */ |
---|
| 3468 | +#define EXT2_UNRM_FL FS_UNRM_FL /* Undelete */ |
---|
| 3469 | +#define EXT2_COMPR_FL FS_COMPR_FL /* Compress file */ |
---|
| 3470 | +#define EXT2_SYNC_FL FS_SYNC_FL /* Synchronous updates */ |
---|
| 3471 | +#define EXT2_IMMUTABLE_FL FS_IMMUTABLE_FL /* Immutable file */ |
---|
| 3472 | +#define EXT2_APPEND_FL FS_APPEND_FL /* writes to file may only append */ |
---|
| 3473 | +#define EXT2_NODUMP_FL FS_NODUMP_FL /* do not dump file */ |
---|
| 3474 | +#define EXT2_NOATIME_FL FS_NOATIME_FL /* do not update atime */ |
---|
| 3475 | +/* Reserved for compression usage... */ |
---|
| 3476 | +#define EXT2_DIRTY_FL FS_DIRTY_FL |
---|
| 3477 | +#define EXT2_COMPRBLK_FL FS_COMPRBLK_FL /* One or more compressed clusters */ |
---|
| 3478 | +#define EXT2_NOCOMP_FL FS_NOCOMP_FL /* Don't compress */ |
---|
| 3479 | +#define EXT2_ECOMPR_FL FS_ECOMPR_FL /* Compression error */ |
---|
| 3480 | +/* End compression flags --- maybe not all used */ |
---|
| 3481 | +#define EXT2_BTREE_FL FS_BTREE_FL /* btree format dir */ |
---|
| 3482 | +#define EXT2_INDEX_FL FS_INDEX_FL /* hash-indexed directory */ |
---|
| 3483 | +#define EXT2_IMAGIC_FL FS_IMAGIC_FL /* AFS directory */ |
---|
| 3484 | +#define EXT2_JOURNAL_DATA_FL FS_JOURNAL_DATA_FL /* Reserved for ext3 */ |
---|
| 3485 | +#define EXT2_NOTAIL_FL FS_NOTAIL_FL /* file tail should not be merged */ |
---|
| 3486 | +#define EXT2_DIRSYNC_FL FS_DIRSYNC_FL /* dirsync behaviour (directories only) */ |
---|
| 3487 | +#define EXT2_TOPDIR_FL FS_TOPDIR_FL /* Top of directory hierarchies*/ |
---|
| 3488 | +#define EXT2_RESERVED_FL FS_RESERVED_FL /* reserved for ext2 lib */ |
---|
| 3489 | + |
---|
| 3490 | +#define EXT2_FL_USER_VISIBLE FS_FL_USER_VISIBLE /* User visible flags */ |
---|
| 3491 | +#define EXT2_FL_USER_MODIFIABLE FS_FL_USER_MODIFIABLE /* User modifiable flags */ |
---|
| 3492 | + |
---|
| 3493 | +/* |
---|
| 3494 | + * ioctl commands |
---|
| 3495 | + */ |
---|
| 3496 | +#define EXT2_IOC_GETFLAGS FS_IOC_GETFLAGS |
---|
| 3497 | +#define EXT2_IOC_SETFLAGS FS_IOC_SETFLAGS |
---|
| 3498 | +#define EXT2_IOC_GETVERSION FS_IOC_GETVERSION |
---|
| 3499 | +#define EXT2_IOC_SETVERSION FS_IOC_SETVERSION |
---|
| 3500 | + |
---|
| 3501 | +/* |
---|
| 3502 | + * ioctl commands in 32 bit emulation |
---|
| 3503 | + */ |
---|
| 3504 | +#define EXT2_IOC32_GETFLAGS FS_IOC32_GETFLAGS |
---|
| 3505 | +#define EXT2_IOC32_SETFLAGS FS_IOC32_SETFLAGS |
---|
| 3506 | +#define EXT2_IOC32_GETVERSION FS_IOC32_GETVERSION |
---|
| 3507 | +#define EXT2_IOC32_SETVERSION FS_IOC32_SETVERSION |
---|
| 3508 | + |
---|
| 3509 | +/* |
---|
| 3510 | + * Structure of an inode on the disk |
---|
| 3511 | + */ |
---|
| 3512 | +struct ext2_inode { |
---|
| 3513 | + __le16 i_mode; /* File mode */ |
---|
| 3514 | + __le16 i_uid; /* Low 16 bits of Owner Uid */ |
---|
| 3515 | + __le32 i_size; /* Size in bytes */ |
---|
| 3516 | + __le32 i_atime; /* Access time */ |
---|
| 3517 | + __le32 i_ctime; /* Creation time */ |
---|
| 3518 | + __le32 i_mtime; /* Modification time */ |
---|
| 3519 | + __le32 i_dtime; /* Deletion Time */ |
---|
| 3520 | + __le16 i_gid; /* Low 16 bits of Group Id */ |
---|
| 3521 | + __le16 i_links_count; /* Links count */ |
---|
| 3522 | + __le32 i_blocks; /* Blocks count */ |
---|
| 3523 | + __le32 i_flags; /* File flags */ |
---|
| 3524 | + union { |
---|
| 3525 | + struct { |
---|
| 3526 | + __le32 l_i_reserved1; |
---|
| 3527 | + } linux1; |
---|
| 3528 | + struct { |
---|
| 3529 | + __le32 h_i_translator; |
---|
| 3530 | + } hurd1; |
---|
| 3531 | + struct { |
---|
| 3532 | + __le32 m_i_reserved1; |
---|
| 3533 | + } masix1; |
---|
| 3534 | + } osd1; /* OS dependent 1 */ |
---|
| 3535 | + __le32 i_block[EXT2_N_BLOCKS];/* Pointers to blocks */ |
---|
| 3536 | + __le32 i_generation; /* File version (for NFS) */ |
---|
| 3537 | + __le32 i_file_acl; /* File ACL */ |
---|
| 3538 | + __le32 i_dir_acl; /* Directory ACL */ |
---|
| 3539 | + __le32 i_faddr; /* Fragment address */ |
---|
| 3540 | + union { |
---|
| 3541 | + struct { |
---|
| 3542 | + __u8 l_i_frag; /* Fragment number */ |
---|
| 3543 | + __u8 l_i_fsize; /* Fragment size */ |
---|
| 3544 | + __u16 i_pad1; |
---|
| 3545 | + __le16 l_i_uid_high; /* these 2 fields */ |
---|
| 3546 | + __le16 l_i_gid_high; /* were reserved2[0] */ |
---|
| 3547 | + __u32 l_i_reserved2; |
---|
| 3548 | + } linux2; |
---|
| 3549 | + struct { |
---|
| 3550 | + __u8 h_i_frag; /* Fragment number */ |
---|
| 3551 | + __u8 h_i_fsize; /* Fragment size */ |
---|
| 3552 | + __le16 h_i_mode_high; |
---|
| 3553 | + __le16 h_i_uid_high; |
---|
| 3554 | + __le16 h_i_gid_high; |
---|
| 3555 | + __le32 h_i_author; |
---|
| 3556 | + } hurd2; |
---|
| 3557 | + struct { |
---|
| 3558 | + __u8 m_i_frag; /* Fragment number */ |
---|
| 3559 | + __u8 m_i_fsize; /* Fragment size */ |
---|
| 3560 | + __u16 m_pad1; |
---|
| 3561 | + __u32 m_i_reserved2[2]; |
---|
| 3562 | + } masix2; |
---|
| 3563 | + } osd2; /* OS dependent 2 */ |
---|
| 3564 | +}; |
---|
| 3565 | + |
---|
| 3566 | +#define i_size_high i_dir_acl |
---|
| 3567 | + |
---|
| 3568 | +#if defined(__KERNEL__) || defined(__linux__) |
---|
| 3569 | +#define i_reserved1 osd1.linux1.l_i_reserved1 |
---|
| 3570 | +#define i_frag osd2.linux2.l_i_frag |
---|
| 3571 | +#define i_fsize osd2.linux2.l_i_fsize |
---|
| 3572 | +#define i_uid_low i_uid |
---|
| 3573 | +#define i_gid_low i_gid |
---|
| 3574 | +#define i_uid_high osd2.linux2.l_i_uid_high |
---|
| 3575 | +#define i_gid_high osd2.linux2.l_i_gid_high |
---|
| 3576 | +#define i_reserved2 osd2.linux2.l_i_reserved2 |
---|
| 3577 | +#endif |
---|
| 3578 | + |
---|
| 3579 | +#ifdef __hurd__ |
---|
| 3580 | +#define i_translator osd1.hurd1.h_i_translator |
---|
| 3581 | +#define i_frag osd2.hurd2.h_i_frag; |
---|
| 3582 | +#define i_fsize osd2.hurd2.h_i_fsize; |
---|
| 3583 | +#define i_uid_high osd2.hurd2.h_i_uid_high |
---|
| 3584 | +#define i_gid_high osd2.hurd2.h_i_gid_high |
---|
| 3585 | +#define i_author osd2.hurd2.h_i_author |
---|
| 3586 | +#endif |
---|
| 3587 | + |
---|
| 3588 | +#ifdef __masix__ |
---|
| 3589 | +#define i_reserved1 osd1.masix1.m_i_reserved1 |
---|
| 3590 | +#define i_frag osd2.masix2.m_i_frag |
---|
| 3591 | +#define i_fsize osd2.masix2.m_i_fsize |
---|
| 3592 | +#define i_reserved2 osd2.masix2.m_i_reserved2 |
---|
| 3593 | +#endif |
---|
| 3594 | + |
---|
| 3595 | +/* |
---|
| 3596 | + * File system states |
---|
| 3597 | + */ |
---|
| 3598 | +#define EXT2_VALID_FS 0x0001 /* Unmounted cleanly */ |
---|
| 3599 | +#define EXT2_ERROR_FS 0x0002 /* Errors detected */ |
---|
| 3600 | + |
---|
| 3601 | +/* |
---|
| 3602 | + * Mount flags |
---|
| 3603 | + */ |
---|
| 3604 | +#define EXT2_MOUNT_CHECK 0x000001 /* Do mount-time checks */ |
---|
| 3605 | +#define EXT2_MOUNT_OLDALLOC 0x000002 /* Don't use the new Orlov allocator */ |
---|
| 3606 | +#define EXT2_MOUNT_GRPID 0x000004 /* Create files with directory's group */ |
---|
| 3607 | +#define EXT2_MOUNT_DEBUG 0x000008 /* Some debugging messages */ |
---|
| 3608 | +#define EXT2_MOUNT_ERRORS_CONT 0x000010 /* Continue on errors */ |
---|
| 3609 | +#define EXT2_MOUNT_ERRORS_RO 0x000020 /* Remount fs ro on errors */ |
---|
| 3610 | +#define EXT2_MOUNT_ERRORS_PANIC 0x000040 /* Panic on errors */ |
---|
| 3611 | +#define EXT2_MOUNT_MINIX_DF 0x000080 /* Mimics the Minix statfs */ |
---|
| 3612 | +#define EXT2_MOUNT_NOBH 0x000100 /* No buffer_heads */ |
---|
| 3613 | +#define EXT2_MOUNT_NO_UID32 0x000200 /* Disable 32-bit UIDs */ |
---|
| 3614 | +#define EXT2_MOUNT_XATTR_USER 0x004000 /* Extended user attributes */ |
---|
| 3615 | +#define EXT2_MOUNT_POSIX_ACL 0x008000 /* POSIX Access Control Lists */ |
---|
| 3616 | +#define EXT2_MOUNT_XIP 0x010000 /* Execute in place */ |
---|
| 3617 | +#define EXT2_MOUNT_USRQUOTA 0x020000 /* user quota */ |
---|
| 3618 | +#define EXT2_MOUNT_GRPQUOTA 0x040000 /* group quota */ |
---|
| 3619 | + |
---|
| 3620 | + |
---|
| 3621 | +#define clear_opt(o, opt) o &= ~EXT2_MOUNT_##opt |
---|
| 3622 | +#define set_opt(o, opt) o |= EXT2_MOUNT_##opt |
---|
| 3623 | +#define test_opt(sb, opt) (EXT2_SB(sb)->s_mount_opt & \ |
---|
| 3624 | + EXT2_MOUNT_##opt) |
---|
| 3625 | +/* |
---|
| 3626 | + * Maximal mount counts between two filesystem checks |
---|
| 3627 | + */ |
---|
| 3628 | +#define EXT2_DFL_MAX_MNT_COUNT 20 /* Allow 20 mounts */ |
---|
| 3629 | +#define EXT2_DFL_CHECKINTERVAL 0 /* Don't use interval check */ |
---|
| 3630 | + |
---|
| 3631 | +/* |
---|
| 3632 | + * Behaviour when detecting errors |
---|
| 3633 | + */ |
---|
| 3634 | +#define EXT2_ERRORS_CONTINUE 1 /* Continue execution */ |
---|
| 3635 | +#define EXT2_ERRORS_RO 2 /* Remount fs read-only */ |
---|
| 3636 | +#define EXT2_ERRORS_PANIC 3 /* Panic */ |
---|
| 3637 | +#define EXT2_ERRORS_DEFAULT EXT2_ERRORS_CONTINUE |
---|
| 3638 | + |
---|
| 3639 | +/* |
---|
| 3640 | + * Structure of the super block |
---|
| 3641 | + */ |
---|
| 3642 | +struct ext2_super_block { |
---|
| 3643 | + __le32 s_inodes_count; /* Inodes count */ |
---|
| 3644 | + __le32 s_blocks_count; /* Blocks count */ |
---|
| 3645 | + __le32 s_r_blocks_count; /* Reserved blocks count */ |
---|
| 3646 | + __le32 s_free_blocks_count; /* Free blocks count */ |
---|
| 3647 | + __le32 s_free_inodes_count; /* Free inodes count */ |
---|
| 3648 | + __le32 s_first_data_block; /* First Data Block */ |
---|
| 3649 | + __le32 s_log_block_size; /* Block size */ |
---|
| 3650 | + __le32 s_log_frag_size; /* Fragment size */ |
---|
| 3651 | + __le32 s_blocks_per_group; /* # Blocks per group */ |
---|
| 3652 | + __le32 s_frags_per_group; /* # Fragments per group */ |
---|
| 3653 | + __le32 s_inodes_per_group; /* # Inodes per group */ |
---|
| 3654 | + __le32 s_mtime; /* Mount time */ |
---|
| 3655 | + __le32 s_wtime; /* Write time */ |
---|
| 3656 | + __le16 s_mnt_count; /* Mount count */ |
---|
| 3657 | + __le16 s_max_mnt_count; /* Maximal mount count */ |
---|
| 3658 | + __le16 s_magic; /* Magic signature */ |
---|
| 3659 | + __le16 s_state; /* File system state */ |
---|
| 3660 | + __le16 s_errors; /* Behaviour when detecting errors */ |
---|
| 3661 | + __le16 s_minor_rev_level; /* minor revision level */ |
---|
| 3662 | + __le32 s_lastcheck; /* time of last check */ |
---|
| 3663 | + __le32 s_checkinterval; /* max. time between checks */ |
---|
| 3664 | + __le32 s_creator_os; /* OS */ |
---|
| 3665 | + __le32 s_rev_level; /* Revision level */ |
---|
| 3666 | + __le16 s_def_resuid; /* Default uid for reserved blocks */ |
---|
| 3667 | + __le16 s_def_resgid; /* Default gid for reserved blocks */ |
---|
| 3668 | + /* |
---|
| 3669 | + * These fields are for EXT2_DYNAMIC_REV superblocks only. |
---|
| 3670 | + * |
---|
| 3671 | + * Note: the difference between the compatible feature set and |
---|
| 3672 | + * the incompatible feature set is that if there is a bit set |
---|
| 3673 | + * in the incompatible feature set that the kernel doesn't |
---|
| 3674 | + * know about, it should refuse to mount the filesystem. |
---|
| 3675 | + * |
---|
| 3676 | + * e2fsck's requirements are more strict; if it doesn't know |
---|
| 3677 | + * about a feature in either the compatible or incompatible |
---|
| 3678 | + * feature set, it must abort and not try to meddle with |
---|
| 3679 | + * things it doesn't understand... |
---|
| 3680 | + */ |
---|
| 3681 | + __le32 s_first_ino; /* First non-reserved inode */ |
---|
| 3682 | + __le16 s_inode_size; /* size of inode structure */ |
---|
| 3683 | + __le16 s_block_group_nr; /* block group # of this superblock */ |
---|
| 3684 | + __le32 s_feature_compat; /* compatible feature set */ |
---|
| 3685 | + __le32 s_feature_incompat; /* incompatible feature set */ |
---|
| 3686 | + __le32 s_feature_ro_compat; /* readonly-compatible feature set */ |
---|
| 3687 | + __u8 s_uuid[16]; /* 128-bit uuid for volume */ |
---|
| 3688 | + char s_volume_name[16]; /* volume name */ |
---|
| 3689 | + char s_last_mounted[64]; /* directory where last mounted */ |
---|
| 3690 | + __le32 s_algorithm_usage_bitmap; /* For compression */ |
---|
| 3691 | + /* |
---|
| 3692 | + * Performance hints. Directory preallocation should only |
---|
| 3693 | + * happen if the EXT2_COMPAT_PREALLOC flag is on. |
---|
| 3694 | + */ |
---|
| 3695 | + __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/ |
---|
| 3696 | + __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */ |
---|
| 3697 | + __u16 s_padding1; |
---|
| 3698 | + /* |
---|
| 3699 | + * Journaling support valid if EXT3_FEATURE_COMPAT_HAS_JOURNAL set. |
---|
| 3700 | + */ |
---|
| 3701 | + __u8 s_journal_uuid[16]; /* uuid of journal superblock */ |
---|
| 3702 | + __u32 s_journal_inum; /* inode number of journal file */ |
---|
| 3703 | + __u32 s_journal_dev; /* device number of journal file */ |
---|
| 3704 | + __u32 s_last_orphan; /* start of list of inodes to delete */ |
---|
| 3705 | + __u32 s_hash_seed[4]; /* HTREE hash seed */ |
---|
| 3706 | + __u8 s_def_hash_version; /* Default hash version to use */ |
---|
| 3707 | + __u8 s_reserved_char_pad; |
---|
| 3708 | + __u16 s_reserved_word_pad; |
---|
| 3709 | + __le32 s_default_mount_opts; |
---|
| 3710 | + __le32 s_first_meta_bg; /* First metablock block group */ |
---|
| 3711 | + __u32 s_reserved[190]; /* Padding to the end of the block */ |
---|
| 3712 | +}; |
---|
| 3713 | + |
---|
| 3714 | +/* |
---|
| 3715 | + * Codes for operating systems |
---|
| 3716 | + */ |
---|
| 3717 | +#define EXT2_OS_LINUX 0 |
---|
| 3718 | +#define EXT2_OS_HURD 1 |
---|
| 3719 | +#define EXT2_OS_MASIX 2 |
---|
| 3720 | +#define EXT2_OS_FREEBSD 3 |
---|
| 3721 | +#define EXT2_OS_LITES 4 |
---|
| 3722 | + |
---|
| 3723 | +/* |
---|
| 3724 | + * Revision levels |
---|
| 3725 | + */ |
---|
| 3726 | +#define EXT2_GOOD_OLD_REV 0 /* The good old (original) format */ |
---|
| 3727 | +#define EXT2_DYNAMIC_REV 1 /* V2 format w/ dynamic inode sizes */ |
---|
| 3728 | + |
---|
| 3729 | +#define EXT2_CURRENT_REV EXT2_GOOD_OLD_REV |
---|
| 3730 | +#define EXT2_MAX_SUPP_REV EXT2_DYNAMIC_REV |
---|
| 3731 | + |
---|
| 3732 | +#define EXT2_GOOD_OLD_INODE_SIZE 128 |
---|
| 3733 | + |
---|
| 3734 | +/* |
---|
| 3735 | + * Feature set definitions |
---|
| 3736 | + */ |
---|
| 3737 | + |
---|
| 3738 | +#define EXT2_HAS_COMPAT_FEATURE(sb,mask) \ |
---|
| 3739 | + ( EXT2_SB(sb)->s_es->s_feature_compat & cpu_to_le32(mask) ) |
---|
| 3740 | +#define EXT2_HAS_RO_COMPAT_FEATURE(sb,mask) \ |
---|
| 3741 | + ( EXT2_SB(sb)->s_es->s_feature_ro_compat & cpu_to_le32(mask) ) |
---|
| 3742 | +#define EXT2_HAS_INCOMPAT_FEATURE(sb,mask) \ |
---|
| 3743 | + ( EXT2_SB(sb)->s_es->s_feature_incompat & cpu_to_le32(mask) ) |
---|
| 3744 | +#define EXT2_SET_COMPAT_FEATURE(sb,mask) \ |
---|
| 3745 | + EXT2_SB(sb)->s_es->s_feature_compat |= cpu_to_le32(mask) |
---|
| 3746 | +#define EXT2_SET_RO_COMPAT_FEATURE(sb,mask) \ |
---|
| 3747 | + EXT2_SB(sb)->s_es->s_feature_ro_compat |= cpu_to_le32(mask) |
---|
| 3748 | +#define EXT2_SET_INCOMPAT_FEATURE(sb,mask) \ |
---|
| 3749 | + EXT2_SB(sb)->s_es->s_feature_incompat |= cpu_to_le32(mask) |
---|
| 3750 | +#define EXT2_CLEAR_COMPAT_FEATURE(sb,mask) \ |
---|
| 3751 | + EXT2_SB(sb)->s_es->s_feature_compat &= ~cpu_to_le32(mask) |
---|
| 3752 | +#define EXT2_CLEAR_RO_COMPAT_FEATURE(sb,mask) \ |
---|
| 3753 | + EXT2_SB(sb)->s_es->s_feature_ro_compat &= ~cpu_to_le32(mask) |
---|
| 3754 | +#define EXT2_CLEAR_INCOMPAT_FEATURE(sb,mask) \ |
---|
| 3755 | + EXT2_SB(sb)->s_es->s_feature_incompat &= ~cpu_to_le32(mask) |
---|
| 3756 | + |
---|
| 3757 | +#define EXT2_FEATURE_COMPAT_DIR_PREALLOC 0x0001 |
---|
| 3758 | +#define EXT2_FEATURE_COMPAT_IMAGIC_INODES 0x0002 |
---|
| 3759 | +#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004 |
---|
| 3760 | +#define EXT2_FEATURE_COMPAT_EXT_ATTR 0x0008 |
---|
| 3761 | +#define EXT2_FEATURE_COMPAT_RESIZE_INO 0x0010 |
---|
| 3762 | +#define EXT2_FEATURE_COMPAT_DIR_INDEX 0x0020 |
---|
| 3763 | +#define EXT2_FEATURE_COMPAT_ANY 0xffffffff |
---|
| 3764 | + |
---|
| 3765 | +#define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001 |
---|
| 3766 | +#define EXT2_FEATURE_RO_COMPAT_LARGE_FILE 0x0002 |
---|
| 3767 | +#define EXT2_FEATURE_RO_COMPAT_BTREE_DIR 0x0004 |
---|
| 3768 | +#define EXT2_FEATURE_RO_COMPAT_ANY 0xffffffff |
---|
| 3769 | + |
---|
| 3770 | +#define EXT2_FEATURE_INCOMPAT_COMPRESSION 0x0001 |
---|
| 3771 | +#define EXT2_FEATURE_INCOMPAT_FILETYPE 0x0002 |
---|
| 3772 | +#define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004 |
---|
| 3773 | +#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008 |
---|
| 3774 | +#define EXT2_FEATURE_INCOMPAT_META_BG 0x0010 |
---|
| 3775 | +#define EXT2_FEATURE_INCOMPAT_ANY 0xffffffff |
---|
| 3776 | + |
---|
| 3777 | +#define EXT2_FEATURE_COMPAT_SUPP EXT2_FEATURE_COMPAT_EXT_ATTR |
---|
| 3778 | +#define EXT2_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE| \ |
---|
| 3779 | + EXT2_FEATURE_INCOMPAT_META_BG) |
---|
| 3780 | +#define EXT2_FEATURE_RO_COMPAT_SUPP (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER| \ |
---|
| 3781 | + EXT2_FEATURE_RO_COMPAT_LARGE_FILE| \ |
---|
| 3782 | + EXT2_FEATURE_RO_COMPAT_BTREE_DIR) |
---|
| 3783 | +#define EXT2_FEATURE_RO_COMPAT_UNSUPPORTED ~EXT2_FEATURE_RO_COMPAT_SUPP |
---|
| 3784 | +#define EXT2_FEATURE_INCOMPAT_UNSUPPORTED ~EXT2_FEATURE_INCOMPAT_SUPP |
---|
| 3785 | + |
---|
| 3786 | +/* |
---|
| 3787 | + * Default values for user and/or group using reserved blocks |
---|
| 3788 | + */ |
---|
| 3789 | +#define EXT2_DEF_RESUID 0 |
---|
| 3790 | +#define EXT2_DEF_RESGID 0 |
---|
| 3791 | + |
---|
| 3792 | +/* |
---|
| 3793 | + * Default mount options |
---|
| 3794 | + */ |
---|
| 3795 | +#define EXT2_DEFM_DEBUG 0x0001 |
---|
| 3796 | +#define EXT2_DEFM_BSDGROUPS 0x0002 |
---|
| 3797 | +#define EXT2_DEFM_XATTR_USER 0x0004 |
---|
| 3798 | +#define EXT2_DEFM_ACL 0x0008 |
---|
| 3799 | +#define EXT2_DEFM_UID16 0x0010 |
---|
| 3800 | + /* Not used by ext2, but reserved for use by ext3 */ |
---|
| 3801 | +#define EXT3_DEFM_JMODE 0x0060 |
---|
| 3802 | +#define EXT3_DEFM_JMODE_DATA 0x0020 |
---|
| 3803 | +#define EXT3_DEFM_JMODE_ORDERED 0x0040 |
---|
| 3804 | +#define EXT3_DEFM_JMODE_WBACK 0x0060 |
---|
| 3805 | + |
---|
| 3806 | +/* |
---|
| 3807 | + * Structure of a directory entry |
---|
| 3808 | + */ |
---|
| 3809 | +#define EXT2_NAME_LEN 255 |
---|
| 3810 | + |
---|
| 3811 | +struct ext2_dir_entry { |
---|
| 3812 | + __le32 inode; /* Inode number */ |
---|
| 3813 | + __le16 rec_len; /* Directory entry length */ |
---|
| 3814 | + __le16 name_len; /* Name length */ |
---|
| 3815 | + char name[EXT2_NAME_LEN]; /* File name */ |
---|
| 3816 | +}; |
---|
| 3817 | + |
---|
| 3818 | +/* |
---|
| 3819 | + * The new version of the directory entry. Since EXT2 structures are |
---|
| 3820 | + * stored in intel byte order, and the name_len field could never be |
---|
| 3821 | + * bigger than 255 chars, it's safe to reclaim the extra byte for the |
---|
| 3822 | + * file_type field. |
---|
| 3823 | + */ |
---|
| 3824 | +struct ext2_dir_entry_2 { |
---|
| 3825 | + __le32 inode; /* Inode number */ |
---|
| 3826 | + __le16 rec_len; /* Directory entry length */ |
---|
| 3827 | + __u8 name_len; /* Name length */ |
---|
| 3828 | + __u8 file_type; |
---|
| 3829 | + char name[EXT2_NAME_LEN]; /* File name */ |
---|
| 3830 | +}; |
---|
| 3831 | + |
---|
| 3832 | +/* |
---|
| 3833 | + * Ext2 directory file types. Only the low 3 bits are used. The |
---|
| 3834 | + * other bits are reserved for now. |
---|
| 3835 | + */ |
---|
| 3836 | +enum { |
---|
| 3837 | + EXT2_FT_UNKNOWN, |
---|
| 3838 | + EXT2_FT_REG_FILE, |
---|
| 3839 | + EXT2_FT_DIR, |
---|
| 3840 | + EXT2_FT_CHRDEV, |
---|
| 3841 | + EXT2_FT_BLKDEV, |
---|
| 3842 | + EXT2_FT_FIFO, |
---|
| 3843 | + EXT2_FT_SOCK, |
---|
| 3844 | + EXT2_FT_SYMLINK, |
---|
| 3845 | + EXT2_FT_MAX |
---|
| 3846 | +}; |
---|
| 3847 | + |
---|
| 3848 | +/* |
---|
| 3849 | + * EXT2_DIR_PAD defines the directory entries boundaries |
---|
| 3850 | + * |
---|
| 3851 | + * NOTE: It must be a multiple of 4 |
---|
| 3852 | + */ |
---|
| 3853 | +#define EXT2_DIR_PAD 4 |
---|
| 3854 | +#define EXT2_DIR_ROUND (EXT2_DIR_PAD - 1) |
---|
| 3855 | +#define EXT2_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT2_DIR_ROUND) & \ |
---|
| 3856 | + ~EXT2_DIR_ROUND) |
---|
| 3857 | + |
---|
| 3858 | +#endif /* _LINUX_EXT2_FS_H */ |
---|
| 3859 | diff -Naur aboot-0.9b.orig/include/linux/fs.h aboot-0.9b/include/linux/fs.h |
---|
| 3860 | --- aboot-0.9b.orig/include/linux/fs.h 1969-12-31 19:00:00.000000000 -0500 |
---|
| 3861 | +++ aboot-0.9b/include/linux/fs.h 2008-01-02 13:53:15.000000000 -0500 |
---|
| 3862 | @@ -0,0 +1,269 @@ |
---|
| 3863 | +#ifndef _LINUX_FS_H |
---|
| 3864 | +#define _LINUX_FS_H |
---|
| 3865 | + |
---|
| 3866 | +/* |
---|
| 3867 | + * This file has definitions for some important file table |
---|
| 3868 | + * structures etc. |
---|
| 3869 | + */ |
---|
| 3870 | + |
---|
| 3871 | +#include <linux/limits.h> |
---|
| 3872 | +#include <linux/ioctl.h> |
---|
| 3873 | + |
---|
| 3874 | +/* |
---|
| 3875 | + * It's silly to have NR_OPEN bigger than NR_FILE, but you can change |
---|
| 3876 | + * the file limit at runtime and only root can increase the per-process |
---|
| 3877 | + * nr_file rlimit, so it's safe to set up a ridiculously high absolute |
---|
| 3878 | + * upper limit on files-per-process. |
---|
| 3879 | + * |
---|
| 3880 | + * Some programs (notably those using select()) may have to be |
---|
| 3881 | + * recompiled to take full advantage of the new limits.. |
---|
| 3882 | + */ |
---|
| 3883 | + |
---|
| 3884 | +/* Fixed constants first: */ |
---|
| 3885 | +#undef NR_OPEN |
---|
| 3886 | +#define NR_OPEN (1024*1024) /* Absolute upper limit on fd num */ |
---|
| 3887 | +#define INR_OPEN 1024 /* Initial setting for nfile rlimits */ |
---|
| 3888 | + |
---|
| 3889 | +#define BLOCK_SIZE_BITS 10 |
---|
| 3890 | +#define BLOCK_SIZE (1<<BLOCK_SIZE_BITS) |
---|
| 3891 | + |
---|
| 3892 | +#define SEEK_SET 0 /* seek relative to beginning of file */ |
---|
| 3893 | +#define SEEK_CUR 1 /* seek relative to current file position */ |
---|
| 3894 | +#define SEEK_END 2 /* seek relative to end of file */ |
---|
| 3895 | +#define SEEK_MAX SEEK_END |
---|
| 3896 | + |
---|
| 3897 | +/* And dynamically-tunable limits and defaults: */ |
---|
| 3898 | +struct files_stat_struct { |
---|
| 3899 | + int nr_files; /* read only */ |
---|
| 3900 | + int nr_free_files; /* read only */ |
---|
| 3901 | + int max_files; /* tunable */ |
---|
| 3902 | +}; |
---|
| 3903 | +extern struct files_stat_struct files_stat; |
---|
| 3904 | +extern int get_max_files(void); |
---|
| 3905 | + |
---|
| 3906 | +struct inodes_stat_t { |
---|
| 3907 | + int nr_inodes; |
---|
| 3908 | + int nr_unused; |
---|
| 3909 | + int dummy[5]; /* padding for sysctl ABI compatibility */ |
---|
| 3910 | +}; |
---|
| 3911 | +extern struct inodes_stat_t inodes_stat; |
---|
| 3912 | + |
---|
| 3913 | +extern int leases_enable, lease_break_time; |
---|
| 3914 | + |
---|
| 3915 | +#ifdef CONFIG_DNOTIFY |
---|
| 3916 | +extern int dir_notify_enable; |
---|
| 3917 | +#endif |
---|
| 3918 | + |
---|
| 3919 | +#define NR_FILE 8192 /* this can well be larger on a larger system */ |
---|
| 3920 | + |
---|
| 3921 | +#define MAY_EXEC 1 |
---|
| 3922 | +#define MAY_WRITE 2 |
---|
| 3923 | +#define MAY_READ 4 |
---|
| 3924 | +#define MAY_APPEND 8 |
---|
| 3925 | + |
---|
| 3926 | +#define FMODE_READ 1 |
---|
| 3927 | +#define FMODE_WRITE 2 |
---|
| 3928 | + |
---|
| 3929 | +/* Internal kernel extensions */ |
---|
| 3930 | +#define FMODE_LSEEK 4 |
---|
| 3931 | +#define FMODE_PREAD 8 |
---|
| 3932 | +#define FMODE_PWRITE FMODE_PREAD /* These go hand in hand */ |
---|
| 3933 | + |
---|
| 3934 | +/* File is being opened for execution. Primary users of this flag are |
---|
| 3935 | + distributed filesystems that can use it to achieve correct ETXTBUSY |
---|
| 3936 | + behavior for cross-node execution/opening_for_writing of files */ |
---|
| 3937 | +#define FMODE_EXEC 16 |
---|
| 3938 | + |
---|
| 3939 | +#define RW_MASK 1 |
---|
| 3940 | +#define RWA_MASK 2 |
---|
| 3941 | +#define READ 0 |
---|
| 3942 | +#define WRITE 1 |
---|
| 3943 | +#define READA 2 /* read-ahead - don't block if no resources */ |
---|
| 3944 | +#define SWRITE 3 /* for ll_rw_block() - wait for buffer lock */ |
---|
| 3945 | +#define READ_SYNC (READ | (1 << BIO_RW_SYNC)) |
---|
| 3946 | +#define READ_META (READ | (1 << BIO_RW_META)) |
---|
| 3947 | +#define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNC)) |
---|
| 3948 | +#define WRITE_BARRIER ((1 << BIO_RW) | (1 << BIO_RW_BARRIER)) |
---|
| 3949 | + |
---|
| 3950 | +#define SEL_IN 1 |
---|
| 3951 | +#define SEL_OUT 2 |
---|
| 3952 | +#define SEL_EX 4 |
---|
| 3953 | + |
---|
| 3954 | +/* public flags for file_system_type */ |
---|
| 3955 | +#define FS_REQUIRES_DEV 1 |
---|
| 3956 | +#define FS_BINARY_MOUNTDATA 2 |
---|
| 3957 | +#define FS_HAS_SUBTYPE 4 |
---|
| 3958 | +#define FS_REVAL_DOT 16384 /* Check the paths ".", ".." for staleness */ |
---|
| 3959 | +#define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move() |
---|
| 3960 | + * during rename() internally. |
---|
| 3961 | + */ |
---|
| 3962 | + |
---|
| 3963 | +/* |
---|
| 3964 | + * These are the fs-independent mount-flags: up to 32 flags are supported |
---|
| 3965 | + */ |
---|
| 3966 | +#define MS_RDONLY 1 /* Mount read-only */ |
---|
| 3967 | +#define MS_NOSUID 2 /* Ignore suid and sgid bits */ |
---|
| 3968 | +#define MS_NODEV 4 /* Disallow access to device special files */ |
---|
| 3969 | +#define MS_NOEXEC 8 /* Disallow program execution */ |
---|
| 3970 | +#define MS_SYNCHRONOUS 16 /* Writes are synced at once */ |
---|
| 3971 | +#define MS_REMOUNT 32 /* Alter flags of a mounted FS */ |
---|
| 3972 | +#define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */ |
---|
| 3973 | +#define MS_DIRSYNC 128 /* Directory modifications are synchronous */ |
---|
| 3974 | +#define MS_NOATIME 1024 /* Do not update access times. */ |
---|
| 3975 | +#define MS_NODIRATIME 2048 /* Do not update directory access times */ |
---|
| 3976 | +#define MS_BIND 4096 |
---|
| 3977 | +#define MS_MOVE 8192 |
---|
| 3978 | +#define MS_REC 16384 |
---|
| 3979 | +#define MS_VERBOSE 32768 /* War is peace. Verbosity is silence. |
---|
| 3980 | + MS_VERBOSE is deprecated. */ |
---|
| 3981 | +#define MS_SILENT 32768 |
---|
| 3982 | +#define MS_POSIXACL (1<<16) /* VFS does not apply the umask */ |
---|
| 3983 | +#define MS_UNBINDABLE (1<<17) /* change to unbindable */ |
---|
| 3984 | +#define MS_PRIVATE (1<<18) /* change to private */ |
---|
| 3985 | +#define MS_SLAVE (1<<19) /* change to slave */ |
---|
| 3986 | +#define MS_SHARED (1<<20) /* change to shared */ |
---|
| 3987 | +#define MS_RELATIME (1<<21) /* Update atime relative to mtime/ctime. */ |
---|
| 3988 | +#define MS_ACTIVE (1<<30) |
---|
| 3989 | +#define MS_NOUSER (1<<31) |
---|
| 3990 | + |
---|
| 3991 | +/* |
---|
| 3992 | + * Superblock flags that can be altered by MS_REMOUNT |
---|
| 3993 | + */ |
---|
| 3994 | +#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK) |
---|
| 3995 | + |
---|
| 3996 | +/* |
---|
| 3997 | + * Old magic mount flag and mask |
---|
| 3998 | + */ |
---|
| 3999 | +#define MS_MGC_VAL 0xC0ED0000 |
---|
| 4000 | +#define MS_MGC_MSK 0xffff0000 |
---|
| 4001 | + |
---|
| 4002 | +/* Inode flags - they have nothing to superblock flags now */ |
---|
| 4003 | + |
---|
| 4004 | +#define S_SYNC 1 /* Writes are synced at once */ |
---|
| 4005 | +#define S_NOATIME 2 /* Do not update access times */ |
---|
| 4006 | +#define S_APPEND 4 /* Append-only file */ |
---|
| 4007 | +#define S_IMMUTABLE 8 /* Immutable file */ |
---|
| 4008 | +#define S_DEAD 16 /* removed, but still open directory */ |
---|
| 4009 | +#define S_NOQUOTA 32 /* Inode is not counted to quota */ |
---|
| 4010 | +#define S_DIRSYNC 64 /* Directory modifications are synchronous */ |
---|
| 4011 | +#define S_NOCMTIME 128 /* Do not update file c/mtime */ |
---|
| 4012 | +#define S_SWAPFILE 256 /* Do not truncate: swapon got its bmaps */ |
---|
| 4013 | +#define S_PRIVATE 512 /* Inode is fs-internal */ |
---|
| 4014 | + |
---|
| 4015 | +/* |
---|
| 4016 | + * Note that nosuid etc flags are inode-specific: setting some file-system |
---|
| 4017 | + * flags just means all the inodes inherit those flags by default. It might be |
---|
| 4018 | + * possible to override it selectively if you really wanted to with some |
---|
| 4019 | + * ioctl() that is not currently implemented. |
---|
| 4020 | + * |
---|
| 4021 | + * Exception: MS_RDONLY is always applied to the entire file system. |
---|
| 4022 | + * |
---|
| 4023 | + * Unfortunately, it is possible to change a filesystems flags with it mounted |
---|
| 4024 | + * with files in use. This means that all of the inodes will not have their |
---|
| 4025 | + * i_flags updated. Hence, i_flags no longer inherit the superblock mount |
---|
| 4026 | + * flags, so these have to be checked separately. -- rmk@arm.uk.linux.org |
---|
| 4027 | + */ |
---|
| 4028 | +#define __IS_FLG(inode,flg) ((inode)->i_sb->s_flags & (flg)) |
---|
| 4029 | + |
---|
| 4030 | +#define IS_RDONLY(inode) ((inode)->i_sb->s_flags & MS_RDONLY) |
---|
| 4031 | +#define IS_SYNC(inode) (__IS_FLG(inode, MS_SYNCHRONOUS) || \ |
---|
| 4032 | + ((inode)->i_flags & S_SYNC)) |
---|
| 4033 | +#define IS_DIRSYNC(inode) (__IS_FLG(inode, MS_SYNCHRONOUS|MS_DIRSYNC) || \ |
---|
| 4034 | + ((inode)->i_flags & (S_SYNC|S_DIRSYNC))) |
---|
| 4035 | +#define IS_MANDLOCK(inode) __IS_FLG(inode, MS_MANDLOCK) |
---|
| 4036 | +#define IS_NOATIME(inode) __IS_FLG(inode, MS_RDONLY|MS_NOATIME) |
---|
| 4037 | + |
---|
| 4038 | +#define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA) |
---|
| 4039 | +#define IS_APPEND(inode) ((inode)->i_flags & S_APPEND) |
---|
| 4040 | +#define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE) |
---|
| 4041 | +#define IS_POSIXACL(inode) __IS_FLG(inode, MS_POSIXACL) |
---|
| 4042 | + |
---|
| 4043 | +#define IS_DEADDIR(inode) ((inode)->i_flags & S_DEAD) |
---|
| 4044 | +#define IS_NOCMTIME(inode) ((inode)->i_flags & S_NOCMTIME) |
---|
| 4045 | +#define IS_SWAPFILE(inode) ((inode)->i_flags & S_SWAPFILE) |
---|
| 4046 | +#define IS_PRIVATE(inode) ((inode)->i_flags & S_PRIVATE) |
---|
| 4047 | + |
---|
| 4048 | +/* the read-only stuff doesn't really belong here, but any other place is |
---|
| 4049 | + probably as bad and I don't want to create yet another include file. */ |
---|
| 4050 | + |
---|
| 4051 | +#define BLKROSET _IO(0x12,93) /* set device read-only (0 = read-write) */ |
---|
| 4052 | +#define BLKROGET _IO(0x12,94) /* get read-only status (0 = read_write) */ |
---|
| 4053 | +#define BLKRRPART _IO(0x12,95) /* re-read partition table */ |
---|
| 4054 | +#define BLKGETSIZE _IO(0x12,96) /* return device size /512 (long *arg) */ |
---|
| 4055 | +#define BLKFLSBUF _IO(0x12,97) /* flush buffer cache */ |
---|
| 4056 | +#define BLKRASET _IO(0x12,98) /* set read ahead for block device */ |
---|
| 4057 | +#define BLKRAGET _IO(0x12,99) /* get current read ahead setting */ |
---|
| 4058 | +#define BLKFRASET _IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */ |
---|
| 4059 | +#define BLKFRAGET _IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */ |
---|
| 4060 | +#define BLKSECTSET _IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */ |
---|
| 4061 | +#define BLKSECTGET _IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */ |
---|
| 4062 | +#define BLKSSZGET _IO(0x12,104)/* get block device sector size */ |
---|
| 4063 | +#if 0 |
---|
| 4064 | +#define BLKPG _IO(0x12,105)/* See blkpg.h */ |
---|
| 4065 | + |
---|
| 4066 | +/* Some people are morons. Do not use sizeof! */ |
---|
| 4067 | + |
---|
| 4068 | +#define BLKELVGET _IOR(0x12,106,size_t)/* elevator get */ |
---|
| 4069 | +#define BLKELVSET _IOW(0x12,107,size_t)/* elevator set */ |
---|
| 4070 | +/* This was here just to show that the number is taken - |
---|
| 4071 | + probably all these _IO(0x12,*) ioctls should be moved to blkpg.h. */ |
---|
| 4072 | +#endif |
---|
| 4073 | +/* A jump here: 108-111 have been used for various private purposes. */ |
---|
| 4074 | +#define BLKBSZGET _IOR(0x12,112,size_t) |
---|
| 4075 | +#define BLKBSZSET _IOW(0x12,113,size_t) |
---|
| 4076 | +#define BLKGETSIZE64 _IOR(0x12,114,size_t) /* return device size in bytes (u64 *arg) */ |
---|
| 4077 | +#define BLKTRACESETUP _IOWR(0x12,115,struct blk_user_trace_setup) |
---|
| 4078 | +#define BLKTRACESTART _IO(0x12,116) |
---|
| 4079 | +#define BLKTRACESTOP _IO(0x12,117) |
---|
| 4080 | +#define BLKTRACETEARDOWN _IO(0x12,118) |
---|
| 4081 | + |
---|
| 4082 | +#define BMAP_IOCTL 1 /* obsolete - kept for compatibility */ |
---|
| 4083 | +#define FIBMAP _IO(0x00,1) /* bmap access */ |
---|
| 4084 | +#define FIGETBSZ _IO(0x00,2) /* get the block size used for bmap */ |
---|
| 4085 | + |
---|
| 4086 | +#define FS_IOC_GETFLAGS _IOR('f', 1, long) |
---|
| 4087 | +#define FS_IOC_SETFLAGS _IOW('f', 2, long) |
---|
| 4088 | +#define FS_IOC_GETVERSION _IOR('v', 1, long) |
---|
| 4089 | +#define FS_IOC_SETVERSION _IOW('v', 2, long) |
---|
| 4090 | +#define FS_IOC32_GETFLAGS _IOR('f', 1, int) |
---|
| 4091 | +#define FS_IOC32_SETFLAGS _IOW('f', 2, int) |
---|
| 4092 | +#define FS_IOC32_GETVERSION _IOR('v', 1, int) |
---|
| 4093 | +#define FS_IOC32_SETVERSION _IOW('v', 2, int) |
---|
| 4094 | + |
---|
| 4095 | +/* |
---|
| 4096 | + * Inode flags (FS_IOC_GETFLAGS / FS_IOC_SETFLAGS) |
---|
| 4097 | + */ |
---|
| 4098 | +#define FS_SECRM_FL 0x00000001 /* Secure deletion */ |
---|
| 4099 | +#define FS_UNRM_FL 0x00000002 /* Undelete */ |
---|
| 4100 | +#define FS_COMPR_FL 0x00000004 /* Compress file */ |
---|
| 4101 | +#define FS_SYNC_FL 0x00000008 /* Synchronous updates */ |
---|
| 4102 | +#define FS_IMMUTABLE_FL 0x00000010 /* Immutable file */ |
---|
| 4103 | +#define FS_APPEND_FL 0x00000020 /* writes to file may only append */ |
---|
| 4104 | +#define FS_NODUMP_FL 0x00000040 /* do not dump file */ |
---|
| 4105 | +#define FS_NOATIME_FL 0x00000080 /* do not update atime */ |
---|
| 4106 | +/* Reserved for compression usage... */ |
---|
| 4107 | +#define FS_DIRTY_FL 0x00000100 |
---|
| 4108 | +#define FS_COMPRBLK_FL 0x00000200 /* One or more compressed clusters */ |
---|
| 4109 | +#define FS_NOCOMP_FL 0x00000400 /* Don't compress */ |
---|
| 4110 | +#define FS_ECOMPR_FL 0x00000800 /* Compression error */ |
---|
| 4111 | +/* End compression flags --- maybe not all used */ |
---|
| 4112 | +#define FS_BTREE_FL 0x00001000 /* btree format dir */ |
---|
| 4113 | +#define FS_INDEX_FL 0x00001000 /* hash-indexed directory */ |
---|
| 4114 | +#define FS_IMAGIC_FL 0x00002000 /* AFS directory */ |
---|
| 4115 | +#define FS_JOURNAL_DATA_FL 0x00004000 /* Reserved for ext3 */ |
---|
| 4116 | +#define FS_NOTAIL_FL 0x00008000 /* file tail should not be merged */ |
---|
| 4117 | +#define FS_DIRSYNC_FL 0x00010000 /* dirsync behaviour (directories only) */ |
---|
| 4118 | +#define FS_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/ |
---|
| 4119 | +#define FS_EXTENT_FL 0x00080000 /* Extents */ |
---|
| 4120 | +#define FS_DIRECTIO_FL 0x00100000 /* Use direct i/o */ |
---|
| 4121 | +#define FS_RESERVED_FL 0x80000000 /* reserved for ext2 lib */ |
---|
| 4122 | + |
---|
| 4123 | +#define FS_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */ |
---|
| 4124 | +#define FS_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */ |
---|
| 4125 | + |
---|
| 4126 | + |
---|
| 4127 | +#define SYNC_FILE_RANGE_WAIT_BEFORE 1 |
---|
| 4128 | +#define SYNC_FILE_RANGE_WRITE 2 |
---|
| 4129 | +#define SYNC_FILE_RANGE_WAIT_AFTER 4 |
---|
| 4130 | + |
---|
| 4131 | +#endif /* _LINUX_FS_H */ |
---|
| 4132 | diff -Naur aboot-0.9b.orig/include/linux/hdreg.h aboot-0.9b/include/linux/hdreg.h |
---|
| 4133 | --- aboot-0.9b.orig/include/linux/hdreg.h 1969-12-31 19:00:00.000000000 -0500 |
---|
| 4134 | +++ aboot-0.9b/include/linux/hdreg.h 2008-01-02 13:53:15.000000000 -0500 |
---|
| 4135 | @@ -0,0 +1,647 @@ |
---|
| 4136 | +#ifndef _LINUX_HDREG_H |
---|
| 4137 | +#define _LINUX_HDREG_H |
---|
| 4138 | + |
---|
| 4139 | + |
---|
| 4140 | +#include <linux/types.h> |
---|
| 4141 | + |
---|
| 4142 | +/* |
---|
| 4143 | + * Command Header sizes for IOCTL commands |
---|
| 4144 | + */ |
---|
| 4145 | + |
---|
| 4146 | +#define HDIO_DRIVE_CMD_HDR_SIZE (4 * sizeof(__u8)) |
---|
| 4147 | +#define HDIO_DRIVE_HOB_HDR_SIZE (8 * sizeof(__u8)) |
---|
| 4148 | +#define HDIO_DRIVE_TASK_HDR_SIZE (8 * sizeof(__u8)) |
---|
| 4149 | + |
---|
| 4150 | +#define IDE_DRIVE_TASK_INVALID -1 |
---|
| 4151 | +#define IDE_DRIVE_TASK_NO_DATA 0 |
---|
| 4152 | +#define IDE_DRIVE_TASK_SET_XFER 1 |
---|
| 4153 | + |
---|
| 4154 | +#define IDE_DRIVE_TASK_IN 2 |
---|
| 4155 | + |
---|
| 4156 | +#define IDE_DRIVE_TASK_OUT 3 |
---|
| 4157 | +#define IDE_DRIVE_TASK_RAW_WRITE 4 |
---|
| 4158 | + |
---|
| 4159 | +/* |
---|
| 4160 | + * Define standard taskfile in/out register |
---|
| 4161 | + */ |
---|
| 4162 | +#define IDE_TASKFILE_STD_IN_FLAGS 0xFE |
---|
| 4163 | +#define IDE_HOB_STD_IN_FLAGS 0x3C |
---|
| 4164 | +#define IDE_TASKFILE_STD_OUT_FLAGS 0xFE |
---|
| 4165 | +#define IDE_HOB_STD_OUT_FLAGS 0x3C |
---|
| 4166 | + |
---|
| 4167 | +typedef unsigned char task_ioreg_t; |
---|
| 4168 | +typedef unsigned long sata_ioreg_t; |
---|
| 4169 | + |
---|
| 4170 | +typedef union ide_reg_valid_s { |
---|
| 4171 | + unsigned all : 16; |
---|
| 4172 | + struct { |
---|
| 4173 | + unsigned data : 1; |
---|
| 4174 | + unsigned error_feature : 1; |
---|
| 4175 | + unsigned sector : 1; |
---|
| 4176 | + unsigned nsector : 1; |
---|
| 4177 | + unsigned lcyl : 1; |
---|
| 4178 | + unsigned hcyl : 1; |
---|
| 4179 | + unsigned select : 1; |
---|
| 4180 | + unsigned status_command : 1; |
---|
| 4181 | + |
---|
| 4182 | + unsigned data_hob : 1; |
---|
| 4183 | + unsigned error_feature_hob : 1; |
---|
| 4184 | + unsigned sector_hob : 1; |
---|
| 4185 | + unsigned nsector_hob : 1; |
---|
| 4186 | + unsigned lcyl_hob : 1; |
---|
| 4187 | + unsigned hcyl_hob : 1; |
---|
| 4188 | + unsigned select_hob : 1; |
---|
| 4189 | + unsigned control_hob : 1; |
---|
| 4190 | + } b; |
---|
| 4191 | +} ide_reg_valid_t; |
---|
| 4192 | + |
---|
| 4193 | +typedef struct ide_task_request_s { |
---|
| 4194 | + task_ioreg_t io_ports[8]; |
---|
| 4195 | + task_ioreg_t hob_ports[8]; |
---|
| 4196 | + ide_reg_valid_t out_flags; |
---|
| 4197 | + ide_reg_valid_t in_flags; |
---|
| 4198 | + int data_phase; |
---|
| 4199 | + int req_cmd; |
---|
| 4200 | + unsigned long out_size; |
---|
| 4201 | + unsigned long in_size; |
---|
| 4202 | +} ide_task_request_t; |
---|
| 4203 | + |
---|
| 4204 | +typedef struct ide_ioctl_request_s { |
---|
| 4205 | + ide_task_request_t *task_request; |
---|
| 4206 | + unsigned char *out_buffer; |
---|
| 4207 | + unsigned char *in_buffer; |
---|
| 4208 | +} ide_ioctl_request_t; |
---|
| 4209 | + |
---|
| 4210 | +struct hd_drive_cmd_hdr { |
---|
| 4211 | + task_ioreg_t command; |
---|
| 4212 | + task_ioreg_t sector_number; |
---|
| 4213 | + task_ioreg_t feature; |
---|
| 4214 | + task_ioreg_t sector_count; |
---|
| 4215 | +}; |
---|
| 4216 | + |
---|
| 4217 | +typedef struct hd_drive_task_hdr { |
---|
| 4218 | + task_ioreg_t data; |
---|
| 4219 | + task_ioreg_t feature; |
---|
| 4220 | + task_ioreg_t sector_count; |
---|
| 4221 | + task_ioreg_t sector_number; |
---|
| 4222 | + task_ioreg_t low_cylinder; |
---|
| 4223 | + task_ioreg_t high_cylinder; |
---|
| 4224 | + task_ioreg_t device_head; |
---|
| 4225 | + task_ioreg_t command; |
---|
| 4226 | +} task_struct_t; |
---|
| 4227 | + |
---|
| 4228 | +typedef struct hd_drive_hob_hdr { |
---|
| 4229 | + task_ioreg_t data; |
---|
| 4230 | + task_ioreg_t feature; |
---|
| 4231 | + task_ioreg_t sector_count; |
---|
| 4232 | + task_ioreg_t sector_number; |
---|
| 4233 | + task_ioreg_t low_cylinder; |
---|
| 4234 | + task_ioreg_t high_cylinder; |
---|
| 4235 | + task_ioreg_t device_head; |
---|
| 4236 | + task_ioreg_t control; |
---|
| 4237 | +} hob_struct_t; |
---|
| 4238 | + |
---|
| 4239 | +#define TASKFILE_INVALID 0x7fff |
---|
| 4240 | +#define TASKFILE_48 0x8000 |
---|
| 4241 | + |
---|
| 4242 | +#define TASKFILE_NO_DATA 0x0000 |
---|
| 4243 | + |
---|
| 4244 | +#define TASKFILE_IN 0x0001 |
---|
| 4245 | +#define TASKFILE_MULTI_IN 0x0002 |
---|
| 4246 | + |
---|
| 4247 | +#define TASKFILE_OUT 0x0004 |
---|
| 4248 | +#define TASKFILE_MULTI_OUT 0x0008 |
---|
| 4249 | +#define TASKFILE_IN_OUT 0x0010 |
---|
| 4250 | + |
---|
| 4251 | +#define TASKFILE_IN_DMA 0x0020 |
---|
| 4252 | +#define TASKFILE_OUT_DMA 0x0040 |
---|
| 4253 | +#define TASKFILE_IN_DMAQ 0x0080 |
---|
| 4254 | +#define TASKFILE_OUT_DMAQ 0x0100 |
---|
| 4255 | + |
---|
| 4256 | +#define TASKFILE_P_IN 0x0200 |
---|
| 4257 | +#define TASKFILE_P_OUT 0x0400 |
---|
| 4258 | +#define TASKFILE_P_IN_DMA 0x0800 |
---|
| 4259 | +#define TASKFILE_P_OUT_DMA 0x1000 |
---|
| 4260 | +#define TASKFILE_P_IN_DMAQ 0x2000 |
---|
| 4261 | +#define TASKFILE_P_OUT_DMAQ 0x4000 |
---|
| 4262 | + |
---|
| 4263 | +/* ATA/ATAPI Commands pre T13 Spec */ |
---|
| 4264 | +#define WIN_NOP 0x00 |
---|
| 4265 | +/* |
---|
| 4266 | + * 0x01->0x02 Reserved |
---|
| 4267 | + */ |
---|
| 4268 | +#define CFA_REQ_EXT_ERROR_CODE 0x03 /* CFA Request Extended Error Code */ |
---|
| 4269 | +/* |
---|
| 4270 | + * 0x04->0x07 Reserved |
---|
| 4271 | + */ |
---|
| 4272 | +#define WIN_SRST 0x08 /* ATAPI soft reset command */ |
---|
| 4273 | +#define WIN_DEVICE_RESET 0x08 |
---|
| 4274 | +/* |
---|
| 4275 | + * 0x09->0x0F Reserved |
---|
| 4276 | + */ |
---|
| 4277 | +#define WIN_RECAL 0x10 |
---|
| 4278 | +#define WIN_RESTORE WIN_RECAL |
---|
| 4279 | +/* |
---|
| 4280 | + * 0x10->0x1F Reserved |
---|
| 4281 | + */ |
---|
| 4282 | +#define WIN_READ 0x20 /* 28-Bit */ |
---|
| 4283 | +#define WIN_READ_ONCE 0x21 /* 28-Bit without retries */ |
---|
| 4284 | +#define WIN_READ_LONG 0x22 /* 28-Bit */ |
---|
| 4285 | +#define WIN_READ_LONG_ONCE 0x23 /* 28-Bit without retries */ |
---|
| 4286 | +#define WIN_READ_EXT 0x24 /* 48-Bit */ |
---|
| 4287 | +#define WIN_READDMA_EXT 0x25 /* 48-Bit */ |
---|
| 4288 | +#define WIN_READDMA_QUEUED_EXT 0x26 /* 48-Bit */ |
---|
| 4289 | +#define WIN_READ_NATIVE_MAX_EXT 0x27 /* 48-Bit */ |
---|
| 4290 | +/* |
---|
| 4291 | + * 0x28 |
---|
| 4292 | + */ |
---|
| 4293 | +#define WIN_MULTREAD_EXT 0x29 /* 48-Bit */ |
---|
| 4294 | +/* |
---|
| 4295 | + * 0x2A->0x2F Reserved |
---|
| 4296 | + */ |
---|
| 4297 | +#define WIN_WRITE 0x30 /* 28-Bit */ |
---|
| 4298 | +#define WIN_WRITE_ONCE 0x31 /* 28-Bit without retries */ |
---|
| 4299 | +#define WIN_WRITE_LONG 0x32 /* 28-Bit */ |
---|
| 4300 | +#define WIN_WRITE_LONG_ONCE 0x33 /* 28-Bit without retries */ |
---|
| 4301 | +#define WIN_WRITE_EXT 0x34 /* 48-Bit */ |
---|
| 4302 | +#define WIN_WRITEDMA_EXT 0x35 /* 48-Bit */ |
---|
| 4303 | +#define WIN_WRITEDMA_QUEUED_EXT 0x36 /* 48-Bit */ |
---|
| 4304 | +#define WIN_SET_MAX_EXT 0x37 /* 48-Bit */ |
---|
| 4305 | +#define CFA_WRITE_SECT_WO_ERASE 0x38 /* CFA Write Sectors without erase */ |
---|
| 4306 | +#define WIN_MULTWRITE_EXT 0x39 /* 48-Bit */ |
---|
| 4307 | +/* |
---|
| 4308 | + * 0x3A->0x3B Reserved |
---|
| 4309 | + */ |
---|
| 4310 | +#define WIN_WRITE_VERIFY 0x3C /* 28-Bit */ |
---|
| 4311 | +/* |
---|
| 4312 | + * 0x3D->0x3F Reserved |
---|
| 4313 | + */ |
---|
| 4314 | +#define WIN_VERIFY 0x40 /* 28-Bit - Read Verify Sectors */ |
---|
| 4315 | +#define WIN_VERIFY_ONCE 0x41 /* 28-Bit - without retries */ |
---|
| 4316 | +#define WIN_VERIFY_EXT 0x42 /* 48-Bit */ |
---|
| 4317 | +/* |
---|
| 4318 | + * 0x43->0x4F Reserved |
---|
| 4319 | + */ |
---|
| 4320 | +#define WIN_FORMAT 0x50 |
---|
| 4321 | +/* |
---|
| 4322 | + * 0x51->0x5F Reserved |
---|
| 4323 | + */ |
---|
| 4324 | +#define WIN_INIT 0x60 |
---|
| 4325 | +/* |
---|
| 4326 | + * 0x61->0x5F Reserved |
---|
| 4327 | + */ |
---|
| 4328 | +#define WIN_SEEK 0x70 /* 0x70-0x7F Reserved */ |
---|
| 4329 | + |
---|
| 4330 | +#define CFA_TRANSLATE_SECTOR 0x87 /* CFA Translate Sector */ |
---|
| 4331 | +#define WIN_DIAGNOSE 0x90 |
---|
| 4332 | +#define WIN_SPECIFY 0x91 /* set drive geometry translation */ |
---|
| 4333 | +#define WIN_DOWNLOAD_MICROCODE 0x92 |
---|
| 4334 | +#define WIN_STANDBYNOW2 0x94 |
---|
| 4335 | +#define WIN_STANDBY2 0x96 |
---|
| 4336 | +#define WIN_SETIDLE2 0x97 |
---|
| 4337 | +#define WIN_CHECKPOWERMODE2 0x98 |
---|
| 4338 | +#define WIN_SLEEPNOW2 0x99 |
---|
| 4339 | +/* |
---|
| 4340 | + * 0x9A VENDOR |
---|
| 4341 | + */ |
---|
| 4342 | +#define WIN_PACKETCMD 0xA0 /* Send a packet command. */ |
---|
| 4343 | +#define WIN_PIDENTIFY 0xA1 /* identify ATAPI device */ |
---|
| 4344 | +#define WIN_QUEUED_SERVICE 0xA2 |
---|
| 4345 | +#define WIN_SMART 0xB0 /* self-monitoring and reporting */ |
---|
| 4346 | +#define CFA_ERASE_SECTORS 0xC0 |
---|
| 4347 | +#define WIN_MULTREAD 0xC4 /* read sectors using multiple mode*/ |
---|
| 4348 | +#define WIN_MULTWRITE 0xC5 /* write sectors using multiple mode */ |
---|
| 4349 | +#define WIN_SETMULT 0xC6 /* enable/disable multiple mode */ |
---|
| 4350 | +#define WIN_READDMA_QUEUED 0xC7 /* read sectors using Queued DMA transfers */ |
---|
| 4351 | +#define WIN_READDMA 0xC8 /* read sectors using DMA transfers */ |
---|
| 4352 | +#define WIN_READDMA_ONCE 0xC9 /* 28-Bit - without retries */ |
---|
| 4353 | +#define WIN_WRITEDMA 0xCA /* write sectors using DMA transfers */ |
---|
| 4354 | +#define WIN_WRITEDMA_ONCE 0xCB /* 28-Bit - without retries */ |
---|
| 4355 | +#define WIN_WRITEDMA_QUEUED 0xCC /* write sectors using Queued DMA transfers */ |
---|
| 4356 | +#define CFA_WRITE_MULTI_WO_ERASE 0xCD /* CFA Write multiple without erase */ |
---|
| 4357 | +#define WIN_GETMEDIASTATUS 0xDA |
---|
| 4358 | +#define WIN_ACKMEDIACHANGE 0xDB /* ATA-1, ATA-2 vendor */ |
---|
| 4359 | +#define WIN_POSTBOOT 0xDC |
---|
| 4360 | +#define WIN_PREBOOT 0xDD |
---|
| 4361 | +#define WIN_DOORLOCK 0xDE /* lock door on removable drives */ |
---|
| 4362 | +#define WIN_DOORUNLOCK 0xDF /* unlock door on removable drives */ |
---|
| 4363 | +#define WIN_STANDBYNOW1 0xE0 |
---|
| 4364 | +#define WIN_IDLEIMMEDIATE 0xE1 /* force drive to become "ready" */ |
---|
| 4365 | +#define WIN_STANDBY 0xE2 /* Set device in Standby Mode */ |
---|
| 4366 | +#define WIN_SETIDLE1 0xE3 |
---|
| 4367 | +#define WIN_READ_BUFFER 0xE4 /* force read only 1 sector */ |
---|
| 4368 | +#define WIN_CHECKPOWERMODE1 0xE5 |
---|
| 4369 | +#define WIN_SLEEPNOW1 0xE6 |
---|
| 4370 | +#define WIN_FLUSH_CACHE 0xE7 |
---|
| 4371 | +#define WIN_WRITE_BUFFER 0xE8 /* force write only 1 sector */ |
---|
| 4372 | +#define WIN_WRITE_SAME 0xE9 /* read ata-2 to use */ |
---|
| 4373 | + /* SET_FEATURES 0x22 or 0xDD */ |
---|
| 4374 | +#define WIN_FLUSH_CACHE_EXT 0xEA /* 48-Bit */ |
---|
| 4375 | +#define WIN_IDENTIFY 0xEC /* ask drive to identify itself */ |
---|
| 4376 | +#define WIN_MEDIAEJECT 0xED |
---|
| 4377 | +#define WIN_IDENTIFY_DMA 0xEE /* same as WIN_IDENTIFY, but DMA */ |
---|
| 4378 | +#define WIN_SETFEATURES 0xEF /* set special drive features */ |
---|
| 4379 | +#define EXABYTE_ENABLE_NEST 0xF0 |
---|
| 4380 | +#define WIN_SECURITY_SET_PASS 0xF1 |
---|
| 4381 | +#define WIN_SECURITY_UNLOCK 0xF2 |
---|
| 4382 | +#define WIN_SECURITY_ERASE_PREPARE 0xF3 |
---|
| 4383 | +#define WIN_SECURITY_ERASE_UNIT 0xF4 |
---|
| 4384 | +#define WIN_SECURITY_FREEZE_LOCK 0xF5 |
---|
| 4385 | +#define WIN_SECURITY_DISABLE 0xF6 |
---|
| 4386 | +#define WIN_READ_NATIVE_MAX 0xF8 /* return the native maximum address */ |
---|
| 4387 | +#define WIN_SET_MAX 0xF9 |
---|
| 4388 | +#define DISABLE_SEAGATE 0xFB |
---|
| 4389 | + |
---|
| 4390 | +/* WIN_SMART sub-commands */ |
---|
| 4391 | + |
---|
| 4392 | +#define SMART_READ_VALUES 0xD0 |
---|
| 4393 | +#define SMART_READ_THRESHOLDS 0xD1 |
---|
| 4394 | +#define SMART_AUTOSAVE 0xD2 |
---|
| 4395 | +#define SMART_SAVE 0xD3 |
---|
| 4396 | +#define SMART_IMMEDIATE_OFFLINE 0xD4 |
---|
| 4397 | +#define SMART_READ_LOG_SECTOR 0xD5 |
---|
| 4398 | +#define SMART_WRITE_LOG_SECTOR 0xD6 |
---|
| 4399 | +#define SMART_WRITE_THRESHOLDS 0xD7 |
---|
| 4400 | +#define SMART_ENABLE 0xD8 |
---|
| 4401 | +#define SMART_DISABLE 0xD9 |
---|
| 4402 | +#define SMART_STATUS 0xDA |
---|
| 4403 | +#define SMART_AUTO_OFFLINE 0xDB |
---|
| 4404 | + |
---|
| 4405 | +/* Password used in TF4 & TF5 executing SMART commands */ |
---|
| 4406 | + |
---|
| 4407 | +#define SMART_LCYL_PASS 0x4F |
---|
| 4408 | +#define SMART_HCYL_PASS 0xC2 |
---|
| 4409 | + |
---|
| 4410 | +/* WIN_SETFEATURES sub-commands */ |
---|
| 4411 | +#define SETFEATURES_EN_8BIT 0x01 /* Enable 8-Bit Transfers */ |
---|
| 4412 | +#define SETFEATURES_EN_WCACHE 0x02 /* Enable write cache */ |
---|
| 4413 | +#define SETFEATURES_DIS_DEFECT 0x04 /* Disable Defect Management */ |
---|
| 4414 | +#define SETFEATURES_EN_APM 0x05 /* Enable advanced power management */ |
---|
| 4415 | +#define SETFEATURES_EN_SAME_R 0x22 /* for a region ATA-1 */ |
---|
| 4416 | +#define SETFEATURES_DIS_MSN 0x31 /* Disable Media Status Notification */ |
---|
| 4417 | +#define SETFEATURES_DIS_RETRY 0x33 /* Disable Retry */ |
---|
| 4418 | +#define SETFEATURES_EN_AAM 0x42 /* Enable Automatic Acoustic Management */ |
---|
| 4419 | +#define SETFEATURES_RW_LONG 0x44 /* Set Length of VS bytes */ |
---|
| 4420 | +#define SETFEATURES_SET_CACHE 0x54 /* Set Cache segments to SC Reg. Val */ |
---|
| 4421 | +#define SETFEATURES_DIS_RLA 0x55 /* Disable read look-ahead feature */ |
---|
| 4422 | +#define SETFEATURES_EN_RI 0x5D /* Enable release interrupt */ |
---|
| 4423 | +#define SETFEATURES_EN_SI 0x5E /* Enable SERVICE interrupt */ |
---|
| 4424 | +#define SETFEATURES_DIS_RPOD 0x66 /* Disable reverting to power on defaults */ |
---|
| 4425 | +#define SETFEATURES_DIS_ECC 0x77 /* Disable ECC byte count */ |
---|
| 4426 | +#define SETFEATURES_DIS_8BIT 0x81 /* Disable 8-Bit Transfers */ |
---|
| 4427 | +#define SETFEATURES_DIS_WCACHE 0x82 /* Disable write cache */ |
---|
| 4428 | +#define SETFEATURES_EN_DEFECT 0x84 /* Enable Defect Management */ |
---|
| 4429 | +#define SETFEATURES_DIS_APM 0x85 /* Disable advanced power management */ |
---|
| 4430 | +#define SETFEATURES_EN_ECC 0x88 /* Enable ECC byte count */ |
---|
| 4431 | +#define SETFEATURES_EN_MSN 0x95 /* Enable Media Status Notification */ |
---|
| 4432 | +#define SETFEATURES_EN_RETRY 0x99 /* Enable Retry */ |
---|
| 4433 | +#define SETFEATURES_EN_RLA 0xAA /* Enable read look-ahead feature */ |
---|
| 4434 | +#define SETFEATURES_PREFETCH 0xAB /* Sets drive prefetch value */ |
---|
| 4435 | +#define SETFEATURES_EN_REST 0xAC /* ATA-1 */ |
---|
| 4436 | +#define SETFEATURES_4B_RW_LONG 0xBB /* Set Lenght of 4 bytes */ |
---|
| 4437 | +#define SETFEATURES_DIS_AAM 0xC2 /* Disable Automatic Acoustic Management */ |
---|
| 4438 | +#define SETFEATURES_EN_RPOD 0xCC /* Enable reverting to power on defaults */ |
---|
| 4439 | +#define SETFEATURES_DIS_RI 0xDD /* Disable release interrupt ATAPI */ |
---|
| 4440 | +#define SETFEATURES_EN_SAME_M 0xDD /* for a entire device ATA-1 */ |
---|
| 4441 | +#define SETFEATURES_DIS_SI 0xDE /* Disable SERVICE interrupt ATAPI */ |
---|
| 4442 | + |
---|
| 4443 | +/* WIN_SECURITY sub-commands */ |
---|
| 4444 | + |
---|
| 4445 | +#define SECURITY_SET_PASSWORD 0xBA |
---|
| 4446 | +#define SECURITY_UNLOCK 0xBB |
---|
| 4447 | +#define SECURITY_ERASE_PREPARE 0xBC |
---|
| 4448 | +#define SECURITY_ERASE_UNIT 0xBD |
---|
| 4449 | +#define SECURITY_FREEZE_LOCK 0xBE |
---|
| 4450 | +#define SECURITY_DISABLE_PASSWORD 0xBF |
---|
| 4451 | + |
---|
| 4452 | +struct hd_geometry { |
---|
| 4453 | + unsigned char heads; |
---|
| 4454 | + unsigned char sectors; |
---|
| 4455 | + unsigned short cylinders; |
---|
| 4456 | + unsigned long start; |
---|
| 4457 | +}; |
---|
| 4458 | + |
---|
| 4459 | +/* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */ |
---|
| 4460 | +#define HDIO_GETGEO 0x0301 /* get device geometry */ |
---|
| 4461 | +#define HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */ |
---|
| 4462 | +#define HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */ |
---|
| 4463 | +#define HDIO_GET_QDMA 0x0305 /* get use-qdma flag */ |
---|
| 4464 | + |
---|
| 4465 | +#define HDIO_SET_XFER 0x0306 /* set transfer rate via proc */ |
---|
| 4466 | + |
---|
| 4467 | +#define HDIO_OBSOLETE_IDENTITY 0x0307 /* OBSOLETE, DO NOT USE: returns 142 bytes */ |
---|
| 4468 | +#define HDIO_GET_KEEPSETTINGS 0x0308 /* get keep-settings-on-reset flag */ |
---|
| 4469 | +#define HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */ |
---|
| 4470 | +#define HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */ |
---|
| 4471 | +#define HDIO_GET_DMA 0x030b /* get use-dma flag */ |
---|
| 4472 | +#define HDIO_GET_NICE 0x030c /* get nice flags */ |
---|
| 4473 | +#define HDIO_GET_IDENTITY 0x030d /* get IDE identification info */ |
---|
| 4474 | +#define HDIO_GET_WCACHE 0x030e /* get write cache mode on|off */ |
---|
| 4475 | +#define HDIO_GET_ACOUSTIC 0x030f /* get acoustic value */ |
---|
| 4476 | +#define HDIO_GET_ADDRESS 0x0310 /* */ |
---|
| 4477 | + |
---|
| 4478 | +#define HDIO_GET_BUSSTATE 0x031a /* get the bus state of the hwif */ |
---|
| 4479 | +#define HDIO_TRISTATE_HWIF 0x031b /* execute a channel tristate */ |
---|
| 4480 | +#define HDIO_DRIVE_RESET 0x031c /* execute a device reset */ |
---|
| 4481 | +#define HDIO_DRIVE_TASKFILE 0x031d /* execute raw taskfile */ |
---|
| 4482 | +#define HDIO_DRIVE_TASK 0x031e /* execute task and special drive command */ |
---|
| 4483 | +#define HDIO_DRIVE_CMD 0x031f /* execute a special drive command */ |
---|
| 4484 | +#define HDIO_DRIVE_CMD_AEB HDIO_DRIVE_TASK |
---|
| 4485 | + |
---|
| 4486 | +/* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */ |
---|
| 4487 | +#define HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */ |
---|
| 4488 | +#define HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */ |
---|
| 4489 | +#define HDIO_SET_KEEPSETTINGS 0x0323 /* keep ioctl settings on reset */ |
---|
| 4490 | +#define HDIO_SET_32BIT 0x0324 /* change io_32bit flags */ |
---|
| 4491 | +#define HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */ |
---|
| 4492 | +#define HDIO_SET_DMA 0x0326 /* change use-dma flag */ |
---|
| 4493 | +#define HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */ |
---|
| 4494 | +#define HDIO_SCAN_HWIF 0x0328 /* register and (re)scan interface */ |
---|
| 4495 | +#define HDIO_SET_NICE 0x0329 /* set nice flags */ |
---|
| 4496 | +#define HDIO_UNREGISTER_HWIF 0x032a /* unregister interface */ |
---|
| 4497 | +#define HDIO_SET_WCACHE 0x032b /* change write cache enable-disable */ |
---|
| 4498 | +#define HDIO_SET_ACOUSTIC 0x032c /* change acoustic behavior */ |
---|
| 4499 | +#define HDIO_SET_BUSSTATE 0x032d /* set the bus state of the hwif */ |
---|
| 4500 | +#define HDIO_SET_QDMA 0x032e /* change use-qdma flag */ |
---|
| 4501 | +#define HDIO_SET_ADDRESS 0x032f /* change lba addressing modes */ |
---|
| 4502 | + |
---|
| 4503 | +/* bus states */ |
---|
| 4504 | +enum { |
---|
| 4505 | + BUSSTATE_OFF = 0, |
---|
| 4506 | + BUSSTATE_ON, |
---|
| 4507 | + BUSSTATE_TRISTATE |
---|
| 4508 | +}; |
---|
| 4509 | + |
---|
| 4510 | +/* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x033n/0x033n */ |
---|
| 4511 | +/* 0x330 is reserved - used to be HDIO_GETGEO_BIG */ |
---|
| 4512 | +/* 0x331 is reserved - used to be HDIO_GETGEO_BIG_RAW */ |
---|
| 4513 | +/* 0x338 is reserved - used to be HDIO_SET_IDE_SCSI */ |
---|
| 4514 | +/* 0x339 is reserved - used to be HDIO_SET_SCSI_IDE */ |
---|
| 4515 | + |
---|
| 4516 | +#define __NEW_HD_DRIVE_ID |
---|
| 4517 | + |
---|
| 4518 | +/* |
---|
| 4519 | + * Structure returned by HDIO_GET_IDENTITY, as per ANSI NCITS ATA6 rev.1b spec. |
---|
| 4520 | + * |
---|
| 4521 | + * If you change something here, please remember to update fix_driveid() in |
---|
| 4522 | + * ide/probe.c. |
---|
| 4523 | + */ |
---|
| 4524 | +struct hd_driveid { |
---|
| 4525 | + unsigned short config; /* lots of obsolete bit flags */ |
---|
| 4526 | + unsigned short cyls; /* Obsolete, "physical" cyls */ |
---|
| 4527 | + unsigned short reserved2; /* reserved (word 2) */ |
---|
| 4528 | + unsigned short heads; /* Obsolete, "physical" heads */ |
---|
| 4529 | + unsigned short track_bytes; /* unformatted bytes per track */ |
---|
| 4530 | + unsigned short sector_bytes; /* unformatted bytes per sector */ |
---|
| 4531 | + unsigned short sectors; /* Obsolete, "physical" sectors per track */ |
---|
| 4532 | + unsigned short vendor0; /* vendor unique */ |
---|
| 4533 | + unsigned short vendor1; /* vendor unique */ |
---|
| 4534 | + unsigned short vendor2; /* Retired vendor unique */ |
---|
| 4535 | + unsigned char serial_no[20]; /* 0 = not_specified */ |
---|
| 4536 | + unsigned short buf_type; /* Retired */ |
---|
| 4537 | + unsigned short buf_size; /* Retired, 512 byte increments |
---|
| 4538 | + * 0 = not_specified |
---|
| 4539 | + */ |
---|
| 4540 | + unsigned short ecc_bytes; /* for r/w long cmds; 0 = not_specified */ |
---|
| 4541 | + unsigned char fw_rev[8]; /* 0 = not_specified */ |
---|
| 4542 | + unsigned char model[40]; /* 0 = not_specified */ |
---|
| 4543 | + unsigned char max_multsect; /* 0=not_implemented */ |
---|
| 4544 | + unsigned char vendor3; /* vendor unique */ |
---|
| 4545 | + unsigned short dword_io; /* 0=not_implemented; 1=implemented */ |
---|
| 4546 | + unsigned char vendor4; /* vendor unique */ |
---|
| 4547 | + unsigned char capability; /* (upper byte of word 49) |
---|
| 4548 | + * 3: IORDYsup |
---|
| 4549 | + * 2: IORDYsw |
---|
| 4550 | + * 1: LBA |
---|
| 4551 | + * 0: DMA |
---|
| 4552 | + */ |
---|
| 4553 | + unsigned short reserved50; /* reserved (word 50) */ |
---|
| 4554 | + unsigned char vendor5; /* Obsolete, vendor unique */ |
---|
| 4555 | + unsigned char tPIO; /* Obsolete, 0=slow, 1=medium, 2=fast */ |
---|
| 4556 | + unsigned char vendor6; /* Obsolete, vendor unique */ |
---|
| 4557 | + unsigned char tDMA; /* Obsolete, 0=slow, 1=medium, 2=fast */ |
---|
| 4558 | + unsigned short field_valid; /* (word 53) |
---|
| 4559 | + * 2: ultra_ok word 88 |
---|
| 4560 | + * 1: eide_ok words 64-70 |
---|
| 4561 | + * 0: cur_ok words 54-58 |
---|
| 4562 | + */ |
---|
| 4563 | + unsigned short cur_cyls; /* Obsolete, logical cylinders */ |
---|
| 4564 | + unsigned short cur_heads; /* Obsolete, l heads */ |
---|
| 4565 | + unsigned short cur_sectors; /* Obsolete, l sectors per track */ |
---|
| 4566 | + unsigned short cur_capacity0; /* Obsolete, l total sectors on drive */ |
---|
| 4567 | + unsigned short cur_capacity1; /* Obsolete, (2 words, misaligned int) */ |
---|
| 4568 | + unsigned char multsect; /* current multiple sector count */ |
---|
| 4569 | + unsigned char multsect_valid; /* when (bit0==1) multsect is ok */ |
---|
| 4570 | + unsigned int lba_capacity; /* Obsolete, total number of sectors */ |
---|
| 4571 | + unsigned short dma_1word; /* Obsolete, single-word dma info */ |
---|
| 4572 | + unsigned short dma_mword; /* multiple-word dma info */ |
---|
| 4573 | + unsigned short eide_pio_modes; /* bits 0:mode3 1:mode4 */ |
---|
| 4574 | + unsigned short eide_dma_min; /* min mword dma cycle time (ns) */ |
---|
| 4575 | + unsigned short eide_dma_time; /* recommended mword dma cycle time (ns) */ |
---|
| 4576 | + unsigned short eide_pio; /* min cycle time (ns), no IORDY */ |
---|
| 4577 | + unsigned short eide_pio_iordy; /* min cycle time (ns), with IORDY */ |
---|
| 4578 | + unsigned short words69_70[2]; /* reserved words 69-70 |
---|
| 4579 | + * future command overlap and queuing |
---|
| 4580 | + */ |
---|
| 4581 | + /* HDIO_GET_IDENTITY currently returns only words 0 through 70 */ |
---|
| 4582 | + unsigned short words71_74[4]; /* reserved words 71-74 |
---|
| 4583 | + * for IDENTIFY PACKET DEVICE command |
---|
| 4584 | + */ |
---|
| 4585 | + unsigned short queue_depth; /* (word 75) |
---|
| 4586 | + * 15:5 reserved |
---|
| 4587 | + * 4:0 Maximum queue depth -1 |
---|
| 4588 | + */ |
---|
| 4589 | + unsigned short words76_79[4]; /* reserved words 76-79 */ |
---|
| 4590 | + unsigned short major_rev_num; /* (word 80) */ |
---|
| 4591 | + unsigned short minor_rev_num; /* (word 81) */ |
---|
| 4592 | + unsigned short command_set_1; /* (word 82) supported |
---|
| 4593 | + * 15: Obsolete |
---|
| 4594 | + * 14: NOP command |
---|
| 4595 | + * 13: READ_BUFFER |
---|
| 4596 | + * 12: WRITE_BUFFER |
---|
| 4597 | + * 11: Obsolete |
---|
| 4598 | + * 10: Host Protected Area |
---|
| 4599 | + * 9: DEVICE Reset |
---|
| 4600 | + * 8: SERVICE Interrupt |
---|
| 4601 | + * 7: Release Interrupt |
---|
| 4602 | + * 6: look-ahead |
---|
| 4603 | + * 5: write cache |
---|
| 4604 | + * 4: PACKET Command |
---|
| 4605 | + * 3: Power Management Feature Set |
---|
| 4606 | + * 2: Removable Feature Set |
---|
| 4607 | + * 1: Security Feature Set |
---|
| 4608 | + * 0: SMART Feature Set |
---|
| 4609 | + */ |
---|
| 4610 | + unsigned short command_set_2; /* (word 83) |
---|
| 4611 | + * 15: Shall be ZERO |
---|
| 4612 | + * 14: Shall be ONE |
---|
| 4613 | + * 13: FLUSH CACHE EXT |
---|
| 4614 | + * 12: FLUSH CACHE |
---|
| 4615 | + * 11: Device Configuration Overlay |
---|
| 4616 | + * 10: 48-bit Address Feature Set |
---|
| 4617 | + * 9: Automatic Acoustic Management |
---|
| 4618 | + * 8: SET MAX security |
---|
| 4619 | + * 7: reserved 1407DT PARTIES |
---|
| 4620 | + * 6: SetF sub-command Power-Up |
---|
| 4621 | + * 5: Power-Up in Standby Feature Set |
---|
| 4622 | + * 4: Removable Media Notification |
---|
| 4623 | + * 3: APM Feature Set |
---|
| 4624 | + * 2: CFA Feature Set |
---|
| 4625 | + * 1: READ/WRITE DMA QUEUED |
---|
| 4626 | + * 0: Download MicroCode |
---|
| 4627 | + */ |
---|
| 4628 | + unsigned short cfsse; /* (word 84) |
---|
| 4629 | + * cmd set-feature supported extensions |
---|
| 4630 | + * 15: Shall be ZERO |
---|
| 4631 | + * 14: Shall be ONE |
---|
| 4632 | + * 13:6 reserved |
---|
| 4633 | + * 5: General Purpose Logging |
---|
| 4634 | + * 4: Streaming Feature Set |
---|
| 4635 | + * 3: Media Card Pass Through |
---|
| 4636 | + * 2: Media Serial Number Valid |
---|
| 4637 | + * 1: SMART selt-test supported |
---|
| 4638 | + * 0: SMART error logging |
---|
| 4639 | + */ |
---|
| 4640 | + unsigned short cfs_enable_1; /* (word 85) |
---|
| 4641 | + * command set-feature enabled |
---|
| 4642 | + * 15: Obsolete |
---|
| 4643 | + * 14: NOP command |
---|
| 4644 | + * 13: READ_BUFFER |
---|
| 4645 | + * 12: WRITE_BUFFER |
---|
| 4646 | + * 11: Obsolete |
---|
| 4647 | + * 10: Host Protected Area |
---|
| 4648 | + * 9: DEVICE Reset |
---|
| 4649 | + * 8: SERVICE Interrupt |
---|
| 4650 | + * 7: Release Interrupt |
---|
| 4651 | + * 6: look-ahead |
---|
| 4652 | + * 5: write cache |
---|
| 4653 | + * 4: PACKET Command |
---|
| 4654 | + * 3: Power Management Feature Set |
---|
| 4655 | + * 2: Removable Feature Set |
---|
| 4656 | + * 1: Security Feature Set |
---|
| 4657 | + * 0: SMART Feature Set |
---|
| 4658 | + */ |
---|
| 4659 | + unsigned short cfs_enable_2; /* (word 86) |
---|
| 4660 | + * command set-feature enabled |
---|
| 4661 | + * 15: Shall be ZERO |
---|
| 4662 | + * 14: Shall be ONE |
---|
| 4663 | + * 13: FLUSH CACHE EXT |
---|
| 4664 | + * 12: FLUSH CACHE |
---|
| 4665 | + * 11: Device Configuration Overlay |
---|
| 4666 | + * 10: 48-bit Address Feature Set |
---|
| 4667 | + * 9: Automatic Acoustic Management |
---|
| 4668 | + * 8: SET MAX security |
---|
| 4669 | + * 7: reserved 1407DT PARTIES |
---|
| 4670 | + * 6: SetF sub-command Power-Up |
---|
| 4671 | + * 5: Power-Up in Standby Feature Set |
---|
| 4672 | + * 4: Removable Media Notification |
---|
| 4673 | + * 3: APM Feature Set |
---|
| 4674 | + * 2: CFA Feature Set |
---|
| 4675 | + * 1: READ/WRITE DMA QUEUED |
---|
| 4676 | + * 0: Download MicroCode |
---|
| 4677 | + */ |
---|
| 4678 | + unsigned short csf_default; /* (word 87) |
---|
| 4679 | + * command set-feature default |
---|
| 4680 | + * 15: Shall be ZERO |
---|
| 4681 | + * 14: Shall be ONE |
---|
| 4682 | + * 13:6 reserved |
---|
| 4683 | + * 5: General Purpose Logging enabled |
---|
| 4684 | + * 4: Valid CONFIGURE STREAM executed |
---|
| 4685 | + * 3: Media Card Pass Through enabled |
---|
| 4686 | + * 2: Media Serial Number Valid |
---|
| 4687 | + * 1: SMART selt-test supported |
---|
| 4688 | + * 0: SMART error logging |
---|
| 4689 | + */ |
---|
| 4690 | + unsigned short dma_ultra; /* (word 88) */ |
---|
| 4691 | + unsigned short trseuc; /* time required for security erase */ |
---|
| 4692 | + unsigned short trsEuc; /* time required for enhanced erase */ |
---|
| 4693 | + unsigned short CurAPMvalues; /* current APM values */ |
---|
| 4694 | + unsigned short mprc; /* master password revision code */ |
---|
| 4695 | + unsigned short hw_config; /* hardware config (word 93) |
---|
| 4696 | + * 15: Shall be ZERO |
---|
| 4697 | + * 14: Shall be ONE |
---|
| 4698 | + * 13: |
---|
| 4699 | + * 12: |
---|
| 4700 | + * 11: |
---|
| 4701 | + * 10: |
---|
| 4702 | + * 9: |
---|
| 4703 | + * 8: |
---|
| 4704 | + * 7: |
---|
| 4705 | + * 6: |
---|
| 4706 | + * 5: |
---|
| 4707 | + * 4: |
---|
| 4708 | + * 3: |
---|
| 4709 | + * 2: |
---|
| 4710 | + * 1: |
---|
| 4711 | + * 0: Shall be ONE |
---|
| 4712 | + */ |
---|
| 4713 | + unsigned short acoustic; /* (word 94) |
---|
| 4714 | + * 15:8 Vendor's recommended value |
---|
| 4715 | + * 7:0 current value |
---|
| 4716 | + */ |
---|
| 4717 | + unsigned short msrqs; /* min stream request size */ |
---|
| 4718 | + unsigned short sxfert; /* stream transfer time */ |
---|
| 4719 | + unsigned short sal; /* stream access latency */ |
---|
| 4720 | + unsigned int spg; /* stream performance granularity */ |
---|
| 4721 | + unsigned long long lba_capacity_2;/* 48-bit total number of sectors */ |
---|
| 4722 | + unsigned short words104_125[22];/* reserved words 104-125 */ |
---|
| 4723 | + unsigned short last_lun; /* (word 126) */ |
---|
| 4724 | + unsigned short word127; /* (word 127) Feature Set |
---|
| 4725 | + * Removable Media Notification |
---|
| 4726 | + * 15:2 reserved |
---|
| 4727 | + * 1:0 00 = not supported |
---|
| 4728 | + * 01 = supported |
---|
| 4729 | + * 10 = reserved |
---|
| 4730 | + * 11 = reserved |
---|
| 4731 | + */ |
---|
| 4732 | + unsigned short dlf; /* (word 128) |
---|
| 4733 | + * device lock function |
---|
| 4734 | + * 15:9 reserved |
---|
| 4735 | + * 8 security level 1:max 0:high |
---|
| 4736 | + * 7:6 reserved |
---|
| 4737 | + * 5 enhanced erase |
---|
| 4738 | + * 4 expire |
---|
| 4739 | + * 3 frozen |
---|
| 4740 | + * 2 locked |
---|
| 4741 | + * 1 en/disabled |
---|
| 4742 | + * 0 capability |
---|
| 4743 | + */ |
---|
| 4744 | + unsigned short csfo; /* (word 129) |
---|
| 4745 | + * current set features options |
---|
| 4746 | + * 15:4 reserved |
---|
| 4747 | + * 3: auto reassign |
---|
| 4748 | + * 2: reverting |
---|
| 4749 | + * 1: read-look-ahead |
---|
| 4750 | + * 0: write cache |
---|
| 4751 | + */ |
---|
| 4752 | + unsigned short words130_155[26];/* reserved vendor words 130-155 */ |
---|
| 4753 | + unsigned short word156; /* reserved vendor word 156 */ |
---|
| 4754 | + unsigned short words157_159[3];/* reserved vendor words 157-159 */ |
---|
| 4755 | + unsigned short cfa_power; /* (word 160) CFA Power Mode |
---|
| 4756 | + * 15 word 160 supported |
---|
| 4757 | + * 14 reserved |
---|
| 4758 | + * 13 |
---|
| 4759 | + * 12 |
---|
| 4760 | + * 11:0 |
---|
| 4761 | + */ |
---|
| 4762 | + unsigned short words161_175[15];/* Reserved for CFA */ |
---|
| 4763 | + unsigned short words176_205[30];/* Current Media Serial Number */ |
---|
| 4764 | + unsigned short words206_254[49];/* reserved words 206-254 */ |
---|
| 4765 | + unsigned short integrity_word; /* (word 255) |
---|
| 4766 | + * 15:8 Checksum |
---|
| 4767 | + * 7:0 Signature |
---|
| 4768 | + */ |
---|
| 4769 | +}; |
---|
| 4770 | + |
---|
| 4771 | +/* |
---|
| 4772 | + * IDE "nice" flags. These are used on a per drive basis to determine |
---|
| 4773 | + * when to be nice and give more bandwidth to the other devices which |
---|
| 4774 | + * share the same IDE bus. |
---|
| 4775 | + */ |
---|
| 4776 | +#define IDE_NICE_DSC_OVERLAP (0) /* per the DSC overlap protocol */ |
---|
| 4777 | +#define IDE_NICE_ATAPI_OVERLAP (1) /* not supported yet */ |
---|
| 4778 | +#define IDE_NICE_0 (2) /* when sure that it won't affect us */ |
---|
| 4779 | +#define IDE_NICE_1 (3) /* when probably won't affect us much */ |
---|
| 4780 | +#define IDE_NICE_2 (4) /* when we know it's on our expense */ |
---|
| 4781 | + |
---|
| 4782 | +#endif /* _LINUX_HDREG_H */ |
---|
| 4783 | diff -Naur aboot-0.9b.orig/include/linux/ioctl.h aboot-0.9b/include/linux/ioctl.h |
---|
| 4784 | --- aboot-0.9b.orig/include/linux/ioctl.h 1969-12-31 19:00:00.000000000 -0500 |
---|
| 4785 | +++ aboot-0.9b/include/linux/ioctl.h 2008-01-02 13:53:15.000000000 -0500 |
---|
| 4786 | @@ -0,0 +1,7 @@ |
---|
| 4787 | +#ifndef _LINUX_IOCTL_H |
---|
| 4788 | +#define _LINUX_IOCTL_H |
---|
| 4789 | + |
---|
| 4790 | +#include <asm/ioctl.h> |
---|
| 4791 | + |
---|
| 4792 | +#endif /* _LINUX_IOCTL_H */ |
---|
| 4793 | + |
---|
| 4794 | diff -Naur aboot-0.9b.orig/include/linux/kdev_t.h aboot-0.9b/include/linux/kdev_t.h |
---|
| 4795 | --- aboot-0.9b.orig/include/linux/kdev_t.h 1969-12-31 19:00:00.000000000 -0500 |
---|
| 4796 | +++ aboot-0.9b/include/linux/kdev_t.h 2008-01-02 13:53:15.000000000 -0500 |
---|
| 4797 | @@ -0,0 +1,11 @@ |
---|
| 4798 | +#ifndef _LINUX_KDEV_T_H |
---|
| 4799 | +#define _LINUX_KDEV_T_H |
---|
| 4800 | + |
---|
| 4801 | +/* |
---|
| 4802 | +Some programs want their definitions of MAJOR and MINOR and MKDEV |
---|
| 4803 | +from the kernel sources. These must be the externally visible ones. |
---|
| 4804 | +*/ |
---|
| 4805 | +#define MAJOR(dev) ((dev)>>8) |
---|
| 4806 | +#define MINOR(dev) ((dev) & 0xff) |
---|
| 4807 | +#define MKDEV(ma,mi) ((ma)<<8 | (mi)) |
---|
| 4808 | +#endif |
---|
| 4809 | diff -Naur aboot-0.9b.orig/include/linux/kernel.h aboot-0.9b/include/linux/kernel.h |
---|
| 4810 | --- aboot-0.9b.orig/include/linux/kernel.h 1969-12-31 19:00:00.000000000 -0500 |
---|
| 4811 | +++ aboot-0.9b/include/linux/kernel.h 2008-01-02 13:53:15.000000000 -0500 |
---|
| 4812 | @@ -0,0 +1,46 @@ |
---|
| 4813 | +#ifndef _LINUX_KERNEL_H |
---|
| 4814 | +#define _LINUX_KERNEL_H |
---|
| 4815 | + |
---|
| 4816 | +/* |
---|
| 4817 | + * 'kernel.h' contains some often-used function prototypes etc |
---|
| 4818 | + */ |
---|
| 4819 | + |
---|
| 4820 | + |
---|
| 4821 | +#define SI_LOAD_SHIFT 16 |
---|
| 4822 | +struct sysinfo { |
---|
| 4823 | + long uptime; /* Seconds since boot */ |
---|
| 4824 | + unsigned long loads[3]; /* 1, 5, and 15 minute load averages */ |
---|
| 4825 | + unsigned long totalram; /* Total usable main memory size */ |
---|
| 4826 | + unsigned long freeram; /* Available memory size */ |
---|
| 4827 | + unsigned long sharedram; /* Amount of shared memory */ |
---|
| 4828 | + unsigned long bufferram; /* Memory used by buffers */ |
---|
| 4829 | + unsigned long totalswap; /* Total swap space size */ |
---|
| 4830 | + unsigned long freeswap; /* swap space still available */ |
---|
| 4831 | + unsigned short procs; /* Number of current processes */ |
---|
| 4832 | + unsigned short pad; /* explicit padding for m68k */ |
---|
| 4833 | + unsigned long totalhigh; /* Total high memory size */ |
---|
| 4834 | + unsigned long freehigh; /* Available high memory size */ |
---|
| 4835 | + unsigned int mem_unit; /* Memory unit size in bytes */ |
---|
| 4836 | + char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */ |
---|
| 4837 | +}; |
---|
| 4838 | + |
---|
| 4839 | +/* Force a compilation error if condition is true */ |
---|
| 4840 | +#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) |
---|
| 4841 | + |
---|
| 4842 | +/* Force a compilation error if condition is true, but also produce a |
---|
| 4843 | + result (of value 0 and type size_t), so the expression can be used |
---|
| 4844 | + e.g. in a structure initializer (or where-ever else comma expressions |
---|
| 4845 | + aren't permitted). */ |
---|
| 4846 | +#define BUILD_BUG_ON_ZERO(e) (sizeof(char[1 - 2 * !!(e)]) - 1) |
---|
| 4847 | + |
---|
| 4848 | +/* Trap pasters of __FUNCTION__ at compile-time */ |
---|
| 4849 | +#define __FUNCTION__ (__func__) |
---|
| 4850 | + |
---|
| 4851 | +/* This helps us to avoid #ifdef CONFIG_NUMA */ |
---|
| 4852 | +#ifdef CONFIG_NUMA |
---|
| 4853 | +#define NUMA_BUILD 1 |
---|
| 4854 | +#else |
---|
| 4855 | +#define NUMA_BUILD 0 |
---|
| 4856 | +#endif |
---|
| 4857 | + |
---|
| 4858 | +#endif |
---|
| 4859 | diff -Naur aboot-0.9b.orig/include/linux/limits.h aboot-0.9b/include/linux/limits.h |
---|
| 4860 | --- aboot-0.9b.orig/include/linux/limits.h 1969-12-31 19:00:00.000000000 -0500 |
---|
| 4861 | +++ aboot-0.9b/include/linux/limits.h 2008-01-02 13:53:15.000000000 -0500 |
---|
| 4862 | @@ -0,0 +1,20 @@ |
---|
| 4863 | +#ifndef _LINUX_LIMITS_H |
---|
| 4864 | +#define _LINUX_LIMITS_H |
---|
| 4865 | + |
---|
| 4866 | +#define NR_OPEN 1024 |
---|
| 4867 | + |
---|
| 4868 | +#define NGROUPS_MAX 65536 /* supplemental group IDs are available */ |
---|
| 4869 | +#define ARG_MAX 131072 /* # bytes of args + environ for exec() */ |
---|
| 4870 | +#define LINK_MAX 127 /* # links a file may have */ |
---|
| 4871 | +#define MAX_CANON 255 /* size of the canonical input queue */ |
---|
| 4872 | +#define MAX_INPUT 255 /* size of the type-ahead buffer */ |
---|
| 4873 | +#define NAME_MAX 255 /* # chars in a file name */ |
---|
| 4874 | +#define PATH_MAX 4096 /* # chars in a path name including nul */ |
---|
| 4875 | +#define PIPE_BUF 4096 /* # bytes in atomic write to a pipe */ |
---|
| 4876 | +#define XATTR_NAME_MAX 255 /* # chars in an extended attribute name */ |
---|
| 4877 | +#define XATTR_SIZE_MAX 65536 /* size of an extended attribute value (64k) */ |
---|
| 4878 | +#define XATTR_LIST_MAX 65536 /* size of extended attribute namelist (64k) */ |
---|
| 4879 | + |
---|
| 4880 | +#define RTSIG_MAX 32 |
---|
| 4881 | + |
---|
| 4882 | +#endif |
---|
| 4883 | diff -Naur aboot-0.9b.orig/include/linux/magic.h aboot-0.9b/include/linux/magic.h |
---|
| 4884 | --- aboot-0.9b.orig/include/linux/magic.h 1969-12-31 19:00:00.000000000 -0500 |
---|
| 4885 | +++ aboot-0.9b/include/linux/magic.h 2008-01-02 13:53:15.000000000 -0500 |
---|
| 4886 | @@ -0,0 +1,41 @@ |
---|
| 4887 | +#ifndef __LINUX_MAGIC_H__ |
---|
| 4888 | +#define __LINUX_MAGIC_H__ |
---|
| 4889 | + |
---|
| 4890 | +#define ADFS_SUPER_MAGIC 0xadf5 |
---|
| 4891 | +#define AFFS_SUPER_MAGIC 0xadff |
---|
| 4892 | +#define AFS_SUPER_MAGIC 0x5346414F |
---|
| 4893 | +#define AUTOFS_SUPER_MAGIC 0x0187 |
---|
| 4894 | +#define CODA_SUPER_MAGIC 0x73757245 |
---|
| 4895 | +#define EFS_SUPER_MAGIC 0x414A53 |
---|
| 4896 | +#define EXT2_SUPER_MAGIC 0xEF53 |
---|
| 4897 | +#define EXT3_SUPER_MAGIC 0xEF53 |
---|
| 4898 | +#define EXT4_SUPER_MAGIC 0xEF53 |
---|
| 4899 | +#define HPFS_SUPER_MAGIC 0xf995e849 |
---|
| 4900 | +#define ISOFS_SUPER_MAGIC 0x9660 |
---|
| 4901 | +#define JFFS2_SUPER_MAGIC 0x72b6 |
---|
| 4902 | +#define ANON_INODE_FS_MAGIC 0x09041934 |
---|
| 4903 | + |
---|
| 4904 | +#define MINIX_SUPER_MAGIC 0x137F /* original minix fs */ |
---|
| 4905 | +#define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */ |
---|
| 4906 | +#define MINIX2_SUPER_MAGIC 0x2468 /* minix V2 fs */ |
---|
| 4907 | +#define MINIX2_SUPER_MAGIC2 0x2478 /* minix V2 fs, 30 char names */ |
---|
| 4908 | +#define MINIX3_SUPER_MAGIC 0x4d5a /* minix V3 fs */ |
---|
| 4909 | + |
---|
| 4910 | +#define MSDOS_SUPER_MAGIC 0x4d44 /* MD */ |
---|
| 4911 | +#define NCP_SUPER_MAGIC 0x564c /* Guess, what 0x564c is :-) */ |
---|
| 4912 | +#define NFS_SUPER_MAGIC 0x6969 |
---|
| 4913 | +#define OPENPROM_SUPER_MAGIC 0x9fa1 |
---|
| 4914 | +#define PROC_SUPER_MAGIC 0x9fa0 |
---|
| 4915 | +#define QNX4_SUPER_MAGIC 0x002f /* qnx4 fs detection */ |
---|
| 4916 | + |
---|
| 4917 | +#define REISERFS_SUPER_MAGIC 0x52654973 /* used by gcc */ |
---|
| 4918 | + /* used by file system utilities that |
---|
| 4919 | + look at the superblock, etc. */ |
---|
| 4920 | +#define REISERFS_SUPER_MAGIC_STRING "ReIsErFs" |
---|
| 4921 | +#define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs" |
---|
| 4922 | +#define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs" |
---|
| 4923 | + |
---|
| 4924 | +#define SMB_SUPER_MAGIC 0x517B |
---|
| 4925 | +#define USBDEVICE_SUPER_MAGIC 0x9fa2 |
---|
| 4926 | + |
---|
| 4927 | +#endif /* __LINUX_MAGIC_H__ */ |
---|
| 4928 | diff -Naur aboot-0.9b.orig/include/linux/param.h aboot-0.9b/include/linux/param.h |
---|
| 4929 | --- aboot-0.9b.orig/include/linux/param.h 1969-12-31 19:00:00.000000000 -0500 |
---|
| 4930 | +++ aboot-0.9b/include/linux/param.h 2008-01-02 13:53:15.000000000 -0500 |
---|
| 4931 | @@ -0,0 +1,6 @@ |
---|
| 4932 | +#ifndef _LINUX_PARAM_H |
---|
| 4933 | +#define _LINUX_PARAM_H |
---|
| 4934 | + |
---|
| 4935 | +#include <asm/param.h> |
---|
| 4936 | + |
---|
| 4937 | +#endif |
---|
| 4938 | diff -Naur aboot-0.9b.orig/include/linux/posix_types.h aboot-0.9b/include/linux/posix_types.h |
---|
| 4939 | --- aboot-0.9b.orig/include/linux/posix_types.h 1969-12-31 19:00:00.000000000 -0500 |
---|
| 4940 | +++ aboot-0.9b/include/linux/posix_types.h 2008-01-02 13:53:15.000000000 -0500 |
---|
| 4941 | @@ -0,0 +1,49 @@ |
---|
| 4942 | +#ifndef _LINUX_POSIX_TYPES_H |
---|
| 4943 | +#define _LINUX_POSIX_TYPES_H |
---|
| 4944 | + |
---|
| 4945 | +#include <linux/stddef.h> |
---|
| 4946 | + |
---|
| 4947 | +/* |
---|
| 4948 | + * This allows for 1024 file descriptors: if NR_OPEN is ever grown |
---|
| 4949 | + * beyond that you'll have to change this too. But 1024 fd's seem to be |
---|
| 4950 | + * enough even for such "real" unices like OSF/1, so hopefully this is |
---|
| 4951 | + * one limit that doesn't have to be changed [again]. |
---|
| 4952 | + * |
---|
| 4953 | + * Note that POSIX wants the FD_CLEAR(fd,fdsetp) defines to be in |
---|
| 4954 | + * <sys/time.h> (and thus <linux/time.h>) - but this is a more logical |
---|
| 4955 | + * place for them. Solved by having dummy defines in <sys/time.h>. |
---|
| 4956 | + */ |
---|
| 4957 | + |
---|
| 4958 | +/* |
---|
| 4959 | + * Those macros may have been defined in <gnu/types.h>. But we always |
---|
| 4960 | + * use the ones here. |
---|
| 4961 | + */ |
---|
| 4962 | +#undef __NFDBITS |
---|
| 4963 | +#define __NFDBITS (8 * sizeof(unsigned long)) |
---|
| 4964 | + |
---|
| 4965 | +#undef __FD_SETSIZE |
---|
| 4966 | +#define __FD_SETSIZE 1024 |
---|
| 4967 | + |
---|
| 4968 | +#undef __FDSET_LONGS |
---|
| 4969 | +#define __FDSET_LONGS (__FD_SETSIZE/__NFDBITS) |
---|
| 4970 | + |
---|
| 4971 | +#undef __FDELT |
---|
| 4972 | +#define __FDELT(d) ((d) / __NFDBITS) |
---|
| 4973 | + |
---|
| 4974 | +#undef __FDMASK |
---|
| 4975 | +#define __FDMASK(d) (1UL << ((d) % __NFDBITS)) |
---|
| 4976 | + |
---|
| 4977 | +typedef struct { |
---|
| 4978 | + unsigned long fds_bits [__FDSET_LONGS]; |
---|
| 4979 | +} __kernel_fd_set; |
---|
| 4980 | + |
---|
| 4981 | +/* Type of a signal handler. */ |
---|
| 4982 | +typedef void (*__kernel_sighandler_t)(int); |
---|
| 4983 | + |
---|
| 4984 | +/* Type of a SYSV IPC key. */ |
---|
| 4985 | +typedef int __kernel_key_t; |
---|
| 4986 | +typedef int __kernel_mqd_t; |
---|
| 4987 | + |
---|
| 4988 | +#include <asm/posix_types.h> |
---|
| 4989 | + |
---|
| 4990 | +#endif /* _LINUX_POSIX_TYPES_H */ |
---|
| 4991 | diff -Naur aboot-0.9b.orig/include/linux/stat.h aboot-0.9b/include/linux/stat.h |
---|
| 4992 | --- aboot-0.9b.orig/include/linux/stat.h 1969-12-31 19:00:00.000000000 -0500 |
---|
| 4993 | +++ aboot-0.9b/include/linux/stat.h 2008-01-02 13:53:15.000000000 -0500 |
---|
| 4994 | @@ -0,0 +1,45 @@ |
---|
| 4995 | +#ifndef _LINUX_STAT_H |
---|
| 4996 | +#define _LINUX_STAT_H |
---|
| 4997 | + |
---|
| 4998 | + |
---|
| 4999 | +#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) |
---|
| 5000 | + |
---|
| 5001 | +#define S_IFMT 00170000 |
---|
| 5002 | +#define S_IFSOCK 0140000 |
---|
| 5003 | +#define S_IFLNK 0120000 |
---|
| 5004 | +#define S_IFREG 0100000 |
---|
| 5005 | +#define S_IFBLK 0060000 |
---|
| 5006 | +#define S_IFDIR 0040000 |
---|
| 5007 | +#define S_IFCHR 0020000 |
---|
| 5008 | +#define S_IFIFO 0010000 |
---|
| 5009 | +#define S_ISUID 0004000 |
---|
| 5010 | +#define S_ISGID 0002000 |
---|
| 5011 | +#define S_ISVTX 0001000 |
---|
| 5012 | + |
---|
| 5013 | +#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) |
---|
| 5014 | +#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) |
---|
| 5015 | +#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) |
---|
| 5016 | +#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) |
---|
| 5017 | +#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) |
---|
| 5018 | +#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) |
---|
| 5019 | +#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) |
---|
| 5020 | + |
---|
| 5021 | +#define S_IRWXU 00700 |
---|
| 5022 | +#define S_IRUSR 00400 |
---|
| 5023 | +#define S_IWUSR 00200 |
---|
| 5024 | +#define S_IXUSR 00100 |
---|
| 5025 | + |
---|
| 5026 | +#define S_IRWXG 00070 |
---|
| 5027 | +#define S_IRGRP 00040 |
---|
| 5028 | +#define S_IWGRP 00020 |
---|
| 5029 | +#define S_IXGRP 00010 |
---|
| 5030 | + |
---|
| 5031 | +#define S_IRWXO 00007 |
---|
| 5032 | +#define S_IROTH 00004 |
---|
| 5033 | +#define S_IWOTH 00002 |
---|
| 5034 | +#define S_IXOTH 00001 |
---|
| 5035 | + |
---|
| 5036 | +#endif |
---|
| 5037 | + |
---|
| 5038 | + |
---|
| 5039 | +#endif |
---|
| 5040 | diff -Naur aboot-0.9b.orig/include/linux/stddef.h aboot-0.9b/include/linux/stddef.h |
---|
| 5041 | --- aboot-0.9b.orig/include/linux/stddef.h 1969-12-31 19:00:00.000000000 -0500 |
---|
| 5042 | +++ aboot-0.9b/include/linux/stddef.h 2008-01-02 13:53:15.000000000 -0500 |
---|
| 5043 | @@ -0,0 +1,13 @@ |
---|
| 5044 | +#ifndef _LINUX_STDDEF_H |
---|
| 5045 | +#define _LINUX_STDDEF_H |
---|
| 5046 | + |
---|
| 5047 | + |
---|
| 5048 | +#undef NULL |
---|
| 5049 | +#if defined(__cplusplus) |
---|
| 5050 | +#define NULL 0 |
---|
| 5051 | +#else |
---|
| 5052 | +#define NULL ((void *)0) |
---|
| 5053 | +#endif |
---|
| 5054 | + |
---|
| 5055 | + |
---|
| 5056 | +#endif |
---|
| 5057 | diff -Naur aboot-0.9b.orig/include/linux/string.h aboot-0.9b/include/linux/string.h |
---|
| 5058 | --- aboot-0.9b.orig/include/linux/string.h 1969-12-31 19:00:00.000000000 -0500 |
---|
| 5059 | +++ aboot-0.9b/include/linux/string.h 2008-01-02 13:53:15.000000000 -0500 |
---|
| 5060 | @@ -0,0 +1,113 @@ |
---|
| 5061 | +#ifndef _LINUX_STRING_H_ |
---|
| 5062 | +#define _LINUX_STRING_H_ |
---|
| 5063 | + |
---|
| 5064 | +/* We don't want strings.h stuff being user by user stuff by accident */ |
---|
| 5065 | + |
---|
| 5066 | +#ifdef __KERNEL__ |
---|
| 5067 | + |
---|
| 5068 | +#include <linux/types.h> /* for size_t */ |
---|
| 5069 | +#include <linux/stddef.h> /* for NULL */ |
---|
| 5070 | + |
---|
| 5071 | +#ifdef __cplusplus |
---|
| 5072 | +extern "C" { |
---|
| 5073 | +#endif |
---|
| 5074 | + |
---|
| 5075 | +//extern char *strndup_user(const char __user *, long); |
---|
| 5076 | + |
---|
| 5077 | +#ifndef __HAVE_ARCH_STRCPY |
---|
| 5078 | +extern char * strcpy(char *,const char *); |
---|
| 5079 | +#endif |
---|
| 5080 | +#ifndef __HAVE_ARCH_STRNCPY |
---|
| 5081 | +extern char * strncpy(char *,const char *, __kernel_size_t); |
---|
| 5082 | +#endif |
---|
| 5083 | +#ifndef __HAVE_ARCH_STRLCPY |
---|
| 5084 | +size_t strlcpy(char *, const char *, size_t); |
---|
| 5085 | +#endif |
---|
| 5086 | +#ifndef __HAVE_ARCH_STRCAT |
---|
| 5087 | +extern char * strcat(char *, const char *); |
---|
| 5088 | +#endif |
---|
| 5089 | +#ifndef __HAVE_ARCH_STRNCAT |
---|
| 5090 | +extern char * strncat(char *, const char *, __kernel_size_t); |
---|
| 5091 | +#endif |
---|
| 5092 | +#ifndef __HAVE_ARCH_STRLCAT |
---|
| 5093 | +extern size_t strlcat(char *, const char *, __kernel_size_t); |
---|
| 5094 | +#endif |
---|
| 5095 | +#ifndef __HAVE_ARCH_STRCMP |
---|
| 5096 | +extern int strcmp(const char *,const char *); |
---|
| 5097 | +#endif |
---|
| 5098 | +#ifndef __HAVE_ARCH_STRNCMP |
---|
| 5099 | +extern int strncmp(const char *,const char *,__kernel_size_t); |
---|
| 5100 | +#endif |
---|
| 5101 | +#ifndef __HAVE_ARCH_STRNICMP |
---|
| 5102 | +extern int strnicmp(const char *, const char *, __kernel_size_t); |
---|
| 5103 | +#endif |
---|
| 5104 | +#ifndef __HAVE_ARCH_STRCASECMP |
---|
| 5105 | +extern int strcasecmp(const char *s1, const char *s2); |
---|
| 5106 | +#endif |
---|
| 5107 | +#ifndef __HAVE_ARCH_STRNCASECMP |
---|
| 5108 | +extern int strncasecmp(const char *s1, const char *s2, size_t n); |
---|
| 5109 | +#endif |
---|
| 5110 | +#ifndef __HAVE_ARCH_STRCHR |
---|
| 5111 | +extern char * strchr(const char *,int); |
---|
| 5112 | +#endif |
---|
| 5113 | +#ifndef __HAVE_ARCH_STRNCHR |
---|
| 5114 | +extern char * strnchr(const char *, size_t, int); |
---|
| 5115 | +#endif |
---|
| 5116 | +#ifndef __HAVE_ARCH_STRRCHR |
---|
| 5117 | +extern char * strrchr(const char *,int); |
---|
| 5118 | +#endif |
---|
| 5119 | +extern char * strstrip(char *); |
---|
| 5120 | +#ifndef __HAVE_ARCH_STRSTR |
---|
| 5121 | +extern char * strstr(const char *,const char *); |
---|
| 5122 | +#endif |
---|
| 5123 | +#ifndef __HAVE_ARCH_STRLEN |
---|
| 5124 | +extern __kernel_size_t strlen(const char *); |
---|
| 5125 | +#endif |
---|
| 5126 | +#ifndef __HAVE_ARCH_STRNLEN |
---|
| 5127 | +extern __kernel_size_t strnlen(const char *,__kernel_size_t); |
---|
| 5128 | +#endif |
---|
| 5129 | +#ifndef __HAVE_ARCH_STRPBRK |
---|
| 5130 | +extern char * strpbrk(const char *,const char *); |
---|
| 5131 | +#endif |
---|
| 5132 | +#ifndef __HAVE_ARCH_STRSEP |
---|
| 5133 | +extern char * strsep(char **,const char *); |
---|
| 5134 | +#endif |
---|
| 5135 | +#ifndef __HAVE_ARCH_STRSPN |
---|
| 5136 | +extern __kernel_size_t strspn(const char *,const char *); |
---|
| 5137 | +#endif |
---|
| 5138 | +#ifndef __HAVE_ARCH_STRCSPN |
---|
| 5139 | +extern __kernel_size_t strcspn(const char *,const char *); |
---|
| 5140 | +#endif |
---|
| 5141 | + |
---|
| 5142 | +#ifndef __HAVE_ARCH_MEMSET |
---|
| 5143 | +extern void * memset(void *,int,__kernel_size_t); |
---|
| 5144 | +#endif |
---|
| 5145 | +#ifndef __HAVE_ARCH_MEMCPY |
---|
| 5146 | +extern void * memcpy(void *,const void *,__kernel_size_t); |
---|
| 5147 | +#endif |
---|
| 5148 | +#ifndef __HAVE_ARCH_MEMMOVE |
---|
| 5149 | +extern void * memmove(void *,const void *,__kernel_size_t); |
---|
| 5150 | +#endif |
---|
| 5151 | +#ifndef __HAVE_ARCH_MEMSCAN |
---|
| 5152 | +extern void * memscan(void *,int,__kernel_size_t); |
---|
| 5153 | +#endif |
---|
| 5154 | +#ifndef __HAVE_ARCH_MEMCMP |
---|
| 5155 | +extern int memcmp(const void *,const void *,__kernel_size_t); |
---|
| 5156 | +#endif |
---|
| 5157 | +#ifndef __HAVE_ARCH_MEMCHR |
---|
| 5158 | +extern void * memchr(const void *,int,__kernel_size_t); |
---|
| 5159 | +#endif |
---|
| 5160 | + |
---|
| 5161 | +//extern char *kstrdup(const char *s, gfp_t gfp); |
---|
| 5162 | +//extern char *kstrndup(const char *s, size_t len, gfp_t gfp); |
---|
| 5163 | +//extern void *kmemdup(const void *src, size_t len, gfp_t gfp); |
---|
| 5164 | + |
---|
| 5165 | +//extern char **argv_split(gfp_t gfp, const char *str, int *argcp); |
---|
| 5166 | +//extern void argv_free(char **argv); |
---|
| 5167 | + |
---|
| 5168 | +#ifdef __cplusplus |
---|
| 5169 | +} |
---|
| 5170 | +#endif |
---|
| 5171 | + |
---|
| 5172 | +#endif |
---|
| 5173 | +#endif /* _LINUX_STRING_H_ */ |
---|
| 5174 | diff -Naur aboot-0.9b.orig/include/linux/types.h aboot-0.9b/include/linux/types.h |
---|
| 5175 | --- aboot-0.9b.orig/include/linux/types.h 1969-12-31 19:00:00.000000000 -0500 |
---|
| 5176 | +++ aboot-0.9b/include/linux/types.h 2008-01-02 13:53:15.000000000 -0500 |
---|
| 5177 | @@ -0,0 +1,172 @@ |
---|
| 5178 | +#ifndef _LINUX_TYPES_H |
---|
| 5179 | +#define _LINUX_TYPES_H |
---|
| 5180 | + |
---|
| 5181 | + |
---|
| 5182 | +#include <linux/posix_types.h> |
---|
| 5183 | +#include <asm/types.h> |
---|
| 5184 | + |
---|
| 5185 | +#ifndef __KERNEL_STRICT_NAMES |
---|
| 5186 | + |
---|
| 5187 | +typedef __u32 __kernel_dev_t; |
---|
| 5188 | + |
---|
| 5189 | +typedef __kernel_fd_set fd_set; |
---|
| 5190 | +typedef __kernel_dev_t dev_t; |
---|
| 5191 | +typedef __kernel_ino_t ino_t; |
---|
| 5192 | +typedef __kernel_mode_t mode_t; |
---|
| 5193 | +typedef __kernel_nlink_t nlink_t; |
---|
| 5194 | +typedef __kernel_off_t off_t; |
---|
| 5195 | +typedef __kernel_pid_t pid_t; |
---|
| 5196 | +typedef __kernel_daddr_t daddr_t; |
---|
| 5197 | +typedef __kernel_key_t key_t; |
---|
| 5198 | +typedef __kernel_suseconds_t suseconds_t; |
---|
| 5199 | +typedef __kernel_timer_t timer_t; |
---|
| 5200 | +typedef __kernel_clockid_t clockid_t; |
---|
| 5201 | +typedef __kernel_mqd_t mqd_t; |
---|
| 5202 | + |
---|
| 5203 | +typedef __kernel_uid_t uid_t; |
---|
| 5204 | +typedef __kernel_gid_t gid_t; |
---|
| 5205 | + |
---|
| 5206 | +#if defined(__GNUC__) && !defined(__STRICT_ANSI__) |
---|
| 5207 | +typedef __kernel_loff_t loff_t; |
---|
| 5208 | +#endif |
---|
| 5209 | + |
---|
| 5210 | +/* |
---|
| 5211 | + * The following typedefs are also protected by individual ifdefs for |
---|
| 5212 | + * historical reasons: |
---|
| 5213 | + */ |
---|
| 5214 | +#ifndef _SIZE_T |
---|
| 5215 | +#define _SIZE_T |
---|
| 5216 | +typedef __kernel_size_t size_t; |
---|
| 5217 | +#endif |
---|
| 5218 | + |
---|
| 5219 | +#ifndef _SSIZE_T |
---|
| 5220 | +#define _SSIZE_T |
---|
| 5221 | +typedef __kernel_ssize_t ssize_t; |
---|
| 5222 | +#endif |
---|
| 5223 | + |
---|
| 5224 | +#ifndef _PTRDIFF_T |
---|
| 5225 | +#define _PTRDIFF_T |
---|
| 5226 | +typedef __kernel_ptrdiff_t ptrdiff_t; |
---|
| 5227 | +#endif |
---|
| 5228 | + |
---|
| 5229 | +#ifndef _TIME_T |
---|
| 5230 | +#define _TIME_T |
---|
| 5231 | +typedef __kernel_time_t time_t; |
---|
| 5232 | +#endif |
---|
| 5233 | + |
---|
| 5234 | +#ifndef _CLOCK_T |
---|
| 5235 | +#define _CLOCK_T |
---|
| 5236 | +typedef __kernel_clock_t clock_t; |
---|
| 5237 | +#endif |
---|
| 5238 | + |
---|
| 5239 | +#ifndef _CADDR_T |
---|
| 5240 | +#define _CADDR_T |
---|
| 5241 | +typedef __kernel_caddr_t caddr_t; |
---|
| 5242 | +#endif |
---|
| 5243 | + |
---|
| 5244 | +/* bsd */ |
---|
| 5245 | +typedef unsigned char u_char; |
---|
| 5246 | +typedef unsigned short u_short; |
---|
| 5247 | +typedef unsigned int u_int; |
---|
| 5248 | +typedef unsigned long u_long; |
---|
| 5249 | + |
---|
| 5250 | +/* sysv */ |
---|
| 5251 | +typedef unsigned char unchar; |
---|
| 5252 | +typedef unsigned short ushort; |
---|
| 5253 | +typedef unsigned int uint; |
---|
| 5254 | +typedef unsigned long ulong; |
---|
| 5255 | + |
---|
| 5256 | +#ifndef __BIT_TYPES_DEFINED__ |
---|
| 5257 | +#define __BIT_TYPES_DEFINED__ |
---|
| 5258 | + |
---|
| 5259 | +typedef __u8 u_int8_t; |
---|
| 5260 | +typedef __s8 int8_t; |
---|
| 5261 | +typedef __u16 u_int16_t; |
---|
| 5262 | +typedef __s16 int16_t; |
---|
| 5263 | +typedef __u32 u_int32_t; |
---|
| 5264 | +typedef __s32 int32_t; |
---|
| 5265 | + |
---|
| 5266 | +#endif /* !(__BIT_TYPES_DEFINED__) */ |
---|
| 5267 | + |
---|
| 5268 | +typedef __u8 uint8_t; |
---|
| 5269 | +typedef __u16 uint16_t; |
---|
| 5270 | +typedef __u32 uint32_t; |
---|
| 5271 | + |
---|
| 5272 | +#if defined(__GNUC__) && !defined(__STRICT_ANSI__) |
---|
| 5273 | +typedef __u64 uint64_t; |
---|
| 5274 | +typedef __u64 u_int64_t; |
---|
| 5275 | +typedef __s64 int64_t; |
---|
| 5276 | +#endif |
---|
| 5277 | + |
---|
| 5278 | +/* this is a special 64bit data type that is 8-byte aligned */ |
---|
| 5279 | +#define aligned_u64 unsigned long long __attribute__((aligned(8))) |
---|
| 5280 | +#define aligned_be64 __be64 __attribute__((aligned(8))) |
---|
| 5281 | +#define aligned_le64 __le64 __attribute__((aligned(8))) |
---|
| 5282 | + |
---|
| 5283 | +/** |
---|
| 5284 | + * The type used for indexing onto a disc or disc partition. |
---|
| 5285 | + * |
---|
| 5286 | + * Linux always considers sectors to be 512 bytes long independently |
---|
| 5287 | + * of the devices real block size. |
---|
| 5288 | + */ |
---|
| 5289 | +#ifdef CONFIG_LBD |
---|
| 5290 | +typedef u64 sector_t; |
---|
| 5291 | +#else |
---|
| 5292 | +typedef unsigned long sector_t; |
---|
| 5293 | +#endif |
---|
| 5294 | + |
---|
| 5295 | +/* |
---|
| 5296 | + * The type of the inode's block count. |
---|
| 5297 | + */ |
---|
| 5298 | +#ifdef CONFIG_LSF |
---|
| 5299 | +typedef u64 blkcnt_t; |
---|
| 5300 | +#else |
---|
| 5301 | +typedef unsigned long blkcnt_t; |
---|
| 5302 | +#endif |
---|
| 5303 | + |
---|
| 5304 | +/* |
---|
| 5305 | + * The type of an index into the pagecache. Use a #define so asm/types.h |
---|
| 5306 | + * can override it. |
---|
| 5307 | + */ |
---|
| 5308 | +#ifndef pgoff_t |
---|
| 5309 | +#define pgoff_t unsigned long |
---|
| 5310 | +#endif |
---|
| 5311 | + |
---|
| 5312 | +#endif /* __KERNEL_STRICT_NAMES */ |
---|
| 5313 | + |
---|
| 5314 | +/* |
---|
| 5315 | + * Below are truly Linux-specific types that should never collide with |
---|
| 5316 | + * any application/library that wants linux/types.h. |
---|
| 5317 | + */ |
---|
| 5318 | + |
---|
| 5319 | +#ifdef __CHECKER__ |
---|
| 5320 | +#define __bitwise__ __attribute__((bitwise)) |
---|
| 5321 | +#else |
---|
| 5322 | +#define __bitwise__ |
---|
| 5323 | +#endif |
---|
| 5324 | +#ifdef __CHECK_ENDIAN__ |
---|
| 5325 | +#define __bitwise __bitwise__ |
---|
| 5326 | +#else |
---|
| 5327 | +#define __bitwise |
---|
| 5328 | +#endif |
---|
| 5329 | + |
---|
| 5330 | +typedef __u16 __bitwise __le16; |
---|
| 5331 | +typedef __u16 __bitwise __be16; |
---|
| 5332 | +typedef __u32 __bitwise __le32; |
---|
| 5333 | +typedef __u32 __bitwise __be32; |
---|
| 5334 | +#if defined(__GNUC__) && !defined(__STRICT_ANSI__) |
---|
| 5335 | +typedef __u64 __bitwise __le64; |
---|
| 5336 | +typedef __u64 __bitwise __be64; |
---|
| 5337 | +#endif |
---|
| 5338 | +typedef __u16 __bitwise __sum16; |
---|
| 5339 | +typedef __u32 __bitwise __wsum; |
---|
| 5340 | + |
---|
| 5341 | + |
---|
| 5342 | +struct ustat { |
---|
| 5343 | + __kernel_daddr_t f_tfree; |
---|
| 5344 | + __kernel_ino_t f_tinode; |
---|
| 5345 | + char f_fname[6]; |
---|
| 5346 | + char f_fpack[6]; |
---|
| 5347 | +}; |
---|
| 5348 | + |
---|
| 5349 | +#endif /* _LINUX_TYPES_H */ |
---|
| 5350 | diff -Naur aboot-0.9b.orig/include/linux/version.h aboot-0.9b/include/linux/version.h |
---|
| 5351 | --- aboot-0.9b.orig/include/linux/version.h 1969-12-31 19:00:00.000000000 -0500 |
---|
| 5352 | +++ aboot-0.9b/include/linux/version.h 2008-01-02 13:53:15.000000000 -0500 |
---|
| 5353 | @@ -0,0 +1,2 @@ |
---|
| 5354 | +#define LINUX_VERSION_CODE 132631 |
---|
| 5355 | +#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) |
---|
| 5356 | diff -Naur aboot-0.9b.orig/include/utils.h aboot-0.9b/include/utils.h |
---|
| 5357 | --- aboot-0.9b.orig/include/utils.h 2001-10-08 19:03:52.000000000 -0400 |
---|
| 5358 | +++ aboot-0.9b/include/utils.h 2008-01-02 13:53:15.000000000 -0500 |
---|
| 5359 | @@ -15,6 +15,10 @@ |
---|
| 5360 | extern void getline (char *buf, int maxlen); |
---|
| 5361 | #endif |
---|
| 5362 | |
---|
| 5363 | +unsigned long simple_strtoul(const char *cp, char **endp, unsigned int base); |
---|
| 5364 | +size_t strnlen(const char * s, size_t count); |
---|
| 5365 | +char * strtok(char * s,const char * ct); |
---|
| 5366 | + |
---|
| 5367 | extern unsigned long memory_end(void); |
---|
| 5368 | extern unsigned long free_mem_ptr; |
---|
| 5369 | |
---|
| 5370 | diff -Naur aboot-0.9b.orig/lib/Makefile aboot-0.9b/lib/Makefile |
---|
| 5371 | --- aboot-0.9b.orig/lib/Makefile 2002-09-18 15:48:22.000000000 -0400 |
---|
| 5372 | +++ aboot-0.9b/lib/Makefile 2008-01-02 13:53:15.000000000 -0500 |
---|
| 5373 | @@ -1,4 +1,5 @@ |
---|
| 5374 | -CC = gcc |
---|
| 5375 | +include ../Makefile.inc |
---|
| 5376 | + |
---|
| 5377 | CPPFLAGS += -D__KERNEL__ -I../include |
---|
| 5378 | ifeq ($(TESTING),) |
---|
| 5379 | CFLAGS = -Os -Wall -mno-fp-regs -fno-builtin |
---|
| 5380 | @@ -11,10 +12,10 @@ |
---|
| 5381 | libaboot.a: vsprintf.o memcpy.o memset.o string.o _setjmp.o \ |
---|
| 5382 | _longjmp.o isolib.o __divqu.o __remqu.o __divlu.o \ |
---|
| 5383 | __remlu.o |
---|
| 5384 | - ar cru $@ $? |
---|
| 5385 | + $(AR) cru $@ $? |
---|
| 5386 | else |
---|
| 5387 | libaboot.a: isolib.o |
---|
| 5388 | - ar cru $@ $? |
---|
| 5389 | + $(AR) cru $@ $? |
---|
| 5390 | endif |
---|
| 5391 | |
---|
| 5392 | clean: |
---|
| 5393 | diff -Naur aboot-0.9b.orig/lib/isolib.c aboot-0.9b/lib/isolib.c |
---|
| 5394 | --- aboot-0.9b.orig/lib/isolib.c 2001-10-08 19:03:53.000000000 -0400 |
---|
| 5395 | +++ aboot-0.9b/lib/isolib.c 2008-01-02 13:53:15.000000000 -0500 |
---|
| 5396 | @@ -6,16 +6,14 @@ |
---|
| 5397 | * functionality to the Linux bootstrapper. All we can do is |
---|
| 5398 | * open and read files... but that's all we need 8-) |
---|
| 5399 | */ |
---|
| 5400 | -#ifndef TESTING |
---|
| 5401 | -# include <linux/string.h> |
---|
| 5402 | -#endif |
---|
| 5403 | #include <linux/kernel.h> |
---|
| 5404 | -#include <linux/config.h> |
---|
| 5405 | #include <linux/types.h> |
---|
| 5406 | #include <linux/stat.h> |
---|
| 5407 | #include <linux/kdev_t.h> |
---|
| 5408 | #include <asm/page.h> |
---|
| 5409 | |
---|
| 5410 | +#include <string.h> |
---|
| 5411 | + |
---|
| 5412 | #include <iso.h> |
---|
| 5413 | #include <isolib.h> |
---|
| 5414 | #include <utils.h> |
---|
| 5415 | @@ -488,7 +486,7 @@ |
---|
| 5416 | if (dlen) { |
---|
| 5417 | strcpy(de->name, retname); |
---|
| 5418 | } else { |
---|
| 5419 | - dlen = isonum_711(de->name_len); |
---|
| 5420 | + dlen = isonum_711((char *)de->name_len); |
---|
| 5421 | if(sb.s_mapping == 'n') { |
---|
| 5422 | for (i = 0; i < dlen; i++) { |
---|
| 5423 | c = de->name[i]; |
---|
| 5424 | @@ -1035,7 +1033,7 @@ |
---|
| 5425 | * Everything's cool, let's get the filename. |
---|
| 5426 | * First we need to figure out the length. |
---|
| 5427 | */ |
---|
| 5428 | - name_len = isonum_711(dirent->name_len); |
---|
| 5429 | + name_len = isonum_711((char *)dirent->name_len); |
---|
| 5430 | #ifdef DEBUG_ISO |
---|
| 5431 | if (name_len==0) printf("dirent->name_len = 0, skipping.\n"); |
---|
| 5432 | #endif |
---|
| 5433 | @@ -1177,7 +1175,7 @@ |
---|
| 5434 | if (!sb.s_rock) return 0; |
---|
| 5435 | *retname = '\0'; |
---|
| 5436 | |
---|
| 5437 | - len = sizeof(struct iso_directory_record) + isonum_711(de->name_len); |
---|
| 5438 | + len = sizeof(struct iso_directory_record) + isonum_711((char *)de->name_len); |
---|
| 5439 | if (len & 1) len++; |
---|
| 5440 | chr = ((unsigned char *) de) + len; |
---|
| 5441 | len = *((unsigned char *) de) - len; |
---|
| 5442 | @@ -1520,6 +1518,7 @@ |
---|
| 5443 | #ifdef DEBUG_ROCK |
---|
| 5444 | printf("Symlink component flag not implemented (%d)\n",slen); |
---|
| 5445 | #endif |
---|
| 5446 | + break; |
---|
| 5447 | }; |
---|
| 5448 | slen -= slp->len + 2; |
---|
| 5449 | oldslp = slp; |
---|
| 5450 | diff -Naur aboot-0.9b.orig/lib/vsprintf.c aboot-0.9b/lib/vsprintf.c |
---|
| 5451 | --- aboot-0.9b.orig/lib/vsprintf.c 2001-10-08 19:03:53.000000000 -0400 |
---|
| 5452 | +++ aboot-0.9b/lib/vsprintf.c 2008-01-02 13:53:15.000000000 -0500 |
---|
| 5453 | @@ -11,7 +11,8 @@ |
---|
| 5454 | |
---|
| 5455 | #include <stdarg.h> |
---|
| 5456 | #include <linux/types.h> |
---|
| 5457 | -#include <linux/string.h> |
---|
| 5458 | + |
---|
| 5459 | +#include <utils.h> |
---|
| 5460 | |
---|
| 5461 | /* we use this so that we can do without the ctype library */ |
---|
| 5462 | #define is_digit(c) ((c) >= '0' && (c) <= '9') |
---|
| 5463 | diff -Naur aboot-0.9b.orig/sdisklabel/Makefile aboot-0.9b/sdisklabel/Makefile |
---|
| 5464 | --- aboot-0.9b.orig/sdisklabel/Makefile 2001-10-08 19:03:53.000000000 -0400 |
---|
| 5465 | +++ aboot-0.9b/sdisklabel/Makefile 2008-01-02 13:53:15.000000000 -0500 |
---|
| 5466 | @@ -1,13 +1,17 @@ |
---|
| 5467 | -CC = gcc -O2 |
---|
| 5468 | -CFLAGS= -I../include $(CPPFLAGS) -Wall |
---|
| 5469 | +include ../Makefile.inc |
---|
| 5470 | + |
---|
| 5471 | +CFLAGS= -O2 -I../include $(CPPFLAGS) -Wall |
---|
| 5472 | |
---|
| 5473 | all: sdisklabel swriteboot |
---|
| 5474 | |
---|
| 5475 | +%.o: %.c |
---|
| 5476 | + $(HOST_CC) $(CFLAGS) -c $< -o $@ |
---|
| 5477 | + |
---|
| 5478 | sdisklabel: sdisklabel.o library.o |
---|
| 5479 | - $(CC) $(LDFLAGS) sdisklabel.o library.o -o sdisklabel |
---|
| 5480 | + $(HOST_CC) $(LDFLAGS) sdisklabel.o library.o -o sdisklabel |
---|
| 5481 | |
---|
| 5482 | swriteboot: swriteboot.o library.o |
---|
| 5483 | - $(CC) $(LDFLAGS) swriteboot.o library.o -o swriteboot |
---|
| 5484 | + $(HOST_CC) $(LDFLAGS) swriteboot.o library.o -o swriteboot |
---|
| 5485 | |
---|
| 5486 | clean: |
---|
| 5487 | rm -f sdisklabel swriteboot *.o |
---|
| 5488 | diff -Naur aboot-0.9b.orig/sdisklabel/sdisklabel.c aboot-0.9b/sdisklabel/sdisklabel.c |
---|
| 5489 | --- aboot-0.9b.orig/sdisklabel/sdisklabel.c 2001-11-14 19:06:30.000000000 -0500 |
---|
| 5490 | +++ aboot-0.9b/sdisklabel/sdisklabel.c 2008-01-02 13:53:15.000000000 -0500 |
---|
| 5491 | @@ -36,7 +36,7 @@ |
---|
| 5492 | d->d_magic2=DISKLABELMAGIC; |
---|
| 5493 | d->d_type=DTYPE_SCSI; |
---|
| 5494 | d->d_secsize=512; |
---|
| 5495 | - strcpy(d->d_typename,"SCSI"); |
---|
| 5496 | + strcpy((char *)d->d_typename,"SCSI"); |
---|
| 5497 | } |
---|
| 5498 | |
---|
| 5499 | void |
---|
| 5500 | diff -Naur aboot-0.9b.orig/sdisklabel/swriteboot.c aboot-0.9b/sdisklabel/swriteboot.c |
---|
| 5501 | --- aboot-0.9b.orig/sdisklabel/swriteboot.c 2001-10-08 19:03:53.000000000 -0400 |
---|
| 5502 | +++ aboot-0.9b/sdisklabel/swriteboot.c 2008-01-02 13:53:15.000000000 -0500 |
---|
| 5503 | @@ -6,7 +6,6 @@ |
---|
| 5504 | #include <sys/stat.h> |
---|
| 5505 | #include <sys/types.h> |
---|
| 5506 | |
---|
| 5507 | -#include <asm/system.h> |
---|
| 5508 | #include <disklabel.h> |
---|
| 5509 | #include <config.h> |
---|
| 5510 | #include "library.h" |
---|
| 5511 | diff -Naur aboot-0.9b.orig/tools/Makefile aboot-0.9b/tools/Makefile |
---|
| 5512 | --- aboot-0.9b.orig/tools/Makefile 2001-10-08 19:03:53.000000000 -0400 |
---|
| 5513 | +++ aboot-0.9b/tools/Makefile 2008-01-02 13:53:15.000000000 -0500 |
---|
| 5514 | @@ -1,20 +1,31 @@ |
---|
| 5515 | -CC = gcc |
---|
| 5516 | + |
---|
| 5517 | +include ../Makefile.inc |
---|
| 5518 | + |
---|
| 5519 | CFLAGS = -g -O2 -Wall -I. -I../include $(CPPFLAGS) |
---|
| 5520 | LDFLAGS = -g |
---|
| 5521 | PGMS = e2writeboot isomarkboot abootconf elfencap objstrip |
---|
| 5522 | |
---|
| 5523 | -EXEC_PREFIX = /usr |
---|
| 5524 | - |
---|
| 5525 | -all: $(PGMS) |
---|
| 5526 | +all: $(PGMS) |
---|
| 5527 | |
---|
| 5528 | -install: $(PGMS) |
---|
| 5529 | - install -s -c -o root -g root -m 755 $(PGMS) $(EXEC_PREFIX)/bin |
---|
| 5530 | +.c.o: |
---|
| 5531 | + $(HOST_CC) $(CFLAGS) -c $< -o $@ |
---|
| 5532 | |
---|
| 5533 | -clean: |
---|
| 5534 | - rm -f *~ *.o *.a core $(PGMS) |
---|
| 5535 | +$(PGMS): |
---|
| 5536 | + $(HOST_CC) $(LDFLAGS) $^ -o $@ |
---|
| 5537 | |
---|
| 5538 | -isomarkboot: isomarkboot.o ../lib/isolib.o |
---|
| 5539 | -e2writeboot: e2writeboot.o e2lib.o bio.o |
---|
| 5540 | +abootconf: abootconf.o |
---|
| 5541 | +objstrip: objstrip.o |
---|
| 5542 | +elfencap: elfencap.o |
---|
| 5543 | +isomarkboot: isomarkboot.o isolib.o |
---|
| 5544 | +e2writeboot: e2writeboot.o e2lib.o bio.o |
---|
| 5545 | |
---|
| 5546 | -e2writeboot.o: e2lib.h |
---|
| 5547 | +e2writeboot.o: e2lib.h |
---|
| 5548 | e2lib.o: e2lib.h |
---|
| 5549 | +isolib.o: ../lib/isolib.c |
---|
| 5550 | + $(HOST_CC) $(CFLAGS) -c $< -o $@ |
---|
| 5551 | + |
---|
| 5552 | +install: $(PGMS) |
---|
| 5553 | + install -s -c -o root -g root -m 755 $(PGMS) $(DESTDIR)$(EXEC_PREFIX)/bin |
---|
| 5554 | + |
---|
| 5555 | +clean: |
---|
| 5556 | + rm -f *~ *.o *.a core $(PGMS) |
---|
| 5557 | diff -Naur aboot-0.9b.orig/tools/elfencap.c aboot-0.9b/tools/elfencap.c |
---|
| 5558 | --- aboot-0.9b.orig/tools/elfencap.c 2001-10-08 19:03:53.000000000 -0400 |
---|
| 5559 | +++ aboot-0.9b/tools/elfencap.c 2008-01-02 13:53:15.000000000 -0500 |
---|
| 5560 | @@ -34,7 +34,7 @@ |
---|
| 5561 | memset(&h, 0, sizeof(h)); |
---|
| 5562 | |
---|
| 5563 | h.ehdr.e_ident[0] = 0x7f; |
---|
| 5564 | - strcpy(h.ehdr.e_ident + 1, "ELF"); |
---|
| 5565 | + strcpy((char *)h.ehdr.e_ident + 1, "ELF"); |
---|
| 5566 | h.ehdr.e_ident[EI_CLASS] = ELF_CLASS; |
---|
| 5567 | h.ehdr.e_ident[EI_DATA] = ELF_DATA; |
---|
| 5568 | h.ehdr.e_ident[EI_VERSION] = EV_CURRENT; |
---|
| 5569 | diff -Naur aboot-0.9b.orig/tools/objstrip.c aboot-0.9b/tools/objstrip.c |
---|
| 5570 | --- aboot-0.9b.orig/tools/objstrip.c 2002-09-18 15:48:22.000000000 -0400 |
---|
| 5571 | +++ aboot-0.9b/tools/objstrip.c 2008-01-02 13:53:15.000000000 -0500 |
---|
| 5572 | @@ -152,7 +152,7 @@ |
---|
| 5573 | #ifdef __ELF__ |
---|
| 5574 | elf = (struct elfhdr *) buf; |
---|
| 5575 | |
---|
| 5576 | - if (elf->e_ident[0] == 0x7f && strncmp(elf->e_ident + 1, "ELF", 3) == 0) { |
---|
| 5577 | + if (elf->e_ident[0] == 0x7f && strncmp((char *)elf->e_ident + 1, "ELF", 3) == 0) { |
---|
| 5578 | if (elf->e_type != ET_EXEC) { |
---|
| 5579 | fprintf(stderr, "%s: %s is not an ELF executable\n", |
---|
| 5580 | prog_name, inname); |
---|
| 5581 | diff -Naur aboot-0.9b.orig/zip/misc.c aboot-0.9b/zip/misc.c |
---|
| 5582 | --- aboot-0.9b.orig/zip/misc.c 2001-10-08 19:03:54.000000000 -0400 |
---|
| 5583 | +++ aboot-0.9b/zip/misc.c 2008-01-02 13:53:15.000000000 -0500 |
---|
| 5584 | @@ -189,7 +189,7 @@ |
---|
| 5585 | } |
---|
| 5586 | |
---|
| 5587 | nblocks = INBUFSIZ / bfs->blocksize; |
---|
| 5588 | - nread = (*bfs->bread)(input_fd, block_number, nblocks, inbuf); |
---|
| 5589 | + nread = (*bfs->bread)(input_fd, block_number, nblocks, (char *)inbuf); |
---|
| 5590 | #ifdef DEBUG |
---|
| 5591 | printf("read %ld blocks of %d, got %ld\n", nblocks, bfs->blocksize, |
---|
| 5592 | nread); |
---|
| 5593 | @@ -230,14 +230,14 @@ |
---|
| 5594 | updcrc(window, outcnt); |
---|
| 5595 | |
---|
| 5596 | if (!bytes_out) /* first block - look for headers */ |
---|
| 5597 | - if (first_block(window, outcnt) < 0) |
---|
| 5598 | + if (first_block((char *)window, outcnt) < 0) |
---|
| 5599 | unzip_error("invalid exec header"); /* does a longjmp() */ |
---|
| 5600 | |
---|
| 5601 | bytes_out += outcnt; |
---|
| 5602 | while (chunk < nchunks) { |
---|
| 5603 | /* position within the current segment */ |
---|
| 5604 | ssize_t chunk_offset = file_offset - chunks[chunk].offset; |
---|
| 5605 | - unsigned char *dest = (char *) chunks[chunk].addr + chunk_offset; |
---|
| 5606 | + unsigned char *dest = (unsigned char *) chunks[chunk].addr + chunk_offset; |
---|
| 5607 | ssize_t to_copy; |
---|
| 5608 | unsigned char *src = window; |
---|
| 5609 | |
---|