diff options
author | Barry Wardell <rockbox@barrywardell.net> | 2007-08-01 22:17:36 +0000 |
---|---|---|
committer | Barry Wardell <rockbox@barrywardell.net> | 2007-08-01 22:17:36 +0000 |
commit | 0b8dd125c3744fbfd4b3162de7882f5dd60f5e0a (patch) | |
tree | 511d76f2b39763b4689e3fd713b69c366e8f1264 | |
parent | 307d2ddce98ef81f5cd3e5e1f24a7ddada60c486 (diff) | |
download | rockbox-0b8dd125c3744fbfd4b3162de7882f5dd60f5e0a.tar.gz rockbox-0b8dd125c3744fbfd4b3162de7882f5dd60f5e0a.zip |
FS#7182: Initial attempt by Dave Chapman at getting ARM disassembler to compile in Linux.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14127 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | utils/disassembler/arm/Makefile | 26 | ||||
-rw-r--r-- | utils/disassembler/arm/disasm_arm.c | 3 | ||||
-rw-r--r-- | utils/disassembler/arm/main.c | 6 |
3 files changed, 31 insertions, 4 deletions
diff --git a/utils/disassembler/arm/Makefile b/utils/disassembler/arm/Makefile new file mode 100644 index 0000000000..786325e27d --- /dev/null +++ b/utils/disassembler/arm/Makefile | |||
@@ -0,0 +1,26 @@ | |||
1 | CFLAGS = -Wall | ||
2 | |||
3 | ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN) | ||
4 | OUTPUT=arm_disass.exe | ||
5 | CROSS= | ||
6 | CFLAGS+=-mno-cygwin | ||
7 | else | ||
8 | OUTPUT=arm_disass | ||
9 | CROSS=i586-mingw32msvc- | ||
10 | endif | ||
11 | |||
12 | NATIVECC = gcc | ||
13 | CC = $(CROSS)gcc | ||
14 | |||
15 | all: $(OUTPUT) | ||
16 | |||
17 | arm_disass: main.c disasm_arm.c | ||
18 | gcc $(CFLAGS) -o arm_disass main.c disasm_arm.c | ||
19 | strip arm_disass | ||
20 | |||
21 | arm_disass.exe: main.c disasm_arm.c | ||
22 | $(CC) $(CFLAGS) -o arm_disass.exe main.c disasm_arm.c | ||
23 | $(CROSS)strip arm_disass.exe | ||
24 | |||
25 | clean: | ||
26 | rm -f arm_disass main.o disasm_arm.o *~ | ||
diff --git a/utils/disassembler/arm/disasm_arm.c b/utils/disassembler/arm/disasm_arm.c index 4664d0f3b2..631eb9d7db 100644 --- a/utils/disassembler/arm/disasm_arm.c +++ b/utils/disassembler/arm/disasm_arm.c | |||
@@ -1,5 +1,6 @@ | |||
1 | #include <stdio.h> | 1 | #include <stdio.h> |
2 | #include <string.h> | 2 | #include <string.h> |
3 | #include <stdint.h> | ||
3 | 4 | ||
4 | #define ULONG unsigned long | 5 | #define ULONG unsigned long |
5 | #define UCHAR unsigned char | 6 | #define UCHAR unsigned char |
@@ -194,7 +195,7 @@ void opcode_stg(char *stg, ULONG val, ULONG off) | |||
194 | 195 | ||
195 | if(val & 0x2000000) // immidiate | 196 | if(val & 0x2000000) // immidiate |
196 | { | 197 | { |
197 | off = (ULONG)((unsigned __int64)(val&0xff) << (32 - 2 * ((val >> 8) & 15))) | ((val&0xff) >> 2 * ((val >> 8) & 15)); | 198 | off = (ULONG)((uint64_t)(val&0xff) << (32 - 2 * ((val >> 8) & 15))) | ((val&0xff) >> 2 * ((val >> 8) & 15)); |
198 | sprintf(op2, FRMT" ", off); | 199 | sprintf(op2, FRMT" ", off); |
199 | } | 200 | } |
200 | else | 201 | else |
diff --git a/utils/disassembler/arm/main.c b/utils/disassembler/arm/main.c index 834dc5ff93..59dad48176 100644 --- a/utils/disassembler/arm/main.c +++ b/utils/disassembler/arm/main.c | |||
@@ -10,7 +10,7 @@ ULONG isdata[1000000]; /* each bit defines one byte as: code=0, data=1 */ | |||
10 | 10 | ||
11 | extern void dis_asm(ULONG off, ULONG val, char *stg); | 11 | extern void dis_asm(ULONG off, ULONG val, char *stg); |
12 | 12 | ||
13 | void main(int argc, char **argv) | 13 | int main(int argc, char **argv) |
14 | { | 14 | { |
15 | FILE *in, *out; | 15 | FILE *in, *out; |
16 | char *ptr, stg[256]; | 16 | char *ptr, stg[256]; |
@@ -20,7 +20,7 @@ void main(int argc, char **argv) | |||
20 | 20 | ||
21 | if(argc == 1 || strcmp(argv[1], "--help") == 0) | 21 | if(argc == 1 || strcmp(argv[1], "--help") == 0) |
22 | { printf("Usage: arm_disass [input file]\n"); | 22 | { printf("Usage: arm_disass [input file]\n"); |
23 | printf(" disassembles input file to 'disasm.txt'"); | 23 | printf(" disassembles input file to 'disasm.txt'\n"); |
24 | exit(-1); | 24 | exit(-1); |
25 | } | 25 | } |
26 | 26 | ||
@@ -115,4 +115,4 @@ void main(int argc, char **argv) | |||
115 | } | 115 | } |
116 | 116 | ||
117 | fclose(in); | 117 | fclose(in); |
118 | } \ No newline at end of file | 118 | } |