shithub: bench9

ref: 05188cb08b4304e34a7d822bb0f80ef5b780aa72
dir: /b_386.s/

View raw version
#define RDTSCP WORD $0x010F; BYTE $0xF9
#define RDTSC  WORD $0x310F

TEXT tstart(SB), 1, $0
	CPUID
	RDTSC
	MOVL c+0(FP), CX
	MOVL AX, 0(CX)
	MOVL DX, 4(CX)
	RET

TEXT _tend(SB), 1, $0
	RDTSC
	MOVL c+0(FP), CX
	MOVL AX, 0(CX)
	MOVL DX, 4(CX)
	CPUID
	RET

TEXT _tendp(SB), 1, $0
	RDTSCP
	MOVL c+0(FP), CX
	MOVL AX, 0(CX)
	MOVL DX, 4(CX)
	CPUID
	RET

TEXT cpuid(SB), 1, $0
	MOVL rep+0(FP), BP
	MOVL ax+4(FP), AX
	MOVL cx+8(FP), CX
	CPUID
	MOVL AX, 0(BP)
	MOVL BX, 4(BP)
	MOVL CX, 8(BP)
	MOVL DX, 12(BP)
	RET