picolisp

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/picolisp.git/
Log | Files | Refs | README | LICENSE

commit fc875ca7562a1d6836af9af9014e87a577101cb0
parent 182c03dcabac4b58b38f8e09b675a9cd4a0c5c6b
Author: Alexander Burger <abu@software-lab.de>
Date:   Sat, 13 Oct 2012 12:18:21 +0200

emu64 continued
Diffstat:
Msrc64/arch/emu.l | 11++++++++++-
Msrc64/arch/ppc64.l | 18++++++++++++------
Msrc64/arch/x86-64.l | 8++++++--
Msrc64/lib/asm.l | 9+++------
Msrc64/main.l | 4++--
5 files changed, 33 insertions(+), 17 deletions(-)

diff --git a/src64/arch/emu.l b/src64/arch/emu.l @@ -1,4 +1,4 @@ -# 12oct12abu +# 13oct12abu # (c) Software Lab. Alexander Burger # *AsmOpcodes *AsmCode *AsmPos *Labels *AsmData *SysFun @@ -16,6 +16,7 @@ (zero *AsmPos) (off *AlignedCode) +(on *AlignedLabel) # Register assignments (de *Registers @@ -189,6 +190,14 @@ (pack "((ptr)(" (op.p (car Arg) (car M)) " + 8))->n") ) ) ) ### Instruction set ### +(de alignSection (Align) + (if (== 'data *Section) + (when (gt0 (% (asmDataLength) 16)) + (conc (car *AsmData) (need (- 16 @) 0)) ) + (setq Align (/ Align 2)) + (until (= Align (& *AsmPos 7)) + (addCode '(NIL '(nop))) ) ) ) + (de fmtInstruction (Lst) (replace (chop (str Lst)) "\"") ) diff --git a/src64/arch/ppc64.l b/src64/arch/ppc64.l @@ -1,9 +1,9 @@ -# 10oct12abu +# 13oct12abu # (c) Software Lab. Alexander Burger # Byte order (off *LittleEndian) -(on *AlignedCode) +(on *AlignedCode *AlignedLabel) # Register assignments (de *Registers @@ -370,16 +370,22 @@ (memory2 "std" (cadr RegRef) (cddr RegRef)) ) ) ) ### Instruction set ### +(de alignSection (Align) + (if (== *Section 'text) + (prinst ".balign" 8) + (prinst ".balign" 16) + (or (=0 Align) (prinst ".space" Align)) ) ) + (asm nop () (prinst "nop") ) (asm align (N) - (prinst ".balign" - (if (and (== *Section 'text) (= N 16)) 8 N) ) ) + (prinst ".balign" N) ) (asm skip (N) - (when (== 'data *Section) - (or (=0 N) (prinst ".space" N)) ) ) + (if (== 'data *Section) + (or (=0 N) (prinst ".space" N)) + (do (/ N 2) (prinst "nop")) ) ) (asm ld (Dst D Src S) (cond diff --git a/src64/arch/x86-64.l b/src64/arch/x86-64.l @@ -1,9 +1,9 @@ -# 24sep12abu +# 13oct12abu # (c) Software Lab. Alexander Burger # Byte order (on *LittleEndian) -(off *AlignedCode) +(off *AlignedCode *AlignedLabel) # Register assignments (de *Registers @@ -196,6 +196,10 @@ (prinst (pack Cmd (unless (pre? "%" Dst) "q")) "%cl" Dst) ) ) ### Instruction set ### +(de alignSection (Align) + (prinst ".balign" 16) + ((; 'skip asm) Align) ) + (asm nop () (prinst "nop") ) diff --git a/src64/lib/asm.l b/src64/lib/asm.l @@ -1,4 +1,4 @@ -# 29sep12abu +# 13oct12abu # (c) Software Lab. Alexander Burger # *LittleEndian *AlignedCode *Registers optimize @@ -80,12 +80,9 @@ (def Fun (curry (@Sym) (Lbl Align) (newSection '@Sym) - (when Align - ((; 'align asm) 16) - ((; 'skip asm) Align) ) - (when (reg Lbl) - (quit "Register" Lbl) ) + (and Align (alignSection @)) (when Lbl + (and (reg Lbl) (quit "Register" Lbl)) (let Src (file) (idxTags Lbl Src) (def Lbl 'tag (cdr Src)) ) diff --git a/src64/main.l b/src64/main.l @@ -1,4 +1,4 @@ -# 02oct12abu +# 13oct12abu # (c) Software Lab. Alexander Burger (code 'Code) @@ -1353,7 +1353,7 @@ cc dlsym(A Y) # Find dynamic symbol null A # OK? if nz # Yes - ? *AlignedCode + ? *AlignedLabel or A CNT # Make short number = ld (E) A # 'nz' - Set function definition