This commit is contained in:
comex 2011-01-07 22:01:46 -05:00
parent d14d30acf7
commit 381edfadc6
2 changed files with 11 additions and 7 deletions

15
dmini.c
View File

@ -42,14 +42,19 @@ void find_second_ldm(struct binary *binary, uint32_t valid_conds, int reg, addr_
}
int offset;
if((val & 0xfdfc081) == 0x890c001) {
if((val & 0xfd0c081) == 0x890c001) {
offset = 0;
} else if((val & 0xfdfc081) == 0x990c001) {
} else if((val & 0xfd0c081) == 0x990c001) {
offset = 1;
} else {
continue;
}
uint32_t rn = (val & 0xf0000) >> 16;
if((int) rn != reg) {
continue;
}
*addrp = addr;
*num_before_r0 = offset;
*num_after_r0 = count_ones(val & 0x3f7e);
@ -105,10 +110,10 @@ void find_kernel_ldm(struct binary *binary, uint32_t valid_conds, addr_t *addrp,
// 0xfdf to be strict about user registers, 0xf9f otherwise
int offset;
if((val & 0xfd0c080) == 0x890c000) {
if((val & 0xfd08080) == 0x8908000) {
// ldmia
offset = 0;
} else if((val & 0xfd0c080) == 0x990c000) {
} else if((val & 0xfd08080) == 0x9908000) {
// ldmib
offset = 1;
} else {
@ -119,7 +124,7 @@ void find_kernel_ldm(struct binary *binary, uint32_t valid_conds, addr_t *addrp,
uint32_t reglist = val & 0x7f7f;
int ones = count_ones(reglist) + offset; // ones = offset of PC
printf("addr=%x rn=%u ones=%d val=%x\n", addr, rn, ones, val);
//printf("addr=%x rn=%u ones=%d val=%x\n", addr, rn, ones, val);
if(rn != 0 && rn != 5) goto nope;
//printf("rn=%u ones=%d\n", rn, ones);

View File

@ -129,8 +129,7 @@ void do_kernel(prange_t output, prange_t sandbox, struct binary *binary) {
addr_t sysent_patch_orig = b_read32(binary, sysent + 4);
patch("sysent patch", 0, uint32_t, {sysent + 4});
patch("sysent patch orig", 0, uint32_t, {sysent_patch_orig});
fprintf(stderr, "scratch = %x\n", scratch);
patch("scratch", 0, uint32_t, {(scratch + sandbox.size + 0xfff) & ~0xfff});
}