Changeset 38384ae in mainline


Ignore:
Timestamp:
2012-03-30T06:56:10Z (12 years ago)
Author:
Frantisek Princ <frantisek.princ@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1ac1ab4
Parents:
fffb061 (diff), bb1b44e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge with mainline

Location:
boot
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • boot/arch/ia64/src/main.c

    rfffb061 r38384ae  
    189189        printf("\nInflating components ... ");
    190190       
     191        /*
     192         * We will use the next available address for a copy of each component to
     193         * make sure that inflate() works with disjunctive memory regions.
     194         */
     195        top = ALIGN_UP(top, PAGE_SIZE);
     196
    191197        for (i = cnt; i > 0; i--) {
    192198                printf("%s ", components[i - 1].name);
    193199               
    194                 int err = inflate(components[i - 1].start, components[i - 1].size,
     200                /*
     201                 * Copy the component to a location which is guaranteed not to
     202                 * overlap with the destination for inflate().
     203                 */
     204                memmove((void *) top, components[i - 1].start, components[i - 1].size);
     205               
     206                int err = inflate((void *) top, components[i - 1].size,
    195207                    dest[i - 1], components[i - 1].inflated);
    196208               
  • boot/generic/include/memstr.h

    rfffb061 r38384ae  
    3636
    3737extern void *memcpy(void *, const void *, size_t);
     38extern void *memmove(void *, const void *, size_t);
    3839
    3940#endif
  • boot/generic/src/memstr.c

    rfffb061 r38384ae  
    5151}
    5252
     53/** Move memory block with possible overlapping.
     54 *
     55 * Copy cnt bytes from src address to dst address. The source
     56 * and destination memory areas may overlap.
     57 *
     58 * @param dst Destination address to copy to.
     59 * @param src Source address to copy from.
     60 * @param cnt Number of bytes to copy.
     61 *
     62 * @return Destination address.
     63 *
     64 */
     65void *memmove(void *dst, const void *src, size_t cnt)
     66{
     67        /* Nothing to do? */
     68        if (src == dst)
     69                return dst;
     70       
     71        /* Non-overlapping? */
     72        if ((dst >= src + cnt) || (src >= dst + cnt))
     73                return memcpy(dst, src, cnt);
     74       
     75        uint8_t *dp;
     76        const uint8_t *sp;
     77       
     78        /* Which direction? */
     79        if (src > dst) {
     80                /* Forwards. */
     81                dp = dst;
     82                sp = src;
     83               
     84                while (cnt-- != 0)
     85                        *dp++ = *sp++;
     86        } else {
     87                /* Backwards. */
     88                dp = dst + (cnt - 1);
     89                sp = src + (cnt - 1);
     90               
     91                while (cnt-- != 0)
     92                        *dp-- = *sp--;
     93        }
     94       
     95        return dst;
     96}
     97
    5398/** @}
    5499 */
Note: See TracChangeset for help on using the changeset viewer.