CR16C: monitor register definitions

this enables printing registers with the print command
This commit is contained in:
fridtjof 2026-05-13 14:53:32 +02:00
parent a84c408062
commit 3918b2c050
2 changed files with 65 additions and 0 deletions

View file

@ -7,6 +7,7 @@ cr16c_ss.add(gen)
cr16c_ss.add(files(
'cpu.c',
'helper.c',
'monitor.c',
'translate.c',
'disas.c',
))

64
target/cr16c/monitor.c Normal file
View file

@ -0,0 +1,64 @@
/*
* QEMU monitor
*
* Copyright (c) 2026 fridtjof
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "qemu/osdep.h"
#include "cpu.h"
#include "monitor/monitor.h"
#include "monitor/hmp-target.h"
const MonitorDef monitor_defs[] = {
#define GENERIC_REG(idx) { cr16c_cpu_r_names[(idx)], offsetof(CPUCR16CState, r[(idx)]) }
GENERIC_REG(0),
GENERIC_REG(1),
GENERIC_REG(2),
GENERIC_REG(3),
GENERIC_REG(4),
GENERIC_REG(5),
GENERIC_REG(6),
GENERIC_REG(7),
GENERIC_REG(8),
GENERIC_REG(9),
GENERIC_REG(10),
GENERIC_REG(11),
GENERIC_REG(12),
GENERIC_REG(13),
GENERIC_REG(14),
GENERIC_REG(15),
#undef GENERIC_REG
{ "intbase", offsetof(CPUCR16CState, intbase), },
{ "isp", offsetof(CPUCR16CState, isp), },
{ "usp", offsetof(CPUCR16CState, usp), },
// TODO PSR, CFG
// TODO debug registers
{ "pc", offsetof(CPUCR16CState, pc), },
{ NULL },
};
const MonitorDef *target_monitor_defs(void)
{
return monitor_defs;
}