From patchwork Tue Jul 24 10:51:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 142761 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp7120430ljj; Tue, 24 Jul 2018 03:59:49 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdVZewQPxMCP8FXlpU0uSzQYcBUZX0lM3V2nSOqTKaaP4hTOVf0ZqdyGM+lgVjcKLGeAQ6B X-Received: by 2002:ac8:5289:: with SMTP id s9-v6mr15185164qtn.311.1532429989525; Tue, 24 Jul 2018 03:59:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532429989; cv=none; d=google.com; s=arc-20160816; b=gywMfbIwdYdEKaT7D7dcHSecwzpa7KWMXXV9o2pWRBCN9/VQj05fELlmXqQMTKtwVn d1eV4betyAa6kB1388tvoCj3Gqep32ZedvpgDF7U8zX1rCGP3SYvgCb5oWiX3ulkb6Vu nVej6/cCoYa5CT5r+wacvxzH4fEPUxl5LD6/YBE6d4sIoKOigmcPygFCIqLb+C8XN2e8 0U15yMcko3YuuPKmAWdFuaCDPH1CclJdWt8CiFmgkRhyzj5GFAKghiA7I/cUGJX+a0yr 6COoYlaqY//FBJwb169EfSLKCyYyAcQF60kBGnjj/jqa62JD2KXZcj+5hCxNKGoq3LOT 5/Uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=hxKEMlC/fwAWde72FJ/A17vNzuwLpn2MYRkDcIREctA=; b=nXozHiI9w2V6Mq38C2tI0+wVqHtNk/fX9dL9Y3oRC6T8O/oSUWFLKkgfNpdOGERYRz sKbBNCDX0gaowekK7lPpefdZvo5acrSxNSixLPyq/iXycRYHSeq8IwuORkmCexnLAVX9 uxtwNzJgSsGAq7iaHyligHx95DA9DQWkh72v+Iq28PIk2kCdnb4+hu4vgaFbt/ULttU+ fHcJwapzL+Fbu0PVxHW0MivnKv6ma0HTB7/KZteSqf5Sw1iuZ3HsLOxMS58hizwsWhtK dz7Q3Xdh3pUU6sBN808uXYNwjqKwm7tlsoCXwD7RbpaV3n4VCXr2ekuX/jfnExDzy0t0 K8kQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=VzyXmC9o; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id g187-v6si2204649qkb.320.2018.07.24.03.59.49 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 24 Jul 2018 03:59:49 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=VzyXmC9o; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:39485 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhv2i-0007tU-Vn for patch@linaro.org; Tue, 24 Jul 2018 06:59:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34051) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhv1m-0007PV-AI for qemu-devel@nongnu.org; Tue, 24 Jul 2018 06:58:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fhv1k-0000kW-QE for qemu-devel@nongnu.org; Tue, 24 Jul 2018 06:58:50 -0400 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:40107) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fhv1k-0000kK-GV for qemu-devel@nongnu.org; Tue, 24 Jul 2018 06:58:48 -0400 Received: by mail-wm0-x244.google.com with SMTP id y9-v6so1252638wma.5 for ; Tue, 24 Jul 2018 03:58:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hxKEMlC/fwAWde72FJ/A17vNzuwLpn2MYRkDcIREctA=; b=VzyXmC9o9oeBoacUgf0RnSAK2Z7EaYtdU2VWyB/J4azAHBY76f5LClx9ha8xD3rNfQ drXplB61SD1rwCHeyd6C/0/usL86SCVPZQsOOtDlgMXYIUFYezlaxNRWrc/js83sDlMB 98jiMqU3vN6vDcgNAU+dsKtpGLaMHdwits1Qw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hxKEMlC/fwAWde72FJ/A17vNzuwLpn2MYRkDcIREctA=; b=e64clh+u4SAGAtdN/SBdiQi/A7EWmZ1GC96OqAjLNvU992D6NZgamq7MG5GCHAx7Eu Tlci8wV+XmruHzRIyG2nDYtyMqCCKiRpDDmYz8sQABTLtJf64hXaQA7wVTsPX3tc3ADb J5+0libfG3sLtXuTAvMmaIgMi7B/JS07zj9C/RjxAiZuixsI0eag2laO2hcoa/YdFK/8 qjARGqL+H9+3O6Sff0mWZkPzTtnVEkN9JTiUJMJpYey+NdefNroQPOEPSuZy96pjE40m +JZVYXNTcWsKkrxIPxmaKN8pRsyF6n9uebVcgDwhkS1KpeosIsSEqhZWE+btKnuZNA2u 8CWA== X-Gm-Message-State: AOUpUlEvQdgR9Jrr+AQcYnJ4KCc6dYx79loku4DnUHaLx5ekaKPb4N8p K97b4ayFhNZGWbh7av+rCAvT+g== X-Received: by 2002:a1c:4d09:: with SMTP id o9-v6mr1787619wmh.111.1532429927287; Tue, 24 Jul 2018 03:58:47 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id q188-v6sm2321523wmd.36.2018.07.24.03.58.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 24 Jul 2018 03:58:46 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 37ABA3E072C; Tue, 24 Jul 2018 11:51:11 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Tue, 24 Jul 2018 11:51:09 +0100 Message-Id: <20180724105109.8392-18-alex.bennee@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180724105109.8392-1-alex.bennee@linaro.org> References: <20180724105109.8392-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::244 Subject: [Qemu-devel] [PULL 17/17] tests/tcg: remove runcom test X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, Eduardo Habkost , Richard Henderson Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The combination of being rather esoteric and needing to support mmap @ 0 means this only ever worked under translation. It has now regressed even further and is no longer useful. Kill it. Signed-off-by: Alex Bennée Reviewed-by: Peter Maydell -- 2.17.1 diff --git a/tests/tcg/i386/Makefile.target b/tests/tcg/i386/Makefile.target index c1997a1624..b4033ba3d1 100644 --- a/tests/tcg/i386/Makefile.target +++ b/tests/tcg/i386/Makefile.target @@ -29,11 +29,6 @@ test-i386: test-i386.c test-i386-code16.S test-i386-vm86.S test-i386.h test-i386 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ \ $( -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -extern int vm86 (unsigned long int subfunction, - struct vm86plus_struct *info); - -#define VIF_MASK 0x00080000 - -//#define SIGTEST - -#define COM_BASE_ADDR 0x10100 - -static void usage(void) -{ - printf("runcom version 0.1 (c) 2003 Fabrice Bellard\n" - "usage: runcom file.com\n" - "VM86 Run simple .com DOS executables (linux vm86 test mode)\n"); - exit(1); -} - -static inline void set_bit(uint8_t *a, unsigned int bit) -{ - a[bit / 8] |= (1 << (bit % 8)); -} - -static inline uint8_t *seg_to_linear(unsigned int seg, unsigned int reg) -{ - return (uint8_t *)((seg << 4) + (reg & 0xffff)); -} - -static inline void pushw(struct vm86_regs *r, int val) -{ - r->esp = (r->esp & ~0xffff) | ((r->esp - 2) & 0xffff); - *(uint16_t *)seg_to_linear(r->ss, r->esp) = val; -} - -void dump_regs(struct vm86_regs *r) -{ - fprintf(stderr, - "EAX=%08lx EBX=%08lx ECX=%08lx EDX=%08lx\n" - "ESI=%08lx EDI=%08lx EBP=%08lx ESP=%08lx\n" - "EIP=%08lx EFL=%08lx\n" - "CS=%04x DS=%04x ES=%04x SS=%04x FS=%04x GS=%04x\n", - r->eax, r->ebx, r->ecx, r->edx, r->esi, r->edi, r->ebp, r->esp, - r->eip, r->eflags, - r->cs, r->ds, r->es, r->ss, r->fs, r->gs); -} - -#ifdef SIGTEST -void alarm_handler(int sig) -{ - fprintf(stderr, "alarm signal=%d\n", sig); - alarm(1); -} -#endif - -int main(int argc, char **argv) -{ - uint8_t *vm86_mem; - const char *filename; - int fd, ret, seg; - struct vm86plus_struct ctx; - struct vm86_regs *r; - - if (argc != 2) - usage(); - filename = argv[1]; - - vm86_mem = mmap((void *)0x00000000, 0x110000, - PROT_WRITE | PROT_READ | PROT_EXEC, - MAP_FIXED | MAP_ANON | MAP_PRIVATE, -1, 0); - if (vm86_mem == MAP_FAILED) { - perror("mmap"); - exit(1); - } -#ifdef SIGTEST - { - struct sigaction act; - - act.sa_handler = alarm_handler; - sigemptyset(&act.sa_mask); - act.sa_flags = 0; - sigaction(SIGALRM, &act, NULL); - alarm(1); - } -#endif - - /* load the MSDOS .com executable */ - fd = open(filename, O_RDONLY); - if (fd < 0) { - perror(filename); - exit(1); - } - ret = read(fd, vm86_mem + COM_BASE_ADDR, 65536 - 256); - if (ret < 0) { - perror("read"); - exit(1); - } - close(fd); - - memset(&ctx, 0, sizeof(ctx)); - /* init basic registers */ - r = &ctx.regs; - r->eip = 0x100; - r->esp = 0xfffe; - seg = (COM_BASE_ADDR - 0x100) >> 4; - r->cs = seg; - r->ss = seg; - r->ds = seg; - r->es = seg; - r->fs = seg; - r->gs = seg; - r->eflags = VIF_MASK; - - /* put return code */ - set_bit((uint8_t *)&ctx.int_revectored, 0x21); - *seg_to_linear(r->cs, 0) = 0xb4; /* mov ah, $0 */ - *seg_to_linear(r->cs, 1) = 0x00; - *seg_to_linear(r->cs, 2) = 0xcd; /* int $0x21 */ - *seg_to_linear(r->cs, 3) = 0x21; - pushw(&ctx.regs, 0x0000); - - /* the value of these registers seem to be assumed by pi_10.com */ - r->esi = 0x100; - r->ecx = 0xff; - r->ebp = 0x0900; - r->edi = 0xfffe; - - for(;;) { - ret = vm86(VM86_ENTER, &ctx); - switch(VM86_TYPE(ret)) { - case VM86_INTx: - { - int int_num, ah; - - int_num = VM86_ARG(ret); - if (int_num != 0x21) - goto unknown_int; - ah = (r->eax >> 8) & 0xff; - switch(ah) { - case 0x00: /* exit */ - exit(0); - case 0x02: /* write char */ - { - uint8_t c = r->edx; - write(1, &c, 1); - } - break; - case 0x09: /* write string */ - { - uint8_t c; - for(;;) { - c = *seg_to_linear(r->ds, r->edx); - if (c == '$') - break; - write(1, &c, 1); - } - r->eax = (r->eax & ~0xff) | '$'; - } - break; - default: - unknown_int: - fprintf(stderr, "unsupported int 0x%02x\n", int_num); - dump_regs(&ctx.regs); - // exit(1); - } - } - break; - case VM86_SIGNAL: - /* a signal came, we just ignore that */ - break; - case VM86_STI: - break; - default: - fprintf(stderr, "unhandled vm86 return code (0x%x)\n", ret); - dump_regs(&ctx.regs); - exit(1); - } - } -}