arch/mips/fw/arc/cmdline.c

Source file repositories/reference/linux-study-clean/arch/mips/fw/arc/cmdline.c

File Facts

System
Linux kernel
Corpus path
arch/mips/fw/arc/cmdline.c
Extension
.c
Size
2371 bytes
Lines
115
Domain
Architecture Layer
Bucket
arch/mips
Inferred role
Architecture Layer: implementation source
Status
source implementation candidate

Why This File Exists

CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.

Dependency Surface

Detected Declarations

Annotated Snippet

if (!strncmp(prom_argv(actr), used_arc[i][0], len)) {
			/* Ok, we want it. First append the replacement... */
				strcat(cp, used_arc[i][1]);
				cp += strlen(used_arc[i][1]);
				/* ... and now the argument */
				s = strchr(prom_argv(actr), '=');
				if (s) {
					s++;
					len = strlen(s);
					memcpy(cp, s, len + 1);
					cp += len;
				}
				*cp++ = ' ';
				break;
			}
		}
		actr++;
	}

	return cp;
}

void __init prom_init_cmdline(int argc, LONG *argv)
{
	char *cp;
	int actr, i;
	size_t len;

	actr = 1; /* Always ignore argv[0] */

	cp = arcs_cmdline;
	/*
	 * Move ARC variables to the beginning to make sure they can be
	 * overridden by later arguments.
	 */
	cp = move_firmware_args(argc, argv, cp);

	while (actr < argc) {
		for (i = 0; i < ARRAY_SIZE(ignored); i++) {
			len = strlen(ignored[i]);
			if (!strncmp(prom_argv(actr), ignored[i], len))
				goto pic_cont;
		}

		/* Ok, we want it. */
		len = strlen(prom_argv(actr));
		memcpy(cp, prom_argv(actr), len + 1);
		cp += len;
		*cp++ = ' ';

	pic_cont:
		actr++;
	}

	if (cp != arcs_cmdline)		/* get rid of trailing space */
		--cp;
	*cp = '\0';

#ifdef DEBUG_CMDLINE
	pr_debug("prom cmdline: %s\n", arcs_cmdline);
#endif
}

Annotation

Implementation Notes