OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
982 | 982 |
983 int Simulator::ReadW(int32_t addr, Instr* instr) { | 983 int Simulator::ReadW(int32_t addr, Instr* instr) { |
984 #if V8_TARGET_CAN_READ_UNALIGNED | 984 #if V8_TARGET_CAN_READ_UNALIGNED |
985 intptr_t* ptr = reinterpret_cast<intptr_t*>(addr); | 985 intptr_t* ptr = reinterpret_cast<intptr_t*>(addr); |
986 return *ptr; | 986 return *ptr; |
987 #else | 987 #else |
988 if ((addr & 3) == 0) { | 988 if ((addr & 3) == 0) { |
989 intptr_t* ptr = reinterpret_cast<intptr_t*>(addr); | 989 intptr_t* ptr = reinterpret_cast<intptr_t*>(addr); |
990 return *ptr; | 990 return *ptr; |
991 } | 991 } |
992 PrintF("Unaligned read at 0x%08x, pc=%p\n", addr, instr); | 992 PrintF("Unaligned read at 0x%08x, pc=0x%08" V8PRIxPTR "\n", |
| 993 addr, |
| 994 reinterpret_cast<intptr_t>(instr)); |
993 UNIMPLEMENTED(); | 995 UNIMPLEMENTED(); |
994 return 0; | 996 return 0; |
995 #endif | 997 #endif |
996 } | 998 } |
997 | 999 |
998 | 1000 |
999 void Simulator::WriteW(int32_t addr, int value, Instr* instr) { | 1001 void Simulator::WriteW(int32_t addr, int value, Instr* instr) { |
1000 #if V8_TARGET_CAN_READ_UNALIGNED | 1002 #if V8_TARGET_CAN_READ_UNALIGNED |
1001 intptr_t* ptr = reinterpret_cast<intptr_t*>(addr); | 1003 intptr_t* ptr = reinterpret_cast<intptr_t*>(addr); |
1002 *ptr = value; | 1004 *ptr = value; |
1003 return; | 1005 return; |
1004 #else | 1006 #else |
1005 if ((addr & 3) == 0) { | 1007 if ((addr & 3) == 0) { |
1006 intptr_t* ptr = reinterpret_cast<intptr_t*>(addr); | 1008 intptr_t* ptr = reinterpret_cast<intptr_t*>(addr); |
1007 *ptr = value; | 1009 *ptr = value; |
1008 return; | 1010 return; |
1009 } | 1011 } |
1010 PrintF("Unaligned write at 0x%08x, pc=%p\n", addr, instr); | 1012 PrintF("Unaligned write at 0x%08x, pc=0x%08" V8PRIxPTR "\n", |
| 1013 addr, |
| 1014 reinterpret_cast<intptr_t>(instr)); |
1011 UNIMPLEMENTED(); | 1015 UNIMPLEMENTED(); |
1012 #endif | 1016 #endif |
1013 } | 1017 } |
1014 | 1018 |
1015 | 1019 |
1016 uint16_t Simulator::ReadHU(int32_t addr, Instr* instr) { | 1020 uint16_t Simulator::ReadHU(int32_t addr, Instr* instr) { |
1017 #if V8_TARGET_CAN_READ_UNALIGNED | 1021 #if V8_TARGET_CAN_READ_UNALIGNED |
1018 uint16_t* ptr = reinterpret_cast<uint16_t*>(addr); | 1022 uint16_t* ptr = reinterpret_cast<uint16_t*>(addr); |
1019 return *ptr; | 1023 return *ptr; |
1020 #else | 1024 #else |
1021 if ((addr & 1) == 0) { | 1025 if ((addr & 1) == 0) { |
1022 uint16_t* ptr = reinterpret_cast<uint16_t*>(addr); | 1026 uint16_t* ptr = reinterpret_cast<uint16_t*>(addr); |
1023 return *ptr; | 1027 return *ptr; |
1024 } | 1028 } |
1025 PrintF("Unaligned unsigned halfword read at 0x%08x, pc=%p\n", addr, instr); | 1029 PrintF("Unaligned unsigned halfword read at 0x%08x, pc=0x%08" V8PRIxPTR "\n", |
| 1030 addr, |
| 1031 reinterpret_cast<intptr_t>(instr)); |
1026 UNIMPLEMENTED(); | 1032 UNIMPLEMENTED(); |
1027 return 0; | 1033 return 0; |
1028 #endif | 1034 #endif |
1029 } | 1035 } |
1030 | 1036 |
1031 | 1037 |
1032 int16_t Simulator::ReadH(int32_t addr, Instr* instr) { | 1038 int16_t Simulator::ReadH(int32_t addr, Instr* instr) { |
1033 #if V8_TARGET_CAN_READ_UNALIGNED | 1039 #if V8_TARGET_CAN_READ_UNALIGNED |
1034 int16_t* ptr = reinterpret_cast<int16_t*>(addr); | 1040 int16_t* ptr = reinterpret_cast<int16_t*>(addr); |
1035 return *ptr; | 1041 return *ptr; |
(...skipping 13 matching lines...) Expand all Loading... |
1049 #if V8_TARGET_CAN_READ_UNALIGNED | 1055 #if V8_TARGET_CAN_READ_UNALIGNED |
1050 uint16_t* ptr = reinterpret_cast<uint16_t*>(addr); | 1056 uint16_t* ptr = reinterpret_cast<uint16_t*>(addr); |
1051 *ptr = value; | 1057 *ptr = value; |
1052 return; | 1058 return; |
1053 #else | 1059 #else |
1054 if ((addr & 1) == 0) { | 1060 if ((addr & 1) == 0) { |
1055 uint16_t* ptr = reinterpret_cast<uint16_t*>(addr); | 1061 uint16_t* ptr = reinterpret_cast<uint16_t*>(addr); |
1056 *ptr = value; | 1062 *ptr = value; |
1057 return; | 1063 return; |
1058 } | 1064 } |
1059 PrintF("Unaligned unsigned halfword write at 0x%08x, pc=%p\n", addr, instr); | 1065 PrintF("Unaligned unsigned halfword write at 0x%08x, pc=0x%08" V8PRIxPTR "\n", |
| 1066 addr, |
| 1067 reinterpret_cast<intptr_t>(instr)); |
1060 UNIMPLEMENTED(); | 1068 UNIMPLEMENTED(); |
1061 #endif | 1069 #endif |
1062 } | 1070 } |
1063 | 1071 |
1064 | 1072 |
1065 void Simulator::WriteH(int32_t addr, int16_t value, Instr* instr) { | 1073 void Simulator::WriteH(int32_t addr, int16_t value, Instr* instr) { |
1066 #if V8_TARGET_CAN_READ_UNALIGNED | 1074 #if V8_TARGET_CAN_READ_UNALIGNED |
1067 int16_t* ptr = reinterpret_cast<int16_t*>(addr); | 1075 int16_t* ptr = reinterpret_cast<int16_t*>(addr); |
1068 *ptr = value; | 1076 *ptr = value; |
1069 return; | 1077 return; |
1070 #else | 1078 #else |
1071 if ((addr & 1) == 0) { | 1079 if ((addr & 1) == 0) { |
1072 int16_t* ptr = reinterpret_cast<int16_t*>(addr); | 1080 int16_t* ptr = reinterpret_cast<int16_t*>(addr); |
1073 *ptr = value; | 1081 *ptr = value; |
1074 return; | 1082 return; |
1075 } | 1083 } |
1076 PrintF("Unaligned halfword write at 0x%08x, pc=%p\n", addr, instr); | 1084 PrintF("Unaligned halfword write at 0x%08x, pc=0x%08" V8PRIxPTR "\n", |
| 1085 addr, |
| 1086 reinterpret_cast<intptr_t>(instr)); |
1077 UNIMPLEMENTED(); | 1087 UNIMPLEMENTED(); |
1078 #endif | 1088 #endif |
1079 } | 1089 } |
1080 | 1090 |
1081 | 1091 |
1082 uint8_t Simulator::ReadBU(int32_t addr) { | 1092 uint8_t Simulator::ReadBU(int32_t addr) { |
1083 uint8_t* ptr = reinterpret_cast<uint8_t*>(addr); | 1093 uint8_t* ptr = reinterpret_cast<uint8_t*>(addr); |
1084 return *ptr; | 1094 return *ptr; |
1085 } | 1095 } |
1086 | 1096 |
(...skipping 1934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3021 uintptr_t address = *stack_slot; | 3031 uintptr_t address = *stack_slot; |
3022 set_register(sp, current_sp + sizeof(uintptr_t)); | 3032 set_register(sp, current_sp + sizeof(uintptr_t)); |
3023 return address; | 3033 return address; |
3024 } | 3034 } |
3025 | 3035 |
3026 } } // namespace assembler::arm | 3036 } } // namespace assembler::arm |
3027 | 3037 |
3028 #endif // USE_SIMULATOR | 3038 #endif // USE_SIMULATOR |
3029 | 3039 |
3030 #endif // V8_TARGET_ARCH_ARM | 3040 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |