Commit fe30af97 authored by Al Viro's avatar Al Viro Committed by Linus Torvalds

remove the rudiment of a.out for sparc

it's been used only in sunos compat
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent e0b685d3
...@@ -99,88 +99,53 @@ static int aout_core_dump(long signr, struct pt_regs *regs, struct file *file, u ...@@ -99,88 +99,53 @@ static int aout_core_dump(long signr, struct pt_regs *regs, struct file *file, u
# define START_DATA(u) (u.start_data) # define START_DATA(u) (u.start_data)
#elif defined(__arm__) #elif defined(__arm__)
# define START_DATA(u) ((u.u_tsize << PAGE_SHIFT) + u.start_code) # define START_DATA(u) ((u.u_tsize << PAGE_SHIFT) + u.start_code)
#elif defined(__sparc__)
# define START_DATA(u) (u.u_tsize)
#elif defined(__i386__) || defined(__mc68000__) || defined(__arch_um__) #elif defined(__i386__) || defined(__mc68000__) || defined(__arch_um__)
# define START_DATA(u) (u.u_tsize << PAGE_SHIFT) # define START_DATA(u) (u.u_tsize << PAGE_SHIFT)
#endif #endif
#ifdef __sparc__
# define START_STACK(u) ((regs->u_regs[UREG_FP]) & ~(PAGE_SIZE - 1))
#else
# define START_STACK(u) (u.start_stack) # define START_STACK(u) (u.start_stack)
#endif
fs = get_fs(); fs = get_fs();
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
has_dumped = 1; has_dumped = 1;
current->flags |= PF_DUMPCORE; current->flags |= PF_DUMPCORE;
strncpy(dump.u_comm, current->comm, sizeof(dump.u_comm)); strncpy(dump.u_comm, current->comm, sizeof(dump.u_comm));
#ifndef __sparc__
dump.u_ar0 = offsetof(struct user, regs); dump.u_ar0 = offsetof(struct user, regs);
#endif
dump.signal = signr; dump.signal = signr;
aout_dump_thread(regs, &dump); aout_dump_thread(regs, &dump);
/* If the size of the dump file exceeds the rlimit, then see what would happen /* If the size of the dump file exceeds the rlimit, then see what would happen
if we wrote the stack, but not the data area. */ if we wrote the stack, but not the data area. */
#ifdef __sparc__
if ((dump.u_dsize + dump.u_ssize) > limit)
dump.u_dsize = 0;
#else
if ((dump.u_dsize + dump.u_ssize+1) * PAGE_SIZE > limit) if ((dump.u_dsize + dump.u_ssize+1) * PAGE_SIZE > limit)
dump.u_dsize = 0; dump.u_dsize = 0;
#endif
/* Make sure we have enough room to write the stack and data areas. */ /* Make sure we have enough room to write the stack and data areas. */
#ifdef __sparc__
if (dump.u_ssize > limit)
dump.u_ssize = 0;
#else
if ((dump.u_ssize + 1) * PAGE_SIZE > limit) if ((dump.u_ssize + 1) * PAGE_SIZE > limit)
dump.u_ssize = 0; dump.u_ssize = 0;
#endif
/* make sure we actually have a data and stack area to dump */ /* make sure we actually have a data and stack area to dump */
set_fs(USER_DS); set_fs(USER_DS);
#ifdef __sparc__
if (!access_ok(VERIFY_READ, (void __user *)START_DATA(dump), dump.u_dsize))
dump.u_dsize = 0;
if (!access_ok(VERIFY_READ, (void __user *)START_STACK(dump), dump.u_ssize))
dump.u_ssize = 0;
#else
if (!access_ok(VERIFY_READ, (void __user *)START_DATA(dump), dump.u_dsize << PAGE_SHIFT)) if (!access_ok(VERIFY_READ, (void __user *)START_DATA(dump), dump.u_dsize << PAGE_SHIFT))
dump.u_dsize = 0; dump.u_dsize = 0;
if (!access_ok(VERIFY_READ, (void __user *)START_STACK(dump), dump.u_ssize << PAGE_SHIFT)) if (!access_ok(VERIFY_READ, (void __user *)START_STACK(dump), dump.u_ssize << PAGE_SHIFT))
dump.u_ssize = 0; dump.u_ssize = 0;
#endif
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
/* struct user */ /* struct user */
DUMP_WRITE(&dump,sizeof(dump)); DUMP_WRITE(&dump,sizeof(dump));
/* Now dump all of the user data. Include malloced stuff as well */ /* Now dump all of the user data. Include malloced stuff as well */
#ifndef __sparc__
DUMP_SEEK(PAGE_SIZE); DUMP_SEEK(PAGE_SIZE);
#endif
/* now we start writing out the user space info */ /* now we start writing out the user space info */
set_fs(USER_DS); set_fs(USER_DS);
/* Dump the data area */ /* Dump the data area */
if (dump.u_dsize != 0) { if (dump.u_dsize != 0) {
dump_start = START_DATA(dump); dump_start = START_DATA(dump);
#ifdef __sparc__
dump_size = dump.u_dsize;
#else
dump_size = dump.u_dsize << PAGE_SHIFT; dump_size = dump.u_dsize << PAGE_SHIFT;
#endif
DUMP_WRITE(dump_start,dump_size); DUMP_WRITE(dump_start,dump_size);
} }
/* Now prepare to dump the stack area */ /* Now prepare to dump the stack area */
if (dump.u_ssize != 0) { if (dump.u_ssize != 0) {
dump_start = START_STACK(dump); dump_start = START_STACK(dump);
#ifdef __sparc__
dump_size = dump.u_ssize;
#else
dump_size = dump.u_ssize << PAGE_SHIFT; dump_size = dump.u_ssize << PAGE_SHIFT;
#endif
DUMP_WRITE(dump_start,dump_size); DUMP_WRITE(dump_start,dump_size);
} }
/* Finally dump the task struct. Not be used by gdb, but could be useful */ /* Finally dump the task struct. Not be used by gdb, but could be useful */
...@@ -205,11 +170,6 @@ static unsigned long __user *create_aout_tables(char __user *p, struct linux_bin ...@@ -205,11 +170,6 @@ static unsigned long __user *create_aout_tables(char __user *p, struct linux_bin
int envc = bprm->envc; int envc = bprm->envc;
sp = (void __user *)((-(unsigned long)sizeof(char *)) & (unsigned long) p); sp = (void __user *)((-(unsigned long)sizeof(char *)) & (unsigned long) p);
#ifdef __sparc__
/* This imposes the proper stack alignment for a new process. */
sp = (void __user *) (((unsigned long) sp) & ~7);
if ((envc+argc+3)&1) --sp;
#endif
#ifdef __alpha__ #ifdef __alpha__
/* whee.. test-programs are so much fun. */ /* whee.. test-programs are so much fun. */
put_user(0, --sp); put_user(0, --sp);
...@@ -302,11 +262,6 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs) ...@@ -302,11 +262,6 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs)
/* OK, This is the point of no return */ /* OK, This is the point of no return */
#if defined(__alpha__) #if defined(__alpha__)
SET_AOUT_PERSONALITY(bprm, ex); SET_AOUT_PERSONALITY(bprm, ex);
#elif defined(__sparc__)
set_personality(PER_SUNOS);
#if !defined(__sparc_v9__)
memcpy(&current->thread.core_exec, &ex, sizeof(struct exec));
#endif
#else #else
set_personality(PER_LINUX); set_personality(PER_LINUX);
#endif #endif
...@@ -322,24 +277,6 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs) ...@@ -322,24 +277,6 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs)
install_exec_creds(bprm); install_exec_creds(bprm);
current->flags &= ~PF_FORKNOEXEC; current->flags &= ~PF_FORKNOEXEC;
#ifdef __sparc__
if (N_MAGIC(ex) == NMAGIC) {
loff_t pos = fd_offset;
/* Fuck me plenty... */
/* <AOL></AOL> */
down_write(&current->mm->mmap_sem);
error = do_brk(N_TXTADDR(ex), ex.a_text);
up_write(&current->mm->mmap_sem);
bprm->file->f_op->read(bprm->file, (char *) N_TXTADDR(ex),
ex.a_text, &pos);
down_write(&current->mm->mmap_sem);
error = do_brk(N_DATADDR(ex), ex.a_data);
up_write(&current->mm->mmap_sem);
bprm->file->f_op->read(bprm->file, (char *) N_DATADDR(ex),
ex.a_data, &pos);
goto beyond_if;
}
#endif
if (N_MAGIC(ex) == OMAGIC) { if (N_MAGIC(ex) == OMAGIC) {
unsigned long text_addr, map_size; unsigned long text_addr, map_size;
...@@ -347,7 +284,7 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs) ...@@ -347,7 +284,7 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs)
text_addr = N_TXTADDR(ex); text_addr = N_TXTADDR(ex);
#if defined(__alpha__) || defined(__sparc__) #ifdef __alpha__
pos = fd_offset; pos = fd_offset;
map_size = ex.a_text+ex.a_data + PAGE_SIZE - 1; map_size = ex.a_text+ex.a_data + PAGE_SIZE - 1;
#else #else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment