GithubHelp home page GithubHelp logo

levskaya / jslinux-deobfuscated Goto Github PK

View Code? Open in Web Editor NEW
1.0K 59.0 145.0 2.11 MB

An old version of Mr. Bellard's JSLinux rewritten to be human readable, hand deobfuscated and annotated.

License: Other

JavaScript 99.38% Python 0.39% Emacs Lisp 0.07% HTML 0.16%

jslinux-deobfuscated's Introduction

De-obfuscated JSLinux

This repo corresponds to a very old version of jslinux, Mr. Bellard currently uses an emscripten converted emulator for the current jslinux.

There are better emulator codebases out there for pedagogical use!

I highly recommend checking out another open-source x86 emulation project that includes vga support, "v86" (demo / source). There's yet another open-source 386-style emulator in javascript called jslm32.

For a simpler RISC architecture, take a look at the linux on jor1k emulator project.

Finally, the Angel emulator (source) shows off the elegant open-ISA 64bit RISC-V architecture that is being brought to silicon by the lowrisc team. This is by far the cleanest architecture for studying general low-level hardware and operating system implementation details.

History

I wanted to understand how the amazing JsLinux worked, so in a fit of mania I hand de-obfuscated the codebase while studying it over a few days' time. In the off-chance someone else might be interested in this code as a basis for further weird in-browser x86 hacking I posted this redacted version of the code here, with permission of Mr. Bellard.

Status

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, messy code base from any pedagogic point of view. However for those interested in Mr. Bellard's code, this version is nowhere near so incomprehensible as the original. Nearly all of the global variables and function names have been named somewhat sensibly. Many pointers to references have been added to the source.

The core opcode execution loop has been commented to indicate what instruction 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.

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

I highly recommend, by the way, the excellent JSShaper 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

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

Some other helpful references for understanding what's going on:

x86

Bit Hacking

Other devices

jslinux-deobfuscated's People

Contributors

danluu avatar levskaya avatar staeff avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jslinux-deobfuscated's Issues

Network support

Hi there,

I have been looking through the code to try to understand what it would take to add network support. Am I correct to think that one would need to port a simple network module (and the necessary low-level network card functions) for this to work?

Any pointers appreciated 😊

BIOS

    loadbinary("vmlinux-2.6.20.bin", 0);
    loadbinary("root.bin", 1);
    loadbinary("linuxstart.bin", 2);

Which one is bios?
Which one is vgabios?
Which one is linux os?

License

Hi,

If I were to package this for a Linux distro, which license should I put in the package file? Copyright Fabrice Bellard? Is he okay with this?

If possible, please add a "LICENSE" or "COPYING" file that clarifies this.

Best regards,
Alexander Rødseth

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.