From: Mike Frysinger <vapier@gentoo.org>
To: andrew.burgess@embecosm.com
Cc: gdb@sourceware.org
Subject: weird m68hc11 emulos sim code
Date: Sat, 30 Jan 2021 10:40:08 -0500 [thread overview]
Message-ID: <YBV92PFcGtHmWL7o@vapier> (raw)
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
reply other threads:[~2021-01-30 15:40 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YBV92PFcGtHmWL7o@vapier \
--to=vapier@gentoo.org \
--cc=andrew.burgess@embecosm.com \
--cc=gdb@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).