m, mw, md, mp, mpw, and mpd subcommands
The m (modify bytes), mw (modify words) and md (modify double words) subcommands modify memory starting at a specified effective address. The mp (modify bytes), mpw (modify words) and mpd (modify double words) subcommands modify memory starting at a specified real address.
These subcommands are only available within the KDB kernel debugger. They are not included in the kdb command.
Format
m effectiveaddress
mw effectiveaddress
md effectiveaddress
mp physicaladdress
mpw physicaladdress
mpd physicaladdress
Parameters
| Item | Description |
|---|---|
| effectiveaddress | Specifies the effective or virtual address of the starting memory area to modify. Symbols, hexadecimal values, or hexadecimal expressions can be used to specify the address. |
| physicaladdress | Specifies the physical or real address of the starting memory area to modify. Symbols, hexadecimal values, or hexadecimal expressions can be used to specify the address. |
Read or write access can be in virtual or real mode.
These subcommands are interactive. Each modification is entered one-by-one. The first unexpected input stops modification. For example, a period (.) can be used to indicate the end of the data. If a break point is set at the same address, use the mw subcommand to maintain break point coherency.
Other
No aliases.
Examples
The following is an example of how to use the mw and m subcommands to do a patch:
KDB(0)> dc @iar //print current instruction
.open+000000 mflr r0
KDB(0)> mw @iar //nop current instruction
.open+000000: 7C0802A6 = 60000000
.open+000004: 93E1FFFC = . //end of input
KDB(0)> dc @iar //print current instruction
.open+000000 ori r0,r0,0
KDB(0)> m @iar //restore current instruction byte per byte
.open+000000: 60 = 7C
.open+000001: 00 = 08
.open+000002: 00 = 02
.open+000003: 00 = A6
.open+000004: 93 = . //end of input
KDB(0)> dc @iar //print current instruction
.open+000000 mflr r0
KDB(0)> tr @iar //physical address of current instruction
Physical Address = 001C5BA0
KDB(0)> mwp 001C5BA0 //modify with physical address
001C5BA0: 7C0802A6 = <CR/LF>
001C5BA4: 93E1FFFC = <CR/LF>
001C5BA8: 90010008 = <CR/LF>
001C5BAC: 9421FF40 = 60000000
001C5BB0: 83E211C4 = . //end of input
KDB(0)> dc @iar 5 //print instructions
.open+000000 mflr r0
.open+000004 stw r31,FFFFFFFC(stkp)
.open+000008 stw r0,8(stkp)
.open+00000C ori r0,r0,0
.open+000010 lwz r31,11C4(toc) 11C4(toc)=_open$$
KDB(0)> mw open+c //restore instruction
.open+00000C: 60000000 = 9421FF40
.open+000010: 83E211C4 = . //end of input
KDB(0)> dc open+c //print instruction
.open+00000C stwu stkp,FFFFFF40(stkp)
KDB(0)>