1#include "linux/threads.h"
2#include "linux/stddef.h"  // for NULL
3#include "linux/elf.h"  // for AT_NULL
4
5/* The following function nicked from arch/ppc/kernel/process.c and
6 * adapted slightly */
7void shove_aux_table(unsigned long sp)
8{
9	int argc;
10	char *p;
11	unsigned long e;
12	unsigned long aux_start, offset;
13
14	argc = *(int *)sp;
15	sp += sizeof(int) + (argc + 1) * sizeof(char *);
16	/* skip over the environment pointers */
17	do {
18		p = *(char **)sp;
19		sp += sizeof(char *);
20	} while (p != NULL);
21	aux_start = sp;
22	/* skip to the end of the auxiliary table */
23	do {
24		e = *(unsigned long *)sp;
25		sp += 2 * sizeof(unsigned long);
26	} while (e != AT_NULL);
27	offset = ((aux_start + 15) & ~15) - aux_start;
28	if (offset != 0) {
29		do {
30			sp -= sizeof(unsigned long);
31			e = *(unsigned long *)sp;
32			*(unsigned long *)(sp + offset) = e;
33		} while (sp > aux_start);
34	}
35}
36/* END stuff taken from arch/ppc/kernel/process.c */
37
38
39/*
40 * Overrides for Emacs so that we follow Linus's tabbing style.
41 * Emacs will notice this stuff at the end of the file and automatically
42 * adjust the settings for this buffer only.  This must remain at the end
43 * of the file.
44 * ---------------------------------------------------------------------------
45 * Local variables:
46 * c-file-style: "linux"
47 * End:
48 */
49