qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] TARGET_PAGE_BITS
@ 2017-05-22 12:54 ali saeedi
  2017-05-22 13:10 ` Thomas Huth
  0 siblings, 1 reply; 6+ messages in thread
From: ali saeedi @ 2017-05-22 12:54 UTC (permalink / raw)
  To: qemu-devel

Hello
What is TARGET_PAGE_BITS in ram.c?
thanks a lot

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

* Re: [Qemu-devel] TARGET_PAGE_BITS
  2017-05-22 12:54 [Qemu-devel] TARGET_PAGE_BITS ali saeedi
@ 2017-05-22 13:10 ` Thomas Huth
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Huth @ 2017-05-22 13:10 UTC (permalink / raw)
  To: qemu-devel

On 22.05.2017 14:54, ali saeedi wrote:
> Hello
> What is TARGET_PAGE_BITS in ram.c?

12, on average, see:

grep TARGET_PAGE_BITS target/*/cpu.h

> thanks a lot

You're welcome.

 Thomas

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

* [Qemu-devel] TARGET_PAGE_BITS
@ 2017-06-23 14:13 ali saeedi
  2017-06-23 14:41 ` Alex Bennée
  0 siblings, 1 reply; 6+ messages in thread
From: ali saeedi @ 2017-06-23 14:13 UTC (permalink / raw)
  To: qemu-devel

Hello
What does TARGET_PAGE_BITS mean in qemu code?
thanks a lot

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

* Re: [Qemu-devel] TARGET_PAGE_BITS
  2017-06-23 14:13 ali saeedi
@ 2017-06-23 14:41 ` Alex Bennée
  2017-06-23 15:02   ` ali saeedi
  0 siblings, 1 reply; 6+ messages in thread
From: Alex Bennée @ 2017-06-23 14:41 UTC (permalink / raw)
  To: ali saeedi; +Cc: qemu-devel


ali saeedi <ali.saeedi56@gmail.com> writes:

> Hello
> What does TARGET_PAGE_BITS mean in qemu code?

It's the page size of the target. e.g.

  TARGET_PAGE_BITS 12

  1 << 12 = 4096 = 4k pages


> thanks a lot


--
Alex Bennée

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

* Re: [Qemu-devel] TARGET_PAGE_BITS
  2017-06-23 14:41 ` Alex Bennée
@ 2017-06-23 15:02   ` ali saeedi
  2017-06-23 15:06     ` Peter Maydell
  0 siblings, 1 reply; 6+ messages in thread
From: ali saeedi @ 2017-06-23 15:02 UTC (permalink / raw)
  To: Alex Bennée; +Cc: qemu-devel

thank you for answer
So. why do we have right shift in qemu by "TARGET_PAGE_BITS" ? for exampe
in below code, what does it mean?

static inline void cpu_physical_memory_set_dirty_range(ram_addr_t start,
                                                       ram_addr_t length)
{
    unsigned long end, page;

    end = TARGET_PAGE_ALIGN(start + length) >> TARGET_PAGE_BITS;
    page = start >> TARGET_PAGE_BITS;
...
}
thanks a lot

On Fri, Jun 23, 2017 at 7:11 PM, Alex Bennée <alex.bennee@linaro.org> wrote:

>
> ali saeedi <ali.saeedi56@gmail.com> writes:
>
> > Hello
> > What does TARGET_PAGE_BITS mean in qemu code?
>
> It's the page size of the target. e.g.
>
>   TARGET_PAGE_BITS 12
>
>   1 << 12 = 4096 = 4k pages
>
>
> > thanks a lot
>
>
> --
> Alex Bennée
>

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

* Re: [Qemu-devel] TARGET_PAGE_BITS
  2017-06-23 15:02   ` ali saeedi
@ 2017-06-23 15:06     ` Peter Maydell
  0 siblings, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2017-06-23 15:06 UTC (permalink / raw)
  To: ali saeedi; +Cc: Alex Bennée, QEMU Developers

On 23 June 2017 at 16:02, ali saeedi <ali.saeedi56@gmail.com> wrote:
> thank you for answer
> So. why do we have right shift in qemu by "TARGET_PAGE_BITS" ? for exampe
> in below code, what does it mean?
>
> static inline void cpu_physical_memory_set_dirty_range(ram_addr_t start,
>                                                        ram_addr_t length)
> {
>     unsigned long end, page;
>
>     end = TARGET_PAGE_ALIGN(start + length) >> TARGET_PAGE_BITS;
>     page = start >> TARGET_PAGE_BITS;
> ...
> }

If you take an address, and you shift it right by the number
of bits in a page, you get a page number...

thanks
-- PMM

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

end of thread, other threads:[~2017-06-23 15:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-22 12:54 [Qemu-devel] TARGET_PAGE_BITS ali saeedi
2017-05-22 13:10 ` Thomas Huth
  -- strict thread matches above, loose matches on Subject: below --
2017-06-23 14:13 ali saeedi
2017-06-23 14:41 ` Alex Bennée
2017-06-23 15:02   ` ali saeedi
2017-06-23 15:06     ` Peter Maydell

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 NNTP newsgroup(s).