Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a86: Check immediate ranges #115

Closed
dvanhorn opened this issue Oct 31, 2022 · 5 comments
Closed

a86: Check immediate ranges #115

dvanhorn opened this issue Oct 31, 2022 · 5 comments

Comments

@dvanhorn
Copy link
Member

Instructions that take immediate values should check that values are in range. Some instructions, e.g. Cmp can only take 32-bit immediate, and will silently do something unexpected if you use a 64-bit immediate.

@dvanhorn
Copy link
Member Author

This is going to be a pain to check. For example, Mov can take a 64-bit immediate, but only if moving into a register, not memory.

@pdarragh
Copy link
Contributor

Regardless of whether we move to the OO technique in #113, I've been planning to revise how instruction AST nodes are defined to make things like this easier to specify, so I'm not sure whether we ought to do it right now in the main branch or not.

@laelath
Copy link

laelath commented Oct 31, 2022

I think this is orthogonal to that, since these are just checks on the target language AST

@dvanhorn
Copy link
Member Author

I've added checks in a branch which we can merge later. (Probably after the exam is fine.) I haven't done the "if moving into memory you only get 32-bits" part yet.

@dvanhorn
Copy link
Member Author

Just remembered you can't move immediates into memory, so I think this is done now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants