105b261ecSmrg/**************************************************************************** 205b261ecSmrg* 305b261ecSmrg* Realmode X86 Emulator Library 405b261ecSmrg* 505b261ecSmrg* Copyright (C) 1996-1999 SciTech Software, Inc. 605b261ecSmrg* Copyright (C) David Mosberger-Tang 705b261ecSmrg* Copyright (C) 1999 Egbert Eich 805b261ecSmrg* 905b261ecSmrg* ======================================================================== 1005b261ecSmrg* 1105b261ecSmrg* Permission to use, copy, modify, distribute, and sell this software and 1205b261ecSmrg* its documentation for any purpose is hereby granted without fee, 1305b261ecSmrg* provided that the above copyright notice appear in all copies and that 1405b261ecSmrg* both that copyright notice and this permission notice appear in 1505b261ecSmrg* supporting documentation, and that the name of the authors not be used 1605b261ecSmrg* in advertising or publicity pertaining to distribution of the software 1705b261ecSmrg* without specific, written prior permission. The authors makes no 1805b261ecSmrg* representations about the suitability of this software for any purpose. 1905b261ecSmrg* It is provided "as is" without express or implied warranty. 2005b261ecSmrg* 2105b261ecSmrg* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 2205b261ecSmrg* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 2305b261ecSmrg* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR 2405b261ecSmrg* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF 2505b261ecSmrg* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 2605b261ecSmrg* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 2705b261ecSmrg* PERFORMANCE OF THIS SOFTWARE. 2805b261ecSmrg* 2905b261ecSmrg* ======================================================================== 3005b261ecSmrg* 3105b261ecSmrg* Language: Watcom C 10.6 or later 3205b261ecSmrg* Environment: 32-bit DOS 3305b261ecSmrg* Developer: Kendall Bennett 3405b261ecSmrg* 3505b261ecSmrg* Description: Program to validate the x86 emulator library for 3605b261ecSmrg* correctness. We run the emulator primitive operations 3705b261ecSmrg* functions against the real x86 CPU, and compare the result 3805b261ecSmrg* and flags to ensure correctness. 3905b261ecSmrg* 4005b261ecSmrg* We use inline assembler to compile and build this program. 4105b261ecSmrg* 4205b261ecSmrg****************************************************************************/ 4305b261ecSmrg 4405b261ecSmrg#include <stdio.h> 4505b261ecSmrg#include <stdlib.h> 4605b261ecSmrg#include <string.h> 4705b261ecSmrg#include <stdarg.h> 4805b261ecSmrg#include "x86emu.h" 4905b261ecSmrg#include "x86emu/prim_asm.h" 5005b261ecSmrg 5105b261ecSmrg/*-------------------------- Implementation -------------------------------*/ 5205b261ecSmrg 5305b261ecSmrg#define true 1 5405b261ecSmrg#define false 0 5505b261ecSmrg 5605b261ecSmrg#define ALL_FLAGS (F_CF | F_PF | F_AF | F_ZF | F_SF | F_OF) 5705b261ecSmrg 5805b261ecSmrg#define VAL_START_BINARY(parm_type,res_type,dmax,smax,dincr,sincr) \ 5905b261ecSmrg{ \ 6005b261ecSmrg parm_type d,s; \ 6105b261ecSmrg res_type r,r_asm; \ 6205b261ecSmrg ulong flags,inflags; \ 6305b261ecSmrg int f,failed = false; \ 6405b261ecSmrg char buf1[80],buf2[80]; \ 6505b261ecSmrg for (d = 0; d < dmax; d += dincr) { \ 6605b261ecSmrg for (s = 0; s < smax; s += sincr) { \ 6705b261ecSmrg M.x86.R_EFLG = inflags = flags = def_flags; \ 6805b261ecSmrg for (f = 0; f < 2; f++) { 6905b261ecSmrg 7005b261ecSmrg#define VAL_TEST_BINARY(name) \ 7105b261ecSmrg r_asm = name##_asm(&flags,d,s); \ 7205b261ecSmrg r = name(d,s); \ 7305b261ecSmrg if (r != r_asm || M.x86.R_EFLG != flags) \ 7405b261ecSmrg failed = true; \ 7505b261ecSmrg if (failed || trace) { 7605b261ecSmrg 7705b261ecSmrg#define VAL_TEST_BINARY_VOID(name) \ 7805b261ecSmrg name##_asm(&flags,d,s); \ 7905b261ecSmrg name(d,s); \ 8005b261ecSmrg r = r_asm = 0; \ 8105b261ecSmrg if (M.x86.R_EFLG != flags) \ 8205b261ecSmrg failed = true; \ 8305b261ecSmrg if (failed || trace) { 8405b261ecSmrg 8505b261ecSmrg#define VAL_FAIL_BYTE_BYTE_BINARY(name) \ 8605b261ecSmrg if (failed) \ 8705b261ecSmrg printk("fail\n"); \ 8805b261ecSmrg printk("0x%02X = %-15s(0x%02X,0x%02X), flags = %s -> %s\n", \ 8905b261ecSmrg r, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \ 9005b261ecSmrg printk("0x%02X = %-15s(0x%02X,0x%02X), flags = %s -> %s\n", \ 9105b261ecSmrg r_asm, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); 9205b261ecSmrg 9305b261ecSmrg#define VAL_FAIL_WORD_WORD_BINARY(name) \ 9405b261ecSmrg if (failed) \ 9505b261ecSmrg printk("fail\n"); \ 9605b261ecSmrg printk("0x%04X = %-15s(0x%04X,0x%04X), flags = %s -> %s\n", \ 9705b261ecSmrg r, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \ 9805b261ecSmrg printk("0x%04X = %-15s(0x%04X,0x%04X), flags = %s -> %s\n", \ 9905b261ecSmrg r_asm, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); 10005b261ecSmrg 10105b261ecSmrg#define VAL_FAIL_LONG_LONG_BINARY(name) \ 10205b261ecSmrg if (failed) \ 10305b261ecSmrg printk("fail\n"); \ 10405b261ecSmrg printk("0x%08X = %-15s(0x%08X,0x%08X), flags = %s -> %s\n", \ 10505b261ecSmrg r, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \ 10605b261ecSmrg printk("0x%08X = %-15s(0x%08X,0x%08X), flags = %s -> %s\n", \ 10705b261ecSmrg r_asm, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); 10805b261ecSmrg 10905b261ecSmrg#define VAL_END_BINARY() \ 11005b261ecSmrg } \ 11105b261ecSmrg M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \ 11205b261ecSmrg if (failed) \ 11305b261ecSmrg break; \ 11405b261ecSmrg } \ 11505b261ecSmrg if (failed) \ 11605b261ecSmrg break; \ 11705b261ecSmrg } \ 11805b261ecSmrg if (failed) \ 11905b261ecSmrg break; \ 12005b261ecSmrg } \ 12105b261ecSmrg if (!failed) \ 12205b261ecSmrg printk("passed\n"); \ 12305b261ecSmrg} 12405b261ecSmrg 12505b261ecSmrg#define VAL_BYTE_BYTE_BINARY(name) \ 12605b261ecSmrg printk("Validating %s ... ", #name); \ 12705b261ecSmrg VAL_START_BINARY(u8,u8,0xFF,0xFF,1,1) \ 12805b261ecSmrg VAL_TEST_BINARY(name) \ 12905b261ecSmrg VAL_FAIL_BYTE_BYTE_BINARY(name) \ 13005b261ecSmrg VAL_END_BINARY() 13105b261ecSmrg 13205b261ecSmrg#define VAL_WORD_WORD_BINARY(name) \ 13305b261ecSmrg printk("Validating %s ... ", #name); \ 13405b261ecSmrg VAL_START_BINARY(u16,u16,0xFF00,0xFF00,0x100,0x100) \ 13505b261ecSmrg VAL_TEST_BINARY(name) \ 13605b261ecSmrg VAL_FAIL_WORD_WORD_BINARY(name) \ 13705b261ecSmrg VAL_END_BINARY() 13805b261ecSmrg 13905b261ecSmrg#define VAL_LONG_LONG_BINARY(name) \ 14005b261ecSmrg printk("Validating %s ... ", #name); \ 14105b261ecSmrg VAL_START_BINARY(u32,u32,0xFF000000,0xFF000000,0x1000000,0x1000000) \ 14205b261ecSmrg VAL_TEST_BINARY(name) \ 14305b261ecSmrg VAL_FAIL_LONG_LONG_BINARY(name) \ 14405b261ecSmrg VAL_END_BINARY() 14505b261ecSmrg 14605b261ecSmrg#define VAL_VOID_BYTE_BINARY(name) \ 14705b261ecSmrg printk("Validating %s ... ", #name); \ 14805b261ecSmrg VAL_START_BINARY(u8,u8,0xFF,0xFF,1,1) \ 14905b261ecSmrg VAL_TEST_BINARY_VOID(name) \ 15005b261ecSmrg VAL_FAIL_BYTE_BYTE_BINARY(name) \ 15105b261ecSmrg VAL_END_BINARY() 15205b261ecSmrg 15305b261ecSmrg#define VAL_VOID_WORD_BINARY(name) \ 15405b261ecSmrg printk("Validating %s ... ", #name); \ 15505b261ecSmrg VAL_START_BINARY(u16,u16,0xFF00,0xFF00,0x100,0x100) \ 15605b261ecSmrg VAL_TEST_BINARY_VOID(name) \ 15705b261ecSmrg VAL_FAIL_WORD_WORD_BINARY(name) \ 15805b261ecSmrg VAL_END_BINARY() 15905b261ecSmrg 16005b261ecSmrg#define VAL_VOID_LONG_BINARY(name) \ 16105b261ecSmrg printk("Validating %s ... ", #name); \ 16205b261ecSmrg VAL_START_BINARY(u32,u32,0xFF000000,0xFF000000,0x1000000,0x1000000) \ 16305b261ecSmrg VAL_TEST_BINARY_VOID(name) \ 16405b261ecSmrg VAL_FAIL_LONG_LONG_BINARY(name) \ 16505b261ecSmrg VAL_END_BINARY() 16605b261ecSmrg 16705b261ecSmrg#define VAL_BYTE_ROTATE(name) \ 16805b261ecSmrg printk("Validating %s ... ", #name); \ 16905b261ecSmrg VAL_START_BINARY(u8,u8,0xFF,8,1,1) \ 17005b261ecSmrg VAL_TEST_BINARY(name) \ 17105b261ecSmrg VAL_FAIL_BYTE_BYTE_BINARY(name) \ 17205b261ecSmrg VAL_END_BINARY() 17305b261ecSmrg 17405b261ecSmrg#define VAL_WORD_ROTATE(name) \ 17505b261ecSmrg printk("Validating %s ... ", #name); \ 17605b261ecSmrg VAL_START_BINARY(u16,u16,0xFF00,16,0x100,1) \ 17705b261ecSmrg VAL_TEST_BINARY(name) \ 17805b261ecSmrg VAL_FAIL_WORD_WORD_BINARY(name) \ 17905b261ecSmrg VAL_END_BINARY() 18005b261ecSmrg 18105b261ecSmrg#define VAL_LONG_ROTATE(name) \ 18205b261ecSmrg printk("Validating %s ... ", #name); \ 18305b261ecSmrg VAL_START_BINARY(u32,u32,0xFF000000,32,0x1000000,1) \ 18405b261ecSmrg VAL_TEST_BINARY(name) \ 18505b261ecSmrg VAL_FAIL_LONG_LONG_BINARY(name) \ 18605b261ecSmrg VAL_END_BINARY() 18705b261ecSmrg 18805b261ecSmrg#define VAL_START_TERNARY(parm_type,res_type,dmax,smax,dincr,sincr,maxshift)\ 18905b261ecSmrg{ \ 19005b261ecSmrg parm_type d,s; \ 19105b261ecSmrg res_type r,r_asm; \ 19205b261ecSmrg u8 shift; \ 19305b261ecSmrg u32 flags,inflags; \ 19405b261ecSmrg int f,failed = false; \ 19505b261ecSmrg char buf1[80],buf2[80]; \ 19605b261ecSmrg for (d = 0; d < dmax; d += dincr) { \ 19705b261ecSmrg for (s = 0; s < smax; s += sincr) { \ 19805b261ecSmrg for (shift = 0; shift < maxshift; shift += 1) { \ 19905b261ecSmrg M.x86.R_EFLG = inflags = flags = def_flags; \ 20005b261ecSmrg for (f = 0; f < 2; f++) { 20105b261ecSmrg 20205b261ecSmrg#define VAL_TEST_TERNARY(name) \ 20305b261ecSmrg r_asm = name##_asm(&flags,d,s,shift); \ 20405b261ecSmrg r = name(d,s,shift); \ 20505b261ecSmrg if (r != r_asm || M.x86.R_EFLG != flags) \ 20605b261ecSmrg failed = true; \ 20705b261ecSmrg if (failed || trace) { 20805b261ecSmrg 20905b261ecSmrg#define VAL_FAIL_WORD_WORD_TERNARY(name) \ 21005b261ecSmrg if (failed) \ 21105b261ecSmrg printk("fail\n"); \ 21205b261ecSmrg printk("0x%04X = %-15s(0x%04X,0x%04X,%d), flags = %s -> %s\n", \ 21305b261ecSmrg r, #name, d, s, shift, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \ 21405b261ecSmrg printk("0x%04X = %-15s(0x%04X,0x%04X,%d), flags = %s -> %s\n", \ 21505b261ecSmrg r_asm, #name"_asm", d, s, shift, print_flags(buf1,inflags), print_flags(buf2,flags)); 21605b261ecSmrg 21705b261ecSmrg#define VAL_FAIL_LONG_LONG_TERNARY(name) \ 21805b261ecSmrg if (failed) \ 21905b261ecSmrg printk("fail\n"); \ 22005b261ecSmrg printk("0x%08X = %-15s(0x%08X,0x%08X,%d), flags = %s -> %s\n", \ 22105b261ecSmrg r, #name, d, s, shift, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \ 22205b261ecSmrg printk("0x%08X = %-15s(0x%08X,0x%08X,%d), flags = %s -> %s\n", \ 22305b261ecSmrg r_asm, #name"_asm", d, s, shift, print_flags(buf1,inflags), print_flags(buf2,flags)); 22405b261ecSmrg 22505b261ecSmrg#define VAL_END_TERNARY() \ 22605b261ecSmrg } \ 22705b261ecSmrg M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \ 22805b261ecSmrg if (failed) \ 22905b261ecSmrg break; \ 23005b261ecSmrg } \ 23105b261ecSmrg if (failed) \ 23205b261ecSmrg break; \ 23305b261ecSmrg } \ 23405b261ecSmrg if (failed) \ 23505b261ecSmrg break; \ 23605b261ecSmrg } \ 23705b261ecSmrg if (failed) \ 23805b261ecSmrg break; \ 23905b261ecSmrg } \ 24005b261ecSmrg if (!failed) \ 24105b261ecSmrg printk("passed\n"); \ 24205b261ecSmrg} 24305b261ecSmrg 24405b261ecSmrg#define VAL_WORD_ROTATE_DBL(name) \ 24505b261ecSmrg printk("Validating %s ... ", #name); \ 24605b261ecSmrg VAL_START_TERNARY(u16,u16,0xFF00,0xFF00,0x100,0x100,16) \ 24705b261ecSmrg VAL_TEST_TERNARY(name) \ 24805b261ecSmrg VAL_FAIL_WORD_WORD_TERNARY(name) \ 24905b261ecSmrg VAL_END_TERNARY() 25005b261ecSmrg 25105b261ecSmrg#define VAL_LONG_ROTATE_DBL(name) \ 25205b261ecSmrg printk("Validating %s ... ", #name); \ 25305b261ecSmrg VAL_START_TERNARY(u32,u32,0xFF000000,0xFF000000,0x1000000,0x1000000,32) \ 25405b261ecSmrg VAL_TEST_TERNARY(name) \ 25505b261ecSmrg VAL_FAIL_LONG_LONG_TERNARY(name) \ 25605b261ecSmrg VAL_END_TERNARY() 25705b261ecSmrg 25805b261ecSmrg#define VAL_START_UNARY(parm_type,max,incr) \ 25905b261ecSmrg{ \ 26005b261ecSmrg parm_type d,r,r_asm; \ 26105b261ecSmrg u32 flags,inflags; \ 26205b261ecSmrg int f,failed = false; \ 26305b261ecSmrg char buf1[80],buf2[80]; \ 26405b261ecSmrg for (d = 0; d < max; d += incr) { \ 26505b261ecSmrg M.x86.R_EFLG = inflags = flags = def_flags; \ 26605b261ecSmrg for (f = 0; f < 2; f++) { 26705b261ecSmrg 26805b261ecSmrg#define VAL_TEST_UNARY(name) \ 26905b261ecSmrg r_asm = name##_asm(&flags,d); \ 27005b261ecSmrg r = name(d); \ 27105b261ecSmrg if (r != r_asm || M.x86.R_EFLG != flags) { \ 27205b261ecSmrg failed = true; 27305b261ecSmrg 27405b261ecSmrg#define VAL_FAIL_BYTE_UNARY(name) \ 27505b261ecSmrg printk("fail\n"); \ 27605b261ecSmrg printk("0x%02X = %-15s(0x%02X), flags = %s -> %s\n", \ 27705b261ecSmrg r, #name, d, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \ 27805b261ecSmrg printk("0x%02X = %-15s(0x%02X), flags = %s -> %s\n", \ 27905b261ecSmrg r_asm, #name"_asm", d, print_flags(buf1,inflags), print_flags(buf2,flags)); 28005b261ecSmrg 28105b261ecSmrg#define VAL_FAIL_WORD_UNARY(name) \ 28205b261ecSmrg printk("fail\n"); \ 28305b261ecSmrg printk("0x%04X = %-15s(0x%04X), flags = %s -> %s\n", \ 28405b261ecSmrg r, #name, d, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \ 28505b261ecSmrg printk("0x%04X = %-15s(0x%04X), flags = %s -> %s\n", \ 28605b261ecSmrg r_asm, #name"_asm", d, print_flags(buf1,inflags), print_flags(buf2,flags)); 28705b261ecSmrg 28805b261ecSmrg#define VAL_FAIL_LONG_UNARY(name) \ 28905b261ecSmrg printk("fail\n"); \ 29005b261ecSmrg printk("0x%08X = %-15s(0x%08X), flags = %s -> %s\n", \ 29105b261ecSmrg r, #name, d, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \ 29205b261ecSmrg printk("0x%08X = %-15s(0x%08X), flags = %s -> %s\n", \ 29305b261ecSmrg r_asm, #name"_asm", d, print_flags(buf1,inflags), print_flags(buf2,flags)); 29405b261ecSmrg 29505b261ecSmrg#define VAL_END_UNARY() \ 29605b261ecSmrg } \ 29705b261ecSmrg M.x86.R_EFLG = inflags = flags = def_flags | ALL_FLAGS; \ 29805b261ecSmrg if (failed) \ 29905b261ecSmrg break; \ 30005b261ecSmrg } \ 30105b261ecSmrg if (failed) \ 30205b261ecSmrg break; \ 30305b261ecSmrg } \ 30405b261ecSmrg if (!failed) \ 30505b261ecSmrg printk("passed\n"); \ 30605b261ecSmrg} 30705b261ecSmrg 30805b261ecSmrg#define VAL_BYTE_UNARY(name) \ 30905b261ecSmrg printk("Validating %s ... ", #name); \ 31005b261ecSmrg VAL_START_UNARY(u8,0xFF,0x1) \ 31105b261ecSmrg VAL_TEST_UNARY(name) \ 31205b261ecSmrg VAL_FAIL_BYTE_UNARY(name) \ 31305b261ecSmrg VAL_END_UNARY() 31405b261ecSmrg 31505b261ecSmrg#define VAL_WORD_UNARY(name) \ 31605b261ecSmrg printk("Validating %s ... ", #name); \ 31705b261ecSmrg VAL_START_UNARY(u16,0xFF00,0x100) \ 31805b261ecSmrg VAL_TEST_UNARY(name) \ 31905b261ecSmrg VAL_FAIL_WORD_UNARY(name) \ 32005b261ecSmrg VAL_END_UNARY() 32105b261ecSmrg 32205b261ecSmrg#define VAL_WORD_BYTE_UNARY(name) \ 32305b261ecSmrg printk("Validating %s ... ", #name); \ 32405b261ecSmrg VAL_START_UNARY(u16,0xFF,0x1) \ 32505b261ecSmrg VAL_TEST_UNARY(name) \ 32605b261ecSmrg VAL_FAIL_WORD_UNARY(name) \ 32705b261ecSmrg VAL_END_UNARY() 32805b261ecSmrg 32905b261ecSmrg#define VAL_LONG_UNARY(name) \ 33005b261ecSmrg printk("Validating %s ... ", #name); \ 33105b261ecSmrg VAL_START_UNARY(u32,0xFF000000,0x1000000) \ 33205b261ecSmrg VAL_TEST_UNARY(name) \ 33305b261ecSmrg VAL_FAIL_LONG_UNARY(name) \ 33405b261ecSmrg VAL_END_UNARY() 33505b261ecSmrg 33605b261ecSmrg#define VAL_BYTE_MUL(name) \ 33705b261ecSmrg printk("Validating %s ... ", #name); \ 33805b261ecSmrg{ \ 33905b261ecSmrg u8 d,s; \ 34005b261ecSmrg u16 r,r_asm; \ 34105b261ecSmrg u32 flags,inflags; \ 34205b261ecSmrg int f,failed = false; \ 34305b261ecSmrg char buf1[80],buf2[80]; \ 34405b261ecSmrg for (d = 0; d < 0xFF; d += 1) { \ 34505b261ecSmrg for (s = 0; s < 0xFF; s += 1) { \ 34605b261ecSmrg M.x86.R_EFLG = inflags = flags = def_flags; \ 34705b261ecSmrg for (f = 0; f < 2; f++) { \ 34805b261ecSmrg name##_asm(&flags,&r_asm,d,s); \ 34905b261ecSmrg M.x86.R_AL = d; \ 35005b261ecSmrg name(s); \ 35105b261ecSmrg r = M.x86.R_AX; \ 35205b261ecSmrg if (r != r_asm || M.x86.R_EFLG != flags) \ 35305b261ecSmrg failed = true; \ 35405b261ecSmrg if (failed || trace) { \ 35505b261ecSmrg if (failed) \ 35605b261ecSmrg printk("fail\n"); \ 35705b261ecSmrg printk("0x%04X = %-15s(0x%02X,0x%02X), flags = %s -> %s\n", \ 35805b261ecSmrg r, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \ 35905b261ecSmrg printk("0x%04X = %-15s(0x%02X,0x%02X), flags = %s -> %s\n", \ 36005b261ecSmrg r_asm, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); \ 36105b261ecSmrg } \ 36205b261ecSmrg M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \ 36305b261ecSmrg if (failed) \ 36405b261ecSmrg break; \ 36505b261ecSmrg } \ 36605b261ecSmrg if (failed) \ 36705b261ecSmrg break; \ 36805b261ecSmrg } \ 36905b261ecSmrg if (failed) \ 37005b261ecSmrg break; \ 37105b261ecSmrg } \ 37205b261ecSmrg if (!failed) \ 37305b261ecSmrg printk("passed\n"); \ 37405b261ecSmrg} 37505b261ecSmrg 37605b261ecSmrg#define VAL_WORD_MUL(name) \ 37705b261ecSmrg printk("Validating %s ... ", #name); \ 37805b261ecSmrg{ \ 37905b261ecSmrg u16 d,s; \ 38005b261ecSmrg u16 r_lo,r_asm_lo; \ 38105b261ecSmrg u16 r_hi,r_asm_hi; \ 38205b261ecSmrg u32 flags,inflags; \ 38305b261ecSmrg int f,failed = false; \ 38405b261ecSmrg char buf1[80],buf2[80]; \ 38505b261ecSmrg for (d = 0; d < 0xFF00; d += 0x100) { \ 38605b261ecSmrg for (s = 0; s < 0xFF00; s += 0x100) { \ 38705b261ecSmrg M.x86.R_EFLG = inflags = flags = def_flags; \ 38805b261ecSmrg for (f = 0; f < 2; f++) { \ 38905b261ecSmrg name##_asm(&flags,&r_asm_lo,&r_asm_hi,d,s); \ 39005b261ecSmrg M.x86.R_AX = d; \ 39105b261ecSmrg name(s); \ 39205b261ecSmrg r_lo = M.x86.R_AX; \ 39305b261ecSmrg r_hi = M.x86.R_DX; \ 39405b261ecSmrg if (r_lo != r_asm_lo || r_hi != r_asm_hi || M.x86.R_EFLG != flags)\ 39505b261ecSmrg failed = true; \ 39605b261ecSmrg if (failed || trace) { \ 39705b261ecSmrg if (failed) \ 39805b261ecSmrg printk("fail\n"); \ 39905b261ecSmrg printk("0x%04X:0x%04X = %-15s(0x%04X,0x%04X), flags = %s -> %s\n", \ 40005b261ecSmrg r_hi,r_lo, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \ 40105b261ecSmrg printk("0x%04X:0x%04X = %-15s(0x%04X,0x%04X), flags = %s -> %s\n", \ 40205b261ecSmrg r_asm_hi,r_asm_lo, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); \ 40305b261ecSmrg } \ 40405b261ecSmrg M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \ 40505b261ecSmrg if (failed) \ 40605b261ecSmrg break; \ 40705b261ecSmrg } \ 40805b261ecSmrg if (failed) \ 40905b261ecSmrg break; \ 41005b261ecSmrg } \ 41105b261ecSmrg if (failed) \ 41205b261ecSmrg break; \ 41305b261ecSmrg } \ 41405b261ecSmrg if (!failed) \ 41505b261ecSmrg printk("passed\n"); \ 41605b261ecSmrg} 41705b261ecSmrg 41805b261ecSmrg#define VAL_LONG_MUL(name) \ 41905b261ecSmrg printk("Validating %s ... ", #name); \ 42005b261ecSmrg{ \ 42105b261ecSmrg u32 d,s; \ 42205b261ecSmrg u32 r_lo,r_asm_lo; \ 42305b261ecSmrg u32 r_hi,r_asm_hi; \ 42405b261ecSmrg u32 flags,inflags; \ 42505b261ecSmrg int f,failed = false; \ 42605b261ecSmrg char buf1[80],buf2[80]; \ 42705b261ecSmrg for (d = 0; d < 0xFF000000; d += 0x1000000) { \ 42805b261ecSmrg for (s = 0; s < 0xFF000000; s += 0x1000000) { \ 42905b261ecSmrg M.x86.R_EFLG = inflags = flags = def_flags; \ 43005b261ecSmrg for (f = 0; f < 2; f++) { \ 43105b261ecSmrg name##_asm(&flags,&r_asm_lo,&r_asm_hi,d,s); \ 43205b261ecSmrg M.x86.R_EAX = d; \ 43305b261ecSmrg name(s); \ 43405b261ecSmrg r_lo = M.x86.R_EAX; \ 43505b261ecSmrg r_hi = M.x86.R_EDX; \ 43605b261ecSmrg if (r_lo != r_asm_lo || r_hi != r_asm_hi || M.x86.R_EFLG != flags)\ 43705b261ecSmrg failed = true; \ 43805b261ecSmrg if (failed || trace) { \ 43905b261ecSmrg if (failed) \ 44005b261ecSmrg printk("fail\n"); \ 44105b261ecSmrg printk("0x%08X:0x%08X = %-15s(0x%08X,0x%08X), flags = %s -> %s\n", \ 44205b261ecSmrg r_hi,r_lo, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \ 44305b261ecSmrg printk("0x%08X:0x%08X = %-15s(0x%08X,0x%08X), flags = %s -> %s\n", \ 44405b261ecSmrg r_asm_hi,r_asm_lo, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); \ 44505b261ecSmrg } \ 44605b261ecSmrg M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \ 44705b261ecSmrg if (failed) \ 44805b261ecSmrg break; \ 44905b261ecSmrg } \ 45005b261ecSmrg if (failed) \ 45105b261ecSmrg break; \ 45205b261ecSmrg } \ 45305b261ecSmrg if (failed) \ 45405b261ecSmrg break; \ 45505b261ecSmrg } \ 45605b261ecSmrg if (!failed) \ 45705b261ecSmrg printk("passed\n"); \ 45805b261ecSmrg} 45905b261ecSmrg 46005b261ecSmrg#define VAL_BYTE_DIV(name) \ 46105b261ecSmrg printk("Validating %s ... ", #name); \ 46205b261ecSmrg{ \ 46305b261ecSmrg u16 d,s; \ 46405b261ecSmrg u8 r_quot,r_rem,r_asm_quot,r_asm_rem; \ 46505b261ecSmrg u32 flags,inflags; \ 46605b261ecSmrg int f,failed = false; \ 46705b261ecSmrg char buf1[80],buf2[80]; \ 46805b261ecSmrg for (d = 0; d < 0xFF00; d += 0x100) { \ 46905b261ecSmrg for (s = 1; s < 0xFF; s += 1) { \ 47005b261ecSmrg M.x86.R_EFLG = inflags = flags = def_flags; \ 47105b261ecSmrg for (f = 0; f < 2; f++) { \ 47205b261ecSmrg M.x86.intr = 0; \ 47305b261ecSmrg M.x86.R_AX = d; \ 47405b261ecSmrg name(s); \ 47505b261ecSmrg r_quot = M.x86.R_AL; \ 47605b261ecSmrg r_rem = M.x86.R_AH; \ 47705b261ecSmrg if (M.x86.intr & INTR_SYNCH) \ 47805b261ecSmrg continue; \ 47905b261ecSmrg name##_asm(&flags,&r_asm_quot,&r_asm_rem,d,s); \ 48005b261ecSmrg if (r_quot != r_asm_quot || r_rem != r_asm_rem || M.x86.R_EFLG != flags) \ 48105b261ecSmrg failed = true; \ 48205b261ecSmrg if (failed || trace) { \ 48305b261ecSmrg if (failed) \ 48405b261ecSmrg printk("fail\n"); \ 48505b261ecSmrg printk("0x%02X:0x%02X = %-15s(0x%04X,0x%02X), flags = %s -> %s\n", \ 48605b261ecSmrg r_quot, r_rem, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \ 48705b261ecSmrg printk("0x%02X:0x%02X = %-15s(0x%04X,0x%02X), flags = %s -> %s\n", \ 48805b261ecSmrg r_asm_quot, r_asm_rem, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); \ 48905b261ecSmrg } \ 49005b261ecSmrg M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \ 49105b261ecSmrg if (failed) \ 49205b261ecSmrg break; \ 49305b261ecSmrg } \ 49405b261ecSmrg if (failed) \ 49505b261ecSmrg break; \ 49605b261ecSmrg } \ 49705b261ecSmrg if (failed) \ 49805b261ecSmrg break; \ 49905b261ecSmrg } \ 50005b261ecSmrg if (!failed) \ 50105b261ecSmrg printk("passed\n"); \ 50205b261ecSmrg} 50305b261ecSmrg 50405b261ecSmrg#define VAL_WORD_DIV(name) \ 50505b261ecSmrg printk("Validating %s ... ", #name); \ 50605b261ecSmrg{ \ 50705b261ecSmrg u32 d,s; \ 50805b261ecSmrg u16 r_quot,r_rem,r_asm_quot,r_asm_rem; \ 50905b261ecSmrg u32 flags,inflags; \ 51005b261ecSmrg int f,failed = false; \ 51105b261ecSmrg char buf1[80],buf2[80]; \ 51205b261ecSmrg for (d = 0; d < 0xFF000000; d += 0x1000000) { \ 51305b261ecSmrg for (s = 0x100; s < 0xFF00; s += 0x100) { \ 51405b261ecSmrg M.x86.R_EFLG = inflags = flags = def_flags; \ 51505b261ecSmrg for (f = 0; f < 2; f++) { \ 51605b261ecSmrg M.x86.intr = 0; \ 51705b261ecSmrg M.x86.R_AX = d & 0xFFFF; \ 51805b261ecSmrg M.x86.R_DX = d >> 16; \ 51905b261ecSmrg name(s); \ 52005b261ecSmrg r_quot = M.x86.R_AX; \ 52105b261ecSmrg r_rem = M.x86.R_DX; \ 52205b261ecSmrg if (M.x86.intr & INTR_SYNCH) \ 52305b261ecSmrg continue; \ 52405b261ecSmrg name##_asm(&flags,&r_asm_quot,&r_asm_rem,d & 0xFFFF,d >> 16,s);\ 52505b261ecSmrg if (r_quot != r_asm_quot || r_rem != r_asm_rem || M.x86.R_EFLG != flags) \ 52605b261ecSmrg failed = true; \ 52705b261ecSmrg if (failed || trace) { \ 52805b261ecSmrg if (failed) \ 52905b261ecSmrg printk("fail\n"); \ 53005b261ecSmrg printk("0x%04X:0x%04X = %-15s(0x%08X,0x%04X), flags = %s -> %s\n", \ 53105b261ecSmrg r_quot, r_rem, #name, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \ 53205b261ecSmrg printk("0x%04X:0x%04X = %-15s(0x%08X,0x%04X), flags = %s -> %s\n", \ 53305b261ecSmrg r_asm_quot, r_asm_rem, #name"_asm", d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); \ 53405b261ecSmrg } \ 53505b261ecSmrg M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \ 53605b261ecSmrg if (failed) \ 53705b261ecSmrg break; \ 53805b261ecSmrg } \ 53905b261ecSmrg if (failed) \ 54005b261ecSmrg break; \ 54105b261ecSmrg } \ 54205b261ecSmrg if (failed) \ 54305b261ecSmrg break; \ 54405b261ecSmrg } \ 54505b261ecSmrg if (!failed) \ 54605b261ecSmrg printk("passed\n"); \ 54705b261ecSmrg} 54805b261ecSmrg 54905b261ecSmrg#define VAL_LONG_DIV(name) \ 55005b261ecSmrg printk("Validating %s ... ", #name); \ 55105b261ecSmrg{ \ 55205b261ecSmrg u32 d,s; \ 55305b261ecSmrg u32 r_quot,r_rem,r_asm_quot,r_asm_rem; \ 55405b261ecSmrg u32 flags,inflags; \ 55505b261ecSmrg int f,failed = false; \ 55605b261ecSmrg char buf1[80],buf2[80]; \ 55705b261ecSmrg for (d = 0; d < 0xFF000000; d += 0x1000000) { \ 55805b261ecSmrg for (s = 0x100; s < 0xFF00; s += 0x100) { \ 55905b261ecSmrg M.x86.R_EFLG = inflags = flags = def_flags; \ 56005b261ecSmrg for (f = 0; f < 2; f++) { \ 56105b261ecSmrg M.x86.intr = 0; \ 56205b261ecSmrg M.x86.R_EAX = d; \ 56305b261ecSmrg M.x86.R_EDX = 0; \ 56405b261ecSmrg name(s); \ 56505b261ecSmrg r_quot = M.x86.R_EAX; \ 56605b261ecSmrg r_rem = M.x86.R_EDX; \ 56705b261ecSmrg if (M.x86.intr & INTR_SYNCH) \ 56805b261ecSmrg continue; \ 56905b261ecSmrg name##_asm(&flags,&r_asm_quot,&r_asm_rem,d,0,s); \ 57005b261ecSmrg if (r_quot != r_asm_quot || r_rem != r_asm_rem || M.x86.R_EFLG != flags) \ 57105b261ecSmrg failed = true; \ 57205b261ecSmrg if (failed || trace) { \ 57305b261ecSmrg if (failed) \ 57405b261ecSmrg printk("fail\n"); \ 57505b261ecSmrg printk("0x%08X:0x%08X = %-15s(0x%08X:0x%08X,0x%08X), flags = %s -> %s\n", \ 57605b261ecSmrg r_quot, r_rem, #name, 0, d, s, print_flags(buf1,inflags), print_flags(buf2,M.x86.R_EFLG)); \ 57705b261ecSmrg printk("0x%08X:0x%08X = %-15s(0x%08X:0x%08X,0x%08X), flags = %s -> %s\n", \ 57805b261ecSmrg r_asm_quot, r_asm_rem, #name"_asm", 0, d, s, print_flags(buf1,inflags), print_flags(buf2,flags)); \ 57905b261ecSmrg } \ 58005b261ecSmrg M.x86.R_EFLG = inflags = flags = def_flags | (ALL_FLAGS & ~F_OF); \ 58105b261ecSmrg if (failed) \ 58205b261ecSmrg break; \ 58305b261ecSmrg } \ 58405b261ecSmrg if (failed) \ 58505b261ecSmrg break; \ 58605b261ecSmrg } \ 58705b261ecSmrg if (failed) \ 58805b261ecSmrg break; \ 58905b261ecSmrg } \ 59005b261ecSmrg if (!failed) \ 59105b261ecSmrg printk("passed\n"); \ 59205b261ecSmrg} 59305b261ecSmrg 59435c4bbdfSmrgvoid 59535c4bbdfSmrgprintk(const char *fmt, ...) 59605b261ecSmrg{ 59705b261ecSmrg va_list argptr; 59835c4bbdfSmrg 59905b261ecSmrg va_start(argptr, fmt); 60005b261ecSmrg vfprintf(stdout, fmt, argptr); 60105b261ecSmrg fflush(stdout); 60205b261ecSmrg va_end(argptr); 60305b261ecSmrg} 60405b261ecSmrg 60535c4bbdfSmrgchar * 60635c4bbdfSmrgprint_flags(char *buf, ulong flags) 60705b261ecSmrg{ 60805b261ecSmrg char *separator = ""; 60905b261ecSmrg 61005b261ecSmrg buf[0] = 0; 61105b261ecSmrg if (flags & F_CF) { 61235c4bbdfSmrg strcat(buf, separator); 61335c4bbdfSmrg strcat(buf, "CF"); 61405b261ecSmrg separator = ","; 61535c4bbdfSmrg } 61605b261ecSmrg if (flags & F_PF) { 61735c4bbdfSmrg strcat(buf, separator); 61835c4bbdfSmrg strcat(buf, "PF"); 61905b261ecSmrg separator = ","; 62035c4bbdfSmrg } 62105b261ecSmrg if (flags & F_AF) { 62235c4bbdfSmrg strcat(buf, separator); 62335c4bbdfSmrg strcat(buf, "AF"); 62405b261ecSmrg separator = ","; 62535c4bbdfSmrg } 62605b261ecSmrg if (flags & F_ZF) { 62735c4bbdfSmrg strcat(buf, separator); 62835c4bbdfSmrg strcat(buf, "ZF"); 62905b261ecSmrg separator = ","; 63035c4bbdfSmrg } 63105b261ecSmrg if (flags & F_SF) { 63235c4bbdfSmrg strcat(buf, separator); 63335c4bbdfSmrg strcat(buf, "SF"); 63405b261ecSmrg separator = ","; 63535c4bbdfSmrg } 63605b261ecSmrg if (flags & F_OF) { 63735c4bbdfSmrg strcat(buf, separator); 63835c4bbdfSmrg strcat(buf, "OF"); 63905b261ecSmrg separator = ","; 64035c4bbdfSmrg } 64105b261ecSmrg if (separator[0] == 0) 64235c4bbdfSmrg strcpy(buf, "None"); 64305b261ecSmrg return buf; 64405b261ecSmrg} 64505b261ecSmrg 64635c4bbdfSmrgint 64735c4bbdfSmrgmain(int argc) 64805b261ecSmrg{ 64935c4bbdfSmrg ulong def_flags; 65005b261ecSmrg int trace = false; 65105b261ecSmrg 65205b261ecSmrg if (argc > 1) 65305b261ecSmrg trace = true; 65405b261ecSmrg memset(&M, 0, sizeof(M)); 65505b261ecSmrg def_flags = get_flags_asm() & ~ALL_FLAGS; 65605b261ecSmrg 65705b261ecSmrg VAL_WORD_UNARY(aaa_word); 65805b261ecSmrg VAL_WORD_UNARY(aas_word); 65905b261ecSmrg 66005b261ecSmrg VAL_WORD_UNARY(aad_word); 66105b261ecSmrg VAL_WORD_UNARY(aam_word); 66205b261ecSmrg 66305b261ecSmrg VAL_BYTE_BYTE_BINARY(adc_byte); 66405b261ecSmrg VAL_WORD_WORD_BINARY(adc_word); 66505b261ecSmrg VAL_LONG_LONG_BINARY(adc_long); 66605b261ecSmrg 66705b261ecSmrg VAL_BYTE_BYTE_BINARY(add_byte); 66805b261ecSmrg VAL_WORD_WORD_BINARY(add_word); 66905b261ecSmrg VAL_LONG_LONG_BINARY(add_long); 67005b261ecSmrg 67105b261ecSmrg VAL_BYTE_BYTE_BINARY(and_byte); 67205b261ecSmrg VAL_WORD_WORD_BINARY(and_word); 67305b261ecSmrg VAL_LONG_LONG_BINARY(and_long); 67405b261ecSmrg 67505b261ecSmrg VAL_BYTE_BYTE_BINARY(cmp_byte); 67605b261ecSmrg VAL_WORD_WORD_BINARY(cmp_word); 67705b261ecSmrg VAL_LONG_LONG_BINARY(cmp_long); 67805b261ecSmrg 67905b261ecSmrg VAL_BYTE_UNARY(daa_byte); 6806747b715Smrg VAL_BYTE_UNARY(das_byte); /* Fails for 0x9A (out of range anyway) */ 68105b261ecSmrg 68205b261ecSmrg VAL_BYTE_UNARY(dec_byte); 68305b261ecSmrg VAL_WORD_UNARY(dec_word); 68405b261ecSmrg VAL_LONG_UNARY(dec_long); 68505b261ecSmrg 68605b261ecSmrg VAL_BYTE_UNARY(inc_byte); 68705b261ecSmrg VAL_WORD_UNARY(inc_word); 68805b261ecSmrg VAL_LONG_UNARY(inc_long); 68905b261ecSmrg 69005b261ecSmrg VAL_BYTE_BYTE_BINARY(or_byte); 69105b261ecSmrg VAL_WORD_WORD_BINARY(or_word); 69205b261ecSmrg VAL_LONG_LONG_BINARY(or_long); 69305b261ecSmrg 69405b261ecSmrg VAL_BYTE_UNARY(neg_byte); 69505b261ecSmrg VAL_WORD_UNARY(neg_word); 69605b261ecSmrg VAL_LONG_UNARY(neg_long); 69705b261ecSmrg 69805b261ecSmrg VAL_BYTE_UNARY(not_byte); 69905b261ecSmrg VAL_WORD_UNARY(not_word); 70005b261ecSmrg VAL_LONG_UNARY(not_long); 70105b261ecSmrg 70205b261ecSmrg VAL_BYTE_ROTATE(rcl_byte); 70305b261ecSmrg VAL_WORD_ROTATE(rcl_word); 70405b261ecSmrg VAL_LONG_ROTATE(rcl_long); 70505b261ecSmrg 70605b261ecSmrg VAL_BYTE_ROTATE(rcr_byte); 70705b261ecSmrg VAL_WORD_ROTATE(rcr_word); 70805b261ecSmrg VAL_LONG_ROTATE(rcr_long); 70905b261ecSmrg 71005b261ecSmrg VAL_BYTE_ROTATE(rol_byte); 71105b261ecSmrg VAL_WORD_ROTATE(rol_word); 71205b261ecSmrg VAL_LONG_ROTATE(rol_long); 71305b261ecSmrg 71405b261ecSmrg VAL_BYTE_ROTATE(ror_byte); 71505b261ecSmrg VAL_WORD_ROTATE(ror_word); 71605b261ecSmrg VAL_LONG_ROTATE(ror_long); 71705b261ecSmrg 71805b261ecSmrg VAL_BYTE_ROTATE(shl_byte); 71905b261ecSmrg VAL_WORD_ROTATE(shl_word); 72005b261ecSmrg VAL_LONG_ROTATE(shl_long); 72105b261ecSmrg 72205b261ecSmrg VAL_BYTE_ROTATE(shr_byte); 72305b261ecSmrg VAL_WORD_ROTATE(shr_word); 72405b261ecSmrg VAL_LONG_ROTATE(shr_long); 72505b261ecSmrg 72605b261ecSmrg VAL_BYTE_ROTATE(sar_byte); 72705b261ecSmrg VAL_WORD_ROTATE(sar_word); 72805b261ecSmrg VAL_LONG_ROTATE(sar_long); 72905b261ecSmrg 73005b261ecSmrg VAL_WORD_ROTATE_DBL(shld_word); 73105b261ecSmrg VAL_LONG_ROTATE_DBL(shld_long); 73205b261ecSmrg 73305b261ecSmrg VAL_WORD_ROTATE_DBL(shrd_word); 73405b261ecSmrg VAL_LONG_ROTATE_DBL(shrd_long); 73505b261ecSmrg 73605b261ecSmrg VAL_BYTE_BYTE_BINARY(sbb_byte); 73705b261ecSmrg VAL_WORD_WORD_BINARY(sbb_word); 73805b261ecSmrg VAL_LONG_LONG_BINARY(sbb_long); 73905b261ecSmrg 74005b261ecSmrg VAL_BYTE_BYTE_BINARY(sub_byte); 74105b261ecSmrg VAL_WORD_WORD_BINARY(sub_word); 74205b261ecSmrg VAL_LONG_LONG_BINARY(sub_long); 74305b261ecSmrg 74405b261ecSmrg VAL_BYTE_BYTE_BINARY(xor_byte); 74505b261ecSmrg VAL_WORD_WORD_BINARY(xor_word); 74605b261ecSmrg VAL_LONG_LONG_BINARY(xor_long); 74705b261ecSmrg 74805b261ecSmrg VAL_VOID_BYTE_BINARY(test_byte); 74905b261ecSmrg VAL_VOID_WORD_BINARY(test_word); 75005b261ecSmrg VAL_VOID_LONG_BINARY(test_long); 75105b261ecSmrg 75205b261ecSmrg VAL_BYTE_MUL(imul_byte); 75305b261ecSmrg VAL_WORD_MUL(imul_word); 75405b261ecSmrg VAL_LONG_MUL(imul_long); 75505b261ecSmrg 75605b261ecSmrg VAL_BYTE_MUL(mul_byte); 75705b261ecSmrg VAL_WORD_MUL(mul_word); 75805b261ecSmrg VAL_LONG_MUL(mul_long); 75905b261ecSmrg 76005b261ecSmrg VAL_BYTE_DIV(idiv_byte); 76105b261ecSmrg VAL_WORD_DIV(idiv_word); 76205b261ecSmrg VAL_LONG_DIV(idiv_long); 76305b261ecSmrg 76405b261ecSmrg VAL_BYTE_DIV(div_byte); 76505b261ecSmrg VAL_WORD_DIV(div_word); 76605b261ecSmrg VAL_LONG_DIV(div_long); 76705b261ecSmrg 76805b261ecSmrg return 0; 76905b261ecSmrg} 770