Mmuhack As Kernel Module


How to apply? Modprobe or insmod?
Code:
	if(bOpen2X)
	{
		printf("On Open2X modprobing mmuhack.o\n");
		system("/sbin/modprobe mmuhack");
	}
	else
	{
		//Try to apply MMU hack.
		int mmufd = open("/dev/mmuhack", O_RDWR);
		if(mmufd < 0)
		{
			system("/sbin/insmod mmuhack.o");
			mmufd = open("/dev/mmuhack", O_RDWR);
		}
		if(mmufd < 0)
		{
			printf("MMU hack failed\n");
		}
		else
		{
			close(mmufd);
		}
	}
 
i've downloaded mame4all source - http://www.talfi.net/gp32_franxis/ . check warm.h/c(pp?) files how to use the module. afaik insmod is used.
 
For just making framebuffer bufferable mmuhack might be easier and simpler, KungPhoo's code should be fine. wARM only offers more control.
 
question - i'm trying to use mmuhack in combination with 'my' GL virtual framebuffer lib, but i get frequent freezes. should i use wARM? if yes, any hints how to use it? i don't have a clue what "WCB_C_BIT" or "WCB_B_BIT" is and more :)
 
crow_riot said:
question - i'm trying to use mmuhack in combination with 'my' GL virtual framebuffer lib, but i get frequent freezes. should i use wARM? if yes, any hints how to use it? i don't have a clue what "WCB_C_BIT" or "WCB_B_BIT" is and more :)
Depends on what it does. Does it mmap stuff? If it doesn't, you don't need wARM (and mmuhack too, really).

If you mmap, and only write to that buffer, make memory bufferable:
Code:
buffer = mmap(0, size, ...
warm_change_cb_range(WCB_B_BIT, 1, buffer, size);

If you mmap and read a lot from that buffer, mabe it cacheable:
Code:
buffer = mmap(0, size, ...
warm_change_cb_range(WCB_C_BIT, 1, buffer, size);

For both you can use WCB_B_BIT|WCB_C_BIT.

If you set WCB_C_BIT and want that memory to be read by something else than CPU (display, 3d hardware), you have to clean CPU cache (write cache contents to memory) before sending command to hardware:
Code:
warm_cache_op_range(WOP_D_CLEAN, buffer, size);
 
Last edited by a moderator:
Back
Top