⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dispatch_x86.c

📁 学习JAVA编程的示例
💻 C
字号:
/*
 * @(#)dispatch_x86.c	1.3 98/03/22
 *
 * Copyright (c) 1998 Sun Microsystems, Inc. All Rights Reserved.
 *
 * See also the LICENSE file in this distribution.
 */

/*
 * Copies the arguments from the given array to C stack, invoke the
 * target function, and copy the result back.
 */
void asm_dispatch(void *func, int nwords, long *c_args, int ty, long *resP)
{
    __asm {

	mov esi, c_args
	mov edx, nwords
	// word address -> byte address
	shl edx, 2

        sub edx, 4
	jc  args_done

	// Push the last argument first.
    args_loop:
	mov eax, DWORD PTR [esi+edx]
	push eax
	sub edx, 4
	jge SHORT args_loop

    args_done:
	call func

	// pop arguments
	mov edx, nwords
        shl edx, 2
        add esp, edx

        mov esi, resP
	mov edx, ty
	dec edx
	jge not_p64

	// p64
	mov [esi], eax
	mov [esi+4], 0
	jmp done

    not_p64:
	dec edx
        jge not_i32

	// i32
	mov [esi], eax
        jmp done

    not_i32:
	dec edx
        jge not_f32

        // f32
	fstp DWORD PTR [esi]
	jmp done

    not_f32:
        // f64
	fstp QWORD PTR [esi]

    done:
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -