Open wargio opened 8 years ago
below is my fix:
osfmk/arm/genassym.c | 7 +++++-- osfmk/conf/Makefile.template | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/osfmk/arm/genassym.c b/osfmk/arm/genassym.c index 9b3d063..d3f46d9 100644 --- a/osfmk/arm/genassym.c +++ b/osfmk/arm/genassym.c @@ -108,8 +108,11 @@
__asm("#DEFINITION#\t.set\t" SYM ",\t%0" : : "n" ((u_int)(VAL)))
+//#define DECLARE(SYM,VAL) \ +// __asm("#DEFINITION##define " SYM "\t%0" : : "n" ((u_int)(VAL)))
__asm("DEFINITION__define__" SYM ":\t .ascii \"%0\"" : : "n" ((u_int)(VAL)))
+
int main(int argc, char _argv); @@ -129,7 +132,7 @@ int main(int argc, char _argv) DECLARE("MUTEX_STATE", offsetof(lck_mtx_t *, lck_mtx_state));
DECLARE("MUTEX_IND", LCK_MTX_TAG_INDIRECT);
DECLARE("MUTEX_PTR", offsetof(lck_mtx_t , lck_mtx_ptr)); +// DECLARE("MUTEX_PTR", offsetof(lck_mtx_t , lck_mtx_ptr)); DECLARE("MUTEX_ASSERT_OWNED", LCK_MTX_ASSERT_OWNED); DECLARE("MUTEX_ASSERT_NOTOWNED", LCK_MTX_ASSERT_NOTOWNED); DECLARE("GRP_MTX_STAT_UTIL", diff --git a/osfmk/conf/Makefile.template b/osfmk/conf/Makefile.template index c39e844..a04f213 100644 --- a/osfmk/conf/Makefile.template +++ b/osfmk/conf/Makefile.template @@ -117,10 +117,12 @@ GENASSYM_LOCATION = i386 endif
genassym.o: $(SOURCE_DIR)/$(COMPONENT)/$(GENASSYM_LOCATION)/genassym.c
@echo $(_v)${KCC} $(subst -flto,,${CFLAGS}) -MD ${_HOST_EXTRA_CFLAGS} -S -o ${@} -c ${INCFLAGS} $< $(_v)${KCC} $(subst -flto,,${CFLAGS}) -MD ${_HOST_EXTRA_CFLAGS} -S -o ${@} -c ${INCFLAGS} $<
assym.s: genassym.o
$(_v)sed -e '/^[[:space:]]DEFINITIONdefine/!d;{N;s/\n//;}' -e 's/^[[:space:]]DEFINITIONdefine([^:]):.ascii.\"[\$$]([-0-9#])\".$$/#define \1 \2/' -e 'p' -e 's/#//2' -e 's/^[[:space:]]#define ([A-Za-z0-9])[[:space:]][\$$#]([-0-9]_).$$/#define \1_NUM \2/' genassym.o > $@
${SOBJS}: assym.s
2.7.4
@nightsuns, can you please post the patch in a code block so I can copy/paste it? GitHub's markdown took over it 😃
Hey @nightsuns, please paste a readable patch.
I'm glad I got a notification from this issue. I was working with the GitHub API at the time and had the idea of just getting the raw message. I don't know how to escape backticks on Github and this patch appears to have some... so, I'll just show you how to get the raw answer.
curl -i "https://api.github.com/repos/darwin-on-arm/xnu/issues/38/comments"
It'd be under the body element in the JSON response. You'll have to replace \n with actual newlines.
that's my patch
Oh thanks @wargio, do you think it would be possible to emulate ios with this kernel?
Somehow the kernel is still not building, I followed the instructions and the patch didn't work. The assym.s file is empty in the Build folder. I'm kinda new at this stuff....
try with my fork.
It failed with the same error. I'm on macOS 10.12.6. I know enough c and I understand what the makefile template was trying to do, but i'm not fluent with unix commands. I checked the build without the patch:
sed -e '/#DEFINITION#/!d' -e 's/^.*#DEFINITION#//' -e 's/\$$//' -e 'p' -e 's/#//2' -e 's/[^A-Za-z0-9_]*\([A-Za-z0-9_]*\)/ \1_NUM/2' genassym.o >${@}
And got some definitions which were incomplete or something, but when i tried with the patch:
sed -e '/.file\s*\"#DEFINITION#/!d' -e 's/^.*#DEFINITION#//' -e 's/####\"//' -e 's/\$$//' -e 'p' -e 's/#//2' -e 's/[^A-Za-z0-9_]*\([A-Za-z0-9_]*\)/ \1_NUM/2' genassym.o > ${@}
assym.S ended up empty.
I have a this problem on debian: when i compile the assym.S is totally empty. looks like the compiler removes the macro when it expands it. file: https://github.com/darwin-on-arm/xnu/blob/master/osfmk/arm/genassym.c#L111
i fixed it in this way: on that file it becomes:
and i changed the makefile template: File: https://github.com/darwin-on-arm/xnu/blob/master/osfmk/conf/Makefile.template#L123
to
Anybody knows a better why to fix this?