1#include "asm_i386.h" 2 3.data 4fpenv: .long 0, 0, 0, 0, 0, 0, 0, 0 5 6.text 7.globl C(StartMSRInterval) 8C(StartMSRInterval): 9 movl $0x11,%ecx // read the CESR 10 .byte 0x0F 11 .byte 0x32 // RDMSR 12 13 andl $0xFE3FFE3F,%eax // stop both counters 14 .byte 0x0F 15 .byte 0x30 // WRMSR 16 17 movl 4(%esp),%eax // point counter 0 to desired event, with counters 18 andl $0x3F,%eax // still stopped 19 movl $0x11,%ecx 20 .byte 0x0F 21 .byte 0x30 // WRMSR 22 23 movl $0x12,%ecx // set counter 0 to the value 0 24 subl %eax,%eax 25 subl %edx,%edx 26 .byte 0x0F 27 .byte 0x30 // WRMSR 28 29 movl 4(%esp),%eax // restart counter 0 with selected event 30 andl $0x3F,%eax 31 subl %edx,%edx 32 orl $0xC0,%eax 33 movl $0x11,%ecx // control and event select 34 .byte 0x0F 35 .byte 0x30 // WRMSR 36 37 ret 38 39.globl C(EndMSRInterval) 40C(EndMSRInterval): 41 movl $0x12,%ecx // counter 0 42 .byte 0x0F 43 .byte 0x32 // RDMSR 44 45 ret // lower 32 bits of count in %eax 46 47#if 0 48 .data 49Lxxx: .long 0 50 51 .text 52 53.globl C(setstackcheck) 54C(setstackcheck): 55 56 movl %esp,%eax 57 subl $0x38000,%eax 58 movl $0x5A5A5A5A,(%eax) 59 movl %eax,Lxxx 60 61 ret 62 63 64.globl C(dostackcheck) 65C(dostackcheck): 66 67 movl Lxxx,%edx 68 movl $0,%eax 69 70 cmpl $0x5A5A5A5A,(%edx) 71 jz qqq 72 incl %eax 73qqq: 74 75 ret 76#endif 77 78