diff options
author | David Gibson <dgibson@sneetch.(none)> | 2005-07-15 17:14:24 +1000 |
---|---|---|
committer | David Gibson <dgibson@sneetch.(none)> | 2005-07-15 17:14:24 +1000 |
commit | f0517db25008374955e1b09a140413d7e0f499c3 (patch) | |
tree | 4afdb633dbff1189b950b2c5ba633c23125a4ef5 /dtc-lexer.l | |
parent | 586606e35d1e72d3ee2073bca4247b340233af53 (diff) | |
download | dtc-f0517db25008374955e1b09a140413d7e0f499c3.tar.gz |
Support for specifying memreserve ranges in the source format, based on
a patch by Jon Loeliger <jdl AT freescale.com>, although tweaked
substantially.
Diffstat (limited to 'dtc-lexer.l')
-rw-r--r-- | dtc-lexer.l | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/dtc-lexer.l b/dtc-lexer.l index 0f94dfc..cd3229f 100644 --- a/dtc-lexer.l +++ b/dtc-lexer.l @@ -22,6 +22,7 @@ %x CELLDATA %x BYTESTRING +%x MEMRESERVE PROPCHAR [a-zA-Z0-9,._+*#?-] UNITCHAR [0-9a-f,] @@ -53,6 +54,29 @@ REFCHAR ({PROPCHAR}|{UNITCHAR}|[/@]) return DT_STRING; } +"/memreserve/" { + DPRINT("Keyword: /memreserve/\n"); + BEGIN(MEMRESERVE); + return DT_MEMRESERVE; + } + +<MEMRESERVE>[0-9a-fA-F]+ { + if (yyleng > 2*sizeof(yylval.addr)) { + fprintf(stderr, "Address value %s too large\n", + yytext); + } + yylval.addr = (u64) strtoull(yytext, NULL, 16); + DPRINT("Addr: %llx\n", + (unsigned long long)yylval.addr); + return DT_ADDR; + } + +<MEMRESERVE>";" { + DPRINT("/MEMRESERVE\n"); + BEGIN(INITIAL); + return ';'; + } + <CELLDATA>[0-9a-fA-F]+ { if (yyleng > 2*sizeof(yylval.cval)) { fprintf(stderr, @@ -116,7 +140,7 @@ REFCHAR ({PROPCHAR}|{UNITCHAR}|[/@]) <*>"//".*\n /* eat line comments */ -. { +<*>. { switch (yytext[0]) { case '<': DPRINT("CELLDATA\n"); |