GithubHelp home page GithubHelp logo

emu_x86's People

Contributors

octarect avatar yuku avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

emu_x86's Issues

Found bug with set_register8

void set_register8(Emulator* emu, int index, uint8_t value)
{
  if (index < 4) {
    uint32_t r = emu->registers[index] & 0xffffff00;
    emu->registers[index] = r | (uint32_t)value;
  } else {
    uint32_t r = emu->registers[index] & 0xffff00ff;
    emu->registers[index - 4] = r | ((uint32_t)value << 8);
  }
}

Fixed looks like this

void set_register8(Emulator* emu, int index, uint8_t value)
{
  if (index < 4) {
    uint32_t r = emu->registers[index] & 0xffffff00;
    emu->registers[index] = r | (uint32_t)value;
  } else {
    uint32_t r = emu->registers[index - 4] & 0xffff00ff;
    emu->registers[index - 4] = r | ((uint32_t)value << 8);
  }
}

missing - 4 on the first registers array on the bottom of the else statement

Fixed also eval_sib(..) function it was off.

new code looks like this

uint32_t eval_sib(Emulator* emu, ModRM* modrm) {
    uint8_t sib = modrm->sib;
    uint8_t scale = (sib >> 6) & 0x03;   //((sib & 0xC0) >> 6); //old broken code
    uint8_t base  = sib & 0x07;          //((sib & 0x38) >> 3); //old broken code
    uint8_t index = (sib >> 3) & 0x07;   //(sib & 0x03);         //old broken code

Sib formula by this image match

  7   6   5   4   3   2   1   0
+---+---+---+---+---+---+---+---+
|  mod  |    reg    |     rm    |
+---+---+---+---+---+---+---+---+

changed parse_modrm 16_32 into 1 and changed

    modrm->mod = (code >> 6) & 0x03;     //old code  ((code & 0xC0) >> 6);
    modrm->opcode = (code >> 3) & 0x07;  //old code  ((code & 0x38) >> 3);
    modrm->rm = code & 0x07;             //old code  code & 0x07;

another bug where you see modrm->mod == 5 and modrm->mod == 6 you meant to use modrm->rm == 5 and modrm->rm == 6 because mod doesn't pass the value 3 it's only 2 bits.

http://download.intel.com/design/intarch/manuals/24319101.pdf Page 35 for 16 bit and page 36 for 32 bit.

I fixed more like lea_r16_m made it lea_r16_r32_m haha. added xor, or, and, stos, prefixes (buggy) still needs segments maybe? idk never worked with cpu emulators, others have it, maybe not needed.

update1: https://www.mediafire.com/?cg2q2lmfexbepz5
update2: http://www.mediafire.com/?7t601e27r348178
update3: http://www.mediafire.com/?8c3p50pp7zveo67

on update3 i fixed the memory issue.

I hope you not abandoned this project it's very good compared to other cpu emulators this is the simplest one which is best :)

it needs FPU support to be better then any other cpu emulator and still small and simple.

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.