Giter Club home page Giter Club logo

x64asm's Issues

Memory operand printing

From jason koenig --

Stoke generates instructions like:
leaw -0x1(%rax,8), %r11w
which are ill-formed according to the "att" parser because they lack a base register. GNU as gives an warning for this code. It should be:
leaw -0x1(,%rax,8), %r11w
This can be fixed by changing line 91 in x64asm/src/m.cc:
if (contains_base() && contains_index()) {
to
if (contains_index()) {
i.e. the comma needs to be printed if there is an index register/multiplier regardless of whether there is a base.

Add functions to get the set of read/written registers to Code class

For my work I needed to get the set of possibly read and possibly written registers from a Code class. For the moment, it's implemented in my stoke branch, but it's somewhat out of place. Do you think it would make sense to add such functions here?

They're truly short functions, just 5/6 lines each.

Build problems on Ubuntu 13.10

The presence of Unicode non-ASCII codepoints caused building to fail on Ubuntu 13.10 with default package versions. (That is, system built according to instructions in repo.) See pull request #24.

Hex disagreement for arithmetic ALU ops

g++ prefers register immediate rather than specialized for rax.
See output of make check.

This isn't technically a bug.
It would just be nice to match the output of g++ exactly.

Disagreement with g++ for vmov variants

Can't fix with the code in its current state.
g++ selects variants based on the rex prefix of its arguments which the type system is unable to represent.

These instructions are correct, just not as short as possible.

Invalid instruction variants allowed

The x64asm type system is insufficient for preventing users from requesting instruction such as:

crc32 %r12, %ah

(This shouldn't be allowed due to %r12 requiring a rex prefix.)

This occurs for other instructions in similar situations, such as when a memory operand requires an rex prefix. Fixing this issue will require a major re-architecting. I'd prefer to stay away from this is possible.

Known opcodes with this issue --

  • crc32
  • movsx
  • movzx

Rename Rb to R8

Low priority --

Now that Rh and Rl are subclasses of Rb, it would be nice to rename Rb to reflect the symmetry with the rest of the general purpose register classes.

If we do this, we should leave a typedef from R8 to Rb just to preserve backwards compatibility for dependent code.

adding is_call method to Instruction class

(Berkeley is taking ownership of this). I'm adding functionality to see if a given instruction is a call (e.g. call or syscall). This means having codegen make a new table and having the x64asm library slurp it in. Creating a new branch based on this ticket number.

/bin/stoke has trouble counting number of binaries

I'm having trouble with /bin/stoke because it always counts the number of binaries, which is different depending on whether or not the test suite has been built. It also differs between branches. In this branch, I remove this sanity check.

Also, make clean needs to delete all binaries besides /bin/stoke in the /bin folder, so that binaries from one branch aren't present when working in the other.

Assembler Bug

xorl %edx, %edx (segfaults when executed; extra 0x02)

Cleanup regset >>

At some point I overloaded RegSet's stream operator before I knew that RegSetWriter was the best place to put that stuff. I'll clean this up sometime soon.

Transition away from spreadsheet

Spreadsheet has non-ascii characters in it, and manually exporting to .csv every time we make a bug fix is just awful.

Let's pick a more readable/editable tab formatting and edit the .csv directly from now on.

linux_caller_save() doesn't match ABI

I don't want to break anything, so I won't change this function quite yet. The name of these function doesn't quite match up to what they are though: linux_caller_save() currently returns the list of all registers used as parameters; however, the caller must also save rax, r9, r10 and r11, which aren't parameters.

I also have a really hard time with the names callee/caller save, but that's probably just me, so my current solution is to define four new additional functions:
linux_call_parameters()
linux_call_scratch()
linux_call_preserved()
linux_call_return() (including rax, rdx, xmm0, xmm1)

that return the appropriate sets of registers.

Disagreement with g++ hex

Complete listing of opcode with this issue is below --

  • bswap
  • call with relative offset
  • jump with relative offset
  • loop
  • push imm16
  • vcvtdq2pd ymm ymm
  • vmov variants
  • xchg with rax operand

It's finally time for a linker

STOKE needs a linker now that we're ready to start sandboxing functions that use the call instruction.

I think this is actually really easy. All we need to do is store a symbol table in functions rather in the assembler. (And for our purposes, all the symbol table is is a mapping from labels to code offsets and jump locations). If a function has that, it can figure out the global offset for labels because it knows the offset that its buffer begins at.

From there, all a linker will have to do redo the offsets.

Assuming you're only working with a single function, the assembler should continue to work exactly as it used to.

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.