From: Gabe Black Date: Wed, 26 Feb 2020 03:16:06 +0000 (-0800) Subject: arm: Expose the constants which select a semihosting operation. X-Git-Tag: v20.0.0.0~452 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fcec43e297475dfa9bffe7067ebd180be888fa10;p=gem5.git arm: Expose the constants which select a semihosting operation. Give these constants meaningful names instead of opaque constants only visible in the .cc file. Change-Id: Ib88912dae79960f785099c236c337db52a69d563 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/25945 Reviewed-by: Chun-Chen TK Hsu Reviewed-by: Giacomo Travaglini Maintainer: Giacomo Travaglini Tested-by: kokoro --- diff --git a/src/arch/arm/semihosting.cc b/src/arch/arm/semihosting.cc index e85fe7ead..4f897e208 100644 --- a/src/arch/arm/semihosting.cc +++ b/src/arch/arm/semihosting.cc @@ -52,37 +52,39 @@ #include "sim/system.hh" const std::map ArmSemihosting::calls{ - { 0x01, { "SYS_OPEN", &ArmSemihosting::callOpen, 3, 3 } }, - { 0x02, { "SYS_CLOSE", &ArmSemihosting::callClose, 1, 1 } }, + { SYS_OPEN, { "SYS_OPEN", &ArmSemihosting::callOpen, 3, 3 } }, + { SYS_CLOSE, { "SYS_CLOSE", &ArmSemihosting::callClose, 1, 1 } }, // Write(C|0) are special since we want to read the character // manually. We therefore declare them as having 0 params. - { 0x03, { "SYS_WRITEC", &ArmSemihosting::callWriteC, 0, 0 } }, - { 0x04, { "SYS_WRITE0", &ArmSemihosting::callWrite0, 1, 1 } }, - - { 0x05, { "SYS_WRITE", &ArmSemihosting::callWrite, 3, 3 } }, - { 0x06, { "SYS_READ", &ArmSemihosting::callRead, 3, 3 } }, - { 0x07, { "SYS_READC", &ArmSemihosting::callReadC, 0, 0 } }, - { 0x08, { "SYS_ISERROR", &ArmSemihosting::callIsError, 1, 1 } }, - { 0x09, { "SYS_ISTTY", &ArmSemihosting::callIsTTY, 1, 1 } }, - { 0x0A, { "SYS_SEEK", &ArmSemihosting::callSeek, 2, 2 } }, - { 0x0C, { "SYS_FLEN", &ArmSemihosting::callFLen, 1, 1 } }, - { 0x0D, { "SYS_TMPNAM", &ArmSemihosting::callTmpNam, 3, 3 } }, - { 0x0E, { "SYS_REMOVE", &ArmSemihosting::callRemove, 2, 2} }, - { 0x0F, { "SYS_RENAME", &ArmSemihosting::callRename, 4, 4} }, - { 0x10, { "SYS_CLOCK", &ArmSemihosting::callClock, 0, 0} }, - { 0x11, { "SYS_TIME", &ArmSemihosting::callTime, 0, 0} }, - { 0x12, { "SYS_SYSTEM", &ArmSemihosting::callSystem, 2, 2} }, - { 0x13, { "SYS_ERRNO", &ArmSemihosting::callErrno, 0, 0 } }, - { 0x15, { "SYS_GET_CMDLINE", &ArmSemihosting::callGetCmdLine, 2, 2} }, - { 0x16, { "SYS_HEAPINFO", &ArmSemihosting::callHeapInfo, 1, 1} }, + { SYS_WRITEC, { "SYS_WRITEC", &ArmSemihosting::callWriteC, 0, 0 } }, + { SYS_WRITE0, { "SYS_WRITE0", &ArmSemihosting::callWrite0, 1, 1 } }, + + { SYS_WRITE, { "SYS_WRITE", &ArmSemihosting::callWrite, 3, 3 } }, + { SYS_READ, { "SYS_READ", &ArmSemihosting::callRead, 3, 3 } }, + { SYS_READC, { "SYS_READC", &ArmSemihosting::callReadC, 0, 0 } }, + { SYS_ISERROR, { "SYS_ISERROR", &ArmSemihosting::callIsError, 1, 1 } }, + { SYS_ISTTY, { "SYS_ISTTY", &ArmSemihosting::callIsTTY, 1, 1 } }, + { SYS_SEEK, { "SYS_SEEK", &ArmSemihosting::callSeek, 2, 2 } }, + { SYS_FLEN, { "SYS_FLEN", &ArmSemihosting::callFLen, 1, 1 } }, + { SYS_TMPNAM, { "SYS_TMPNAM", &ArmSemihosting::callTmpNam, 3, 3 } }, + { SYS_REMOVE, { "SYS_REMOVE", &ArmSemihosting::callRemove, 2, 2} }, + { SYS_RENAME, { "SYS_RENAME", &ArmSemihosting::callRename, 4, 4} }, + { SYS_CLOCK, { "SYS_CLOCK", &ArmSemihosting::callClock, 0, 0} }, + { SYS_TIME, { "SYS_TIME", &ArmSemihosting::callTime, 0, 0} }, + { SYS_SYSTEM, { "SYS_SYSTEM", &ArmSemihosting::callSystem, 2, 2} }, + { SYS_ERRNO, { "SYS_ERRNO", &ArmSemihosting::callErrno, 0, 0 } }, + { SYS_GET_CMDLINE, + { "SYS_GET_CMDLINE", &ArmSemihosting::callGetCmdLine, 2, 2} }, + { SYS_HEAPINFO, { "SYS_HEAPINFO", &ArmSemihosting::callHeapInfo, 1, 1} }, // Exit is special and requires custom handling in aarch32. - { 0x18, { "SYS_EXIT", &ArmSemihosting::callExit, 0, 2 } }, - { 0x20, { "SYS_EXIT_EXTENDED", &ArmSemihosting::callExitExtended, 2, 2 } }, + { SYS_EXIT, { "SYS_EXIT", &ArmSemihosting::callExit, 0, 2 } }, + { SYS_EXIT_EXTENDED, + { "SYS_EXIT_EXTENDED", &ArmSemihosting::callExitExtended, 2, 2 } }, - { 0x30, { "SYS_ELAPSED", &ArmSemihosting::callElapsed, 0, 0 } }, - { 0x31, { "SYS_TICKFREQ", &ArmSemihosting::callTickFreq, 0, 0 } }, + { SYS_ELAPSED, { "SYS_ELAPSED", &ArmSemihosting::callElapsed, 0, 0 } }, + { SYS_TICKFREQ, { "SYS_TICKFREQ", &ArmSemihosting::callTickFreq, 0, 0 } }, }; const std::vector ArmSemihosting::fmodes{ diff --git a/src/arch/arm/semihosting.hh b/src/arch/arm/semihosting.hh index 3b5b46ea6..104b479c5 100644 --- a/src/arch/arm/semihosting.hh +++ b/src/arch/arm/semihosting.hh @@ -68,6 +68,36 @@ class ThreadContext; class ArmSemihosting : public SimObject { public: + + enum Operation { + SYS_OPEN = 0x01, + SYS_CLOSE = 0x02, + SYS_WRITEC = 0x03, + SYS_WRITE0 = 0x04, + SYS_WRITE = 0x05, + SYS_READ = 0x06, + SYS_READC = 0x07, + SYS_ISERROR = 0x08, + SYS_ISTTY = 0x09, + SYS_SEEK = 0x0A, + SYS_FLEN = 0x0C, + SYS_TMPNAM = 0x0D, + SYS_REMOVE = 0x0E, + SYS_RENAME = 0x0F, + SYS_CLOCK = 0x10, + SYS_TIME = 0x11, + SYS_SYSTEM = 0x12, + SYS_ERRNO = 0x13, + SYS_GET_CMDLINE = 0x15, + SYS_HEAPINFO = 0x16, + SYS_EXIT = 0x18, + SYS_EXIT_EXTENDED = 0x20, + SYS_ELAPSED = 0x30, + SYS_TICKFREQ = 0x31, + + MaxStandardOp = 0xFF + }; + ArmSemihosting(const ArmSemihostingParams *p); /** Perform an Arm Semihosting call from aarch64 code. */