OSDN Git Service

deallocate shared memory after using it.
authorastoria-d <astoria-d@mail.goo.ne.jp>
Wed, 27 Mar 2013 06:24:55 +0000 (15:24 +0900)
committerastoria-d <astoria-d@mail.goo.ne.jp>
Wed, 27 Mar 2013 06:24:55 +0000 (15:24 +0900)
emulator/cpu.c
emulator/ppu.c
emulator/ppucore/vram.c
libs/vgashm.c

index f146251..ec6a139 100644 (file)
@@ -305,8 +305,8 @@ int init_cpu(void) {
     cpu_addr_buffer = 0;
 
     d1_set(debug_mode);
-    d2_set(debug_mode);
-    d3_set(debug_mode);
+    d2_set(FALSE);
+    d3_set(FALSE);
 
     return TRUE;
 }
index 3952a19..6f6048c 100644 (file)
@@ -11,6 +11,7 @@
 void set_vga_base(unsigned char* base);
 void *vga_shm_get(void);
 void vga_shm_free(void* addr);
+void vga_shm_remove(void);
 void release_bus(void);
 
 struct ppu_cpu_pin {
@@ -151,6 +152,7 @@ int init_ppu(void) {
 void clean_ppu(void) {
     clean_ppucore();
     vga_shm_free(vga_shared_buf);
+    vga_shm_remove();
 }
 
 
index 634d75c..fe0bb7b 100644 (file)
@@ -498,7 +498,8 @@ int vram_init(void) {
     memset(bg_palette_tbl, 0, PALETTE_TBL_SIZE);
     memset(spr_palette_tbl, 0, PALETTE_TBL_SIZE);
 
-    d4_set(debug_mode);
+    //d4_set(debug_mode);
+    d4_set(FALSE);
 
     return TRUE;
 }
index c554374..ee08947 100644 (file)
@@ -6,10 +6,11 @@
 #include "tools.h"
 #include "vga.h"
 
+static int   shmid;
+
 void *vga_shm_get(void) {
     void* ret;
     key_t key;
-    int   shmid;
 
     //create shared memory
     key = ftok(VGA_SHM, VGA_SHM_PRJ_ID);
@@ -44,3 +45,7 @@ void vga_shm_free(void* addr) {
     shmdt(addr);
 }
 
+void vga_shm_remove(void) {
+    shmctl(shmid, IPC_RMID, 0);
+}
+