Works on modern browsers again, updated readme to reflect this.
This commit is contained in:
parent
8eaef79602
commit
12777e29c6
31
readme.md
31
readme.md
@ -3,37 +3,39 @@ De-obfuscated JSLinux
|
|||||||
|
|
||||||
I wanted to understand how the amazing [JsLinux][1] worked.
|
I wanted to understand how the amazing [JsLinux][1] worked.
|
||||||
|
|
||||||
However the original was passed through a minifier and was completely incomprehensible in that form. (Mr Bellard's standards for the code that he open sources is very high.) I couldn't wait for the proper release of the opus, so in a fit of mania I hand de-obfuscated the codebase (primarily the core cpu-emulation
|
However the original was passed through a minifier and was completely incomprehensible in that form. (Mr Bellard's standards for the code that he open sources is very high.) I couldn't wait for the proper release of the opus, so in a fit of mania I hand de-obfuscated the codebase (primarily the core cpu-emulation routines and a bit of the rest as well) while studying it over a few days' time.
|
||||||
routines and a bit of the rest as well) while studying it over a few days' time.
|
|
||||||
|
|
||||||
In the off-chance someone else might be interested in this code as a
|
In the off-chance someone else might be interested in this code as a basis for further weird in-browser x86 hacking I'm posting this
|
||||||
basis for further weird in-browser x86 hacking I'm posting this
|
|
||||||
redacted version of the code here, with permission of Mr. Bellard.
|
redacted version of the code here, with permission of Mr. Bellard.
|
||||||
|
|
||||||
Note that there is a much more readable, ground-up project to build an open-source 386-style emulator in javascript called [jslm32][3].
|
Note that there is another ground-up project to build an open-source 386-style emulator in javascript called [jslm32][3].
|
||||||
|
I also recommend looking at the remarkable linux on [jor1k][5] emulator project.
|
||||||
|
|
||||||
### Status
|
### Status
|
||||||
|
|
||||||
The current codebase won't run on recent webkit browsers due to a breaking change in the way Synchronous [XHR][4] requests are handled. The binary loading routines need to be rewritten to be asynchronous, not terribly hard but annoying enough that I haven't just done it. (Fabrice's original online version has been patched and runs fine.)
|
The current codebase should run on most modern versions of Chrome, Safari, and Firefox. If you're running it locally, you will need to load it via a local server to allow the XHR requests to load the binaries.
|
||||||
|
|
||||||
jslinux-deobfuscated is still a dense code base, it's an emulator of a rather
|
jslinux-deobfuscated is still a dense, messy code base from any pedagogic point of view. However for those interested in Mr. Bellard's code,
|
||||||
complicated architecture, after all. However this version is nowhere
|
this version is nowhere near so incomprehensible as the original. Nearly all of the global variables and function names have been named
|
||||||
near so incomprehensible as the original. Nearly all of the global variables
|
somewhat sensibly. Many pointers to references have been added to the source.
|
||||||
and function names have been named somewhat sensibly. Many comments
|
|
||||||
have been added.
|
|
||||||
|
|
||||||
The core opcode execution loop has been autocommented to indicate what
|
The core opcode execution loop has been commented to indicate what instruction the opcode refers to.
|
||||||
instruction operation the opcode refers to.
|
|
||||||
|
### Unresolved
|
||||||
|
|
||||||
One mystery is, why does CPUID(1) return 8 << 8 in EBX? EBX[15:8] is now used to indicate CLFLUSH line size, but that field must have been used for something else in the past.
|
One mystery is, why does CPUID(1) return 8 << 8 in EBX? EBX[15:8] is now used to indicate CLFLUSH line size, but that field must have been used for something else in the past.
|
||||||
|
|
||||||
|
The CALL/RET/INT/IRET routines are still quite confused and haven't yet been rewritten. The code dealing with segmentation, and some of the code for real-mode remains relatively messy.
|
||||||
|
|
||||||
|
Any recommendations / clarifications are welcome!
|
||||||
|
|
||||||
### ETC
|
### ETC
|
||||||
|
|
||||||
I highly recommend, by the way, the excellent [JSShaper][2] library for transforming large javascript code bases. The hacks I made from it are in this repo: a little symbol-name-transformer node.js script and an emacs function for doing this in live buffers.
|
I highly recommend, by the way, the excellent [JSShaper][2] library for transforming large javascript code bases. The hacks I made from it are in this repo: a little symbol-name-transformer node.js script and an emacs function for doing this in live buffers.
|
||||||
|
|
||||||
### License
|
### License
|
||||||
|
|
||||||
This is a pedagogical/aesthetic derivative of the original JSLinux code Copyright (c) 2011-2013 Fabrice Bellard. It is posted here with permission of the original author subject to his original constraints : Redistribution or commercial use is prohibited without the (original) author's permission.
|
This is a pedagogical/aesthetic derivative of the original JSLinux code Copyright (c) 2011-2014 Fabrice Bellard. It is posted here with permission of the original author subject to his original constraints : Redistribution or commercial use is prohibited without the (original) author's permission.
|
||||||
|
|
||||||
### References
|
### References
|
||||||
Some other helpful references for understanding what's going on:
|
Some other helpful references for understanding what's going on:
|
||||||
@ -59,3 +61,4 @@ Some other helpful references for understanding what's going on:
|
|||||||
[2]: http://jsshaper.org
|
[2]: http://jsshaper.org
|
||||||
[3]: https://github.com/ubercomp/jslm32
|
[3]: https://github.com/ubercomp/jslm32
|
||||||
[4]: https://bugs.webkit.org/show_bug.cgi?id=72154
|
[4]: https://bugs.webkit.org/show_bug.cgi?id=72154
|
||||||
|
[5]: https://github.com/s-macke/jor1k
|
||||||
|
Loading…
Reference in New Issue
Block a user