1
0
Fork 0
mirror of https://github.com/pnx/m16vm synced 2026-06-22 10:03:40 +02:00

mm: change variable name from "memory" to "mm_base_addr"

This commit is contained in:
Henrik Hautakoski 2019-04-26 13:30:26 +02:00
parent e92b7ee551
commit 76a72e6857
No known key found for this signature in database
GPG key ID: 839F3A7EAFAEAFAA
3 changed files with 9 additions and 9 deletions

14
vm/mm.c
View file

@ -27,13 +27,13 @@
#endif
// Get a WORD aligned (16-bit) address.
// Casts the 8-bit pointer (memory) to 16-bit (WORD) and add offset.
// Casts the 8-bit pointer (mm_base_addr) to 16-bit (WORD) and add offset.
#define addr_align_word(offset) \
(((uint16_t*) memory) + (offset))
(((uint16_t*) mm_base_addr) + (offset))
#define EXCEPTION_STRING "Runtime exception: Memory address '%u' is out of bounds.\n"
uint8_t *memory = NULL;
uint8_t *mm_base_addr = NULL;
#define __check_bounds(addr) \
if ((addr) + 1 > MEM_SIZE) { \
@ -43,14 +43,14 @@ uint8_t *memory = NULL;
void mm_init() {
memory = (uint8_t*) malloc(MEM_SIZE);
mm_base_addr = (uint8_t*) malloc(MEM_SIZE);
}
void mm_exit() {
if (memory) {
free(memory);
memory = NULL;
if (mm_base_addr) {
free(mm_base_addr);
mm_base_addr = NULL;
}
}