Skip to content

Commit

Permalink
side deck filtering: blacklists and whitelists
Browse files Browse the repository at this point in the history
Signed-off-by: Fyodor Kovin <[email protected]>
  • Loading branch information
fkovinAtRocket committed May 6, 2019
1 parent 2477bbd commit 686c21f
Show file tree
Hide file tree
Showing 5 changed files with 303 additions and 9 deletions.
42 changes: 34 additions & 8 deletions build/gen-side-deck.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,41 @@
#!/bin/bash
FILES="recovery.o http.o httpserver.o utils.o dataservice.o json.o alloc.o logging.o"
trap 'exit 1' ERR

ZSS=${ZSS:-$PWD/..}

DEFS=$ZSS/build/side-deck-defs
FILES="`cat $DEFS/files`"

cd $ZSS/build/tmp-zss

cd tmp-zss
dd if=zssServer.x conv=unblock cbs=80 of=side-deck
nm $FILES |grep ' T ' |awk '{ print $3 }' |sort -u >relevant-functions
cat relevant-functions |while read fn; do grep ",'"$fn"'" side-deck; done > side-deck-filtered

rm -f relevant-functions
for f in $FILES
do
if [ -f $DEFS/$f-bl ]
then
echo "Found blacklist file for $f"
nm $f |grep ' T ' |awk '{ print $3 }' |grep -v -f $DEFS/$f-bl >>relevant-functions
elif [ -f $DEFS/$f-wl ]
then
echo "Found whilelist file for $f"
nm $f |grep ' T ' |awk '{ print $3 }' |grep -f $DEFS/$f-wl >>relevant-functions
else
echo "Adding all functions from $f to the side deck"
nm $f |grep ' T ' |awk '{ print $3 }' >>relevant-functions
fi
done
sort -u -o relevant-functions relevant-functions

cat relevant-functions |while read fn; do grep ",'"$fn"'" side-deck; done >side-deck-filtered

# dd doesn't support file tags, while cat does.
cat side-deck-filtered |dd conv=block cbs=80 bs=80 > zss.x
mkdir -p ../../lib
cp zss.x ../../lib
echo Side deck ../../lib/zss.x build successfully out of $FILES
cat side-deck-filtered |dd conv=block cbs=80 bs=80 |sed 's/\(.\{79\}\)./\1\n/g' >zss.x

mkdir -p $ZSS/lib
cp zss.x $ZSS/lib
echo Side deck $ZSS/lib/zss.x build successfully out of $FILES



3 changes: 3 additions & 0 deletions build/side-deck-defs/files
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
recovery.o http.o httpserver.o utils.o
dataservice.o json.o xml.o logging.o

13 changes: 13 additions & 0 deletions build/side-deck-defs/httpserver.o-bl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
registerHttpServerModuleWithBase
httpServerSetSessionTokenKey
registerHttpService
dequeueHttpRequest
makeHttpRequestParser
makeHttpResponse
makeHttpServer2
makeHttpServer
makeSecureHttpServer
makeHttpConversation
makeIntParamSpec
makeInt64ParamSpec
makeStringParamSpec
10 changes: 10 additions & 0 deletions build/side-deck-defs/utils.o-wl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
addToStringList
addToStringList
addToStringListUnique
firstStringListElt
makeStringList
stringListContains
stringListContains
stringListLast
stringListLength
stringListPrint
Loading

0 comments on commit 686c21f

Please sign in to comment.