[MLton-commit] r4623

Matthew Fluet MLton@mlton.org
Mon, 29 May 2006 20:21:34 -0700


Runtime and bootstrap on NetBSD 3.0
----------------------------------------------------------------------

U   mlton/branches/on-20050822-x86_64-branch/bin/mlton-script
U   mlton/branches/on-20050822-x86_64-branch/runtime/platform/darwin.c
U   mlton/branches/on-20050822-x86_64-branch/runtime/platform/freebsd.c
U   mlton/branches/on-20050822-x86_64-branch/runtime/platform/linux.c
U   mlton/branches/on-20050822-x86_64-branch/runtime/platform/netbsd.c
A   mlton/branches/on-20050822-x86_64-branch/runtime/platform/nonwin.c
U   mlton/branches/on-20050822-x86_64-branch/runtime/platform/openbsd.c
U   mlton/branches/on-20050822-x86_64-branch/runtime/platform/sysctl.c

----------------------------------------------------------------------

Modified: mlton/branches/on-20050822-x86_64-branch/bin/mlton-script
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/bin/mlton-script	2006-05-29 23:27:28 UTC (rev 4622)
+++ mlton/branches/on-20050822-x86_64-branch/bin/mlton-script	2006-05-30 03:21:33 UTC (rev 4623)
@@ -81,6 +81,7 @@
         -target-cc-opts amd64 '-m32 -mtune=opteron'              \
         -target-cc-opts darwin '-I/sw/include'                   \
         -target-cc-opts freebsd '-I/usr/local/include'           \
+        -target-cc-opts netbsd '-I/usr/pkg/include'              \
         -target-cc-opts solaris                                  \
                 '-Wa,-xarch=v8plusa
                 -mcpu=ultrasparc'                                \
@@ -102,7 +103,7 @@
         -target-link-opts mingw                                  \
                 '-lgmp -lws2_32 -lkernel32 -lpsapi -lnetapi32'   \
         -target-link-opts netbsd                                 \
-                '-Wl,-R/usr/pkg/lib -L/usr/local/lib/ -lgmp'     \
+                '-Wl,-R/usr/pkg/lib -L/usr/pkg/lib/ -lgmp'       \
         -target-link-opts openbsd '-L/usr/local/lib/ -lgmp'      \
         -target-link-opts solaris '-lgmp -lnsl -lsocket -lrt'    \
         -link-opts '-lgdtoa -lm'                                 \

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/platform/darwin.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/platform/darwin.c	2006-05-29 23:27:28 UTC (rev 4622)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/platform/darwin.c	2006-05-30 03:21:33 UTC (rev 4623)
@@ -7,6 +7,7 @@
 #include "diskBack.unix.c"
 #include "mkdir2.c"
 #include "mmap-protect.c"
+#include "nonwin.c"
 #include "use-mmap.c"
 
 code_pointer GC_getTextEnd (void) {
@@ -54,10 +55,3 @@
                 diee ("sysctl failed");
         return mem;
 }
-
-// This is not windows
-__attribute__ ((noreturn))
-C_Errno_t(C_PId_t) MLton_Process_cwait (__attribute__ ((unused)) C_PId_t pid, 
-                                        __attribute__ ((unused)) Ref(C_Status_t) status) {
-        die("MLton_Process_cwait not implemented");
-}

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/platform/freebsd.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/platform/freebsd.c	2006-05-29 23:27:28 UTC (rev 4622)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/platform/freebsd.c	2006-05-30 03:21:33 UTC (rev 4623)
@@ -4,6 +4,8 @@
 #include "getText.c"
 #include "mkdir2.c"
 #include "mmap-protect.c"
+#include "nonwin.c"
+#include "sysctl.c"
 #include "use-mmap.c"
 
 void GC_displayMem () {
@@ -23,13 +25,3 @@
         sa->sa_flags = SA_ONSTACK | SA_RESTART | SA_SIGINFO;
         sa->sa_sigaction = (void (*)(int, siginfo_t*, void*))catcher;
 }
-
-size_t GC_totalRam (void) {
-        unsigned int mem;
-        size_t len;
-
-        len = sizeof (int);
-        if (-1 == sysctlbyname ("hw.physmem", &mem, &len, NULL, 0))
-                diee ("sysctl failed");
-        return (size_t)mem;
-}

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/platform/linux.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/platform/linux.c	2006-05-29 23:27:28 UTC (rev 4622)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/platform/linux.c	2006-05-30 03:21:33 UTC (rev 4623)
@@ -7,6 +7,7 @@
 #include "mkdir2.c"
 #include "displayMem.linux.c"
 #include "mmap-protect.c"
