RTEMS Logo

RTEMS 4.9.4 On-Line Library


Memory Commands mfill - file memory with pattern

PREV UP NEXT Bookshelf RTEMS Shell User's Guide

4.2.4: mfill - file memory with pattern

SYNOPSYS:

mfill address length value

DESCRIPTION:

This command is used to fill the memory starting at address for the specified length in octets when the specified at value.

EXIT STATUS:

This command returns 0 on success and non-zero if an error is encountered.

NOTES:

Filling a non-existent address range may result in an unrecoverable program fault. Similarly overwriting interrupt vector tables, code space or critical data areas can be fatal as shown in the example.

EXAMPLES:

In this example, the address used (0x23d89a0) as the base address of the filled area is the end of the stack for the Idle thread. This address was determined manually using gdb and is very specific to this application and BSP. The first command in this example is an mdump to display the initial contents of this memory. We see that the first 8 bytes are 0xA5 which is the pattern used as a guard by the Stack Checker. On the first context switch after the pattern is overwritten by the mfill command, the Stack Checker detect the pattern has been corrupted and generates a fatal error.

SHLL [/] $ mdump 0x23d89a0 16
0x023D89A0 A5 A5 A5 A5 A5 A5 A5 A5-FE ED F0 0D 0B AD 0D 06 ................
SHLL [/] $ mfill 0x23d89a0 13 0x5a
SHLL [/] $ BLOWN STACK!!! Offending task(0x23D4418): id=0x09010001; name=0x0203D908
  stack covers range 0x23D89A0 - 0x23D99AF (4112 bytes)
  Damaged pattern begins at 0x023D89A8 and is 16 bytes long

CONFIGURATION:

This command is included in the default shell command set. When building a custom command set, define CONFIGURE_SHELL_COMMAND_MFILL to have this command included.

This command can be excluded from the shell command set by defining CONFIGURE_SHELL_NO_COMMAND_MFILL when all shell commands have been configured.

PROGRAMMING INFORMATION:

The mfill is implemented by a C language function which has the following prototype:

int rtems_shell_rtems_main_mfill(
  int    argc,
  char **argv
);

The configuration structure for the mfill has the following prototype:

extern rtems_shell_cmd_t rtems_shell_MFILL_Command;


PREV UP NEXT Bookshelf RTEMS Shell User's Guide

Copyright © 1988-2008 OAR Corporation