Skip to contentSkip to conversation

Which functions writes to memory?

Qemu-devel Jun Koi 2 participants 6 messages Apr 16, 2010

lore
Share & tools
lore

Jun Koi

author
#0 lore raw

Hi,

I am writing a small tool to trace all the activities that write to an area of (virtual) memory in Qemu.
I am currently doing that by putting my code at the top of the below macro in softmmu_header.h

static inline void glue(glue(st, SUFFIX), MEMSUFFIX)....

However, it seems I still miss some written events: in some occasions, I believe that Qemu has another code writing data to memory, which happens even before this macro.
Is it true that elsewhere, Qemu also writes into memory besides using above function?

The memory area I am tracking for written events belong to normal area in OS kernel, where usually only normal code (kernel, not something like SMM handler) write to.

Thanks a lot,
Jun

#1 lore raw
Quoted 15 lines · Jun Koi

Hi,

I am writing a small tool to trace all the activities that write to an area of (virtual) memory in Qemu.
I am currently doing that by putting my code at the top of the below macro in softmmu_header.h

static inline void glue(glue(st, SUFFIX), MEMSUFFIX)....

However, it seems I still miss some written events: in some occasions, I believe that Qemu has another code writing data to memory, which happens even before this macro.
Is it true that elsewhere, Qemu also writes into memory besides using above function?

Quoted 3 lines

The memory area I am tracking for written events belong to normal area in OS kernel, where usually only normal code (kernel, not something like SMM handler) write to.

Once the TLB is properly set up st helpers are bypassed entirely and tcg generated code writes to it directly, it's quite easy to "workaround" that at the expense of much slower execution.

Signature · 1 line
mailto:[email protected]
author
#2 lore raw
Quoted 17 lines · malc
Quoted 15 lines · Jun Koi

Hi,

I am writing a small tool to trace all the activities that write to an area of (virtual) memory in Qemu.
I am currently doing that by putting my code at the top of the below macro in softmmu_header.h

static inline void glue(glue(st, SUFFIX), MEMSUFFIX)....

However, it seems I still miss some written events: in some occasions, I believe that Qemu has another code writing data to memory, which happens even before this macro.
Is it true that elsewhere, Qemu also writes into memory besides using above function?

Quoted 8 lines
Quoted 3 lines

The memory area I am tracking for written events belong to normal area in OS kernel, where usually only normal code (kernel, not something like SMM handler)  write to.

Once the TLB is properly set up st helpers are bypassed entirely and tcg generated code writes to it directly, it's quite easy to "workaround" that at the expense of much slower execution.

This saves me a lot of frustrated time, thanks!

Now I can see that tcg code calls to __stb*_mmu(), but cannot find any code call to st*_mmu().
Do you have any hint?

Thanks a lot,
J

#3 lore raw
Quoted 27 lines · Jun Koi
Quoted 17 lines · malc
Quoted 15 lines · Jun Koi

Hi,

I am writing a small tool to trace all the activities that write to an area of (virtual) memory in Qemu.
I am currently doing that by putting my code at the top of the below macro in softmmu_header.h

static inline void glue(glue(st, SUFFIX), MEMSUFFIX)....

However, it seems I still miss some written events: in some occasions, I believe that Qemu has another code writing data to memory, which happens even before this macro.
Is it true that elsewhere, Qemu also writes into memory besides using above function?

Quoted 8 lines
Quoted 3 lines

The memory area I am tracking for written events belong to normal area in OS kernel, where usually only normal code (kernel, not something like SMM handler)  write to.

Once the TLB is properly set up st helpers are bypassed entirely and tcg generated code writes to it directly, it's quite easy to "workaround" that at the expense of much slower execution.

Quoted 5 lines

This saves me a lot of frustrated time, thanks!

Now I can see that tcg code calls to __stb*_mmu(), but cannot find any code call to st*_mmu().
Do you have any hint?

The tcg generated code fetches appropriate helper's address from the qemu_st/ld_helpers array and calls it indirectly.

Signature · 1 line
mailto:[email protected]
author
#4 lore raw

2010/4/16 malc <[email protected]>:

Quoted 29 lines · Jun Koi
Quoted 28 lines · malc
Quoted 25 lines · Jun Koi
Quoted 16 lines

Hi,

I am writing a small tool to trace all the activities that write to an area of (virtual) memory in Qemu.
I am currently doing that by putting my code at the top of the below macro in softmmu_header.h

static inline void glue(glue(st, SUFFIX), MEMSUFFIX)....

However, it seems I still miss some written events: in some occasions, I believe that Qemu has another code writing data to memory, which happens even before this macro.
Is it true that elsewhere, Qemu also writes into memory besides using above function?

Quoted 3 lines

The memory area I am tracking for written events belong to normal area in OS kernel, where usually only normal code (kernel, not something like SMM handler)  write to.

Once the TLB is properly set up st helpers are bypassed entirely and tcg generated code writes to it directly, it's quite easy to "workaround" that at the expense of much slower execution.

Quoted 8 lines
Quoted 5 lines

This saves me a lot of frustrated time, thanks!

Now I can see that tcg code calls to __stb*_mmu(), but cannot find any code call to st*_mmu().
Do you have any hint?

The tcg generated code fetches appropriate helper's address from the qemu_st/ld_helpers array and calls it indirectly.

Sorry if that was not clear, but my question is: which code called st*mmu() macros (in softmmu_header.h)

I searched around everywhere, but dont see which calls these macros.

Thanks,
J

#5 lore raw
Quoted 36 lines · Jun Koi

2010/4/16 malc <[email protected]>:

Quoted 35 lines · Jun Koi
Quoted 33 lines · malc
Quoted 17 lines · Jun Koi
Quoted 16 lines

Hi,

I am writing a small tool to trace all the activities that write to an area of (virtual) memory in Qemu.
I am currently doing that by putting my code at the top of the below macro in softmmu_header.h

static inline void glue(glue(st, SUFFIX), MEMSUFFIX)....

However, it seems I still miss some written events: in some occasions, I believe that Qemu has another code writing data to memory, which happens even before this macro.
Is it true that elsewhere, Qemu also writes into memory besides using above function?

Quoted 8 lines
Quoted 3 lines

The memory area I am tracking for written events belong to normal area in OS kernel, where usually only normal code (kernel, not something like SMM handler)  write to.

Once the TLB is properly set up st helpers are bypassed entirely and tcg generated code writes to it directly, it's quite easy to "workaround" that at the expense of much slower execution.

This saves me a lot of frustrated time, thanks!

Now I can see that tcg code calls to __stb*_mmu(), but cannot find any code call to st*_mmu().
Do you have any hint?

Quoted 8 lines
Quoted 2 lines

The tcg generated code fetches appropriate helper's address from the qemu_st/ld_helpers array and calls it indirectly.

Sorry if that was not clear, but my question is: which code called st*mmu() macros (in softmmu_header.h)

I searched around everywhere, but dont see which calls these macros.

It's being called by automatically generated code, code generators for various platforms leave in tcg/platform/tcg-target.c

Signature · 1 line
mailto:[email protected]