1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
%{
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef __cplusplus
extern "C" {
int yylex(void);
}
#endif
#include "igdbg.yacc.h"
#undef YY_INPUT
#define YY_INPUT(b,r,ms) (r = my_yyinput(b,ms))
#define min(a,b) ((a)>(b)?b:a)
extern YYSTYPE yylval;
extern char *cmd_buf,*cmd_ptr,*cmd_end;
static int my_yyinput(char *buf, int max_size);
%}
%%
[\t ] ; /* ignore whitespace */
\n ; /* ignore enter */
exit |
quit |
help |
verbose |
dumppci |
pipe |
plane |
port |
fifo |
overlay |
onscreen |
fence |
stolen { yylval.string=strdup(yytext); return CMDHDR0; }
regread |
irq |
estatus |
cstatus |
dumppgtt |
dumpstat |
inl { yylval.string=strdup(yytext); return CMDHDR1; }
kkflip |
regwrite |
dumpcmd |
dumpgtt |
dumpfb |
dumpfbl |
msgread { yylval.string=strdup(yytext); return CMDHDR2; }
fillfb |
fillfbl |
dumpring |
msgwrite { yylval.string=strdup(yytext); return CMDHDR3; }
pciread { yylval.string=strdup(yytext); return CMDHDR4; }
pciwrite { yylval.string=strdup(yytext); return CMDHDR5; }
[A-Za-z_][A-Za-z0-9_\.]* |
\.[A-Za-z_0-9][A-Za-z0-9_\.]* { yylval.string=strdup(yytext); return FILENAME; }
([0-9]+)|(0x[a-fA-F0-9]+) { yylval.expr = strtoul(yytext,NULL,0);return NUMBER;}
\<\< return LSHIFT;
\>\> return RSHIFT;
. return *yytext;
%%
static int my_yyinput(char *buf, int max_size)
{
int n = min(max_size, cmd_end - cmd_ptr);
if (n>0) {
memcpy(buf,cmd_ptr,n);
cmd_ptr += n;
}
return n;
}
|