View Single Post
 
Old 09-20-2012, 10:08 PM
The Connactic The Connactic is offline
Jaguar
 
Join Date: Jul 2012
Posts: 89
I got a little further by removing the unnecessary kexts EVOreboot and LegacyRTC . Now i'm stuck at Kernel=LP64. So i think i won't get past there without solving the ssse3 issue.

Researching about it, i came to a very interesting website from Dave Elliot: http://tgwbd.org/darwin/xnu.html

There i learn that there is only one routine that needs ssse3 at the commpage, precisely the one required to enable 64-bit support. Do you have any assembly knowledge, RAW? Here's the routine, as is in xnu 1699.26.8:

#include <i386/asm.h>

/* void *memcpy((void *) to, (const void *) from, (size_t) bcount) */
/* rdi, rsi, rdx */
/*
* Note: memcpy does not support overlapping copies
*/
ENTRY(memcpy)
movq %rdx,%rcx
shrq $3,%rcx /* copy by 64-bit words */
cld /* copy forwards */
rep
movsq
movq %rdx,%rcx
andq $7,%rcx /* any bytes left? */
rep
movsb
ret

/* void bcopy((const char *) from, (char *) to, (unsigned int) count) */
/* rdi, rsi, rdx */

ENTRY(bcopy_no_overwrite)
xchgq %rsi,%rdi
jmp EXT(memcpy)

/*
* bcopy(src, dst, cnt)
* rdi, rsi, rdx
* [email protected] (Wolfgang Solfrank, TooLs GmbH) +49-228-985800
*/
ENTRY(bcopy)
xchgq %rsi,%rdi
movq %rdx,%rcx

movq %rdi,%rax
subq %rsi,%rax
cmpq %rcx,%rax /* overlapping && src < dst? */
jb 1f

shrq $3,%rcx /* copy by 64-bit words */
cld /* nope, copy forwards */
rep
movsq
movq %rdx,%rcx
andq $7,%rcx /* any bytes left? */
rep
movsb
ret

/* ALIGN_TEXT */
1:

addq %rcx,%rdi /* copy backwards */
addq %rcx,%rsi
decq %rdi
decq %rsi
andq $7,%rcx /* any fractional bytes? */
std
rep
movsb
movq %rdx,%rcx /* copy remainder by 32-bit words */
shrq $3,%rcx
subq $7,%rsi
subq $7,%rdi
rep
movsq
cld
ret


The questions are:

1) Why this routine needs ssse3 to run? It's not explicit.


2) Instead of write an on-the-fly ssse3 emulator, would it be possible to simply alter this single assembly routine so it calls, say, sse3 and not ssse3?

Last edited by The Connactic; 09-20-2012 at 10:19 PM.
Reply With Quote