Skip to content

Commit

Permalink
GdbARMAlien64 generation
Browse files Browse the repository at this point in the history
  • Loading branch information
eliotmiranda committed Jan 23, 2018
1 parent 988252f commit 32e860a
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 6 deletions.
31 changes: 31 additions & 0 deletions processors/ARM/exploration/Makefile64
@@ -0,0 +1,31 @@
LIBDEPS=../cpu/libcpu.a
GDBARM=../../../processors/ARM/gdb-7.10
GDBARMEXP=.
INCLUDES := -I$(GDBARM)/include \
-I$(GDBARM)/sim/arm \
-I$(GDBARM)/bfd \
-I../bfd
LIBS:=-L../bfd -L../libiberty -L../opcodes -L../sim/arm -L../zlib \
-lbfd -liberty -lopcodes -lopcodes -lsim -lz
CFLAGS=-m64 -DFOR64BITS=1 -DMODET $(INCLUDES) $(LIBS)

.PHONY: $(LIBDEPS)

all: GdbARMAlien64-regs.st GdbARMAlien64-vfp.st

GdbARMAlien64-regs.st: printcpu64
./printcpu64 >GdbARMAlien64-regs.st

GdbARMAlien64-vfp.st: printcpuvfp64
./printcpuvfp64 >GdbARMAlien64-vfp.st

clean:
rm -f GdbARMAlien64-regs.st GdbARMAlien64-vfp.st
rm -f printcpu64 printcpuvfp64
rm -f printcpu64.exe printcpuvfp64.exe

printcpu64: $(GDBARMEXP)/printcpu.c $(LIBDEPS)
$(CC) -o $@ $< $(CFLAGS)

printcpuvfp64: $(GDBARMEXP)/printcpuvfp.c $(LIBDEPS)
$(CC) -o $@ $< $(CFLAGS)
12 changes: 9 additions & 3 deletions processors/ARM/exploration/printcpu.c
Expand Up @@ -20,16 +20,22 @@ lower(char *s)
return buf;
}

#if FOR64BITS
# define CLASS "!GdbARMAlien64"
#else
# define CLASS "!GdbARMAlien"
#endif

int
main()
{
#define offsetof(type,field) (long)(&(((type *)0)->field))
#define stoffsetof(type,field) (offsetof(type,field)+1)
#define print(n,r) \
printf("!GdbARMAlien methodsFor: 'accessing' stamp: 'eem %d/%d/%d %d:%02d'!\r"\
printf(CLASS " methodsFor: 'accessing' stamp: 'eem %d/%d/%d %d:%02d'!\r"\
"%s\r\t^self unsignedLongAt: %ld! !\r", m,d,y,h,i, lower(#r), \
stoffsetof(ARMul_State,Reg[n]));\
printf("!GdbARMAlien methodsFor: 'accessing' stamp: 'eem %d/%d/%d %d:%02d'!\r"\
printf(CLASS " methodsFor: 'accessing' stamp: 'eem %d/%d/%d %d:%02d'!\r"\
"%s: anUnsignedInteger\r\t^self unsignedLongAt: %ld put: anUnsignedInteger! !\r", m,d,y,h,i, lower(#r), \
stoffsetof(ARMul_State,Reg[n]))

Expand All @@ -42,7 +48,7 @@ printf("!GdbARMAlien methodsFor: 'accessing' stamp: 'eem %d/%d/%d %d:%02d'!\r"\
int i = now.tm_min;

printf("\"Hello world!!\"!\r");
printf("!GdbARMAlien class methodsFor: 'instance creation' stamp: 'eem %d/%d/%d %d:%02d'!\r"
printf(CLASS " class methodsFor: 'instance creation' stamp: 'eem %d/%d/%d %d:%02d'!\r"
"dataSize\r\t^%ld! !\r", m,d,y,h,i, sizeof(ARMul_State));

print(0,r0);
Expand Down
12 changes: 9 additions & 3 deletions processors/ARM/exploration/printcpuvfp.c
Expand Up @@ -20,16 +20,22 @@ lower(char *s)
return buf;
}

#if FOR64BITS
# define CLASS "!GdbARMAlien64"
#else
# define CLASS "!GdbARMAlien"
#endif

int
main()
{
#define offsetof(type,field) (long)(&(((type *)0)->field))
#define stoffsetof(type,field) (offsetof(type,field)+1)
#define print(n,r) \
printf("!GdbARMAlien methodsFor: 'accessing' stamp: 'eem %d/%d/%d %d:%02d'!\r"\
printf(CLASS " methodsFor: 'accessing' stamp: 'eem %d/%d/%d %d:%02d'!\r"\
"%s\r\t^self unsignedLongLongAt: %ld! !\r", m,d,y,h,i, lower(#r), \
stoffsetof(ARMul_State,VFP_Reg[n].dword));\
printf("!GdbARMAlien methodsFor: 'accessing' stamp: 'eem %d/%d/%d %d:%02d'!\r"\
printf(CLASS " methodsFor: 'accessing' stamp: 'eem %d/%d/%d %d:%02d'!\r"\
"%s: anUnsignedInteger\r\t^self unsignedLongLongAt: %ld put: anUnsignedInteger! !\r", m,d,y,h,i, lower(#r), \
stoffsetof(ARMul_State,VFP_Reg[n].dword))

Expand All @@ -42,7 +48,7 @@ printf("!GdbARMAlien methodsFor: 'accessing' stamp: 'eem %d/%d/%d %d:%02d'!\r"\
int i = now.tm_min;

printf("\"Hello world!!\"!\r");
printf("!GdbARMAlien class methodsFor: 'instance creation' stamp: 'eem %d/%d/%d %d:%02d'!\r"
printf(CLASS " class methodsFor: 'instance creation' stamp: 'eem %d/%d/%d %d:%02d'!\r"
"dataSize\r\t^%ld! !\r", m,d,y,h,i, sizeof(ARMul_State));

print(0,d0);
Expand Down

0 comments on commit 32e860a

Please sign in to comment.