Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 1789 → Rev 1790

/trunk/kernel/arch/sparc64/src/asm.S
42,33 → 42,67
memcpy:
memcpy_from_uspace:
memcpy_to_uspace:
.register %g2, #scratch
.register %g3, #scratch
add %o1, 7, %g1
and %g1, -8, %g1
cmp %o1, %g1
be,pn %xcc, 3f
add %o0, 7, %g1
mov 0, %g3
0:
brz,pn %o2, 2f
mov 0, %g2
1:
ldub [%g3 + %o1], %g1
add %g2, 1, %g2
cmp %o2, %g2
stb %g1, [%g3 + %o0]
bne,pt %xcc, 1b
mov %g2, %g3
2:
jmp %o7 + 8 ! exit point
mov %o1, %o0
3:
and %g1, -8, %g1
cmp %o0, %g1
bne,pt %xcc, 0b
mov 0, %g3
srlx %o2, 3, %g4
brz,pn %g4, 5f
mov 0, %g5
4:
sllx %g3, 3, %g2
add %g5, 1, %g3
ldx [%o1 + %g2], %g1
mov %g3, %g5
cmp %g4, %g3
bne,pt %xcc, 4b
stx %g1, [%o0 + %g2]
5:
and %o2, 7, %o2
brz,pn %o2, 2b
sllx %g4, 3, %g1
mov 0, %g2
add %g1, %o0, %o0
add %g1, %o1, %g4
mov 0, %g3
6:
ldub [%g2 + %g4], %g1
stb %g1, [%g2 + %o0]
add %g3, 1, %g2
cmp %o2, %g2
bne,pt %xcc, 6b
mov %g2, %g3
 
b _memcpy
nop
jmp %o7 + 8 ! exit point
mov %o1, %o0
 
memcpy_from_uspace_failover_address:
memcpy_to_uspace_failover_address:
b memcpy_from_uspace_failover_address
nop
jmp %o7 + 8 ! exit point
mov %g0, %o0 ! return 0 on failure
 
memsetb:
b _memsetb
nop
 
.global ofw
ofw:
save %sp, -STACK_WINDOW_SAVE_AREA_SIZE, %sp
set ofw_cif, %l0
ldx [%l0], %l0
 
rdpr %pstate, %l1
and %l1, ~PSTATE_AM_BIT, %l2
wrpr %l2, 0, %pstate
jmpl %l0, %o7
mov %i0, %o0
wrpr %l1, 0, %pstate
 
ret
restore %o0, 0, %o0