From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 From: Mike Frysinger To: andrew.burgess@embecosm.com Cc: gdb@sourceware.org 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-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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: , X-List-Received-Date: Sat, 30 Jan 2021 15:40:11 -0000 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