source: patches/aboot-0.9b-kernel26_gcc4_fixes-3.patch@ aaecc3ab

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since aaecc3ab was 02ce565, checked in by Justin Knierim <cross-lfs@…>, 18 years ago

Added/Removed patches from trunk/patches to match r1922.

  • Property mode set to 100644
File size: 92.7 KB
RevLine 
[02ce565]1Submitted By: Joe Ciccone <jciccone@linuxfromscratch.org>
2Date: 2006-06-25
3Initial Package Version: 0.9b
4Upstream Status: NONE
5Origin: Joe Ciccone
6Description: This patch fixes compilation issues with aboot-0.9b.
7 This patch creates kernel headers that the makefile would
8 normaly take out of the kernel source or that are not
9 included with the linux-headers package installed in the
10 system.
11
12diff -Naur aboot-0.9b.orig/Makefile aboot-0.9b/Makefile
13--- aboot-0.9b.orig/Makefile 2002-09-18 15:48:21.000000000 -0400
14+++ aboot-0.9b/Makefile 2006-06-25 18:22:04.000000000 -0400
15@@ -23,7 +23,7 @@
16 root =
17 bindir = $(root)/sbin
18 bootdir = $(root)/boot
19-mandir = /usr/man
20+mandir = $(root)/usr/man
21
22 #
23 # There shouldn't be any need to change anything below this line.
24@@ -82,10 +82,10 @@
25 tools/objstrip -vb aboot bootlx
26
27 install-man:
28- make -C doc/man install
29+ $(MAKE) -C doc/man install
30
31 install-man-gz:
32- make -C doc/man install-gz
33+ $(MAKE) -C doc/man install-gz
34
35 install: tools/abootconf tools/e2writeboot tools/isomarkboot \
36 sdisklabel/swriteboot install-man
37@@ -128,13 +128,13 @@
38 find . -name \*~ | xargs rm -f
39
40 lib/%:
41- make -C lib $* CPPFLAGS="$(CPPFLAGS)" TESTING="$(TESTING)"
42+ $(MAKE) -C lib $* CPPFLAGS="$(CPPFLAGS)" TESTING="$(TESTING)"
43
44 tools/%:
45- make -C tools $* CPPFLAGS="$(CPPFLAGS)"
46+ $(MAKE) -C tools $* CPPFLAGS="$(CPPFLAGS)"
47
48 sdisklabel/%:
49- make -C sdisklabel $* CPPFLAGS="$(CPPFLAGS)"
50+ $(MAKE) -C sdisklabel $* CPPFLAGS="$(CPPFLAGS)"
51
52 vmlinux.nh: $(VMLINUX) tools/objstrip
53 tools/objstrip -vb $(VMLINUX) vmlinux.nh
54diff -Naur aboot-0.9b.orig/cons.c aboot-0.9b/cons.c
55--- aboot-0.9b.orig/cons.c 2001-10-08 19:03:50.000000000 -0400
56+++ aboot-0.9b/cons.c 2006-06-25 18:22:04.000000000 -0400
57@@ -12,7 +12,7 @@
58 #include <utils.h>
59
60 long cons_dev; /* console device */
61-extern long int dispatch(); /* Need the full 64 bit return here...*/
62+long dispatch(long proc, ...); /* Need the full 64 bit return here...*/
63
64 long
65 cons_puts(const char *str, long len)
66diff -Naur aboot-0.9b.orig/disk.c aboot-0.9b/disk.c
67--- aboot-0.9b.orig/disk.c 2001-10-09 16:45:57.000000000 -0400
68+++ aboot-0.9b/disk.c 2006-06-25 18:22:04.000000000 -0400
69@@ -480,9 +480,7 @@
70 } else {
71 *d++ = *p;
72 }
73- break;
74-
75- default:
76+ break;
77 }
78 p++;
79 }
80diff -Naur aboot-0.9b.orig/doc/man/Makefile aboot-0.9b/doc/man/Makefile
81--- aboot-0.9b.orig/doc/man/Makefile 2003-01-14 15:12:14.000000000 -0500
82+++ aboot-0.9b/doc/man/Makefile 2006-06-25 18:22:04.000000000 -0400
83@@ -6,7 +6,7 @@
84 # use that value. Otherwise default to /usr/man.
85
86 ifeq ($(mandir),)
87-MANDIR=/usr/man
88+MANDIR=$(root)/usr/man
89 else
90 MANDIR=$(mandir)
91 endif
92diff -Naur aboot-0.9b.orig/include/asm/a.out.h aboot-0.9b/include/asm/a.out.h
93--- aboot-0.9b.orig/include/asm/a.out.h 1969-12-31 19:00:00.000000000 -0500
94+++ aboot-0.9b/include/asm/a.out.h 2006-06-25 18:22:04.000000000 -0400
95@@ -0,0 +1,91 @@
96+#ifndef __ALPHA_A_OUT_H__
97+#define __ALPHA_A_OUT_H__
98+
99+#include <linux/types.h>
100+
101+/*
102+ * OSF/1 ECOFF header structs. ECOFF files consist of:
103+ * - a file header (struct filehdr),
104+ * - an a.out header (struct aouthdr),
105+ * - one or more section headers (struct scnhdr).
106+ * The filhdr's "f_nscns" field contains the
107+ * number of section headers.
108+ */
109+
110+struct filehdr
111+{
112+ /* OSF/1 "file" header */
113+ __u16 f_magic, f_nscns;
114+ __u32 f_timdat;
115+ __u64 f_symptr;
116+ __u32 f_nsyms;
117+ __u16 f_opthdr, f_flags;
118+};
119+
120+struct aouthdr
121+{
122+ __u64 info; /* after that it looks quite normal.. */
123+ __u64 tsize;
124+ __u64 dsize;
125+ __u64 bsize;
126+ __u64 entry;
127+ __u64 text_start; /* with a few additions that actually make sense */
128+ __u64 data_start;
129+ __u64 bss_start;
130+ __u32 gprmask, fprmask; /* bitmask of general & floating point regs used in binary */
131+ __u64 gpvalue;
132+};
133+
134+struct scnhdr
135+{
136+ char s_name[8];
137+ __u64 s_paddr;
138+ __u64 s_vaddr;
139+ __u64 s_size;
140+ __u64 s_scnptr;
141+ __u64 s_relptr;
142+ __u64 s_lnnoptr;
143+ __u16 s_nreloc;
144+ __u16 s_nlnno;
145+ __u32 s_flags;
146+};
147+
148+struct exec
149+{
150+ /* OSF/1 "file" header */
151+ struct filehdr fh;
152+ struct aouthdr ah;
153+};
154+
155+/*
156+ * Define's so that the kernel exec code can access the a.out header
157+ * fields...
158+ */
159+#define a_info ah.info
160+#define a_text ah.tsize
161+#define a_data ah.dsize
162+#define a_bss ah.bsize
163+#define a_entry ah.entry
164+#define a_textstart ah.text_start
165+#define a_datastart ah.data_start
166+#define a_bssstart ah.bss_start
167+#define a_gprmask ah.gprmask
168+#define a_fprmask ah.fprmask
169+#define a_gpvalue ah.gpvalue
170+
171+#define N_TXTADDR(x) ((x).a_textstart)
172+#define N_DATADDR(x) ((x).a_datastart)
173+#define N_BSSADDR(x) ((x).a_bssstart)
174+#define N_DRSIZE(x) 0
175+#define N_TRSIZE(x) 0
176+#define N_SYMSIZE(x) 0
177+
178+#define AOUTHSZ sizeof(struct aouthdr)
179+#define SCNHSZ sizeof(struct scnhdr)
180+#define SCNROUND 16
181+
182+#define N_TXTOFF(x) \
183+ ((long) N_MAGIC(x) == ZMAGIC ? 0 : \
184+ (sizeof(struct exec) + (x).fh.f_nscns*SCNHSZ + SCNROUND - 1) & ~(SCNROUND - 1))
185+
186+#endif /* __A_OUT_GNU_H__ */
187diff -Naur aboot-0.9b.orig/include/asm/auxvec.h aboot-0.9b/include/asm/auxvec.h
188--- aboot-0.9b.orig/include/asm/auxvec.h 1969-12-31 19:00:00.000000000 -0500
189+++ aboot-0.9b/include/asm/auxvec.h 2006-06-25 18:22:04.000000000 -0400
190@@ -0,0 +1,24 @@
191+#ifndef __ASM_ALPHA_AUXVEC_H
192+#define __ASM_ALPHA_AUXVEC_H
193+
194+/* Reserve these numbers for any future use of a VDSO. */
195+#if 0
196+#define AT_SYSINFO 32
197+#define AT_SYSINFO_EHDR 33
198+#endif
199+
200+/* More complete cache descriptions than AT_[DIU]CACHEBSIZE. If the
201+ value is -1, then the cache doesn't exist. Otherwise:
202+
203+ bit 0-3: Cache set-associativity; 0 means fully associative.
204+ bit 4-7: Log2 of cacheline size.
205+ bit 8-31: Size of the entire cache >> 8.
206+ bit 32-63: Reserved.
207+*/
208+
209+#define AT_L1I_CACHESHAPE 34
210+#define AT_L1D_CACHESHAPE 35
211+#define AT_L2_CACHESHAPE 36
212+#define AT_L3_CACHESHAPE 37
213+
214+#endif /* __ASM_ALPHA_AUXVEC_H */
215diff -Naur aboot-0.9b.orig/include/asm/barrier.h aboot-0.9b/include/asm/barrier.h
216--- aboot-0.9b.orig/include/asm/barrier.h 1969-12-31 19:00:00.000000000 -0500
217+++ aboot-0.9b/include/asm/barrier.h 2006-06-25 18:22:04.000000000 -0400
218@@ -0,0 +1,34 @@
219+#ifndef __BARRIER_H
220+#define __BARRIER_H
221+
222+#define mb() \
223+__asm__ __volatile__("mb": : :"memory")
224+
225+#define rmb() \
226+__asm__ __volatile__("mb": : :"memory")
227+
228+#define wmb() \
229+__asm__ __volatile__("wmb": : :"memory")
230+
231+#define read_barrier_depends() \
232+__asm__ __volatile__("mb": : :"memory")
233+
234+#ifdef CONFIG_SMP
235+#define smp_mb() mb()
236+#define smp_rmb() rmb()
237+#define smp_wmb() wmb()
238+#define smp_read_barrier_depends() read_barrier_depends()
239+#else
240+#define smp_mb() barrier()
241+#define smp_rmb() barrier()
242+#define smp_wmb() barrier()
243+#define smp_read_barrier_depends() barrier()
244+#endif
245+
246+#define set_mb(var, value) \
247+do { var = value; mb(); } while (0)
248+
249+#define set_wmb(var, value) \
250+do { var = value; wmb(); } while (0)
251+
252+#endif /* __BARRIER_H */
253diff -Naur aboot-0.9b.orig/include/asm/hwrpb.h aboot-0.9b/include/asm/hwrpb.h
254--- aboot-0.9b.orig/include/asm/hwrpb.h 1969-12-31 19:00:00.000000000 -0500
255+++ aboot-0.9b/include/asm/hwrpb.h 2006-06-25 18:22:04.000000000 -0400
256@@ -0,0 +1,205 @@
257+#ifndef __ALPHA_HWRPB_H
258+#define __ALPHA_HWRPB_H
259+
260+#define INIT_HWRPB ((struct hwrpb_struct *) 0x10000000)
261+
262+/*
263+ * DEC processor types for Alpha systems. Found in HWRPB.
264+ * These values are architected.
265+ */
266+
267+#define EV3_CPU 1 /* EV3 */
268+#define EV4_CPU 2 /* EV4 (21064) */
269+#define LCA4_CPU 4 /* LCA4 (21066/21068) */
270+#define EV5_CPU 5 /* EV5 (21164) */
271+#define EV45_CPU 6 /* EV4.5 (21064/xxx) */
272+#define EV56_CPU 7 /* EV5.6 (21164) */
273+#define EV6_CPU 8 /* EV6 (21264) */
274+#define PCA56_CPU 9 /* PCA56 (21164PC) */
275+#define PCA57_CPU 10 /* PCA57 (notyet) */
276+#define EV67_CPU 11 /* EV67 (21264A) */
277+#define EV68CB_CPU 12 /* EV68CB (21264C) */
278+#define EV68AL_CPU 13 /* EV68AL (21264B) */
279+#define EV68CX_CPU 14 /* EV68CX (21264D) */
280+#define EV7_CPU 15 /* EV7 (21364) */
281+#define EV79_CPU 16 /* EV79 (21364??) */
282+#define EV69_CPU 17 /* EV69 (21264/EV69A) */
283+
284+/*
285+ * DEC system types for Alpha systems. Found in HWRPB.
286+ * These values are architected.
287+ */
288+
289+#define ST_ADU 1 /* Alpha ADU systype */
290+#define ST_DEC_4000 2 /* Cobra systype */
291+#define ST_DEC_7000 3 /* Ruby systype */
292+#define ST_DEC_3000_500 4 /* Flamingo systype */
293+#define ST_DEC_2000_300 6 /* Jensen systype */
294+#define ST_DEC_3000_300 7 /* Pelican systype */
295+#define ST_DEC_2100_A500 9 /* Sable systype */
296+#define ST_DEC_AXPVME_64 10 /* AXPvme system type */
297+#define ST_DEC_AXPPCI_33 11 /* NoName system type */
298+#define ST_DEC_TLASER 12 /* Turbolaser systype */
299+#define ST_DEC_2100_A50 13 /* Avanti systype */
300+#define ST_DEC_MUSTANG 14 /* Mustang systype */
301+#define ST_DEC_ALCOR 15 /* Alcor (EV5) systype */
302+#define ST_DEC_1000 17 /* Mikasa systype */
303+#define ST_DEC_EB64 18 /* EB64 systype */
304+#define ST_DEC_EB66 19 /* EB66 systype */
305+#define ST_DEC_EB64P 20 /* EB64+ systype */
306+#define ST_DEC_BURNS 21 /* laptop systype */
307+#define ST_DEC_RAWHIDE 22 /* Rawhide systype */
308+#define ST_DEC_K2 23 /* K2 systype */
309+#define ST_DEC_LYNX 24 /* Lynx systype */
310+#define ST_DEC_XL 25 /* Alpha XL systype */
311+#define ST_DEC_EB164 26 /* EB164 systype */
312+#define ST_DEC_NORITAKE 27 /* Noritake systype */
313+#define ST_DEC_CORTEX 28 /* Cortex systype */
314+#define ST_DEC_MIATA 30 /* Miata systype */
315+#define ST_DEC_XXM 31 /* XXM systype */
316+#define ST_DEC_TAKARA 32 /* Takara systype */
317+#define ST_DEC_YUKON 33 /* Yukon systype */
318+#define ST_DEC_TSUNAMI 34 /* Tsunami systype */
319+#define ST_DEC_WILDFIRE 35 /* Wildfire systype */
320+#define ST_DEC_CUSCO 36 /* CUSCO systype */
321+#define ST_DEC_EIGER 37 /* Eiger systype */
322+#define ST_DEC_TITAN 38 /* Titan systype */
323+#define ST_DEC_MARVEL 39 /* Marvel systype */
324+
325+/* UNOFFICIAL!!! */
326+#define ST_UNOFFICIAL_BIAS 100
327+#define ST_DTI_RUFFIAN 101 /* RUFFIAN systype */
328+
329+/* Alpha Processor, Inc. systems */
330+#define ST_API_BIAS 200
331+#define ST_API_NAUTILUS 201 /* UP1000 systype */
332+
333+struct pcb_struct {
334+ unsigned long ksp;
335+ unsigned long usp;
336+ unsigned long ptbr;
337+ unsigned int pcc;
338+ unsigned int asn;
339+ unsigned long unique;
340+ unsigned long flags;
341+ unsigned long res1, res2;
342+};
343+
344+struct percpu_struct {
345+ unsigned long hwpcb[16];
346+ unsigned long flags;
347+ unsigned long pal_mem_size;
348+ unsigned long pal_scratch_size;
349+ unsigned long pal_mem_pa;
350+ unsigned long pal_scratch_pa;
351+ unsigned long pal_revision;
352+ unsigned long type;
353+ unsigned long variation;
354+ unsigned long revision;
355+ unsigned long serial_no[2];
356+ unsigned long logout_area_pa;
357+ unsigned long logout_area_len;
358+ unsigned long halt_PCBB;
359+ unsigned long halt_PC;
360+ unsigned long halt_PS;
361+ unsigned long halt_arg;
362+ unsigned long halt_ra;
363+ unsigned long halt_pv;
364+ unsigned long halt_reason;
365+ unsigned long res;
366+ unsigned long ipc_buffer[21];
367+ unsigned long palcode_avail[16];
368+ unsigned long compatibility;
369+ unsigned long console_data_log_pa;
370+ unsigned long console_data_log_length;
371+ unsigned long bcache_info;
372+};
373+
374+struct procdesc_struct {
375+ unsigned long weird_vms_stuff;
376+ unsigned long address;
377+};
378+
379+struct vf_map_struct {
380+ unsigned long va;
381+ unsigned long pa;
382+ unsigned long count;
383+};
384+
385+struct crb_struct {
386+ struct procdesc_struct * dispatch_va;
387+ struct procdesc_struct * dispatch_pa;
388+ struct procdesc_struct * fixup_va;
389+ struct procdesc_struct * fixup_pa;
390+ /* virtual->physical map */
391+ unsigned long map_entries;
392+ unsigned long map_pages;
393+ struct vf_map_struct map[1];
394+};
395+
396+struct memclust_struct {
397+ unsigned long start_pfn;
398+ unsigned long numpages;
399+ unsigned long numtested;
400+ unsigned long bitmap_va;
401+ unsigned long bitmap_pa;
402+ unsigned long bitmap_chksum;
403+ unsigned long usage;
404+};
405+
406+struct memdesc_struct {
407+ unsigned long chksum;
408+ unsigned long optional_pa;
409+ unsigned long numclusters;
410+ struct memclust_struct cluster[0];
411+};
412+
413+struct dsr_struct {
414+ long smm; /* SMM nubber used by LMF */
415+ unsigned long lurt_off; /* offset to LURT table */
416+ unsigned long sysname_off; /* offset to sysname char count */
417+};
418+
419+struct hwrpb_struct {
420+ unsigned long phys_addr; /* check: physical address of the hwrpb */
421+ unsigned long id; /* check: "HWRPB\0\0\0" */
422+ unsigned long revision;
423+ unsigned long size; /* size of hwrpb */
424+ unsigned long cpuid;
425+ unsigned long pagesize; /* 8192, I hope */
426+ unsigned long pa_bits; /* number of physical address bits */
427+ unsigned long max_asn;
428+ unsigned char ssn[16]; /* system serial number: big bother is watching */
429+ unsigned long sys_type;
430+ unsigned long sys_variation;
431+ unsigned long sys_revision;
432+ unsigned long intr_freq; /* interval clock frequency * 4096 */
433+ unsigned long cycle_freq; /* cycle counter frequency */
434+ unsigned long vptb; /* Virtual Page Table Base address */
435+ unsigned long res1;
436+ unsigned long tbhb_offset; /* Translation Buffer Hint Block */
437+ unsigned long nr_processors;
438+ unsigned long processor_size;
439+ unsigned long processor_offset;
440+ unsigned long ctb_nr;
441+ unsigned long ctb_size; /* console terminal block size */
442+ unsigned long ctbt_offset; /* console terminal block table offset */
443+ unsigned long crb_offset; /* console callback routine block */
444+ unsigned long mddt_offset; /* memory data descriptor table */
445+ unsigned long cdb_offset; /* configuration data block (or NULL) */
446+ unsigned long frut_offset; /* FRU table (or NULL) */
447+ void (*save_terminal)(unsigned long);
448+ unsigned long save_terminal_data;
449+ void (*restore_terminal)(unsigned long);
450+ unsigned long restore_terminal_data;
451+ void (*CPU_restart)(unsigned long);
452+ unsigned long CPU_restart_data;
453+ unsigned long res2;
454+ unsigned long res3;
455+ unsigned long chksum;
456+ unsigned long rxrdy;
457+ unsigned long txrdy;
458+ unsigned long dsr_offset; /* "Dynamic System Recognition Data Block Table" */
459+};
460+
461+#endif /* __ALPHA_HWRPB_H */
462diff -Naur aboot-0.9b.orig/include/asm/page.h aboot-0.9b/include/asm/page.h
463--- aboot-0.9b.orig/include/asm/page.h 1969-12-31 19:00:00.000000000 -0500
464+++ aboot-0.9b/include/asm/page.h 2006-06-25 18:22:04.000000000 -0400
465@@ -0,0 +1,103 @@
466+#ifndef _ALPHA_PAGE_H
467+#define _ALPHA_PAGE_H
468+
469+#include <linux/config.h>
470+#include <asm/pal.h>
471+
472+/* PAGE_SHIFT determines the page size */
473+#define PAGE_SHIFT 13
474+#define PAGE_SIZE (1UL << PAGE_SHIFT)
475+#define PAGE_MASK (~(PAGE_SIZE-1))
476+
477+#ifdef __KERNEL__
478+
479+#ifndef __ASSEMBLY__
480+
481+#define STRICT_MM_TYPECHECKS
482+
483+extern void clear_page(void *page);
484+#define clear_user_page(page, vaddr, pg) clear_page(page)
485+
486+#define alloc_zeroed_user_highpage(vma, vaddr) alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO, vma, vmaddr)
487+#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
488+
489+extern void copy_page(void * _to, void * _from);
490+#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
491+
492+#ifdef STRICT_MM_TYPECHECKS
493+/*
494+ * These are used to make use of C type-checking..
495+ */
496+typedef struct { unsigned long pte; } pte_t;
497+typedef struct { unsigned long pmd; } pmd_t;
498+typedef struct { unsigned long pgd; } pgd_t;
499+typedef struct { unsigned long pgprot; } pgprot_t;
500+
501+#define pte_val(x) ((x).pte)
502+#define pmd_val(x) ((x).pmd)
503+#define pgd_val(x) ((x).pgd)
504+#define pgprot_val(x) ((x).pgprot)
505+
506+#define __pte(x) ((pte_t) { (x) } )
507+#define __pmd(x) ((pmd_t) { (x) } )
508+#define __pgd(x) ((pgd_t) { (x) } )
509+#define __pgprot(x) ((pgprot_t) { (x) } )
510+
511+#else
512+/*
513+ * .. while these make it easier on the compiler
514+ */
515+typedef unsigned long pte_t;
516+typedef unsigned long pmd_t;
517+typedef unsigned long pgd_t;
518+typedef unsigned long pgprot_t;
519+
520+#define pte_val(x) (x)
521+#define pmd_val(x) (x)
522+#define pgd_val(x) (x)
523+#define pgprot_val(x) (x)
524+
525+#define __pte(x) (x)
526+#define __pgd(x) (x)
527+#define __pgprot(x) (x)
528+
529+#endif /* STRICT_MM_TYPECHECKS */
530+
531+#ifdef USE_48_BIT_KSEG
532+#define PAGE_OFFSET 0xffff800000000000UL
533+#else
534+#define PAGE_OFFSET 0xfffffc0000000000UL
535+#endif
536+
537+#else
538+
539+#ifdef USE_48_BIT_KSEG
540+#define PAGE_OFFSET 0xffff800000000000
541+#else
542+#define PAGE_OFFSET 0xfffffc0000000000
543+#endif
544+
545+#endif /* !__ASSEMBLY__ */
546+
547+/* to align the pointer to the (next) page boundary */
548+#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
549+
550+#define __pa(x) ((unsigned long) (x) - PAGE_OFFSET)
551+#define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET))
552+#ifndef CONFIG_DISCONTIGMEM
553+#define pfn_to_page(pfn) (mem_map + (pfn))
554+#define page_to_pfn(page) ((unsigned long)((page) - mem_map))
555+#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
556+
557+#define pfn_valid(pfn) ((pfn) < max_mapnr)
558+#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
559+#endif /* CONFIG_DISCONTIGMEM */
560+
561+#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
562+ VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
563+
564+#endif /* __KERNEL__ */
565+
566+#include <asm-generic/page.h>
567+
568+#endif /* _ALPHA_PAGE_H */
569diff -Naur aboot-0.9b.orig/include/asm/pal.h aboot-0.9b/include/asm/pal.h
570--- aboot-0.9b.orig/include/asm/pal.h 1969-12-31 19:00:00.000000000 -0500
571+++ aboot-0.9b/include/asm/pal.h 2006-06-25 18:22:04.000000000 -0400
572@@ -0,0 +1,51 @@
573+#ifndef __ALPHA_PAL_H
574+#define __ALPHA_PAL_H
575+
576+/*
577+ * Common PAL-code
578+ */
579+#define PAL_halt 0
580+#define PAL_cflush 1
581+#define PAL_draina 2
582+#define PAL_bpt 128
583+#define PAL_bugchk 129
584+#define PAL_chmk 131
585+#define PAL_callsys 131
586+#define PAL_imb 134
587+#define PAL_rduniq 158
588+#define PAL_wruniq 159
589+#define PAL_gentrap 170
590+#define PAL_nphalt 190
591+
592+/*
593+ * VMS specific PAL-code
594+ */
595+#define PAL_swppal 10
596+#define PAL_mfpr_vptb 41
597+
598+/*
599+ * OSF specific PAL-code
600+ */
601+#define PAL_cserve 9
602+#define PAL_wripir 13
603+#define PAL_rdmces 16
604+#define PAL_wrmces 17
605+#define PAL_wrfen 43
606+#define PAL_wrvptptr 45
607+#define PAL_jtopal 46
608+#define PAL_swpctx 48
609+#define PAL_wrval 49
610+#define PAL_rdval 50
611+#define PAL_tbi 51
612+#define PAL_wrent 52
613+#define PAL_swpipl 53
614+#define PAL_rdps 54
615+#define PAL_wrkgp 55
616+#define PAL_wrusp 56
617+#define PAL_wrperfmon 57
618+#define PAL_rdusp 58
619+#define PAL_whami 60
620+#define PAL_retsys 61
621+#define PAL_rti 63
622+
623+#endif /* __ALPHA_PAL_H */
624diff -Naur aboot-0.9b.orig/include/asm/spinlock.h aboot-0.9b/include/asm/spinlock.h
625--- aboot-0.9b.orig/include/asm/spinlock.h 1969-12-31 19:00:00.000000000 -0500
626+++ aboot-0.9b/include/asm/spinlock.h 2006-06-25 18:22:04.000000000 -0400
627@@ -0,0 +1,170 @@
628+#ifndef _ALPHA_SPINLOCK_H
629+#define _ALPHA_SPINLOCK_H
630+
631+#include <linux/config.h>
632+#include <asm/system.h>
633+#include <linux/kernel.h>
634+#include <asm/current.h>
635+
636+/*
637+ * Simple spin lock operations. There are two variants, one clears IRQ's
638+ * on the local processor, one does not.
639+ *
640+ * We make no fairness assumptions. They have a cost.
641+ */
642+
643+#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock)
644+#define __raw_spin_is_locked(x) ((x)->lock != 0)
645+#define __raw_spin_unlock_wait(x) \
646+ do { cpu_relax(); } while ((x)->lock)
647+
648+static inline void __raw_spin_unlock(raw_spinlock_t * lock)
649+{
650+ mb();
651+ lock->lock = 0;
652+}
653+
654+static inline void __raw_spin_lock(raw_spinlock_t * lock)
655+{
656+ long tmp;
657+
658+ __asm__ __volatile__(
659+ "1: ldl_l %0,%1\n"
660+ " bne %0,2f\n"
661+ " lda %0,1\n"
662+ " stl_c %0,%1\n"
663+ " beq %0,2f\n"
664+ " mb\n"
665+ ".subsection 2\n"
666+ "2: ldl %0,%1\n"
667+ " bne %0,2b\n"
668+ " br 1b\n"
669+ ".previous"
670+ : "=&r" (tmp), "=m" (lock->lock)
671+ : "m"(lock->lock) : "memory");
672+}
673+
674+static inline int __raw_spin_trylock(raw_spinlock_t *lock)
675+{
676+ return !test_and_set_bit(0, &lock->lock);
677+}
678+
679+/***********************************************************/
680+
681+static inline int __raw_read_can_lock(raw_rwlock_t *lock)
682+{
683+ return (lock->lock & 1) == 0;
684+}
685+
686+static inline int __raw_write_can_lock(raw_rwlock_t *lock)
687+{
688+ return lock->lock == 0;
689+}
690+
691+static inline void __raw_read_lock(raw_rwlock_t *lock)
692+{
693+ long regx;
694+
695+ __asm__ __volatile__(
696+ "1: ldl_l %1,%0\n"
697+ " blbs %1,6f\n"
698+ " subl %1,2,%1\n"
699+ " stl_c %1,%0\n"
700+ " beq %1,6f\n"
701+ " mb\n"
702+ ".subsection 2\n"
703+ "6: ldl %1,%0\n"
704+ " blbs %1,6b\n"
705+ " br 1b\n"
706+ ".previous"
707+ : "=m" (*lock), "=&r" (regx)
708+ : "m" (*lock) : "memory");
709+}
710+
711+static inline void __raw_write_lock(raw_rwlock_t *lock)
712+{
713+ long regx;
714+
715+ __asm__ __volatile__(
716+ "1: ldl_l %1,%0\n"
717+ " bne %1,6f\n"
718+ " lda %1,1\n"
719+ " stl_c %1,%0\n"
720+ " beq %1,6f\n"
721+ " mb\n"
722+ ".subsection 2\n"
723+ "6: ldl %1,%0\n"
724+ " bne %1,6b\n"
725+ " br 1b\n"
726+ ".previous"
727+ : "=m" (*lock), "=&r" (regx)
728+ : "m" (*lock) : "memory");
729+}
730+
731+static inline int __raw_read_trylock(raw_rwlock_t * lock)
732+{
733+ long regx;
734+ int success;
735+
736+ __asm__ __volatile__(
737+ "1: ldl_l %1,%0\n"
738+ " lda %2,0\n"
739+ " blbs %1,2f\n"
740+ " subl %1,2,%2\n"
741+ " stl_c %2,%0\n"
742+ " beq %2,6f\n"
743+ "2: mb\n"
744+ ".subsection 2\n"
745+ "6: br 1b\n"
746+ ".previous"
747+ : "=m" (*lock), "=&r" (regx), "=&r" (success)
748+ : "m" (*lock) : "memory");
749+
750+ return success;
751+}
752+
753+static inline int __raw_write_trylock(raw_rwlock_t * lock)
754+{
755+ long regx;
756+ int success;
757+
758+ __asm__ __volatile__(
759+ "1: ldl_l %1,%0\n"
760+ " lda %2,0\n"
761+ " bne %1,2f\n"
762+ " lda %2,1\n"
763+ " stl_c %2,%0\n"
764+ " beq %2,6f\n"
765+ "2: mb\n"
766+ ".subsection 2\n"
767+ "6: br 1b\n"
768+ ".previous"
769+ : "=m" (*lock), "=&r" (regx), "=&r" (success)
770+ : "m" (*lock) : "memory");
771+
772+ return success;
773+}
774+
775+static inline void __raw_read_unlock(raw_rwlock_t * lock)
776+{
777+ long regx;
778+ __asm__ __volatile__(
779+ " mb\n"
780+ "1: ldl_l %1,%0\n"
781+ " addl %1,2,%1\n"
782+ " stl_c %1,%0\n"
783+ " beq %1,6f\n"
784+ ".subsection 2\n"
785+ "6: br 1b\n"
786+ ".previous"
787+ : "=m" (*lock), "=&r" (regx)
788+ : "m" (*lock) : "memory");
789+}
790+
791+static inline void __raw_write_unlock(raw_rwlock_t * lock)
792+{
793+ mb();
794+ lock->lock = 0;
795+}
796+
797+#endif /* _ALPHA_SPINLOCK_H */
798diff -Naur aboot-0.9b.orig/include/asm/spinlock_types.h aboot-0.9b/include/asm/spinlock_types.h
799--- aboot-0.9b.orig/include/asm/spinlock_types.h 1969-12-31 19:00:00.000000000 -0500
800+++ aboot-0.9b/include/asm/spinlock_types.h 2006-06-25 18:22:04.000000000 -0400
801@@ -0,0 +1,20 @@
802+#ifndef _ALPHA_SPINLOCK_TYPES_H
803+#define _ALPHA_SPINLOCK_TYPES_H
804+
805+#ifndef __LINUX_SPINLOCK_TYPES_H
806+# error "please don't include this file directly"
807+#endif
808+
809+typedef struct {
810+ volatile unsigned int lock;
811+} raw_spinlock_t;
812+
813+#define __RAW_SPIN_LOCK_UNLOCKED { 0 }
814+
815+typedef struct {
816+ volatile unsigned int lock;
817+} raw_rwlock_t;
818+
819+#define __RAW_RW_LOCK_UNLOCKED { 0 }
820+
821+#endif
822diff -Naur aboot-0.9b.orig/include/asm/string.h aboot-0.9b/include/asm/string.h
823--- aboot-0.9b.orig/include/asm/string.h 1969-12-31 19:00:00.000000000 -0500
824+++ aboot-0.9b/include/asm/string.h 2006-06-25 18:22:04.000000000 -0400
825@@ -0,0 +1,68 @@
826+#ifndef __ALPHA_STRING_H__
827+#define __ALPHA_STRING_H__
828+
829+#ifdef __KERNEL__
830+
831+/*
832+ * GCC of any recent vintage doesn't do stupid things with bcopy.
833+ * EGCS 1.1 knows all about expanding memcpy inline, others don't.
834+ *
835+ * Similarly for a memset with data = 0.
836+ */
837+
838+#define __HAVE_ARCH_MEMCPY
839+extern void * memcpy(void *, const void *, size_t);
840+#define __HAVE_ARCH_MEMMOVE
841+extern void * memmove(void *, const void *, size_t);
842+
843+/* For backward compatibility with modules. Unused otherwise. */
844+extern void * __memcpy(void *, const void *, size_t);
845+
846+#define memcpy __builtin_memcpy
847+
848+#define __HAVE_ARCH_MEMSET
849+extern void * __constant_c_memset(void *, unsigned long, size_t);
850+extern void * __memset(void *, int, size_t);
851+extern void * memset(void *, int, size_t);
852+
853+#define memset(s, c, n) \
854+(__builtin_constant_p(c) \
855+ ? (__builtin_constant_p(n) && (c) == 0 \
856+ ? __builtin_memset((s),0,(n)) \
857+ : __constant_c_memset((s),0x0101010101010101UL*(unsigned char)(c),(n))) \
858+ : __memset((s),(c),(n)))
859+
860+#define __HAVE_ARCH_STRCPY
861+extern char * strcpy(char *,const char *);
862+#define __HAVE_ARCH_STRNCPY
863+extern char * strncpy(char *, const char *, size_t);
864+#define __HAVE_ARCH_STRCAT
865+extern char * strcat(char *, const char *);
866+#define __HAVE_ARCH_STRNCAT
867+extern char * strncat(char *, const char *, size_t);
868+#define __HAVE_ARCH_STRCHR
869+extern char * strchr(const char *,int);
870+#define __HAVE_ARCH_STRRCHR
871+extern char * strrchr(const char *,int);
872+#define __HAVE_ARCH_STRLEN
873+extern size_t strlen(const char *);
874+#define __HAVE_ARCH_MEMCHR
875+extern void * memchr(const void *, int, size_t);
876+
877+/* The following routine is like memset except that it writes 16-bit
878+ aligned values. The DEST and COUNT parameters must be even for
879+ correct operation. */
880+
881+#define __HAVE_ARCH_MEMSETW
882+extern void * __memsetw(void *dest, unsigned short, size_t count);
883+
884+#define memsetw(s, c, n) \
885+(__builtin_constant_p(c) \
886+ ? __constant_c_memset((s),0x0001000100010001UL*(unsigned short)(c),(n)) \
887+ : __memsetw((s),(c),(n)))
888+
889+extern int strcasecmp(const char *, const char *);
890+
891+#endif /* __KERNEL__ */
892+
893+#endif /* __ALPHA_STRING_H__ */
894diff -Naur aboot-0.9b.orig/include/asm/system.h aboot-0.9b/include/asm/system.h
895--- aboot-0.9b.orig/include/asm/system.h 1969-12-31 19:00:00.000000000 -0500
896+++ aboot-0.9b/include/asm/system.h 2006-06-25 18:22:04.000000000 -0400
897@@ -0,0 +1,594 @@
898+#ifndef __ALPHA_SYSTEM_H
899+#define __ALPHA_SYSTEM_H
900+
901+#include <linux/config.h>
902+#include <asm/pal.h>
903+#include <asm/page.h>
904+#include <asm/barrier.h>
905+
906+/*
907+ * System defines.. Note that this is included both from .c and .S
908+ * files, so it does only defines, not any C code.
909+ */
910+
911+/*
912+ * We leave one page for the initial stack page, and one page for
913+ * the initial process structure. Also, the console eats 3 MB for
914+ * the initial bootloader (one of which we can reclaim later).
915+ */
916+#define BOOT_PCB 0x20000000
917+#define BOOT_ADDR 0x20000000
918+/* Remove when official MILO sources have ELF support: */
919+#define BOOT_SIZE (16*1024)
920+
921+#ifdef CONFIG_ALPHA_LEGACY_START_ADDRESS
922+#define KERNEL_START_PHYS 0x300000 /* Old bootloaders hardcoded this. */
923+#else
924+#define KERNEL_START_PHYS 0x1000000 /* required: Wildfire/Titan/Marvel */
925+#endif
926+
927+#define KERNEL_START (PAGE_OFFSET+KERNEL_START_PHYS)
928+#define SWAPPER_PGD KERNEL_START
929+#define INIT_STACK (PAGE_OFFSET+KERNEL_START_PHYS+0x02000)
930+#define EMPTY_PGT (PAGE_OFFSET+KERNEL_START_PHYS+0x04000)
931+#define EMPTY_PGE (PAGE_OFFSET+KERNEL_START_PHYS+0x08000)
932+#define ZERO_PGE (PAGE_OFFSET+KERNEL_START_PHYS+0x0A000)
933+
934+#define START_ADDR (PAGE_OFFSET+KERNEL_START_PHYS+0x10000)
935+
936+/*
937+ * This is setup by the secondary bootstrap loader. Because
938+ * the zero page is zeroed out as soon as the vm system is
939+ * initialized, we need to copy things out into a more permanent
940+ * place.
941+ */
942+#define PARAM ZERO_PGE
943+#define COMMAND_LINE ((char*)(PARAM + 0x0000))
944+#define INITRD_START (*(unsigned long *) (PARAM+0x100))
945+#define INITRD_SIZE (*(unsigned long *) (PARAM+0x108))
946+
947+#ifndef __ASSEMBLY__
948+#include <linux/kernel.h>
949+
950+/*
951+ * This is the logout header that should be common to all platforms
952+ * (assuming they are running OSF/1 PALcode, I guess).
953+ */
954+struct el_common {
955+ unsigned int size; /* size in bytes of logout area */
956+ unsigned int sbz1 : 30; /* should be zero */
957+ unsigned int err2 : 1; /* second error */
958+ unsigned int retry : 1; /* retry flag */
959+ unsigned int proc_offset; /* processor-specific offset */
960+ unsigned int sys_offset; /* system-specific offset */
961+ unsigned int code; /* machine check code */
962+ unsigned int frame_rev; /* frame revision */
963+};
964+
965+/* Machine Check Frame for uncorrectable errors (Large format)
966+ * --- This is used to log uncorrectable errors such as
967+ * double bit ECC errors.
968+ * --- These errors are detected by both processor and systems.
969+ */
970+struct el_common_EV5_uncorrectable_mcheck {
971+ unsigned long shadow[8]; /* Shadow reg. 8-14, 25 */
972+ unsigned long paltemp[24]; /* PAL TEMP REGS. */
973+ unsigned long exc_addr; /* Address of excepting instruction*/
974+ unsigned long exc_sum; /* Summary of arithmetic traps. */
975+ unsigned long exc_mask; /* Exception mask (from exc_sum). */
976+ unsigned long pal_base; /* Base address for PALcode. */
977+ unsigned long isr; /* Interrupt Status Reg. */
978+ unsigned long icsr; /* CURRENT SETUP OF EV5 IBOX */
979+ unsigned long ic_perr_stat; /* I-CACHE Reg. <11> set Data parity
980+ <12> set TAG parity*/
981+ unsigned long dc_perr_stat; /* D-CACHE error Reg. Bits set to 1:
982+ <2> Data error in bank 0
983+ <3> Data error in bank 1
984+ <4> Tag error in bank 0
985+ <5> Tag error in bank 1 */
986+ unsigned long va; /* Effective VA of fault or miss. */
987+ unsigned long mm_stat; /* Holds the reason for D-stream
988+ fault or D-cache parity errors */
989+ unsigned long sc_addr; /* Address that was being accessed
990+ when EV5 detected Secondary cache
991+ failure. */
992+ unsigned long sc_stat; /* Helps determine if the error was
993+ TAG/Data parity(Secondary Cache)*/
994+ unsigned long bc_tag_addr; /* Contents of EV5 BC_TAG_ADDR */
995+ unsigned long ei_addr; /* Physical address of any transfer
996+ that is logged in EV5 EI_STAT */
997+ unsigned long fill_syndrome; /* For correcting ECC errors. */
998+ unsigned long ei_stat; /* Helps identify reason of any
999+ processor uncorrectable error
1000+ at its external interface. */
1001+ unsigned long ld_lock; /* Contents of EV5 LD_LOCK register*/
1002+};
1003+
1004+struct el_common_EV6_mcheck {
1005+ unsigned int FrameSize; /* Bytes, including this field */
1006+ unsigned int FrameFlags; /* <31> = Retry, <30> = Second Error */
1007+ unsigned int CpuOffset; /* Offset to CPU-specific info */
1008+ unsigned int SystemOffset; /* Offset to system-specific info */
1009+ unsigned int MCHK_Code;
1010+ unsigned int MCHK_Frame_Rev;
1011+ unsigned long I_STAT; /* EV6 Internal Processor Registers */
1012+ unsigned long DC_STAT; /* (See the 21264 Spec) */
1013+ unsigned long C_ADDR;
1014+ unsigned long DC1_SYNDROME;
1015+ unsigned long DC0_SYNDROME;
1016+ unsigned long C_STAT;
1017+ unsigned long C_STS;
1018+ unsigned long MM_STAT;
1019+ unsigned long EXC_ADDR;
1020+ unsigned long IER_CM;
1021+ unsigned long ISUM;
1022+ unsigned long RESERVED0;
1023+ unsigned long PAL_BASE;
1024+ unsigned long I_CTL;
1025+ unsigned long PCTX;
1026+};
1027+
1028+extern void halt(void) __attribute__((noreturn));
1029+#define __halt() __asm__ __volatile__ ("call_pal %0 #halt" : : "i" (PAL_halt))
1030+
1031+#define switch_to(P,N,L) \
1032+ do { \
1033+ (L) = alpha_switch_to(virt_to_phys(&(N)->thread_info->pcb), (P)); \
1034+ check_mmu_context(); \
1035+ } while (0)
1036+
1037+struct task_struct;
1038+extern struct task_struct *alpha_switch_to(unsigned long, struct task_struct*);
1039+
1040+#define imb() \
1041+__asm__ __volatile__ ("call_pal %0 #imb" : : "i" (PAL_imb) : "memory")
1042+
1043+#define draina() \
1044+__asm__ __volatile__ ("call_pal %0 #draina" : : "i" (PAL_draina) : "memory")
1045+
1046+enum implver_enum {
1047+ IMPLVER_EV4,
1048+ IMPLVER_EV5,
1049+ IMPLVER_EV6
1050+};
1051+
1052+#ifdef CONFIG_ALPHA_GENERIC
1053+#define implver() \
1054+({ unsigned long __implver; \
1055+ __asm__ ("implver %0" : "=r"(__implver)); \
1056+ (enum implver_enum) __implver; })
1057+#else
1058+/* Try to eliminate some dead code. */
1059+#ifdef CONFIG_ALPHA_EV4
1060+#define implver() IMPLVER_EV4
1061+#endif
1062+#ifdef CONFIG_ALPHA_EV5
1063+#define implver() IMPLVER_EV5
1064+#endif
1065+#if defined(CONFIG_ALPHA_EV6)
1066+#define implver() IMPLVER_EV6
1067+#endif
1068+#endif
1069+
1070+enum amask_enum {
1071+ AMASK_BWX = (1UL << 0),
1072+ AMASK_FIX = (1UL << 1),
1073+ AMASK_CIX = (1UL << 2),
1074+ AMASK_MAX = (1UL << 8),
1075+ AMASK_PRECISE_TRAP = (1UL << 9),
1076+};
1077+
1078+#define amask(mask) \
1079+({ unsigned long __amask, __input = (mask); \
1080+ __asm__ ("amask %1,%0" : "=r"(__amask) : "rI"(__input)); \
1081+ __amask; })
1082+
1083+#define __CALL_PAL_R0(NAME, TYPE) \
1084+static inline TYPE NAME(void) \
1085+{ \
1086+ register TYPE __r0 __asm__("$0"); \
1087+ __asm__ __volatile__( \
1088+ "call_pal %1 # " #NAME \
1089+ :"=r" (__r0) \
1090+ :"i" (PAL_ ## NAME) \
1091+ :"$1", "$16", "$22", "$23", "$24", "$25"); \
1092+ return __r0; \
1093+}
1094+
1095+#define __CALL_PAL_W1(NAME, TYPE0) \
1096+static inline void NAME(TYPE0 arg0) \
1097+{ \
1098+ register TYPE0 __r16 __asm__("$16") = arg0; \
1099+ __asm__ __volatile__( \
1100+ "call_pal %1 # "#NAME \
1101+ : "=r"(__r16) \
1102+ : "i"(PAL_ ## NAME), "0"(__r16) \
1103+ : "$1", "$22", "$23", "$24", "$25"); \
1104+}
1105+
1106+#define __CALL_PAL_W2(NAME, TYPE0, TYPE1) \
1107+static inline void NAME(TYPE0 arg0, TYPE1 arg1) \
1108+{ \
1109+ register TYPE0 __r16 __asm__("$16") = arg0; \
1110+ register TYPE1 __r17 __asm__("$17") = arg1; \
1111+ __asm__ __volatile__( \
1112+ "call_pal %2 # "#NAME \
1113+ : "=r"(__r16), "=r"(__r17) \
1114+ : "i"(PAL_ ## NAME), "0"(__r16), "1"(__r17) \
1115+ : "$1", "$22", "$23", "$24", "$25"); \
1116+}
1117+
1118+#define __CALL_PAL_RW1(NAME, RTYPE, TYPE0) \
1119+static inline RTYPE NAME(TYPE0 arg0) \
1120+{ \
1121+ register RTYPE __r0 __asm__("$0"); \
1122+ register TYPE0 __r16 __asm__("$16") = arg0; \
1123+ __asm__ __volatile__( \
1124+ "call_pal %2 # "#NAME \
1125+ : "=r"(__r16), "=r"(__r0) \
1126+ : "i"(PAL_ ## NAME), "0"(__r16) \
1127+ : "$1", "$22", "$23", "$24", "$25"); \
1128+ return __r0; \
1129+}
1130+
1131+#define __CALL_PAL_RW2(NAME, RTYPE, TYPE0, TYPE1) \
1132+static inline RTYPE NAME(TYPE0 arg0, TYPE1 arg1) \
1133+{ \
1134+ register RTYPE __r0 __asm__("$0"); \
1135+ register TYPE0 __r16 __asm__("$16") = arg0; \
1136+ register TYPE1 __r17 __asm__("$17") = arg1; \
1137+ __asm__ __volatile__( \
1138+ "call_pal %3 # "#NAME \
1139+ : "=r"(__r16), "=r"(__r17), "=r"(__r0) \
1140+ : "i"(PAL_ ## NAME), "0"(__r16), "1"(__r17) \
1141+ : "$1", "$22", "$23", "$24", "$25"); \
1142+ return __r0; \
1143+}
1144+
1145+__CALL_PAL_W1(cflush, unsigned long);
1146+__CALL_PAL_R0(rdmces, unsigned long);
1147+__CALL_PAL_R0(rdps, unsigned long);
1148+__CALL_PAL_R0(rdusp, unsigned long);
1149+__CALL_PAL_RW1(swpipl, unsigned long, unsigned long);
1150+__CALL_PAL_R0(whami, unsigned long);
1151+__CALL_PAL_W2(wrent, void*, unsigned long);
1152+__CALL_PAL_W1(wripir, unsigned long);
1153+__CALL_PAL_W1(wrkgp, unsigned long);
1154+__CALL_PAL_W1(wrmces, unsigned long);
1155+__CALL_PAL_RW2(wrperfmon, unsigned long, unsigned long, unsigned long);
1156+__CALL_PAL_W1(wrusp, unsigned long);
1157+__CALL_PAL_W1(wrvptptr, unsigned long);
1158+
1159+#define IPL_MIN 0
1160+#define IPL_SW0 1
1161+#define IPL_SW1 2
1162+#define IPL_DEV0 3
1163+#define IPL_DEV1 4
1164+#define IPL_TIMER 5
1165+#define IPL_PERF 6
1166+#define IPL_POWERFAIL 6
1167+#define IPL_MCHECK 7
1168+#define IPL_MAX 7
1169+
1170+#ifdef CONFIG_ALPHA_BROKEN_IRQ_MASK
1171+#undef IPL_MIN
1172+#define IPL_MIN __min_ipl
1173+extern int __min_ipl;
1174+#endif
1175+
1176+#define getipl() (rdps() & 7)
1177+#define setipl(ipl) ((void) swpipl(ipl))
1178+
1179+#define local_irq_disable() do { setipl(IPL_MAX); barrier(); } while(0)
1180+#define local_irq_enable() do { barrier(); setipl(IPL_MIN); } while(0)
1181+#define local_save_flags(flags) ((flags) = rdps())
1182+#define local_irq_save(flags) do { (flags) = swpipl(IPL_MAX); barrier(); } while(0)
1183+#define local_irq_restore(flags) do { barrier(); setipl(flags); barrier(); } while(0)
1184+
1185+#define irqs_disabled() (getipl() == IPL_MAX)
1186+
1187+/*
1188+ * TB routines..
1189+ */
1190+#define __tbi(nr,arg,arg1...) \
1191+({ \
1192+ register unsigned long __r16 __asm__("$16") = (nr); \
1193+ register unsigned long __r17 __asm__("$17"); arg; \
1194+ __asm__ __volatile__( \
1195+ "call_pal %3 #__tbi" \
1196+ :"=r" (__r16),"=r" (__r17) \
1197+ :"0" (__r16),"i" (PAL_tbi) ,##arg1 \
1198+ :"$0", "$1", "$22", "$23", "$24", "$25"); \
1199+})
1200+
1201+#define tbi(x,y) __tbi(x,__r17=(y),"1" (__r17))
1202+#define tbisi(x) __tbi(1,__r17=(x),"1" (__r17))
1203+#define tbisd(x) __tbi(2,__r17=(x),"1" (__r17))
1204+#define tbis(x) __tbi(3,__r17=(x),"1" (__r17))
1205+#define tbiap() __tbi(-1, /* no second argument */)
1206+#define tbia() __tbi(-2, /* no second argument */)
1207+
1208+/*
1209+ * Atomic exchange.
1210+ * Since it can be used to implement critical sections
1211+ * it must clobber "memory" (also for interrupts in UP).
1212+ */
1213+
1214+static inline unsigned long
1215+__xchg_u8(volatile char *m, unsigned long val)
1216+{
1217+ unsigned long ret, tmp, addr64;
1218+
1219+ __asm__ __volatile__(
1220+ " andnot %4,7,%3\n"
1221+ " insbl %1,%4,%1\n"
1222+ "1: ldq_l %2,0(%3)\n"
1223+ " extbl %2,%4,%0\n"
1224+ " mskbl %2,%4,%2\n"
1225+ " or %1,%2,%2\n"
1226+ " stq_c %2,0(%3)\n"
1227+ " beq %2,2f\n"
1228+#ifdef CONFIG_SMP
1229+ " mb\n"
1230+#endif
1231+ ".subsection 2\n"
1232+ "2: br 1b\n"
1233+ ".previous"
1234+ : "=&r" (ret), "=&r" (val), "=&r" (tmp), "=&r" (addr64)
1235+ : "r" ((long)m), "1" (val) : "memory");
1236+
1237+ return ret;
1238+}
1239+
1240+static inline unsigned long
1241+__xchg_u16(volatile short *m, unsigned long val)
1242+{
1243+ unsigned long ret, tmp, addr64;
1244+
1245+ __asm__ __volatile__(
1246+ " andnot %4,7,%3\n"
1247+ " inswl %1,%4,%1\n"
1248+ "1: ldq_l %2,0(%3)\n"
1249+ " extwl %2,%4,%0\n"
1250+ " mskwl %2,%4,%2\n"
1251+ " or %1,%2,%2\n"
1252+ " stq_c %2,0(%3)\n"
1253+ " beq %2,2f\n"
1254+#ifdef CONFIG_SMP
1255+ " mb\n"
1256+#endif
1257+ ".subsection 2\n"
1258+ "2: br 1b\n"
1259+ ".previous"
1260+ : "=&r" (ret), "=&r" (val), "=&r" (tmp), "=&r" (addr64)
1261+ : "r" ((long)m), "1" (val) : "memory");
1262+
1263+ return ret;
1264+}
1265+
1266+static inline unsigned long
1267+__xchg_u32(volatile int *m, unsigned long val)
1268+{
1269+ unsigned long dummy;
1270+
1271+ __asm__ __volatile__(
1272+ "1: ldl_l %0,%4\n"
1273+ " bis $31,%3,%1\n"
1274+ " stl_c %1,%2\n"
1275+ " beq %1,2f\n"
1276+#ifdef CONFIG_SMP
1277+ " mb\n"
1278+#endif
1279+ ".subsection 2\n"
1280+ "2: br 1b\n"
1281+ ".previous"
1282+ : "=&r" (val), "=&r" (dummy), "=m" (*m)
1283+ : "rI" (val), "m" (*m) : "memory");
1284+
1285+ return val;
1286+}
1287+
1288+static inline unsigned long
1289+__xchg_u64(volatile long *m, unsigned long val)
1290+{
1291+ unsigned long dummy;
1292+
1293+ __asm__ __volatile__(
1294+ "1: ldq_l %0,%4\n"
1295+ " bis $31,%3,%1\n"
1296+ " stq_c %1,%2\n"
1297+ " beq %1,2f\n"
1298+#ifdef CONFIG_SMP
1299+ " mb\n"
1300+#endif
1301+ ".subsection 2\n"
1302+ "2: br 1b\n"
1303+ ".previous"
1304+ : "=&r" (val), "=&r" (dummy), "=m" (*m)
1305+ : "rI" (val), "m" (*m) : "memory");
1306+
1307+ return val;
1308+}
1309+
1310+/* This function doesn't exist, so you'll get a linker error
1311+ if something tries to do an invalid xchg(). */
1312+extern void __xchg_called_with_bad_pointer(void);
1313+
1314+#define __xchg(ptr, x, size) \
1315+({ \
1316+ unsigned long __xchg__res; \
1317+ volatile void *__xchg__ptr = (ptr); \
1318+ switch (size) { \
1319+ case 1: __xchg__res = __xchg_u8(__xchg__ptr, x); break; \
1320+ case 2: __xchg__res = __xchg_u16(__xchg__ptr, x); break; \
1321+ case 4: __xchg__res = __xchg_u32(__xchg__ptr, x); break; \
1322+ case 8: __xchg__res = __xchg_u64(__xchg__ptr, x); break; \
1323+ default: __xchg_called_with_bad_pointer(); __xchg__res = x; \
1324+ } \
1325+ __xchg__res; \
1326+})
1327+
1328+#define xchg(ptr,x) \
1329+ ({ \
1330+ __typeof__(*(ptr)) _x_ = (x); \
1331+ (__typeof__(*(ptr))) __xchg((ptr), (unsigned long)_x_, sizeof(*(ptr))); \
1332+ })
1333+
1334+#define tas(ptr) (xchg((ptr),1))
1335+
1336+
1337+/*
1338+ * Atomic compare and exchange. Compare OLD with MEM, if identical,
1339+ * store NEW in MEM. Return the initial value in MEM. Success is
1340+ * indicated by comparing RETURN with OLD.
1341+ *
1342+ * The memory barrier should be placed in SMP only when we actually
1343+ * make the change. If we don't change anything (so if the returned
1344+ * prev is equal to old) then we aren't acquiring anything new and
1345+ * we don't need any memory barrier as far I can tell.
1346+ */
1347+
1348+#define __HAVE_ARCH_CMPXCHG 1
1349+
1350+static inline unsigned long
1351+__cmpxchg_u8(volatile char *m, long old, long new)
1352+{
1353+ unsigned long prev, tmp, cmp, addr64;
1354+
1355+ __asm__ __volatile__(
1356+ " andnot %5,7,%4\n"
1357+ " insbl %1,%5,%1\n"
1358+ "1: ldq_l %2,0(%4)\n"
1359+ " extbl %2,%5,%0\n"
1360+ " cmpeq %0,%6,%3\n"
1361+ " beq %3,2f\n"
1362+ " mskbl %2,%5,%2\n"
1363+ " or %1,%2,%2\n"
1364+ " stq_c %2,0(%4)\n"
1365+ " beq %2,3f\n"
1366+#ifdef CONFIG_SMP
1367+ " mb\n"
1368+#endif
1369+ "2:\n"
1370+ ".subsection 2\n"
1371+ "3: br 1b\n"
1372+ ".previous"
1373+ : "=&r" (prev), "=&r" (new), "=&r" (tmp), "=&r" (cmp), "=&r" (addr64)
1374+ : "r" ((long)m), "Ir" (old), "1" (new) : "memory");
1375+
1376+ return prev;
1377+}
1378+
1379+static inline unsigned long
1380+__cmpxchg_u16(volatile short *m, long old, long new)
1381+{
1382+ unsigned long prev, tmp, cmp, addr64;
1383+
1384+ __asm__ __volatile__(
1385+ " andnot %5,7,%4\n"
1386+ " inswl %1,%5,%1\n"
1387+ "1: ldq_l %2,0(%4)\n"
1388+ " extwl %2,%5,%0\n"
1389+ " cmpeq %0,%6,%3\n"
1390+ " beq %3,2f\n"
1391+ " mskwl %2,%5,%2\n"
1392+ " or %1,%2,%2\n"
1393+ " stq_c %2,0(%4)\n"
1394+ " beq %2,3f\n"
1395+#ifdef CONFIG_SMP
1396+ " mb\n"
1397+#endif
1398+ "2:\n"
1399+ ".subsection 2\n"
1400+ "3: br 1b\n"
1401+ ".previous"
1402+ : "=&r" (prev), "=&r" (new), "=&r" (tmp), "=&r" (cmp), "=&r" (addr64)
1403+ : "r" ((long)m), "Ir" (old), "1" (new) : "memory");
1404+
1405+ return prev;
1406+}
1407+
1408+static inline unsigned long
1409+__cmpxchg_u32(volatile int *m, int old, int new)
1410+{
1411+ unsigned long prev, cmp;
1412+
1413+ __asm__ __volatile__(
1414+ "1: ldl_l %0,%5\n"
1415+ " cmpeq %0,%3,%1\n"
1416+ " beq %1,2f\n"
1417+ " mov %4,%1\n"
1418+ " stl_c %1,%2\n"
1419+ " beq %1,3f\n"
1420+#ifdef CONFIG_SMP
1421+ " mb\n"
1422+#endif
1423+ "2:\n"
1424+ ".subsection 2\n"
1425+ "3: br 1b\n"
1426+ ".previous"
1427+ : "=&r"(prev), "=&r"(cmp), "=m"(*m)
1428+ : "r"((long) old), "r"(new), "m"(*m) : "memory");
1429+
1430+ return prev;
1431+}
1432+
1433+static inline unsigned long
1434+__cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new)
1435+{
1436+ unsigned long prev, cmp;
1437+
1438+ __asm__ __volatile__(
1439+ "1: ldq_l %0,%5\n"
1440+ " cmpeq %0,%3,%1\n"
1441+ " beq %1,2f\n"
1442+ " mov %4,%1\n"
1443+ " stq_c %1,%2\n"
1444+ " beq %1,3f\n"
1445+#ifdef CONFIG_SMP
1446+ " mb\n"
1447+#endif
1448+ "2:\n"
1449+ ".subsection 2\n"
1450+ "3: br 1b\n"
1451+ ".previous"
1452+ : "=&r"(prev), "=&r"(cmp), "=m"(*m)
1453+ : "r"((long) old), "r"(new), "m"(*m) : "memory");
1454+
1455+ return prev;
1456+}
1457+
1458+/* This function doesn't exist, so you'll get a linker error
1459+ if something tries to do an invalid cmpxchg(). */
1460+extern void __cmpxchg_called_with_bad_pointer(void);
1461+
1462+static inline unsigned long
1463+__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
1464+{
1465+ switch (size) {
1466+ case 1:
1467+ return __cmpxchg_u8(ptr, old, new);
1468+ case 2:
1469+ return __cmpxchg_u16(ptr, old, new);
1470+ case 4:
1471+ return __cmpxchg_u32(ptr, old, new);
1472+ case 8:
1473+ return __cmpxchg_u64(ptr, old, new);
1474+ }
1475+ __cmpxchg_called_with_bad_pointer();
1476+ return old;
1477+}
1478+
1479+#define cmpxchg(ptr,o,n) \
1480+ ({ \
1481+ __typeof__(*(ptr)) _o_ = (o); \
1482+ __typeof__(*(ptr)) _n_ = (n); \
1483+ (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \
1484+ (unsigned long)_n_, sizeof(*(ptr))); \
1485+ })
1486+
1487+#endif /* __ASSEMBLY__ */
1488+
1489+#define arch_align_stack(x) (x)
1490+
1491+#endif
1492diff -Naur aboot-0.9b.orig/include/asm/thread_info.h aboot-0.9b/include/asm/thread_info.h
1493--- aboot-0.9b.orig/include/asm/thread_info.h 1969-12-31 19:00:00.000000000 -0500
1494+++ aboot-0.9b/include/asm/thread_info.h 2006-06-25 18:22:04.000000000 -0400
1495@@ -0,0 +1,96 @@
1496+#ifndef _ALPHA_THREAD_INFO_H
1497+#define _ALPHA_THREAD_INFO_H
1498+
1499+#ifdef __KERNEL__
1500+
1501+#ifndef __ASSEMBLY__
1502+#include <asm/processor.h>
1503+#include <asm/types.h>
1504+#include <asm/hwrpb.h>
1505+#endif
1506+
1507+#ifndef __ASSEMBLY__
1508+struct thread_info {
1509+ struct pcb_struct pcb; /* palcode state */
1510+
1511+ struct task_struct *task; /* main task structure */
1512+ unsigned int flags; /* low level flags */
1513+ unsigned int ieee_state; /* see fpu.h */
1514+
1515+ struct exec_domain *exec_domain; /* execution domain */
1516+ mm_segment_t addr_limit; /* thread address space */
1517+ unsigned cpu; /* current CPU */
1518+ int preempt_count; /* 0 => preemptable, <0 => BUG */
1519+
1520+ int bpt_nsaved;
1521+ unsigned long bpt_addr[2]; /* breakpoint handling */
1522+ unsigned int bpt_insn[2];
1523+
1524+ struct restart_block restart_block;
1525+};
1526+
1527+/*
1528+ * Macros/functions for gaining access to the thread information structure.
1529+ */
1530+#define INIT_THREAD_INFO(tsk) \
1531+{ \
1532+ .task = &tsk, \
1533+ .exec_domain = &default_exec_domain, \
1534+ .addr_limit = KERNEL_DS, \
1535+ .restart_block = { \
1536+ .fn = do_no_restart_syscall, \
1537+ }, \
1538+}
1539+
1540+#define init_thread_info (init_thread_union.thread_info)
1541+#define init_stack (init_thread_union.stack)
1542+
1543+/* How to get the thread information struct from C. */
1544+register struct thread_info *__current_thread_info __asm__("$8");
1545+#define current_thread_info() __current_thread_info
1546+
1547+/* Thread information allocation. */
1548+#define THREAD_SIZE (2*PAGE_SIZE)
1549+#define alloc_thread_info(tsk) \
1550+ ((struct thread_info *) __get_free_pages(GFP_KERNEL,1))
1551+#define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
1552+
1553+#endif /* __ASSEMBLY__ */
1554+
1555+#define PREEMPT_ACTIVE 0x40000000
1556+
1557+/*
1558+ * Thread information flags:
1559+ * - these are process state flags and used from assembly
1560+ * - pending work-to-be-done flags come first to fit in and immediate operand.
1561+ *
1562+ * TIF_SYSCALL_TRACE is known to be 0 via blbs.
1563+ */
1564+#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
1565+#define TIF_NOTIFY_RESUME 1 /* resumption notification requested */
1566+#define TIF_SIGPENDING 2 /* signal pending */
1567+#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
1568+#define TIF_POLLING_NRFLAG 4 /* poll_idle is polling NEED_RESCHED */
1569+#define TIF_DIE_IF_KERNEL 5 /* dik recursion lock */
1570+#define TIF_UAC_NOPRINT 6 /* see sysinfo.h */
1571+#define TIF_UAC_NOFIX 7
1572+#define TIF_UAC_SIGBUS 8
1573+#define TIF_MEMDIE 9
1574+
1575+#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
1576+#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
1577+#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
1578+#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
1579+#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
1580+
1581+/* Work to do on interrupt/exception return. */
1582+#define _TIF_WORK_MASK (_TIF_NOTIFY_RESUME \
1583+ | _TIF_SIGPENDING \
1584+ | _TIF_NEED_RESCHED)
1585+
1586+/* Work to do on any return to userspace. */
1587+#define _TIF_ALLWORK_MASK (_TIF_WORK_MASK \
1588+ | _TIF_SYSCALL_TRACE)
1589+
1590+#endif /* __KERNEL__ */
1591+#endif /* _ALPHA_THREAD_INFO_H */
1592diff -Naur aboot-0.9b.orig/include/asm-generic/page.h aboot-0.9b/include/asm-generic/page.h
1593--- aboot-0.9b.orig/include/asm-generic/page.h 1969-12-31 19:00:00.000000000 -0500
1594+++ aboot-0.9b/include/asm-generic/page.h 2006-06-25 18:22:04.000000000 -0400
1595@@ -0,0 +1,27 @@
1596+#ifndef _ASM_GENERIC_PAGE_H
1597+#define _ASM_GENERIC_PAGE_H
1598+
1599+#ifdef __KERNEL__
1600+#ifndef __ASSEMBLY__
1601+
1602+#include <linux/compiler.h>
1603+
1604+/* Pure 2^n version of get_order */
1605+/*
1606+static int get_order(unsigned long size)
1607+{
1608+ int order;
1609+
1610+ size = (size - 1) >> (PAGE_SHIFT - 1);
1611+ order = -1;
1612+ do {
1613+ size >>= 1;
1614+ order++;
1615+ } while (size);
1616+ return order;
1617+}*/
1618+
1619+#endif /* __ASSEMBLY__ */
1620+#endif /* __KERNEL__ */
1621+
1622+#endif /* _ASM_GENERIC_PAGE_H */
1623diff -Naur aboot-0.9b.orig/include/linux/auxvec.h aboot-0.9b/include/linux/auxvec.h
1624--- aboot-0.9b.orig/include/linux/auxvec.h 1969-12-31 19:00:00.000000000 -0500
1625+++ aboot-0.9b/include/linux/auxvec.h 2006-06-25 18:22:04.000000000 -0400
1626@@ -0,0 +1,31 @@
1627+#ifndef _LINUX_AUXVEC_H
1628+#define _LINUX_AUXVEC_H
1629+
1630+#include <asm/auxvec.h>
1631+
1632+/* Symbolic values for the entries in the auxiliary table
1633+ put on the initial stack */
1634+#define AT_NULL 0 /* end of vector */
1635+#define AT_IGNORE 1 /* entry should be ignored */
1636+#define AT_EXECFD 2 /* file descriptor of program */
1637+#define AT_PHDR 3 /* program headers for program */
1638+#define AT_PHENT 4 /* size of program header entry */
1639+#define AT_PHNUM 5 /* number of program headers */
1640+#define AT_PAGESZ 6 /* system page size */
1641+#define AT_BASE 7 /* base address of interpreter */
1642+#define AT_FLAGS 8 /* flags */
1643+#define AT_ENTRY 9 /* entry point of program */
1644+#define AT_NOTELF 10 /* program is not ELF */
1645+#define AT_UID 11 /* real uid */
1646+#define AT_EUID 12 /* effective uid */
1647+#define AT_GID 13 /* real gid */
1648+#define AT_EGID 14 /* effective gid */
1649+#define AT_PLATFORM 15 /* string identifying CPU for optimizations */
1650+#define AT_HWCAP 16 /* arch dependent hints at CPU capabilities */
1651+#define AT_CLKTCK 17 /* frequency at which times() increments */
1652+
1653+#define AT_SECURE 23 /* secure mode boolean */
1654+
1655+#define AT_VECTOR_SIZE 42 /* Size of auxiliary table. */
1656+
1657+#endif /* _LINUX_AUXVEC_H */
1658diff -Naur aboot-0.9b.orig/include/linux/blockgroup_lock.h aboot-0.9b/include/linux/blockgroup_lock.h
1659--- aboot-0.9b.orig/include/linux/blockgroup_lock.h 1969-12-31 19:00:00.000000000 -0500
1660+++ aboot-0.9b/include/linux/blockgroup_lock.h 2006-06-25 18:22:04.000000000 -0400
1661@@ -0,0 +1,60 @@
1662+#ifndef _LINUX_BLOCKGROUP_LOCK_H
1663+#define _LINUX_BLOCKGROUP_LOCK_H
1664+/*
1665+ * Per-blockgroup locking for ext2 and ext3.
1666+ *
1667+ * Simple hashed spinlocking.
1668+ */
1669+
1670+#include <linux/config.h>
1671+#include <linux/spinlock.h>
1672+#include <linux/cache.h>
1673+
1674+#ifdef CONFIG_SMP
1675+
1676+/*
1677+ * We want a power-of-two. Is there a better way than this?
1678+ */
1679+
1680+#if NR_CPUS >= 32
1681+#define NR_BG_LOCKS 128
1682+#elif NR_CPUS >= 16
1683+#define NR_BG_LOCKS 64
1684+#elif NR_CPUS >= 8
1685+#define NR_BG_LOCKS 32
1686+#elif NR_CPUS >= 4
1687+#define NR_BG_LOCKS 16
1688+#elif NR_CPUS >= 2
1689+#define NR_BG_LOCKS 8
1690+#else
1691+#define NR_BG_LOCKS 4
1692+#endif
1693+
1694+#else /* CONFIG_SMP */
1695+#define NR_BG_LOCKS 1
1696+#endif /* CONFIG_SMP */
1697+
1698+struct bgl_lock {
1699+ spinlock_t lock;
1700+} ____cacheline_aligned_in_smp;
1701+
1702+struct blockgroup_lock {
1703+ struct bgl_lock locks[NR_BG_LOCKS];
1704+};
1705+
1706+static inline void bgl_lock_init(struct blockgroup_lock *bgl)
1707+{
1708+ int i;
1709+
1710+ for (i = 0; i < NR_BG_LOCKS; i++)
1711+ spin_lock_init(&bgl->locks[i].lock);
1712+}
1713+
1714+/*
1715+ * The accessor is a macro so we can embed a blockgroup_lock into different
1716+ * superblock types
1717+ */
1718+#define sb_bgl_lock(sb, block_group) \
1719+ (&(sb)->s_blockgroup_lock.locks[(block_group) & (NR_BG_LOCKS-1)].lock)
1720+
1721+#endif
1722diff -Naur aboot-0.9b.orig/include/linux/config.h aboot-0.9b/include/linux/config.h
1723--- aboot-0.9b.orig/include/linux/config.h 1969-12-31 19:00:00.000000000 -0500
1724+++ aboot-0.9b/include/linux/config.h 2006-06-25 18:22:38.000000000 -0400
1725@@ -0,0 +1 @@
1726+/* Dummy Config.h */
1727diff -Naur aboot-0.9b.orig/include/linux/elf.h aboot-0.9b/include/linux/elf.h
1728--- aboot-0.9b.orig/include/linux/elf.h 1969-12-31 19:00:00.000000000 -0500
1729+++ aboot-0.9b/include/linux/elf.h 2006-06-25 18:22:04.000000000 -0400
1730@@ -0,0 +1,427 @@
1731+#ifndef _LINUX_ELF_H
1732+#define _LINUX_ELF_H
1733+
1734+#include <linux/types.h>
1735+#include <linux/auxvec.h>
1736+#include <asm/elf.h>
1737+
1738+#ifndef elf_read_implies_exec
1739+ /* Executables for which elf_read_implies_exec() returns TRUE will
1740+ have the READ_IMPLIES_EXEC personality flag set automatically.
1741+ Override in asm/elf.h as needed. */
1742+# define elf_read_implies_exec(ex, have_pt_gnu_stack) 0
1743+#endif
1744+
1745+/* 32-bit ELF base types. */
1746+typedef __u32 Elf32_Addr;
1747+typedef __u16 Elf32_Half;
1748+typedef __u32 Elf32_Off;
1749+typedef __s32 Elf32_Sword;
1750+typedef __u32 Elf32_Word;
1751+
1752+/* 64-bit ELF base types. */
1753+typedef __u64 Elf64_Addr;
1754+typedef __u16 Elf64_Half;
1755+typedef __s16 Elf64_SHalf;
1756+typedef __u64 Elf64_Off;
1757+typedef __s32 Elf64_Sword;
1758+typedef __u32 Elf64_Word;
1759+typedef __u64 Elf64_Xword;
1760+typedef __s64 Elf64_Sxword;
1761+
1762+/* These constants are for the segment types stored in the image headers */
1763+#define PT_NULL 0
1764+#define PT_LOAD 1
1765+#define PT_DYNAMIC 2
1766+#define PT_INTERP 3
1767+#define PT_NOTE 4
1768+#define PT_SHLIB 5
1769+#define PT_PHDR 6
1770+#define PT_TLS 7 /* Thread local storage segment */
1771+#define PT_LOOS 0x60000000 /* OS-specific */
1772+#define PT_HIOS 0x6fffffff /* OS-specific */
1773+#define PT_LOPROC 0x70000000
1774+#define PT_HIPROC 0x7fffffff
1775+#define PT_GNU_EH_FRAME 0x6474e550
1776+
1777+#define PT_GNU_STACK (PT_LOOS + 0x474e551)
1778+
1779+/* These constants define the different elf file types */
1780+#define ET_NONE 0
1781+#define ET_REL 1
1782+#define ET_EXEC 2
1783+#define ET_DYN 3
1784+#define ET_CORE 4
1785+#define ET_LOPROC 0xff00
1786+#define ET_HIPROC 0xffff
1787+
1788+/* These constants define the various ELF target machines */
1789+#define EM_NONE 0
1790+#define EM_M32 1
1791+#define EM_SPARC 2
1792+#define EM_386 3
1793+#define EM_68K 4
1794+#define EM_88K 5
1795+#define EM_486 6 /* Perhaps disused */
1796+#define EM_860 7
1797+
1798+#define EM_MIPS 8 /* MIPS R3000 (officially, big-endian only) */
1799+
1800+#define EM_MIPS_RS4_BE 10 /* MIPS R4000 big-endian */
1801+
1802+#define EM_PARISC 15 /* HPPA */
1803+
1804+#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */
1805+
1806+#define EM_PPC 20 /* PowerPC */
1807+#define EM_PPC64 21 /* PowerPC64 */
1808+
1809+#define EM_SH 42 /* SuperH */
1810+
1811+#define EM_SPARCV9 43 /* SPARC v9 64-bit */
1812+
1813+#define EM_IA_64 50 /* HP/Intel IA-64 */
1814+
1815+#define EM_X86_64 62 /* AMD x86-64 */
1816+
1817+#define EM_S390 22 /* IBM S/390 */
1818+
1819+#define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */
1820+
1821+#define EM_V850 87 /* NEC v850 */
1822+
1823+#define EM_M32R 88 /* Renesas M32R */
1824+
1825+#define EM_H8_300 46 /* Renesas H8/300,300H,H8S */
1826+
1827+/*
1828+ * This is an interim value that we will use until the committee comes
1829+ * up with a final number.
1830+ */
1831+#define EM_ALPHA 0x9026
1832+
1833+/* Bogus old v850 magic number, used by old tools. */
1834+#define EM_CYGNUS_V850 0x9080
1835+
1836+/* Bogus old m32r magic number, used by old tools. */
1837+#define EM_CYGNUS_M32R 0x9041
1838+
1839+/*
1840+ * This is the old interim value for S/390 architecture
1841+ */
1842+#define EM_S390_OLD 0xA390
1843+
1844+#define EM_FRV 0x5441 /* Fujitsu FR-V */
1845+
1846+/* This is the info that is needed to parse the dynamic section of the file */
1847+#define DT_NULL 0
1848+#define DT_NEEDED 1
1849+#define DT_PLTRELSZ 2
1850+#define DT_PLTGOT 3
1851+#define DT_HASH 4
1852+#define DT_STRTAB 5
1853+#define DT_SYMTAB 6
1854+#define DT_RELA 7
1855+#define DT_RELASZ 8
1856+#define DT_RELAENT 9
1857+#define DT_STRSZ 10
1858+#define DT_SYMENT 11
1859+#define DT_INIT 12
1860+#define DT_FINI 13
1861+#define DT_SONAME 14
1862+#define DT_RPATH 15
1863+#define DT_SYMBOLIC 16
1864+#define DT_REL 17
1865+#define DT_RELSZ 18
1866+#define DT_RELENT 19
1867+#define DT_PLTREL 20
1868+#define DT_DEBUG 21
1869+#define DT_TEXTREL 22
1870+#define DT_JMPREL 23
1871+#define DT_LOPROC 0x70000000
1872+#define DT_HIPROC 0x7fffffff
1873+
1874+/* This info is needed when parsing the symbol table */
1875+#define STB_LOCAL 0
1876+#define STB_GLOBAL 1
1877+#define STB_WEAK 2
1878+
1879+#define STT_NOTYPE 0
1880+#define STT_OBJECT 1
1881+#define STT_FUNC 2
1882+#define STT_SECTION 3
1883+#define STT_FILE 4
1884+
1885+#define ELF_ST_BIND(x) ((x) >> 4)
1886+#define ELF_ST_TYPE(x) (((unsigned int) x) & 0xf)
1887+#define ELF32_ST_BIND(x) ELF_ST_BIND(x)
1888+#define ELF32_ST_TYPE(x) ELF_ST_TYPE(x)
1889+#define ELF64_ST_BIND(x) ELF_ST_BIND(x)
1890+#define ELF64_ST_TYPE(x) ELF_ST_TYPE(x)
1891+
1892+typedef struct dynamic{
1893+ Elf32_Sword d_tag;
1894+ union{
1895+ Elf32_Sword d_val;
1896+ Elf32_Addr d_ptr;
1897+ } d_un;
1898+} Elf32_Dyn;
1899+
1900+typedef struct {
1901+ Elf64_Sxword d_tag; /* entry tag value */
1902+ union {
1903+ Elf64_Xword d_val;
1904+ Elf64_Addr d_ptr;
1905+ } d_un;
1906+} Elf64_Dyn;
1907+
1908+/* The following are used with relocations */
1909+#define ELF32_R_SYM(x) ((x) >> 8)
1910+#define ELF32_R_TYPE(x) ((x) & 0xff)
1911+
1912+#define ELF64_R_SYM(i) ((i) >> 32)
1913+#define ELF64_R_TYPE(i) ((i) & 0xffffffff)
1914+
1915+typedef struct elf32_rel {
1916+ Elf32_Addr r_offset;
1917+ Elf32_Word r_info;
1918+} Elf32_Rel;
1919+
1920+typedef struct elf64_rel {
1921+ Elf64_Addr r_offset; /* Location at which to apply the action */
1922+ Elf64_Xword r_info; /* index and type of relocation */
1923+} Elf64_Rel;
1924+
1925+typedef struct elf32_rela{
1926+ Elf32_Addr r_offset;
1927+ Elf32_Word r_info;
1928+ Elf32_Sword r_addend;
1929+} Elf32_Rela;
1930+
1931+typedef struct elf64_rela {
1932+ Elf64_Addr r_offset; /* Location at which to apply the action */
1933+ Elf64_Xword r_info; /* index and type of relocation */
1934+ Elf64_Sxword r_addend; /* Constant addend used to compute value */
1935+} Elf64_Rela;
1936+
1937+typedef struct elf32_sym{
1938+ Elf32_Word st_name;
1939+ Elf32_Addr st_value;
1940+ Elf32_Word st_size;
1941+ unsigned char st_info;
1942+ unsigned char st_other;
1943+ Elf32_Half st_shndx;
1944+} Elf32_Sym;
1945+
1946+typedef struct elf64_sym {
1947+ Elf64_Word st_name; /* Symbol name, index in string tbl */
1948+ unsigned char st_info; /* Type and binding attributes */
1949+ unsigned char st_other; /* No defined meaning, 0 */
1950+ Elf64_Half st_shndx; /* Associated section index */
1951+ Elf64_Addr st_value; /* Value of the symbol */
1952+ Elf64_Xword st_size; /* Associated symbol size */
1953+} Elf64_Sym;
1954+
1955+
1956+#define EI_NIDENT 16
1957+
1958+typedef struct elf32_hdr{
1959+ unsigned char e_ident[EI_NIDENT];
1960+ Elf32_Half e_type;
1961+ Elf32_Half e_machine;
1962+ Elf32_Word e_version;
1963+ Elf32_Addr e_entry; /* Entry point */
1964+ Elf32_Off e_phoff;
1965+ Elf32_Off e_shoff;
1966+ Elf32_Word e_flags;
1967+ Elf32_Half e_ehsize;
1968+ Elf32_Half e_phentsize;
1969+ Elf32_Half e_phnum;
1970+ Elf32_Half e_shentsize;
1971+ Elf32_Half e_shnum;
1972+ Elf32_Half e_shstrndx;
1973+} Elf32_Ehdr;
1974+
1975+typedef struct elf64_hdr {
1976+ unsigned char e_ident[16]; /* ELF "magic number" */
1977+ Elf64_Half e_type;
1978+ Elf64_Half e_machine;
1979+ Elf64_Word e_version;
1980+ Elf64_Addr e_entry; /* Entry point virtual address */
1981+ Elf64_Off e_phoff; /* Program header table file offset */
1982+ Elf64_Off e_shoff; /* Section header table file offset */
1983+ Elf64_Word e_flags;
1984+ Elf64_Half e_ehsize;
1985+ Elf64_Half e_phentsize;
1986+ Elf64_Half e_phnum;
1987+ Elf64_Half e_shentsize;
1988+ Elf64_Half e_shnum;
1989+ Elf64_Half e_shstrndx;
1990+} Elf64_Ehdr;
1991+
1992+/* These constants define the permissions on sections in the program
1993+ header, p_flags. */
1994+#define PF_R 0x4
1995+#define PF_W 0x2
1996+#define PF_X 0x1
1997+
1998+typedef struct elf32_phdr{
1999+ Elf32_Word p_type;
2000+ Elf32_Off p_offset;
2001+ Elf32_Addr p_vaddr;
2002+ Elf32_Addr p_paddr;
2003+ Elf32_Word p_filesz;
2004+ Elf32_Word p_memsz;
2005+ Elf32_Word p_flags;
2006+ Elf32_Word p_align;
2007+} Elf32_Phdr;
2008+
2009+typedef struct elf64_phdr {
2010+ Elf64_Word p_type;
2011+ Elf64_Word p_flags;
2012+ Elf64_Off p_offset; /* Segment file offset */
2013+ Elf64_Addr p_vaddr; /* Segment virtual address */
2014+ Elf64_Addr p_paddr; /* Segment physical address */
2015+ Elf64_Xword p_filesz; /* Segment size in file */
2016+ Elf64_Xword p_memsz; /* Segment size in memory */
2017+ Elf64_Xword p_align; /* Segment alignment, file & memory */
2018+} Elf64_Phdr;
2019+
2020+/* sh_type */
2021+#define SHT_NULL 0
2022+#define SHT_PROGBITS 1
2023+#define SHT_SYMTAB 2
2024+#define SHT_STRTAB 3
2025+#define SHT_RELA 4
2026+#define SHT_HASH 5
2027+#define SHT_DYNAMIC 6
2028+#define SHT_NOTE 7
2029+#define SHT_NOBITS 8
2030+#define SHT_REL 9
2031+#define SHT_SHLIB 10
2032+#define SHT_DYNSYM 11
2033+#define SHT_NUM 12
2034+#define SHT_LOPROC 0x70000000
2035+#define SHT_HIPROC 0x7fffffff
2036+#define SHT_LOUSER 0x80000000
2037+#define SHT_HIUSER 0xffffffff
2038+
2039+/* sh_flags */
2040+#define SHF_WRITE 0x1
2041+#define SHF_ALLOC 0x2
2042+#define SHF_EXECINSTR 0x4
2043+#define SHF_MASKPROC 0xf0000000
2044+
2045+/* special section indexes */
2046+#define SHN_UNDEF 0
2047+#define SHN_LORESERVE 0xff00
2048+#define SHN_LOPROC 0xff00
2049+#define SHN_HIPROC 0xff1f
2050+#define SHN_ABS 0xfff1
2051+#define SHN_COMMON 0xfff2
2052+#define SHN_HIRESERVE 0xffff
2053+
2054+typedef struct {
2055+ Elf32_Word sh_name;
2056+ Elf32_Word sh_type;
2057+ Elf32_Word sh_flags;
2058+ Elf32_Addr sh_addr;
2059+ Elf32_Off sh_offset;
2060+ Elf32_Word sh_size;
2061+ Elf32_Word sh_link;
2062+ Elf32_Word sh_info;
2063+ Elf32_Word sh_addralign;
2064+ Elf32_Word sh_entsize;
2065+} Elf32_Shdr;
2066+
2067+typedef struct elf64_shdr {
2068+ Elf64_Word sh_name; /* Section name, index in string tbl */
2069+ Elf64_Word sh_type; /* Type of section */
2070+ Elf64_Xword sh_flags; /* Miscellaneous section attributes */
2071+ Elf64_Addr sh_addr; /* Section virtual addr at execution */
2072+ Elf64_Off sh_offset; /* Section file offset */
2073+ Elf64_Xword sh_size; /* Size of section in bytes */
2074+ Elf64_Word sh_link; /* Index of another section */
2075+ Elf64_Word sh_info; /* Additional section information */
2076+ Elf64_Xword sh_addralign; /* Section alignment */
2077+ Elf64_Xword sh_entsize; /* Entry size if section holds table */
2078+} Elf64_Shdr;
2079+
2080+#define EI_MAG0 0 /* e_ident[] indexes */
2081+#define EI_MAG1 1
2082+#define EI_MAG2 2
2083+#define EI_MAG3 3
2084+#define EI_CLASS 4
2085+#define EI_DATA 5
2086+#define EI_VERSION 6
2087+#define EI_OSABI 7
2088+#define EI_PAD 8
2089+
2090+#define ELFMAG0 0x7f /* EI_MAG */
2091+#define ELFMAG1 'E'
2092+#define ELFMAG2 'L'
2093+#define ELFMAG3 'F'
2094+#define ELFMAG "\177ELF"
2095+#define SELFMAG 4
2096+
2097+#define ELFCLASSNONE 0 /* EI_CLASS */
2098+#define ELFCLASS32 1
2099+#define ELFCLASS64 2
2100+#define ELFCLASSNUM 3
2101+
2102+#define ELFDATANONE 0 /* e_ident[EI_DATA] */
2103+#define ELFDATA2LSB 1
2104+#define ELFDATA2MSB 2
2105+
2106+#define EV_NONE 0 /* e_version, EI_VERSION */
2107+#define EV_CURRENT 1
2108+#define EV_NUM 2
2109+
2110+#define ELFOSABI_NONE 0
2111+#define ELFOSABI_LINUX 3
2112+
2113+#ifndef ELF_OSABI
2114+#define ELF_OSABI ELFOSABI_NONE
2115+#endif
2116+
2117+/* Notes used in ET_CORE */
2118+#define NT_PRSTATUS 1
2119+#define NT_PRFPREG 2
2120+#define NT_PRPSINFO 3
2121+#define NT_TASKSTRUCT 4
2122+#define NT_AUXV 6
2123+#define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */
2124+
2125+
2126+/* Note header in a PT_NOTE section */
2127+typedef struct elf32_note {
2128+ Elf32_Word n_namesz; /* Name size */
2129+ Elf32_Word n_descsz; /* Content size */
2130+ Elf32_Word n_type; /* Content type */
2131+} Elf32_Nhdr;
2132+
2133+/* Note header in a PT_NOTE section */
2134+typedef struct elf64_note {
2135+ Elf64_Word n_namesz; /* Name size */
2136+ Elf64_Word n_descsz; /* Content size */
2137+ Elf64_Word n_type; /* Content type */
2138+} Elf64_Nhdr;
2139+
2140+#if ELF_CLASS == ELFCLASS32
2141+
2142+extern Elf32_Dyn _DYNAMIC [];
2143+#define elfhdr elf32_hdr
2144+#define elf_phdr elf32_phdr
2145+#define elf_note elf32_note
2146+
2147+#else
2148+
2149+extern Elf64_Dyn _DYNAMIC [];
2150+#define elfhdr elf64_hdr
2151+#define elf_phdr elf64_phdr
2152+#define elf_note elf64_note
2153+
2154+#endif
2155+
2156+
2157+#endif /* _LINUX_ELF_H */
2158diff -Naur aboot-0.9b.orig/include/linux/spinlock.h aboot-0.9b/include/linux/spinlock.h
2159--- aboot-0.9b.orig/include/linux/spinlock.h 1969-12-31 19:00:00.000000000 -0500
2160+++ aboot-0.9b/include/linux/spinlock.h 2006-06-25 18:22:04.000000000 -0400
2161@@ -0,0 +1,247 @@
2162+#ifndef __LINUX_SPINLOCK_H
2163+#define __LINUX_SPINLOCK_H
2164+
2165+/*
2166+ * include/linux/spinlock.h - generic spinlock/rwlock declarations
2167+ *
2168+ * here's the role of the various spinlock/rwlock related include files:
2169+ *
2170+ * on SMP builds:
2171+ *
2172+ * asm/spinlock_types.h: contains the raw_spinlock_t/raw_rwlock_t and the
2173+ * initializers
2174+ *
2175+ * linux/spinlock_types.h:
2176+ * defines the generic type and initializers
2177+ *
2178+ * asm/spinlock.h: contains the __raw_spin_*()/etc. lowlevel
2179+ * implementations, mostly inline assembly code
2180+ *
2181+ * (also included on UP-debug builds:)
2182+ *
2183+ * linux/spinlock_api_smp.h:
2184+ * contains the prototypes for the _spin_*() APIs.
2185+ *
2186+ * linux/spinlock.h: builds the final spin_*() APIs.
2187+ *
2188+ * on UP builds:
2189+ *
2190+ * linux/spinlock_type_up.h:
2191+ * contains the generic, simplified UP spinlock type.
2192+ * (which is an empty structure on non-debug builds)
2193+ *
2194+ * linux/spinlock_types.h:
2195+ * defines the generic type and initializers
2196+ *
2197+ * linux/spinlock_up.h:
2198+ * contains the __raw_spin_*()/etc. version of UP
2199+ * builds. (which are NOPs on non-debug, non-preempt
2200+ * builds)
2201+ *
2202+ * (included on UP-non-debug builds:)
2203+ *
2204+ * linux/spinlock_api_up.h:
2205+ * builds the _spin_*() APIs.
2206+ *
2207+ * linux/spinlock.h: builds the final spin_*() APIs.
2208+ */
2209+
2210+#include <linux/config.h>
2211+#include <linux/preempt.h>
2212+#include <linux/linkage.h>
2213+#include <linux/compiler.h>
2214+#include <linux/thread_info.h>
2215+#include <linux/kernel.h>
2216+#include <linux/stringify.h>
2217+
2218+#include <asm/system.h>
2219+
2220+/*
2221+ * Must define these before including other files, inline functions need them
2222+ */
2223+#define LOCK_SECTION_NAME ".text.lock."KBUILD_BASENAME
2224+
2225+#define LOCK_SECTION_START(extra) \
2226+ ".subsection 1\n\t" \
2227+ extra \
2228+ ".ifndef " LOCK_SECTION_NAME "\n\t" \
2229+ LOCK_SECTION_NAME ":\n\t" \
2230+ ".endif\n"
2231+
2232+#define LOCK_SECTION_END \
2233+ ".previous\n\t"
2234+
2235+#define __lockfunc fastcall __attribute__((section(".spinlock.text")))
2236+
2237+/*
2238+ * Pull the raw_spinlock_t and raw_rwlock_t definitions:
2239+ */
2240+#include <linux/spinlock_types.h>
2241+
2242+extern int __lockfunc generic__raw_read_trylock(raw_rwlock_t *lock);
2243+
2244+/*
2245+ * Pull the __raw*() functions/declarations (UP-nondebug doesnt need them):
2246+ */
2247+#if defined(CONFIG_SMP)
2248+# include <asm/spinlock.h>
2249+#else
2250+# include <linux/spinlock_up.h>
2251+#endif
2252+
2253+#define spin_lock_init(lock) do { *(lock) = SPIN_LOCK_UNLOCKED; } while (0)
2254+#define rwlock_init(lock) do { *(lock) = RW_LOCK_UNLOCKED; } while (0)
2255+
2256+#define spin_is_locked(lock) __raw_spin_is_locked(&(lock)->raw_lock)
2257+
2258+/**
2259+ * spin_unlock_wait - wait until the spinlock gets unlocked
2260+ * @lock: the spinlock in question.
2261+ */
2262+#define spin_unlock_wait(lock) __raw_spin_unlock_wait(&(lock)->raw_lock)
2263+
2264+/*
2265+ * Pull the _spin_*()/_read_*()/_write_*() functions/declarations:
2266+ */
2267+#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
2268+# include <linux/spinlock_api_smp.h>
2269+#else
2270+# include <linux/spinlock_api_up.h>
2271+#endif
2272+
2273+#ifdef CONFIG_DEBUG_SPINLOCK
2274+ extern void _raw_spin_lock(spinlock_t *lock);
2275+#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock)
2276+ extern int _raw_spin_trylock(spinlock_t *lock);
2277+ extern void _raw_spin_unlock(spinlock_t *lock);
2278+
2279+ extern void _raw_read_lock(rwlock_t *lock);
2280+ extern int _raw_read_trylock(rwlock_t *lock);
2281+ extern void _raw_read_unlock(rwlock_t *lock);
2282+ extern void _raw_write_lock(rwlock_t *lock);
2283+ extern int _raw_write_trylock(rwlock_t *lock);
2284+ extern void _raw_write_unlock(rwlock_t *lock);
2285+#else
2286+# define _raw_spin_unlock(lock) __raw_spin_unlock(&(lock)->raw_lock)
2287+# define _raw_spin_trylock(lock) __raw_spin_trylock(&(lock)->raw_lock)
2288+# define _raw_spin_lock(lock) __raw_spin_lock(&(lock)->raw_lock)
2289+# define _raw_spin_lock_flags(lock, flags) \
2290+ __raw_spin_lock_flags(&(lock)->raw_lock, *(flags))
2291+# define _raw_read_lock(rwlock) __raw_read_lock(&(rwlock)->raw_lock)
2292+# define _raw_write_lock(rwlock) __raw_write_lock(&(rwlock)->raw_lock)
2293+# define _raw_read_unlock(rwlock) __raw_read_unlock(&(rwlock)->raw_lock)
2294+# define _raw_write_unlock(rwlock) __raw_write_unlock(&(rwlock)->raw_lock)
2295+# define _raw_read_trylock(rwlock) __raw_read_trylock(&(rwlock)->raw_lock)
2296+# define _raw_write_trylock(rwlock) __raw_write_trylock(&(rwlock)->raw_lock)
2297+#endif
2298+
2299+#define read_can_lock(rwlock) __raw_read_can_lock(&(rwlock)->raw_lock)
2300+#define write_can_lock(rwlock) __raw_write_can_lock(&(rwlock)->raw_lock)
2301+
2302+/*
2303+ * Define the various spin_lock and rw_lock methods. Note we define these
2304+ * regardless of whether CONFIG_SMP or CONFIG_PREEMPT are set. The various
2305+ * methods are defined as nops in the case they are not required.
2306+ */
2307+#define spin_trylock(lock) __cond_lock(_spin_trylock(lock))
2308+#define read_trylock(lock) __cond_lock(_read_trylock(lock))
2309+#define write_trylock(lock) __cond_lock(_write_trylock(lock))
2310+
2311+#define spin_lock(lock) _spin_lock(lock)
2312+#define write_lock(lock) _write_lock(lock)
2313+#define read_lock(lock) _read_lock(lock)
2314+
2315+#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
2316+#define spin_lock_irqsave(lock, flags) flags = _spin_lock_irqsave(lock)
2317+#define read_lock_irqsave(lock, flags) flags = _read_lock_irqsave(lock)
2318+#define write_lock_irqsave(lock, flags) flags = _write_lock_irqsave(lock)
2319+#else
2320+#define spin_lock_irqsave(lock, flags) _spin_lock_irqsave(lock, flags)
2321+#define read_lock_irqsave(lock, flags) _read_lock_irqsave(lock, flags)
2322+#define write_lock_irqsave(lock, flags) _write_lock_irqsave(lock, flags)
2323+#endif
2324+
2325+#define spin_lock_irq(lock) _spin_lock_irq(lock)
2326+#define spin_lock_bh(lock) _spin_lock_bh(lock)
2327+
2328+#define read_lock_irq(lock) _read_lock_irq(lock)
2329+#define read_lock_bh(lock) _read_lock_bh(lock)
2330+
2331+#define write_lock_irq(lock) _write_lock_irq(lock)
2332+#define write_lock_bh(lock) _write_lock_bh(lock)
2333+
2334+/*
2335+ * We inline the unlock functions in the nondebug case:
2336+ */
2337+#if defined(CONFIG_DEBUG_SPINLOCK) || defined(CONFIG_PREEMPT) || !defined(CONFIG_SMP)
2338+# define spin_unlock(lock) _spin_unlock(lock)
2339+# define read_unlock(lock) _read_unlock(lock)
2340+# define write_unlock(lock) _write_unlock(lock)
2341+#else
2342+# define spin_unlock(lock) __raw_spin_unlock(&(lock)->raw_lock)
2343+# define read_unlock(lock) __raw_read_unlock(&(lock)->raw_lock)
2344+# define write_unlock(lock) __raw_write_unlock(&(lock)->raw_lock)
2345+#endif
2346+
2347+#if defined(CONFIG_DEBUG_SPINLOCK) || defined(CONFIG_PREEMPT) || !defined(CONFIG_SMP)
2348+# define spin_unlock_irq(lock) _spin_unlock_irq(lock)
2349+# define read_unlock_irq(lock) _read_unlock_irq(lock)
2350+# define write_unlock_irq(lock) _write_unlock_irq(lock)
2351+#else
2352+# define spin_unlock_irq(lock) \
2353+ do { __raw_spin_unlock(&(lock)->raw_lock); local_irq_enable(); } while (0)
2354+# define read_unlock_irq(lock) \
2355+ do { __raw_read_unlock(&(lock)->raw_lock); local_irq_enable(); } while (0)
2356+# define write_unlock_irq(lock) \
2357+ do { __raw_write_unlock(&(lock)->raw_lock); local_irq_enable(); } while (0)
2358+#endif
2359+
2360+#define spin_unlock_irqrestore(lock, flags) \
2361+ _spin_unlock_irqrestore(lock, flags)
2362+#define spin_unlock_bh(lock) _spin_unlock_bh(lock)
2363+
2364+#define read_unlock_irqrestore(lock, flags) \
2365+ _read_unlock_irqrestore(lock, flags)
2366+#define read_unlock_bh(lock) _read_unlock_bh(lock)
2367+
2368+#define write_unlock_irqrestore(lock, flags) \
2369+ _write_unlock_irqrestore(lock, flags)
2370+#define write_unlock_bh(lock) _write_unlock_bh(lock)
2371+
2372+#define spin_trylock_bh(lock) __cond_lock(_spin_trylock_bh(lock))
2373+
2374+#define spin_trylock_irq(lock) \
2375+({ \
2376+ local_irq_disable(); \
2377+ _spin_trylock(lock) ? \
2378+ 1 : ({ local_irq_enable(); 0; }); \
2379+})
2380+
2381+#define spin_trylock_irqsave(lock, flags) \
2382+({ \
2383+ local_irq_save(flags); \
2384+ _spin_trylock(lock) ? \
2385+ 1 : ({ local_irq_restore(flags); 0; }); \
2386+})
2387+
2388+/*
2389+ * Pull the atomic_t declaration:
2390+ * (asm-mips/atomic.h needs above definitions)
2391+ */
2392+#include <asm/atomic.h>
2393+/**
2394+ * atomic_dec_and_lock - lock on reaching reference count zero
2395+ * @atomic: the atomic counter
2396+ * @lock: the spinlock in question
2397+ */
2398+extern int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock);
2399+#define atomic_dec_and_lock(atomic, lock) \
2400+ __cond_lock(_atomic_dec_and_lock(atomic, lock))
2401+
2402+/**
2403+ * spin_can_lock - would spin_trylock() succeed?
2404+ * @lock: the spinlock in question.
2405+ */
2406+#define spin_can_lock(lock) (!spin_is_locked(lock))
2407+
2408+#endif /* __LINUX_SPINLOCK_H */
2409diff -Naur aboot-0.9b.orig/include/linux/spinlock_api_smp.h aboot-0.9b/include/linux/spinlock_api_smp.h
2410--- aboot-0.9b.orig/include/linux/spinlock_api_smp.h 1969-12-31 19:00:00.000000000 -0500
2411+++ aboot-0.9b/include/linux/spinlock_api_smp.h 2006-06-25 18:22:04.000000000 -0400
2412@@ -0,0 +1,57 @@
2413+#ifndef __LINUX_SPINLOCK_API_SMP_H
2414+#define __LINUX_SPINLOCK_API_SMP_H
2415+
2416+#ifndef __LINUX_SPINLOCK_H
2417+# error "please don't include this file directly"
2418+#endif
2419+
2420+/*
2421+ * include/linux/spinlock_api_smp.h
2422+ *
2423+ * spinlock API declarations on SMP (and debug)
2424+ * (implemented in kernel/spinlock.c)
2425+ *
2426+ * portions Copyright 2005, Red Hat, Inc., Ingo Molnar
2427+ * Released under the General Public License (GPL).
2428+ */
2429+
2430+int in_lock_functions(unsigned long addr);
2431+
2432+#define assert_spin_locked(x) BUG_ON(!spin_is_locked(x))
2433+
2434+void __lockfunc _spin_lock(spinlock_t *lock) __acquires(spinlock_t);
2435+void __lockfunc _read_lock(rwlock_t *lock) __acquires(rwlock_t);
2436+void __lockfunc _write_lock(rwlock_t *lock) __acquires(rwlock_t);
2437+void __lockfunc _spin_lock_bh(spinlock_t *lock) __acquires(spinlock_t);
2438+void __lockfunc _read_lock_bh(rwlock_t *lock) __acquires(rwlock_t);
2439+void __lockfunc _write_lock_bh(rwlock_t *lock) __acquires(rwlock_t);
2440+void __lockfunc _spin_lock_irq(spinlock_t *lock) __acquires(spinlock_t);
2441+void __lockfunc _read_lock_irq(rwlock_t *lock) __acquires(rwlock_t);
2442+void __lockfunc _write_lock_irq(rwlock_t *lock) __acquires(rwlock_t);
2443+unsigned long __lockfunc _spin_lock_irqsave(spinlock_t *lock)
2444+ __acquires(spinlock_t);
2445+unsigned long __lockfunc _read_lock_irqsave(rwlock_t *lock)
2446+ __acquires(rwlock_t);
2447+unsigned long __lockfunc _write_lock_irqsave(rwlock_t *lock)
2448+ __acquires(rwlock_t);
2449+int __lockfunc _spin_trylock(spinlock_t *lock);
2450+int __lockfunc _read_trylock(rwlock_t *lock);
2451+int __lockfunc _write_trylock(rwlock_t *lock);
2452+int __lockfunc _spin_trylock_bh(spinlock_t *lock);
2453+void __lockfunc _spin_unlock(spinlock_t *lock) __releases(spinlock_t);
2454+void __lockfunc _read_unlock(rwlock_t *lock) __releases(rwlock_t);
2455+void __lockfunc _write_unlock(rwlock_t *lock) __releases(rwlock_t);
2456+void __lockfunc _spin_unlock_bh(spinlock_t *lock) __releases(spinlock_t);
2457+void __lockfunc _read_unlock_bh(rwlock_t *lock) __releases(rwlock_t);
2458+void __lockfunc _write_unlock_bh(rwlock_t *lock) __releases(rwlock_t);
2459+void __lockfunc _spin_unlock_irq(spinlock_t *lock) __releases(spinlock_t);
2460+void __lockfunc _read_unlock_irq(rwlock_t *lock) __releases(rwlock_t);
2461+void __lockfunc _write_unlock_irq(rwlock_t *lock) __releases(rwlock_t);
2462+void __lockfunc _spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags)
2463+ __releases(spinlock_t);
2464+void __lockfunc _read_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
2465+ __releases(rwlock_t);
2466+void __lockfunc _write_unlock_irqrestore(rwlock_t *lock, unsigned long flags)
2467+ __releases(rwlock_t);
2468+
2469+#endif /* __LINUX_SPINLOCK_API_SMP_H */
2470diff -Naur aboot-0.9b.orig/include/linux/spinlock_api_up.h aboot-0.9b/include/linux/spinlock_api_up.h
2471--- aboot-0.9b.orig/include/linux/spinlock_api_up.h 1969-12-31 19:00:00.000000000 -0500
2472+++ aboot-0.9b/include/linux/spinlock_api_up.h 2006-06-25 18:22:04.000000000 -0400
2473@@ -0,0 +1,80 @@
2474+#ifndef __LINUX_SPINLOCK_API_UP_H
2475+#define __LINUX_SPINLOCK_API_UP_H
2476+
2477+#ifndef __LINUX_SPINLOCK_H
2478+# error "please don't include this file directly"
2479+#endif
2480+
2481+/*
2482+ * include/linux/spinlock_api_up.h
2483+ *
2484+ * spinlock API implementation on UP-nondebug (inlined implementation)
2485+ *
2486+ * portions Copyright 2005, Red Hat, Inc., Ingo Molnar
2487+ * Released under the General Public License (GPL).
2488+ */
2489+
2490+#define in_lock_functions(ADDR) 0
2491+
2492+#define assert_spin_locked(lock) do { (void)(lock); } while (0)
2493+
2494+/*
2495+ * In the UP-nondebug case there's no real locking going on, so the
2496+ * only thing we have to do is to keep the preempt counts and irq
2497+ * flags straight, to supress compiler warnings of unused lock
2498+ * variables, and to add the proper checker annotations:
2499+ */
2500+#define __LOCK(lock) \
2501+ do { preempt_disable(); __acquire(lock); (void)(lock); } while (0)
2502+
2503+#define __LOCK_BH(lock) \
2504+ do { local_bh_disable(); __LOCK(lock); } while (0)
2505+
2506+#define __LOCK_IRQ(lock) \
2507+ do { local_irq_disable(); __LOCK(lock); } while (0)
2508+
2509+#define __LOCK_IRQSAVE(lock, flags) \
2510+ do { local_irq_save(flags); __LOCK(lock); } while (0)
2511+
2512+#define __UNLOCK(lock) \
2513+ do { preempt_enable(); __release(lock); (void)(lock); } while (0)
2514+
2515+#define __UNLOCK_BH(lock) \
2516+ do { preempt_enable_no_resched(); local_bh_enable(); __release(lock); (void)(lock); } while (0)
2517+
2518+#define __UNLOCK_IRQ(lock) \
2519+ do { local_irq_enable(); __UNLOCK(lock); } while (0)
2520+
2521+#define __UNLOCK_IRQRESTORE(lock, flags) \
2522+ do { local_irq_restore(flags); __UNLOCK(lock); } while (0)
2523+
2524+#define _spin_lock(lock) __LOCK(lock)
2525+#define _read_lock(lock) __LOCK(lock)
2526+#define _write_lock(lock) __LOCK(lock)
2527+#define _spin_lock_bh(lock) __LOCK_BH(lock)
2528+#define _read_lock_bh(lock) __LOCK_BH(lock)
2529+#define _write_lock_bh(lock) __LOCK_BH(lock)
2530+#define _spin_lock_irq(lock) __LOCK_IRQ(lock)
2531+#define _read_lock_irq(lock) __LOCK_IRQ(lock)
2532+#define _write_lock_irq(lock) __LOCK_IRQ(lock)
2533+#define _spin_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags)
2534+#define _read_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags)
2535+#define _write_lock_irqsave(lock, flags) __LOCK_IRQSAVE(lock, flags)
2536+#define _spin_trylock(lock) ({ __LOCK(lock); 1; })
2537+#define _read_trylock(lock) ({ __LOCK(lock); 1; })
2538+#define _write_trylock(lock) ({ __LOCK(lock); 1; })
2539+#define _spin_trylock_bh(lock) ({ __LOCK_BH(lock); 1; })
2540+#define _spin_unlock(lock) __UNLOCK(lock)
2541+#define _read_unlock(lock) __UNLOCK(lock)
2542+#define _write_unlock(lock) __UNLOCK(lock)
2543+#define _spin_unlock_bh(lock) __UNLOCK_BH(lock)
2544+#define _write_unlock_bh(lock) __UNLOCK_BH(lock)
2545+#define _read_unlock_bh(lock) __UNLOCK_BH(lock)
2546+#define _spin_unlock_irq(lock) __UNLOCK_IRQ(lock)
2547+#define _read_unlock_irq(lock) __UNLOCK_IRQ(lock)
2548+#define _write_unlock_irq(lock) __UNLOCK_IRQ(lock)
2549+#define _spin_unlock_irqrestore(lock, flags) __UNLOCK_IRQRESTORE(lock, flags)
2550+#define _read_unlock_irqrestore(lock, flags) __UNLOCK_IRQRESTORE(lock, flags)
2551+#define _write_unlock_irqrestore(lock, flags) __UNLOCK_IRQRESTORE(lock, flags)
2552+
2553+#endif /* __LINUX_SPINLOCK_API_UP_H */
2554diff -Naur aboot-0.9b.orig/include/linux/spinlock_types.h aboot-0.9b/include/linux/spinlock_types.h
2555--- aboot-0.9b.orig/include/linux/spinlock_types.h 1969-12-31 19:00:00.000000000 -0500
2556+++ aboot-0.9b/include/linux/spinlock_types.h 2006-06-25 18:22:04.000000000 -0400
2557@@ -0,0 +1,67 @@
2558+#ifndef __LINUX_SPINLOCK_TYPES_H
2559+#define __LINUX_SPINLOCK_TYPES_H
2560+
2561+/*
2562+ * include/linux/spinlock_types.h - generic spinlock type definitions
2563+ * and initializers
2564+ *
2565+ * portions Copyright 2005, Red Hat, Inc., Ingo Molnar
2566+ * Released under the General Public License (GPL).
2567+ */
2568+
2569+#if defined(CONFIG_SMP)
2570+# include <asm/spinlock_types.h>
2571+#else
2572+# include <linux/spinlock_types_up.h>
2573+#endif
2574+
2575+typedef struct {
2576+ raw_spinlock_t raw_lock;
2577+#if defined(CONFIG_PREEMPT) && defined(CONFIG_SMP)
2578+ unsigned int break_lock;
2579+#endif
2580+#ifdef CONFIG_DEBUG_SPINLOCK
2581+ unsigned int magic, owner_cpu;
2582+ void *owner;
2583+#endif
2584+} spinlock_t;
2585+
2586+#define SPINLOCK_MAGIC 0xdead4ead
2587+
2588+typedef struct {
2589+ raw_rwlock_t raw_lock;
2590+#if defined(CONFIG_PREEMPT) && defined(CONFIG_SMP)
2591+ unsigned int break_lock;
2592+#endif
2593+#ifdef CONFIG_DEBUG_SPINLOCK
2594+ unsigned int magic, owner_cpu;
2595+ void *owner;
2596+#endif
2597+} rwlock_t;
2598+
2599+#define RWLOCK_MAGIC 0xdeaf1eed
2600+
2601+#define SPINLOCK_OWNER_INIT ((void *)-1L)
2602+
2603+#ifdef CONFIG_DEBUG_SPINLOCK
2604+# define SPIN_LOCK_UNLOCKED \
2605+ (spinlock_t) { .raw_lock = __RAW_SPIN_LOCK_UNLOCKED, \
2606+ .magic = SPINLOCK_MAGIC, \
2607+ .owner = SPINLOCK_OWNER_INIT, \
2608+ .owner_cpu = -1 }
2609+#define RW_LOCK_UNLOCKED \
2610+ (rwlock_t) { .raw_lock = __RAW_RW_LOCK_UNLOCKED, \
2611+ .magic = RWLOCK_MAGIC, \
2612+ .owner = SPINLOCK_OWNER_INIT, \
2613+ .owner_cpu = -1 }
2614+#else
2615+# define SPIN_LOCK_UNLOCKED \
2616+ (spinlock_t) { .raw_lock = __RAW_SPIN_LOCK_UNLOCKED }
2617+#define RW_LOCK_UNLOCKED \
2618+ (rwlock_t) { .raw_lock = __RAW_RW_LOCK_UNLOCKED }
2619+#endif
2620+
2621+#define DEFINE_SPINLOCK(x) spinlock_t x = SPIN_LOCK_UNLOCKED
2622+#define DEFINE_RWLOCK(x) rwlock_t x = RW_LOCK_UNLOCKED
2623+
2624+#endif /* __LINUX_SPINLOCK_TYPES_H */
2625diff -Naur aboot-0.9b.orig/include/linux/spinlock_types_up.h aboot-0.9b/include/linux/spinlock_types_up.h
2626--- aboot-0.9b.orig/include/linux/spinlock_types_up.h 1969-12-31 19:00:00.000000000 -0500
2627+++ aboot-0.9b/include/linux/spinlock_types_up.h 2006-06-25 18:22:04.000000000 -0400
2628@@ -0,0 +1,37 @@
2629+#ifndef __LINUX_SPINLOCK_TYPES_UP_H
2630+#define __LINUX_SPINLOCK_TYPES_UP_H
2631+
2632+#ifndef __LINUX_SPINLOCK_TYPES_H
2633+# error "please don't include this file directly"
2634+#endif
2635+
2636+/*
2637+ * include/linux/spinlock_types_up.h - spinlock type definitions for UP
2638+ *
2639+ * portions Copyright 2005, Red Hat, Inc., Ingo Molnar
2640+ * Released under the General Public License (GPL).
2641+ */
2642+
2643+#ifdef CONFIG_DEBUG_SPINLOCK
2644+
2645+typedef struct {
2646+ volatile unsigned int slock;
2647+} raw_spinlock_t;
2648+
2649+#define __RAW_SPIN_LOCK_UNLOCKED { 1 }
2650+
2651+#else
2652+
2653+typedef struct { } raw_spinlock_t;
2654+
2655+#define __RAW_SPIN_LOCK_UNLOCKED { }
2656+
2657+#endif
2658+
2659+typedef struct {
2660+ /* no debug version on UP */
2661+} raw_rwlock_t;
2662+
2663+#define __RAW_RW_LOCK_UNLOCKED { }
2664+
2665+#endif /* __LINUX_SPINLOCK_TYPES_UP_H */
2666diff -Naur aboot-0.9b.orig/include/linux/spinlock_up.h aboot-0.9b/include/linux/spinlock_up.h
2667--- aboot-0.9b.orig/include/linux/spinlock_up.h 1969-12-31 19:00:00.000000000 -0500
2668+++ aboot-0.9b/include/linux/spinlock_up.h 2006-06-25 18:22:04.000000000 -0400
2669@@ -0,0 +1,74 @@
2670+#ifndef __LINUX_SPINLOCK_UP_H
2671+#define __LINUX_SPINLOCK_UP_H
2672+
2673+#ifndef __LINUX_SPINLOCK_H
2674+# error "please don't include this file directly"
2675+#endif
2676+
2677+/*
2678+ * include/linux/spinlock_up.h - UP-debug version of spinlocks.
2679+ *
2680+ * portions Copyright 2005, Red Hat, Inc., Ingo Molnar
2681+ * Released under the General Public License (GPL).
2682+ *
2683+ * In the debug case, 1 means unlocked, 0 means locked. (the values
2684+ * are inverted, to catch initialization bugs)
2685+ *
2686+ * No atomicity anywhere, we are on UP.
2687+ */
2688+
2689+#ifdef CONFIG_DEBUG_SPINLOCK
2690+
2691+#define __raw_spin_is_locked(x) ((x)->slock == 0)
2692+
2693+static inline void __raw_spin_lock(raw_spinlock_t *lock)
2694+{
2695+ lock->slock = 0;
2696+}
2697+
2698+static inline void
2699+__raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long flags)
2700+{
2701+ local_irq_save(flags);
2702+ lock->slock = 0;
2703+}
2704+
2705+static inline int __raw_spin_trylock(raw_spinlock_t *lock)
2706+{
2707+ char oldval = lock->slock;
2708+
2709+ lock->slock = 0;
2710+
2711+ return oldval > 0;
2712+}
2713+
2714+static inline void __raw_spin_unlock(raw_spinlock_t *lock)
2715+{
2716+ lock->slock = 1;
2717+}
2718+
2719+/*
2720+ * Read-write spinlocks. No debug version.
2721+ */
2722+#define __raw_read_lock(lock) do { (void)(lock); } while (0)
2723+#define __raw_write_lock(lock) do { (void)(lock); } while (0)
2724+#define __raw_read_trylock(lock) ({ (void)(lock); 1; })
2725+#define __raw_write_trylock(lock) ({ (void)(lock); 1; })
2726+#define __raw_read_unlock(lock) do { (void)(lock); } while (0)
2727+#define __raw_write_unlock(lock) do { (void)(lock); } while (0)
2728+
2729+#else /* DEBUG_SPINLOCK */
2730+#define __raw_spin_is_locked(lock) ((void)(lock), 0)
2731+/* for sched.c and kernel_lock.c: */
2732+# define __raw_spin_lock(lock) do { (void)(lock); } while (0)
2733+# define __raw_spin_unlock(lock) do { (void)(lock); } while (0)
2734+# define __raw_spin_trylock(lock) ({ (void)(lock); 1; })
2735+#endif /* DEBUG_SPINLOCK */
2736+
2737+#define __raw_read_can_lock(lock) (((void)(lock), 1))
2738+#define __raw_write_can_lock(lock) (((void)(lock), 1))
2739+
2740+#define __raw_spin_unlock_wait(lock) \
2741+ do { cpu_relax(); } while (__raw_spin_is_locked(lock))
2742+
2743+#endif /* __LINUX_SPINLOCK_UP_H */
2744diff -Naur aboot-0.9b.orig/include/linux/stat.h aboot-0.9b/include/linux/stat.h
2745--- aboot-0.9b.orig/include/linux/stat.h 1969-12-31 19:00:00.000000000 -0500
2746+++ aboot-0.9b/include/linux/stat.h 2006-06-25 18:22:04.000000000 -0400
2747@@ -0,0 +1,77 @@
2748+#ifndef _LINUX_STAT_H
2749+#define _LINUX_STAT_H
2750+
2751+#ifdef __KERNEL__
2752+
2753+#include <asm/stat.h>
2754+
2755+#endif
2756+
2757+#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
2758+
2759+#define S_IFMT 00170000
2760+#define S_IFSOCK 0140000
2761+#define S_IFLNK 0120000
2762+#define S_IFREG 0100000
2763+#define S_IFBLK 0060000
2764+#define S_IFDIR 0040000
2765+#define S_IFCHR 0020000
2766+#define S_IFIFO 0010000
2767+#define S_ISUID 0004000
2768+#define S_ISGID 0002000
2769+#define S_ISVTX 0001000
2770+
2771+#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
2772+#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
2773+#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
2774+#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
2775+#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
2776+#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
2777+#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
2778+
2779+#define S_IRWXU 00700
2780+#define S_IRUSR 00400
2781+#define S_IWUSR 00200
2782+#define S_IXUSR 00100
2783+
2784+#define S_IRWXG 00070
2785+#define S_IRGRP 00040
2786+#define S_IWGRP 00020
2787+#define S_IXGRP 00010
2788+
2789+#define S_IRWXO 00007
2790+#define S_IROTH 00004
2791+#define S_IWOTH 00002
2792+#define S_IXOTH 00001
2793+
2794+#endif
2795+
2796+#ifdef __KERNEL__
2797+#define S_IRWXUGO (S_IRWXU|S_IRWXG|S_IRWXO)
2798+#define S_IALLUGO (S_ISUID|S_ISGID|S_ISVTX|S_IRWXUGO)
2799+#define S_IRUGO (S_IRUSR|S_IRGRP|S_IROTH)
2800+#define S_IWUGO (S_IWUSR|S_IWGRP|S_IWOTH)
2801+#define S_IXUGO (S_IXUSR|S_IXGRP|S_IXOTH)
2802+
2803+#include <linux/types.h>
2804+#include <sys/time.h>
2805+
2806+struct kstat {
2807+ unsigned long ino;
2808+ dev_t dev;
2809+ umode_t mode;
2810+ unsigned int nlink;
2811+ uid_t uid;
2812+ gid_t gid;
2813+ dev_t rdev;
2814+ loff_t size;
2815+ struct timespec atime;
2816+ struct timespec mtime;
2817+ struct timespec ctime;
2818+ unsigned long blksize;
2819+ unsigned long blocks;
2820+};
2821+
2822+#endif
2823+
2824+#endif
2825diff -Naur aboot-0.9b.orig/include/linux/string.h aboot-0.9b/include/linux/string.h
2826--- aboot-0.9b.orig/include/linux/string.h 1969-12-31 19:00:00.000000000 -0500
2827+++ aboot-0.9b/include/linux/string.h 2006-06-25 18:22:04.000000000 -0400
2828@@ -0,0 +1,100 @@
2829+#ifndef _LINUX_STRING_H_
2830+#define _LINUX_STRING_H_
2831+
2832+/* We don't want strings.h stuff being user by user stuff by accident */
2833+
2834+#ifdef __KERNEL__
2835+
2836+typedef unsigned gfp_t;
2837+
2838+#include <linux/compiler.h> /* for inline */
2839+#include <linux/types.h> /* for size_t */
2840+#include <linux/stddef.h> /* for NULL */
2841+
2842+#ifdef __cplusplus
2843+extern "C" {
2844+#endif
2845+
2846+extern char * strpbrk(const char *,const char *);
2847+extern char * strsep(char **,const char *);
2848+extern __kernel_size_t strspn(const char *,const char *);
2849+extern __kernel_size_t strcspn(const char *,const char *);
2850+
2851+/*
2852+ * Include machine specific inline routines
2853+ */
2854+#include <asm/string.h>
2855+
2856+#ifndef __HAVE_ARCH_STRCPY
2857+extern char * strcpy(char *,const char *);
2858+#endif
2859+#ifndef __HAVE_ARCH_STRNCPY
2860+extern char * strncpy(char *,const char *, __kernel_size_t);
2861+#endif
2862+#ifndef __HAVE_ARCH_STRLCPY
2863+size_t strlcpy(char *, const char *, size_t);
2864+#endif
2865+#ifndef __HAVE_ARCH_STRCAT
2866+extern char * strcat(char *, const char *);
2867+#endif
2868+#ifndef __HAVE_ARCH_STRNCAT
2869+extern char * strncat(char *, const char *, __kernel_size_t);
2870+#endif
2871+#ifndef __HAVE_ARCH_STRLCAT
2872+extern size_t strlcat(char *, const char *, __kernel_size_t);
2873+#endif
2874+#ifndef __HAVE_ARCH_STRCMP
2875+extern int strcmp(const char *,const char *);
2876+#endif
2877+#ifndef __HAVE_ARCH_STRNCMP
2878+extern int strncmp(const char *,const char *,__kernel_size_t);
2879+#endif
2880+#ifndef __HAVE_ARCH_STRNICMP
2881+extern int strnicmp(const char *, const char *, __kernel_size_t);
2882+#endif
2883+#ifndef __HAVE_ARCH_STRCHR
2884+extern char * strchr(const char *,int);
2885+#endif
2886+#ifndef __HAVE_ARCH_STRNCHR
2887+extern char * strnchr(const char *, size_t, int);
2888+#endif
2889+#ifndef __HAVE_ARCH_STRRCHR
2890+extern char * strrchr(const char *,int);
2891+#endif
2892+#ifndef __HAVE_ARCH_STRSTR
2893+extern char * strstr(const char *,const char *);
2894+#endif
2895+#ifndef __HAVE_ARCH_STRLEN
2896+extern __kernel_size_t strlen(const char *);
2897+#endif
2898+#ifndef __HAVE_ARCH_STRNLEN
2899+extern __kernel_size_t strnlen(const char *,__kernel_size_t);
2900+#endif
2901+
2902+#ifndef __HAVE_ARCH_MEMSET
2903+extern void * memset(void *,int,__kernel_size_t);
2904+#endif
2905+#ifndef __HAVE_ARCH_MEMCPY
2906+extern void * memcpy(void *,const void *,__kernel_size_t);
2907+#endif
2908+#ifndef __HAVE_ARCH_MEMMOVE
2909+extern void * memmove(void *,const void *,__kernel_size_t);
2910+#endif
2911+#ifndef __HAVE_ARCH_MEMSCAN
2912+extern void * memscan(void *,int,__kernel_size_t);
2913+#endif
2914+#ifndef __HAVE_ARCH_MEMCMP
2915+extern int memcmp(const void *,const void *,__kernel_size_t);
2916+#endif
2917+#ifndef __HAVE_ARCH_MEMCHR
2918+extern void * memchr(const void *,int,__kernel_size_t);
2919+#endif
2920+
2921+extern char *kstrdup(const char *s, gfp_t gfp);
2922+
2923+#ifdef __cplusplus
2924+}
2925+#endif
2926+
2927+#endif
2928+#endif /* _LINUX_STRING_H_ */
2929diff -Naur aboot-0.9b.orig/include/linux/thread_info.h aboot-0.9b/include/linux/thread_info.h
2930--- aboot-0.9b.orig/include/linux/thread_info.h 1969-12-31 19:00:00.000000000 -0500
2931+++ aboot-0.9b/include/linux/thread_info.h 2006-06-25 18:22:04.000000000 -0400
2932@@ -0,0 +1,71 @@
2933+/* thread_info.h: common low-level thread information accessors
2934+ *
2935+ * Copyright (C) 2002 David Howells (dhowells@redhat.com)
2936+ * - Incorporating suggestions made by Linus Torvalds
2937+ */
2938+
2939+#ifndef _LINUX_THREAD_INFO_H
2940+#define _LINUX_THREAD_INFO_H
2941+
2942+/*
2943+ * System call restart block.
2944+ */
2945+struct restart_block {
2946+ long (*fn)(struct restart_block *);
2947+ unsigned long arg0, arg1, arg2, arg3;
2948+};
2949+
2950+extern long do_no_restart_syscall(struct restart_block *parm);
2951+
2952+#include <linux/bitops.h>
2953+#include <asm/thread_info.h>
2954+
2955+#ifdef __KERNEL__
2956+
2957+/*
2958+ * flag set/clear/test wrappers
2959+ * - pass TIF_xxxx constants to these functions
2960+ */
2961+
2962+static inline void set_ti_thread_flag(struct thread_info *ti, int flag)
2963+{
2964+ set_bit(flag,&ti->flags);
2965+}
2966+
2967+static inline void clear_ti_thread_flag(struct thread_info *ti, int flag)
2968+{
2969+ clear_bit(flag,&ti->flags);
2970+}
2971+
2972+static inline int test_and_set_ti_thread_flag(struct thread_info *ti, int flag)
2973+{
2974+ return test_and_set_bit(flag,&ti->flags);
2975+}
2976+
2977+static inline int test_and_clear_ti_thread_flag(struct thread_info *ti, int flag)
2978+{
2979+ return test_and_clear_bit(flag,&ti->flags);
2980+}
2981+
2982+static inline int test_ti_thread_flag(struct thread_info *ti, int flag)
2983+{
2984+ return test_bit(flag,&ti->flags);
2985+}
2986+
2987+#define set_thread_flag(flag) \
2988+ set_ti_thread_flag(current_thread_info(), flag)
2989+#define clear_thread_flag(flag) \
2990+ clear_ti_thread_flag(current_thread_info(), flag)
2991+#define test_and_set_thread_flag(flag) \
2992+ test_and_set_ti_thread_flag(current_thread_info(), flag)
2993+#define test_and_clear_thread_flag(flag) \
2994+ test_and_clear_ti_thread_flag(current_thread_info(), flag)
2995+#define test_thread_flag(flag) \
2996+ test_ti_thread_flag(current_thread_info(), flag)
2997+
2998+#define set_need_resched() set_thread_flag(TIF_NEED_RESCHED)
2999+#define clear_need_resched() clear_thread_flag(TIF_NEED_RESCHED)
3000+
3001+#endif
3002+
3003+#endif /* _LINUX_THREAD_INFO_H */
3004diff -Naur aboot-0.9b.orig/lib/isolib.c aboot-0.9b/lib/isolib.c
3005--- aboot-0.9b.orig/lib/isolib.c 2001-10-08 19:03:53.000000000 -0400
3006+++ aboot-0.9b/lib/isolib.c 2006-06-25 18:22:04.000000000 -0400
3007@@ -6,6 +6,7 @@
3008 * functionality to the Linux bootstrapper. All we can do is
3009 * open and read files... but that's all we need 8-)
3010 */
3011+#define __KERNEL__
3012 #ifndef TESTING
3013 # include <linux/string.h>
3014 #endif
3015@@ -1520,6 +1521,7 @@
3016 #ifdef DEBUG_ROCK
3017 printf("Symlink component flag not implemented (%d)\n",slen);
3018 #endif
3019+ break;
3020 };
3021 slen -= slp->len + 2;
3022 oldslp = slp;
3023diff -Naur aboot-0.9b.orig/sdisklabel/Makefile aboot-0.9b/sdisklabel/Makefile
3024--- aboot-0.9b.orig/sdisklabel/Makefile 2001-10-08 19:03:53.000000000 -0400
3025+++ aboot-0.9b/sdisklabel/Makefile 2006-06-25 18:22:04.000000000 -0400
3026@@ -1,13 +1,16 @@
3027-CC = gcc -O2
3028+HOST_CC = gcc -O2
3029 CFLAGS= -I../include $(CPPFLAGS) -Wall
3030
3031 all: sdisklabel swriteboot
3032
3033+%.o: %.c
3034+ $(HOST_CC) $(CFLAGS) -c $< -o $@
3035+
3036 sdisklabel: sdisklabel.o library.o
3037- $(CC) $(LDFLAGS) sdisklabel.o library.o -o sdisklabel
3038+ $(HOST_CC) $(LDFLAGS) sdisklabel.o library.o -o sdisklabel
3039
3040 swriteboot: swriteboot.o library.o
3041- $(CC) $(LDFLAGS) swriteboot.o library.o -o swriteboot
3042+ $(HOST_CC) $(LDFLAGS) swriteboot.o library.o -o swriteboot
3043
3044 clean:
3045 rm -f sdisklabel swriteboot *.o
3046diff -Naur aboot-0.9b.orig/tools/Makefile aboot-0.9b/tools/Makefile
3047--- aboot-0.9b.orig/tools/Makefile 2001-10-08 19:03:53.000000000 -0400
3048+++ aboot-0.9b/tools/Makefile 2006-06-25 18:22:04.000000000 -0400
3049@@ -1,20 +1,32 @@
3050-CC = gcc
3051+HOST_CC = gcc
3052 CFLAGS = -g -O2 -Wall -I. -I../include $(CPPFLAGS)
3053 LDFLAGS = -g
3054 PGMS = e2writeboot isomarkboot abootconf elfencap objstrip
3055
3056-EXEC_PREFIX = /usr
3057+EXEC_PREFIX = $(root)/usr
3058
3059-all: $(PGMS)
3060+all: $(PGMS)
3061
3062-install: $(PGMS)
3063- install -s -c -o root -g root -m 755 $(PGMS) $(EXEC_PREFIX)/bin
3064+install: $(PGMS)
3065+ install -s -c -m 755 $(PGMS) $(EXEC_PREFIX)/bin
3066
3067 clean:
3068 rm -f *~ *.o *.a core $(PGMS)
3069
3070-isomarkboot: isomarkboot.o ../lib/isolib.o
3071-e2writeboot: e2writeboot.o e2lib.o bio.o
3072+isolib.o: ../lib/isolib.c
3073+ $(HOST_CC) $(CFLAGS) -c $< -o $@
3074
3075-e2writeboot.o: e2lib.h
3076+%.o: %.c
3077+ $(HOST_CC) $(CFLAGS) -c $< -o $@
3078+
3079+e2writeboot.o: e2lib.h
3080 e2lib.o: e2lib.h
3081+
3082+e2writeboot: e2writeboot.o e2lib.o bio.o
3083+ $(HOST_CC) $(LDFLAGS) e2writeboot.o e2lib.o bio.o -o $@
3084+
3085+isomarkboot: isomarkboot.o isolib.o
3086+ $(HOST_CC) $(LDFLAGS) isomarkboot.o isolib.o -o $@
3087+
3088+abootconf elfencap objstrip: $(@:%=%.c)
3089+ $(HOST_CC) $(CFLAGS) $(LDFLAGS) $(@:%=%.c) -o $@
3090diff -Naur aboot-0.9b.orig/tools/Makefile.orig aboot-0.9b/tools/Makefile.orig
3091--- aboot-0.9b.orig/tools/Makefile.orig 1969-12-31 19:00:00.000000000 -0500
3092+++ aboot-0.9b/tools/Makefile.orig 2006-06-25 18:22:04.000000000 -0400
3093@@ -0,0 +1,20 @@
3094+CC = gcc
3095+CFLAGS = -g -O2 -Wall -I. -I../include $(CPPFLAGS)
3096+LDFLAGS = -g
3097+PGMS = e2writeboot isomarkboot abootconf elfencap objstrip
3098+
3099+EXEC_PREFIX = /usr
3100+
3101+all: $(PGMS)
3102+
3103+install: $(PGMS)
3104+ install -s -c -o root -g root -m 755 $(PGMS) $(EXEC_PREFIX)/bin
3105+
3106+clean:
3107+ rm -f *~ *.o *.a core $(PGMS)
3108+
3109+isomarkboot: isomarkboot.o ../lib/isolib.o
3110+e2writeboot: e2writeboot.o e2lib.o bio.o
3111+
3112+e2writeboot.o: e2lib.h
3113+e2lib.o: e2lib.h
3114diff -Naur aboot-0.9b.orig/tools/objstrip.c aboot-0.9b/tools/objstrip.c
3115--- aboot-0.9b.orig/tools/objstrip.c 2002-09-18 15:48:22.000000000 -0400
3116+++ aboot-0.9b/tools/objstrip.c 2006-06-25 18:22:04.000000000 -0400
3117@@ -7,15 +7,17 @@
3118 */
3119 /*
3120 * Converts an ECOFF or ELF object file into a bootable file. The
3121- * object file must be a OMAGIC file (i.e., data and bss follow immediatly
3122+ * object file must be a OMAGIC file (i.e., data and bss follow immediately
3123 * behind the text). See DEC "Assembly Language Programmer's Guide"
3124 * documentation for details. The SRM boot process is documented in
3125 * the Alpha AXP Architecture Reference Manual, Second Edition by
3126 * Richard L. Sites and Richard T. Witek.
3127 */
3128-#include <stdlib.h>
3129 #include <stdio.h>
3130+#include <string.h>
3131+#include <stdlib.h>
3132 #include <unistd.h>
3133+#include <string.h>
3134
3135 #include <sys/fcntl.h>
3136 #include <sys/stat.h>
3137@@ -24,17 +26,8 @@
3138 #include <linux/a.out.h>
3139 #include <linux/coff.h>
3140 #include <linux/param.h>
3141-#include <string.h>
3142-
3143 #ifdef __ELF__
3144-# include <asm/elf.h>
3145 # include <linux/elf.h>
3146-# include <linux/version.h>
3147-# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
3148-# define aboot_elf_check_arch(e) elf_check_arch(e)
3149-# else
3150-# define aboot_elf_check_arch(e) elf_check_arch(e->e_machine)
3151-# endif
3152 #endif
3153
3154 /* bootfile size must be multiple of BLOCK_SIZE: */
3155@@ -62,8 +55,8 @@
3156 struct exec * aout; /* includes file & aout header */
3157 long offset;
3158 #ifdef __ELF__
3159- struct elfhdr *elf;
3160- struct elf_phdr *elf_phdr; /* program header */
3161+ Elf64_Ehdr *elf;
3162+ Elf64_Phdr *elf_phdr; /* program header */
3163 unsigned long long e_entry;
3164 #endif
3165
3166@@ -150,19 +143,14 @@
3167 }
3168
3169 #ifdef __ELF__
3170- elf = (struct elfhdr *) buf;
3171+ elf = (Elf64_Ehdr *) buf;
3172
3173- if (elf->e_ident[0] == 0x7f && strncmp(elf->e_ident + 1, "ELF", 3) == 0) {
3174+ if (elf->e_ident[0] == 0x7f && strncmp((char *)elf->e_ident + 1, "ELF", 3) == 0) {
3175 if (elf->e_type != ET_EXEC) {
3176 fprintf(stderr, "%s: %s is not an ELF executable\n",
3177 prog_name, inname);
3178 exit(1);
3179 }
3180- if (!aboot_elf_check_arch(elf)) {
3181- fprintf(stderr, "%s: is not for this processor (e_machine=%d)\n",
3182- prog_name, elf->e_machine);
3183- exit(1);
3184- }
3185 if (elf->e_phnum != 1) {
3186 fprintf(stderr,
3187 "%s: %d program headers (forgot to link with -N?)\n",
3188@@ -177,7 +165,7 @@
3189 exit(1);
3190 }
3191
3192- elf_phdr = (struct elf_phdr *) buf;
3193+ elf_phdr = (Elf64_Phdr *) buf;
3194 offset = elf_phdr->p_offset;
3195 mem_size = elf_phdr->p_memsz;
3196 fil_size = elf_phdr->p_filesz;
Note: See TracBrowser for help on using the repository browser.