shithub: 9scripts

ref: 7923e9afe0182b0a723e80f93b0eec30020549ca
dir: /util/fscale/

View raw version
#!/bin/rc
# by mischief

fn x86_speed {
	if(! io -wM 0x19A $1 >[2]/dev/null){
		echo unsupported processor
		exit unsupported
	}
}

fn x86_slow {
	x86_speed 0x12
}

fn x86_fast {
	x86_speed 0x0
}

arch=()

switch $objtype {
case 386 amd64
	arch=x86
case *
	echo unsupported architecture
	exit unsupported
}

switch $1 {
case off
	$arch^_slow
case on
	$arch^_fast
case *
	echo invalid mode
	exit invalid
}