[kaffe] CVS kaffe (robilad): reverted to old version

Kaffe CVS cvs-commits at kaffe.org
Sun Sep 24 13:58:07 PDT 2006


PatchSet 7424 
Date: 2006/09/24 18:24:16
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
reverted to old version

Members: 
	include/jsyscall.h:1.28->1.29 
	kaffe/kaffeh/support.c:1.53->1.54 
	kaffe/kaffevm/systems/beos-native/syscalls.c:1.12->1.13 
	kaffe/kaffevm/systems/drops-l4threads/syscalls.c:1.3->1.4 
	kaffe/kaffevm/systems/oskit-pthreads/syscalls.c:1.12->1.13 
	kaffe/kaffevm/systems/unix-jthreads/syscalls.c:1.21->1.22 
	kaffe/kaffevm/systems/unix-pthreads/syscalls.c:1.39->1.40 

Index: kaffe/include/jsyscall.h
diff -u kaffe/include/jsyscall.h:1.28 kaffe/include/jsyscall.h:1.29
--- kaffe/include/jsyscall.h:1.28	Tue Sep 12 22:26:58 2006
+++ kaffe/include/jsyscall.h	Sun Sep 24 18:24:16 2006
@@ -95,7 +95,9 @@
 	int	(*_waitpid)(int, int *, int, int *);
 	int	(*_kill)(int, int);
 
+	int	(*_mmap)(void **, size_t *, int, int fd, off_t *);
 	int	(*_munmap)(void *, size_t);
+	int	(*_msync)(void *, size_t);
 
 	int	(*_pipecreate)(int *, int *);
 	int	(*_piperead)(int, void *, size_t, int, ssize_t *);
@@ -250,13 +252,19 @@
 #define	KFORKEXEC(A,B,C,D,E) \
 			(*Kaffe_SystemCallInterface._forkexec)(A,B,C,D,E)
 #define	KKILL(A,B)	(*Kaffe_SystemCallInterface._kill)(A,B)
+#define KMMAP(A,B,C,D,E) (*Kaffe_SystemCallInterface._mmap)(A,B,C,D,E)
 #define KMUNMAP(A,B)  (*Kaffe_SystemCallInterface._munmap)(A,B)
+#define KMSYNC(A,B)  (*Kaffe_SystemCallInterface._msync)(A,B)
 
 #define KPIPECREATE(A,B)   (*Kaffe_SystemCallInterface._pipecreate)(A,B)
 #define KPIPEREAD(A,B,C,D,E) (*Kaffe_SystemCallInterface._piperead)(A,B,C,D,E)
 #define KPIPEWRITE(A,B,C,D,E) (*Kaffe_SystemCallInterface._pipewrite)(A,B,C,D,E)
 
 #define KSOCKSHUTDOWN(A) (*Kaffe_SystemCallInterface._sockShutdown)(A)
+
+#define KAFFE_MMAP_READ 0
+#define KAFFE_MMAP_WRITE 1
+#define KAFFE_MMAP_PRIVATE 2
 
 #define NOTIMEOUT (-1)
 
Index: kaffe/kaffe/kaffeh/support.c
diff -u kaffe/kaffe/kaffeh/support.c:1.53 kaffe/kaffe/kaffeh/support.c:1.54
--- kaffe/kaffe/kaffeh/support.c:1.53	Tue Sep 12 22:26:58 2006
+++ kaffe/kaffe/kaffeh/support.c	Sun Sep 24 18:25:23 2006
@@ -144,7 +144,9 @@
         NULL,		/* forkexec */
         NULL,		/* waitpid */
         NULL,		/* kill */
+	NULL,           /* mmap */
         NULL,           /* munmap */
+        NULL,           /* msync */
         NULL,           /* pipecreate */
         NULL,           /* piperead */
         NULL            /* pipewrite */
Index: kaffe/kaffe/kaffevm/systems/beos-native/syscalls.c
diff -u kaffe/kaffe/kaffevm/systems/beos-native/syscalls.c:1.12 kaffe/kaffe/kaffevm/systems/beos-native/syscalls.c:1.13
--- kaffe/kaffe/kaffevm/systems/beos-native/syscalls.c:1.12	Tue Sep 12 22:26:59 2006
+++ kaffe/kaffe/kaffevm/systems/beos-native/syscalls.c	Sun Sep 24 18:26:40 2006
@@ -500,6 +500,12 @@
 }
 
 static int
