Commit ef224ce1 authored by Wayne Ren's avatar Wayne Ren Committed by Maureen Helm
Browse files

ARC: make the assembly codes compatible



Make the assembly codes compatible with both GNU
and Metaware toolchain.

* replace ".balign" with ".align"
  ".align" assembler directive is supposed by all
  ARC toolchains and it is implemented in a same
  way across ARC toolchains.
* replace "mov_s __certain_reg" with "mov __certain_reg"
  Even though GCC encodes those mnemonics and even real
  HW executes them according to PRM these are restricted
  ones for mov_s and CCAC rightfully refuses to accept
  such mnemonics. So for compatibility and clarity sake
  we switch to 32-bit mov instruction which allows use
  of all those instructions.
* Add "%%" prefix while accessing registers from inline
  ASM as it is required by MWDT.
* Drop "@" prefix while accessing symbols (defined in C
  code) from ASM code as it is required by MWDT.

Signed-off-by: default avatarWayne Ren <wei.ren@synopsys.com>

/#
parent 596cd869
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ GTEXT(arch_cpu_atomic_idle)
GDATA(z_arc_cpu_sleep_mode)

SECTION_VAR(BSS, z_arc_cpu_sleep_mode)
	.balign 4
	.align 4
	.word 0

/*
+6 −6
Original line number Diff line number Diff line
@@ -126,7 +126,7 @@ firq_nest_1:
firq_nest:
#endif
	push_s r0
	j @_isr_demux
	j _isr_demux



@@ -163,7 +163,7 @@ SECTION_FUNC(TEXT, _firq_exit)

	/* fall to no switch */

.balign 4
.align 4
_firq_no_switch:
	/* restore interrupted context' sp */
	pop sp
@@ -176,7 +176,7 @@ _firq_no_switch:
#endif
	rtie

.balign 4
.align 4
_firq_switch:
	/* restore interrupted context' sp */
	pop sp
@@ -261,14 +261,14 @@ _firq_create_irq_stack_frame:

	/* fall through */

.balign 4
.align 4
_firq_switch_from_coop:

	_set_misc_regs_irq_switch_from_coop

	/* pc into ilink */
	pop_s r0
	mov_s ilink, r0
	mov ilink, r0

	pop_s r0 /* status32 into r0 */
	sr r0, [_ARC_V2_STATUS32_P0]
@@ -282,7 +282,7 @@ _firq_switch_from_coop:
#endif
	rtie

.balign 4
.align 4
_firq_switch_from_rirq:
_firq_switch_from_firq:

+5 −5
Original line number Diff line number Diff line
@@ -84,7 +84,7 @@ _exc_entry:
	 * and exception is raised, then here it's guaranteed that
	 * exception handling has necessary stack to use
	 */
	mov_s ilink, sp
	mov ilink, sp
	_get_curr_cpu_irq_stack sp
	sub sp, sp, (CONFIG_ISR_STACK_SIZE - CONFIG_ARC_EXCEPTION_STACK_SIZE)

@@ -104,7 +104,7 @@ _exc_entry:
	/* sp is parameter of _Fault */
	mov_s r0, sp
	/* ilink is the thread's original sp */
	mov_s r1, ilink
	mov r1, ilink
	jl _Fault

_exc_return:
@@ -143,7 +143,7 @@ _exc_return:
	/* save r2 in ilink because of the possible following reg
	 * bank switch
	 */
	mov_s ilink, r2
	mov ilink, r2
#endif
	lr r3, [_ARC_V2_STATUS32]
	and r3,r3,(~(_ARC_V2_STATUS32_AE | _ARC_V2_STATUS32_RB(7)))
@@ -187,7 +187,7 @@ _exc_return_from_exc:
	sr r0, [_ARC_V2_ERET]

	_pop_irq_stack_frame
	mov_s sp, ilink
	mov sp, ilink
	rtie

/* separated entry for trap which may be used by irq_offload, USERPSACE */
@@ -199,7 +199,7 @@ SECTION_SUBSEC_FUNC(TEXT,__fault,__ev_trap)
	cmp ilink, _TRAP_S_CALL_SYSTEM_CALL
	bne _do_non_syscall_trap
	/* do sys_call */
	mov_s ilink, K_SYSCALL_LIMIT
	mov ilink, K_SYSCALL_LIMIT
	cmp r6, ilink
	blo valid_syscall_id

+8 −8
Original line number Diff line number Diff line
@@ -63,17 +63,17 @@ void z_arc_firq_stack_set(void)
/* only ilink will not be banked, so use ilink as channel
 * between 2 banks
 */
	"mov ilink, %0		\n\t"
	"mov %%ilink, %0\n\t"
	"lr %0, [%1]\n\t"
	"or %0, %0, %2\n\t"
	"kflag %0\n\t"
	"mov sp, ilink		\n\t"
	"mov %%sp, %%ilink\n\t"
/* switch back to bank0, use ilink to avoid the pollution of
 * bank1's gp regs.
 */
	"lr ilink, [%1]		\n\t"
	"and ilink, ilink, %3	\n\t"
	"kflag ilink		\n\t"
	"lr %%ilink, [%1]\n\t"
	"and %%ilink, %%ilink, %3\n\t"
	"kflag %%ilink\n\t"
	:
	: "r"(firq_sp), "i"(_ARC_V2_STATUS32),
	  "i"(_ARC_V2_STATUS32_RB(1)),
+3 −3
Original line number Diff line number Diff line
@@ -269,7 +269,7 @@ SECTION_FUNC(TEXT, _rirq_exit)
	mov r2, r0

/* _rirq_newthread_switch required by exception handling */
.balign 4
.align 4
_rirq_newthread_switch:

	_load_new_thread_callee_regs
@@ -281,7 +281,7 @@ _rirq_newthread_switch:

	/* fall through */

.balign 4
.align 4
_rirq_switch_from_coop:

	/* for a cooperative switch, it's not in irq, so
@@ -320,7 +320,7 @@ _rirq_switch_from_coop:
	/* rtie will pop the rest from the stack */
	rtie

.balign 4
.align 4
_rirq_switch_from_firq:
_rirq_switch_from_rirq:

Loading