1 /* src/vm/jit/x86_64/patcher.c - x86_64 code patching functions
3 Copyright (C) 1996-2005 R. Grafl, A. Krall, C. Kruegel, C. Oates,
4 R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
5 C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
6 Institut f. Computersprachen - TU Wien
8 This file is part of CACAO.
10 This program is free software; you can redistribute it and/or
11 modify it under the terms of the GNU General Public License as
12 published by the Free Software Foundation; either version 2, or (at
13 your option) any later version.
15 This program is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
25 Contact: cacao@complang.tuwien.ac.at
27 Authors: Christian Thalinger
31 $Id: patcher.c 2651 2005-06-13 14:02:52Z twisti $
36 #include "vm/jit/x86_64/types.h"
38 #include "mm/memory.h"
39 #include "native/native.h"
40 #include "vm/builtin.h"
41 #include "vm/exceptions.h"
43 #include "vm/initialize.h"
44 #include "vm/options.h"
45 #include "vm/references.h"
46 #include "vm/jit/helper.h"
47 #include "vm/jit/patcher.h"
50 bool helper_initialize_class(void* beginOfJavaStack,classinfo *c,u1 *ra)
52 if (!c->initialized) {
53 native_stackframeinfo sfi;
56 /* more or less the same as the above sfi setup is done in the assembler code by the prepare/remove functions*/
57 sfi.returnToFromNative = (functionptr) (ptrint) ra;
58 sfi.beginOfJavaStackframe = beginOfJavaStack;
59 sfi.method = NULL; /*internal*/
60 sfi.addressOfThreadspecificHead = builtin_asm_get_stackframeinfo();
61 sfi.oldThreadspecificHeadValue = *(sfi.addressOfThreadspecificHead);
62 *(sfi.addressOfThreadspecificHead) = &sfi;
64 /*printf("calling static initializer (helper_initialize_class), returnaddress=%p for class %s\n",ra,c->name->text);*/
66 init=initialize_class(c);
68 *(sfi.addressOfThreadspecificHead) = sfi.oldThreadspecificHeadValue;
78 /* patcher_get_putstatic *******************************************************
82 <patched call position>
83 4d 8b 15 86 fe ff ff mov -378(%rip),%r10
85 *******************************************************************************/
87 bool patcher_get_putstatic(u1 *sp)
97 /* get stuff from the stack */
99 ra = (u1 *) *((ptrint *) (sp + 3 * 8));
100 o = (java_objectheader *) *((ptrint *) (sp + 2 * 8));
101 mcode = *((u8 *) (sp + 1 * 8));
102 uf = (unresolved_field *) *((ptrint *) (sp + 0 * 8));
104 beginJavaStack= (void*)(sp + 3 * 8);
106 /* calculate and set the new return address */
109 *((ptrint *) (sp + 3 * 8)) = (ptrint) ra;
111 PATCHER_MONITORENTER;
113 /* get the fieldinfo */
115 if (!(fi = helper_resolve_fieldinfo(uf))) {
121 /* check if the field's class is initialized */
123 if (!helper_initialize_class(beginJavaStack, fi->class, ra + 5)) {
129 /* patch back original code */
131 *((u8 *) ra) = mcode;
133 /* if we show disassembly, we have to skip the nop's */
138 /* get RIP offset from machine instruction */
140 offset = *((u4 *) (ra + 3));
142 /* patch the field value's address (+ 7: is the size of the RIP move) */
144 *((ptrint *) (ra + 7 + offset)) = (ptrint) &(fi->value);
146 PATCHER_MARK_PATCHED_MONITOREXIT;
152 /* patcher_get_putfield ********************************************************
156 <patched call position>
157 45 8b 8f 00 00 00 00 mov 0x0(%r15),%r9d
159 *******************************************************************************/
161 bool patcher_get_putfield(u1 *sp)
164 java_objectheader *o;
166 unresolved_field *uf;
169 /* get stuff from the stack */
171 ra = (u1 *) *((ptrint *) (sp + 3 * 8));
172 o = (java_objectheader *) *((ptrint *) (sp + 2 * 8));
173 mcode = *((u8 *) (sp + 1 * 8));
174 uf = (unresolved_field *) *((ptrint *) (sp + 0 * 8));
176 /* calculate and set the new return address */
179 *((ptrint *) (sp + 3 * 8)) = (ptrint) ra;
181 PATCHER_MONITORENTER;
183 /* get the fieldinfo */
185 if (!(fi = helper_resolve_fieldinfo(uf))) {
191 /* patch back original code */
193 *((u8 *) ra) = mcode;
195 /* if we show disassembly, we have to skip the nop's */
200 /* patch the field's offset: we check for the field type, because the */
201 /* instructions have different lengths */
203 if (IS_FLT_DBL_TYPE(fi->type)) {
204 *((u4 *) (ra + 5)) = (u4) (fi->offset);
209 /* check for special case: %rsp or %r12 as base register */
214 *((u4 *) (ra + 4)) = (u4) (fi->offset);
216 *((u4 *) (ra + 3)) = (u4) (fi->offset);
219 PATCHER_MARK_PATCHED_MONITOREXIT;
225 /* patcher_putfieldconst *******************************************************
229 <patched call position>
230 49 c7 87 10 00 00 00 00 00 00 00 movq $0x0,0x10(%r15)
232 *******************************************************************************/
234 bool patcher_putfieldconst(u1 *sp)
237 java_objectheader *o;
239 unresolved_field *uf;
242 /* get stuff from the stack */
244 ra = (u1 *) *((ptrint *) (sp + 3 * 8));
245 o = (java_objectheader *) *((ptrint *) (sp + 2 * 8));
246 mcode = *((u8 *) (sp + 1 * 8));
247 uf = (unresolved_field *) *((ptrint *) (sp + 0 * 8));
249 /* calculate and set the new return address */
252 *((ptrint *) (sp + 3 * 8)) = (ptrint) ra;
254 PATCHER_MONITORENTER;
256 /* get the fieldinfo */
258 if (!(fi = helper_resolve_fieldinfo(uf))) {
264 /* patch back original code */
266 *((u8 *) ra) = mcode;
268 /* if we show disassembly, we have to skip the nop's */
273 /* handle special case when the base register is %r12 */
275 if (*(ra + 2) == 0x84)
278 /* patch the field's offset */
280 if (IS_2_WORD_TYPE(fi->type) || IS_ADR_TYPE(fi->type)) {
281 *((u4 *) (ra + 3)) = (u4) (fi->offset);
282 *((u4 *) (ra + 11 + 3)) = (u4) (fi->offset + 4);
285 *((u4 *) (ra + 3)) = (u4) (fi->offset);
288 PATCHER_MARK_PATCHED_MONITOREXIT;
294 /* patcher_builtin_new *********************************************************
298 48 bf a0 f0 92 00 00 00 00 00 mov $0x92f0a0,%rdi
299 <patched call position>
300 48 b8 00 00 00 00 00 00 00 00 mov $0x0,%rax
303 *******************************************************************************/
305 bool patcher_builtin_new(u1 *sp)
308 java_objectheader *o;
310 constant_classref *cr;
312 void *beginJavaStack;
313 /* get stuff from the stack */
315 ra = (u1 *) *((ptrint *) (sp + 3 * 8));
316 o = (java_objectheader *) *((ptrint *) (sp + 2 * 8));
317 mcode = *((u8 *) (sp + 1 * 8));
318 cr = (constant_classref *) *((ptrint *) (sp + 0 * 8));
319 beginJavaStack = (void*) (sp+3*8);
321 /* calculate and set the new return address */
324 *((ptrint *) (sp + 3 * 8)) = (ptrint) ra;
326 PATCHER_MONITORENTER;
328 /* get the classinfo */
330 if (!(c = helper_resolve_classinfo(cr))) {
336 if (!helper_initialize_class(beginJavaStack, c, ra + 5)) {
342 /* patch back original code */
344 *((u8 *) (ra + 10)) = mcode;
346 /* patch the classinfo pointer */
348 *((ptrint *) (ra + 2)) = (ptrint) c;
350 /* if we show disassembly, we have to skip the nop's */
355 /* patch new function address */
357 *((ptrint *) (ra + 10 + 2)) = (ptrint) BUILTIN_new;
359 PATCHER_MARK_PATCHED_MONITOREXIT;
365 /* patcher_builtin_newarray ****************************************************
369 48 be 88 13 9b 00 00 00 00 00 mov $0x9b1388,%rsi
370 <patched call position>
371 48 b8 00 00 00 00 00 00 00 00 mov $0x0,%rax
374 *******************************************************************************/
376 bool patcher_builtin_newarray(u1 *sp)
379 java_objectheader *o;
381 constant_classref *cr;
384 /* get stuff from the stack */
386 ra = (u1 *) *((ptrint *) (sp + 3 * 8));
387 o = (java_objectheader *) *((ptrint *) (sp + 2 * 8));
388 mcode = *((u8 *) (sp + 1 * 8));
389 cr = (constant_classref *) *((ptrint *) (sp + 0 * 8));
391 /* calculate and set the new return address */
394 *((ptrint *) (sp + 3 * 8)) = (ptrint) ra;
396 PATCHER_MONITORENTER;
398 /* get the classinfo */
400 if (!(c = helper_resolve_classinfo(cr))) {
406 /* patch back original code */
408 *((u8 *) (ra + 10)) = mcode;
410 /* patch the class' vftbl pointer */
412 *((ptrint *) (ra + 2)) = (ptrint) c->vftbl;
414 /* if we show disassembly, we have to skip the nop's */
419 /* patch new function address */
421 *((ptrint *) (ra + 10 + 2)) = (ptrint) BUILTIN_newarray;
423 PATCHER_MARK_PATCHED_MONITOREXIT;
429 /* patcher_builtin_multianewarray **********************************************
433 <patched call position>
434 48 bf 02 00 00 00 00 00 00 00 mov $0x2,%rdi
435 48 be 30 40 b2 00 00 00 00 00 mov $0xb24030,%rsi
436 48 89 e2 mov %rsp,%rdx
437 48 b8 7c 96 4b 00 00 00 00 00 mov $0x4b967c,%rax
440 *******************************************************************************/
442 bool patcher_builtin_multianewarray(u1 *sp)
445 java_objectheader *o;
447 constant_classref *cr;
450 /* get stuff from the stack */
452 ra = (u1 *) *((ptrint *) (sp + 3 * 8));
453 o = (java_objectheader *) *((ptrint *) (sp + 2 * 8));
454 mcode = *((u8 *) (sp + 1 * 8));
455 cr = (constant_classref *) *((ptrint *) (sp + 0 * 8));
457 /* calculate and set the new return address */
460 *((ptrint *) (sp + 3 * 8)) = (ptrint) ra;
462 PATCHER_MONITORENTER;
464 /* get the classinfo */
466 if (!(c = helper_resolve_classinfo(cr))) {
472 /* patch back original code */
474 *((u8 *) ra) = mcode;
476 /* if we show disassembly, we have to skip the nop's */
481 /* patch the class' vftbl pointer */
483 *((ptrint *) (ra + 10 + 2)) = (ptrint) c->vftbl;
485 /* patch new function address */
487 *((ptrint *) (ra + 10 + 10 + 3 + 2)) = (ptrint) BUILTIN_multianewarray;
489 PATCHER_MARK_PATCHED_MONITOREXIT;
495 /* patcher_builtin_arraycheckcast **********************************************
499 48 be b8 3f b2 00 00 00 00 00 mov $0xb23fb8,%rsi
500 <patched call position>
501 48 b8 00 00 00 00 00 00 00 00 mov $0x0,%rax
504 *******************************************************************************/
506 bool patcher_builtin_arraycheckcast(u1 *sp)
509 java_objectheader *o;
511 constant_classref *cr;
514 /* get stuff from the stack */
516 ra = (u1 *) *((ptrint *) (sp + 3 * 8));
517 o = (java_objectheader *) *((ptrint *) (sp + 2 * 8));
518 mcode = *((u8 *) (sp + 1 * 8));
519 cr = (constant_classref *) *((ptrint *) (sp + 0 * 8));
521 /* calculate and set the new return address */
524 *((ptrint *) (sp + 3 * 8)) = (ptrint) ra;
526 PATCHER_MONITORENTER;
528 /* get the classinfo */
530 if (!(c = helper_resolve_classinfo(cr))) {
536 /* patch back original code */
538 *((u8 *) (ra + 10)) = mcode;
540 /* patch the class' vftbl pointer */
542 *((ptrint *) (ra + 2)) = (ptrint) c->vftbl;
544 /* if we show disassembly, we have to skip the nop's */
549 /* patch new function address */
551 *((ptrint *) (ra + 10 + 2)) = (ptrint) BUILTIN_arraycheckcast;
553 PATCHER_MARK_PATCHED_MONITOREXIT;
559 /* patcher_builtin_arrayinstanceof *********************************************
563 48 be 30 3c b2 00 00 00 00 00 mov $0xb23c30,%rsi
564 <patched call position>
565 48 b8 00 00 00 00 00 00 00 00 mov $0x0,%rax
568 *******************************************************************************/
570 bool patcher_builtin_arrayinstanceof(u1 *sp)
573 java_objectheader *o;
575 constant_classref *cr;
578 /* get stuff from the stack */
580 ra = (u1 *) *((ptrint *) (sp + 3 * 8));
581 o = (java_objectheader *) *((ptrint *) (sp + 2 * 8));
582 mcode = *((u8 *) (sp + 1 * 8));
583 cr = (constant_classref *) *((ptrint *) (sp + 0 * 8));
585 /* calculate and set the new return address */
588 *((ptrint *) (sp + 3 * 8)) = (ptrint) ra;
590 PATCHER_MONITORENTER;
592 /* get the classinfo */
594 if (!(c = helper_resolve_classinfo(cr))) {
600 /* patch back original code */
602 *((u8 *) (ra + 10)) = mcode;
604 /* patch the class' vftbl pointer */
606 *((ptrint *) (ra + 2)) = (ptrint) c->vftbl;
608 /* if we show disassembly, we have to skip the nop's */
613 /* patch new function address */
615 *((ptrint *) (ra + 10 + 2)) = (ptrint) BUILTIN_arrayinstanceof;
617 PATCHER_MARK_PATCHED_MONITOREXIT;
623 /* patcher_invokestatic_special ************************************************
627 *******************************************************************************/
629 bool patcher_invokestatic_special(u1 *sp)
632 java_objectheader *o;
634 unresolved_method *um;
637 /* get stuff from the stack */
639 ra = (u1 *) *((ptrint *) (sp + 3 * 8));
640 o = (java_objectheader *) *((ptrint *) (sp + 2 * 8));
641 mcode = *((u8 *) (sp + 1 * 8));
642 um = (unresolved_method *) *((ptrint *) (sp + 0 * 8));
644 /* calculate and set the new return address */
647 *((ptrint *) (sp + 3 * 8)) = (ptrint) ra;
649 PATCHER_MONITORENTER;
651 /* get the fieldinfo */
653 if (!(m = helper_resolve_methodinfo(um))) {
658 /* patch back original code */
660 *((u8 *) ra) = mcode;
662 /* if we show disassembly, we have to skip the nop's */
667 /* patch stubroutine */
669 *((ptrint *) (ra + 2)) = (ptrint) m->stubroutine;
671 PATCHER_MARK_PATCHED_MONITOREXIT;
677 /* patcher_invokevirtual *******************************************************
681 *******************************************************************************/
683 bool patcher_invokevirtual(u1 *sp)
686 java_objectheader *o;
688 unresolved_method *um;
691 /* get stuff from the stack */
693 ra = (u1 *) *((ptrint *) (sp + 3 * 8));
694 o = (java_objectheader *) *((ptrint *) (sp + 2 * 8));
695 mcode = *((u8 *) (sp + 1 * 8));
696 um = (unresolved_method *) *((ptrint *) (sp + 0 * 8));
698 /* calculate and set the new return address */
701 *((ptrint *) (sp + 3 * 8)) = (ptrint) ra;
703 PATCHER_MONITORENTER;
705 /* get the fieldinfo */
707 if (!(m = helper_resolve_methodinfo(um))) {
713 /* patch back original code */
715 *((u8 *) ra) = mcode;
717 /* if we show disassembly, we have to skip the nop's */
722 /* patch vftbl index */
724 *((s4 *) (ra + 3 + 3)) = (s4) (OFFSET(vftbl_t, table[0]) +
725 sizeof(methodptr) * m->vftblindex);
727 PATCHER_MARK_PATCHED_MONITOREXIT;
733 /* patcher_invokeinterface *****************************************************
737 *******************************************************************************/
739 bool patcher_invokeinterface(u1 *sp)
742 java_objectheader *o;
744 unresolved_method *um;
747 /* get stuff from the stack */
749 ra = (u1 *) *((ptrint *) (sp + 3 * 8));
750 o = (java_objectheader *) *((ptrint *) (sp + 2 * 8));
751 mcode = *((u8 *) (sp + 1 * 8));
752 um = (unresolved_method *) *((ptrint *) (sp + 0 * 8));
754 /* calculate and set the new return address */
757 *((ptrint *) (sp + 3 * 8)) = (ptrint) ra;
759 PATCHER_MONITORENTER;
761 /* get the fieldinfo */
763 if (!(m = helper_resolve_methodinfo(um))) {
769 /* patch back original code */
771 *((u8 *) ra) = mcode;
773 /* if we show disassembly, we have to skip the nop's */
778 /* patch interfacetable index */
780 *((s4 *) (ra + 3 + 3)) = (s4) (OFFSET(vftbl_t, interfacetable[0]) -
781 sizeof(methodptr) * m->class->index);
783 /* patch method offset */
785 *((s4 *) (ra + 3 + 7 + 3)) =
786 (s4) (sizeof(methodptr) * (m - m->class->methods));
788 PATCHER_MARK_PATCHED_MONITOREXIT;
794 /* patcher_checkcast_instanceof_flags ******************************************
798 *******************************************************************************/
800 bool patcher_checkcast_instanceof_flags(u1 *sp)
803 java_objectheader *o;
805 constant_classref *cr;
808 /* get stuff from the stack */
810 ra = (u1 *) *((ptrint *) (sp + 3 * 8));
811 o = (java_objectheader *) *((ptrint *) (sp + 2 * 8));
812 mcode = *((u8 *) (sp + 1 * 8));
813 cr = (constant_classref *) *((ptrint *) (sp + 0 * 8));
815 /* calculate and set the new return address */
818 *((ptrint *) (sp + 3 * 8)) = (ptrint) ra;
820 PATCHER_MONITORENTER;
822 /* get the fieldinfo */
824 if (!(c = helper_resolve_classinfo(cr))) {
830 /* patch back original code */
832 *((u8 *) ra) = mcode;
834 /* if we show disassembly, we have to skip the nop's */
839 /* patch class flags */
841 *((s4 *) (ra + 2)) = (s4) c->flags;
843 PATCHER_MARK_PATCHED_MONITOREXIT;
849 /* patcher_checkcast_instanceof_interface **************************************
853 *******************************************************************************/
855 bool patcher_checkcast_instanceof_interface(u1 *sp)
858 java_objectheader *o;
860 constant_classref *cr;
863 /* get stuff from the stack */
865 ra = (u1 *) *((ptrint *) (sp + 3 * 8));
866 o = (java_objectheader *) *((ptrint *) (sp + 2 * 8));
867 mcode = *((u8 *) (sp + 1 * 8));
868 cr = (constant_classref *) *((ptrint *) (sp + 0 * 8));
870 /* calculate and set the new return address */
873 *((ptrint *) (sp + 3 * 8)) = (ptrint) ra;
875 PATCHER_MONITORENTER;
877 /* get the fieldinfo */
879 if (!(c = helper_resolve_classinfo(cr))) {
885 /* patch back original code */
887 *((u8 *) ra) = mcode;
889 /* if we show disassembly, we have to skip the nop's */
894 /* patch super class index */
896 *((s4 *) (ra + 7 + 3)) = (s4) c->index;
898 *((s4 *) (ra + 7 + 7 + 3 + 6 + 3)) =
899 (s4) (OFFSET(vftbl_t, interfacetable[0]) -
900 c->index * sizeof(methodptr*));
902 PATCHER_MARK_PATCHED_MONITOREXIT;
908 /* patcher_checkcast_class *****************************************************
912 *******************************************************************************/
914 bool patcher_checkcast_class(u1 *sp)
917 java_objectheader *o;
919 constant_classref *cr;
922 /* get stuff from the stack */
924 ra = (u1 *) *((ptrint *) (sp + 3 * 8));
925 o = (java_objectheader *) *((ptrint *) (sp + 2 * 8));
926 mcode = *((u8 *) (sp + 1 * 8));
927 cr = (constant_classref *) *((ptrint *) (sp + 0 * 8));
929 /* calculate and set the new return address */
932 *((ptrint *) (sp + 3 * 8)) = (ptrint) ra;
934 PATCHER_MONITORENTER;
936 /* get the fieldinfo */
938 if (!(c = helper_resolve_classinfo(cr))) {
944 /* patch back original code */
946 *((u8 *) ra) = mcode;
948 /* if we show disassembly, we have to skip the nop's */
953 /* patch super class' vftbl */
955 *((ptrint *) (ra + 2)) = (ptrint) c->vftbl;
956 *((ptrint *) (ra + 10 + 7 + 7 + 3 + 2)) = (ptrint) c->vftbl;
958 PATCHER_MARK_PATCHED_MONITOREXIT;
964 /* patcher_instanceof_class ****************************************************
968 *******************************************************************************/
970 bool patcher_instanceof_class(u1 *sp)
973 java_objectheader *o;
975 constant_classref *cr;
978 /* get stuff from the stack */
980 ra = (u1 *) *((ptrint *) (sp + 3 * 8));
981 o = (java_objectheader *) *((ptrint *) (sp + 2 * 8));
982 mcode = *((u8 *) (sp + 1 * 8));
983 cr = (constant_classref *) *((ptrint *) (sp + 0 * 8));
985 /* calculate and set the new return address */
988 *((ptrint *) (sp + 3 * 8)) = (ptrint) ra;
990 PATCHER_MONITORENTER;
992 /* get the fieldinfo */
994 if (!(c = helper_resolve_classinfo(cr))) {
1000 /* patch back original code */
1002 *((u8 *) ra) = mcode;
1004 /* if we show disassembly, we have to skip the nop's */
1006 if (showdisassemble)
1009 /* patch super class' vftbl */
1011 *((ptrint *) (ra + 2)) = (ptrint) c->vftbl;
1013 PATCHER_MARK_PATCHED_MONITOREXIT;
1019 /* patcher_clinit **************************************************************
1023 *******************************************************************************/
1025 bool patcher_clinit(u1 *sp)
1028 java_objectheader *o;
1031 void *beginJavaStack;
1033 /* get stuff from the stack */
1035 ra = (u1 *) *((ptrint *) (sp + 3 * 8));
1036 o = (java_objectheader *) *((ptrint *) (sp + 2 * 8));
1037 mcode = *((u8 *) (sp + 1 * 8));
1038 c = (classinfo *) *((ptrint *) (sp + 0 * 8));
1040 beginJavaStack = (void*) (sp + 3 * 8);
1042 /* calculate and set the new return address */
1045 *((ptrint *) (sp + 3 * 8)) = (ptrint) ra;
1047 PATCHER_MONITORENTER;
1049 /* check if the class is initialized */
1051 if (!helper_initialize_class(beginJavaStack, c, ra + 5)) {
1052 PATCHER_MONITOREXIT;
1057 /* patch back original code */
1059 *((u8 *) ra) = mcode;
1061 PATCHER_MARK_PATCHED_MONITOREXIT;
1067 /* patcher_resolve_native ******************************************************
1071 *******************************************************************************/
1073 bool patcher_resolve_native(u1 *sp)
1076 java_objectheader *o;
1080 void *beginJavaStack;
1082 /* get stuff from the stack */
1084 ra = (u1 *) *((ptrint *) (sp + 3 * 8));
1085 o = (java_objectheader *) *((ptrint *) (sp + 2 * 8));
1086 mcode = *((u8 *) (sp + 1 * 8));
1087 m = (methodinfo *) *((ptrint *) (sp + 0 * 8));
1089 beginJavaStack = (void*) (sp + 3 * 8);
1091 /* calculate and set the new return address */
1094 *((ptrint *) (sp + 3 * 8)) = (ptrint) ra;
1096 PATCHER_MONITORENTER;
1098 /* resolve native function */
1100 if (!(f = native_resolve_function(m))) {
1101 PATCHER_MONITOREXIT;
1106 /* patch back original code */
1108 *((u8 *) ra) = mcode;
1110 /* if we show disassembly, we have to skip the nop's */
1112 if (showdisassemble)
1115 /* patch native function pointer */
1117 *((ptrint *) (ra + 2)) = (ptrint) f;
1119 PATCHER_MARK_PATCHED_MONITOREXIT;
1126 * These are local overrides for various environment variables in Emacs.
1127 * Please do not remove this and leave it at the end of the file, where
1128 * Emacs will automagically detect them.
1129 * ---------------------------------------------------------------------
1132 * indent-tabs-mode: t
1136 * vim:noexpandtab:sw=4:ts=4: