Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
105 changed files
with
47,133 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Copyright (c) 2012 Tommi Pisto | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env node | ||
var path = require('path'); | ||
var fs = require('fs'); | ||
var lib = path.join(path.dirname(fs.realpathSync(__filename)), '../lib'); | ||
var parser = require(lib + '/pasm/pasm.js').parser; | ||
var arg = process.argv.splice(2); | ||
|
||
var input = fs.readFileSync(arg[0],'utf-8'); | ||
var res = parser.parse(input); | ||
|
||
// Get filename | ||
fn = arg[0].split('.'); | ||
fileName = fn[0]; | ||
|
||
// Write binary file | ||
var buff = new Buffer(res.data, 'hex'); | ||
fs.writeFile(fileName, buff, function (err) { | ||
if (err) throw err; | ||
console.log('Wrote ' + buff.length + " byte" + (buff.length > 1 ? 's' : '') + ' to \'' + fileName + '\'.' ); | ||
}); |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,170 @@ | ||
body { | ||
margin-right: 40px; | ||
} | ||
|
||
.section { | ||
float: left; | ||
width: 50%; | ||
} | ||
.activeline { | ||
background: #444 !important; | ||
} | ||
.byte { | ||
width: 10px; | ||
height: 10px; | ||
cursor: pointer; | ||
display: inline; | ||
} | ||
.highlight-byte{ | ||
background-color: #99ff99; | ||
} | ||
#error { | ||
width: 100%; | ||
height: 50px; | ||
font-size: 12px; | ||
font-family: monospace; | ||
padding: 12px; | ||
border: 1px solid #aaa; | ||
background-color: #fee; | ||
margin-bottom: 12px; | ||
margin-top: 12px; | ||
} | ||
|
||
#bytecode { | ||
font-family: monospace; | ||
width: 386px; | ||
margin-right: 12px; | ||
margin-left: 24px; | ||
} | ||
|
||
#details { | ||
width: 100%; | ||
font-family: monospace; | ||
padding: 12px; | ||
height: 100px; | ||
margin-top: -12px; | ||
|
||
border: 1px solid #eee; | ||
background-color: #eee; | ||
} | ||
|
||
.details-table { | ||
float: left; | ||
margin-right: 12px; | ||
} | ||
|
||
.table-header { | ||
display: block; | ||
font-size: 10px; | ||
padding-bottom: 5px; | ||
padding-top: 5px; | ||
font-family: Arial; | ||
} | ||
|
||
.inner-header { | ||
font-size: 10px; | ||
font-family: Arial; | ||
} | ||
|
||
table { | ||
margin: 0px; | ||
border-collapse: collapse; | ||
box-shadow: 5px 5px 5px #777; | ||
background-color: white; | ||
} | ||
|
||
table td { | ||
padding: 6px; | ||
border: 1px solid #999; | ||
} | ||
|
||
.byte-table td:nth-child(odd) { | ||
border-right: 0px; | ||
} | ||
.byte-table td:nth-child(even) { | ||
border-left: 0px; | ||
} | ||
.byte-table tr:not(.inner-header) td:nth-child(4n+1) { | ||
background-color: #efefef | ||
} | ||
.byte-table tr:not(.inner-header) td:nth-child(4n+2) { | ||
background-color: #efefef | ||
} | ||
.byte-table table { | ||
border: 2px solid #595; | ||
} | ||
.bit-table table { | ||
border: 2px solid #55f; | ||
} | ||
|
||
/* First four, REX */ | ||
.prefix-rex tr:not(.inner-header) td:nth-child(1) { | ||
background-color: #aee | ||
} | ||
.prefix-rex tr:not(.inner-header) td:nth-child(2) { | ||
background-color: #aee | ||
} | ||
.prefix-rex tr:not(.inner-header) td:nth-child(3) { | ||
background-color: #aee | ||
} | ||
.prefix-rex tr:not(.inner-header) td:nth-child(4) { | ||
background-color: #aee | ||
} | ||
.prefix-rex tr:not(.inner-header) td:nth-child(2n+5) { | ||
background-color: #eee | ||
} | ||
.prefix-rex tr:not(.inner-header) td:nth-child(2n+6) { | ||
background-color: #ddd | ||
} | ||
|
||
/* Modrm */ | ||
.modrm tr:not(.inner-header) td:nth-child(1) { | ||
background-color: #aee | ||
} | ||
.modrm tr:not(.inner-header) td:nth-child(2) { | ||
background-color: #aee | ||
} | ||
.modrm tr:not(.inner-header) td:nth-child(3) { | ||
background-color: #e0ffff | ||
} | ||
.modrm tr:not(.inner-header) td:nth-child(4) { | ||
background-color: #e0ffff | ||
} | ||
.modrm tr:not(.inner-header) td:nth-child(5) { | ||
background-color: #e0ffff | ||
} | ||
.modrm tr:not(.inner-header) td:nth-child(6) { | ||
background-color: #e0ffe0 | ||
} | ||
.modrm tr:not(.inner-header) td:nth-child(7) { | ||
background-color: #e0ffe0 | ||
} | ||
.modrm tr:not(.inner-header) td:nth-child(8) { | ||
background-color: #e0ffe0 | ||
} | ||
|
||
/* Sib */ | ||
.sib tr:not(.inner-header) td:nth-child(1) { | ||
background-color: #aee | ||
} | ||
.sib tr:not(.inner-header) td:nth-child(2) { | ||
background-color: #aee | ||
} | ||
.sib tr:not(.inner-header) td:nth-child(3) { | ||
background-color: #e0ffff | ||
} | ||
.sib tr:not(.inner-header) td:nth-child(4) { | ||
background-color: #e0ffff | ||
} | ||
.sib tr:not(.inner-header) td:nth-child(5) { | ||
background-color: #e0ffff | ||
} | ||
.sib tr:not(.inner-header) td:nth-child(6) { | ||
background-color: #e0ffe0 | ||
} | ||
.sib tr:not(.inner-header) td:nth-child(7) { | ||
background-color: #e0ffe0 | ||
} | ||
.sib tr:not(.inner-header) td:nth-child(8) { | ||
background-color: #e0ffe0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<html> | ||
<head> | ||
<link rel="stylesheet" type="text/css" href="css/styles.css"></link> | ||
<link rel="stylesheet" type="text/css" href="js/codemirror/codemirror.css"></link> | ||
<link rel="stylesheet" type="text/css" href="js/codemirror/theme/monokai.css"></link> | ||
</head> | ||
<body> | ||
<div id="details"> | ||
<div class="prefix details-table byte-table"> | ||
<span class="table-header">Prefix</span> | ||
<table class="prefix-table"> | ||
</table> | ||
</div> | ||
<div class="prefix-rex details-table bit-table"> | ||
<span class="table-header">REX prefix Byte</span> | ||
<table class="rex-table"> | ||
<tr class="inner-header"><td colspan="4">REX</td><td>W</td><td>R</td><td>X</td><td>B</td></tr> | ||
<tr><td>0</td><td>1</td><td>0</td><td>0</td> | ||
<td class="rex-w">0</td> | ||
<td class="rex-r">0</td> | ||
<td class="rex-x">0</td> | ||
<td class="rex-b">0</td> | ||
</tr> | ||
</table> | ||
</div> | ||
<div class="opcode details-table byte-table"> | ||
<span class="table-header">Opcode</span> | ||
<table class="opcode-table"> | ||
</table> | ||
</div> | ||
<div class="modrm details-table bit-table"> | ||
<span class="table-header">modRM Byte</span> | ||
<table class="modrm-table"> | ||
<tr class="inner-header"><td colspan="2">mod</td><td colspan="3">reg</td><td colspan="3">r/m</td></tr> | ||
<tr class="modrm-tr"></tr> | ||
</table> | ||
</div> | ||
<div class="sib details-table bit-table"> | ||
<span class="table-header">SIB Byte</span> | ||
<table class="sib-table"> | ||
<tr class="inner-header"><td colspan="2">scale</td><td colspan="3">index</td><td colspan="3">base</td></tr> | ||
<tr class="sib-tr"></tr> | ||
</table> | ||
</div> | ||
<div class="imm details-table byte-table"> | ||
<span class="table-header">Immediate</span> | ||
<table class="imm-table"> | ||
</table> | ||
</div> | ||
<div class="disp details-table byte-table"> | ||
<span class="table-header">Displacement</span> | ||
<table class="disp-table"> | ||
</table> | ||
</div> | ||
|
||
</div> | ||
<div style="clear: both;"></div> | ||
<div id="error"></div> | ||
<div class="section"> | ||
<textarea class="asm" name="asm" id="asm" rows="40"> | ||
[bits 64] | ||
mov rax,[rdx+0x21] | ||
int 0x21 | ||
</textarea> | ||
</div> | ||
<div id="bytecode" class="section"></div> | ||
|
||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> | ||
<script type="text/javascript" src="site.js"></script> | ||
<script type="text/javascript" src="../pasm.min.js"></script> | ||
<script type="text/javascript" src="js/codemirror/codemirror.js"></script> | ||
</body> | ||
</html> |
Oops, something went wrong.