GithubHelp home page GithubHelp logo

Support for segment registers about xbyak HOT 5 CLOSED

herumi avatar herumi commented on May 22, 2024
Support for segment registers

from xbyak.

Comments (5)

AlexAltea avatar AlexAltea commented on May 22, 2024

I was thinking about having a class SegmentReg : class Reg type for the members cs,ds,ss,es,fs,gs and extending RegExp to allow following expressions:

(ptr|dword|word|byte) [(cs|ds|ss|es|fs|gs) | base + index * (1|2|4|8) + displacement]

Such that, for example, following expressions were possible:

mov(ecx, ptr[rax]);
mov(ecx, ptr[fs | rax]);
mov(ebx, ptr[gs | rax + rcx*4]);
mov(fs, rax);

This matches more or less the Intel syntax.

from xbyak.

herumi avatar herumi commented on May 22, 2024

Thank you for your suggestion, but it is difficult to extend Addressing to support segment registers.

How about the following extension?

add method cs(), ds(), ... to Xbyak::CodeGenerator;

cs() { db(0x2e); }
ds() { db(0x3e); }
...
mov(ecx, ptr[rax]);
fs(); mov(ecx, ptr[rax]);
gs(); mov(ebx, ptr[rax + rcx*4]);

It is necessary for mov to support segment registers.

from xbyak.

AlexAltea avatar AlexAltea commented on May 22, 2024

True, that's a simpler workaround. I guess I will do that (for now). Thanks for the tip! :-)

from xbyak.

herumi avatar herumi commented on May 22, 2024

https://github.com/herumi/xbyak/releases/tag/v4.87 supports the following codes.

putSeg(fs); mov(eax, ptr [ecx]);
mov(cs, ax);
push(ds);

Could you try it?

from xbyak.

AlexAltea avatar AlexAltea commented on May 22, 2024

I've tried it and it works perfectly. Thank you very much for your support and congratulations for this great library. I'm closing this issue. :-)

from xbyak.

Related Issues (20)

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.