diff --git a/basis/cpu/ppc/linux/linux.factor b/basis/cpu/ppc/linux/linux.factor index c6649c7ad2..090495aa11 100644 --- a/basis/cpu/ppc/linux/linux.factor +++ b/basis/cpu/ppc/linux/linux.factor @@ -1,6 +1,7 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors system kernel alien.c-types cpu.architecture cpu.ppc ; +USING: accessors system kernel layouts +alien.c-types cpu.architecture cpu.ppc ; IN: cpu.ppc.linux << @@ -8,11 +9,11 @@ t "longlong" c-type (>>stack-align?) t "ulonglong" c-type (>>stack-align?) >> -M: linux reserved-area-size 2 ; +M: linux reserved-area-size 2 cells ; -M: linux lr-save 1 ; +M: linux lr-save 1 cells ; -M: float-regs param-regs { 1 2 3 4 5 6 7 8 } ; +M: float-regs param-regs drop { 1 2 3 4 5 6 7 8 } ; M: ppc value-structs? f ; diff --git a/basis/cpu/ppc/macosx/macosx.factor b/basis/cpu/ppc/macosx/macosx.factor index bb607d0e44..877fb37d31 100644 --- a/basis/cpu/ppc/macosx/macosx.factor +++ b/basis/cpu/ppc/macosx/macosx.factor @@ -1,6 +1,7 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors system kernel alien.c-types cpu.architecture cpu.ppc ; +USING: accessors system kernel layouts +alien.c-types cpu.architecture cpu.ppc ; IN: cpu.ppc.macosx << @@ -9,11 +10,11 @@ IN: cpu.ppc.macosx 4 "double" c-type (>>align) >> -M: macosx reserved-area-size 6 ; +M: macosx reserved-area-size 6 cells ; -M: macosx lr-save 2 ; +M: macosx lr-save 2 cells ; -M: float-regs param-regs { 1 2 3 4 5 6 7 8 9 10 11 12 13 } ; +M: float-regs param-regs drop { 1 2 3 4 5 6 7 8 9 10 11 12 13 } ; M: ppc value-structs? t ; diff --git a/basis/cpu/ppc/ppc.factor b/basis/cpu/ppc/ppc.factor index d2d1e26396..2be46d15ee 100644 --- a/basis/cpu/ppc/ppc.factor +++ b/basis/cpu/ppc/ppc.factor @@ -349,12 +349,17 @@ M: ppc %gc "end" resolve-label ; M: ppc %prologue ( n -- ) - 0 scratch-reg LOAD32 rc-absolute-ppc-2/2 rel-this + #! We use a volatile register (r11) here for scratch. Because + #! callback bodies have a prologue too, we cannot assume + #! that c_to_factor saved all non-volatile registers, so + #! we have to respect the C calling convention. Also, we + #! cannot touch any param-regs either. + 0 11 LOAD32 rc-absolute-ppc-2/2 rel-this 0 MFLR 1 1 pick neg ADDI - scratch-reg 1 pick xt-save STW - dup scratch-reg LI - scratch-reg 1 pick next-save STW + 11 1 pick xt-save STW + dup 11 LI + 11 1 pick next-save STW 0 1 rot lr-save + STW ; M: ppc %epilogue ( n -- ) diff --git a/build-support/factor.sh b/build-support/factor.sh index 7fbb54a568..bd234afb5f 100755 --- a/build-support/factor.sh +++ b/build-support/factor.sh @@ -271,17 +271,21 @@ check_os_arch_word() { set_build_info() { check_os_arch_word - MAKE_TARGET=$OS-$ARCH-$WORD if [[ $OS == macosx && $ARCH == ppc ]] ; then MAKE_IMAGE_TARGET=macosx-ppc + MAKE_TARGET=macosx-ppc elif [[ $OS == linux && $ARCH == ppc ]] ; then MAKE_IMAGE_TARGET=linux-ppc + MAKE_TARGET=linux-ppc elif [[ $OS == winnt && $ARCH == x86 && $WORD == 64 ]] ; then MAKE_IMAGE_TARGET=winnt-x86.64 + MAKE_TARGET=winnt-x86-64 elif [[ $ARCH == x86 && $WORD == 64 ]] ; then MAKE_IMAGE_TARGET=unix-x86.64 - else + MAKE_TARGET=$OS-x86-64 + else MAKE_IMAGE_TARGET=$ARCH.$WORD + MAKE_TARGET=$OS-$ARCH-$WORD fi BOOT_IMAGE=boot.$MAKE_IMAGE_TARGET.image } diff --git a/vm/callstack.c b/vm/callstack.c index c9466bbbb2..b7e99b418c 100755 --- a/vm/callstack.c +++ b/vm/callstack.c @@ -117,7 +117,7 @@ CELL frame_executing(F_STACK_FRAME *frame) F_STACK_FRAME *frame_successor(F_STACK_FRAME *frame) { if(frame->size == 0) - critical_error("Stack frame has zero size",frame); + critical_error("Stack frame has zero size",(CELL)frame); return (F_STACK_FRAME *)((CELL)frame - frame->size); } diff --git a/vm/cpu-x86.32.S b/vm/cpu-x86.32.S index eec850dc9e..6ddbd52da2 100755 --- a/vm/cpu-x86.32.S +++ b/vm/cpu-x86.32.S @@ -10,7 +10,7 @@ and the callstack top is passed in EDX */ #define DS_REG %esi #define RETURN_REG %eax -#define NV_TEMP_REG %rbx +#define NV_TEMP_REG %ebx #define CELL_SIZE 4 #define STACK_PADDING 12