Make CPU and memory thread-safe

This commit is contained in:
2023-10-08 16:50:57 +02:00
parent c878dee7e0
commit f2c573bfc6
5 changed files with 29 additions and 11 deletions

View File

@@ -2,8 +2,10 @@
#include "vriscv.h"
uint8_t* memory;
pthread_mutex_t memory_mutex;
void mem_init()
{
memory = malloc(memory_size);
pthread_mutex_init(&memory_mutex, 0);
}

View File

@@ -2,8 +2,10 @@
#define MEMORY_H
#include <stdint.h>
#include <pthread.h>
extern uint8_t* memory;
extern pthread_mutex_t memory_mutex;
void mem_init();