Changeset 12906
- Timestamp:
- Oct 4, 2009, 6:41:08 PM (15 years ago)
- File:
-
- 1 edited
-
branches/watchpoints/lib/misc.lisp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/watchpoints/lib/misc.lisp
r12885 r12906 1065 1065 (return-from unwatch (%unwatch thing new))))) 1066 1066 area-watched area-watched)) 1067 1068 ;;; These functions would seem to belong somewhere else. 1067 1069 1070 ;; This will work only if the uvector is in a static gc area. 1071 (defun %uvector-index-for-address (uvector address) 1072 (let* ((size (uvsize uvector)) 1073 (nbytes (if (ivectorp uvector) 1074 (subtag-bytes (typecode uvector) size) 1075 (* size target::node-size))) 1076 (bytes-per-element (/ nbytes size)) 1077 (noderef (logandc2 (%address-of uvector) 1078 target::fulltagmask)) 1079 (offset (- address (+ noderef target::node-size))) 1080 (index (/ offset bytes-per-element))) 1081 index)) 1082 1083 (defun x86-imm-reg-p (reg-num) 1084 (member reg-num (list x8664::imm0 x8664::imm1 x8664::imm2 1085 x8664::imm0.l x8664::imm0.l x8664::imm2.l 1086 x8664::imm0.w x8664::imm0.w x8664::imm2.w 1087 x8664::imm0.b x8664::imm0.b x8664::imm2.b))) 1088 1089 ;;; Try to emulate the instruction. Returns true on success, 1090 ;;; NIL on failure. If dest isn't in a static area, we will lose... 1091 (defun x86-emulate-write-instruction (xp insn addr dest) 1092 (let ((op0 (x86-di-op0 insn))) 1093 (unless (and (typep op0 'x86::x86-register-operand) 1094 (string= (subseq (x86-di-mnemonic insn) 0 3) "mov")) 1095 (return-from x86-emulate-write-instruction nil)) 1096 (let* ((reg-entry (x86::x86-register-operand-entry op0)) 1097 (reg-num (x86::reg-entry-reg-num reg-entry))) 1098 (if (uvectorp dest) 1099 (cond ((gvectorp dest) 1100 (let* ((src (encoded-gpr-lisp xp reg-num)) 1101 (index (%uvector-index-for-address dest addr))) 1102 (if (fixnump index) 1103 (setf (uvref dest index) src)))) 1104 ((ivectorp dest) 1105 (let* ((src (if (x86-imm-reg-p reg-num) 1106 (encoded-gpr-integer xp reg-num) 1107 (encoded-gpr-lisp xp reg-num))) 1108 (index (%uvector-index-for-address dest addr))) 1109 (if (fixnump index) 1110 (setf (uvref dest index) src)) 1111 (setq src (encoded-gpr-lisp xp reg-num))))) 1112 (if (consp dest) 1113 (let* ((src (encoded-gpr-lisp xp reg-num))) 1114 (if (= addr (+ (%address-of dest) target::cons.cdr)) 1115 (rplacd dest src) 1116 (if (= addr (+ (%address-of dest) target::cons.car)) 1117 (rplaca dest src)))))))))
Note:
See TracChangeset
for help on using the changeset viewer.
