source: patches/aboot-0.9b-kernel26_gcc4_fixes-4.patch@ da50a69

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since da50a69 was 6742797, checked in by Joe Ciccone <jciccone@…>, 18 years ago

Added aboot-0.9b-kernel26_gcc4_fixes-4.patch

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