+beos_native_mmap(void **memory, size_t *size, int mode, int fd, off_t *offset)
+{
+	return B_UNSUPPORTED;
+}
+
+static int
 beos_native_munmap(void *memory, size_t size)
 {
 	return B_UNSUPPORTED;
@@ -538,5 +544,6 @@
 	beos_native_forkexec,
 	beos_native_waitpid,
 	beos_native_kill,
+	beos_native_mmap,
 	beos_native_munmap
 };
Index: kaffe/kaffe/kaffevm/systems/drops-l4threads/syscalls.c
diff -u kaffe/kaffe/kaffevm/systems/drops-l4threads/syscalls.c:1.3 kaffe/kaffe/kaffevm/systems/drops-l4threads/syscalls.c:1.4
--- kaffe/kaffe/kaffevm/systems/drops-l4threads/syscalls.c:1.3	Tue Sep 12 22:26:59 2006
+++ kaffe/kaffe/kaffevm/systems/drops-l4threads/syscalls.c	Sun Sep 24 18:27:45 2006
@@ -341,12 +341,25 @@
   return -1;
 }
 
+static int drops_mmap(void **memory UNUSED, size_t *size UNUSED,
+                      int mode UNUSED, int fd UNUSED,
+                      off_t *offset UNUSED) {
+  unimp("mmap() not implemented");
+  return -1;
+}
+
 static int drops_munmap(void *memory UNUSED,
                         size_t size UNUSED) {
   unimp("munmap() not implemented");
   return -1;
 }
 
+static int drops_msync(void *memory UNUSED,
+                       size_t length UNUSED) {
+  unimp("msync() not implemented");
+  return -1;
+}
+
 static int drops_pipecreate(int * a UNUSED, int *b UNUSED) {
   unimp("pipecreate() not implemented");
   return -1;
@@ -401,7 +414,9 @@
 	drops_forkexec,
 	drops_waitpid,
 	drops_kill,
+	drops_mmap,
         drops_munmap,
+        drops_msync,
         drops_pipecreate,
         drops_piperead,
         drops_pipewrite
Index: kaffe/kaffe/kaffevm/systems/oskit-pthreads/syscalls.c
diff -u kaffe/kaffe/kaffevm/systems/oskit-pthreads/syscalls.c:1.12 kaffe/kaffe/kaffevm/systems/oskit-pthreads/syscalls.c:1.13
--- kaffe/kaffe/kaffevm/systems/oskit-pthreads/syscalls.c:1.12	Tue Sep 12 22:26:59 2006
+++ kaffe/kaffe/kaffevm/systems/oskit-pthreads/syscalls.c	Sun Sep 24 18:28:49 2006
@@ -318,6 +318,12 @@
 }
 
 static int
+oskit_pthread_mmap(void **memory, size_t *size, )
+{
+	return (EOPNOTSUPP);
+}
+
+static int
 oskit_pthread_munmap(void *memory, size_t size)
 {
 	return (EOPNOTSUPP);
@@ -356,5 +362,6 @@
 	oskit_pthread_forkexec,
 	oskit_pthread_waitpid,
 	oskit_pthread_kill,
+	oskit_pthread_mmap,
 	oskit_pthread_munmap
 };
Index: kaffe/kaffe/kaffevm/systems/unix-jthreads/syscalls.c
diff -u kaffe/kaffe/kaffevm/systems/unix-jthreads/syscalls.c:1.21 kaffe/kaffe/kaffevm/systems/unix-jthreads/syscalls.c:1.22
--- kaffe/kaffe/kaffevm/systems/unix-jthreads/syscalls.c:1.21	Tue Sep 12 22:27:00 2006
+++ kaffe/kaffe/kaffevm/systems/unix-jthreads/syscalls.c	Sun Sep 24 18:30:29 2006
@@ -325,6 +325,50 @@
 }
 
 static int
+jthreadedMmap(void **memory, size_t *size, int mode, int fd, off_t *offset)
+{
+#if defined(HAVE_MMAP)
+	size_t pages_sz;
+	off_t pages_offset;
+	int sysmode, sysflags;
+	int rc = 0;
+
+	pages_sz = (*size)/getpagesize();
+	*size = (pages_sz+1)*getpagesize();
+  
+	pages_offset = (*offset)/getpagesize();
+	*offset = pages_offset*getpagesize();
+
+	switch (mode) {
+		case KAFFE_MMAP_READ:
+			sysflags = MAP_PRIVATE;
+			sysmode = PROT_READ;
+			break;
+		case KAFFE_MMAP_WRITE:
+			sysflags = MAP_SHARED;
+			sysmode = PROT_READ | PROT_WRITE;
+			break;
+		case KAFFE_MMAP_PRIVATE:
+			sysflags = MAP_PRIVATE;
+			sysmode = PROT_WRITE | PROT_READ;
+			break;
+		default:
+			return EINVAL;
+	}
+
+	jthread_spinon(0);
+	*memory = mmap(*memory, *size, sysmode, sysflags, fd, *offset);
+	if (*memory == NULL)
+		rc = errno;
+
+	jthread_spinoff(0);
+	return (rc);
+#else
+	return (ENOTSUP);
+#endif
+}
+
+static int
 jthreadedMunmap(void *memory, size_t size)
 {
 #if defined(HAVE_MMAP)
@@ -341,6 +385,27 @@
 #endif
 }
 
