Clarified licensing information subject to the received permission of Fabrice Bellard to post this derivative work online.

This commit is contained in:
Anselm Levskaya 2013-03-28 19:43:44 -07:00
parent e7b0f1b321
commit 3bf3d7322a
10 changed files with 49 additions and 23 deletions

View File

@ -1,5 +1,8 @@
/* /*
Fabrix - An annotated version of the original JSLinux which is Copyright (c) 2011 Fabrice Bellard JSLinux-deobfuscated - An annotated version of the original JSLinux.
Original is Copyright (c) 2011-2012 Fabrice Bellard
Redistribution or commercial use is prohibited without the author's permission.
Clock Emulator Clock Emulator
*/ */
@ -30,7 +33,7 @@ CMOS.prototype.ioport_write = function(mem8_loc, data) {
// the high order bit is used to indicate NMI masking // the high order bit is used to indicate NMI masking
// low order bits are used to address CMOS // low order bits are used to address CMOS
// the index written here is used on an ioread 0x71 // the index written here is used on an ioread 0x71
this.cmos_index = data & 0x7f; this.cmos_index = data & 0x7f;
} }
}; };
CMOS.prototype.ioport_read = function(mem8_loc) { CMOS.prototype.ioport_read = function(mem8_loc) {

5
KBD.js
View File

@ -1,5 +1,8 @@
/* /*
Fabrix - An annotated version of the original JSLinux which is Copyright (c) 2011 Fabrice Bellard JSLinux-deobfuscated - An annotated version of the original JSLinux.
Original is Copyright (c) 2011-2012 Fabrice Bellard
Redistribution or commercial use is prohibited without the author's permission.
Keyboard Device Emulator Keyboard Device Emulator
*/ */

4
LICENSE Normal file
View File

@ -0,0 +1,4 @@
This is a derivative work of JSLinux and is posted here with permission of the author.
JSLinux is Copyright (c) 2011-2013 Fabrice Bellard
Redistribution or commercial use is prohibited without the author's permission.

View File

@ -1,5 +1,8 @@
/* /*
Fabrix - An annotated version of the original JSLinux which is Copyright (c) 2011 Fabrice Bellard JSLinux-deobfuscated - An annotated version of the original JSLinux.
Original is Copyright (c) 2011-2012 Fabrice Bellard
Redistribution or commercial use is prohibited without the author's permission.
Main PC Emulator Routine Main PC Emulator Routine
*/ */

5
PIC.js
View File

@ -1,5 +1,8 @@
/* /*
Fabrix - An annotated version of the original JSLinux which is Copyright (c) 2011 Fabrice Bellard JSLinux-deobfuscated - An annotated version of the original JSLinux.
Original is Copyright (c) 2011-2012 Fabrice Bellard
Redistribution or commercial use is prohibited without the author's permission.
8259 PIC (Programmable Interrupt Controller) Emulation Code 8259 PIC (Programmable Interrupt Controller) Emulation Code
*/ */

7
PIT.js
View File

@ -1,7 +1,10 @@
/* /*
Fabrix - An annotated version of the original JSLinux which is Copyright (c) 2011 Fabrice Bellard JSLinux-deobfuscated - An annotated version of the original JSLinux.
PIT Emulator Original is Copyright (c) 2011-2012 Fabrice Bellard
Redistribution or commercial use is prohibited without the author's permission.
8254 Programmble Interrupt Timer Emulator
*/ */
function PIT(PC, ah, bh) { function PIT(PC, ah, bh) {
var s, i; var s, i;

View File

@ -1,5 +1,8 @@
/* /*
Fabrix - An annotated version of the original JSLinux which is Copyright (c) 2011 Fabrice Bellard JSLinux-deobfuscated - An annotated version of the original JSLinux.
Original is Copyright (c) 2011-2012 Fabrice Bellard
Redistribution or commercial use is prohibited without the author's permission.
Serial Controller Emulator Serial Controller Emulator
*/ */

View File

@ -1,5 +1,8 @@
/* /*
Fabrix - An annotated version of the original JSLinux which is Copyright (c) 2011 Fabrice Bellard JSLinux-deobfuscated - An annotated version of the original JSLinux.
Original is Copyright (c) 2011-2012 Fabrice Bellard
Redistribution or commercial use is prohibited without the author's permission.
Clipboard Device Clipboard Device
*/ */

View File

@ -1,8 +1,11 @@
/* /*
Fabrix - An annotated version of the original JSLinux Copyright (c) 2011 Fabrice Bellard JSLinux-deobfuscated - An annotated version of the original JSLinux.
==================================================================================================
Original is Copyright (c) 2011-2012 Fabrice Bellard
Redistribution or commercial use is prohibited without the author's permission.
A x86 CPU (circa 486 sans FPU) Emulator A x86 CPU (circa 486 sans FPU) Emulator
======================================================================
Useful references: Useful references:
====================================================================== ======================================================================
@ -4824,7 +4827,7 @@ CPU_X86.prototype.exec_internal = function(N_cycles, interrupt) {
var z; var z;
z = segment_isnt_accessible(selector, is_verw); z = segment_isnt_accessible(selector, is_verw);
_src = get_conditional_flags(); _src = get_conditional_flags();
// clear eflags.zf if selector is accessible and (readable (for VERR) or writable (for VERW)) // clear eflags.zf if selector is accessible and (readable (for VERR) or writable (for VERW))
if (z) if (z)
_src |= 0x0040; _src |= 0x0040;

View File

@ -3,17 +3,14 @@ De-obfuscated JSLinux
I wanted to understand how the amazing [JsLinux][1] worked. I wanted to understand how the amazing [JsLinux][1] worked.
I have no idea if he passed it through a minifier or if the code was generated algorithmically from stuff in the QEMU codebase. In any case, it's hard to follow the action as presented originally, let alone extend it to do new tricks. 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.
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.
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. redacted version of the code here, with permission of Mr. Bellard.
There is a much more complete, ground-up project to build a 386-style emulator in javascript called [jslm32][3]. Note that there is a much more readable, ground-up project to build an open-source 386-style emulator in javascript called [jslm32][3].
### Status ### Status
It's still a dense code base, it's an emulator of a rather It's still a dense code base, it's an emulator of a rather
@ -22,6 +19,8 @@ near so incomprehensible as the original. Nearly all of the global variables
and function names have been named somewhat sensibly. Many comments and function names have been named somewhat sensibly. Many comments
have been added. have been added.
It seems to run identically to the original.
The core opcode execution loop has been autocommented to indicate what The core opcode execution loop has been autocommented to indicate what
instruction operation the opcode refers to. instruction operation the opcode refers to.
@ -31,10 +30,9 @@ One mystery is, why does CPUID(1) return 8 << 8 in EBX? EBX[15:8] is now used to
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.
### Caveat Coder ### License
This is a pedagogical/aesthetic reinterpretation of the original
JSLinux code Copyright (c) 2011 Fabrice Bellard. It seems to run 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.
identically to the original.
### References ### References
Some other helpful references for understanding what's going on: Some other helpful references for understanding what's going on: