Merge pull request #990 from rohit-n/fix-formatting

Fix formatting
This commit is contained in:
shuffle2 committed 2014-09-06 11:54:17 -07:00
commit 1b23432d34
5 files changed
+191 -65

No files matched your search

+26 -13
View File
@@ -147,7 +147,8 @@ static gdb_bp_t *gdb_bp_empty_slot(u32 type)
if (p == nullptr)
return nullptr;
for (i = 0; i < GDB_MAX_BP; i++) {
for (i = 0; i < GDB_MAX_BP; i++)
{
if (p[i].active == 0)
return &p[i];
}
@@ -164,7 +165,8 @@ static gdb_bp_t *gdb_bp_find(u32 type, u32 addr, u32 len)
if (p == nullptr)
return nullptr;
for (i = 0; i < GDB_MAX_BP; i++) {
for (i = 0; i < GDB_MAX_BP; i++)
{
if (p[i].active == 1 &&
p[i].addr == addr &&
p[i].len == len)
@@ -178,9 +180,11 @@ static void gdb_bp_remove(u32 type, u32 addr, u32 len)
{
gdb_bp_t *p;
do {
do
{
p = gdb_bp_find(type, addr, len);
if (p != nullptr) {
if (p != nullptr)
{
DEBUG_LOG(GDB_STUB, "gdb: removed a breakpoint: %08x bytes at %08x\n", len, addr);
p->active = 0;
memset(p, 0, sizeof(gdb_bp_t));
@@ -197,7 +201,8 @@ static int gdb_bp_check(u32 addr, u32 type)
if (p == nullptr)
return 0;
for (i = 0; i < GDB_MAX_BP; i++) {
for (i = 0; i < GDB_MAX_BP; i++)
{
if (p[i].active == 1 &&
(addr >= p[i].addr && addr < p[i].addr + p[i].len))
return 1;
@@ -246,12 +251,14 @@ static void gdb_read_command()
gdb_signal(SIGTRAP);
return;
}
else if (c != GDB_STUB_START) {
else if (c != GDB_STUB_START)
{
DEBUG_LOG(GDB_STUB, "gdb: read invalid byte %02x\n", c);
return;
}
while ((c = gdb_read_byte()) != GDB_STUB_END) {
while ((c = gdb_read_byte()) != GDB_STUB_END)
{
cmd_bfr[cmd_len++] = c;
if (cmd_len == sizeof cmd_bfr)
{
@@ -266,7 +273,8 @@ static void gdb_read_command()
chk_calc = gdb_calc_chksum();
if (chk_calc != chk_read) {
if (chk_calc != chk_read)
{
ERROR_LOG(GDB_STUB, "gdb: invalid checksum: calculated %02x and read %02x for $%s# (length: %d)\n", chk_calc, chk_read, cmd_bfr, cmd_len);
cmd_len = 0;
@@ -469,13 +477,15 @@ static void gdb_read_registers()
memset(bfr, 0, sizeof bfr);
for (i = 0; i < 32; i++) {
for (i = 0; i < 32; i++)
{
wbe32hex(bufptr + i*8, GPR(i));
}
bufptr += 32 * 8;
/*
for (i = 0; i < 32; i++) {
for (i = 0; i < 32; i++)
{
wbe32hex(bufptr + i*8, riPS0(i));
}
bufptr += 32 * 8;
@@ -500,7 +510,8 @@ static void gdb_write_registers()
u32 i;
u8 * bufptr = cmd_bfr;
for (i = 0; i < 32; i++) {
for (i = 0; i < 32; i++)
{
GPR(i) = re32hex(bufptr + i*8);
}
bufptr += 32 * 8;
@@ -649,7 +660,8 @@ static void _gdb_add_bp()
u32 i, addr = 0, len = 0;
type = hex2char(cmd_bfr[1]);
switch (type) {
switch (type)
{
case 0:
case 1:
type = GDB_BP_TYPE_X;
@@ -869,7 +881,8 @@ int gdb_signal(u32 s)
sig = s;
if (send_signal) {
if (send_signal)
{
gdb_handle_signal();
send_signal = 0;
}
+15 -13
View File
@@ -12,22 +12,24 @@
namespace PowerPC
{
const u32 plru_mask[8] = {11,11,19,19,37,37,69,69};
const u32 plru_value[8] = {11,3,17,1,36,4,64,0};
const u32 plru_mask[8] = {11, 11, 19, 19, 37, 37, 69, 69};
const u32 plru_value[8] = {11, 3, 17, 1, 36, 4, 64, 0};
InstructionCache::InstructionCache()
{
for (u32 m = 0; m < 0xff; m++)
{
u32 w = 0;
while (m & (1<<w)) w++;
while (m & (1 << w))
w++;
way_from_valid[m] = w;
}
for (u32 m = 0; m < 128; m++)
{
u32 b[7];
for (int i = 0; i < 7; i++) b[i] = m & (1<<i);
for (int i = 0; i < 7; i++)
b[i] = m & (1 << i);
u32 w;
if (b[0])
if (b[2])
@@ -82,7 +84,7 @@ namespace PowerPC
// invalidates the whole set
u32 set = (addr >> 5) & 0x7f;
for (int i = 0; i < 8; i++)
if (valid[set] & (1<<i))
if (valid[set] & (1 << i))
{
if (tags[set][i] & (ICACHE_VMEM_BIT >> 12))
lookup_table_vmem[((tags[set][i] << 7) | set) & 0xfffff] = 0xff;
@@ -105,15 +107,15 @@ namespace PowerPC
u32 t;
if (addr & ICACHE_VMEM_BIT)
{
t = lookup_table_vmem[(addr>>5) & 0xfffff];
t = lookup_table_vmem[(addr >> 5) & 0xfffff];
}
else if (addr & ICACHE_EXRAM_BIT)
{
t = lookup_table_ex[(addr>>5) & 0x1fffff];
t = lookup_table_ex[(addr >> 5) & 0x1fffff];
}
else
{
t = lookup_table[(addr>>5) & 0xfffff];
t = lookup_table[(addr >> 5) & 0xfffff];
}
if (t == 0xff) // load to the cache
@@ -128,7 +130,7 @@ namespace PowerPC
// load
u8 *p = Memory::GetPointer(addr & ~0x1f);
memcpy(data[set][t], p, 32);
if (valid[set] & (1<<t))
if (valid[set] & (1 << t))
{
if (tags[set][t] & (ICACHE_VMEM_BIT >> 12))
lookup_table_vmem[((tags[set][t] << 7) | set) & 0xfffff] = 0xff;
@@ -139,17 +141,17 @@ namespace PowerPC
}
if (addr & ICACHE_VMEM_BIT)
lookup_table_vmem[(addr>>5) & 0xfffff] = t;
lookup_table_vmem[(addr >> 5) & 0xfffff] = t;
else if (addr & ICACHE_EXRAM_BIT)
lookup_table_ex[(addr>>5) & 0x1fffff] = t;
lookup_table_ex[(addr >> 5) & 0x1fffff] = t;
else
lookup_table[(addr>>5) & 0xfffff] = t;
tags[set][t] = tag;
valid[set] |= 1<<t;
valid[set] |= (1 << t);
}
// update plru
plru[set] = (plru[set] & ~plru_mask[t]) | plru_value[t];
u32 res = Common::swap32(data[set][t][(addr>>2)&7]);
u32 res = Common::swap32(data[set][t][(addr >> 2) & 7]);
return res;
}