12 #include <linux/module.h>
15 #include <linux/stat.h>
16 #include <linux/sched.h>
18 #include <linux/mman.h>
19 #include <linux/errno.h>
20 #include <linux/signal.h>
21 #include <linux/binfmts.h>
23 #include <linux/string.h>
25 #include <linux/fcntl.h>
26 #include <linux/ptrace.h>
27 #include <linux/slab.h>
28 #include <linux/shm.h>
29 #include <linux/personality.h>
32 #include <asm/uaccess.h>
33 #include <asm/pgtable.h>
36 #include <linux/elf.h>
39 static int load_som_library(
struct file *);
48 #define som_core_dump NULL
51 #define SOM_PAGESTART(_v) ((_v) & ~(unsigned long)(SOM_PAGESIZE-1))
52 #define SOM_PAGEOFFSET(_v) ((_v) & (SOM_PAGESIZE-1))
53 #define SOM_PAGEALIGN(_v) (((_v) + SOM_PAGESIZE - 1) & ~(SOM_PAGESIZE - 1))
57 .load_binary = load_som_binary,
58 .load_shlib = load_som_library,
72 int envc = bprm->
envc;
77 sp = (
unsigned long *)((bprm->
p + 3) & ~3);
89 bprm->
p = (
unsigned long) sp;
106 static int check_som_header(
struct som_hdr *som_ex)
108 int *
buf = (
int *)som_ex;
134 static int map_som_binary(
struct file *
file,
148 current->mm->start_code = code_start;
149 current->mm->end_code = code_start + code_size;
150 retval =
vm_mmap(file, code_start, code_size, prot,
152 if (retval < 0 && retval > -1024)
157 current->mm->start_data = data_start;
159 retval =
vm_mmap(file, data_start, data_size,
162 if (retval < 0 && retval > -1024)
167 retval =
vm_mmap(
NULL, bss_start, som_brk - bss_start,
169 if (retval > 0 || retval < -1024)
187 unsigned long som_entry;
194 retval = check_som_header(som_ex);
209 (
char *) hpuxhdr, size);
210 if (retval != size) {
231 current->thread.task_size = 0xc0000000;
235 current->thread.map_base = 0x80000000;
237 retval = map_som_binary(bprm->
file, hpuxhdr);
248 create_som_tables(bprm);
253 printk(
"(start_brk) %08lx\n" , (
unsigned long)
current->mm->start_brk);
254 printk(
"(end_code) %08lx\n" , (
unsigned long)
current->mm->end_code);
255 printk(
"(start_code) %08lx\n" , (
unsigned long)
current->mm->start_code);
256 printk(
"(end_data) %08lx\n" , (
unsigned long)
current->mm->end_data);
257 printk(
"(start_stack) %08lx\n" , (
unsigned long)
current->mm->start_stack);
273 static int load_som_library(
struct file *
f)
283 static int __init init_som_binfmt(
void)
285 register_binfmt(&som_format);
289 static void __exit exit_som_binfmt(
void)