am 61e92a02: am 68835ee8: Merge "system/core LP64 cleanup."

* commit '61e92a026472786ce81f4738e7d77bcad69697b8':
  system/core LP64 cleanup.
This commit is contained in:
Elliott Hughes 2014-02-06 03:03:52 +00:00 committed by Android Git Automerger
commit b30b159f70
9 changed files with 30 additions and 25 deletions

View file

@ -57,13 +57,13 @@ static void test_call1()
static void *noisy(void *x) static void *noisy(void *x)
{ {
char c = (unsigned) x; char c = (uintptr_t) x;
for(;;) { for(;;) {
usleep(250*1000); usleep(250*1000);
write(2, &c, 1); write(2, &c, 1);
if(c == 'C') *((unsigned*) 0) = 42; if(c == 'C') *((unsigned*) 0) = 42;
} }
return 0; return NULL;
} }
static int ctest() static int ctest()
@ -81,7 +81,7 @@ static int ctest()
static void* thread_callback(void* raw_arg) static void* thread_callback(void* raw_arg)
{ {
return (void*) do_action((const char*) raw_arg); return (void*) (uintptr_t) do_action((const char*) raw_arg);
} }
static int do_action_on_thread(const char* arg) static int do_action_on_thread(const char* arg)
@ -90,7 +90,7 @@ static int do_action_on_thread(const char* arg)
pthread_create(&t, NULL, thread_callback, (void*) arg); pthread_create(&t, NULL, thread_callback, (void*) arg);
void* result = NULL; void* result = NULL;
pthread_join(t, &result); pthread_join(t, &result);
return (int) result; return (int) (uintptr_t) result;
} }
__attribute__((noinline)) static int crash3(int a) { __attribute__((noinline)) static int crash3(int a) {

View file

@ -124,9 +124,9 @@ static void cmd_boot(struct protocol_handle *phandle, const char *arg)
goto error; goto error;
} }
kernel_ptr = (void *)((unsigned) ptr + hdr->page_size); kernel_ptr = (void *)((uintptr_t) ptr + hdr->page_size);
ramdisk_ptr = (void *)((unsigned) kernel_ptr + kernel_actual); ramdisk_ptr = (void *)((uintptr_t) kernel_ptr + kernel_actual);
second_ptr = (void *)((unsigned) ramdisk_ptr + ramdisk_actual); second_ptr = (void *)((uintptr_t) ramdisk_ptr + ramdisk_actual);
D(INFO, "preparing to boot"); D(INFO, "preparing to boot");
// Prepares boot physical address. Addresses from header are ignored // Prepares boot physical address. Addresses from header are ignored

View file

