Making repo public * Add licensing details for limbo directory Create readme.md for disvm-exec project Fix code analysis violations/warnings * Update version to 'beta' - public release
Unified · Split
| @@ -0,0 +1,25 @@ | |||
| 1 | |||
| 2 | The following copyright notice covers the contents of this | ||
| 3 | directory, sub-directories, and files contents: | ||
| 4 | |||
| 5 | Inferno® Copyright © 1996-1999 Lucent Technologies Inc. All rights reserved. | ||
| 6 | Inferno revisions Copyright © 1997-1999 Vita Nuova Limited. All rights reserved. | ||
| 7 | Inferno revisions Copyright © 2000-2015 Vita Nuova Holdings Limited. All rights reserved. | ||
| 8 | Inferno new material Copyright © 2000-2015 Vita Nuova Holdings Limited. All rights reserved. | ||
| 9 | |||
| 10 | Inferno, Styx, Dis and Limbo are registered trademarks of Vita Nuova Holdings Limited in the USA and other countries. | ||
| 11 | Plan 9 is a registered trademark of Lucent Technologies Inc. | ||
| 12 | |||
| 13 | This program is free software; you can redistribute it and/or modify | ||
| 14 | it under the terms of the GNU General Public License (`GPL') as published by | ||
| 15 | the Free Software Foundation; either version 2 of the License, or | ||
| 16 | (at your option) any later version. | ||
| 17 | |||
| 18 | This program is distributed in the hope that it will be useful, | ||
| 19 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 21 | GNU General Public License for more details. | ||
| 22 | |||
| 23 | You should have received a copy of the GNU General Public License | ||
| 24 | along with this program; if not, write to the Free Software | ||
| 25 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| @@ -37,6 +37,8 @@ The source tree is as follows: · 36 unmodified lines | |||
| 37 | | `[PERF]` | Potential for performance improvement. | | 37 | | `[PERF]` | Potential for performance improvement. | |
| 38 | | `[PAL]` | Work that should be done in a platform abstraction layer (PAL). | | 38 | | `[PAL]` | Work that should be done in a platform abstraction layer (PAL). | |
| 39 | 39 | ||
| 40 | See `readme.md` or `license.txt` in source directories for further details or specific licensing. | ||
| 41 | |||
| 40 | # References | 42 | # References |
| 41 | 43 | ||
| 42 | Dis VM specification: http://www.vitanuova.com/inferno/papers/dis.html | 44 | Dis VM specification: http://www.vitanuova.com/inferno/papers/dis.html |
| @@ -47,6 +49,8 @@ Inferno OS - Original Dis VM implementation: https://bitbucket.org/inferno-os/in · 4 unmodified lines | |||
| 47 | 49 | ||
| 48 | # Licenses | 50 | # Licenses |
| 49 | 51 | ||
| 52 | See source directory for a `license.txt` that defines the license, otherwise licenses for the DisVM project are defined below. | ||
| 53 | |||
| 50 | ### [RFC1321](https://www.ietf.org/rfc/rfc1321.txt) ### | 54 | ### [RFC1321](https://www.ietf.org/rfc/rfc1321.txt) ### |
| 51 | 55 | ||
| 52 | Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All | 56 | Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All |
| @@ -80,3 +84,24 @@ The above copyright notice and this permission notice shall be included in all c · 27 unmodified lines | |||
| 80 | 84 | ||
| 81 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 85 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 82 | 86 | ||
| 87 | ### Unless otherwise stated in a `license.txt` or above - [MIT License](https://opensource.org/licenses/MIT) ### | ||
| 88 | |||
| 89 | Copyright (c) 2017 ARR | ||
| 90 | |||
| 91 | Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| 92 | of this software and associated documentation files (the "Software"), to deal | ||
| 93 | in the Software without restriction, including without limitation the rights | ||
| 94 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| 95 | copies of the Software, and to permit persons to whom the Software is | ||
| 96 | furnished to do so, subject to the following conditions: | ||
| 97 | |||
| 98 | The above copyright notice and this permission notice shall be included in all | ||
| 99 | copies or substantial portions of the Software. | ||
| 100 | |||
| 101 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 102 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 103 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| 104 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| 105 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| 106 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| 107 | SOFTWARE. | ||
| @@ -0,0 +1,16 @@ | |||
| 1 | disvm-exec | ||
| 2 | ======================== | ||
| 3 | |||
| 4 | Represents a command line example of using the DisVM. The resulting executable contains a | ||
| 5 | debugger with support loading to limbo symbol files (`.sbl`). The `disvm-exe` executable | ||
| 6 | expects the supplied module to implement the `Exec` contract defined in `limbo/Exec.m`. | ||
| 7 | |||
| 8 | Use the `-h` flag for details on how to use `disvm-exec`. | ||
| 9 | |||
| 10 | ## Examples | ||
| 11 | |||
| 12 | Compile `md5sum.b` limbo file and emit symbol file: | ||
| 13 | `disvm-exec -q limbo.dis -g md5sum.b` | ||
| 14 | |||
| 15 | Debug the compiled `md5sum.dis` module: | ||
| 16 | `disvm-exec -de md5sum.dis md5sum.b` | ||
| @@ -10,6 +10,6 @@ · 9 unmodified lines | |||
| 10 | #define DISVM_VERSION_MAJOR 1 | 10 | #define DISVM_VERSION_MAJOR 1 |
| 11 | #define DISVM_VERSION_MINOR 0 | 11 | #define DISVM_VERSION_MINOR 0 |
| 12 | #define DISVM_VERSION_PATCH 0 | 12 | #define DISVM_VERSION_PATCH 0 |
| 13 | #define DISVM_VERSION_LABEL "alpha" | 13 | #define DISVM_VERSION_LABEL "beta" |
| 14 | 14 | ||
| 15 | #endif // _DISVM_SRC_INCLUDE_VM_VERSION_H_ | 15 | #endif // _DISVM_SRC_INCLUDE_VM_VERSION_H_ |
| @@ -679,7 +679,7 @@ namespace · 678 unmodified lines | |||
| 679 | break; | 679 | break; |
| 680 | } | 680 | } |
| 681 | 681 | ||
| 682 | assert(0 <= static_cast<std::size_t>(target_pc) && static_cast<std::size_t>(target_pc) < r.module_ref->code_section.size()); | 682 | assert(0 <= target_pc && static_cast<std::size_t>(target_pc) < r.module_ref->code_section.size()); |
| 683 | r.next_pc = target_pc; | 683 | r.next_pc = target_pc; |
| 684 | } | 684 | } |
| 685 | 685 | ||
| @@ -598,7 +598,7 @@ Math_realbits32(vm_registers_t &r, vm_t &vm) · 597 unmodified lines | |||
| 598 | auto &fp = r.stack.peek_frame()->base<F_Math_realbits32>(); | 598 | auto &fp = r.stack.peek_frame()->base<F_Math_realbits32>(); |
| 599 | 599 | ||
| 600 | auto x = static_cast<float>(fp.x); | 600 | auto x = static_cast<float>(fp.x); |
| 601 | uint32_t t; | 601 | word_t t; |
| 602 | std::memcpy(&t, &x, sizeof(x)); | 602 | std::memcpy(&t, &x, sizeof(x)); |
| 603 | 603 | ||
| 604 | *fp.ret = t; | 604 | *fp.ret = t; |
| @@ -610,7 +610,7 @@ Math_realbits64(vm_registers_t &r, vm_t &vm) · 5 unmodified lines | |||
| 610 | auto &fp = r.stack.peek_frame()->base<F_Math_realbits64>(); | 610 | auto &fp = r.stack.peek_frame()->base<F_Math_realbits64>(); |
| 611 | 611 | ||
| 612 | auto x = fp.x; | 612 | auto x = fp.x; |
| 613 | uint64_t t; | 613 | big_t t; |
| 614 | std::memcpy(&t, &x, sizeof(x)); | 614 | std::memcpy(&t, &x, sizeof(x)); |
| 615 | static_assert(sizeof(t) == sizeof(x), "Real should be 64-bits"); | 615 | static_assert(sizeof(t) == sizeof(x), "Real should be 64-bits"); |
| 616 | 616 | ||
| @@ -84,12 +84,12 @@ word_t disvm::runtime::sys::printf_to_buffer( · 83 unmodified lines | |||
| 84 | case '*': // Placeholder for word argument | 84 | case '*': // Placeholder for word argument |
| 85 | { | 85 | { |
| 86 | const auto w = *reinterpret_cast<word_t *>(msg_args); | 86 | const auto w = *reinterpret_cast<word_t *>(msg_args); |
| 87 | std::array<char, sizeof("-2147483648")> buffer; | 87 | std::array<char, sizeof("-2147483648")> local_buffer; |
| 88 | const auto len = std::sprintf(buffer.data(), "%d", w); | 88 | const auto len = std::sprintf(local_buffer.data(), "%d", w); |
| 89 | if (len < 0) | 89 | if (len < 0) |
| 90 | return -1; | 90 | return -1; |
| 91 | 91 | ||
| 92 | format.insert(std::end(format), buffer.data(), buffer.data() + len); | 92 | format.insert(std::end(format), local_buffer.data(), local_buffer.data() + len); |
| 93 | msg_args += sizeof(w); | 93 | msg_args += sizeof(w); |
| 94 | continue; | 94 | continue; |
| 95 | } | 95 | } |
| @@ -172,7 +172,7 @@ word_t disvm::runtime::sys::printf_to_buffer( · 76 unmodified lines | |||
| 172 | type_alloc = alloc->alloc_type.get(); | 172 | type_alloc = alloc->alloc_type.get(); |
| 173 | } | 173 | } |
| 174 | 174 | ||
| 175 | wb = std::snprintf(b_curr, (b_end - b_curr), "%" PRIuPTR ".%#08" PRIxPTR, rc, reinterpret_cast<std::size_t>(type_alloc)); | 175 | wb = std::snprintf(b_curr, (b_end - b_curr), "%" PRIuPTR ".%#08" PRIxPTR, static_cast<std::uintptr_t>(rc), reinterpret_cast<std::uintptr_t>(type_alloc)); |
| 176 | msg_args += sizeof(p); | 176 | msg_args += sizeof(p); |
| 177 | break; | 177 | break; |
| 178 | } | 178 | } |
| @@ -95,7 +95,7 @@ std::size_t disvm::runtime::utf8::decode(const uint8_t *str, rune_t &codepoint) · 94 unmodified lines | |||
| 95 | curr++; | 95 | curr++; |
| 96 | state = utf8::decode_step(state, codepoint, c); | 96 | state = utf8::decode_step(state, codepoint, c); |
| 97 | if (state == utf8::decode_state_t::accept) | 97 | if (state == utf8::decode_state_t::accept) |
| 98 | return (curr - begin); | 98 | return static_cast<std::size_t>(curr - begin); |
| 99 | } | 99 | } |
| 100 | 100 | ||
| 101 | // Empty string | 101 | // Empty string |