source: patches/aboot-0.9b-fixes-5.patch@ 3c67a00

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 3c67a00 was af04f13, checked in by Joe Ciccone <jciccone@…>, 17 years ago

Forgot patch in last commit.

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