All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] Emulating external registers
@ 2017-04-05 21:03 Wu, Michael Y [US] (MS)
  2017-04-06  8:32 ` Peter Maydell
  0 siblings, 1 reply; 5+ messages in thread
From: Wu, Michael Y [US] (MS) @ 2017-04-05 21:03 UTC (permalink / raw)
  To: qemu-devel

Hi,

I've been doing some bare metal programming using the powerpc system emulator. I was able to run some of my code using the g3beige system emulation. I am now currently trying emulate some external registers. Simply a powerpc address will be mapped to a register. My plan is to write a bare metal  C program that will access the contents of a given powerpc address via pointers.

My current approach is to create a new MemoryRegion in the init function of the g3beige source code (mac_oldworld.c). My idea is to set up some mmio to certain address to represent those registers. For now I only care about reading and writing, but in the future I hope to add additional logic when the registers are written.
I added the following lines:
MemoryRegion *reg = g_new(MemoryRegion, 1);
memory_region_init_alias(reg, NULL, "reg_mmio",
                            get_system_io(), 0, 0x00200000);
memory_region_add_subregion(sysmem, 0xfc000000, reg);

In my bare metal program I used the following lines to see  if it works using GDB. The issue is that GDB hangs when the pointer is either read or written. This makes me think I am doing something incorrectly.
volatile unsigned int  * const test = (unsigned int *) 0xFC000000;
  *test = 5640;

  //read from register to confirm
  if (5640 == *test) //seems to pause as well...
  {
    breakpoint_hit();
  }

I have very little limited experience with emulators so I thought I would ask to see if anyone has tips or suggestions.

Thanks!

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-04-12 18:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-05 21:03 [Qemu-devel] Emulating external registers Wu, Michael Y [US] (MS)
2017-04-06  8:32 ` Peter Maydell
2017-04-06 17:23   ` [Qemu-devel] EXT :Re: " Wu, Michael Y [US] (MS)
2017-04-06 17:37     ` Peter Maydell
2017-04-12 18:44       ` Wu, Michael Y [US] (MS)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.