+static int
+jthreadedMsync(void *memory, size_t size)
+{
+#if defined(HAVE_MMAP)
+	int rc = 0;
+
+	jthread_spinon(0);
+	memory = (void *)(((size_t)memory/getpagesize()) * getpagesize());
+	size += getpagesize();
+	/* TODO: Try not to freeze the entire VM. */
+	if (msync(memory, size, MS_SYNC | MS_INVALIDATE) < 0) {
+		rc = errno;
+	}
+	jthread_spinoff(0);
+
+	return rc;
+#else
+	return (ENOTSUP);
+#endif
+}
+
 /*
  * The syscall interface as provided by the internal jthread system.
  */
@@ -379,7 +444,9 @@
         jthreadedForkExec,
         jthreadedWaitpid,
         jthreadedKill,
+        jthreadedMmap,
         jthreadedMunmap,
+        jthreadedMsync,
 	jthreadedPipeCreate,
         jthreadedTimedRead,
 	jthreadedTimedWrite
Index: kaffe/kaffe/kaffevm/systems/unix-pthreads/syscalls.c
diff -u kaffe/kaffe/kaffevm/systems/unix-pthreads/syscalls.c:1.39 kaffe/kaffe/kaffevm/systems/unix-pthreads/syscalls.c:1.40
--- kaffe/kaffe/kaffevm/systems/unix-pthreads/syscalls.c:1.39	Tue Sep 12 22:27:00 2006
+++ kaffe/kaffe/kaffevm/systems/unix-pthreads/syscalls.c	Sun Sep 24 18:31:19 2006
@@ -790,6 +790,47 @@
 }
 
 static int
+jthreadedMmap(void **memory, size_t *size, int mode, int fd, off_t *offset)
+{
+#if defined(HAVE_MMAP)
+	size_t pages_sz;
+	off_t pages_offset;
+	int sysmode, sysflags;
+	int rc = 0;
+
+	pages_sz = (*size)/getpagesize();
+	*size = (pages_sz+1)*getpagesize();
+  
+	pages_offset = (*offset)/getpagesize();
+	*offset = pages_offset*getpagesize();
+
+	switch (mode) {
+		case KAFFE_MMAP_READ:
+			sysflags = MAP_SHARED;
+			sysmode = PROT_READ;
+			break;
+		case KAFFE_MMAP_WRITE:
+			sysflags = MAP_SHARED;
+			sysmode = PROT_WRITE | PROT_READ;
+			break;
+		case KAFFE_MMAP_PRIVATE:
+			sysflags = MAP_PRIVATE;
+			sysmode = PROT_WRITE | PROT_READ;
+			break;
+		default:
+			return -EINVAL;
+	}
+
+	*memory = mmap(*memory, *size, sysmode, sysflags, fd, *offset);
+
+	return (rc);
+#else
+	return (ENOTSUP);
+#endif
+}
+
+
+static int
 jthreadedMunmap(void *memory, size_t size)
 {
 #if defined(HAVE_MMAP)
@@ -805,6 +846,25 @@
 }
 
 static int
+jthreadedMsync(void *memory, size_t size)
+{
+#if defined(HAVE_MMAP)
+        int rc = 0;
+
+        memory = (void *)(((size_t)memory/getpagesize()) * getpagesize());
+        size += getpagesize();
+        /* TODO: Try not to freeze the entire VM. */
+        if (msync(memory, size, MS_SYNC | MS_INVALIDATE) < 0) {
+            rc = errno;
+        }
+
+        return rc;
+#else
+        return (ENOTSUP);
+#endif
+}
+
+static int
 jthreadedPipeCreate(int *read_fd, int *write_fd)
 {
 	int pairs[2];
@@ -859,7 +919,9 @@
         jthreadedForkExec,
         jthreadedWaitpid,
         jthreadedKill,
+        jthreadedMmap,
         jthreadedMunmap,
+	jthreadedMsync,
 	jthreadedPipeCreate,
 	jthreadedTimedRead,
 	jthreadedTimedWrite




More information about the kaffe mailing list