+#include "nonwin.c"
 #include "sysconf.c"
 #include "use-mmap.c"
 
@@ -70,26 +71,3 @@
         return mremap (start, oldLength, newLength, MREMAP_MAYMOVE);
 }
 
-/* ------------------------------------------------- */
-/*                       Posix                       */
-/* ------------------------------------------------- */
-
-__attribute__ ((noreturn))
-void Posix_IO_setbin (__attribute__ ((unused)) C_Fd_t fd) {
-        die("Posix_IO_setbin not implemented");
-}
-
-__attribute__ ((noreturn))
-void Posix_IO_settext (__attribute__ ((unused)) C_Fd_t fd) {
-        die("Posix_IO_settext not implemented");
-}
-
-/* ------------------------------------------------- */
-/*                      Process                      */
-/* ------------------------------------------------- */
-
-__attribute__ ((noreturn))
-C_Errno_t(C_PId_t) MLton_Process_cwait (__attribute__ ((unused)) C_PId_t pid, 
-                                        __attribute__ ((unused)) Ref(C_Status_t) status) {
-        die("MLton_Process_cwait not implemented");
-}

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/platform/netbsd.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/platform/netbsd.c	2006-05-29 23:27:28 UTC (rev 4622)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/platform/netbsd.c	2006-05-30 03:21:33 UTC (rev 4623)
@@ -5,6 +5,7 @@
 #include "mkdir2.c"
 #include "displayMem.linux.c"
 #include "mmap-protect.c"
+#include "nonwin.c"
 #include "sysctl.c"
 #include "use-mmap.c"
 

Added: mlton/branches/on-20050822-x86_64-branch/runtime/platform/nonwin.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/platform/nonwin.c	2006-05-29 23:27:28 UTC (rev 4622)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/platform/nonwin.c	2006-05-30 03:21:33 UTC (rev 4623)
@@ -0,0 +1,23 @@
+/* ------------------------------------------------- */
+/*                       Posix                       */
+/* ------------------------------------------------- */
+
+__attribute__ ((noreturn))
+void Posix_IO_setbin (__attribute__ ((unused)) C_Fd_t fd) {
+        die("Posix_IO_setbin not implemented");
+}
+
+__attribute__ ((noreturn))
+void Posix_IO_settext (__attribute__ ((unused)) C_Fd_t fd) {
+        die("Posix_IO_settext not implemented");
+}
+
+/* ------------------------------------------------- */
+/*                      Process                      */
+/* ------------------------------------------------- */
+
+__attribute__ ((noreturn))
+C_Errno_t(C_PId_t) MLton_Process_cwait (__attribute__ ((unused)) C_PId_t pid, 
+                                        __attribute__ ((unused)) Ref(C_Status_t) status) {
+        die("MLton_Process_cwait not implemented");
+}

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/platform/openbsd.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/platform/openbsd.c	2006-05-29 23:27:28 UTC (rev 4622)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/platform/openbsd.c	2006-05-30 03:21:33 UTC (rev 4623)
@@ -5,6 +5,7 @@
 #include "mkdir2.c"
 #include "displayMem.linux.c"
 #include "mmap-protect.c"
+#include "nonwin.c"
 #include "sysctl.c"
 #include "use-mmap.c"
 

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/platform/sysctl.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/platform/sysctl.c	2006-05-29 23:27:28 UTC (rev 4622)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/platform/sysctl.c	2006-05-30 03:21:33 UTC (rev 4623)
@@ -1,12 +1,25 @@
+size_t GC_pageSize (void) {
+  int pageSize;
+  size_t len;
+  int mib[2];
+        
+  mib[0] = CTL_HW;
+  mib[1] = HW_PAGESIZE;
+  len = sizeof(pageSize);
+  if (-1 == sysctl (mib, 2, &pageSize, &len, NULL, 0))
+    diee ("sysctl failed");
+  return (size_t)pageSize;
+}
+
 size_t GC_totalRam (void) {
-  int mem;
+  int physMem;
   size_t len;
   int mib[2];
         
   mib[0] = CTL_HW;
   mib[1] = HW_PHYSMEM;
-  len = sizeof(mem);
-  if (-1 == sysctl (mib, 2, &mem, &len, NULL, 0))
+  len = sizeof(physMem);
+  if (-1 == sysctl (mib, 2, &physMem, &len, NULL, 0))
     diee ("sysctl failed");
-  return (size_t)mem;
+  return (size_t)physMem;
 }