Darren J Moffat wrote: > Christian Kaiser wrote: >> Hi all, >> >> I am wondering how I can find out the physical memory size in kernel >> space? > > Why do you want to do that in a driver ? I'm assuming from the past > questions from Dolphinics this is still about driver development. > > There is no guarantee that this stays they same and could change just > after you have looked at it. I'm also very nervous about any driver > that makes any assumptions based on the size of memory. > >> We have a device driver running on Linux that does the following: >> >> #define DX_TOTALRAM (((U64)num_physpages) << PAGE_SHIFT) >> > >> Can you tell me if there is something similar to 'num_physpages' on >> Solaris? PAGE_SHIFT is used to find out the page size. I should use >> 'ptob(1)' to get the page size, shouldn't I? > > physmem might be the symbol you are looking for. > > That is ptob(9F) of course, running a ptob command inside the kernel > would be tricky :-) But physmem already is the size in bytes. If you > want it in pages use btop(9F). Also you probably should use the > ddi_ptob(9F)/ddi_btop(9F) versions.
It seems that physmem is the size in pages and not in bytes. extern pgcnt_t physmem; /* physical memory (pages) on this CPU */ source: http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/sys/systm.h#74 But with the use of ptob(9F) this is very quickly converted to bytes. Thank you! Christian -- Christian Kaiser, Software Engineer, Dolphin Interconnect Solutions http//www.dolphinics.com _______________________________________________ opensolaris-code mailing list [email protected] http://mail.opensolaris.org/mailman/listinfo/opensolaris-code
