diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2017-10-12 17:02:02 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2017-10-12 17:02:02 -0700 |
commit | aee46a25f5cf1c54b86f2b85f710ac9b344b9ce4 (patch) | |
tree | afcd3d12596bc62b318aaf41f9d5f29c04837b14 /subx/000organization.cc | |
parent | 3f2ac81ecffadc118732f62364c17bf5aabd8720 (diff) | |
download | mu-aee46a25f5cf1c54b86f2b85f710ac9b344b9ce4.tar.gz |
4034
Start implementing core x86 addressing mode decoding.
Diffstat (limited to 'subx/000organization.cc')
-rw-r--r-- | subx/000organization.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/subx/000organization.cc b/subx/000organization.cc index 320c0d4b..f729b17e 100644 --- a/subx/000organization.cc +++ b/subx/000organization.cc @@ -115,6 +115,7 @@ int main(int argc, char* argv[]) { // run on a 32-bit system assert(sizeof(int) == 4); assert(sizeof(float) == 4); + assert_little_endian(); // End One-time Setup @@ -138,3 +139,12 @@ int main(int argc, char* argv[]) { void reset() { // End Reset } + +void assert_little_endian() { + const int x = 1; + const char* y = reinterpret_cast<const char*>(&x); + if (*y != 1) { + cerr << "the SubX VM only runs on little-endian processors. Do you have Intel (or AMD or Atom) inside?\n"; + exit(1); + } +} |