@ -89,10 +89,10 @@ long kexec_load(unsigned int entry, unsigned long nr_segments,
* Kernel address is not set into kernel_phys * Kernel address is not set into kernel_phys
* Ramdisk is set to position relative to kernel * Ramdisk is set to position relative to kernel
*/ */
int prepare_boot_linux(unsigned kernel_phys, void *kernel_addr, int kernel_size, int prepare_boot_linux(uintptr_t kernel_phys, void *kernel_addr, int kernel_size,
unsigned ramdisk_phys, void *ramdisk_addr, int ramdisk_size, uintptr_t ramdisk_phys, void *ramdisk_addr, int ramdisk_size,
unsigned second_phys, void *second_addr, int second_size, uintptr_t second_phys, void *second_addr, int second_size,
unsigned atags_phys, void *atags_addr, int atags_size) { uintptr_t atags_phys, void *atags_addr, int atags_size) {
struct kexec_segment segment[4]; struct kexec_segment segment[4];
int segment_count = 2; int segment_count = 2;
unsigned entry = START_ADDRESS + KEXEC_ARM_ZIMAGE_OFFSET; unsigned entry = START_ADDRESS + KEXEC_ARM_ZIMAGE_OFFSET;

View file

@ -40,8 +40,8 @@
#define KEXEC_TYPE_DEFAULT 0 #define KEXEC_TYPE_DEFAULT 0
#define KEXEC_TYPE_CRASH 1 #define KEXEC_TYPE_CRASH 1
int prepare_boot_linux(unsigned, void *, int, unsigned, void *, int, int prepare_boot_linux(uintptr_t, void *, int, uintptr_t, void *, int,
unsigned, void *, int, unsigned, void *, int); uintptr_t, void *, int, uintptr_t, void *, int);
unsigned *create_atags(unsigned *, int, const struct boot_img_hdr *, int *); unsigned *create_atags(unsigned *, int, const struct boot_img_hdr *, int *);
long kexec_load(unsigned int, unsigned long, struct kexec_segment *, unsigned long); long kexec_load(unsigned int, unsigned long, struct kexec_segment *, unsigned long);
char *read_atags(const char *, int *); char *read_atags(const char *, int *);

View file

@ -142,7 +142,7 @@ void fastboot_data(struct protocol_handle *phandle, size_t len)
char response[64]; char response[64];
ssize_t ret; ssize_t ret;
snprintf(response, 64, "DATA%08x", len); snprintf(response, 64, "DATA%08zx", len);
ret = protocol_handle_write(phandle, response, strlen(response)); ret = protocol_handle_write(phandle, response, strlen(response));
if (ret < 0) if (ret < 0)
return; return;

View file

@ -16,6 +16,7 @@
#include <benchmark.h> #include <benchmark.h>
#include <inttypes.h>
#include <regex.h> #include <regex.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -158,10 +159,10 @@ void Run(Benchmark* b) {
sdev = (sqrt((double)nXvariance) / gBenchmarkNum / gBenchmarkNum) + 0.5; sdev = (sqrt((double)nXvariance) / gBenchmarkNum / gBenchmarkNum) + 0.5;
} }
if (mean > (10000 * sdev)) { if (mean > (10000 * sdev)) {
printf("%-25s %10llu %10llu%s\n", full_name, printf("%-25s %10" PRIu64 " %10" PRIu64 "%s\n", full_name,
static_cast<uint64_t>(iterations), mean, throughput); static_cast<uint64_t>(iterations), mean, throughput);
} else { } else {
printf("%-25s %10llu %10llu(\317\203%llu)%s\n", full_name, printf("%-25s %10" PRIu64 " %10" PRIu64 "(\317\203%" PRIu64 ")%s\n", full_name,
static_cast<uint64_t>(iterations), mean, sdev, throughput); static_cast<uint64_t>(iterations), mean, sdev, throughput);
} }
fflush(stdout); fflush(stdout);

View file

@ -15,6 +15,7 @@
*/ */
#include <fcntl.h> #include <fcntl.h>
#include <inttypes.h>
#include <signal.h> #include <signal.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <log/log.h> #include <log/log.h>
@ -85,8 +86,8 @@ TEST(liblog, __android_log_btwrite) {
static void* ConcurrentPrintFn(void *arg) { static void* ConcurrentPrintFn(void *arg) {
int ret = __android_log_buf_print(LOG_ID_MAIN, ANDROID_LOG_INFO, int ret = __android_log_buf_print(LOG_ID_MAIN, ANDROID_LOG_INFO,
"TEST__android_log_print", "Concurrent %d", "TEST__android_log_print", "Concurrent %" PRIuPTR,
reinterpret_cast<int>(arg)); reinterpret_cast<uintptr_t>(arg));
return reinterpret_cast<void*>(ret); return reinterpret_cast<void*>(ret);
} }
@ -106,8 +107,9 @@ TEST(liblog, concurrent_name(__android_log_buf_print, NUM_CONCURRENT)) {
for (i=0; i < NUM_CONCURRENT; i++) { for (i=0; i < NUM_CONCURRENT; i++) {
void* result; void* result;
ASSERT_EQ(0, pthread_join(t[i], &result)); ASSERT_EQ(0, pthread_join(t[i], &result));
if ((0 == ret) && (0 != reinterpret_cast<int>(result))) { int this_result = reinterpret_cast<uintptr_t>(result);
ret = reinterpret_cast<int>(result); if ((0 == ret) && (0 != this_result)) {
ret = this_result;
} }
} }
ASSERT_LT(0, ret); ASSERT_LT(0, ret);

View file

@ -26,6 +26,7 @@ LOCAL_C_INCLUDES += \
# Static Library # Static Library
LOCAL_MODULE := libnl_2 LOCAL_MODULE := libnl_2
LOCAL_MODULE_TAGS := optional LOCAL_MODULE_TAGS := optional
LOCAL_32_BIT_ONLY := true
include $(BUILD_STATIC_LIBRARY) include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS) include $(CLEAR_VARS)
@ -34,4 +35,5 @@ LOCAL_WHOLE_STATIC_LIBRARIES:= libnl_2
LOCAL_SHARED_LIBRARIES:= liblog LOCAL_SHARED_LIBRARIES:= liblog
LOCAL_MODULE := libnl_2 LOCAL_MODULE := libnl_2
LOCAL_MODULE_TAGS := optional LOCAL_MODULE_TAGS := optional
LOCAL_32_BIT_ONLY := true
include $(BUILD_SHARED_LIBRARY) include $(BUILD_SHARED_LIBRARY)

View file

@ -200,7 +200,7 @@ static bool str_icase_equals(void *keyA, void *keyB) {
} }
static int int_hash(void *key) { static int int_hash(void *key) {
return (int) key; return (int) (uintptr_t) key;
} }
static bool int_equals(void *keyA, void *keyB) { static bool int_equals(void *keyA, void *keyB) {
@ -487,7 +487,7 @@ static void derive_permissions_locked(struct fuse* fuse, struct node *parent,
break; break;
case PERM_ANDROID_DATA: case PERM_ANDROID_DATA:
case PERM_ANDROID_OBB: case PERM_ANDROID_OBB:
appid = (appid_t) hashmapGet(fuse->package_to_appid, node->name); appid = (appid_t) (uintptr_t) hashmapGet(fuse->package_to_appid, node->name);
if (appid != 0) { if (appid != 0) {
node->uid = multiuser_get_uid(parent->userid, appid); node->uid = multiuser_get_uid(parent->userid, appid);
} }
@ -511,7 +511,7 @@ static bool get_caller_has_rw_locked(struct fuse* fuse, const struct fuse_in_hea
} }
appid_t appid = multiuser_get_app_id(hdr->uid); appid_t appid = multiuser_get_app_id(hdr->uid);
return hashmapContainsKey(fuse->appid_with_rw, (void*) appid); return hashmapContainsKey(fuse->appid_with_rw, (void*) (uintptr_t) appid);
} }
/* Kernel has already enforced everything we returned through /* Kernel has already enforced everything we returned through
@ -1621,12 +1621,12 @@ static int read_package_list(struct fuse *fuse) {
if (sscanf(buf, "%s %d %*d %*s %*s %s", package_name, &appid, gids) == 3) { if (sscanf(buf, "%s %d %*d %*s %*s %s", package_name, &appid, gids) == 3) {
char* package_name_dup = strdup(package_name); char* package_name_dup = strdup(package_name);
hashmapPut(fuse->package_to_appid, package_name_dup, (void*) appid); hashmapPut(fuse->package_to_appid, package_name_dup, (void*) (uintptr_t) appid);
char* token = strtok(gids, ","); char* token = strtok(gids, ",");
while (token != NULL) { while (token != NULL) {
if (strtoul(token, NULL, 10) == fuse->write_gid) { if (strtoul(token, NULL, 10) == fuse->write_gid) {
hashmapPut(fuse->appid_with_rw, (void*) appid, (void*) 1); hashmapPut(fuse->appid_with_rw, (void*) (uintptr_t) appid, (void*) (uintptr_t) 1);
break; break;
} }
token = strtok(NULL, ","); token = strtok(NULL, ",");