require '_h2ph_pre.ph';

no warnings qw(redefine misc);

if(!defined(&_SYS_LWPCTL_H_)) {
    eval 'sub _SYS_LWPCTL_H_ () {1;}' unless defined(&_SYS_LWPCTL_H_);
    eval 'sub LWPCTL_CPU_NONE () {(-1);}' unless defined(&LWPCTL_CPU_NONE);
    eval 'sub LWPCTL_CPU_EXITED () {(-2);}' unless defined(&LWPCTL_CPU_EXITED);
    eval 'sub LWPCTL_FEATURE_CURCPU () {0x1;}' unless defined(&LWPCTL_FEATURE_CURCPU);
    eval 'sub LWPCTL_FEATURE_PCTR () {0x2;}' unless defined(&LWPCTL_FEATURE_PCTR);
    if(defined(&_KERNEL)) {
	require 'sys/mutex.ph';
	require 'uvm/uvm_extern.ph';
	eval 'sub LWPCTL_PER_PAGE () {(( &PAGE_SIZE / $sizeof{ &lwpctl_t}) & ~31);}' unless defined(&LWPCTL_PER_PAGE);
	eval 'sub LWPCTL_BITMAP_ENTRIES () {( &LWPCTL_PER_PAGE >> 5);}' unless defined(&LWPCTL_BITMAP_ENTRIES);
	eval 'sub LWPCTL_BITMAP_SZ () {( &LWPCTL_BITMAP_ENTRIES * $sizeof{\'u_int\'});}' unless defined(&LWPCTL_BITMAP_SZ);
	eval 'sub LWPCTL_LCPAGE_SZ () {($sizeof{ &lcpage_t} - $sizeof{\'u_int\'} +  &LWPCTL_BITMAP_SZ);}' unless defined(&LWPCTL_LCPAGE_SZ);
	eval 'sub LWPCTL_UAREA_SZ () {( &round_page( &MAX_LWP_PER_PROC * $sizeof{ &lwpctl_t}));}' unless defined(&LWPCTL_UAREA_SZ);
    }
}
1;
