Skip to content
Snippets Groups Projects
Select Git revision
  • a0eaae08c7c6a59c185cf646b02f4167b2ac6ec0
  • esp32_c3_bringup default
  • master
3 results

tcg-op-ldst.c

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    tcg-op-ldst.c 40.17 KiB
    /*
     * Tiny Code Generator for QEMU
     *
     * Copyright (c) 2008 Fabrice Bellard
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
     * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    
    #include "qemu/osdep.h"
    #include "tcg/tcg.h"
    #include "tcg/tcg-temp-internal.h"
    #include "tcg/tcg-op-common.h"
    #include "tcg/tcg-mo.h"
    #include "exec/translation-block.h"
    #include "exec/plugin-gen.h"
    #include "tcg-internal.h"
    
    
    static void check_max_alignment(unsigned a_bits)
    {
    #if defined(CONFIG_SOFTMMU)
        /*
         * The requested alignment cannot overlap the TLB flags.
         * FIXME: Must keep the count up-to-date with "exec/cpu-all.h".
         */
        tcg_debug_assert(a_bits + 5 <= tcg_ctx->page_bits);
    #endif
    }
    
    static MemOp tcg_canonicalize_memop(MemOp op, bool is64, bool st)
    {
        unsigned a_bits = get_alignment_bits(op);
    
        check_max_alignment(a_bits);
    
        /* Prefer MO_ALIGN+MO_XX over MO_ALIGN_XX+MO_XX */
        if (a_bits == (op & MO_SIZE)) {
            op = (op & ~MO_AMASK) | MO_ALIGN;
        }
    
        switch (op & MO_SIZE) {
        case MO_8:
            op &= ~MO_BSWAP;
            break;
        case MO_16:
            break;
        case MO_32:
            if (!is64) {
                op &= ~MO_SIGN;
            }
            break;
        case MO_64:
            if (is64) {
                op &= ~MO_SIGN;