Index: ibcs/iBCSemul/binfmt_aout.c diff -u ibcs/iBCSemul/binfmt_aout.c:1.1.1.1 ibcs/iBCSemul/binfmt_aout.c:1.3 --- ibcs/iBCSemul/binfmt_aout.c:1.1.1.1 Thu Aug 31 18:36:47 2000 +++ ibcs/iBCSemul/binfmt_aout.c Fri Sep 1 01:42:19 2000 @@ -197,7 +197,11 @@ goto out; } file = fcheck(fd); +#if 0 if (fd_offset % bprm->dentry->d_inode->i_sb->s_blocksize +#else /* Kernel 2.4.x enforces a mmap fd_offset granularity of PAGE_SIZE */ + if (fd_offset & ~PAGE_MASK +#endif || !file->f_op || !file->f_op->mmap) { SYS(close)(fd); do_mmap(NULL, vm_offset, ex.a_text+ex.a_data, @@ -283,6 +287,7 @@ loff_t offset = 0; int retval; int error; + static int warnings; MOD_INC_USE_COUNT; @@ -309,7 +314,8 @@ } if (N_MAGIC(ex) == ZMAGIC && N_TXTOFF(ex) && (N_TXTOFF(ex) < inode->i_sb->s_blocksize)) { - printk("N_TXTOFF < BLOCK_SIZE. Please convert library\n"); + if(warnings++<10) + printk("N_TXTOFF < BLOCK_SIZE. Please convert library\n"); goto out_putf; } @@ -321,6 +327,22 @@ start_addr = ex.a_entry & 0xfffff000; + if (!file->f_op->mmap || +#if 0 + N_TXTOFF(ex) & (bprm->dentry->d_inode->i_sb->s_blocksize-1)) { +#else /* Kernel 2.4.x fd_offset granularity is PAGE_SIZE */ + N_TXTOFF(ex) & ~PAGE_MASK) { +#endif + error = do_mmap(NULL, start_addr, ex.a_text + ex.a_data, + PROT_READ | PROT_WRITE | PROT_EXEC, + MAP_FIXED | MAP_PRIVATE, + 0); + read_exec(file->f_dentry, N_TXTOFF(ex), + (char *)start_addr, ex.a_text + ex.a_data, 0); + flush_icache_range((unsigned long) start_addr, + (unsigned long) start_addr + ex.a_text + ex.a_data); + goto map_bss; + } /* Now use mmap to map the library into memory. */ error = do_mmap(file, start_addr, ex.a_text + ex.a_data, PROT_READ | PROT_WRITE | PROT_EXEC, @@ -330,6 +352,7 @@ if (error != start_addr) goto out_putf; + map_bss: len = PAGE_ALIGN(ex.a_text + ex.a_data); bss = ex.a_text + ex.a_data + ex.a_bss; if (bss > len) { Index: ibcs/iBCSemul/binfmt_xout.c diff -u ibcs/iBCSemul/binfmt_xout.c:1.1.1.1 ibcs/iBCSemul/binfmt_xout.c:1.2 --- ibcs/iBCSemul/binfmt_xout.c:1.1.1.1 Thu Aug 31 18:36:47 2000 +++ ibcs/iBCSemul/binfmt_xout.c Fri Sep 1 01:42:19 2000 @@ -162,11 +162,19 @@ */ # ifdef XOUT_DEBUG if ((ibcs_trace & TRACE_XOUT_LD) +#if 0 && ((seg->xs_filpos & 0x3ff) | (seg->xs_rbase & ~PAGE_MASK))) +#else /* Kernel 2.4.x: mmap file offset granularity is PAGE_SIZE */ + && ((seg->xs_filpos & ~PAGE_MASK) | (seg->xs_rbase & ~PAGE_MASK))) +#endif printk(KERN_DEBUG "XOUT: bad page alignment" " - demand paging disabled\n"); # endif +#if 0 return ((seg->xs_filpos & 0x3ff) | (seg->xs_rbase & ~PAGE_MASK)); +#else /* Kernel 2.4.x: mmap file offset granularity is PAGE_SIZE */ + return ((seg->xs_filpos & ~PAGE_MASK) | (seg->xs_rbase & ~PAGE_MASK)); +#endif #else # ifdef XOUT_DEBUG if ((ibcs_trace & TRACE_XOUT_LD)