ARM7: Make component numbers be size_t instead of int

This commit is contained in:
Jeffrey Pfau 2015-02-04 02:35:30 -08:00
parent f62c068a2c
commit f9110fc51e
3 changed files with 8 additions and 8 deletions

View File

@ -71,7 +71,7 @@ static inline enum RegisterBank _ARMSelectBank(enum PrivilegeMode mode) {
void ARMInit(struct ARMCore* cpu) { void ARMInit(struct ARMCore* cpu) {
cpu->master->init(cpu, cpu->master); cpu->master->init(cpu, cpu->master);
int i; size_t i;
for (i = 0; i < cpu->numComponents; ++i) { for (i = 0; i < cpu->numComponents; ++i) {
if (cpu->components[i] && cpu->components[i]->init) { if (cpu->components[i] && cpu->components[i]->init) {
cpu->components[i]->init(cpu, cpu->components[i]); cpu->components[i]->init(cpu, cpu->components[i]);
@ -83,7 +83,7 @@ void ARMDeinit(struct ARMCore* cpu) {
if (cpu->master->deinit) { if (cpu->master->deinit) {
cpu->master->deinit(cpu->master); cpu->master->deinit(cpu->master);
} }
int i; size_t i;
for (i = 0; i < cpu->numComponents; ++i) { for (i = 0; i < cpu->numComponents; ++i) {
if (cpu->components[i] && cpu->components[i]->deinit) { if (cpu->components[i] && cpu->components[i]->deinit) {
cpu->components[i]->deinit(cpu->components[i]); cpu->components[i]->deinit(cpu->components[i]);
@ -97,14 +97,14 @@ void ARMSetComponents(struct ARMCore* cpu, struct ARMComponent* master, int extr
cpu->components = extras; cpu->components = extras;
} }
void ARMHotplugAttach(struct ARMCore* cpu, int slot) { void ARMHotplugAttach(struct ARMCore* cpu, size_t slot) {
if (slot >= cpu->numComponents) { if (slot >= cpu->numComponents) {
return; return;
} }
cpu->components[slot]->init(cpu, cpu->components[slot]); cpu->components[slot]->init(cpu, cpu->components[slot]);
} }
void ARMHotplugDetach(struct ARMCore* cpu, int slot) { void ARMHotplugDetach(struct ARMCore* cpu, size_t slot) {
if (slot >= cpu->numComponents) { if (slot >= cpu->numComponents) {
return; return;
} }

View File

@ -158,15 +158,15 @@ struct ARMCore {
struct ARMComponent* master; struct ARMComponent* master;
int numComponents; size_t numComponents;
struct ARMComponent** components; struct ARMComponent** components;
}; };
void ARMInit(struct ARMCore* cpu); void ARMInit(struct ARMCore* cpu);
void ARMDeinit(struct ARMCore* cpu); void ARMDeinit(struct ARMCore* cpu);
void ARMSetComponents(struct ARMCore* cpu, struct ARMComponent* master, int extra, struct ARMComponent** extras); void ARMSetComponents(struct ARMCore* cpu, struct ARMComponent* master, int extra, struct ARMComponent** extras);
void ARMHotplugAttach(struct ARMCore* cpu, int slot); void ARMHotplugAttach(struct ARMCore* cpu, size_t slot);
void ARMHotplugDetach(struct ARMCore* cpu, int slot); void ARMHotplugDetach(struct ARMCore* cpu, size_t slot);
void ARMReset(struct ARMCore* cpu); void ARMReset(struct ARMCore* cpu);
void ARMSetPrivilegeMode(struct ARMCore*, enum PrivilegeMode); void ARMSetPrivilegeMode(struct ARMCore*, enum PrivilegeMode);

View File

@ -20,7 +20,7 @@ static uint32_t _popcount32(unsigned bits) {
#define FIND_DEBUGGER(DEBUGGER, CPU) \ #define FIND_DEBUGGER(DEBUGGER, CPU) \
{ \ { \
DEBUGGER = 0; \ DEBUGGER = 0; \
int i; \ size_t i; \
for (i = 0; i < CPU->numComponents; ++i) { \ for (i = 0; i < CPU->numComponents; ++i) { \
if (CPU->components[i]->id == ARM_DEBUGGER_ID) { \ if (CPU->components[i]->id == ARM_DEBUGGER_ID) { \
DEBUGGER = (struct ARMDebugger*) cpu->components[i]; \ DEBUGGER = (struct ARMDebugger*) cpu->components[i]; \