DRAFT AVR Patches
cover DRAFT AVR Patches
This series of patches adds support for 8 bit Atmel (Microchip) AVR microcontrollers. All documented instructions except DES, SPM, and WDR are implemented.
These patches include very incomplete peripheral emulation, and only a single example board definition.
All instructions except LAC, LAS, LAT, XCH, BREAK, and SLEEP have been tested by comparing their behaviours against hardware. The test programs used were designed specifically to exercise as many instruction variants as possible.
More details, source code, and results are available here: https://github.com/seharris/qemu-avr-tests/tree/master/instruction-tests
Additionally, it has been confirmed that this emulation can run FreeRTOS (an open source realtime operating system).
AVRs don't have memory management hardware and typically only have a few kilobytes of RAM so booting something more standard, e.g. Linux, wasn't feasible. Two peripherals were needed (USART and 16 bit timer) for this test and are included in these patches.
The implementations are somewhat limited, mostly because QEMU doesn't seem to have much in the way of facilities to handle low-level electrical interfaces like GPIO pins. A simple LED indicator peripheral was also used, but is not included because it isn't likely to be generally useful.
The FreeRTOS build and LED patch are available here: https://github.com/seharris/qemu-avr-tests/tree/master/free-rtos
These patches are based on work by Michael Rolnik, last discussed here in 2017: https://lists.gnu.org/archive/html/qemu-devel/2017-06/msg02290.html
This series is derived from the version found in this repository: https://github.com/michaelrolnik/qemu-avr
Changes from that version:
- rebase onto current master
- fixes for some accumulated bitrot (including a crash at startup)
- minor improvements to sample board firmware loading
- fixes for bugs in instruction translations (POP, ASR, LSR, ROR, FMUL, FMULS, FMULSU, MUL, MULS, MULSU, OR, SBC, SBCI)
- new instruction decoder to avoid some awkward dependencies
- general cleanup (style fixes, fixing unclear comments, making code easier to follow)
On a personal note, I'm unfamiliar with this style of submission so I hope I haven't broken anything!
Sarah Harris (8):
target/avr: Add instruction decoder
target/avr: Add mechanism to check for active debugger connection target/avr: Add outward facing interfaces and core CPU logic target/avr: Add instruction helpers
target/avr: Add instruction translation
target/avr: Add limited support for USART and 16 bit timer peripherals target/avr: Add example board configuration
target/avr: Register AVR support with the rest of QEMU, the build
system, and the MAINTAINERS file
MAINTAINERS | 6 + arch_init.c | 2 + configure | 6 + default-configs/avr-softmmu.mak | 5 + gdbstub.c | 5 + hw/Kconfig | 1 + hw/avr/Kconfig | 4 + hw/avr/Makefile.objs | 1 + hw/avr/sample.c | 177 ++ hw/char/Kconfig | 3 + hw/char/Makefile.objs | 1 + hw/char/avr_usart.c | 316 ++++ hw/timer/Kconfig | 3 + hw/timer/Makefile.objs | 1 + hw/timer/avr_timer16.c | 587 ++++++ include/disas/dis-asm.h | 6 + include/exec/gdbstub.h | 4 + include/hw/char/avr_usart.h | 99 + include/hw/timer/avr_timer16.h | 99 + include/sysemu/arch_init.h | 1 + qapi/common.json | 2 +- target/avr/Makefile.objs | 23 + target/avr/cpu-qom.h | 83 + target/avr/cpu.c | 570 ++++++ target/avr/cpu.h | 238 +++ target/avr/decode.c | 441 +++++ target/avr/decode.h | 68 + target/avr/gdbstub.c | 85 + target/avr/helper.c | 343 ++++ target/avr/helper.h | 28 + target/avr/machine.c | 122 ++ target/avr/translate-inst.h | 695 +++++++ target/avr/translate.c | 3013 +++++++++++++++++++++++++++++++ tests/machine-none-test.c | 1 + 34 files changed, 7038 insertions(+), 1 deletion(-) create mode 100644 default-configs/avr-softmmu.mak create mode 100644 hw/avr/Kconfig create mode 100644 hw/avr/Makefile.objs create mode 100644 hw/avr/sample.c create mode 100644 hw/char/avr_usart.c create mode 100644 hw/timer/avr_timer16.c create mode 100644 include/hw/char/avr_usart.h create mode 100644 include/hw/timer/avr_timer16.h create mode 100644 target/avr/Makefile.objs create mode 100644 target/avr/cpu-qom.h create mode 100644 target/avr/cpu.c create mode 100644 target/avr/cpu.h create mode 100644 target/avr/decode.c create mode 100644 target/avr/decode.h create mode 100644 target/avr/gdbstub.c create mode 100644 target/avr/helper.c create mode 100644 target/avr/helper.h create mode 100644 target/avr/machine.c create mode 100644 target/avr/translate-inst.h create mode 100644 target/avr/translate.c
Signature · 1 line
2.21.0
PATCH 1/8 target/avr: Add instruction decoder
This utility module builds a decision tree to decode instructions, starting from a human readable list of instruction bit patterns. Automatic tree generation will hopefully be more efficient and more maintainable than a hand-designed opcode parser.
Tree generation happens at startup because this seemed simpler to implement than adding a new build step.
--- target/avr/decode.c | 441 ++++++++++++++++++++++++++++++++++++++++++++ target/avr/decode.h | 68 +++++++ 2 files changed, 509 insertions(+) create mode 100644 target/avr/decode.c create mode 100644 target/avr/decode.h
target/avr/decode.c new file +441 -0
@@ -0,0 +1,441 @@ +/* +* AVR instruction decoder. +* +* Copyright (c) 2019 University of Kent +* Author: Sarah Harris +* +* 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. +*/ + +/* +* # Why is this here? +* This decoder takes a list of human readable descriptions of instructions +* and uses it to build a binary decision tree used to choose translation +* functions for opcodes. +* It's built like this because figuring out the structure of AVR instructions +* was too hard and writing a Big Nested Switch by hand seemed too painful. +* This seems to be the simplest answer that doesn't use loads (>0.5MB) of RAM. +* +* # How does it work? +* This is based J. R. Quinlan's ID3 algorithm, tweaked to add weights to each +* instruction. +* Having a binary tree branch on opcode bits seems obvious, but the awkward +* part is deciding which order to test the bits. +* Getting the order right means that redundant bits can be ignored and fewer +* branches are needed; i.e. less memory and faster lookups. +* Here, the tests are ordered by an estimate of information gain based on +* Shannon Entropy. +* In short, we guess how much each bit tells us and pick the one that gives +* us most progress toward knowing which instruction we're seeing. +* The weights are currently only used to prioritise legal opcodes over +* illegal opcodes, which significantly reduces the tree size. +* +* # Why are you doing this at run time? +* It was easier than building and running a special purpose tool during +* QEMU's build process. +* The tree is only built once, during startup, and hopefully doesn't take long +* enough to be noticeable. +*/ + +#include <math.h> +#include "qemu/osdep.h" +#include "qemu/bitops.h" +#include "qemu/error-report.h" +#include "decode.h" + +/* #define DEBUG_DECODER */ + +/* Wide enough for the largest AVR instruction. */ +#define OPCODE_T uint16_t +#define OPCODE_SIZE 16 + +/* +* Probability estimate for each instruction. +* Larger values mean higher priority. +*/ +#define WEIGHT_T uint64_t +#define WEIGHT_LEGAL (1 << 16) +#define WEIGHT_ILLEGAL 1 + +typedef union Tree Tree ; + +typedef struct { +bool is_leaf; +/* Bit to test */ +uint bit; +const Tree *zero; +const Tree *one; +}Branch ; + +typedef struct { +bool is_leaf; +TranslateFn decoder; +/* Instruction length in bits */ +uint32_t length; +const char *name; +}Leaf ; + +union Tree { +bool is_leaf; +Branch branch; +Leaf leaf; +}; + +/* Additional (generated) instruction data */ +typedef struct { +const Instruction *instruction; +/* Instruction length in bits */ +uint32_t length; +WEIGHT_T weight; +/* +* Bit pattern matched in opcodes. +* For each 1 in mask, the same bit in the opcode must match that from bits. +*/ +OPCODE_T bits; +OPCODE_T mask; +}Pattern ; + +/* Cached decoding tree */ +Tree *cache; + +/* Return calculated bit pattern and length for an instruction */ +static Pattern get_info (const Instruction *instruction) +{ +OPCODE_T bit =1 << (OPCODE_SIZE -1 ); +OPCODE_T bits =0 ; +OPCODE_T mask =0 ; +uint32_t length =0 ; +const char *c = instruction->pattern; +while (*c !='\0' ) { +switch (*c) { +case '0' : + mask |= bit; + bit >>=1 ; + length++; +break ; +case '1' : + bits |= bit; + mask |= bit; + bit >>=1 ; + length++; +break ; +case '*' : + bit >>=1 ; + length++; +break ; +case '_' : +/* NOP */ +break ; +default : +assert (0 ); + } + c++; + } +const Pattern pattern = { + .instruction = instruction, + .length = length, + .weight =WEIGHT_LEGAL , + .bits = bits, + .mask = mask + }; +return pattern; +} + +/* Return true if an instruction matches a pattern of known/unknown bits */ +static bool matches (const Pattern *const pattern,const OPCODE_T bits, +const OPCODE_T mask) +{ +OPCODE_T overlap = pattern->mask & mask; +return (pattern->bits & overlap) == (bits & overlap); +} + +/* Return number of instructions that match a pattern of known/unknown bits */ +static size_t count_legal (const Pattern *patterns,const size_t size, +const OPCODE_T bits,const OPCODE_T mask) +{ +size_t sum =0 ; +size_t i; +for (i =0 ; i < size; i++) { +if (matches (&patterns[i], bits, mask)) { + sum++; + } + } +return sum; +} + +/* Return the number of opcodes that could match a bit pattern */ +static uint64_t count_opcodes (const OPCODE_T _bits,OPCODE_T mask) +{ +uint64_t matches =1 ; +int i; +assert (sizeof (matches) *8 >OPCODE_SIZE ); +for (i =0 ; i <OPCODE_SIZE ; i++) { +if (!(mask &1 )) { + matches <<=1 ; + } + mask >>=1 ; + } +return matches; +} + +/* +* Return a known/unknown bit pattern that only matches opcodes matched by both +* of the given patterns. +*/ +static void intersection (const OPCODE_T a_bits,const OPCODE_T a_mask, +const OPCODE_T b_bits,const OPCODE_T b_mask, +OPCODE_T *const out_bits,OPCODE_T *const out_mask) +{ +const OPCODE_T overlap = a_mask & b_mask; +/* The two patterns mustn't have conflicting requirements */ +assert ((a_bits & overlap) == (b_bits & overlap)); + *out_bits = (a_bits & a_mask) | (b_bits & b_mask); + *out_mask = a_mask | b_mask; +} + +/* +* Return one if any opcode allowed by a pattern of known/unknown bits is +* illegal. +*/ +static size_t count_illegal (const Pattern *patterns,const size_t size, +const OPCODE_T bits,const OPCODE_T mask) +{ +size_t i; +const uint64_t no_opcodes =count_opcodes (bits, mask); +uint64_t no_legal =0 ; + +/* Count opcodes that match instructions */ +for (i =0 ; i < size; i++) { +const Pattern *pattern = &patterns[i]; +if (matches (pattern, bits, mask)) { +OPCODE_T both_bits, both_mask; +intersection ( + bits, mask, + pattern->bits, pattern->mask, + &both_bits, &both_mask + ); + no_legal +=count_opcodes (both_bits, both_mask); + } + } + +assert (no_legal <= no_opcodes); +if (no_legal == no_opcodes) { +return 0 ; + }else { +return 1 ; + } +} + +/* Return the first matching instruction for a pattern of known/unknown bits */ +static const Pattern *find_match (const Pattern *patterns,const size_t size, +const OPCODE_T bits,const OPCODE_T mask) +{ +size_t i; +for (i =0 ; i < size; i++) { +if (matches (&patterns[i], bits, mask)) { +return &patterns[i]; + } + } +return NULL ; +} + +/* Return sum of weights of instructions that match a bit pattern */ +static WEIGHT_T weigh_matches (const Pattern *patterns,const size_t size, +const OPCODE_T bits,const OPCODE_T mask) +{ +size_t i; +WEIGHT_T illegal = (WEIGHT_T )count_illegal (patterns, size, bits, mask) + *WEIGHT_ILLEGAL ; +WEIGHT_T legal =0 ; +for (i =0 ; i < size; i++) { +if (matches (&patterns[i], bits, mask)) { + legal += patterns[i].weight; + } + } +return legal + illegal; +} + +/* +* Return "effort" (estimated information needed) to decide tree outcome. +* bits and mask give the opcode bits already decided by the parent tree. +* parent_weight gives the sum of the weights of instructions that the +* parent tree matches. +*/ +static float subtree_effort (const Pattern *patterns,const size_t size, +const OPCODE_T bits,const OPCODE_T mask,const WEIGHT_T parent_weight) +{ +const WEIGHT_T weight =weigh_matches (patterns, size, bits, mask); +float entropy_legal, entropy_illegal, probability; +size_t i; + +/* Sum information needed to decide legal instructions */ + entropy_legal =0.0 ; +for (i =0 ; i < size; i++) { +const Pattern *const pattern = &patterns[i]; +if (matches (pattern, bits, mask)) { + probability = (float )pattern->weight / (float )weight; + entropy_legal += -probability *log2 (probability); + } + } + +/* Sum information needed to decide illegal instructions */ + probability = (float )WEIGHT_ILLEGAL / (float )weight; + entropy_illegal = -probability *log2 (probability) * + (float )count_illegal (patterns, size, bits, mask); + +return ((float )weight / (float )parent_weight) * + (entropy_legal + entropy_illegal); +} + +/* Return recursively built binary tree for decoding an opcode to instruction */ +static Tree *build_tree (const Pattern *patterns,const size_t size, +OPCODE_T bits,OPCODE_T mask) +{ +/* Check if we've reached a leaf */ +size_t matching_illegal =count_illegal (patterns, size, bits, mask); +size_t matching_legal =count_legal (patterns, size, bits, mask); +size_t matching = matching_illegal + matching_legal; +assert (matching >0 );/* At last an illegal instruction should match */ +if (matching_legal ==0 ) { +/* Illegal instruction */ +Leaf *leaf =g_new0 (Leaf,1 ); + leaf->is_leaf = true; + leaf->decoder =NULL ; + leaf->length =16 ; + leaf->name ="illegal" ; +return (Tree *)leaf; + } +if (matching_legal ==1 && matching_illegal ==0 ) { +/* Legal instruction */ +const Pattern *pattern =find_match (patterns, size, bits, mask); +assert (pattern !=NULL ); +const Instruction *const instruction = pattern->instruction; +Leaf *leaf =g_new0 (Leaf,1 ); + leaf->is_leaf = true; + leaf->decoder = instruction->decoder; + leaf->length = pattern->length; + leaf->name = instruction->name; +return (Tree *)leaf; + } + +/* Work out which bit to branch on */ +const WEIGHT_T tree_weight =weigh_matches (patterns, size, bits, mask); +float min_effort =0.0 ; +ssize_t min_bit =-1 ; +size_t i; +for (i =0 ; i <OPCODE_SIZE ; i++) { +float effort; +const OPCODE_T bit =1 << i; +if (mask & bit) { +/* This bit already branched on, skip */ +continue ; + } + effort =subtree_effort (patterns, size, bits, mask | bit, tree_weight) + +subtree_effort (patterns, size, bits | bit, mask | bit, tree_weight); +if (min_bit <0 || effort < min_effort) { + min_bit = i; + min_effort = effort; + } + } + +/* +* Setup branch on bit that gives most information gain. +* (AKA minimum information/effort needed to decide remaining branches. +*/ +assert (min_bit >=0 );/* Probably multiple instructions match one opcode */ +const OPCODE_T bit =1 << min_bit; +const Tree *zero =build_tree (patterns, size, bits, mask | bit); +const Tree *one =build_tree (patterns, size, bits | bit, mask | bit); +Branch *branch =g_new0 (Branch,1 ); + branch->is_leaf = false; + branch->bit = min_bit; + branch->zero = zero; + branch->one = one; +return (Tree *)branch; +} + +#ifdef DEBUG_DECODER +static size_t depth (const Tree *const tree); +static size_t depth (const Tree *const tree) +{ +if (tree->is_leaf) { +return 1 ; + } +size_t zero =depth (tree->branch.zero); +size_t one =depth (tree->branch.one); +if (zero > one) { +return zero +1 ; + } +return one +1 ; +} +static size_t count (const Tree *const tree); +static size_t count (const Tree *const tree) +{ +if (tree->is_leaf) { +return 1 ; + } +return 1 +count (tree->branch.zero) +count (tree->branch.one); +} +#endif + +void avr_decoder_init (const Instruction instructions[],const size_t size) +{ +assert (cache ==NULL );/* Shouldn't be initialised more than once */ +Pattern *const patterns =g_new0 (Pattern, size); +size_t i; +for (i =0 ; i < size; i++) { + patterns[i] =get_info (&instructions[i]); + } + cache =build_tree (patterns, size,0 ,0 ); +g_free (patterns); +#ifdef DEBUG_DECODER +printf ("AVR decoder init, depth=%lu, size=%lu\n" , +depth (cache),count (cache)); +#endif +} + +TranslateFn avr_decode (const uint32_t opcode,uint32_t *const length_out) +{ +assert (cache !=NULL );/* Must be initialised */ +const Tree *node = cache; +while (1 ) { +assert (node !=NULL ); +if (node->is_leaf) { +const Leaf *const leaf = &node->leaf; +if (leaf->decoder ==NULL ) { +/* Illegal instruction */ +error_report ("Illegal AVR instruction" ); +exit (1 ); + } +#ifdef DEBUG_DECODER +printf ("AVR decoder: %s\n" , leaf->name); +#endif + *length_out = leaf->length; +return leaf->decoder; + }else { +const Branch *const branch = &node->branch; +const OPCODE_T mask =1 << branch->bit; +if (opcode & mask) { + node = branch->one; + }else { + node = branch->zero; + } + } + } +}
target/avr/decode.h new file +68 -0
68 lines not on this page · raw message
Signature · 1 line
2.21.0
Re: [Qemu-devel] [PATCH v1 1/8] target/avr: Add instruction decoder
Quoted 4 lines · Sarah Harris
This utility module builds a decision tree to decode instructions, starting from a human readable list of instruction bit patterns. Automatic tree generation will hopefully be more efficient and more maintainable than a hand-designed opcode parser.
Tree generation happens at startup because this seemed simpler to implement than adding a new build step.
We have such a thing in qemu already, as a separate build step.
See ./scripts/decodetree.py, and some of the uses in
target/{arm,hppa,riscv}/*.decode
In addition to being able to select the instruction, it also extracts arguments from the instruction, so there's less repetition that you have for e.g.
Quoted 4 lines
target/avr/decode.c new file +4
-0+static inline uint32_t MOVW_Rr (uint32_t opcode) +{ +return extract32 (opcode,0 ,4 ); +}
...
target/avr/decode.c line 147
Quoted 4 lines
target/avr/decode.c new file +4
-0+static inline uint32_t MULS_Rr (uint32_t opcode) +{ +return extract32 (opcode,0 ,4 ); +}
r~
PATCH 2/8 target/avr: Add mechanism to check for active debugger connection
In reply to Sarah HarrisAVR CPUs have a BREAK instruction which behaves differently depending on whether debugging is enabled.
Since the hardware fuses that normally control this are difficult to emulate, and the BREAK instruction is useful for testing, the BREAK instruction is instead enabled/disabled depending on whether a GDB session is attached.
--- gdbstub.c | 5 +++++ include/exec/gdbstub.h | 4 ++++ 2 files changed, 9 insertions(+)
gdbstub.c +5 -0
@@ -1793,6 +1793,11 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf)return RS_IDLE ; } +bool gdb_is_active (void ) +{ +return gdbserver_state !=NULL ; +} +void gdb_set_stop_cpu (CPUState *cpu) {GDBProcess *p =gdb_get_cpu_process (gdbserver_state, cpu);
include/exec/gdbstub.h +4 -0
@@ -45,6 +45,10 @@ void gdb_do_syscall(gdb_syscall_complete_cb cb, const char *fmt, ...);*/ void gdb_do_syscallv (gdb_syscall_complete_cb cb,const char *fmt,va_list va);int use_gdb_syscalls (void ); +/** +* gdb_is_active: return true if debugging in progress +*/ +bool gdb_is_active (void );void gdb_set_stop_cpu (CPUState *cpu);void gdb_exit (CPUArchState *,int );#ifdef CONFIG_USER_ONLY
Signature · 1 line
2.21.0
PATCH 3/8 target/avr: Add outward facing interfaces and core CPU logic
In reply to Sarah HarrisThis includes:
- CPU data structures
- object model classes and functions
- migration functions
- GDB hooks
--- target/avr/cpu-qom.h | 83 +++++++ target/avr/cpu.c | 570 +++++++++++++++++++++++++++++++++++++++++++ target/avr/cpu.h | 238 ++++++++++++++++++ target/avr/gdbstub.c | 85 +++++++ target/avr/machine.c | 122 +++++++++ 5 files changed, 1098 insertions(+) create mode 100644 target/avr/cpu-qom.h create mode 100644 target/avr/cpu.c create mode 100644 target/avr/cpu.h create mode 100644 target/avr/gdbstub.c create mode 100644 target/avr/machine.c
target/avr/cpu-qom.h new file +83 -0
@@ -0,0 +1,83 @@ +/* +* QEMU AVR CPU +* +* Copyright (c) 2016 Michael Rolnik +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; either +* version 2.1 of the License, or (at your option) any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, see +* <http://www.gnu.org/licenses/lgpl-2.1.html> +*/ + +#ifndef QEMU_AVR_CPU_QOM_H +#define QEMU_AVR_CPU_QOM_H + +#include "qom/cpu.h" + +#define TYPE_AVR_CPU "avr" + +#define AVR_CPU_CLASS (klass) \ + OBJECT_CLASS_CHECK(AVRCPUClass, (klass), TYPE_AVR_CPU) +#define AVR_CPU (obj) \ + OBJECT_CHECK(AVRCPU, (obj), TYPE_AVR_CPU) +#define AVR_CPU_GET_CLASS (obj) \ + OBJECT_GET_CLASS(AVRCPUClass, (obj), TYPE_AVR_CPU) + +/** +* AVRCPUClass: +* @parent_realize: The parent class' realize handler. +* @parent_reset: The parent class' reset handler. +* @vr: Version Register value. +* +* A AVR CPU model. +*/ +typedef struct AVRCPUClass { +CPUClass parent_class; + +DeviceRealize parent_realize; +void (*parent_reset)(CPUState *cpu); +}AVRCPUClass ; + +/** +* AVRCPU: +* @env: #CPUAVRState +* +* A AVR CPU. +*/ +typedef struct AVRCPU { +/*< private >*/ +CPUState parent_obj; +/*< public >*/ + +CPUAVRState env; +}AVRCPU ; + +static inline AVRCPU *avr_env_get_cpu (CPUAVRState *env) +{ +return container_of (env,AVRCPU , env); +} + +#define ENV_GET_CPU (e) CPU(avr_env_get_cpu(e)) +#define ENV_OFFSET offsetof(AVRCPU, env) + +#ifndef CONFIG_USER_ONLY +extern const struct VMStateDescription vms_avr_cpu; +#endif + +void avr_cpu_do_interrupt (CPUState *cpu); +bool avr_cpu_exec_interrupt (CPUState *cpu,int int_req); +void avr_cpu_dump_state (CPUState *cs,FILE *f,int flags); +hwaddr avr_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr); +int avr_cpu_gdb_read_register (CPUState *cpu,uint8_t *buf,int reg); +int avr_cpu_gdb_write_register (CPUState *cpu,uint8_t *buf,int reg); + +#endif
target/avr/cpu.c new file +570 -0
570 lines not on this page · raw message
target/avr/cpu.h new file +238 -0
238 lines not on this page · raw message
target/avr/gdbstub.c new file +85 -0
85 lines not on this page · raw message
target/avr/machine.c new file +122 -0
122 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH 4/8 target/avr: Add instruction helpers
In reply to Sarah HarrisStubs for unimplemented instructions and helpers for instructions that need to interact with QEMU. SPM and WDR are unimplemented because they require emulation of complex peripherals.
The implementation of SLEEP is very limited due to the lack of peripherals to generate wake interrupts. Memory access instructions are implemented here because some address ranges actually refer to CPU registers.
--- target/avr/helper.c | 343 ++++++++++++++++++++++++++++++++++++++++++++ target/avr/helper.h | 28 ++++ 2 files changed, 371 insertions(+) create mode 100644 target/avr/helper.c create mode 100644 target/avr/helper.h
target/avr/helper.c new file +343 -0
@@ -0,0 +1,343 @@ +/* +* QEMU AVR CPU +* +* Copyright (c) 2016 Michael Rolnik +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; either +* version 2.1 of the License, or (at your option) any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, see +* <http://www.gnu.org/licenses/lgpl-2.1.html> +*/ + +#include "qemu/osdep.h" + +#include "cpu.h" +#include "hw/irq.h" +#include "hw/sysbus.h" +#include "sysemu/sysemu.h" +#include "exec/exec-all.h" +#include "exec/cpu_ldst.h" +#include "exec/helper-proto.h" +#include "exec/ioport.h" +#include "qemu/host-utils.h" +#include "qemu/error-report.h" + +bool avr_cpu_exec_interrupt (CPUState *cs,int interrupt_request) +{ +bool ret = false; +CPUClass *cc =CPU_GET_CLASS (cs); +AVRCPU *cpu =AVR_CPU (cs); +CPUAVRState *env = &cpu->env; + +if (interrupt_request &CPU_INTERRUPT_RESET ) { +if (cpu_interrupts_enabled (env)) { + cs->exception_index =EXCP_RESET ; + cc->do_interrupt (cs); + + cs->interrupt_request &= ~CPU_INTERRUPT_RESET ; + + ret = true; + } + } +if (interrupt_request &CPU_INTERRUPT_HARD ) { +if (cpu_interrupts_enabled (env) && env->intsrc !=0 ) { +int index =ctz32 (env->intsrc); + cs->exception_index =EXCP_INT (index); + cc->do_interrupt (cs); + + env->intsrc &= env->intsrc -1 ;/* clear the interrupt */ + cs->interrupt_request &= ~CPU_INTERRUPT_HARD ; + + ret = true; + } + } +return ret; +} + +void avr_cpu_do_interrupt (CPUState *cs) +{ +AVRCPU *cpu =AVR_CPU (cs); +CPUAVRState *env = &cpu->env; + +uint32_t ret = env->pc_w; +int vector =0 ; +int size =avr_feature (env,AVR_FEATURE_JMP_CALL ) ?2 :1 ; +int base =0 ; + +if (cs->exception_index ==EXCP_RESET ) { + vector =0 ; + }else if (env->intsrc !=0 ) { + vector =ctz32 (env->intsrc) +1 ; + } + +if (avr_feature (env,AVR_FEATURE_3_BYTE_PC )) { +cpu_stb_data (env, env->sp--, (ret &0x0000ff )); +cpu_stb_data (env, env->sp--, (ret &0x00ff00 ) >>8 ); +cpu_stb_data (env, env->sp--, (ret &0xff0000 ) >>16 ); + }else if (avr_feature (env,AVR_FEATURE_2_BYTE_PC )) { +cpu_stb_data (env, env->sp--, (ret &0x0000ff )); +cpu_stb_data (env, env->sp--, (ret &0x00ff00 ) >>8 ); + }else { +cpu_stb_data (env, env->sp--, (ret &0x0000ff )); + } + + env->pc_w = base + vector * size; + env->sregI =0 ;/* clear Global Interrupt Flag */ + + cs->exception_index =-1 ; +} + +int avr_cpu_memory_rw_debug (CPUState *cs,vaddr addr,uint8_t *buf, +int len,bool is_write) +{ +return cpu_memory_rw_debug (cs, addr, buf, len, is_write); +} + +hwaddr avr_cpu_get_phys_page_debug (CPUState *cs,vaddr addr) +{ +return addr;/* I assume 1:1 address correspondance */ +} + +int avr_cpu_handle_mmu_fault ( +CPUState *cs,vaddr address,int size,int rw,int mmu_idx) +{ +/* currently it's assumed that this will never happen */ + cs->exception_index =EXCP_DEBUG ; +cpu_dump_state (cs, stderr,0 ); +return 1 ; +} + +void tlb_fill (CPUState *cs,target_ulong vaddr,int size, +MMUAccessType access_type,int mmu_idx,uintptr_t retaddr) +{ +int prot =0 ; +MemTxAttrs attrs = {}; +uint32_t paddr; + + vaddr &=TARGET_PAGE_MASK ; + +if (mmu_idx ==MMU_CODE_IDX ) { +/* access to code in flash */ + paddr =OFFSET_CODE + vaddr; + prot =PAGE_READ |PAGE_EXEC ; +if (paddr +TARGET_PAGE_SIZE >OFFSET_DATA ) { +error_report ("execution left flash memory" ); +exit (1 ); + } + }else if (vaddr <NO_CPU_REGISTERS +NO_IO_REGISTERS ) { +/* +* access to CPU registers, exit and rebuilt this TB to use full access +* incase it touches specially handled registers like SREG or SP +*/ +AVRCPU *cpu =AVR_CPU (cs); +CPUAVRState *env = &cpu->env; + env->fullacc =1 ; +cpu_loop_exit_restore (cs, retaddr); + }else { +/* access to memory. nothing special */ + paddr =OFFSET_DATA + vaddr; + prot =PAGE_READ |PAGE_WRITE ; + } + +tlb_set_page_with_attrs ( + cs, vaddr, paddr, attrs, prot, mmu_idx,TARGET_PAGE_SIZE ); +} + +void helper_sleep (CPUAVRState *env) +{ +CPUState *cs =CPU (avr_env_get_cpu (env)); + + cs->exception_index =EXCP_HLT ; +cpu_loop_exit (cs); +} + +void helper_unsupported (CPUAVRState *env) +{ +CPUState *cs =CPU (avr_env_get_cpu (env)); + +/* +* I count not find what happens on the real platform, so +* it's EXCP_DEBUG for meanwhile +*/ + cs->exception_index =EXCP_DEBUG ; +if (qemu_loglevel_mask (LOG_UNIMP )) { +qemu_log ("UNSUPPORTED\n" ); +cpu_dump_state (cs, qemu_logfile,0 ); + } +cpu_loop_exit (cs); +} + +void helper_debug (CPUAVRState *env) +{ +CPUState *cs =CPU (avr_env_get_cpu (env)); + + cs->exception_index =EXCP_DEBUG ; +cpu_loop_exit (cs); +} + +void helper_wdr (CPUAVRState *env) +{ +CPUState *cs =CPU (avr_env_get_cpu (env)); + +/* WD is not implemented yet, placeholder */ + cs->exception_index =EXCP_DEBUG ; +cpu_loop_exit (cs); +} + +/* +* This function implements IN instruction +* +* It does the following +* a. if an IO register belongs to CPU, its value is read and returned +* b. otherwise io address is translated to mem address and physical memory +* is read. +* c. it caches the value for sake of SBI, SBIC, SBIS & CBI implementation +* +*/ +target_ulong helper_inb (CPUAVRState *env,uint32_t port) +{ +target_ulong data =0 ; + +switch (port) { +case 0x38 :/* RAMPD */ + data =0xff & (env->rampD >>16 ); +break ; +case 0x39 :/* RAMPX */ + data =0xff & (env->rampX >>16 ); +break ; +case 0x3a :/* RAMPY */ + data =0xff & (env->rampY >>16 ); +break ; +case 0x3b :/* RAMPZ */ + data =0xff & (env->rampZ >>16 ); +break ; +case 0x3c :/* EIND */ + data =0xff & (env->eind >>16 ); +break ; +case 0x3d :/* SPL */ + data = env->sp &0x00ff ; +break ; +case 0x3e :/* SPH */ + data = env->sp >>8 ; +break ; +case 0x3f :/* SREG */ + data =cpu_get_sreg (env); +break ; +default : +/* not a special register, pass to normal memory access */ +cpu_physical_memory_read (OFFSET_IO_REGISTERS + port, &data,1 ); + } + +return data; +} + +/* +* This function implements OUT instruction +* +* It does the following +* a. if an IO register belongs to CPU, its value is written into the register +* b. otherwise io address is translated to mem address and physical memory +* is written. +* c. it caches the value for sake of SBI, SBIC, SBIS & CBI implementation +* +*/ +void helper_outb (CPUAVRState *env,uint32_t port,uint32_t data) +{ + data &=0x000000ff ; + +switch (port) { +case 0x38 :/* RAMPD */ +if (avr_feature (env,AVR_FEATURE_RAMPD )) { + env->rampD = (data &0xff ) <<16 ; + } +break ; +case 0x39 :/* RAMPX */ +if (avr_feature (env,AVR_FEATURE_RAMPX )) { + env->rampX = (data &0xff ) <<16 ; + } +break ; +case 0x3a :/* RAMPY */ +if (avr_feature (env,AVR_FEATURE_RAMPY )) { + env->rampY = (data &0xff ) <<16 ; + } +break ; +case 0x3b :/* RAMPZ */ +if (avr_feature (env,AVR_FEATURE_RAMPZ )) { + env->rampZ = (data &0xff ) <<16 ; + } +break ; +case 0x3c :/* EIDN */ + env->eind = (data &0xff ) <<16 ; +break ; +case 0x3d :/* SPL */ + env->sp = (env->sp &0xff00 ) | (data); +break ; +case 0x3e :/* SPH */ +if (avr_feature (env,AVR_FEATURE_2_BYTE_SP )) { + env->sp = (env->sp &0x00ff ) | (data <<8 ); + } +break ; +case 0x3f :/* SREG */ +cpu_set_sreg (env, data); +break ; +default : +/* not a special register, pass to normal memory access */ +cpu_physical_memory_write (OFFSET_IO_REGISTERS + port, &data,1 ); + } +} + +/* +* this function implements LD instruction when there is a posibility to read +* from a CPU register +*/ +target_ulong helper_fullrd (CPUAVRState *env,uint32_t addr) +{ +uint8_t data; + + env->fullacc = false; + +if (addr <NO_CPU_REGISTERS ) { +/* CPU registers */ + data = env->r[addr]; + }else if (addr <NO_CPU_REGISTERS +NO_IO_REGISTERS ) { +/* IO registers */ + data =helper_inb (env, addr -NO_CPU_REGISTERS ); + }else { +/* memory */ +cpu_physical_memory_read (OFFSET_DATA + addr, &data,1 ); + } +return data; +} + +/* +* this function implements ST instruction when there is a posibility to write +* into a CPU register +*/ +void helper_fullwr (CPUAVRState *env,uint32_t data,uint32_t addr) +{ + env->fullacc = false; + +/* Following logic assumes this: */ +assert (OFFSET_CPU_REGISTERS ==OFFSET_DATA ); +assert (OFFSET_IO_REGISTERS ==OFFSET_CPU_REGISTERS +NO_CPU_REGISTERS ); + +if (addr <NO_CPU_REGISTERS ) { +/* CPU registers */ + env->r[addr] = data; + }else if (addr <NO_CPU_REGISTERS +NO_IO_REGISTERS ) { +/* IO registers */ +helper_outb (env, addr -NO_CPU_REGISTERS , data); + }else { +/* memory */ +cpu_physical_memory_write (OFFSET_DATA + addr, &data,1 ); + } +}
target/avr/helper.h new file +28 -0
@@ -0,0 +1,28 @@ +/* +* QEMU AVR CPU +* +* Copyright (c) 2016 Michael Rolnik +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; either +* version 2.1 of the License, or (at your option) any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, see +* <http://www.gnu.org/licenses/lgpl-2.1.html> +*/ + +DEF_HELPER_1(wdr, void, env) +DEF_HELPER_1(debug, void, env) +DEF_HELPER_1(sleep, void, env) +DEF_HELPER_1(unsupported, void, env) +DEF_HELPER_3(outb, void, env, i32, i32) +DEF_HELPER_2(inb, tl, env, i32) +DEF_HELPER_3(fullwr, void, env, i32, i32) +DEF_HELPER_2 (fullrd, tl, env, i32)
Signature · 1 line
2.21.0
PATCH 5/8 target/avr: Add instruction translation
In reply to Sarah HarrisThis includes:
- table of instruction bit patterns
- intermediate translation functions that extract parameters from opcodes
- TCG translations for each instruction
--- target/avr/translate-inst.h | 695 ++++++++ target/avr/translate.c | 3013 +++++++++++++++++++++++++++++++++++ 2 files changed, 3708 insertions(+) create mode 100644 target/avr/translate-inst.h create mode 100644 target/avr/translate.c
target/avr/translate-inst.h new file +695 -0
@@ -0,0 +1,695 @@ +/* +* QEMU AVR CPU +* +* Copyright (c) 2016 Michael Rolnik +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; either +* version 2.1 of the License, or (at your option) any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, see +* <http://www.gnu.org/licenses/lgpl-2.1.html> +*/ + +/* +* Functions for extracting instruction parameters from raw opcodes. +*/ + +#ifndef AVR_TRANSLATE_INST_H_ +#define AVR_TRANSLATE_INST_H_ + +static inline uint32_t MOVW_Rr (uint32_t opcode) +{ +return extract32 (opcode,0 ,4 ); +} + +static inline uint32_t MOVW_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,4 ); +} + +static inline uint32_t MULS_Rr (uint32_t opcode) +{ +return extract32 (opcode,0 ,4 ); +} + +static inline uint32_t MULS_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,4 ); +} + +static inline uint32_t MULSU_Rr (uint32_t opcode) +{ +return extract32 (opcode,0 ,3 ); +} + +static inline uint32_t MULSU_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,3 ); +} + +static inline uint32_t FMUL_Rr (uint32_t opcode) +{ +return extract32 (opcode,0 ,3 ); +} + +static inline uint32_t FMUL_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,3 ); +} + +static inline uint32_t FMULS_Rr (uint32_t opcode) +{ +return extract32 (opcode,0 ,3 ); +} + +static inline uint32_t FMULS_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,3 ); +} + +static inline uint32_t FMULSU_Rr (uint32_t opcode) +{ +return extract32 (opcode,0 ,3 ); +} + +static inline uint32_t FMULSU_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,3 ); +} + +static inline uint32_t CPC_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t CPC_Rr (uint32_t opcode) +{ +return (extract32 (opcode,9 ,1 ) <<4 ) | + (extract32 (opcode,0 ,4 )); +} + +static inline uint32_t SBC_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t SBC_Rr (uint32_t opcode) +{ +return (extract32 (opcode,9 ,1 ) <<4 ) | + (extract32 (opcode,0 ,4 )); +} + +static inline uint32_t ADD_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t ADD_Rr (uint32_t opcode) +{ +return (extract32 (opcode,9 ,1 ) <<4 ) | + (extract32 (opcode,0 ,4 )); +} + +static inline uint32_t AND_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t AND_Rr (uint32_t opcode) +{ +return (extract32 (opcode,9 ,1 ) <<4 ) | + (extract32 (opcode,0 ,4 )); +} + +static inline uint32_t EOR_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t EOR_Rr (uint32_t opcode) +{ +return (extract32 (opcode,9 ,1 ) <<4 ) | + (extract32 (opcode,0 ,4 )); +} + +static inline uint32_t OR_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t OR_Rr (uint32_t opcode) +{ +return (extract32 (opcode,9 ,1 ) <<4 ) | + (extract32 (opcode,0 ,4 )); +} + +static inline uint32_t MOV_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t MOV_Rr (uint32_t opcode) +{ +return (extract32 (opcode,9 ,1 ) <<4 ) | + (extract32 (opcode,0 ,4 )); +} + +static inline uint32_t CPSE_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t CPSE_Rr (uint32_t opcode) +{ +return (extract32 (opcode,9 ,1 ) <<4 ) | + (extract32 (opcode,0 ,4 )); +} + +static inline uint32_t CP_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t CP_Rr (uint32_t opcode) +{ +return (extract32 (opcode,9 ,1 ) <<4 ) | + (extract32 (opcode,0 ,4 )); +} + +static inline uint32_t SUB_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t SUB_Rr (uint32_t opcode) +{ +return (extract32 (opcode,9 ,1 ) <<4 ) | + (extract32 (opcode,0 ,4 )); +} + +static inline uint32_t ADC_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t ADC_Rr (uint32_t opcode) +{ +return (extract32 (opcode,9 ,1 ) <<4 ) | + (extract32 (opcode,0 ,4 )); +} + +static inline uint32_t CPI_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,4 ); +} + +static inline uint32_t CPI_Imm (uint32_t opcode) +{ +return (extract32 (opcode,8 ,4 ) <<4 ) | + (extract32 (opcode,0 ,4 )); +} + +static inline uint32_t SBCI_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,4 ); +} + +static inline uint32_t SBCI_Imm (uint32_t opcode) +{ +return (extract32 (opcode,8 ,4 ) <<4 ) | + (extract32 (opcode,0 ,4 )); +} + +static inline uint32_t ORI_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,4 ); +} + +static inline uint32_t ORI_Imm (uint32_t opcode) +{ +return (extract32 (opcode,8 ,4 ) <<4 ) | + (extract32 (opcode,0 ,4 )); +} + +static inline uint32_t SUBI_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,4 ); +} + +static inline uint32_t SUBI_Imm (uint32_t opcode) +{ +return (extract32 (opcode,8 ,4 ) <<4 ) | + (extract32 (opcode,0 ,4 )); +} + +static inline uint32_t ANDI_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,4 ); +} + +static inline uint32_t ANDI_Imm (uint32_t opcode) +{ +return (extract32 (opcode,8 ,4 ) <<4 ) | + (extract32 (opcode,0 ,4 )); +} + +static inline uint32_t LDDZ_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t LDDZ_Imm (uint32_t opcode) +{ +return (extract32 (opcode,13 ,1 ) <<5 ) | + (extract32 (opcode,10 ,2 ) <<3 ) | + (extract32 (opcode,0 ,3 )); +} + +static inline uint32_t LDDY_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t LDDY_Imm (uint32_t opcode) +{ +return (extract32 (opcode,13 ,1 ) <<5 ) | + (extract32 (opcode,10 ,2 ) <<3 ) | + (extract32 (opcode,0 ,3 )); +} + +static inline uint32_t STDZ_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t STDZ_Imm (uint32_t opcode) +{ +return (extract32 (opcode,13 ,1 ) <<5 ) | + (extract32 (opcode,10 ,2 ) <<3 ) | + (extract32 (opcode,0 ,3 )); +} + +static inline uint32_t STDY_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t STDY_Imm (uint32_t opcode) +{ +return (extract32 (opcode,13 ,1 ) <<5 ) | + (extract32 (opcode,10 ,2 ) <<3 ) | + (extract32 (opcode,0 ,3 )); +} + +static inline uint32_t LDS_Imm (uint32_t opcode) +{ +return extract32 (opcode,0 ,16 ); +} + +static inline uint32_t LDS_Rd (uint32_t opcode) +{ +return extract32 (opcode,20 ,5 ); +} + +static inline uint32_t LDZ2_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t LDZ3_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t LPM2_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t LPMX_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t ELPM2_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t ELPMX_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t LDY2_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t LDY3_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t LDX1_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t LDX2_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t LDX3_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t POP_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t STS_Imm (uint32_t opcode) +{ +return extract32 (opcode,0 ,16 ); +} + +static inline uint32_t STS_Rd (uint32_t opcode) +{ +return extract32 (opcode,20 ,5 ); +} + +static inline uint32_t STZ2_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t STZ3_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t XCH_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t LAS_Rr (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t LAC_Rr (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t LAT_Rr (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t STY2_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t STY3_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t STX1_Rr (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t STX2_Rr (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t STX3_Rr (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t PUSH_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t COM_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t NEG_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t SWAP_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t INC_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t ASR_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t LSR_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t ROR_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t BSET_Bit (uint32_t opcode) +{ +return extract32 (opcode,4 ,3 ); +} + +static inline uint32_t BCLR_Bit (uint32_t opcode) +{ +return extract32 (opcode,4 ,3 ); +} + +static inline uint32_t DEC_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t DES_Imm (uint32_t opcode) +{ +return extract32 (opcode,4 ,4 ); +} + +static inline uint32_t JMP_Imm (uint32_t opcode) +{ +return (extract32 (opcode,20 ,5 ) <<17 ) | + (extract32 (opcode,0 ,17 )); +} + +static inline uint32_t CALL_Imm (uint32_t opcode) +{ +return (extract32 (opcode,20 ,5 ) <<17 ) | + (extract32 (opcode,0 ,17 )); +} + +static inline uint32_t ADIW_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,2 ); +} + +static inline uint32_t ADIW_Imm (uint32_t opcode) +{ +return (extract32 (opcode,6 ,2 ) <<4 ) | + (extract32 (opcode,0 ,4 )); +} + +static inline uint32_t SBIW_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,2 ); +} + +static inline uint32_t SBIW_Imm (uint32_t opcode) +{ +return (extract32 (opcode,6 ,2 ) <<4 ) | + (extract32 (opcode,0 ,4 )); +} + +static inline uint32_t CBI_Bit (uint32_t opcode) +{ +return extract32 (opcode,0 ,3 ); +} + +static inline uint32_t CBI_Imm (uint32_t opcode) +{ +return extract32 (opcode,3 ,5 ); +} + +static inline uint32_t SBIC_Bit (uint32_t opcode) +{ +return extract32 (opcode,0 ,3 ); +} + +static inline uint32_t SBIC_Imm (uint32_t opcode) +{ +return extract32 (opcode,3 ,5 ); +} + +static inline uint32_t SBI_Bit (uint32_t opcode) +{ +return extract32 (opcode,0 ,3 ); +} + +static inline uint32_t SBI_Imm (uint32_t opcode) +{ +return extract32 (opcode,3 ,5 ); +} + +static inline uint32_t SBIS_Bit (uint32_t opcode) +{ +return extract32 (opcode,0 ,3 ); +} + +static inline uint32_t SBIS_Imm (uint32_t opcode) +{ +return extract32 (opcode,3 ,5 ); +} + +static inline uint32_t MUL_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t MUL_Rr (uint32_t opcode) +{ +return (extract32 (opcode,9 ,1 ) <<4 ) | + (extract32 (opcode,0 ,4 )); +} + +static inline uint32_t IN_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t IN_Imm (uint32_t opcode) +{ +return (extract32 (opcode,9 ,2 ) <<4 ) | + (extract32 (opcode,0 ,4 )); +} + +static inline uint32_t OUT_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t OUT_Imm (uint32_t opcode) +{ +return (extract32 (opcode,9 ,2 ) <<4 ) | + (extract32 (opcode,0 ,4 )); +} + +static inline uint32_t RJMP_Imm (uint32_t opcode) +{ +return extract32 (opcode,0 ,12 ); +} + +static inline uint32_t LDI_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,4 ); +} + +static inline uint32_t LDI_Imm (uint32_t opcode) +{ +return (extract32 (opcode,8 ,4 ) <<4 ) | + (extract32 (opcode,0 ,4 )); +} + +static inline uint32_t RCALL_Imm (uint32_t opcode) +{ +return extract32 (opcode,0 ,12 ); +} + +static inline uint32_t BRBS_Bit (uint32_t opcode) +{ +return extract32 (opcode,0 ,3 ); +} + +static inline uint32_t BRBS_Imm (uint32_t opcode) +{ +return extract32 (opcode,3 ,7 ); +} + +static inline uint32_t BRBC_Bit (uint32_t opcode) +{ +return extract32 (opcode,0 ,3 ); +} + +static inline uint32_t BRBC_Imm (uint32_t opcode) +{ +return extract32 (opcode,3 ,7 ); +} + +static inline uint32_t BLD_Bit (uint32_t opcode) +{ +return extract32 (opcode,0 ,3 ); +} + +static inline uint32_t BLD_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t BST_Bit (uint32_t opcode) +{ +return extract32 (opcode,0 ,3 ); +} + +static inline uint32_t BST_Rd (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t SBRC_Bit (uint32_t opcode) +{ +return extract32 (opcode,0 ,3 ); +} + +static inline uint32_t SBRC_Rr (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +static inline uint32_t SBRS_Bit (uint32_t opcode) +{ +return extract32 (opcode,0 ,3 ); +} + +static inline uint32_t SBRS_Rr (uint32_t opcode) +{ +return extract32 (opcode,4 ,5 ); +} + +#endif
target/avr/translate.c new file +3013 -0
2,305 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.21.0
Part of the diff is not shown here. View the raw message.
PATCH 6/8 target/avr: Add limited support for USART and 16 bit timer peripherals
In reply to Sarah HarrisThese were designed to facilitate testing but should provide enough function to be useful in other contexts.
Only a subset of the functions of each peripheral is implemented, mainly due to the lack of a standard way to handle electrical connections (like GPIO pins).
--- hw/char/Kconfig | 3 + hw/char/Makefile.objs | 1 + hw/char/avr_usart.c | 316 ++++++++++++++++++ hw/timer/Kconfig | 3 + hw/timer/Makefile.objs | 1 + hw/timer/avr_timer16.c | 587 +++++++++++++++++++++++++++++++++ include/hw/char/avr_usart.h | 99 ++++++ include/hw/timer/avr_timer16.h | 99 ++++++ 8 files changed, 1109 insertions(+) create mode 100644 hw/char/avr_usart.c create mode 100644 hw/timer/avr_timer16.c create mode 100644 include/hw/char/avr_usart.h create mode 100644 include/hw/timer/avr_timer16.h
hw/char/Kconfig +3 -0
@@ -40,3 +40,6 @@ config SCLPCONSOLE config TERMINAL3270 bool + +config AVR_USART + bool
hw/char/Makefile.objs +1 -0
@@ -20,6 +20,7 @@ obj-$(CONFIG_PSERIES) += spapr_vty.o obj-$(CONFIG_DIGIC) += digic-uart.o obj-$(CONFIG_STM32F2XX_USART) += stm32f2xx_usart.o obj-$(CONFIG_RASPI) += bcm2835_aux.o +obj-$(CONFIG_AVR_USART) += avr_usart.o common-obj-$(CONFIG_CMSDK_APB_UART) += cmsdk-apb-uart.o common-obj-$(CONFIG_ETRAXFS) += etraxfs_ser.o
hw/char/avr_usart.c new file +316 -0
316 lines not on this page · raw message
hw/timer/Kconfig +3 -0
@@ -61,3 +61,6 @@ config CMSDK_APB_TIMER config CMSDK_APB_DUALTIMER bool select PTIMER + +config AVR_TIMER16 + bool
hw/timer/Makefile.objs +1 -0
@@ -35,6 +35,7 @@ obj-$(CONFIG_PXA2XX) += pxa2xx_timer.o obj-$(CONFIG_SH4) += sh_timer.o obj-$(CONFIG_DIGIC) += digic-timer.o obj-$(CONFIG_MIPS_CPS) += mips_gictimer.o +obj-$(CONFIG_AVR_TIMER16) += avr_timer16.o obj-$(CONFIG_MC146818RTC) += mc146818rtc.o
hw/timer/avr_timer16.c new file +587 -0
587 lines not on this page · raw message
include/hw/char/avr_usart.h new file +99 -0
99 lines not on this page · raw message
include/hw/timer/avr_timer16.h new file +99 -0
99 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH 7/8 target/avr: Add example board configuration
In reply to Sarah HarrisA simple board setup that configures an AVR CPU to run a given firmware image.
This is all that's useful to implement without peripheral emulation as AVR CPUs include a lot of on-board peripherals.
--- hw/Kconfig | 1 + hw/avr/Kconfig | 4 + hw/avr/Makefile.objs | 1 + hw/avr/sample.c | 177 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 183 insertions(+) create mode 100644 hw/avr/Kconfig create mode 100644 hw/avr/Makefile.objs create mode 100644 hw/avr/sample.c
hw/Kconfig +1 -0
@@ -41,6 +41,7 @@ source watchdog/Kconfig # arch Kconfig source arm/Kconfig source alpha/Kconfig +source avr/Kconfig source cris/Kconfig source hppa/Kconfig source i386/Kconfig
hw/avr/Kconfig new file +4 -0
@@ -0,0 +1,4 @@ +config AVR_SAMPLE + bool + select AVR_TIMER16 + select AVR_USART
hw/avr/Makefile.objs new file +1 -0
@@ -0,0 +1 @@ +obj-y += sample.o
hw/avr/sample.c new file +177 -0
177 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH 8/8 target/avr: Register AVR support with the rest of QEMU, the build system, and the MAINTAINERS file
In reply to Sarah Harris--- MAINTAINERS | 6 ++++++ arch_init.c | 2 ++ configure | 6 ++++++ default-configs/avr-softmmu.mak | 5 +++++ include/disas/dis-asm.h | 6 ++++++ include/sysemu/arch_init.h | 1 + qapi/common.json | 2 +- target/avr/Makefile.objs | 23 +++++++++++++++++++++++ tests/machine-none-test.c | 1 + 9 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 default-configs/avr-softmmu.mak create mode 100644 target/avr/Makefile.objs
MAINTAINERS +6 -0
@@ -162,6 +162,12 @@ S: Maintained F: hw/arm/smmu* F: include/hw/arm/smmu* +AVR +M: Michael Rolnik <[email protected]> +S: Odd Fixes +F: target-avr/ +F: hw/avr/ + CRIS M: Edgar E. Iglesias <[email protected]> S: Maintained
arch_init.c +2 -0
@@ -86,6 +86,8 @@ int graphic_depth = 32;#define QEMU_ARCH QEMU_ARCH_UNICORE32#elif defined(TARGET_XTENSA )#define QEMU_ARCH QEMU_ARCH_XTENSA +#elif defined(TARGET_AVR ) +#define QEMU_ARCH QEMU_ARCH_AVR#endif const uint32_t arch_type =QEMU_ARCH ;
configure +6 -0
@@ -7451,6 +7451,9 @@ case "$target_name" in target_compiler=$cross_cc_aarch64 eval "target_compiler_cflags=\$cross_cc_cflags_${target_name}" ;; + avr) + target_compiler=$cross_cc_avr + ;; cris) target_compiler=$cross_cc_cris ;;
@@ -7726,6 +7729,9 @@ for i in $ARCH $TARGET_BASE_ARCH ; do disas_config "ARM_A64" fi ;; + avr) + disas_config "AVR" + ;; cris) disas_config "CRIS" ;;
default-configs/avr-softmmu.mak new file +5 -0
@@ -0,0 +1,5 @@ +# Default configuration for avr-softmmu + +# Boards: +# +CONFIG_AVR_SAMPLE=y
include/disas/dis-asm.h +6 -0
@@ -211,6 +211,12 @@ enum bfd_architecture#define bfd_mach_m32r 0/* backwards compatibility */ bfd_arch_mn10200, /* Matsushita MN10200 */ bfd_arch_mn10300, /* Matsushita MN10300 */ + bfd_arch_avr, /* Atmel AVR microcontrollers. */ +#define bfd_mach_avr1 1 +#define bfd_mach_avr2 2 +#define bfd_mach_avr3 3 +#define bfd_mach_avr4 4 +#define bfd_mach_avr5 5 bfd_arch_cris, /* Axis CRIS */#define bfd_mach_cris_v0_v10 255#define bfd_mach_cris_v32 32
include/sysemu/arch_init.h +1 -0
@@ -25,6 +25,7 @@ enum {QEMU_ARCH_NIOS2 = (1 <<17 ),QEMU_ARCH_HPPA = (1 <<18 ),QEMU_ARCH_RISCV = (1 <<19 ), + QEMU_ARCH_AVR = (1 << 20), };extern const uint32_t arch_type;
qapi/common.json +1 -1
@@ -187,7 +187,7 @@ # Since: 3.0 ## { 'enum' : 'SysEmuTarget', - 'data' : [ 'aarch64', 'alpha', 'arm', 'cris', 'hppa', 'i386', 'lm32', + 'data' : [ 'aarch64', 'alpha', 'arm', 'avr', 'cris', 'hppa', 'i386', 'lm32', 'm68k', 'microblaze', 'microblazeel', 'mips', 'mips64', 'mips64el', 'mipsel', 'moxie', 'nios2', 'or1k', 'ppc', 'ppc64', 'riscv32', 'riscv64', 's390x', 'sh4',
target/avr/Makefile.objs new file +23 -0
@@ -0,0 +1,23 @@ +# +# QEMU AVR CPU +# +# Copyright (c) 2016 Michael Rolnik +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, see +# <http://www.gnu.org/licenses/lgpl-2.1.html> +# + +obj-y += translate.o cpu.o helper.o decode.o +obj-y += gdbstub.o +obj-$(CONFIG_SOFTMMU) += machine.o
tests/machine-none-test.c +1 -0
@@ -27,6 +27,7 @@ static struct arch2cpu cpus_map[] = {/* tested targets list */ { "arm", "cortex-a15" }, { "aarch64", "cortex-a57" }, + { "avr", "avr6" }, { "x86_64", "qemu64,apic-id=0" }, { "i386", "qemu32,apic-id=0" }, { "alpha", "ev67" },
Signature · 1 line
2.21.0
Re: [Qemu-devel] [PATCH v1 8/8] target/avr: Register AVR support with the rest of QEMU, the build system, and the MAINTAINERS file
Quoted 1 line · Sarah Harris
Signed-off-by Sarah Harris <[email protected]>
...
MAINTAINERS S: Maintained · line 170
Quoted 7 lines
MAINTAINERS +6
-0+AVR +M: Michael Rolnik <[email protected]> +S: Odd Fixes +F: target-avr/ +F: hw/avr/ +
This is not how things work. Michael wasn't up to maintaining the code 2 years ago; that's why it was never committed.
You would need to maintain this yourself, and for more than "Odd Fixes".
r~
Re: [Qemu-devel] [PATCH v1 8/8] target/avr: Register AVR support with the rest of QEMU, the build system, and the MAINTAINERS file
Hi Richard.
I can maintain it
Sent from my cell phone, please ignore typos
Quoted 20 lines · Richard Henderson
Quoted 1 line · Sarah Harris
Signed-off-by Sarah Harris <[email protected]>...
MAINTAINERS S: Maintained · line 170
Quoted 7 lines
MAINTAINERS +6
-0+AVR +M: Michael Rolnik <[email protected]> +S: Odd Fixes +F: target-avr/ +F: hw/avr/ +This is not how things work. Michael wasn't up to maintaining the code 2 years
ago; that's why it was never committed.You would need to maintain this yourself, and for more than "Odd Fixes".
r~
Re: [Qemu-devel] [PATCH v1 8/8] target/avr: Register AVR support with the rest of QEMU, the build system, and the MAINTAINERS file
Hi Richard,
I've raised this with my colleagues, we'll discuss tomorrow whether we have the funding and person resources to provide maintenance and get back to you.
I've noted the issues you and Eric raised, I'll wait until I know where things are going before I look at fixing them.
Kind regards,
Sarah Harris
Quoted 29 lines · On Sun, 5 May 2019 09:10:00 -0700 Michael Rolnik <[email protected]> wrote:
Hi Richard.
I can maintain it
Sent from my cell phone, please ignore typos
Quoted 20 lines · Richard Henderson
Quoted 1 line · Sarah Harris
Signed-off-by Sarah Harris <[email protected]>...
MAINTAINERS S: Maintained · line 170
Quoted 7 lines
MAINTAINERS +6
-0+AVR +M: Michael Rolnik <[email protected]> +S: Odd Fixes +F: target-avr/ +F: hw/avr/ +This is not how things work. Michael wasn't up to maintaining the code 2 years
ago; that's why it was never committed.You would need to maintain this yourself, and for more than "Odd Fixes".
r~
Re: [Qemu-devel] [PATCH v1 8/8] target/avr: Register AVR support with the rest of QEMU, the build system, and the MAINTAINERS file
In reply to Michael RolnikHi Richard,
Having discussed with my colleagues, we don't have the resources to maintain this.
If you wanted to take up Michael's offer then I'm happy to respond to queries and provide minor fixes. Otherwise, we will make our repository publicly available in the near future for anyone who wants to use it.
Kind regards,
Sarah Harris
Quoted 29 lines · On Sun, 5 May 2019 09:10:00 -0700 Michael Rolnik <[email protected]> wrote:
Hi Richard.
I can maintain it
Sent from my cell phone, please ignore typos
Quoted 20 lines · Richard Henderson
Quoted 1 line · Sarah Harris
Signed-off-by Sarah Harris <[email protected]>...
MAINTAINERS S: Maintained · line 170
Quoted 7 lines
MAINTAINERS +6
-0+AVR +M: Michael Rolnik <[email protected]> +S: Odd Fixes +F: target-avr/ +F: hw/avr/ +This is not how things work. Michael wasn't up to maintaining the code 2 years
ago; that's why it was never committed.You would need to maintain this yourself, and for more than "Odd Fixes".
r~
Re: [Qemu-devel] [PATCH v1 8/8] target/avr: Register AVR support with the rest of QEMU, the build system, and the MAINTAINERS file
Hi Sarah,
Quoted 5 lines · Sarah Harris
Hi Richard,
Having discussed with my colleagues, we don't have the resources to maintain this.
If you wanted to take up Michael's offer then I'm happy to respond to queries and provide minor fixes. Otherwise, we will make our repository publicly available in the near future for anyone who wants to use it.
Would you agree to be listed as reviewer for AVR (Michael being the maintainer)?
M: Mail patches to: FullName <address@domain>
Maintainers are looking after a certain area and must be CCed on patches. They are considered the main contact point.
R: Designated reviewer: FullName <address@domain>
These reviewers should be CCed on patches.
Reviewers are familiar with the subject matter and provide feedback even though they are not maintainers.
Quoted 36 lines
Kind regards,
Sarah HarrisQuoted 29 lines · On Sun, 5 May 2019 09:10:00 -0700 Michael Rolnik <[email protected]> wrote:
Hi Richard.
I can maintain it
Sent from my cell phone, please ignore typos
Quoted 20 lines · Richard Henderson
Quoted 1 line · Sarah Harris
Signed-off-by Sarah Harris <[email protected]>...
MAINTAINERS S: Maintained · line 170
Quoted 7 lines
MAINTAINERS +6
-0+AVR +M: Michael Rolnik <[email protected]> +S: Odd Fixes +F: target-avr/ +F: hw/avr/ +This is not how things work. Michael wasn't up to maintaining the code 2 years
ago; that's why it was never committed.You would need to maintain this yourself, and for more than "Odd Fixes".
r~
Re: [Qemu-devel] [PATCH v1 8/8] target/avr: Register AVR support with the rest of QEMU, the build system, and the MAINTAINERS file
12.10.2019. 09.31, "Philippe Mathieu-Daudé" <[email protected]> је написао/ла:
Quoted 9 lines
Hi Sarah,
Quoted 4 lines · Sarah Harris
Hi Richard,
Having discussed with my colleagues, we don't have the resources to
maintain this.
Quoted 1 line
Quoted 1 line
If you wanted to take up Michael's offer then I'm happy to respond to
queries and provide minor fixes.
Quoted 1 line
Quoted 1 line
Otherwise, we will make our repository publicly available in the near
future for anyone who wants to use it.
Quoted 3 lines
Would you agree to be listed as reviewer for AVR (Michael being the
maintainer)?
Quoted 1 line
I support this idea, and hopefully Sarah agrees. Reviewer role typically require mucj less tome resources.
Quoted 22 lines
M: Mail patches to: FullName <address@domain>
Maintainers are looking after a certain area and must be CCed on patches. They are considered the main contact point.
R: Designated reviewer: FullName <address@domain>
These reviewers should be CCed on patches.
Reviewers are familiar with the subject matter and provide feedback even though they are not maintainers.Quoted 13 lines
Kind regards,
Sarah HarrisQuoted 7 lines · On Sun, 5 May 2019 09:10:00 -0700 Michael Rolnik <[email protected]> wrote:
Hi Richard.
I can maintain it
Sent from my cell phone, please ignore typos
On Sun, May 5, 2019, 8:57 AM Richard Henderson <
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 7 lines · wrote:
Quoted 2 lines · Sarah Harris
Signed-off-by Sarah Harris <[email protected]>...
Quoted 2 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
MAINTAINERS S: Maintained · line 170
Quoted 6 lines
MAINTAINERS +6
-0+AVR +M: Michael Rolnik <[email protected]> +S: Odd Fixes +F: target-avr/ +F: hw/avr/ +This is not how things work. Michael wasn't up to maintaining the
code 2
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
years
ago; that's why it was never committed.You would need to maintain this yourself, and for more than "Odd
Fixes".
Quoted 7 lines
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
r~
Re: [Qemu-devel] [PATCH v1 8/8] target/avr: Register AVR support with the rest of QEMU, the build system, and the MAINTAINERS file
In reply to Philippe Mathieu-DaudéHi Philippe,
I've checked and yes, I can make time to review patches.
This is part of my current paid work, so when my contract eventually ends I will likely have to step down as reviewer. I'll have notice of that happening some time before, so I can pass that along when it comes.
This message comes from my work email so the details should be correct, i.e. Sarah Harris <[email protected]>
Kind regards,
Sarah Harris
Quoted 57 lines · On Sat, 12 Oct 2019 09:31:07 +0200 Philippe Mathieu-Daudé <[email protected]>…
Hi Sarah,
Quoted 5 lines · Sarah Harris
Hi Richard,
Having discussed with my colleagues, we don't have the resources to maintain this.
If you wanted to take up Michael's offer then I'm happy to respond to queries and provide minor fixes. Otherwise, we will make our repository publicly available in the near future for anyone who wants to use it.Would you agree to be listed as reviewer for AVR (Michael being the maintainer)?
M: Mail patches to: FullName <address@domain>
Maintainers are looking after a certain area and must be CCed on patches. They are considered the main contact point.
R: Designated reviewer: FullName <address@domain>
These reviewers should be CCed on patches.
Reviewers are familiar with the subject matter and provide feedback even though they are not maintainers.Quoted 36 lines
Kind regards,
Sarah HarrisQuoted 29 lines · On Sun, 5 May 2019 09:10:00 -0700 Michael Rolnik <[email protected]> wrote:
Hi Richard.
I can maintain it
Sent from my cell phone, please ignore typos
Quoted 20 lines · Richard Henderson
Quoted 1 line · Sarah Harris
Signed-off-by Sarah Harris <[email protected]>...
MAINTAINERS S: Maintained · line 170
Quoted 7 lines
MAINTAINERS +6
-0+AVR +M: Michael Rolnik <[email protected]> +S: Odd Fixes +F: target-avr/ +F: hw/avr/ +This is not how things work. Michael wasn't up to maintaining the code 2 years
ago; that's why it was never committed.You would need to maintain this yourself, and for more than "Odd Fixes".
r~
Re: [Qemu-devel] [PATCH v1 8/8] target/avr: Register AVR support with the rest of QEMU, the build system, and the MAINTAINERS file
In reply to Sarah Harrisqapi/common.json line 193
Quoted 13 lines · Sarah Harris
Signed-off-by Sarah Harris <[email protected]>---
+++
b/qapi/common.jsonqapi/common.json +1
-1@@ -187,7 +187,7 @@ # Since: 3.0 ## { 'enum' : 'SysEmuTarget', - 'data' : [ 'aarch64', 'alpha', 'arm', 'cris', 'hppa', 'i386', 'lm32', + 'data' : [ 'aarch64', 'alpha', 'arm', 'avr', 'cris', 'hppa', 'i386', 'lm32', 'm68k', 'microblaze', 'microblazeel', 'mips', 'mips64', 'mips64el', 'mipsel', 'moxie', 'nios2', 'or1k', 'ppc', 'ppc64', 'riscv32', 'riscv64', 's390x', 'sh4',
Missing documentation that the new 'avr' member is available only since 4.1.
target/avr/Makefile.objs line 4
Quoted 10 lines
target/avr/Makefile.objs new file +4
-0@@ -0,0 +1,23 @@ +# +# QEMU AVR CPU +# +# Copyright (c) 2016 Michael Rolnik
Do you want to also claim through 2019?
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Re: [Qemu-devel] [PATCH v1 8/8] target/avr: Register AVR support with the rest of QEMU, the build system, and the MAINTAINERS file
Yes
Sent from my cell phone, please ignore typos
Quoted 38 lines · Eric Blake
qapi/common.json line 190
Quoted 10 lines · Sarah Harris
Signed-off-by Sarah Harris <[email protected]>---
+++
b/qapi/common.jsonqapi/common.json +1
-1@@ -187,7 +187,7 @@ # Since: 3.0 ## { 'enum' : 'SysEmuTarget', - 'data' : [ 'aarch64', 'alpha', 'arm', 'cris', 'hppa', 'i386', 'lm32', + 'data' : [ 'aarch64', 'alpha', 'arm', 'avr', 'cris', 'hppa', 'i386','lm32',
qapi/common.json line 193
Quoted 3 lines
qapi/common.json +0
-0'm68k', 'microblaze', 'microblazeel', 'mips', 'mips64', 'mips64el', 'mipsel', 'moxie', 'nios2', 'or1k', 'ppc', 'ppc64', 'riscv32', 'riscv64', 's390x', 'sh4',Missing documentation that the new 'avr' member is available only since 4.1.
target/avr/Makefile.objs line 4
Quoted 10 lines
target/avr/Makefile.objs new file +4
-0@@ -0,0 +1,23 @@ +# +# QEMU AVR CPU +# +# Copyright (c) 2016 Michael RolnikDo you want to also claim through 2019?
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org