Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Unified Diff: tests/dynamic_code_loading/dynamic_load_test.c

Issue 11194045: Change BKPT and UDF encodings on ARM. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Factor out special BKPT/UDF encodings in a separate header file instead of repeating them in a few … Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tests/dynamic_code_loading/dynamic_load_test.c
diff --git a/tests/dynamic_code_loading/dynamic_load_test.c b/tests/dynamic_code_loading/dynamic_load_test.c
index 22558ad09bf09c8f8fc12a4a6b216598c156a754..672ea06a4e57ae008f111408eaad1bc262644f93 100644
--- a/tests/dynamic_code_loading/dynamic_load_test.c
+++ b/tests/dynamic_code_loading/dynamic_load_test.c
@@ -14,6 +14,7 @@
#include <nacl/nacl_dyncode.h>
+#include "native_client/src/include/arm_sandbox.h"
#include "native_client/tests/dynamic_code_loading/dynamic_segment.h"
#include "native_client/tests/dynamic_code_loading/templates.h"
#include "native_client/tests/inbrowser_test_runner/test_runner.h"
@@ -81,7 +82,7 @@ void fill_hlts(uint8_t *data, size_t size) {
#if defined(__i386__) || defined(__x86_64__)
memset(data, 0xf4, size); /* HLTs */
#elif defined(__arm__)
- fill_int32(data, size, 0xe1266676); /* BKPT 0x6666 */
+ fill_int32(data, size, NACL_INSTR_HALT_FILL);
#else
# error "Unknown arch"
#endif
@@ -484,14 +485,18 @@ void test_deleting_code_from_invalid_ranges() {
}
void check_region_is_filled_with_hlts(const char *data, size_t size) {
- uint8_t halts[] =
+ uint8_t halts[] = {
#if defined(__i386__) || defined(__x86_64__)
- { 0xf4 }; /* HLT */
+ 0xf4 /* HLT */
#elif defined(__arm__)
- { 0x76, 0x66, 0x26, 0xe1 }; /* 0xe1266676 - BKPT 0x6666 */
+ (NACL_INSTR_HALT_FILL >> 0) & 0xFF,
Mark Seaborn 2012/10/18 22:05:30 You can just do: #if x86... uint8_t halts = 0xf4;
+ (NACL_INSTR_HALT_FILL >> 8) & 0xFF,
+ (NACL_INSTR_HALT_FILL >> 16) & 0xFF,
+ (NACL_INSTR_HALT_FILL >> 24) & 0xFF
#else
# error "Unknown arch"
#endif
+ };
const char *ptr;
for (ptr = data; ptr < data + size; ptr += sizeof(halts)) {
assert(memcmp(ptr, halts, sizeof(halts)) == 0);

Powered by Google App Engine
This is Rietveld 408576698