~pmdj/ubuntu/trusty/qemu/2.9+applesmc+fadtv3

« back to all changes in this revision

Viewing changes to roms/SLOF/lib/libhvcall/rfill.c

  • Committer: Phil Dennis-Jordan
  • Date: 2017-07-21 08:03:43 UTC
  • mfrom: (1.1.1)
  • Revision ID: phil@philjordan.eu-20170721080343-2yr2vdj7713czahv
New upstream release 2.9.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*****************************************************************************
 
2
 * Fast function for filling cache-inhibited memory regions via h-call.
 
3
 *
 
4
 * Copyright 2015 Red Hat, Inc.
 
5
 *
 
6
 * This program and the accompanying materials
 
7
 * are made available under the terms of the BSD License
 
8
 * which accompanies this distribution, and is available at
 
9
 * http://www.opensource.org/licenses/bsd-license.php
 
10
 *
 
11
 * Contributors:
 
12
 *     Thomas Huth, Red Hat Inc. - initial implementation
 
13
 *****************************************************************************/
 
14
 
 
15
#include <cache.h>
 
16
#include <string.h>
 
17
 
 
18
typedef unsigned long type_u;
 
19
 
 
20
/**
 
21
 * fast_rfill is the implementation of the FAST_RFILL macro with h-calls.
 
22
 * This is defined here instead of cache.h since we need a temporary
 
23
 * local buffer - and that caused stack size problems in engine() when
 
24
 * we used it directly in the FAST_RFILL macro.
 
25
 */
 
26
void fast_rfill(char *dst, long size, char pat)
 
27
{
 
28
        type_u buf[64];
 
29
 
 
30
        memset(buf, pat, size < sizeof(buf) ? size : sizeof(buf));
 
31
 
 
32
        while (size > sizeof(buf)) {
 
33
                FAST_MRMOVE(buf, dst, sizeof(buf));
 
34
                dst += sizeof(buf);
 
35
                size -= sizeof(buf);
 
36
        }
 
37
        FAST_MRMOVE(buf, dst, size);
 
38
}