/[cmucl]/src/code/mach-os.lisp
ViewVC logotype

Contents of /src/code/mach-os.lisp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.13 - (hide annotations)
Fri Mar 19 15:18:59 2010 UTC (4 years, 1 month ago) by rtoy
Branch: MAIN
CVS Tags: sparc-tramp-assem-base, post-merge-intl-branch, release-20b-pre1, release-20b-pre2, sparc-tramp-assem-2010-07-19, GIT-CONVERSION, cross-sol-x86-merged, RELEASE_20b, cross-sol-x86-base, snapshot-2010-12, snapshot-2010-11, snapshot-2011-09, snapshot-2011-06, snapshot-2011-07, snapshot-2011-04, snapshot-2011-02, snapshot-2011-03, snapshot-2011-01, snapshot-2010-05, snapshot-2010-04, snapshot-2010-07, snapshot-2010-06, snapshot-2010-08, cross-sol-x86-2010-12-20, cross-sparc-branch-base, HEAD
Branch point for: cross-sparc-branch, RELEASE-20B-BRANCH, sparc-tramp-assem-branch, cross-sol-x86-branch
Changes since 1.12: +3 -1 lines
Merge intl-branch 2010-03-18 to HEAD.  To build, you need to use
boot-2010-02-1 as the bootstrap file.  You should probably also use
the new -P option for build.sh to generate and update the po files
while building.
1 wlott 1.5 ;;; -*- Package: SYSTEM -*-
2 ram 1.1 ;;;
3     ;;; **********************************************************************
4     ;;; This code was written as part of the CMU Common Lisp project at
5     ;;; Carnegie Mellon University, and has been placed in the public domain.
6     ;;;
7     (ext:file-comment
8 rtoy 1.13 "$Header: /tiger/var/lib/cvsroots/cmucl/src/code/mach-os.lisp,v 1.13 2010/03/19 15:18:59 rtoy Rel $")
9 ram 1.1 ;;;
10     ;;; **********************************************************************
11     ;;;
12     ;;; OS interface functions for CMU CL under Mach.
13     ;;;
14     ;;; Written and maintained mostly by Skef Wholey and Rob MacLachlan.
15     ;;; Scott Fahlman, Dan Aronson, and Steve Handerson did stuff here, too.
16     ;;;
17     (in-package "SYSTEM")
18 ram 1.2 (use-package "EXTENSIONS")
19 rtoy 1.13 (intl:textdomain "cmucl")
20    
21 wlott 1.7 (export '(get-system-info get-page-size os-init))
22 wlott 1.8 (export '(*task-self* *task-data* *task-notify*))
23 ram 1.1
24     (pushnew :mach *features*)
25     (setq *software-type* "MACH/4.3BSD")
26    
27     (defun software-version ()
28     "Returns a string describing version of the supporting software."
29     (string-trim '(#\newline)
30     (with-output-to-string (stream)
31     (run-program "/usr/cs/etc/version" ; Site dependent???
32     nil :output stream))))
33 wlott 1.7
34 wlott 1.8
35 wlott 1.7 ;;; OS-Init initializes our operating-system interface. It sets the values
36     ;;; of the global port variables to what they should be and calls the functions
37     ;;; that set up the argument blocks for the server interfaces.
38 wlott 1.8
39     (defvar *task-self*)
40 wlott 1.7
41     (defun os-init ()
42 wlott 1.11 (setf *task-self* (mach:mach-task_self))
43     #+sparc ;; Can't use #x20000000 thru #xDFFFFFFF, but mach tries to let us.
44     (system:allocate-system-memory-at (system:int-sap #x20000000) #xc0000000))
45 wlott 1.7
46 ram 1.1
47     ;;; GET-SYSTEM-INFO -- Interface
48     ;;;
49     ;;; Return system time, user time and number of page faults. For
50     ;;; page-faults, we add pagein and pageout, since that is a somewhat more
51     ;;; interesting number than the total faults.
52     ;;;
53     (defun get-system-info ()
54 wlott 1.3 (multiple-value-bind (err? utime stime maxrss ixrss idrss
55     isrss minflt majflt)
56 wlott 1.4 (unix:unix-getrusage unix:rusage_self)
57 wlott 1.3 (declare (ignore maxrss ixrss idrss isrss minflt majflt))
58     (unless err?
59     (error "Unix system call getrusage failed: ~A."
60     (unix:get-unix-error-msg utime)))
61    
62     (multiple-value-bind (gr ps fc ac ic wc zf ra in ot)
63     (mach:vm_statistics *task-self*)
64     (declare (ignore ps fc ac ic wc zf ra))
65 wlott 1.5 (mach:gr-error 'mach:vm_statistics gr)
66 wlott 1.3
67     (values utime stime (+ in ot)))))
68 ram 1.1
69    
70     ;;; GET-PAGE-SIZE -- Interface
71     ;;;
72     ;;; Return the system page size.
73     ;;;
74     (defun get-page-size ()
75 wlott 1.6 (mach:gr-call* mach:vm_statistics *task-self*))
76 wlott 1.3

  ViewVC Help
Powered by ViewVC 1.1.5