mirror of
https://github.com/kanjitalk755/macemu.git
synced 2025-01-12 01:30:03 +00:00
code whitespace cleanup and patch_relocations() function
This commit is contained in:
parent
df4aef1fba
commit
f4705aa5e1
@ -483,6 +483,7 @@ void put32(uint32_t *p, uint32_t val)
|
|||||||
void gen_code(const char *name, const char *demangled_name,
|
void gen_code(const char *name, const char *demangled_name,
|
||||||
host_ulong offset, host_ulong size,
|
host_ulong offset, host_ulong size,
|
||||||
FILE *outfile, int gen_switch, const char *prefix);
|
FILE *outfile, int gen_switch, const char *prefix);
|
||||||
|
void patch_relocations(FILE *outfile, const char *name, host_ulong size, host_ulong start_offset);
|
||||||
|
|
||||||
static void do_print_code(FILE *outfile, const char *name, const uint8_t *code_p, int code_size, int is_code)
|
static void do_print_code(FILE *outfile, const char *name, const uint8_t *code_p, int code_size, int is_code)
|
||||||
{
|
{
|
||||||
@ -2055,8 +2056,17 @@ void gen_code(const char *name, const char *demangled_name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* patch relocations */
|
/* patch relocations */
|
||||||
#if defined(HOST_I386)
|
patch_relocations(outfile, name, size, start_offset);
|
||||||
|
fprintf(outfile, " inc_code_ptr(%d);\n", copy_size);
|
||||||
|
fprintf(outfile, "}\n");
|
||||||
|
fprintf(outfile, "#endif\n");
|
||||||
|
fprintf(outfile, "\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void patch_relocations(FILE *outfile, const char *name, host_ulong size, host_ulong start_offset)
|
||||||
{
|
{
|
||||||
|
#if defined(HOST_I386)
|
||||||
#ifdef CONFIG_FORMAT_MACH
|
#ifdef CONFIG_FORMAT_MACH
|
||||||
struct scattered_relocation_info *scarel;
|
struct scattered_relocation_info *scarel;
|
||||||
struct relocation_info * rel;
|
struct relocation_info * rel;
|
||||||
@ -2200,9 +2210,7 @@ void gen_code(const char *name, const char *demangled_name,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
#elif defined(HOST_X86_64)
|
#elif defined(HOST_X86_64)
|
||||||
{
|
|
||||||
#if defined(CONFIG_FORMAT_MACH)
|
#if defined(CONFIG_FORMAT_MACH)
|
||||||
struct relocation_info * rel;
|
struct relocation_info * rel;
|
||||||
char final_sym_name[256];
|
char final_sym_name[256];
|
||||||
@ -2324,9 +2332,7 @@ void gen_code(const char *name, const char *demangled_name,
|
|||||||
#else
|
#else
|
||||||
#error unsupport object format for HOST_X86_64
|
#error unsupport object format for HOST_X86_64
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
#elif defined(HOST_PPC)
|
#elif defined(HOST_PPC)
|
||||||
{
|
|
||||||
#ifdef CONFIG_FORMAT_ELF
|
#ifdef CONFIG_FORMAT_ELF
|
||||||
char final_sym_name[256];
|
char final_sym_name[256];
|
||||||
int type;
|
int type;
|
||||||
@ -2468,9 +2474,7 @@ void gen_code(const char *name, const char *demangled_name,
|
|||||||
#else
|
#else
|
||||||
#error unsupport object format
|
#error unsupport object format
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
#elif defined(HOST_S390)
|
#elif defined(HOST_S390)
|
||||||
{
|
|
||||||
char final_sym_name[256];
|
char final_sym_name[256];
|
||||||
int type;
|
int type;
|
||||||
int addend;
|
int addend;
|
||||||
@ -2501,9 +2505,7 @@ void gen_code(const char *name, const char *demangled_name,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#elif defined(HOST_ALPHA)
|
#elif defined(HOST_ALPHA)
|
||||||
{
|
|
||||||
for (i = 0, rel = relocs; i < nb_relocs; i++, rel++) {
|
for (i = 0, rel = relocs; i < nb_relocs; i++, rel++) {
|
||||||
if (rel->r_offset >= start_offset && rel->r_offset < start_offset + copy_size) {
|
if (rel->r_offset >= start_offset && rel->r_offset < start_offset + copy_size) {
|
||||||
int type;
|
int type;
|
||||||
@ -2555,9 +2557,7 @@ void gen_code(const char *name, const char *demangled_name,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#elif defined(HOST_IA64)
|
#elif defined(HOST_IA64)
|
||||||
{
|
|
||||||
char final_sym_name[256];
|
char final_sym_name[256];
|
||||||
int type;
|
int type;
|
||||||
int addend;
|
int addend;
|
||||||
@ -2577,9 +2577,7 @@ void gen_code(const char *name, const char *demangled_name,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#elif defined(HOST_SPARC)
|
#elif defined(HOST_SPARC)
|
||||||
{
|
|
||||||
char final_sym_name[256];
|
char final_sym_name[256];
|
||||||
int type;
|
int type;
|
||||||
int addend;
|
int addend;
|
||||||
@ -2642,9 +2640,7 @@ void gen_code(const char *name, const char *demangled_name,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#elif defined(HOST_SPARC64)
|
#elif defined(HOST_SPARC64)
|
||||||
{
|
|
||||||
char final_sym_name[256];
|
char final_sym_name[256];
|
||||||
int type;
|
int type;
|
||||||
int addend;
|
int addend;
|
||||||
@ -2697,9 +2693,7 @@ void gen_code(const char *name, const char *demangled_name,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#elif defined(HOST_ARM)
|
#elif defined(HOST_ARM)
|
||||||
{
|
|
||||||
char final_sym_name[256];
|
char final_sym_name[256];
|
||||||
int type;
|
int type;
|
||||||
int addend;
|
int addend;
|
||||||
@ -2731,9 +2725,7 @@ void gen_code(const char *name, const char *demangled_name,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#elif defined(HOST_M68K)
|
#elif defined(HOST_M68K)
|
||||||
{
|
|
||||||
char final_sym_name[256];
|
char final_sym_name[256];
|
||||||
int type;
|
int type;
|
||||||
int addend;
|
int addend;
|
||||||
@ -2762,9 +2754,7 @@ void gen_code(const char *name, const char *demangled_name,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#elif defined(HOST_MIPS)
|
#elif defined(HOST_MIPS)
|
||||||
{
|
|
||||||
char final_sym_name[256];
|
char final_sym_name[256];
|
||||||
int type;
|
int type;
|
||||||
int addend;
|
int addend;
|
||||||
@ -2805,15 +2795,9 @@ void gen_code(const char *name, const char *demangled_name,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
#error unsupported CPU
|
#error unsupported CPU
|
||||||
#endif
|
#endif
|
||||||
fprintf(outfile, " inc_code_ptr(%d);\n", copy_size);
|
|
||||||
fprintf(outfile, "}\n");
|
|
||||||
fprintf(outfile, "#endif\n");
|
|
||||||
fprintf(outfile, "\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int gen_file(FILE *outfile, int out_type)
|
int gen_file(FILE *outfile, int out_type)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user