Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\debug\kdb\kdb_main.c Create Date:2022-07-28 11:41:45
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:kdb_md

Proto:static int kdb_md(int argc, const char **argv)

Type:int

Parameter:

TypeParameterName
intargc
const char **argv
1556  radix = 16 , mdcount = 8 , bytesperword = KDB_WORD_SIZE
1557  nosect = 0
1561  offset = 0
1562  symbolic = 0
1563  valid = 0
1564  phys = 0
1565  raw = 0
1567  kdbgetintenv - This function will return the value of an* integer-valued environment variable
1568  kdbgetintenv - This function will return the value of an* integer-valued environment variable
1569  kdbgetintenv - This function will return the value of an* integer-valued environment variable
1572  repeat = mdcount * 16 / bytesperword
1574  If strcmp(argv[0], "mdr") == 0 Then
1575  If argc == 2 || argc == 0 && last_addr != 0 Then valid = raw = 1
1577  Else Return KDB_ARGCOUNT
1579  Else if isdigit(argv[0][2]) Then
1580  bytesperword = argv[0][2] - '0'
1581  If bytesperword == 0 Then
1583  If bytesperword == 0 Then bytesperword = 4
1586  last_bytesperword = bytesperword
1587  repeat = mdcount * 16 / bytesperword
1588  If Not argv[0][3] Then valid = 1
1590  Else if argv[0][3] == 'c' && argv[0][4] Then
1593  mdcount = ( repeat * bytesperword + 15) / 16
1594  valid = Not p
1596  last_repeat = repeat
1597  Else if strcmp(argv[0], "md") == 0 Then valid = 1
1599  Else if strcmp(argv[0], "mds") == 0 Then valid = 1
1601  Else if strcmp(argv[0], "mdp") == 0 Then
1602  phys = valid = 1
1604  If Not valid Then Return KDB return codes from a command or internal kdb function
1607  If argc == 0 Then
1608  If last_addr == 0 Then Return KDB_ARGCOUNT
1610  addr = last_addr
1611  radix = last_radix
1612  bytesperword = last_bytesperword
1613  repeat = last_repeat
1614  If raw Then mdcount = repeat
1616  Else mdcount = ( repeat * bytesperword + 15) / 16
1620  If argc Then
1622  nextarg = 1
1623  diag = kdbgetaddrarg - This function is responsible for parsing an* address-expression and returning the value of the expression,* symbol name, and offset to the caller
1625  If diag Then Return diag
1627  If argc > nextarg + 2 Then Return KDB_ARGCOUNT
1630  If argc >= nextarg Then
1632  If Not diag Then
1633  mdcount = val
1634  If raw Then repeat = mdcount
1636  Else repeat = mdcount * 16 / bytesperword
1640  If argc >= nextarg + 1 Then
1642  If Not diag Then radix = val
1647  If strcmp(argv[0], "mdr") == 0 Then
1649  last_addr = addr
1650  ret = kdb_mdr - This function implements the guts of the 'mdr', memory* read command.* mdr ,* Inputs:* addr Start address* count Number of bytes* Returns:* Always 0. Any errors are detected and printed by kdb_getarea.
1651  last_addr += mdcount
1652  last_repeat = mdcount
1653  last_bytesperword = bytesperword
1654  Return ret
1658  Case radix == 10
1659  fmtchar = 'd'
1660  Break
1661  Case radix == 16
1662  fmtchar = 'x'
1663  Break
1664  Case radix == 8
1665  fmtchar = 'o'
1666  Break
1667  Default
1668  Return KDB_BADRADIX
1671  last_radix = radix
1673  If bytesperword > KDB_WORD_SIZE Then Return KDB_BADWIDTH
1677  Case bytesperword == 8
1678  sprintf(fmtstr, "%%16.16l%c ", fmtchar)
1679  Break
1680  Case bytesperword == 4
1681  sprintf(fmtstr, "%%8.8l%c ", fmtchar)
1682  Break
1683  Case bytesperword == 2
1684  sprintf(fmtstr, "%%4.4l%c ", fmtchar)
1685  Break
1686  Case bytesperword == 1
1687  sprintf(fmtstr, "%%2.2l%c ", fmtchar)
1688  Break
1689  Default
1690  Return KDB_BADWIDTH
1693  last_repeat = repeat
1694  last_bytesperword = bytesperword
1696  If strcmp(argv[0], "mds") == 0 Then
1697  symbolic = 1
1702  repeat = mdcount
1708  addr &= ~(bytesperword - 1)
1710  When repeat > 0 cycle
1712  num = If symbolic Then 1 Else 16 / bytesperword
1714  If KDB_FLAG(CMD_INTERRUPT) Then Return 0
1716  When z < repeat cycle
1727  addr += bytesperword * n
1728  repeat -= n
1729  z = ( z + num - 1) / num
1730  If z > 2 Then
1731  s = num * (z - 2)
1732  kdb_printf(kdb_machreg_fmt0"-"kdb_machreg_fmt0" zero suppressed\n", addr, addr + bytesperword * s - 1)
1735  addr += bytesperword * s
1736  repeat -= s
1739  last_addr = addr
1741  Return 0