[Git][cmucl/cmucl][sparc64-dev] write-long writes longs

Raymond Toy rtoy at common-lisp.net
Thu Dec 29 17:46:14 UTC 2016


Raymond Toy pushed to branch sparc64-dev at cmucl / cmucl


Commits:
d8c463ea by Raymond Toy at 2016-12-29T09:45:41-08:00
write-long writes longs

Make write-long actually write long values.  This is 32-bit for 32-bit
archs, and 64-bit for 64-bit archs.  This will eventually be needed to
write 64-bit heap addresses and descriptors eventually.

Adjust load_core_file in coreparse.c to read longs as expected.  This
basically reverts all changes in coreparge.c back to the master
version.

- - - - -


2 changed files:

- src/compiler/generic/new-genesis.lisp
- src/lisp/coreparse.c


Changes:

=====================================
src/compiler/generic/new-genesis.lisp
=====================================
--- a/src/compiler/generic/new-genesis.lisp
+++ b/src/compiler/generic/new-genesis.lisp
@@ -2871,6 +2871,7 @@
 (defparameter initial-function-entry-type-code 3863)
 (defparameter end-entry-type-code 3840)
 
+#+nil
 (defun write-long (num)
   (ecase (c:backend-byte-order c:*backend*)
     (:little-endian
@@ -2880,6 +2881,15 @@
      (dotimes (i 4)
        (write-byte (ldb (byte 8 (* (- 3 i) 8)) num) *core-file*)))))
 
+(defun write-long (num)
+  (ecase (c:backend-byte-order c:*backend*)
+    (:little-endian
+     (dotimes (i vm:word-bytes)
+       (write-byte (ldb (byte 8 (* i 8)) num) *core-file*)))
+    (:big-endian
+     (dotimes (i vm:word-bytes)
+       (write-byte (ldb (byte 8 (* (- vm:word-bytes 1 i) 8)) num) *core-file*)))))
+
 
 (defun advance-to-page ()
   (force-output *core-file*)


=====================================
src/lisp/coreparse.c
=====================================
--- a/src/lisp/coreparse.c
+++ b/src/lisp/coreparse.c
@@ -95,10 +95,10 @@ load_core_file(const char *file, fpu_mode_t* fpu_type)
 {
     int fd = open(file, O_RDONLY), count;
 
-#if !(defined(alpha) || defined(__x86_64) || defined(__sparcv9))
+#if !(defined(alpha) || defined(__x86_64))
     long header[CORE_PAGESIZE / sizeof(long)], val, len, *ptr;
 #else
-    uint32_t header[CORE_PAGESIZE / sizeof(uint32_t)], val, len, *ptr;
+    u32 header[CORE_PAGESIZE / sizeof(u32)], val, len, *ptr;
 #endif
     lispobj initial_function = NIL;
 
@@ -154,10 +154,10 @@ load_core_file(const char *file, fpu_mode_t* fpu_type)
 
 	  case CORE_NDIRECTORY:
 	      process_directory(fd, ptr,
-#if !(defined(alpha) || defined(__x86_64) || defined(__sparcv9))
+#if !(defined(alpha) || defined(__x86_64))
 				(len - 2) / (sizeof(struct ndir_entry) / sizeof(long)));
 #else
-				(len - 2) / (sizeof(struct ndir_entry) / sizeof(uint32_t)));
+				(len - 2) / (sizeof(struct ndir_entry) / sizeof(u32)));
 #endif
 	      break;
 



View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/commit/d8c463eab4840d1c6a90fcc67597affa9aae96dd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cmucl-cvs/attachments/20161229/7801e52d/attachment-0001.html>


More information about the cmucl-cvs mailing list