From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id bhErE959FWDMSQAAWB0awg (envelope-from ) for ; Sat, 30 Jan 2021 10:40:14 -0500 Received: by simark.ca (Postfix, from userid 112) id 4055E1EF80; Sat, 30 Jan 2021 10:40:14 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 545BB1E590 for ; Sat, 30 Jan 2021 10:40:13 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3CED1386F03E; Sat, 30 Jan 2021 15:40:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3CED1386F03E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1612021212; bh=zAYvIeqGuxeP6wCX1vHmV3xDpbgOqOwjlGM4mtdRjTY=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=r0DSdK3AmvFC3HlHZBesNULWuFtp47v0AUl2dzdHFoYSYzmhXaFJHvPO5Sd+wOxE5 +oVD5TgR51r/PyUnv94UujIr+wmv16AG8qh6rS1vy3OZ+IbZ4JS2El7Y9TE+5hwDQK 9KxVn3nrr0zoarqOgCa26uxJmoIgWVHOqsqeWsTw= Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) by sourceware.org (Postfix) with ESMTP id 4804E3857814 for ; Sat, 30 Jan 2021 15:40:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4804E3857814 Received: from vapier (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 6D6D8340917; Sat, 30 Jan 2021 15:40:08 +0000 (UTC) Date: Sat, 30 Jan 2021 10:40:08 -0500 To: andrew.burgess@embecosm.com Subject: weird m68hc11 emulos sim code Message-ID: Mail-Followup-To: andrew.burgess@embecosm.com, gdb@sourceware.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Mike Frysinger via Gdb Reply-To: Mike Frysinger Cc: gdb@sourceware.org Errors-To: gdb-bounces@sourceware.org Sender: "Gdb" it looks like this came in via the initial port back in 2000. i'm not familiar with this target or emulos, so hopefully you can explain it as you were the author :). sim/m68hc11/emulos.c: // This is called by M6811_EMUL_SYSCALL. void emul_os (int code, sim_cpu *cpu) { cpu->cpu_current_cycle = 8; switch (code) { /* 0xCD 0x01 */ case 0x01: emul_write (cpu); break; ... static void emul_write (sim_cpu *cpu) { int addr = cpu_get_x (cpu) & 0x0FFFF; int size = cpu_get_d (cpu) & 0x0FFFF; if (addr + size > 0x0FFFF) { size = 0x0FFFF - addr; } cpu->cpu_running = 0; while (size) { uint8 val = memory_read8 (cpu, addr); write(0, &val, 1); addr ++; size--; } } it's writing to fd 0 which is stdin. is that correct ? was this meant to write to stdout as a sort of debug syscall ? -mike