shithub: 9scripts

ref: 05e86b0d7ecd19bd1c3190a58fecea98b01d4d7c
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
}