summaryrefslogtreecommitdiff
path: root/common/hush.c
diff options
context:
space:
mode:
authorwdenk <wdenk>2003-04-05 00:53:31 +0000
committerwdenk <wdenk>2003-04-05 00:53:31 +0000
commit3e38691e8f7aa0d9b498d76c7279ddec6e4946f3 (patch)
treebec2e661298847dc5bcf9335ef31259686e882e1 /common/hush.c
parent36c05a80ecbe3997abd9aa628a68dd6c0bacf681 (diff)
downloadu-boot-imx-3e38691e8f7aa0d9b498d76c7279ddec6e4946f3.zip
u-boot-imx-3e38691e8f7aa0d9b498d76c7279ddec6e4946f3.tar.gz
u-boot-imx-3e38691e8f7aa0d9b498d76c7279ddec6e4946f3.tar.bz2
* Patch by Arun Dharankar, 4 Apr 2003:
Add IDMA example code (tested on 8260 only) * Add support for Purple Board (MIPS64 5Kc) * Add support for MIPS64 5Kc CPUs * Fix missing setting of "loadaddr" and "bootfile" on ARM and MIPS * Patch by Denis Peter, 04 Apr 2003: - update MIP405-4 board * Patches by Denis Peter, 03 April 2003: - fix PCI IRQs on MPL boards - fix two more un-relocated pointer problems * Fix behaviour of "run" command: - print error message iv variable does not exist - terminate processing of arguments in case of error * Patches by Peter Figuli, 10 Mar 2003 - Add support for BTUART on PXA platform - Add support for WEP EP250 (PXA) board * Fix flash problems on INCA-IP; add tool to allow bruning images to flash using a BDI2000 * Implement fix for I2C Edge Conditions problem for all boards that use the bit-banging driver (common/soft_i2c.c) * Add patches by Robert Schwebel, 31 Mar 2003: - csb226 board: bring in sync with innokom/memsetup.S - csb226 board: fix MDREFR handling - misc doc fixes / extensions - innokom board: cleanup, MDREFR fix in memsetup.S, config update - add BOOT_PROGRESS to armlinux.c
Diffstat (limited to 'common/hush.c')
-rw-r--r--common/hush.c62
1 files changed, 38 insertions, 24 deletions
diff --git a/common/hush.c b/common/hush.c
index fcc3559..1993398 100644
--- a/common/hush.c
+++ b/common/hush.c
@@ -2357,34 +2357,35 @@ static void initialize_context(struct p_context *ctx)
* should handle if, then, elif, else, fi, for, while, until, do, done.
* case, function, and select are obnoxious, save those for later.
*/
+struct reserved_combo {
+ char *literal;
+ int code;
+ long flag;
+};
+/* Mostly a list of accepted follow-up reserved words.
+ * FLAG_END means we are done with the sequence, and are ready
+ * to turn the compound list into a command.
+ * FLAG_START means the word must start a new compound list.
+ */
+static struct reserved_combo reserved_list[] = {
+ { "if", RES_IF, FLAG_THEN | FLAG_START },
+ { "then", RES_THEN, FLAG_ELIF | FLAG_ELSE | FLAG_FI },
+ { "elif", RES_ELIF, FLAG_THEN },
+ { "else", RES_ELSE, FLAG_FI },
+ { "fi", RES_FI, FLAG_END },
+ { "for", RES_FOR, FLAG_IN | FLAG_START },
+ { "while", RES_WHILE, FLAG_DO | FLAG_START },
+ { "until", RES_UNTIL, FLAG_DO | FLAG_START },
+ { "in", RES_IN, FLAG_DO },
+ { "do", RES_DO, FLAG_DONE },
+ { "done", RES_DONE, FLAG_END }
+};
+#define NRES (sizeof(reserved_list)/sizeof(struct reserved_combo))
+
int reserved_word(o_string *dest, struct p_context *ctx)
{
- struct reserved_combo {
- char *literal;
- int code;
- long flag;
- };
- /* Mostly a list of accepted follow-up reserved words.
- * FLAG_END means we are done with the sequence, and are ready
- * to turn the compound list into a command.
- * FLAG_START means the word must start a new compound list.
- */
- static struct reserved_combo reserved_list[] = {
- { "if", RES_IF, FLAG_THEN | FLAG_START },
- { "then", RES_THEN, FLAG_ELIF | FLAG_ELSE | FLAG_FI },
- { "elif", RES_ELIF, FLAG_THEN },
- { "else", RES_ELSE, FLAG_FI },
- { "fi", RES_FI, FLAG_END },
- { "for", RES_FOR, FLAG_IN | FLAG_START },
- { "while", RES_WHILE, FLAG_DO | FLAG_START },
- { "until", RES_UNTIL, FLAG_DO | FLAG_START },
- { "in", RES_IN, FLAG_DO },
- { "do", RES_DO, FLAG_DONE },
- { "done", RES_DONE, FLAG_END }
- };
struct reserved_combo *r;
for (r=reserved_list;
-#define NRES sizeof(reserved_list)/sizeof(struct reserved_combo)
r<reserved_list+NRES; r++) {
if (strcmp(dest->data, r->literal) == 0) {
debug_printf("found reserved word %s, code %d\n",r->literal,r->code);
@@ -3169,6 +3170,18 @@ int parse_file_outer(void)
}
#ifdef __U_BOOT__
+static void u_boot_hush_reloc(void)
+{
+ DECLARE_GLOBAL_DATA_PTR;
+ unsigned long addr;
+ struct reserved_combo *r;
+
+ for (r=reserved_list; r<reserved_list+NRES; r++) {
+ addr = (ulong) (r->literal) + gd->reloc_off;
+ r->literal = (char *)addr;
+ }
+}
+
int u_boot_hush_start(void)
{
top_vars = malloc(sizeof(struct variables));
@@ -3177,6 +3190,7 @@ int u_boot_hush_start(void)
top_vars->next = 0;
top_vars->flg_export = 0;
top_vars->flg_read_only = 1;
+ u_boot_hush_reloc();
return 0;
}