forked from PAWPAW-Mirror/lib_xua
Add resource usage symbols / elimination blocks to assembly files.
See bug 10909 and bug 15022.
This commit is contained in:
@@ -5,47 +5,81 @@
|
||||
|
||||
#include <xs1_user.h>
|
||||
|
||||
.text
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// void GetLockResource()
|
||||
.globl GetLockResource.nstackwords
|
||||
.linkset GetLockResource.nstackwords, 0
|
||||
.globl GetLockResource
|
||||
.text
|
||||
.type GetLockResource, @function
|
||||
.cc_top GetLockResource.function
|
||||
.align 2
|
||||
GetLockResource:
|
||||
getr r0, XS1_RES_TYPE_LOCK
|
||||
retsp 0
|
||||
|
||||
.size GetLockResource, .-GetLockResource
|
||||
.cc_bottom GetLockResource.function
|
||||
.globl GetLockResource.nstackwords
|
||||
.globl GetLockResource.maxcores
|
||||
.globl GetLockResource.maxchanends
|
||||
.globl GetLockResource.maxtimers
|
||||
.set GetLockResource.nstackwords, 0
|
||||
.set GetLockResource.maxcores, 1
|
||||
.set GetLockResource.maxchanends, 0
|
||||
.set GetLockResource.maxtimers, 0
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// void ClaimLock(lock l)
|
||||
.globl ClaimLock.nstackwords
|
||||
.linkset ClaimLock.nstackwords, 0
|
||||
.globl ClaimLock
|
||||
.text
|
||||
.type ClaimLock, @function
|
||||
.cc_top ClaimLock.function
|
||||
.align 2
|
||||
ClaimLock:
|
||||
in r0, res[r0]
|
||||
retsp 0
|
||||
|
||||
.size ClaimLock, .-ClaimLock
|
||||
.cc_bottom ClaimLock.function
|
||||
.globl ClaimLock.nstackwords
|
||||
.globl ClaimLock.maxcores
|
||||
.globl ClaimLock.maxchanends
|
||||
.globl ClaimLock.maxtimers
|
||||
.set ClaimLock.nstackwords, 0
|
||||
.set ClaimLock.maxcores, 1
|
||||
.set ClaimLock.maxchanends, 0
|
||||
.set ClaimLock.maxtimers, 0
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// void FreeLock(lock l)
|
||||
.globl FreeLock.nstackwords
|
||||
.linkset FreeLock.nstackwords, 0
|
||||
.globl FreeLock
|
||||
.text
|
||||
.cc_top FreeLock.function
|
||||
.align 2
|
||||
FreeLock:
|
||||
out res[r0], r0
|
||||
retsp 0
|
||||
|
||||
.size FreeLock, .-FreeLock
|
||||
.cc_bottom FreeLock.function
|
||||
.globl FreeLock.nstackwords
|
||||
.globl FreeLock.maxcores
|
||||
.globl FreeLock.maxchanends
|
||||
.globl FreeLock.maxtimers
|
||||
.set FreeLock.nstackwords, 0
|
||||
.set FreeLock.maxcores, 1
|
||||
.set FreeLock.maxchanends, 0
|
||||
.set FreeLock.maxtimers, 0
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// void FreeLockResource(lock l)
|
||||
.globl FreeLockResource.nstackwords
|
||||
.linkset FreeLockResource.nstackwords, 0
|
||||
.globl FreeLockResource
|
||||
.text
|
||||
.cc_top FreeLockResource.function
|
||||
.align 2
|
||||
FreeLockResource:
|
||||
freer res[r0]
|
||||
retsp 0
|
||||
|
||||
|
||||
.size FreeLockResource, .-FreeLockResource
|
||||
.cc_bottom FreeLockResource.function
|
||||
.globl FreeLockResource.nstackwords
|
||||
.globl FreeLockResource.maxcores
|
||||
.globl FreeLockResource.maxchanends
|
||||
.globl FreeLockResource.maxtimers
|
||||
.set FreeLockResource.nstackwords, 0
|
||||
.set FreeLockResource.maxcores, 1
|
||||
.set FreeLockResource.maxchanends, 0
|
||||
.set FreeLockResource.maxtimers, 0
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
.cc_top doMix##i.function,doMix##i; \
|
||||
.align 4 ;\
|
||||
.globl doMix##i ;\
|
||||
.type doMix##i, @function ;\
|
||||
.globl doMix##i##.nstackwords ;\
|
||||
.globl doMix##i##.maxthreads ; \
|
||||
.globl doMix##i##.maxtimers ; \
|
||||
@@ -42,6 +43,7 @@ doMix##i##: ;\
|
||||
retsp 0x0;\
|
||||
\
|
||||
\
|
||||
.size doMix##i, .-doMix##i; \
|
||||
.cc_bottom doMix##i##.function;
|
||||
|
||||
#define N MIX_INPUTS
|
||||
@@ -124,9 +126,10 @@ DOMIX_BOT(7)
|
||||
#undef BODY
|
||||
#define N MAX_MIX_COUNT
|
||||
.cc_top setPtr.function,setPtr;
|
||||
.align 4 ;
|
||||
.globl setPtr.nstackwords;
|
||||
.align 4 ;
|
||||
.globl setPtr;
|
||||
.type setPtr, @function
|
||||
.globl setPtr.nstackwords;
|
||||
.globl setPtr.maxthreads;
|
||||
.globl setPtr.maxtimers;
|
||||
.globl setPtr.maxchanends;
|
||||
@@ -151,14 +154,20 @@ setPtr_go:
|
||||
add r1, r1, r2;
|
||||
st8 r1, r11[r0];
|
||||
retsp 0;
|
||||
.size setPtr, .-setPtr
|
||||
.cc_bottom setPtr.function
|
||||
|
||||
.section .cp.const4, "acM", @progbits, 4
|
||||
.LC0:
|
||||
.cc_top .LC0.data
|
||||
.align 4
|
||||
.LC0:
|
||||
.int 0x7fffff00
|
||||
.cc_bottom .LC0.data
|
||||
.cc_top .LC1.data
|
||||
.align 4
|
||||
.LC1:
|
||||
.int 0x80000000
|
||||
.cc_bottom .LC1.data
|
||||
|
||||
#undef N
|
||||
#undef BODY
|
||||
|
||||
@@ -1,59 +1,63 @@
|
||||
|
||||
#include "xs1_kernel.h"
|
||||
#include "xs1_user.h"
|
||||
|
||||
|
||||
|
||||
.global write_sswitch_reg_blind, "f{si}(ui,ui,ui)"
|
||||
.global write_sswitch_reg_blind.nstackwords
|
||||
.linkset write_sswitch_reg_blind.nstackwords, 0
|
||||
//.type read_sswitch_reg, @function
|
||||
.type write_sswitch_reg_blind, @function
|
||||
// r0 - coreid
|
||||
// r1 - reg
|
||||
// r2 - data
|
||||
.cc_top write_sswitch_reg_blind.function, write_sswitch_reg_blind
|
||||
.align 2
|
||||
write_sswitch_reg_blind:
|
||||
// Check range of coreid
|
||||
// Check range of coreid
|
||||
shr r3, r0, XS1_CHAN_ID_PROCESSOR_SIZE + XS1_CHAN_ID_NODE_SIZE
|
||||
bt r3, write_switch_reg_fail
|
||||
bt r3, write_switch_reg_fail
|
||||
|
||||
// Check range of reg
|
||||
shr r3, r1, 16
|
||||
bt r3, write_switch_reg_fail
|
||||
// Check range of reg
|
||||
shr r3, r1, 16
|
||||
bt r3, write_switch_reg_fail
|
||||
|
||||
// Allocate channel end
|
||||
getr r3, XS1_RES_TYPE_CHANEND
|
||||
// Allocate channel end
|
||||
getr r3, XS1_RES_TYPE_CHANEND
|
||||
|
||||
// Set destination
|
||||
ldc r11, XS1_RES_TYPE_CONFIG | (XS1_CT_SSCTRL << XS1_CHAN_ID_CHANNUM_SHIFT)
|
||||
// Set destination
|
||||
ldc r11, XS1_RES_TYPE_CONFIG | (XS1_CT_SSCTRL << XS1_CHAN_ID_CHANNUM_SHIFT)
|
||||
|
||||
// r0 - l
|
||||
// r1 - reg
|
||||
// r2 - data
|
||||
// r3 - chanend
|
||||
// r11 - low half of dest
|
||||
write_switch_reg:
|
||||
shl r0, r0, XS1_CHAN_ID_PROCESSOR_SHIFT
|
||||
or r0, r0, r11
|
||||
setd res[r3], r0
|
||||
// r0 - l
|
||||
// r1 - reg
|
||||
// r2 - data
|
||||
// r3 - chanend
|
||||
// r11 - low half of dest
|
||||
write_switch_reg:
|
||||
shl r0, r0, XS1_CHAN_ID_PROCESSOR_SHIFT
|
||||
or r0, r0, r11
|
||||
setd res[r3], r0
|
||||
|
||||
// Send packet
|
||||
ldc r11, XS1_CT_WRITEC // Too big for outct immediate
|
||||
outct res[r3], r11
|
||||
mkmsk r0, 32
|
||||
shl r0, r0, 8
|
||||
shr r11, r1, 8
|
||||
or r0, r0, r11
|
||||
out res[r3], r0 // (0xffffff00) | (reg >> 8)
|
||||
outt res[r3], r1 // reg & 0xff
|
||||
out res[r3], r2
|
||||
outct res[r3], XS1_CT_END
|
||||
// Send packet
|
||||
ldc r11, XS1_CT_WRITEC // Too big for outct immediate
|
||||
outct res[r3], r11
|
||||
mkmsk r0, 32
|
||||
shl r0, r0, 8
|
||||
shr r11, r1, 8
|
||||
or r0, r0, r11
|
||||
out res[r3], r0 // (0xffffff00) | (reg >> 8)
|
||||
outt res[r3], r1 // reg & 0xff
|
||||
out res[r3], r2
|
||||
outct res[r3], XS1_CT_END
|
||||
|
||||
// Receive response
|
||||
freer res[r3]
|
||||
retsp 0
|
||||
write_switch_reg_fail:
|
||||
ldc r0, 0
|
||||
retsp 0
|
||||
.cc_bottom write_sswitch_reg_blind.function
|
||||
// Receive response
|
||||
freer res[r3]
|
||||
retsp 0
|
||||
write_switch_reg_fail:
|
||||
ldc r0, 0
|
||||
retsp 0
|
||||
.size write_sswitch_reg_blind, .-write_sswitch_reg_blind
|
||||
.cc_bottom write_sswitch_reg_blind.function
|
||||
.global write_sswitch_reg_blind.nstackwords
|
||||
.global write_sswitch_reg_blind.maxchanends
|
||||
.global write_sswitch_reg_blind.maxtimers
|
||||
.global write_sswitch_reg_blind.maxcores
|
||||
.set write_sswitch_reg_blind.nstackwords, 0
|
||||
.set write_sswitch_reg_blind.maxchanends, 1
|
||||
.set write_sswitch_reg_blind.maxtimers, 0
|
||||
.set write_sswitch_reg_blind.maxcores, 0
|
||||
|
||||
Reference in New Issue
Block a user