/* src/vm/jit/arm/asmpart.S - Java-C interface functions for ARM
- Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
+ Copyright (C) 1996-2005, 2006, 2007 R. Grafl, A. Krall, C. Kruegel,
C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
J. Wenninger, Institut f. Computersprachen - TU Wien
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- Contact: cacao@cacaojvm.org
-
- Authors: Michael Starzinger
-
- Changes: Christian Thalinger
-
- $Id: asmpart.S 6541 2006-08-22 14:48:01Z twisti $
+ $Id: asmpart.S 7227 2007-01-18 13:21:36Z twisti $
*/
str ip, [sp, #-4]! /* store fake address */
mov mptr, sp /* set method pointer */
- mov itmp1, a1 /* pass methodinfo* via ITMP1 */
+ mov itmp1, a0 /* pass methodinfo* via ITMP1 */
- cmp a2, #0 /* do we have arguments? */
+ cmp a1, #0 /* do we have arguments? */
ble asm_calljava_copyfinish /* no -> do not care :-) */
/* REMEMBER: stack space for arguments is reserved here! */
/* TODO: we possibly reserve to much here */
- mov v1, a2, lsl #3 /* how much stack do we alloc? */
+ mov v1, a1, lsl #3 /* how much stack do we alloc? */
sub sp, sp, v1 /* allocate stack for arguments! */
mov itmp3, #0 /* stack position */
asm_calljava_copyloop: /* reorder stack arguments! */
#if defined(__ARMEL__)
- ldr ip, [a3,#offvmargdata] /* get LOW word of argument */
+ ldr ip, [a2,#offvmargdata] /* get LOW word of argument */
str ip, [sp, itmp3]
add itmp3, itmp3, #4
- ldr ip, [a3,#offvmargtype] /* is it a 2_WORD_TYPE? */
+ ldr ip, [a2,#offvmargtype] /* is it a 2_WORD_TYPE? */
tst ip, #1
- ldrne ip, [a3,#offvmargdata + 4] /* yes -> get HIGH word of argument */
+ ldrne ip, [a2,#offvmargdata + 4] /* yes -> get HIGH word of argument */
strne ip, [sp, itmp3]
addne itmp3, itmp3, #4
#else /* defined(__ARMEB__) */
- ldr ip, [a3,#offvmargtype + 4] /* get our item type (it is u8) */
+ ldr ip, [a2,#offvmargtype + 4] /* get our item type (it is u8) */
teq ip, #2 /* is it a TYPE_FLOAT? */
- ldreq ip, [a3,#offvmargdata] /* yes -> get LOW word of float */
+ ldreq ip, [a2,#offvmargdata] /* yes -> get LOW word of float */
streq ip, [sp, itmp3]
addeq itmp3, itmp3, #4
beq asm_calljava_copydone
tst ip, #1 /* is it a 2_WORD_TYPE? */
- ldrne ip, [a3,#offvmargdata] /* yes -> get HIGH word of argument */
+ ldrne ip, [a2,#offvmargdata] /* yes -> get HIGH word of argument */
strne ip, [sp, itmp3]
addne itmp3, itmp3, #4
- ldr ip, [a3,#offvmargdata + 4] /* get LOW word of argument */
+ ldr ip, [a2,#offvmargdata + 4] /* get LOW word of argument */
str ip, [sp, itmp3]
add itmp3, itmp3, #4
asm_calljava_copydone:
#endif
- add a3, a3, #sizevmarg /* next argument block */
- subs a2, a2, #1
+ add a2, a2, #sizevmarg /* next argument block */
+ subs a1, a1, #1
bgt asm_calljava_copyloop
/* REMEMBER: first four args are passed in regs, take them out again */
- ldmfd sp, {a1, a2, a3, a4} /* load first four args to register */
+ ldmfd sp, {a0, a1, a2, a3} /* load first four args to register */
cmp v1, #16 /* do we have four arguments? */
addlt sp, sp, v1
movlt v1, #0
RESTORE_SCRATCH_REGS_AND_RETURN /* return to caller, restore regs */
asm_vm_call_method_exception_handler:
- mov a1, xptr /* exception pointer is arg1 */
+ mov a0, xptr /* exception pointer is arg1 */
bl builtin_throw_exception /* throw the exception */
mov res1, #0 /* return NULL */
mov res2, #0 /* return NULL */
RESTORE_SCRATCH_REGS_AND_RETURN /* return to caller, restore regs */
asm_vm_call_method_float:
- mov a1,#0x51
+ mov a0,#0x51
b asm_debug
asm_vm_call_method_double:
- mov a1,#0x52
+ mov a0,#0x52
b asm_debug
asm_call_jit_compiler:
SAVE_ARGUMENT_REGISTERS /* save our argument registers & LR */
- mov a1, itmp1 /* pass methodinfo pointer */
- mov a2, mptr /* pass method pointer */
- add a3, sp, #MYSTACKSIZE /* pass Java sp */
- mov a4, lr /* pass Java RA (correct for leafs) */
+ mov a0, itmp1 /* pass methodinfo pointer */
+ mov a1, mptr /* pass method pointer */
+ add a2, sp, #MYSTACKSIZE /* pass Java sp */
+ mov a3, lr /* pass Java RA (correct for leafs) */
bl jit_asm_compile
mov itmp1, res1 /* save pointer to new jit-code */
asm_handle_nat_exception:
/*TODO:maybe make a macro out of it!!!*/
SAVE_ARGUMENT_REGISTERS
- mov a1, lr
+ mov a0, lr
bl md_codegen_get_pv_from_pc
mov ip, res1
RESTORE_ARGUMENT_REGISTERS
asm_handle_exception:
stmfd sp!, {r0 - r3} /* save possible used registers */
mov itmp3, #1 /* set maybe-leaf flag */
- mov a4, #(4*4) /* prepare a4 for handle_exception */
+ mov a3, #(4*4) /* prepare a3 for handle_exception */
asm_handle_exception_loop:
stmfd sp!, {ip,lr} /* call exception helper here! */
- mov a1, xptr /* pass exception pointer */
- mov a2, xpc /* pass exception pointer */
- mov a3, ip /* pass data segment pointer */
- add a4, sp, a4 /* calculate Java sp into a4... */
- add a4, a4, #(2*4)
+ mov a0, xptr /* pass exception pointer */
+ mov a1, xpc /* pass exception pointer */
+ mov a2, ip /* pass data segment pointer */
+ add a3, sp, a3 /* calculate Java sp into a3... */
+ add a3, a3, #(2*4)
bl exceptions_handle_exception
ldmfd sp!, {ip,lr}
- tst a1, a1
+ tst a0, a0
beq asm_handle_exception_not_catched
- mov xpc, a1 /* move handlerpc into xpc */
+ mov xpc, a0 /* move handlerpc into xpc */
tst itmp3,itmp3 /* if this is a lead method ... */
ldmnefd sp!, {r0 - r3} /* restore argument registers */
addne sp, sp, #(4*4) /* remove maybe-leaf stackframe */
movne itmp3, #0 /* remove maybe-leaf flag */
- ldr a3, [ip, #FrameSize] /* t2 = frame size */
- add a1, sp, a3 /* t0 = pointer to save area */
- ldr a2, [ip, #IsLeaf] /* t1 = is leaf procedure */
- tst a2, a2 /* if is leaf ... */
- ldreq lr, [a1, #-4]! /* ... restore RA */
+ ldr a2, [ip, #FrameSize] /* t2 = frame size */
+ add a0, sp, a2 /* t0 = pointer to save area */
+ ldr a1, [ip, #IsLeaf] /* t1 = is leaf procedure */
+ tst a1, a1 /* if is leaf ... */
+ ldreq lr, [a0, #-4]! /* ... restore RA */
mov xpc, lr /* the new xpc is RA */
- ldr a2, [ip, #IntSave] /* t1 = saved int register count */
- rsb a2, a2, #5 /* t1 = count of unsaved registers */
- sub a2, a2, #1
- add pc, pc, a2, lsl #2 /* do not load unsaved registers */
- ldr v1, [a1, #-20] /* ... but restore the other ones */
- ldr v2, [a1, #-16]
- ldr v3, [a1, #-12]
- ldr v4, [a1, #- 8]
- ldr v5, [a1, #- 4]
+ ldr a1, [ip, #IntSave] /* t1 = saved int register count */
+ rsb a1, a1, #5 /* t1 = count of unsaved registers */
+ sub a1, a1, #1
+ add pc, pc, a1, lsl #2 /* do not load unsaved registers */
+ ldr v1, [a0, #-20] /* ... but restore the other ones */
+ ldr v2, [a0, #-16]
+ ldr v3, [a0, #-12]
+ ldr v4, [a0, #- 8]
+ ldr v5, [a0, #- 4]
- add sp, sp, a3 /* unwind stack (using t2) */
- mov a4, #0 /* prepare a4 for handle_exception */
+ add sp, sp, a2 /* unwind stack (using t2) */
+ mov a3, #0 /* prepare a3 for handle_exception */
/*TODO:maybe make a macro out of it!!!*/
SAVE_ARGUMENT_REGISTERS
- mov a1, lr
+ mov a0, lr
bl md_codegen_get_pv_from_pc
mov ip, res1
RESTORE_ARGUMENT_REGISTERS
SAVE_ARGUMENT_REGISTERS_IP /* save our argument registers & LR */
SAVE_FLOAT_REGISTERS /* save our float registers here */
- mov a1, itmp3 /* pass SP of patcher stub */
- mov a2, ip /* pass PV */
- mov a3, lr /* pass RA (correct for leafs) */
+ mov a0, itmp3 /* pass SP of patcher stub */
+ mov a1, ip /* pass PV */
+ mov a2, lr /* pass RA (correct for leafs) */
bl patcher_wrapper
mov itmp3, res1 /* save return value */
asm_abstractmethoderror:
stmfd sp!, {lr} /* save return address */
- add a1, sp, #(1*4) /* pass java sp */
- mov a2, lr /* pass exception address */
+ add a0, sp, #(1*4) /* pass java sp */
+ mov a1, lr /* pass exception address */
bl exceptions_asm_new_abstractmethoderror
ldmfd sp!, {lr} /* restore return address */
#if 1
.equ sys_cacheflush, 0x9f0002
asm_cacheflush:
- add a2, a1, a2
- mov a3, #0
- #if 1
- /* TODO: repeair this! */
- /* cacheflush is messed up beyond all repair! */
- mov a1, #0x0
- mov a2, #0xff000000
- #endif
+ add a1, a0, a1
+ mov a2, #0
+
+#if 0
+ /* TWISTI: required on iyonix, maybe a linux-2.4 bug */
+ /* TODO: repeair this! */
+ /* cacheflush is messed up beyond all repair! */
+ mov a0, #0x0
+ mov a1, #0xff000000
+#endif
+
swi #sys_cacheflush
mov pc, lr
-#else
-.equ IMBa, 0xf00000
-.equ IMBb, 0xf00001
-asm_cacheflush:
- /* clean and invalidate the entire cache!!! */
- swi #IMBa
- mov pc, lr
#endif
stmfd sp!, {r4, r5, r6}
_crit_restart:
_crit_begin:
- ldr r4,[a1,#offbaseval]
- ldr r5,[a1,#offdiffval]
- ldr r6,[a2,#offbaseval]
+ ldr r4,[a0,#offbaseval]
+ ldr r5,[a0,#offdiffval]
+ ldr r6,[a1,#offbaseval]
_crit_end:
- str r4,[a3,#offcast_super_baseval]
- str r5,[a3,#offcast_super_diffval]
- str r6,[a3,#offcast_sub_baseval]
+ str r4,[a2,#offcast_super_baseval]
+ str r5,[a2,#offcast_super_diffval]
+ str r6,[a2,#offcast_sub_baseval]
ldmfd sp!, {r4, r5, r6}
mov pc, lr
/* src/vm/jit/arm/md-asm.h - assembler defines for arm ABI
- Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
+ Copyright (C) 1996-2005, 2006, 2007 R. Grafl, A. Krall, C. Kruegel,
C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
J. Wenninger, Institut f. Computersprachen - TU Wien
Contact: cacao@cacaojvm.org
Authors: Michael Starzinger
+ Christian Thalinger
- Changes: Christian Thalinger
-
- $Id: md-asm.h 6514 2006-02-17 20:05:00Z michi $
+ $Id: md-asm.h 7227 2007-01-18 13:21:36Z twisti $
*/
#define res1 r0 /* result registers */
#define res2 r1
-#define a1 r0 /* argument registers */
-#define a2 r1
-#define a3 r2
-#define a4 r3
+#define a0 r0 /* argument registers */
+#define a1 r1
+#define a2 r2
+#define a3 r3
#define v1 r4 /* variable registers */
#define v2 r5
/* save and restore macros ****************************************************/
#define SAVE_ARGUMENT_REGISTERS \
- stmfd sp!, {a1,a2,a3,a4,lr}
+ stmfd sp!, {a0,a1,a2,a3,lr}
#define SAVE_ARGUMENT_REGISTERS_IP \
- stmfd sp!, {a1,a2,a3,a4,ip,lr}
+ stmfd sp!, {a0,a1,a2,a3,ip,lr}
#if defined(ENABLE_SOFTFLOAT)
# define SAVE_FLOAT_REGISTERS
#define RESTORE_ARGUMENT_REGISTERS \
- ldmfd sp!, {a1,a2,a3,a4,lr}
+ ldmfd sp!, {a0,a1,a2,a3,lr}
#define RESTORE_ARGUMENT_REGISTERS_IP \
- ldmfd sp!, {a1,a2,a3,a4,ip,lr}
+ ldmfd sp!, {a0,a1,a2,a3,ip,lr}
#if defined(ENABLE_SOFTFLOAT)
# define RESTORE_FLOAT_REGISTERS