Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8e7106a6 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull m68knommu updates from Greg Ungerer:
 "This series is all about Nicolas flat format support for MMU systems.

  Traditional m68k no-MMU flat format binaries can now be run on m68k
  MMU enabled systems too.  The series includes some nice cleanups of
  the binfmt_flat code and converts it to using proper user space
  accessor functions.

  With all this in place you can boot and run a complete no-MMU flat
  format based user space on an MMU enabled system"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu:
  m68k: enable binfmt_flat on systems with an MMU
  binfmt_flat: allow compressed flat binary format to work on MMU systems
  binfmt_flat: add MMU-specific support
  binfmt_flat: update libraries' data segment pointer with userspace accessors
  binfmt_flat: use clear_user() rather than memset() to clear .bss
  binfmt_flat: use proper user space accessors with old relocs code
  binfmt_flat: use proper user space accessors with relocs processing code
  binfmt_flat: clean up create_flat_tables() and stack accesses
  binfmt_flat: use generic transfer_args_to_stack()
  elf_fdpic_transfer_args_to_stack(): make it generic
  binfmt_flat: prevent kernel dammage from corrupted executable headers
  binfmt_flat: convert printk invocations to their modern form
  binfmt_flat: assorted cleanups
  m68k: use same start_thread() on MMU and no-MMU
  m68k: fix file path comment
  m68k: fix bFLT executable running on MMU enabled systems
parents c1ece767 002d2f01
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
/*
 * include/asm-m68knommu/flat.h -- uClinux flat-format executables
 * flat.h -- uClinux flat-format executables
 */

#ifndef __M68KNOMMU_FLAT_H__
@@ -8,8 +8,9 @@
#define	flat_argvp_envp_on_stack()		1
#define	flat_old_ram_flag(flags)		(flags)
#define	flat_reloc_valid(reloc, size)		((reloc) <= (size))
#define	flat_get_addr_from_rp(rp, relval, flags, p)	get_unaligned(rp)
#define	flat_put_addr_at_rp(rp, val, relval)	put_unaligned(val,rp)
#define	flat_get_addr_from_rp(rp, relval, flags, p) \
	({ unsigned long __val; __get_user_unaligned(__val, rp); __val; })
#define	flat_put_addr_at_rp(rp, val, relval)	__put_user_unaligned(val, rp)
#define	flat_get_relocate_addr(rel)		(rel)

static inline int flat_set_persistent(unsigned long relval,
@@ -18,4 +19,10 @@ static inline int flat_set_persistent(unsigned long relval,
	return 0;
}

#define FLAT_PLAT_INIT(regs) \
	do { \
		if (current->mm) \
			(regs)->d5 = current->mm->start_data; \
	} while (0)

#endif /* __M68KNOMMU_FLAT_H__ */
+1 −14
Original line number Diff line number Diff line
@@ -110,7 +110,6 @@ struct thread_struct {
#define setframeformat(_regs)	do { } while (0)
#endif

#ifdef CONFIG_MMU
/*
 * Do necessary setup to start up a newly executed thread.
 */
@@ -123,26 +122,14 @@ static inline void start_thread(struct pt_regs * regs, unsigned long pc,
	wrusp(usp);
}

#ifdef CONFIG_MMU
extern int handle_kernel_fault(struct pt_regs *regs);

#else

#define start_thread(_regs, _pc, _usp)                  \
do {                                                    \
	(_regs)->pc = (_pc);                            \
	setframeformat(_regs);                          \
	if (current->mm)                                \
		(_regs)->d5 = current->mm->start_data;  \
	(_regs)->sr &= ~0x2000;                         \
	wrusp(_usp);                                    \
} while(0)

static inline  int handle_kernel_fault(struct pt_regs *regs)
{
	/* Any fault in kernel is fatal on non-mmu */
	return 0;
}

#endif

/* Forward declaration, a strange C thing */
+2 −1
Original line number Diff line number Diff line
@@ -89,7 +89,8 @@ config BINFMT_SCRIPT

config BINFMT_FLAT
	bool "Kernel support for flat binaries"
	depends on !MMU && (!FRV || BROKEN)
	depends on !MMU || M68K
	depends on !FRV || BROKEN
	help
	  Support uClinux FLAT format binaries.

+2 −36
Original line number Diff line number Diff line
@@ -67,8 +67,6 @@ static int create_elf_fdpic_tables(struct linux_binprm *, struct mm_struct *,
				   struct elf_fdpic_params *);

#ifndef CONFIG_MMU
static int elf_fdpic_transfer_args_to_stack(struct linux_binprm *,
					    unsigned long *);
static int elf_fdpic_map_file_constdisp_on_uclinux(struct elf_fdpic_params *,
						   struct file *,
						   struct mm_struct *);
@@ -515,8 +513,9 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
	sp = mm->start_stack;

	/* stack the program arguments and environment */
	if (elf_fdpic_transfer_args_to_stack(bprm, &sp) < 0)
	if (transfer_args_to_stack(bprm, &sp) < 0)
		return -EFAULT;
	sp &= ~15;
#endif

	/*
@@ -709,39 +708,6 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
	return 0;
}

/*****************************************************************************/
/*
 * transfer the program arguments and environment from the holding pages onto
 * the stack
 */
#ifndef CONFIG_MMU
static int elf_fdpic_transfer_args_to_stack(struct linux_binprm *bprm,
					    unsigned long *_sp)
{
	unsigned long index, stop, sp;
	char *src;
	int ret = 0;

	stop = bprm->p >> PAGE_SHIFT;
	sp = *_sp;

	for (index = MAX_ARG_PAGES - 1; index >= stop; index--) {
		src = kmap(bprm->page[index]);
		sp -= PAGE_SIZE;
		if (copy_to_user((void *) sp, src, PAGE_SIZE) != 0)
			ret = -EFAULT;
		kunmap(bprm->page[index]);
		if (ret < 0)
			goto out;
	}

	*_sp = (*_sp - (MAX_ARG_PAGES * PAGE_SIZE - bprm->p)) & ~15;

out:
	return ret;
}
#endif

/*****************************************************************************/
/*
 * load the appropriate binary image (executable or interpreter) into memory
+294 −231

File changed.

Preview size limit exceeded, changes collapsed.

Loading