<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Jun 28, 2014, at 4:24 AM, <a href="mailto:marwayusuf@feng.bu.edu.eg">marwayusuf@feng.bu.edu.eg</a> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div id="OWAFontStyleDivID" style="font-size: 12pt; background-color: rgb(255, 255, 255); font-family: Calibri, Arial, Helvetica, sans-serif; position: static; z-index: auto;"><div style="margin-top: 0px; margin-bottom: 0px;">Dear All<br></div><div style="margin-top: 0px; margin-bottom: 0px;">My MSc was about implementing some kind of On stack replacement in LLVM to enhance security by obfuscating running code periodically.<br></div><div style="margin-top: 0px; margin-bottom: 0px;">I've tried to implement this job in JIT, but I couldn't. So I implemented it in interpreter, as an initial step.<br></div><div style="margin-top: 0px; margin-bottom: 0px;">However, now I'm trying to make it in JIT.<br></div><div style="margin-top: 0px; margin-bottom: 0px;">My first step is to extract function state at an arbitrary point. So, I interrupt function at any point (from within JIT) and pause to extract state. My problem now is with state.<br></div><div style="margin-top: 0px; margin-bottom: 0px;">By searching I found about stackmap new intrinsic. I got idea about what it does and I think it may help greatly in my task. However, I could not find any source about how to use it exactly, specially, how to retrieve information stored in a stackmap. I'm not understanding the concept of intrinsics very well. Again, I tried to find any source that explains how intrinsic work, but I couldn't.<br></div><div style="margin-top: 0px; margin-bottom: 0px;">So, any help will be greatly appreciated.<br></div></div></div></blockquote><div><br></div><div><a href="http://llvm.org/docs/StackMaps.html">http://llvm.org/docs/StackMaps.html</a></div><div><br></div><div>The format of the stackmap section is defined in include/CodeGen/StackMaps.h. You currently have to intercept calls to RTDyldMemoryManager to find the stackmap section.</div><div><br></div><div>The intrinsics and stackmap format will probably change again before the next LLVM release.</div><div><br></div><div>You cannot arbitrarily stop a thread running compiled code and extract the state. You have to patch the code so that it calls back to your runtime at a known location. The stackmap intrinsic can be useful if you want to destrcutively patch the code and don't want control to resume in the JITed function. The patchpoint intrinsic works if you want to patch into the runtime and return back to the JIT function.</div><div><br></div><div>-Andy</div><div><br></div><blockquote type="cite"><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div id="OWAFontStyleDivID" style="font-size: 12pt; background-color: rgb(255, 255, 255); font-family: Calibri, Arial, Helvetica, sans-serif; position: static; z-index: auto;"><div style="margin-top: 0px; margin-bottom: 0px;"><br></div><div><div style="margin-top: 0px; margin-bottom: 0px;"><br></div><div class="BodyFragment"><font size="2"><span style="font-size: 10pt;"><div class="PlainText">Regards,<br>Marwa Yusuf<br>Teaching Assistant - Computer Engineering Department<br>Faculty of Engineering - Benha University<br>E-JUST MSc Student<br>Computer Science & Engineering Dept.</div></span></font></div></div></div>_______________________________________________<br>LLVM Developers mailing list<br><a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a><span class="Apple-converted-space"> </span> <a href="http://llvm.cs.uiuc.edu/">http://llvm.cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a></div></blockquote></div><br></body></html>