Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Sep 2000 15:22:38 +0900
From:      Takanori Watanabe <takawata@shidahara1.planet.sci.kobe-u.ac.jp>
To:        freebsd-hackers@freebsd.org, freebsd-emulation@freebsd.org
Subject:   PEACE - Portable Executable win32 API Compatible Environment.
Message-ID:  <200009180622.PAA49090@shidahara1.planet.sci.kobe-u.ac.jp>

next in thread | raw e-mail | index | archive | help
Hi, 

I ported kernel part of PEACE from NetBSD.(That is in sys/compat/pecoff/*).

What is PEACE

PEACE is Win32 API Compatible environment for (Originally) NetBSD.
It consist of three parts: 
Kernel part to load PE format executable onto process memory space.
Dynamic Linker to link with PE format DLL.
Libraries to translate Win32 API call to NetBSD native system call.

Yes, this scheme is more like BSD/OS's LAP than FreeBSD Linux ABI module.
For more infomation:
	http://chiharu.hauN.ORG/peace/

Status:
FreeBSD Specific:
- I ported executable loader moudule to FreeBSD.
- FreeBSD native libraries is not yet available,so I wrote a module to
 add(or replace) system call so that the libraries can be run.
- It requires following changes to sys/imgact.h and kern/kern_exec.c to
 be able to change size of memory area to hold dynamic linker argument
 from executable image loader.

--- sys/imgact.h.orig	Mon Sep 18 02:18:46 2000
+++ sys/imgact.h	Mon Sep 18 02:19:25 2000
@@ -58,6 +58,7 @@
 	struct vm_page *firstpage;	/* first page that we mapped */
 	char *fname;            /* pointer to filename of executable (user space) */
 	unsigned long ps_strings; /* PS_STRINGS for BSD/OS binaries */
+	size_t auxarg_size;
 };
 
 #ifdef _KERNEL
--- kern/kern_exec.c.orig	Fri Jul 14 15:44:45 2000
+++ kern/kern_exec.c	Mon Sep 18 02:59:45 2000
@@ -127,6 +127,7 @@
 	imgp->vp = NULL;
 	imgp->firstpage = NULL;
 	imgp->ps_strings = 0;
+	imgp->auxarg_size=0;
 
 	/*
 	 * Allocate temporary demand zeroed space for argument and
@@ -613,14 +614,21 @@
 	 * If we have a valid auxargs ptr, prepare some room
 	 * on the stack.
 	 */
-	if (imgp->auxargs)
+	if (imgp->auxargs){
+        /*
+	 * 'AT_COUNT*2' is size for the ELF Auxargs data.
+	 * This is for lower compatibility.
+	 */
+		imgp->auxarg_size=(imgp->auxarg_size)?imgp->auxarg_size
+		    :(AT_COUNT*2);
 	/*
 	 * The '+ 2' is for the null pointers at the end of each of the
-	 * arg and env vector sets, and 'AT_COUNT*2' is room for the
-	 * ELF Auxargs data.
+	 * arg and env vector sets,and imgp->auxarg_size is room for argument
+	 * of Runtime loader.
 	 */
 		vectp = (char **)(destp - (imgp->argc + imgp->envc + 2 +
-				  AT_COUNT*2) * sizeof(char*));
+				  imgp->auxarg_size) * sizeof(char*));
+	}
 	else 
 	/*
 	 * The '+ 2' is for the null pointers at the end of each of the

You can get These modules at
 http://www.planet.sci.kobe-u.ac.jp/~takawata/peace/peace4fbsd-kmodule.tar.gz

General status:
- Some command line application like FTP.EXE, CMD.EXE ,EXTRAC32.EXE can be 
 run.
- Simplest GUI application can be run,such as whello.exe ,distributed in
PEACE website.
 
ToDO
priority order.
- Merge the patch to precede .(Who should I ask about it?)
- Merge pecoff loader module to FreeBSD.
- Create native ld.so.dll ,pecoff format of libc.a and libc.dll .
- Share library sources with NetBSD version as much as we can.

NOTE: I don't subscribe freebsd-emulation.

Thanks in advance .

Takanori Watanabe
<a href="http://www.planet.sci.kobe-u.ac.jp/~takawata/key.html">;
Public Key</a>
Key fingerprint =  2C 51 E2 78 2C E1 C5 2D  0F F1 20 A3 11 3A 62 2A 




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200009180622.PAA49090>