/************************************************************* * File: lib/cpdata.s * Purpose: Part of C runtime library * Author: Phil Bunce (pjb@carmel.com) * Revision History: * 970304 Start of revision history * 971231 Added ifdef for GHS */ #include /* * Copy data from ROM to RAM, used in ROM-based applications. */ .globl cpdata .ent cpdata cpdata: # copy .data to RAM #ifdef BSO_TASKING la t5,__lc_cp beq t5,zero,3f 4: lw t1,0(t5) # action beq t1,zero,3f lw t2,4(t5) # dest lw t3,8(t5) # src lw t4,12(t5) # len sll t0,t1,31-2 bgez t0,1f # test CP_REL bit la t0,__lc_zp addu t2,t0 # add _zp to dest 1: sll t0,t1,31-1 bltz t0,2f # test CP_BSS bit 1: beq t4,zero,2f lw t0,(t3) sw t0,(t2) addu t2,4 addu t3,4 subu t4,4 b 1b 2: # next section addu t5,16 # size of entry b 4b 3: #else # src=etext dst=a0 stop=edata #ifdef GHS la t0,__ghsbegin_romdata la t2,__ghsend_romdata move t1,a0 1: lw t3,(t0) sw t3,(t1) addu t0,4 addu t1,4 blt t0,t2,1b #else la t0,etext #ifdef ALGOR /* Algor's convert aligns the start of .data to 16 bytes */ addu t0,15 and t0,~15 #endif la t2,edata move t1,a0 1: lw t3,(t0) sw t3,(t1) addu t0,4 addu t1,4 blt t1,t2,1b #endif #endif j ra .end cpdata