source: patches/aboot-0.9b-kernel26_gcc4_fixes-2.patch@ eab3ca9

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since eab3ca9 was 69cde8d, checked in by Jim Gifford <clfs@…>, 19 years ago

Added: All patches needed for the book.

  • Property mode set to 100644
File size: 44.2 KB
RevLine 
[69cde8d]1Submitted By: Joe Ciccone <joeciccone@crazyeyesoft.com
2Date: 2005-09-16
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, which is not desired.
9
10diff -Naur aboot-0.9b.orig/cons.c aboot-0.9b/cons.c
11--- aboot-0.9b.orig/cons.c 2006-01-16 14:00:09.000000000 +0000
12+++ aboot-0.9b/cons.c 2006-01-16 14:04:02.000000000 +0000
13@@ -12,7 +12,7 @@
14 #include <utils.h>
15
16 long cons_dev; /* console device */
17-extern long int dispatch(); /* Need the full 64 bit return here...*/
18+long dispatch(long proc, ...); /* Need the full 64 bit return here...*/
19
20 long
21 cons_puts(const char *str, long len)
22diff -Naur aboot-0.9b.orig/disk.c aboot-0.9b/disk.c
23--- aboot-0.9b.orig/disk.c 2006-01-16 14:00:09.000000000 +0000
24+++ aboot-0.9b/disk.c 2006-01-16 14:04:26.000000000 +0000
25@@ -480,9 +480,7 @@
26 } else {
27 *d++ = *p;
28 }
29- break;
30-
31- default:
32+ break;
33 }
34 p++;
35 }
36diff -Naur aboot-0.9b.orig/include/asm/auxvec.h aboot-0.9b/include/asm/auxvec.h
37--- aboot-0.9b.orig/include/asm/auxvec.h 1970-01-01 00:00:00.000000000 +0000
38+++ aboot-0.9b/include/asm/auxvec.h 2006-01-16 14:00:50.000000000 +0000
39@@ -0,0 +1,24 @@
40+#ifndef __ASM_ALPHA_AUXVEC_H
41+#define __ASM_ALPHA_AUXVEC_H
42+
43+/* Reserve these numbers for any future use of a VDSO. */
44+#if 0
45+#define AT_SYSINFO 32
46+#define AT_SYSINFO_EHDR 33
47+#endif
48+
49+/* More complete cache descriptions than AT_[DIU]CACHEBSIZE. If the
50+ value is -1, then the cache doesn't exist. Otherwise:
51+
52+ bit 0-3: Cache set-associativity; 0 means fully associative.
53+ bit 4-7: Log2 of cacheline size.
54+ bit 8-31: Size of the entire cache >> 8.
55+ bit 32-63: Reserved.
56+*/
57+
58+#define AT_L1I_CACHESHAPE 34
59+#define AT_L1D_CACHESHAPE 35
60+#define AT_L2_CACHESHAPE 36
61+#define AT_L3_CACHESHAPE 37
62+
63+#endif /* __ASM_ALPHA_AUXVEC_H */
64diff -Naur aboot-0.9b.orig/include/asm/barrier.h aboot-0.9b/include/asm/barrier.h
65--- aboot-0.9b.orig/include/asm/barrier.h 1970-01-01 00:00:00.000000000 +0000
66+++ aboot-0.9b/include/asm/barrier.h 2006-01-16 14:00:50.000000000 +0000
67@@ -0,0 +1,34 @@
68+#ifndef __BARRIER_H
69+#define __BARRIER_H
70+
71+#define mb() \
72+__asm__ __volatile__("mb": : :"memory")
73+
74+#define rmb() \
75+__asm__ __volatile__("mb": : :"memory")
76+
77+#define wmb() \
78+__asm__ __volatile__("wmb": : :"memory")
79+
80+#define read_barrier_depends() \
81+__asm__ __volatile__("mb": : :"memory")
82+
83+#ifdef CONFIG_SMP
84+#define smp_mb() mb()
85+#define smp_rmb() rmb()
86+#define smp_wmb() wmb()
87+#define smp_read_barrier_depends() read_barrier_depends()
88+#else
89+#define smp_mb() barrier()
90+#define smp_rmb() barrier()
91+#define smp_wmb() barrier()
92+#define smp_read_barrier_depends() barrier()
93+#endif
94+
95+#define set_mb(var, value) \
96+do { var = value; mb(); } while (0)
97+
98+#define set_wmb(var, value) \
99+do { var = value; wmb(); } while (0)
100+
101+#endif /* __BARRIER_H */
102diff -Naur aboot-0.9b.orig/include/asm/page.h aboot-0.9b/include/asm/page.h
103--- aboot-0.9b.orig/include/asm/page.h 1970-01-01 00:00:00.000000000 +0000
104+++ aboot-0.9b/include/asm/page.h 2006-01-16 14:00:50.000000000 +0000
105@@ -0,0 +1,103 @@
106+#ifndef _ALPHA_PAGE_H
107+#define _ALPHA_PAGE_H
108+
109+#include <linux/config.h>
110+#include <asm/pal.h>
111+
112+/* PAGE_SHIFT determines the page size */
113+#define PAGE_SHIFT 13
114+#define PAGE_SIZE (1UL << PAGE_SHIFT)
115+#define PAGE_MASK (~(PAGE_SIZE-1))
116+
117+#ifdef __KERNEL__
118+
119+#ifndef __ASSEMBLY__
120+
121+#define STRICT_MM_TYPECHECKS
122+
123+extern void clear_page(void *page);
124+#define clear_user_page(page, vaddr, pg) clear_page(page)
125+
126+#define alloc_zeroed_user_highpage(vma, vaddr) alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO, vma, vmaddr)
127+#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
128+
129+extern void copy_page(void * _to, void * _from);
130+#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
131+
132+#ifdef STRICT_MM_TYPECHECKS
133+/*
134+ * These are used to make use of C type-checking..
135+ */
136+typedef struct { unsigned long pte; } pte_t;
137+typedef struct { unsigned long pmd; } pmd_t;
138+typedef struct { unsigned long pgd; } pgd_t;
139+typedef struct { unsigned long pgprot; } pgprot_t;
140+
141+#define pte_val(x) ((x).pte)
142+#define pmd_val(x) ((x).pmd)
143+#define pgd_val(x) ((x).pgd)
144+#define pgprot_val(x) ((x).pgprot)
145+
146+#define __pte(x) ((pte_t) { (x) } )
147+#define __pmd(x) ((pmd_t) { (x) } )
148+#define __pgd(x) ((pgd_t) { (x) } )
149+#define __pgprot(x) ((pgprot_t) { (x) } )
150+
151+#else
152+/*
153+ * .. while these make it easier on the compiler
154+ */
155+typedef unsigned long pte_t;
156+typedef unsigned long pmd_t;
157+typedef unsigned long pgd_t;
158+typedef unsigned long pgprot_t;
159+
160+#define pte_val(x) (x)
161+#define pmd_val(x) (x)
162+#define pgd_val(x) (x)
163+#define pgprot_val(x) (x)
164+
165+#define __pte(x) (x)
166+#define __pgd(x) (x)
167+#define __pgprot(x) (x)
168+
169+#endif /* STRICT_MM_TYPECHECKS */
170+
171+#ifdef USE_48_BIT_KSEG
172+#define PAGE_OFFSET 0xffff800000000000UL
173+#else
174+#define PAGE_OFFSET 0xfffffc0000000000UL
175+#endif
176+
177+#else
178+
179+#ifdef USE_48_BIT_KSEG
180+#define PAGE_OFFSET 0xffff800000000000
181+#else
182+#define PAGE_OFFSET 0xfffffc0000000000
183+#endif
184+
185+#endif /* !__ASSEMBLY__ */
186+
187+/* to align the pointer to the (next) page boundary */
188+#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
189+
190+#define __pa(x) ((unsigned long) (x) - PAGE_OFFSET)
191+#define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET))
192+#ifndef CONFIG_DISCONTIGMEM
193+#define pfn_to_page(pfn) (mem_map + (pfn))
194+#define page_to_pfn(page) ((unsigned long)((page) - mem_map))
195+#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
196+
197+#define pfn_valid(pfn) ((pfn) < max_mapnr)
198+#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
199+#endif /* CONFIG_DISCONTIGMEM */
200+
201+#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
202+ VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
203+
204+#endif /* __KERNEL__ */
205+
206+#include <asm-generic/page.h>
207+
208+#endif /* _ALPHA_PAGE_H */
209diff -Naur aboot-0.9b.orig/include/asm/string.h aboot-0.9b/include/asm/string.h
210--- aboot-0.9b.orig/include/asm/string.h 1970-01-01 00:00:00.000000000 +0000
211+++ aboot-0.9b/include/asm/string.h 2006-01-16 14:00:50.000000000 +0000
212@@ -0,0 +1,68 @@
213+#ifndef __ALPHA_STRING_H__
214+#define __ALPHA_STRING_H__
215+
216+#ifdef __KERNEL__
217+
218+/*
219+ * GCC of any recent vintage doesn't do stupid things with bcopy.
220+ * EGCS 1.1 knows all about expanding memcpy inline, others don't.
221+ *
222+ * Similarly for a memset with data = 0.
223+ */
224+
225+#define __HAVE_ARCH_MEMCPY
226+extern void * memcpy(void *, const void *, size_t);
227+#define __HAVE_ARCH_MEMMOVE
228+extern void * memmove(void *, const void *, size_t);
229+
230+/* For backward compatibility with modules. Unused otherwise. */
231+extern void * __memcpy(void *, const void *, size_t);
232+
233+#define memcpy __builtin_memcpy
234+
235+#define __HAVE_ARCH_MEMSET
236+extern void * __constant_c_memset(void *, unsigned long, size_t);
237+extern void * __memset(void *, int, size_t);
238+extern void * memset(void *, int, size_t);
239+
240+#define memset(s, c, n) \
241+(__builtin_constant_p(c) \
242+ ? (__builtin_constant_p(n) && (c) == 0 \
243+ ? __builtin_memset((s),0,(n)) \
244+ : __constant_c_memset((s),0x0101010101010101UL*(unsigned char)(c),(n))) \
245+ : __memset((s),(c),(n)))
246+
247+#define __HAVE_ARCH_STRCPY
248+extern char * strcpy(char *,const char *);
249+#define __HAVE_ARCH_STRNCPY
250+extern char * strncpy(char *, const char *, size_t);
251+#define __HAVE_ARCH_STRCAT
252+extern char * strcat(char *, const char *);
253+#define __HAVE_ARCH_STRNCAT
254+extern char * strncat(char *, const char *, size_t);
255+#define __HAVE_ARCH_STRCHR
256+extern char * strchr(const char *,int);
257+#define __HAVE_ARCH_STRRCHR
258+extern char * strrchr(const char *,int);
259+#define __HAVE_ARCH_STRLEN
260+extern size_t strlen(const char *);
261+#define __HAVE_ARCH_MEMCHR
262+extern void * memchr(const void *, int, size_t);
263+
264+/* The following routine is like memset except that it writes 16-bit
265+ aligned values. The DEST and COUNT parameters must be even for
266+ correct operation. */
267+
268+#define __HAVE_ARCH_MEMSETW
269+extern void * __memsetw(void *dest, unsigned short, size_t count);
270+
271+#define memsetw(s, c, n) \
272+(__builtin_constant_p(c) \
273+ ? __constant_c_memset((s),0x0001000100010001UL*(unsigned short)(c),(n)) \
274+ : __memsetw((s),(c),(n)))
275+
276+extern int strcasecmp(const char *, const char *);
277+
278+#endif /* __KERNEL__ */
279+
280+#endif /* __ALPHA_STRING_H__ */
281diff -Naur aboot-0.9b.orig/include/asm/system.h aboot-0.9b/include/asm/system.h
282--- aboot-0.9b.orig/include/asm/system.h 1970-01-01 00:00:00.000000000 +0000
283+++ aboot-0.9b/include/asm/system.h 2006-01-16 14:00:50.000000000 +0000
284@@ -0,0 +1,594 @@
285+#ifndef __ALPHA_SYSTEM_H
286+#define __ALPHA_SYSTEM_H
287+
288+#include <linux/config.h>
289+#include <asm/pal.h>
290+#include <asm/page.h>
291+#include <asm/barrier.h>
292+
293+/*
294+ * System defines.. Note that this is included both from .c and .S
295+ * files, so it does only defines, not any C code.
296+ */
297+
298+/*
299+ * We leave one page for the initial stack page, and one page for
300+ * the initial process structure. Also, the console eats 3 MB for
301+ * the initial bootloader (one of which we can reclaim later).
302+ */
303+#define BOOT_PCB 0x20000000
304+#define BOOT_ADDR 0x20000000
305+/* Remove when official MILO sources have ELF support: */
306+#define BOOT_SIZE (16*1024)
307+
308+#ifdef CONFIG_ALPHA_LEGACY_START_ADDRESS
309+#define KERNEL_START_PHYS 0x300000 /* Old bootloaders hardcoded this. */
310+#else
311+#define KERNEL_START_PHYS 0x1000000 /* required: Wildfire/Titan/Marvel */
312+#endif
313+
314+#define KERNEL_START (PAGE_OFFSET+KERNEL_START_PHYS)
315+#define SWAPPER_PGD KERNEL_START
316+#define INIT_STACK (PAGE_OFFSET+KERNEL_START_PHYS+0x02000)
317+#define EMPTY_PGT (PAGE_OFFSET+KERNEL_START_PHYS+0x04000)
318+#define EMPTY_PGE (PAGE_OFFSET+KERNEL_START_PHYS+0x08000)
319+#define ZERO_PGE (PAGE_OFFSET+KERNEL_START_PHYS+0x0A000)
320+
321+#define START_ADDR (PAGE_OFFSET+KERNEL_START_PHYS+0x10000)
322+
323+/*
324+ * This is setup by the secondary bootstrap loader. Because
325+ * the zero page is zeroed out as soon as the vm system is
326+ * initialized, we need to copy things out into a more permanent
327+ * place.
328+ */
329+#define PARAM ZERO_PGE
330+#define COMMAND_LINE ((char*)(PARAM + 0x0000))
331+#define INITRD_START (*(unsigned long *) (PARAM+0x100))
332+#define INITRD_SIZE (*(unsigned long *) (PARAM+0x108))
333+
334+#ifndef __ASSEMBLY__
335+#include <linux/kernel.h>
336+
337+/*
338+ * This is the logout header that should be common to all platforms
339+ * (assuming they are running OSF/1 PALcode, I guess).
340+ */
341+struct el_common {
342+ unsigned int size; /* size in bytes of logout area */
343+ unsigned int sbz1 : 30; /* should be zero */
344+ unsigned int err2 : 1; /* second error */
345+ unsigned int retry : 1; /* retry flag */
346+ unsigned int proc_offset; /* processor-specific offset */
347+ unsigned int sys_offset; /* system-specific offset */
348+ unsigned int code; /* machine check code */
349+ unsigned int frame_rev; /* frame revision */
350+};
351+
352+/* Machine Check Frame for uncorrectable errors (Large format)
353+ * --- This is used to log uncorrectable errors such as
354+ * double bit ECC errors.
355+ * --- These errors are detected by both processor and systems.
356+ */
357+struct el_common_EV5_uncorrectable_mcheck {
358+ unsigned long shadow[8]; /* Shadow reg. 8-14, 25 */
359+ unsigned long paltemp[24]; /* PAL TEMP REGS. */
360+ unsigned long exc_addr; /* Address of excepting instruction*/
361+ unsigned long exc_sum; /* Summary of arithmetic traps. */
362+ unsigned long exc_mask; /* Exception mask (from exc_sum). */
363+ unsigned long pal_base; /* Base address for PALcode. */
364+ unsigned long isr; /* Interrupt Status Reg. */
365+ unsigned long icsr; /* CURRENT SETUP OF EV5 IBOX */
366+ unsigned long ic_perr_stat; /* I-CACHE Reg. <11> set Data parity
367+ <12> set TAG parity*/
368+ unsigned long dc_perr_stat; /* D-CACHE error Reg. Bits set to 1:
369+ <2> Data error in bank 0
370+ <3> Data error in bank 1
371+ <4> Tag error in bank 0
372+ <5> Tag error in bank 1 */
373+ unsigned long va; /* Effective VA of fault or miss. */
374+ unsigned long mm_stat; /* Holds the reason for D-stream
375+ fault or D-cache parity errors */
376+ unsigned long sc_addr; /* Address that was being accessed
377+ when EV5 detected Secondary cache
378+ failure. */
379+ unsigned long sc_stat; /* Helps determine if the error was
380+ TAG/Data parity(Secondary Cache)*/
381+ unsigned long bc_tag_addr; /* Contents of EV5 BC_TAG_ADDR */
382+ unsigned long ei_addr; /* Physical address of any transfer
383+ that is logged in EV5 EI_STAT */
384+ unsigned long fill_syndrome; /* For correcting ECC errors. */
385+ unsigned long ei_stat; /* Helps identify reason of any
386+ processor uncorrectable error
387+ at its external interface. */
388+ unsigned long ld_lock; /* Contents of EV5 LD_LOCK register*/
389+};
390+
391+struct el_common_EV6_mcheck {
392+ unsigned int FrameSize; /* Bytes, including this field */
393+ unsigned int FrameFlags; /* <31> = Retry, <30> = Second Error */
394+ unsigned int CpuOffset; /* Offset to CPU-specific info */
395+ unsigned int SystemOffset; /* Offset to system-specific info */
396+ unsigned int MCHK_Code;
397+ unsigned int MCHK_Frame_Rev;
398+ unsigned long I_STAT; /* EV6 Internal Processor Registers */
399+ unsigned long DC_STAT; /* (See the 21264 Spec) */
400+ unsigned long C_ADDR;
401+ unsigned long DC1_SYNDROME;
402+ unsigned long DC0_SYNDROME;
403+ unsigned long C_STAT;
404+ unsigned long C_STS;
405+ unsigned long MM_STAT;
406+ unsigned long EXC_ADDR;
407+ unsigned long IER_CM;
408+ unsigned long ISUM;
409+ unsigned long RESERVED0;
410+ unsigned long PAL_BASE;
411+ unsigned long I_CTL;
412+ unsigned long PCTX;
413+};
414+
415+extern void halt(void) __attribute__((noreturn));
416+#define __halt() __asm__ __volatile__ ("call_pal %0 #halt" : : "i" (PAL_halt))
417+
418+#define switch_to(P,N,L) \
419+ do { \
420+ (L) = alpha_switch_to(virt_to_phys(&(N)->thread_info->pcb), (P)); \
421+ check_mmu_context(); \
422+ } while (0)
423+
424+struct task_struct;
425+extern struct task_struct *alpha_switch_to(unsigned long, struct task_struct*);
426+
427+#define imb() \
428+__asm__ __volatile__ ("call_pal %0 #imb" : : "i" (PAL_imb) : "memory")
429+
430+#define draina() \
431+__asm__ __volatile__ ("call_pal %0 #draina" : : "i" (PAL_draina) : "memory")
432+
433+enum implver_enum {
434+ IMPLVER_EV4,
435+ IMPLVER_EV5,
436+ IMPLVER_EV6
437+};
438+
439+#ifdef CONFIG_ALPHA_GENERIC
440+#define implver() \
441+({ unsigned long __implver; \
442+ __asm__ ("implver %0" : "=r"(__implver)); \
443+ (enum implver_enum) __implver; })
444+#else
445+/* Try to eliminate some dead code. */
446+#ifdef CONFIG_ALPHA_EV4
447+#define implver() IMPLVER_EV4
448+#endif
449+#ifdef CONFIG_ALPHA_EV5
450+#define implver() IMPLVER_EV5
451+#endif
452+#if defined(CONFIG_ALPHA_EV6)
453+#define implver() IMPLVER_EV6
454+#endif
455+#endif
456+
457+enum amask_enum {
458+ AMASK_BWX = (1UL << 0),
459+ AMASK_FIX = (1UL << 1),
460+ AMASK_CIX = (1UL << 2),
461+ AMASK_MAX = (1UL << 8),
462+ AMASK_PRECISE_TRAP = (1UL << 9),
463+};
464+
465+#define amask(mask) \
466+({ unsigned long __amask, __input = (mask); \
467+ __asm__ ("amask %1,%0" : "=r"(__amask) : "rI"(__input)); \
468+ __amask; })
469+
470+#define __CALL_PAL_R0(NAME, TYPE) \
471+static inline TYPE NAME(void) \
472+{ \
473+ register TYPE __r0 __asm__("$0"); \
474+ __asm__ __volatile__( \
475+ "call_pal %1 # " #NAME \
476+ :"=r" (__r0) \
477+ :"i" (PAL_ ## NAME) \
478+ :"$1", "$16", "$22", "$23", "$24", "$25"); \
479+ return __r0; \
480+}
481+
482+#define __CALL_PAL_W1(NAME, TYPE0) \
483+static inline void NAME(TYPE0 arg0) \
484+{ \
485+ register TYPE0 __r16 __asm__("$16") = arg0; \
486+ __asm__ __volatile__( \
487+ "call_pal %1 # "#NAME \
488+ : "=r"(__r16) \
489+ : "i"(PAL_ ## NAME), "0"(__r16) \
490+ : "$1", "$22", "$23", "$24", "$25"); \
491+}
492+
493+#define __CALL_PAL_W2(NAME, TYPE0, TYPE1) \
494+static inline void NAME(TYPE0 arg0, TYPE1 arg1) \
495+{ \
496+ register TYPE0 __r16 __asm__("$16") = arg0; \
497+ register TYPE1 __r17 __asm__("$17") = arg1; \
498+ __asm__ __volatile__( \
499+ "call_pal %2 # "#NAME \
500+ : "=r"(__r16), "=r"(__r17) \
501+ : "i"(PAL_ ## NAME), "0"(__r16), "1"(__r17) \
502+ : "$1", "$22", "$23", "$24", "$25"); \
503+}
504+
505+#define __CALL_PAL_RW1(NAME, RTYPE, TYPE0) \
506+static inline RTYPE NAME(TYPE0 arg0) \
507+{ \
508+ register RTYPE __r0 __asm__("$0"); \
509+ register TYPE0 __r16 __asm__("$16") = arg0; \
510+ __asm__ __volatile__( \
511+ "call_pal %2 # "#NAME \
512+ : "=r"(__r16), "=r"(__r0) \
513+ : "i"(PAL_ ## NAME), "0"(__r16) \
514+ : "$1", "$22", "$23", "$24", "$25"); \
515+ return __r0; \
516+}
517+
518+#define __CALL_PAL_RW2(NAME, RTYPE, TYPE0, TYPE1) \
519+static inline RTYPE NAME(TYPE0 arg0, TYPE1 arg1) \
520+{ \
521+ register RTYPE __r0 __asm__("$0"); \
522+ register TYPE0 __r16 __asm__("$16") = arg0; \
523+ register TYPE1 __r17 __asm__("$17") = arg1; \
524+ __asm__ __volatile__( \
525+ "call_pal %3 # "#NAME \
526+ : "=r"(__r16), "=r"(__r17), "=r"(__r0) \
527+ : "i"(PAL_ ## NAME), "0"(__r16), "1"(__r17) \
528+ : "$1", "$22", "$23", "$24", "$25"); \
529+ return __r0; \
530+}
531+
532+__CALL_PAL_W1(cflush, unsigned long);
533+__CALL_PAL_R0(rdmces, unsigned long);
534+__CALL_PAL_R0(rdps, unsigned long);
535+__CALL_PAL_R0(rdusp, unsigned long);
536+__CALL_PAL_RW1(swpipl, unsigned long, unsigned long);
537+__CALL_PAL_R0(whami, unsigned long);
538+__CALL_PAL_W2(wrent, void*, unsigned long);
539+__CALL_PAL_W1(wripir, unsigned long);
540+__CALL_PAL_W1(wrkgp, unsigned long);
541+__CALL_PAL_W1(wrmces, unsigned long);
542+__CALL_PAL_RW2(wrperfmon, unsigned long, unsigned long, unsigned long);
543+__CALL_PAL_W1(wrusp, unsigned long);
544+__CALL_PAL_W1(wrvptptr, unsigned long);
545+
546+#define IPL_MIN 0
547+#define IPL_SW0 1
548+#define IPL_SW1 2
549+#define IPL_DEV0 3
550+#define IPL_DEV1 4
551+#define IPL_TIMER 5
552+#define IPL_PERF 6
553+#define IPL_POWERFAIL 6
554+#define IPL_MCHECK 7
555+#define IPL_MAX 7
556+
557+#ifdef CONFIG_ALPHA_BROKEN_IRQ_MASK
558+#undef IPL_MIN
559+#define IPL_MIN __min_ipl
560+extern int __min_ipl;
561+#endif
562+
563+#define getipl() (rdps() & 7)
564+#define setipl(ipl) ((void) swpipl(ipl))
565+
566+#define local_irq_disable() do { setipl(IPL_MAX); barrier(); } while(0)
567+#define local_irq_enable() do { barrier(); setipl(IPL_MIN); } while(0)
568+#define local_save_flags(flags) ((flags) = rdps())
569+#define local_irq_save(flags) do { (flags) = swpipl(IPL_MAX); barrier(); } while(0)
570+#define local_irq_restore(flags) do { barrier(); setipl(flags); barrier(); } while(0)
571+
572+#define irqs_disabled() (getipl() == IPL_MAX)
573+
574+/*
575+ * TB routines..
576+ */
577+#define __tbi(nr,arg,arg1...) \
578+({ \
579+ register unsigned long __r16 __asm__("$16") = (nr); \
580+ register unsigned long __r17 __asm__("$17"); arg; \
581+ __asm__ __volatile__( \
582+ "call_pal %3 #__tbi" \
583+ :"=r" (__r16),"=r" (__r17) \
584+ :"0" (__r16),"i" (PAL_tbi) ,##arg1 \
585+ :"$0", "$1", "$22", "$23", "$24", "$25"); \
586+})
587+
588+#define tbi(x,y) __tbi(x,__r17=(y),"1" (__r17))
589+#define tbisi(x) __tbi(1,__r17=(x),"1" (__r17))
590+#define tbisd(x) __tbi(2,__r17=(x),"1" (__r17))
591+#define tbis(x) __tbi(3,__r17=(x),"1" (__r17))
592+#define tbiap() __tbi(-1, /* no second argument */)
593+#define tbia() __tbi(-2, /* no second argument */)
594+
595+/*
596+ * Atomic exchange.
597+ * Since it can be used to implement critical sections
598+ * it must clobber "memory" (also for interrupts in UP).
599+ */
600+
601+static inline unsigned long
602+__xchg_u8(volatile char *m, unsigned long val)
603+{
604+ unsigned long ret, tmp, addr64;
605+
606+ __asm__ __volatile__(
607+ " andnot %4,7,%3\n"
608+ " insbl %1,%4,%1\n"
609+ "1: ldq_l %2,0(%3)\n"
610+ " extbl %2,%4,%0\n"
611+ " mskbl %2,%4,%2\n"
612+ " or %1,%2,%2\n"
613+ " stq_c %2,0(%3)\n"
614+ " beq %2,2f\n"
615+#ifdef CONFIG_SMP
616+ " mb\n"
617+#endif
618+ ".subsection 2\n"
619+ "2: br 1b\n"
620+ ".previous"
621+ : "=&r" (ret), "=&r" (val), "=&r" (tmp), "=&r" (addr64)
622+ : "r" ((long)m), "1" (val) : "memory");
623+
624+ return ret;
625+}
626+
627+static inline unsigned long
628+__xchg_u16(volatile short *m, unsigned long val)
629+{
630+ unsigned long ret, tmp, addr64;
631+
632+ __asm__ __volatile__(
633+ " andnot %4,7,%3\n"
634+ " inswl %1,%4,%1\n"
635+ "1: ldq_l %2,0(%3)\n"
636+ " extwl %2,%4,%0\n"
637+ " mskwl %2,%4,%2\n"
638+ " or %1,%2,%2\n"
639+ " stq_c %2,0(%3)\n"
640+ " beq %2,2f\n"
641+#ifdef CONFIG_SMP
642+ " mb\n"
643+#endif
644+ ".subsection 2\n"
645+ "2: br 1b\n"
646+ ".previous"
647+ : "=&r" (ret), "=&r" (val), "=&r" (tmp), "=&r" (addr64)
648+ : "r" ((long)m), "1" (val) : "memory");
649+
650+ return ret;
651+}
652+
653+static inline unsigned long
654+__xchg_u32(volatile int *m, unsigned long val)
655+{
656+ unsigned long dummy;
657+
658+ __asm__ __volatile__(
659+ "1: ldl_l %0,%4\n"
660+ " bis $31,%3,%1\n"
661+ " stl_c %1,%2\n"
662+ " beq %1,2f\n"
663+#ifdef CONFIG_SMP
664+ " mb\n"
665+#endif
666+ ".subsection 2\n"
667+ "2: br 1b\n"
668+ ".previous"
669+ : "=&r" (val), "=&r" (dummy), "=m" (*m)
670+ : "rI" (val), "m" (*m) : "memory");
671+
672+ return val;
673+}
674+
675+static inline unsigned long
676+__xchg_u64(volatile long *m, unsigned long val)
677+{
678+ unsigned long dummy;
679+
680+ __asm__ __volatile__(
681+ "1: ldq_l %0,%4\n"
682+ " bis $31,%3,%1\n"
683+ " stq_c %1,%2\n"
684+ " beq %1,2f\n"
685+#ifdef CONFIG_SMP
686+ " mb\n"
687+#endif
688+ ".subsection 2\n"
689+ "2: br 1b\n"
690+ ".previous"
691+ : "=&r" (val), "=&r" (dummy), "=m" (*m)
692+ : "rI" (val), "m" (*m) : "memory");
693+
694+ return val;
695+}
696+
697+/* This function doesn't exist, so you'll get a linker error
698+ if something tries to do an invalid xchg(). */
699+extern void __xchg_called_with_bad_pointer(void);
700+
701+#define __xchg(ptr, x, size) \
702+({ \
703+ unsigned long __xchg__res; \
704+ volatile void *__xchg__ptr = (ptr); \
705+ switch (size) { \
706+ case 1: __xchg__res = __xchg_u8(__xchg__ptr, x); break; \
707+ case 2: __xchg__res = __xchg_u16(__xchg__ptr, x); break; \
708+ case 4: __xchg__res = __xchg_u32(__xchg__ptr, x); break; \
709+ case 8: __xchg__res = __xchg_u64(__xchg__ptr, x); break; \
710+ default: __xchg_called_with_bad_pointer(); __xchg__res = x; \
711+ } \
712+ __xchg__res; \
713+})
714+
715+#define xchg(ptr,x) \
716+ ({ \
717+ __typeof__(*(ptr)) _x_ = (x); \
718+ (__typeof__(*(ptr))) __xchg((ptr), (unsigned long)_x_, sizeof(*(ptr))); \
719+ })
720+
721+#define tas(ptr) (xchg((ptr),1))
722+
723+
724+/*
725+ * Atomic compare and exchange. Compare OLD with MEM, if identical,
726+ * store NEW in MEM. Return the initial value in MEM. Success is
727+ * indicated by comparing RETURN with OLD.
728+ *
729+ * The memory barrier should be placed in SMP only when we actually
730+ * make the change. If we don't change anything (so if the returned
731+ * prev is equal to old) then we aren't acquiring anything new and
732+ * we don't need any memory barrier as far I can tell.
733+ */
734+
735+#define __HAVE_ARCH_CMPXCHG 1
736+
737+static inline unsigned long
738+__cmpxchg_u8(volatile char *m, long old, long new)
739+{
740+ unsigned long prev, tmp, cmp, addr64;
741+
742+ __asm__ __volatile__(
743+ " andnot %5,7,%4\n"
744+ " insbl %1,%5,%1\n"
745+ "1: ldq_l %2,0(%4)\n"
746+ " extbl %2,%5,%0\n"
747+ " cmpeq %0,%6,%3\n"
748+ " beq %3,2f\n"
749+ " mskbl %2,%5,%2\n"
750+ " or %1,%2,%2\n"
751+ " stq_c %2,0(%4)\n"
752+ " beq %2,3f\n"
753+#ifdef CONFIG_SMP
754+ " mb\n"
755+#endif
756+ "2:\n"
757+ ".subsection 2\n"
758+ "3: br 1b\n"
759+ ".previous"
760+ : "=&r" (prev), "=&r" (new), "=&r" (tmp), "=&r" (cmp), "=&r" (addr64)
761+ : "r" ((long)m), "Ir" (old), "1" (new) : "memory");
762+
763+ return prev;
764+}
765+
766+static inline unsigned long
767+__cmpxchg_u16(volatile short *m, long old, long new)
768+{
769+ unsigned long prev, tmp, cmp, addr64;
770+
771+ __asm__ __volatile__(
772+ " andnot %5,7,%4\n"
773+ " inswl %1,%5,%1\n"
774+ "1: ldq_l %2,0(%4)\n"
775+ " extwl %2,%5,%0\n"
776+ " cmpeq %0,%6,%3\n"
777+ " beq %3,2f\n"
778+ " mskwl %2,%5,%2\n"
779+ " or %1,%2,%2\n"
780+ " stq_c %2,0(%4)\n"
781+ " beq %2,3f\n"
782+#ifdef CONFIG_SMP
783+ " mb\n"
784+#endif
785+ "2:\n"
786+ ".subsection 2\n"
787+ "3: br 1b\n"
788+ ".previous"
789+ : "=&r" (prev), "=&r" (new), "=&r" (tmp), "=&r" (cmp), "=&r" (addr64)
790+ : "r" ((long)m), "Ir" (old), "1" (new) : "memory");
791+
792+ return prev;
793+}
794+
795+static inline unsigned long
796+__cmpxchg_u32(volatile int *m, int old, int new)
797+{
798+ unsigned long prev, cmp;
799+
800+ __asm__ __volatile__(
801+ "1: ldl_l %0,%5\n"
802+ " cmpeq %0,%3,%1\n"
803+ " beq %1,2f\n"
804+ " mov %4,%1\n"
805+ " stl_c %1,%2\n"
806+ " beq %1,3f\n"
807+#ifdef CONFIG_SMP
808+ " mb\n"
809+#endif
810+ "2:\n"
811+ ".subsection 2\n"
812+ "3: br 1b\n"
813+ ".previous"
814+ : "=&r"(prev), "=&r"(cmp), "=m"(*m)
815+ : "r"((long) old), "r"(new), "m"(*m) : "memory");
816+
817+ return prev;
818+}
819+
820+static inline unsigned long
821+__cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new)
822+{
823+ unsigned long prev, cmp;
824+
825+ __asm__ __volatile__(
826+ "1: ldq_l %0,%5\n"
827+ " cmpeq %0,%3,%1\n"
828+ " beq %1,2f\n"
829+ " mov %4,%1\n"
830+ " stq_c %1,%2\n"
831+ " beq %1,3f\n"
832+#ifdef CONFIG_SMP
833+ " mb\n"
834+#endif
835+ "2:\n"
836+ ".subsection 2\n"
837+ "3: br 1b\n"
838+ ".previous"
839+ : "=&r"(prev), "=&r"(cmp), "=m"(*m)
840+ : "r"((long) old), "r"(new), "m"(*m) : "memory");
841+
842+ return prev;
843+}
844+
845+/* This function doesn't exist, so you'll get a linker error
846+ if something tries to do an invalid cmpxchg(). */
847+extern void __cmpxchg_called_with_bad_pointer(void);
848+
849+static inline unsigned long
850+__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
851+{
852+ switch (size) {
853+ case 1:
854+ return __cmpxchg_u8(ptr, old, new);
855+ case 2:
856+ return __cmpxchg_u16(ptr, old, new);
857+ case 4:
858+ return __cmpxchg_u32(ptr, old, new);
859+ case 8:
860+ return __cmpxchg_u64(ptr, old, new);
861+ }
862+ __cmpxchg_called_with_bad_pointer();
863+ return old;
864+}
865+
866+#define cmpxchg(ptr,o,n) \
867+ ({ \
868+ __typeof__(*(ptr)) _o_ = (o); \
869+ __typeof__(*(ptr)) _n_ = (n); \
870+ (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \
871+ (unsigned long)_n_, sizeof(*(ptr))); \
872+ })
873+
874+#endif /* __ASSEMBLY__ */
875+
876+#define arch_align_stack(x) (x)
877+
878+#endif
879diff -Naur aboot-0.9b.orig/include/asm-generic/page.h aboot-0.9b/include/asm-generic/page.h
880--- aboot-0.9b.orig/include/asm-generic/page.h 1970-01-01 00:00:00.000000000 +0000
881+++ aboot-0.9b/include/asm-generic/page.h 2006-01-16 14:00:50.000000000 +0000
882@@ -0,0 +1,27 @@
883+#ifndef _ASM_GENERIC_PAGE_H
884+#define _ASM_GENERIC_PAGE_H
885+
886+#ifdef __KERNEL__
887+#ifndef __ASSEMBLY__
888+
889+#include <linux/compiler.h>
890+
891+/* Pure 2^n version of get_order */
892+/*
893+static int get_order(unsigned long size)
894+{
895+ int order;
896+
897+ size = (size - 1) >> (PAGE_SHIFT - 1);
898+ order = -1;
899+ do {
900+ size >>= 1;
901+ order++;
902+ } while (size);
903+ return order;
904+}*/
905+
906+#endif /* __ASSEMBLY__ */
907+#endif /* __KERNEL__ */
908+
909+#endif /* _ASM_GENERIC_PAGE_H */
910diff -Naur aboot-0.9b.orig/include/linux/auxvec.h aboot-0.9b/include/linux/auxvec.h
911--- aboot-0.9b.orig/include/linux/auxvec.h 1970-01-01 00:00:00.000000000 +0000
912+++ aboot-0.9b/include/linux/auxvec.h 2006-01-16 14:00:50.000000000 +0000
913@@ -0,0 +1,31 @@
914+#ifndef _LINUX_AUXVEC_H
915+#define _LINUX_AUXVEC_H
916+
917+#include <asm/auxvec.h>
918+
919+/* Symbolic values for the entries in the auxiliary table
920+ put on the initial stack */
921+#define AT_NULL 0 /* end of vector */
922+#define AT_IGNORE 1 /* entry should be ignored */
923+#define AT_EXECFD 2 /* file descriptor of program */
924+#define AT_PHDR 3 /* program headers for program */
925+#define AT_PHENT 4 /* size of program header entry */
926+#define AT_PHNUM 5 /* number of program headers */
927+#define AT_PAGESZ 6 /* system page size */
928+#define AT_BASE 7 /* base address of interpreter */
929+#define AT_FLAGS 8 /* flags */
930+#define AT_ENTRY 9 /* entry point of program */
931+#define AT_NOTELF 10 /* program is not ELF */
932+#define AT_UID 11 /* real uid */
933+#define AT_EUID 12 /* effective uid */
934+#define AT_GID 13 /* real gid */
935+#define AT_EGID 14 /* effective gid */
936+#define AT_PLATFORM 15 /* string identifying CPU for optimizations */
937+#define AT_HWCAP 16 /* arch dependent hints at CPU capabilities */
938+#define AT_CLKTCK 17 /* frequency at which times() increments */
939+
940+#define AT_SECURE 23 /* secure mode boolean */
941+
942+#define AT_VECTOR_SIZE 42 /* Size of auxiliary table. */
943+
944+#endif /* _LINUX_AUXVEC_H */
945diff -Naur aboot-0.9b.orig/include/linux/elf.h aboot-0.9b/include/linux/elf.h
946--- aboot-0.9b.orig/include/linux/elf.h 1970-01-01 00:00:00.000000000 +0000
947+++ aboot-0.9b/include/linux/elf.h 2006-01-16 14:00:50.000000000 +0000
948@@ -0,0 +1,427 @@
949+#ifndef _LINUX_ELF_H
950+#define _LINUX_ELF_H
951+
952+#include <linux/types.h>
953+#include <linux/auxvec.h>
954+#include <asm/elf.h>
955+
956+#ifndef elf_read_implies_exec
957+ /* Executables for which elf_read_implies_exec() returns TRUE will
958+ have the READ_IMPLIES_EXEC personality flag set automatically.
959+ Override in asm/elf.h as needed. */
960+# define elf_read_implies_exec(ex, have_pt_gnu_stack) 0
961+#endif
962+
963+/* 32-bit ELF base types. */
964+typedef __u32 Elf32_Addr;
965+typedef __u16 Elf32_Half;
966+typedef __u32 Elf32_Off;
967+typedef __s32 Elf32_Sword;
968+typedef __u32 Elf32_Word;
969+
970+/* 64-bit ELF base types. */
971+typedef __u64 Elf64_Addr;
972+typedef __u16 Elf64_Half;
973+typedef __s16 Elf64_SHalf;
974+typedef __u64 Elf64_Off;
975+typedef __s32 Elf64_Sword;
976+typedef __u32 Elf64_Word;
977+typedef __u64 Elf64_Xword;
978+typedef __s64 Elf64_Sxword;
979+
980+/* These constants are for the segment types stored in the image headers */
981+#define PT_NULL 0
982+#define PT_LOAD 1
983+#define PT_DYNAMIC 2
984+#define PT_INTERP 3
985+#define PT_NOTE 4
986+#define PT_SHLIB 5
987+#define PT_PHDR 6
988+#define PT_TLS 7 /* Thread local storage segment */
989+#define PT_LOOS 0x60000000 /* OS-specific */
990+#define PT_HIOS 0x6fffffff /* OS-specific */
991+#define PT_LOPROC 0x70000000
992+#define PT_HIPROC 0x7fffffff
993+#define PT_GNU_EH_FRAME 0x6474e550
994+
995+#define PT_GNU_STACK (PT_LOOS + 0x474e551)
996+
997+/* These constants define the different elf file types */
998+#define ET_NONE 0
999+#define ET_REL 1
1000+#define ET_EXEC 2
1001+#define ET_DYN 3
1002+#define ET_CORE 4
1003+#define ET_LOPROC 0xff00
1004+#define ET_HIPROC 0xffff
1005+
1006+/* These constants define the various ELF target machines */
1007+#define EM_NONE 0
1008+#define EM_M32 1
1009+#define EM_SPARC 2
1010+#define EM_386 3
1011+#define EM_68K 4
1012+#define EM_88K 5
1013+#define EM_486 6 /* Perhaps disused */
1014+#define EM_860 7
1015+
1016+#define EM_MIPS 8 /* MIPS R3000 (officially, big-endian only) */
1017+
1018+#define EM_MIPS_RS4_BE 10 /* MIPS R4000 big-endian */
1019+
1020+#define EM_PARISC 15 /* HPPA */
1021+
1022+#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */
1023+
1024+#define EM_PPC 20 /* PowerPC */
1025+#define EM_PPC64 21 /* PowerPC64 */
1026+
1027+#define EM_SH 42 /* SuperH */
1028+
1029+#define EM_SPARCV9 43 /* SPARC v9 64-bit */
1030+
1031+#define EM_IA_64 50 /* HP/Intel IA-64 */
1032+
1033+#define EM_X86_64 62 /* AMD x86-64 */
1034+
1035+#define EM_S390 22 /* IBM S/390 */
1036+
1037+#define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */
1038+
1039+#define EM_V850 87 /* NEC v850 */
1040+
1041+#define EM_M32R 88 /* Renesas M32R */
1042+
1043+#define EM_H8_300 46 /* Renesas H8/300,300H,H8S */
1044+
1045+/*
1046+ * This is an interim value that we will use until the committee comes
1047+ * up with a final number.
1048+ */
1049+#define EM_ALPHA 0x9026
1050+
1051+/* Bogus old v850 magic number, used by old tools. */
1052+#define EM_CYGNUS_V850 0x9080
1053+
1054+/* Bogus old m32r magic number, used by old tools. */
1055+#define EM_CYGNUS_M32R 0x9041
1056+
1057+/*
1058+ * This is the old interim value for S/390 architecture
1059+ */
1060+#define EM_S390_OLD 0xA390
1061+
1062+#define EM_FRV 0x5441 /* Fujitsu FR-V */
1063+
1064+/* This is the info that is needed to parse the dynamic section of the file */
1065+#define DT_NULL 0
1066+#define DT_NEEDED 1
1067+#define DT_PLTRELSZ 2
1068+#define DT_PLTGOT 3
1069+#define DT_HASH 4
1070+#define DT_STRTAB 5
1071+#define DT_SYMTAB 6
1072+#define DT_RELA 7
1073+#define DT_RELASZ 8
1074+#define DT_RELAENT 9
1075+#define DT_STRSZ 10
1076+#define DT_SYMENT 11
1077+#define DT_INIT 12
1078+#define DT_FINI 13
1079+#define DT_SONAME 14
1080+#define DT_RPATH 15
1081+#define DT_SYMBOLIC 16
1082+#define DT_REL 17
1083+#define DT_RELSZ 18
1084+#define DT_RELENT 19
1085+#define DT_PLTREL 20
1086+#define DT_DEBUG 21
1087+#define DT_TEXTREL 22
1088+#define DT_JMPREL 23
1089+#define DT_LOPROC 0x70000000
1090+#define DT_HIPROC 0x7fffffff
1091+
1092+/* This info is needed when parsing the symbol table */
1093+#define STB_LOCAL 0
1094+#define STB_GLOBAL 1
1095+#define STB_WEAK 2
1096+
1097+#define STT_NOTYPE 0
1098+#define STT_OBJECT 1
1099+#define STT_FUNC 2
1100+#define STT_SECTION 3
1101+#define STT_FILE 4
1102+
1103+#define ELF_ST_BIND(x) ((x) >> 4)
1104+#define ELF_ST_TYPE(x) (((unsigned int) x) & 0xf)
1105+#define ELF32_ST_BIND(x) ELF_ST_BIND(x)
1106+#define ELF32_ST_TYPE(x) ELF_ST_TYPE(x)
1107+#define ELF64_ST_BIND(x) ELF_ST_BIND(x)
1108+#define ELF64_ST_TYPE(x) ELF_ST_TYPE(x)
1109+
1110+typedef struct dynamic{
1111+ Elf32_Sword d_tag;
1112+ union{
1113+ Elf32_Sword d_val;
1114+ Elf32_Addr d_ptr;
1115+ } d_un;
1116+} Elf32_Dyn;
1117+
1118+typedef struct {
1119+ Elf64_Sxword d_tag; /* entry tag value */
1120+ union {
1121+ Elf64_Xword d_val;
1122+ Elf64_Addr d_ptr;
1123+ } d_un;
1124+} Elf64_Dyn;
1125+
1126+/* The following are used with relocations */
1127+#define ELF32_R_SYM(x) ((x) >> 8)
1128+#define ELF32_R_TYPE(x) ((x) & 0xff)
1129+
1130+#define ELF64_R_SYM(i) ((i) >> 32)
1131+#define ELF64_R_TYPE(i) ((i) & 0xffffffff)
1132+
1133+typedef struct elf32_rel {
1134+ Elf32_Addr r_offset;
1135+ Elf32_Word r_info;
1136+} Elf32_Rel;
1137+
1138+typedef struct elf64_rel {
1139+ Elf64_Addr r_offset; /* Location at which to apply the action */
1140+ Elf64_Xword r_info; /* index and type of relocation */
1141+} Elf64_Rel;
1142+
1143+typedef struct elf32_rela{
1144+ Elf32_Addr r_offset;
1145+ Elf32_Word r_info;
1146+ Elf32_Sword r_addend;
1147+} Elf32_Rela;
1148+
1149+typedef struct elf64_rela {
1150+ Elf64_Addr r_offset; /* Location at which to apply the action */
1151+ Elf64_Xword r_info; /* index and type of relocation */
1152+ Elf64_Sxword r_addend; /* Constant addend used to compute value */
1153+} Elf64_Rela;
1154+
1155+typedef struct elf32_sym{
1156+ Elf32_Word st_name;
1157+ Elf32_Addr st_value;
1158+ Elf32_Word st_size;
1159+ unsigned char st_info;
1160+ unsigned char st_other;
1161+ Elf32_Half st_shndx;
1162+} Elf32_Sym;
1163+
1164+typedef struct elf64_sym {
1165+ Elf64_Word st_name; /* Symbol name, index in string tbl */
1166+ unsigned char st_info; /* Type and binding attributes */
1167+ unsigned char st_other; /* No defined meaning, 0 */
1168+ Elf64_Half st_shndx; /* Associated section index */
1169+ Elf64_Addr st_value; /* Value of the symbol */
1170+ Elf64_Xword st_size; /* Associated symbol size */
1171+} Elf64_Sym;
1172+
1173+
1174+#define EI_NIDENT 16
1175+
1176+typedef struct elf32_hdr{
1177+ unsigned char e_ident[EI_NIDENT];
1178+ Elf32_Half e_type;
1179+ Elf32_Half e_machine;
1180+ Elf32_Word e_version;
1181+ Elf32_Addr e_entry; /* Entry point */
1182+ Elf32_Off e_phoff;
1183+ Elf32_Off e_shoff;
1184+ Elf32_Word e_flags;
1185+ Elf32_Half e_ehsize;
1186+ Elf32_Half e_phentsize;
1187+ Elf32_Half e_phnum;
1188+ Elf32_Half e_shentsize;
1189+ Elf32_Half e_shnum;
1190+ Elf32_Half e_shstrndx;
1191+} Elf32_Ehdr;
1192+
1193+typedef struct elf64_hdr {
1194+ unsigned char e_ident[16]; /* ELF "magic number" */
1195+ Elf64_Half e_type;
1196+ Elf64_Half e_machine;
1197+ Elf64_Word e_version;
1198+ Elf64_Addr e_entry; /* Entry point virtual address */
1199+ Elf64_Off e_phoff; /* Program header table file offset */
1200+ Elf64_Off e_shoff; /* Section header table file offset */
1201+ Elf64_Word e_flags;
1202+ Elf64_Half e_ehsize;
1203+ Elf64_Half e_phentsize;
1204+ Elf64_Half e_phnum;
1205+ Elf64_Half e_shentsize;
1206+ Elf64_Half e_shnum;
1207+ Elf64_Half e_shstrndx;
1208+} Elf64_Ehdr;
1209+
1210+/* These constants define the permissions on sections in the program
1211+ header, p_flags. */
1212+#define PF_R 0x4
1213+#define PF_W 0x2
1214+#define PF_X 0x1
1215+
1216+typedef struct elf32_phdr{
1217+ Elf32_Word p_type;
1218+ Elf32_Off p_offset;
1219+ Elf32_Addr p_vaddr;
1220+ Elf32_Addr p_paddr;
1221+ Elf32_Word p_filesz;
1222+ Elf32_Word p_memsz;
1223+ Elf32_Word p_flags;
1224+ Elf32_Word p_align;
1225+} Elf32_Phdr;
1226+
1227+typedef struct elf64_phdr {
1228+ Elf64_Word p_type;
1229+ Elf64_Word p_flags;
1230+ Elf64_Off p_offset; /* Segment file offset */
1231+ Elf64_Addr p_vaddr; /* Segment virtual address */
1232+ Elf64_Addr p_paddr; /* Segment physical address */
1233+ Elf64_Xword p_filesz; /* Segment size in file */
1234+ Elf64_Xword p_memsz; /* Segment size in memory */
1235+ Elf64_Xword p_align; /* Segment alignment, file & memory */
1236+} Elf64_Phdr;
1237+
1238+/* sh_type */
1239+#define SHT_NULL 0
1240+#define SHT_PROGBITS 1
1241+#define SHT_SYMTAB 2
1242+#define SHT_STRTAB 3
1243+#define SHT_RELA 4
1244+#define SHT_HASH 5
1245+#define SHT_DYNAMIC 6
1246+#define SHT_NOTE 7
1247+#define SHT_NOBITS 8
1248+#define SHT_REL 9
1249+#define SHT_SHLIB 10
1250+#define SHT_DYNSYM 11
1251+#define SHT_NUM 12
1252+#define SHT_LOPROC 0x70000000
1253+#define SHT_HIPROC 0x7fffffff
1254+#define SHT_LOUSER 0x80000000
1255+#define SHT_HIUSER 0xffffffff
1256+
1257+/* sh_flags */
1258+#define SHF_WRITE 0x1
1259+#define SHF_ALLOC 0x2
1260+#define SHF_EXECINSTR 0x4
1261+#define SHF_MASKPROC 0xf0000000
1262+
1263+/* special section indexes */
1264+#define SHN_UNDEF 0
1265+#define SHN_LORESERVE 0xff00
1266+#define SHN_LOPROC 0xff00
1267+#define SHN_HIPROC 0xff1f
1268+#define SHN_ABS 0xfff1
1269+#define SHN_COMMON 0xfff2
1270+#define SHN_HIRESERVE 0xffff
1271+
1272+typedef struct {
1273+ Elf32_Word sh_name;
1274+ Elf32_Word sh_type;
1275+ Elf32_Word sh_flags;
1276+ Elf32_Addr sh_addr;
1277+ Elf32_Off sh_offset;
1278+ Elf32_Word sh_size;
1279+ Elf32_Word sh_link;
1280+ Elf32_Word sh_info;
1281+ Elf32_Word sh_addralign;
1282+ Elf32_Word sh_entsize;
1283+} Elf32_Shdr;
1284+
1285+typedef struct elf64_shdr {
1286+ Elf64_Word sh_name; /* Section name, index in string tbl */
1287+ Elf64_Word sh_type; /* Type of section */
1288+ Elf64_Xword sh_flags; /* Miscellaneous section attributes */
1289+ Elf64_Addr sh_addr; /* Section virtual addr at execution */
1290+ Elf64_Off sh_offset; /* Section file offset */
1291+ Elf64_Xword sh_size; /* Size of section in bytes */
1292+ Elf64_Word sh_link; /* Index of another section */
1293+ Elf64_Word sh_info; /* Additional section information */
1294+ Elf64_Xword sh_addralign; /* Section alignment */
1295+ Elf64_Xword sh_entsize; /* Entry size if section holds table */
1296+} Elf64_Shdr;
1297+
1298+#define EI_MAG0 0 /* e_ident[] indexes */
1299+#define EI_MAG1 1
1300+#define EI_MAG2 2
1301+#define EI_MAG3 3
1302+#define EI_CLASS 4
1303+#define EI_DATA 5
1304+#define EI_VERSION 6
1305+#define EI_OSABI 7
1306+#define EI_PAD 8
1307+
1308+#define ELFMAG0 0x7f /* EI_MAG */
1309+#define ELFMAG1 'E'
1310+#define ELFMAG2 'L'
1311+#define ELFMAG3 'F'
1312+#define ELFMAG "\177ELF"
1313+#define SELFMAG 4
1314+
1315+#define ELFCLASSNONE 0 /* EI_CLASS */
1316+#define ELFCLASS32 1
1317+#define ELFCLASS64 2
1318+#define ELFCLASSNUM 3
1319+
1320+#define ELFDATANONE 0 /* e_ident[EI_DATA] */
1321+#define ELFDATA2LSB 1
1322+#define ELFDATA2MSB 2
1323+
1324+#define EV_NONE 0 /* e_version, EI_VERSION */
1325+#define EV_CURRENT 1
1326+#define EV_NUM 2
1327+
1328+#define ELFOSABI_NONE 0
1329+#define ELFOSABI_LINUX 3
1330+
1331+#ifndef ELF_OSABI
1332+#define ELF_OSABI ELFOSABI_NONE
1333+#endif
1334+
1335+/* Notes used in ET_CORE */
1336+#define NT_PRSTATUS 1
1337+#define NT_PRFPREG 2
1338+#define NT_PRPSINFO 3
1339+#define NT_TASKSTRUCT 4
1340+#define NT_AUXV 6
1341+#define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */
1342+
1343+
1344+/* Note header in a PT_NOTE section */
1345+typedef struct elf32_note {
1346+ Elf32_Word n_namesz; /* Name size */
1347+ Elf32_Word n_descsz; /* Content size */
1348+ Elf32_Word n_type; /* Content type */
1349+} Elf32_Nhdr;
1350+
1351+/* Note header in a PT_NOTE section */
1352+typedef struct elf64_note {
1353+ Elf64_Word n_namesz; /* Name size */
1354+ Elf64_Word n_descsz; /* Content size */
1355+ Elf64_Word n_type; /* Content type */
1356+} Elf64_Nhdr;
1357+
1358+#if ELF_CLASS == ELFCLASS32
1359+
1360+extern Elf32_Dyn _DYNAMIC [];
1361+#define elfhdr elf32_hdr
1362+#define elf_phdr elf32_phdr
1363+#define elf_note elf32_note
1364+
1365+#else
1366+
1367+extern Elf64_Dyn _DYNAMIC [];
1368+#define elfhdr elf64_hdr
1369+#define elf_phdr elf64_phdr
1370+#define elf_note elf64_note
1371+
1372+#endif
1373+
1374+
1375+#endif /* _LINUX_ELF_H */
1376diff -Naur aboot-0.9b.orig/include/linux/stat.h aboot-0.9b/include/linux/stat.h
1377--- aboot-0.9b.orig/include/linux/stat.h 1970-01-01 00:00:00.000000000 +0000
1378+++ aboot-0.9b/include/linux/stat.h 2006-01-16 14:00:50.000000000 +0000
1379@@ -0,0 +1,77 @@
1380+#ifndef _LINUX_STAT_H
1381+#define _LINUX_STAT_H
1382+
1383+#ifdef __KERNEL__
1384+
1385+#include <asm/stat.h>
1386+
1387+#endif
1388+
1389+#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
1390+
1391+#define S_IFMT 00170000
1392+#define S_IFSOCK 0140000
1393+#define S_IFLNK 0120000
1394+#define S_IFREG 0100000
1395+#define S_IFBLK 0060000
1396+#define S_IFDIR 0040000
1397+#define S_IFCHR 0020000
1398+#define S_IFIFO 0010000
1399+#define S_ISUID 0004000
1400+#define S_ISGID 0002000
1401+#define S_ISVTX 0001000
1402+
1403+#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
1404+#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
1405+#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
1406+#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
1407+#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
1408+#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
1409+#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
1410+
1411+#define S_IRWXU 00700
1412+#define S_IRUSR 00400
1413+#define S_IWUSR 00200
1414+#define S_IXUSR 00100
1415+
1416+#define S_IRWXG 00070
1417+#define S_IRGRP 00040
1418+#define S_IWGRP 00020
1419+#define S_IXGRP 00010
1420+
1421+#define S_IRWXO 00007
1422+#define S_IROTH 00004
1423+#define S_IWOTH 00002
1424+#define S_IXOTH 00001
1425+
1426+#endif
1427+
1428+#ifdef __KERNEL__
1429+#define S_IRWXUGO (S_IRWXU|S_IRWXG|S_IRWXO)
1430+#define S_IALLUGO (S_ISUID|S_ISGID|S_ISVTX|S_IRWXUGO)
1431+#define S_IRUGO (S_IRUSR|S_IRGRP|S_IROTH)
1432+#define S_IWUGO (S_IWUSR|S_IWGRP|S_IWOTH)
1433+#define S_IXUGO (S_IXUSR|S_IXGRP|S_IXOTH)
1434+
1435+#include <linux/types.h>
1436+#include <sys/time.h>
1437+
1438+struct kstat {
1439+ unsigned long ino;
1440+ dev_t dev;
1441+ umode_t mode;
1442+ unsigned int nlink;
1443+ uid_t uid;
1444+ gid_t gid;
1445+ dev_t rdev;
1446+ loff_t size;
1447+ struct timespec atime;
1448+ struct timespec mtime;
1449+ struct timespec ctime;
1450+ unsigned long blksize;
1451+ unsigned long blocks;
1452+};
1453+
1454+#endif
1455+
1456+#endif
1457diff -Naur aboot-0.9b.orig/include/linux/string.h aboot-0.9b/include/linux/string.h
1458--- aboot-0.9b.orig/include/linux/string.h 1970-01-01 00:00:00.000000000 +0000
1459+++ aboot-0.9b/include/linux/string.h 2006-01-16 14:00:50.000000000 +0000
1460@@ -0,0 +1,100 @@
1461+#ifndef _LINUX_STRING_H_
1462+#define _LINUX_STRING_H_
1463+
1464+/* We don't want strings.h stuff being user by user stuff by accident */
1465+
1466+#ifdef __KERNEL__
1467+
1468+typedef unsigned gfp_t;
1469+
1470+#include <linux/compiler.h> /* for inline */
1471+#include <linux/types.h> /* for size_t */
1472+#include <linux/stddef.h> /* for NULL */
1473+
1474+#ifdef __cplusplus
1475+extern "C" {
1476+#endif
1477+
1478+extern char * strpbrk(const char *,const char *);
1479+extern char * strsep(char **,const char *);
1480+extern __kernel_size_t strspn(const char *,const char *);
1481+extern __kernel_size_t strcspn(const char *,const char *);
1482+
1483+/*
1484+ * Include machine specific inline routines
1485+ */
1486+#include <asm/string.h>
1487+
1488+#ifndef __HAVE_ARCH_STRCPY
1489+extern char * strcpy(char *,const char *);
1490+#endif
1491+#ifndef __HAVE_ARCH_STRNCPY
1492+extern char * strncpy(char *,const char *, __kernel_size_t);
1493+#endif
1494+#ifndef __HAVE_ARCH_STRLCPY
1495+size_t strlcpy(char *, const char *, size_t);
1496+#endif
1497+#ifndef __HAVE_ARCH_STRCAT
1498+extern char * strcat(char *, const char *);
1499+#endif
1500+#ifndef __HAVE_ARCH_STRNCAT
1501+extern char * strncat(char *, const char *, __kernel_size_t);
1502+#endif
1503+#ifndef __HAVE_ARCH_STRLCAT
1504+extern size_t strlcat(char *, const char *, __kernel_size_t);
1505+#endif
1506+#ifndef __HAVE_ARCH_STRCMP
1507+extern int strcmp(const char *,const char *);
1508+#endif
1509+#ifndef __HAVE_ARCH_STRNCMP
1510+extern int strncmp(const char *,const char *,__kernel_size_t);
1511+#endif
1512+#ifndef __HAVE_ARCH_STRNICMP
1513+extern int strnicmp(const char *, const char *, __kernel_size_t);
1514+#endif
1515+#ifndef __HAVE_ARCH_STRCHR
1516+extern char * strchr(const char *,int);
1517+#endif
1518+#ifndef __HAVE_ARCH_STRNCHR
1519+extern char * strnchr(const char *, size_t, int);
1520+#endif
1521+#ifndef __HAVE_ARCH_STRRCHR
1522+extern char * strrchr(const char *,int);
1523+#endif
1524+#ifndef __HAVE_ARCH_STRSTR
1525+extern char * strstr(const char *,const char *);
1526+#endif
1527+#ifndef __HAVE_ARCH_STRLEN
1528+extern __kernel_size_t strlen(const char *);
1529+#endif
1530+#ifndef __HAVE_ARCH_STRNLEN
1531+extern __kernel_size_t strnlen(const char *,__kernel_size_t);
1532+#endif
1533+
1534+#ifndef __HAVE_ARCH_MEMSET
1535+extern void * memset(void *,int,__kernel_size_t);
1536+#endif
1537+#ifndef __HAVE_ARCH_MEMCPY
1538+extern void * memcpy(void *,const void *,__kernel_size_t);
1539+#endif
1540+#ifndef __HAVE_ARCH_MEMMOVE
1541+extern void * memmove(void *,const void *,__kernel_size_t);
1542+#endif
1543+#ifndef __HAVE_ARCH_MEMSCAN
1544+extern void * memscan(void *,int,__kernel_size_t);
1545+#endif
1546+#ifndef __HAVE_ARCH_MEMCMP
1547+extern int memcmp(const void *,const void *,__kernel_size_t);
1548+#endif
1549+#ifndef __HAVE_ARCH_MEMCHR
1550+extern void * memchr(const void *,int,__kernel_size_t);
1551+#endif
1552+
1553+extern char *kstrdup(const char *s, gfp_t gfp);
1554+
1555+#ifdef __cplusplus
1556+}
1557+#endif
1558+
1559+#endif
1560+#endif /* _LINUX_STRING_H_ */
1561diff -Naur aboot-0.9b.orig/lib/isolib.c aboot-0.9b/lib/isolib.c
1562--- aboot-0.9b.orig/lib/isolib.c 2006-01-16 14:00:10.000000000 +0000
1563+++ aboot-0.9b/lib/isolib.c 2006-01-16 14:05:20.000000000 +0000
1564@@ -6,6 +6,7 @@
1565 * functionality to the Linux bootstrapper. All we can do is
1566 * open and read files... but that's all we need 8-)
1567 */
1568+#define __KERNEL__
1569 #ifndef TESTING
1570 # include <linux/string.h>
1571 #endif
1572@@ -1520,6 +1521,7 @@
1573 #ifdef DEBUG_ROCK
1574 printf("Symlink component flag not implemented (%d)\n",slen);
1575 #endif
1576+ break;
1577 };
1578 slen -= slp->len + 2;
1579 oldslp = slp;
Note: See TracBrowser for help on using the repository browser.