Thu, 26 Jul 2018 17:38:44 -0400
8208183: update HSDIS plugin license to UPL
Reviewed-by: simonis, adinn, jrose
jrose@535 | 1 | /* |
minqi@4093 | 2 | * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. |
jrose@535 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
jrose@535 | 4 | * |
dbuck@9473 | 5 | * The Universal Permissive License (UPL), Version 1.0 |
jrose@535 | 6 | * |
dbuck@9473 | 7 | * Subject to the condition set forth below, permission is hereby granted to |
dbuck@9473 | 8 | * any person obtaining a copy of this software, associated documentation |
dbuck@9473 | 9 | * and/or data (collectively the "Software"), free of charge and under any |
dbuck@9473 | 10 | * and all copyright rights in the Software, and any and all patent rights |
dbuck@9473 | 11 | * owned or freely licensable by each licensor hereunder covering either (i) |
dbuck@9473 | 12 | * the unmodified Software as contributed to or provided by such licensor, |
dbuck@9473 | 13 | * or (ii) the Larger Works (as defined below), to deal in both |
jrose@535 | 14 | * |
dbuck@9473 | 15 | * (a) the Software, and |
dbuck@9473 | 16 | * |
dbuck@9473 | 17 | * (b) any piece of software and/or hardware listed in the lrgrwrks.txt file |
dbuck@9473 | 18 | * if one is included with the Software (each a “Larger Work” to which the |
dbuck@9473 | 19 | * Software is contributed by such licensors), |
dbuck@9473 | 20 | * |
dbuck@9473 | 21 | * without restriction, including without limitation the rights to copy, |
dbuck@9473 | 22 | * create derivative works of, display, perform, and distribute the Software |
dbuck@9473 | 23 | * and make, use, sell, offer for sale, import, export, have made, and have |
dbuck@9473 | 24 | * sold the Software and the Larger Work(s), and to sublicense the foregoing |
dbuck@9473 | 25 | * rights on either these or other terms. |
dbuck@9473 | 26 | * |
dbuck@9473 | 27 | * This license is subject to the following condition: |
dbuck@9473 | 28 | * |
dbuck@9473 | 29 | * The above copyright notice and either this complete permission notice or |
dbuck@9473 | 30 | * at a minimum a reference to the UPL must be included in all copies or |
dbuck@9473 | 31 | * substantial portions of the Software. |
dbuck@9473 | 32 | * |
dbuck@9473 | 33 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
dbuck@9473 | 34 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
dbuck@9473 | 35 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN |
dbuck@9473 | 36 | * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
dbuck@9473 | 37 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
dbuck@9473 | 38 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE |
dbuck@9473 | 39 | * USE OR OTHER DEALINGS IN THE SOFTWARE. |
jrose@535 | 40 | * |
trims@1907 | 41 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
trims@1907 | 42 | * or visit www.oracle.com if you need additional information or have any |
trims@1907 | 43 | * questions. |
jrose@535 | 44 | * |
jrose@535 | 45 | */ |
jrose@535 | 46 | |
jrose@535 | 47 | /* decode_instructions -- dump a range of addresses as native instructions |
jrose@535 | 48 | This implements the protocol required by the HotSpot PrintAssembly option. |
jrose@535 | 49 | |
minqi@4093 | 50 | The start_va, end_va is the virtual address the region of memory to |
minqi@4093 | 51 | disasemble and buffer contains the instructions to decode, |
minqi@4093 | 52 | Disassembling instructions in the current address space is done by |
minqi@4093 | 53 | having start_va == buffer. |
jrose@535 | 54 | |
jrose@535 | 55 | The option string, if not empty, is interpreted by the disassembler implementation. |
jrose@535 | 56 | |
jrose@535 | 57 | The printf callback is 'fprintf' or any other workalike. |
jrose@535 | 58 | It is called as (*printf_callback)(printf_stream, "some format...", some, format, args). |
jrose@535 | 59 | |
jrose@535 | 60 | The event callback receives an event tag (a string) and an argument (a void*). |
jrose@535 | 61 | It is called as (*event_callback)(event_stream, "tag", arg). |
jrose@535 | 62 | |
jrose@535 | 63 | Events: |
jrose@535 | 64 | <insn pc='%p'> begin an instruction, at a given location |
jrose@535 | 65 | </insn pc='%d'> end an instruction, at a given location |
jrose@535 | 66 | <addr value='%p'/> emit the symbolic value of an address |
jrose@535 | 67 | |
jrose@535 | 68 | A tag format is one of three basic forms: "tag", "/tag", "tag/", |
jrose@535 | 69 | where tag is a simple identifier, signifying (as in XML) a element start, |
jrose@535 | 70 | element end, and standalone element. (To render as XML, add angle brackets.) |
jrose@535 | 71 | */ |
minqi@4244 | 72 | #ifndef SHARED_TOOLS_HSDIS_H |
minqi@4244 | 73 | #define SHARED_TOOLS_HSDIS_H |
minqi@4244 | 74 | |
jrose@535 | 75 | extern |
jrose@535 | 76 | #ifdef DLL_EXPORT |
jrose@535 | 77 | DLL_EXPORT |
jrose@535 | 78 | #endif |
minqi@4093 | 79 | void* decode_instructions_virtual(uintptr_t start_va, uintptr_t end_va, |
minqi@4093 | 80 | unsigned char* buffer, uintptr_t length, |
minqi@4093 | 81 | void* (*event_callback)(void*, const char*, void*), |
minqi@4093 | 82 | void* event_stream, |
minqi@4093 | 83 | int (*printf_callback)(void*, const char*, ...), |
minqi@4093 | 84 | void* printf_stream, |
minqi@4244 | 85 | const char* options, |
minqi@4244 | 86 | int newline /* bool value for nice new line */); |
minqi@4244 | 87 | |
minqi@4244 | 88 | /* This is the compatability interface for older versions of hotspot */ |
minqi@4244 | 89 | extern |
minqi@4244 | 90 | #ifdef DLL_ENTRY |
minqi@4244 | 91 | DLL_ENTRY |
minqi@4244 | 92 | #endif |
minqi@4244 | 93 | void* decode_instructions(void* start_pv, void* end_pv, |
minqi@4244 | 94 | void* (*event_callback)(void*, const char*, void*), |
minqi@4244 | 95 | void* event_stream, |
minqi@4244 | 96 | int (*printf_callback)(void*, const char*, ...), |
minqi@4244 | 97 | void* printf_stream, |
minqi@4244 | 98 | const char* options); |
jrose@535 | 99 | |
jrose@535 | 100 | /* convenience typedefs */ |
jrose@535 | 101 | |
jrose@535 | 102 | typedef void* (*decode_instructions_event_callback_ftype) (void*, const char*, void*); |
jrose@535 | 103 | typedef int (*decode_instructions_printf_callback_ftype) (void*, const char*, ...); |
minqi@4244 | 104 | typedef void* (*decode_func_vtype) (uintptr_t start_va, uintptr_t end_va, |
minqi@4244 | 105 | unsigned char* buffer, uintptr_t length, |
minqi@4244 | 106 | decode_instructions_event_callback_ftype event_callback, |
minqi@4244 | 107 | void* event_stream, |
minqi@4244 | 108 | decode_instructions_printf_callback_ftype printf_callback, |
minqi@4244 | 109 | void* printf_stream, |
minqi@4244 | 110 | const char* options, |
minqi@4244 | 111 | int newline); |
minqi@4244 | 112 | typedef void* (*decode_func_stype) (void* start_pv, void* end_pv, |
minqi@4244 | 113 | decode_instructions_event_callback_ftype event_callback, |
minqi@4244 | 114 | void* event_stream, |
minqi@4244 | 115 | decode_instructions_printf_callback_ftype printf_callback, |
minqi@4244 | 116 | void* printf_stream, |
minqi@4244 | 117 | const char* options); |
minqi@4244 | 118 | #endif /* SHARED_TOOLS_HSDIS_H */ |