Description: Fix GCC 15 build failures from pointer type mismatches
 read_mi_regs()/write_mi_regs() now take a "void *" first argument to match
 the memory_rd_function/memory_wr_function function-pointer types used by
 the bus controller, consistent with every other register accessor.
 cen64_thread_setname() now takes the thread handle by value instead of by
 pointer, matching its callers and the pthread_setname_np(3) contract.
Author: tangxiaofeng <tangxiaofeng@kylinos.cn>
Forwarded: not-needed
Last-Update: 2026-08-31

--- cen64-0.3+git20200723.orig/cen64.c
+++ cen64-0.3+git20200723/cen64.c
@@ -448,7 +448,7 @@ int run_device(struct cen64_device *devi
 }
 
 CEN64_THREAD_RETURN_TYPE run_device_thread(void *opaque) {
-  cen64_thread_setname(NULL, "device");
+  cen64_thread_setname(0, "device");
   struct cen64_device *device = (struct cen64_device *) opaque;
 
   device_run(device);
--- cen64-0.3+git20200723.orig/device/device.c
+++ cen64-0.3+git20200723/device/device.c
@@ -223,7 +223,7 @@ CEN64_THREAD_RETURN_TYPE run_rcp_thread(
 }
 
 CEN64_THREAD_RETURN_TYPE run_vr4300_thread(void *opaque) {
-  cen64_thread_setname(NULL, "vr4300");
+  cen64_thread_setname(0, "vr4300");
   struct cen64_device *device = (struct cen64_device *) opaque;
 
   while (likely(device->running)) {
--- cen64-0.3+git20200723.orig/os/posix/thread.h
+++ cen64-0.3+git20200723/os/posix/thread.h
@@ -45,9 +45,9 @@ static inline int cen64_thread_join(cen6
 #ifdef __APPLE__
 int pthread_setname_np(const char*);
 #elif __NETBSD__
-int pthread_setname_np(cen64_thread*, const char*, const char*);
+int pthread_setname_np(cen64_thread, const char*, const char*);
 #else
-int pthread_setname_np(cen64_thread*, const char*);
+int pthread_setname_np(cen64_thread, const char*);
 #endif
 
 // Sets the name of the thread to a specific value
@@ -56,15 +56,15 @@ int pthread_setname_np(cen64_thread*, co
 // If you call it at the wrong time or your OS doesn't support custom thread names
 // the return value will be non-zero.
 // If cen64_thread is not set the name of the current thread will be changed.
-static inline int cen64_thread_setname(cen64_thread *t, const char *name) {
+static inline int cen64_thread_setname(cen64_thread t, const char *name) {
   #ifdef __APPLE__
-    if (t == NULL)
+    if (t == 0)
       return pthread_setname_np(name);
   #elif __NETBSD__
-    if (t != NULL)
+    if (t != 0)
       return pthread_setname_np(t, "%s", name);
   #else
-    if (t != NULL)
+    if (t != 0)
       return pthread_setname_np(t, name);
   #endif
 
--- cen64-0.3+git20200723.orig/vr4300/interface.c
+++ cen64-0.3+git20200723/vr4300/interface.c
@@ -88,7 +88,8 @@ void signal_rcp_interrupt(struct vr4300
 }
 
 // Reads a word from the MI MMIO register space.
-int read_mi_regs(struct vr4300 *vr4300, uint32_t address, uint32_t *word) {
+int read_mi_regs(void *opaque, uint32_t address, uint32_t *word) {
+  struct vr4300 *vr4300 = (struct vr4300 *) opaque;
   uint32_t offset = address - MI_REGS_BASE_ADDRESS;
   enum mi_register reg = (offset >> 2);
 
@@ -98,7 +99,8 @@ int read_mi_regs(struct vr4300 *vr4300,
 }
 
 // Writes a word to the MI MMIO register space.
-int write_mi_regs(struct vr4300 *vr4300, uint32_t address, uint32_t word, uint32_t dqm) {
+int write_mi_regs(void *opaque, uint32_t address, uint32_t word, uint32_t dqm) {
+  struct vr4300 *vr4300 = (struct vr4300 *) opaque;
   uint32_t offset = address - MI_REGS_BASE_ADDRESS;
   enum mi_register reg = (offset >> 2);
   uint32_t result;
--- cen64-0.3+git20200723.orig/vr4300/interface.h
+++ cen64-0.3+git20200723/vr4300/interface.h
@@ -39,8 +39,8 @@ cen64_cold void vr4300_cycle_extra(struc
 uint64_t vr4300_get_register(struct vr4300 *vr4300, size_t i);
 uint64_t vr4300_get_pc(struct vr4300 *vr4300);
 
-int read_mi_regs(struct vr4300 *vr4300, uint32_t address, uint32_t *word);
-int write_mi_regs(struct vr4300 *vr4300, uint32_t address, uint32_t word, uint32_t dqm);
+int read_mi_regs(void *opaque, uint32_t address, uint32_t *word);
+int write_mi_regs(void *opaque, uint32_t address, uint32_t word, uint32_t dqm);
 
 void clear_rcp_interrupt(struct vr4300 *vr4300, enum rcp_interrupt_mask mask);
 void signal_rcp_interrupt(struct vr4300 *vr4300, enum rcp_interrupt_mask mask);
