mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-07-08 12:29:01 +00:00
- added fbdev video code and SPARC assembly optimizations
This commit is contained in:
parent
7177cea47d
commit
4c0aab3113
@ -16,6 +16,8 @@ V0.7 -
|
|||||||
[Giacomo Magnini]
|
[Giacomo Magnini]
|
||||||
- Unix: compilation of cpuemu.cpp is now split in 8 parts
|
- Unix: compilation of cpuemu.cpp is now split in 8 parts
|
||||||
- Unix: volume list in GTK prefs editor is reorderable
|
- Unix: volume list in GTK prefs editor is reorderable
|
||||||
|
- Unix: added fbdev DGA support and SPARC assembly optimizations to
|
||||||
|
UAE core [Gwenole Beauchesne]
|
||||||
|
|
||||||
V0.7 (release 0.7-2) - 6.Oct.1999
|
V0.7 (release 0.7-2) - 6.Oct.1999
|
||||||
- Added BasiliskII.spec for making RPMs [with assistance from
|
- Added BasiliskII.spec for making RPMs [with assistance from
|
||||||
|
@ -607,6 +607,9 @@ Contributions by:
|
|||||||
- Bill Huey <billh@mag.ucsd.edu>: 15/16 bit DGA and 15/16/32 bit X11
|
- Bill Huey <billh@mag.ucsd.edu>: 15/16 bit DGA and 15/16/32 bit X11
|
||||||
window support
|
window support
|
||||||
- David Lawrence <davidl@jlab.org>: incremental window refresh code
|
- David Lawrence <davidl@jlab.org>: incremental window refresh code
|
||||||
|
- Gwenole Beauchesne <gb@dial.oleane.com>: SPARC assembly optimizations and
|
||||||
|
fbdev video code
|
||||||
|
- and others...
|
||||||
|
|
||||||
Special thanks to:
|
Special thanks to:
|
||||||
- Bernd Schmidt for letting me use his UAE 68k emulation
|
- Bernd Schmidt for letting me use his UAE 68k emulation
|
||||||
|
@ -67,11 +67,13 @@ install: $(APP)
|
|||||||
-$(INSTALL_DATA) $(APP).1 $(man1dir)/$(APP).1
|
-$(INSTALL_DATA) $(APP).1 $(man1dir)/$(APP).1
|
||||||
$(INSTALL) -d $(datadir)/$(APP)
|
$(INSTALL) -d $(datadir)/$(APP)
|
||||||
$(INSTALL_DATA) keycodes $(datadir)/$(APP)/keycodes
|
$(INSTALL_DATA) keycodes $(datadir)/$(APP)/keycodes
|
||||||
|
$(INSTALL_DATA) fbdevices $(datadir)/$(APP)/fbdevices
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
rm -f $(bindir)/$(APP)
|
rm -f $(bindir)/$(APP)
|
||||||
rm -f $(man1dir)/$(APP).1
|
rm -f $(man1dir)/$(APP).1
|
||||||
rm -f $(datadir)/$(APP)/keycodes
|
rm -f $(datadir)/$(APP)/keycodes
|
||||||
|
rm -f $(datadir)/$(APP)/fbdevices
|
||||||
rmdir $(datadir)/$(APP)
|
rmdir $(datadir)/$(APP)
|
||||||
|
|
||||||
mostlyclean:
|
mostlyclean:
|
||||||
|
610
BasiliskII/src/Unix/Solaris/sparcasm.h
Normal file
610
BasiliskII/src/Unix/Solaris/sparcasm.h
Normal file
@ -0,0 +1,610 @@
|
|||||||
|
#ifndef SPARC_ASSEMBLY__HEADER
|
||||||
|
#define SPARC_ASSEMBLY__HEADER
|
||||||
|
|
||||||
|
#ifdef SPARC_V8_ASSEMBLY
|
||||||
|
|
||||||
|
static inline char *str_flags(void)
|
||||||
|
{
|
||||||
|
static char str[8];
|
||||||
|
sprintf(str, "%c%c%c%c%c",
|
||||||
|
GET_XFLG ? 'X' : '-',
|
||||||
|
GET_NFLG ? 'N' : '-',
|
||||||
|
GET_ZFLG ? 'Z' : '-',
|
||||||
|
GET_VFLG ? 'V' : '-',
|
||||||
|
GET_CFLG ? 'C' : '-'
|
||||||
|
);
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uae_u32 sparc_v8_flag_add_8(flag_struct *flags, uae_u32 src, uae_u32 dst)
|
||||||
|
{
|
||||||
|
uae_u32 value;
|
||||||
|
__asm__ ("\n"
|
||||||
|
" sll %2, 24, %%o0\n"
|
||||||
|
" sll %3, 24, %%o1\n"
|
||||||
|
" addcc %%o0, %%o1, %%o0\n"
|
||||||
|
" addx %%g0, %%g0, %%o1 ! X,C flags\n"
|
||||||
|
" srl %%o0, 24, %0\n"
|
||||||
|
" stb %%o1, [%1 + 1]\n"
|
||||||
|
" bl,a .+8\n"
|
||||||
|
" or %%o1, 0x08, %%o1 ! N flag\n"
|
||||||
|
" bz,a .+8\n"
|
||||||
|
" or %%o1, 0x04, %%o1 ! Z flag\n"
|
||||||
|
" bvs,a .+8\n"
|
||||||
|
" or %%o1, 0x02, %%o1 ! V flag\n"
|
||||||
|
" stb %%o1, [%1]\n"
|
||||||
|
: "=&r" (value)
|
||||||
|
: "r" (flags), "r" (dst), "r" (src)
|
||||||
|
: "cc", "o0", "o1"
|
||||||
|
);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uae_u32 sparc_v8_flag_add_16(flag_struct *flags, uae_u32 src, uae_u32 dst)
|
||||||
|
{
|
||||||
|
uae_u32 value;
|
||||||
|
__asm__ ("\n"
|
||||||
|
" sll %2, 16, %%o0\n"
|
||||||
|
" sll %3, 16, %%o1\n"
|
||||||
|
" addcc %%o0, %%o1, %%o0\n"
|
||||||
|
" addx %%g0, %%g0, %%o1 ! X,C flags\n"
|
||||||
|
" srl %%o0, 16, %0\n"
|
||||||
|
" stb %%o1, [%1 + 1]\n"
|
||||||
|
" bl,a .+8\n"
|
||||||
|
" or %%o1, 0x08, %%o1 ! N flag\n"
|
||||||
|
" bz,a .+8\n"
|
||||||
|
" or %%o1, 0x04, %%o1 ! Z flag\n"
|
||||||
|
" bvs,a .+8\n"
|
||||||
|
" or %%o1, 0x02, %%o1 ! V flag\n"
|
||||||
|
" stb %%o1, [%1]\n"
|
||||||
|
: "=&r" (value)
|
||||||
|
: "r" (flags), "r" (dst), "r" (src)
|
||||||
|
: "cc", "o0", "o1"
|
||||||
|
);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uae_u32 sparc_v8_flag_add_32(flag_struct *flags, uae_u32 src, uae_u32 dst)
|
||||||
|
{
|
||||||
|
uae_u32 value;
|
||||||
|
__asm__ ("\n"
|
||||||
|
" addcc %2, %3, %0\n"
|
||||||
|
" addx %%g0, %%g0, %%o0 ! X,C flags\n"
|
||||||
|
" stb %%o0, [%1 + 1]\n"
|
||||||
|
" bl,a .+8\n"
|
||||||
|
" or %%o0, 0x08, %%o0 ! N flag\n"
|
||||||
|
" bz,a .+8\n"
|
||||||
|
" or %%o0, 0x04, %%o0 ! Z flag\n"
|
||||||
|
" bvs,a .+8\n"
|
||||||
|
" or %%o0, 0x02, %%o0 ! V flag\n"
|
||||||
|
" stb %%o0, [%1]\n"
|
||||||
|
: "=&r" (value)
|
||||||
|
: "r" (flags), "r" (dst), "r" (src)
|
||||||
|
: "cc", "o0"
|
||||||
|
);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uae_u32 sparc_v8_flag_sub_8(flag_struct *flags, uae_u32 src, uae_u32 dst)
|
||||||
|
{
|
||||||
|
uae_u32 value;
|
||||||
|
__asm__ ("\n"
|
||||||
|
" sll %2, 24, %%o0\n"
|
||||||
|
" sll %3, 24, %%o1\n"
|
||||||
|
" subcc %%o0, %%o1, %%o0\n"
|
||||||
|
" addx %%g0, %%g0, %%o1 ! X,C flags\n"
|
||||||
|
" srl %%o0, 24, %0\n"
|
||||||
|
" stb %%o1, [%1 + 1]\n"
|
||||||
|
" bl,a .+8\n"
|
||||||
|
" or %%o1, 0x08, %%o1 ! N flag\n"
|
||||||
|
" bz,a .+8\n"
|
||||||
|
" or %%o1, 0x04, %%o1 ! Z flag\n"
|
||||||
|
" bvs,a .+8\n"
|
||||||
|
" or %%o1, 0x02, %%o1 ! V flag\n"
|
||||||
|
" stb %%o1, [%1]\n"
|
||||||
|
: "=&r" (value)
|
||||||
|
: "r" (flags), "r" (dst), "r" (src)
|
||||||
|
: "cc", "o0", "o1"
|
||||||
|
);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uae_u32 sparc_v8_flag_sub_16(flag_struct *flags, uae_u32 src, uae_u32 dst)
|
||||||
|
{
|
||||||
|
uae_u32 value;
|
||||||
|
__asm__ ("\n"
|
||||||
|
" sll %2, 16, %%o0\n"
|
||||||
|
" sll %3, 16, %%o1\n"
|
||||||
|
" subcc %%o0, %%o1, %%o0\n"
|
||||||
|
" addx %%g0, %%g0, %%o1 ! X,C flags\n"
|
||||||
|
" srl %%o0, 16, %0\n"
|
||||||
|
" stb %%o1, [%1 + 1]\n"
|
||||||
|
" bl,a .+8\n"
|
||||||
|
" or %%o1, 0x08, %%o1 ! N flag\n"
|
||||||
|
" bz,a .+8\n"
|
||||||
|
" or %%o1, 0x04, %%o1 ! Z flag\n"
|
||||||
|
" bvs,a .+8\n"
|
||||||
|
" or %%o1, 0x02, %%o1 ! V flag\n"
|
||||||
|
" stb %%o1, [%1]\n"
|
||||||
|
: "=&r" (value)
|
||||||
|
: "r" (flags), "r" (dst), "r" (src)
|
||||||
|
: "cc", "o0", "o1"
|
||||||
|
);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uae_u32 sparc_v8_flag_sub_32(flag_struct *flags, uae_u32 src, uae_u32 dst)
|
||||||
|
{
|
||||||
|
uae_u32 value;
|
||||||
|
__asm__ ("\n"
|
||||||
|
" subcc %2, %3, %0\n"
|
||||||
|
" addx %%g0, %%g0, %%o0 ! X,C flags\n"
|
||||||
|
" stb %%o0, [%1 + 1]\n"
|
||||||
|
" bl,a .+8\n"
|
||||||
|
" or %%o0, 0x08, %%o0 ! N flag\n"
|
||||||
|
" bz,a .+8\n"
|
||||||
|
" or %%o0, 0x04, %%o0 ! Z flag\n"
|
||||||
|
" bvs,a .+8\n"
|
||||||
|
" or %%o0, 0x02, %%o0 ! V flag\n"
|
||||||
|
" stb %%o0, [%1]\n"
|
||||||
|
: "=&r" (value)
|
||||||
|
: "r" (flags), "r" (dst), "r" (src)
|
||||||
|
: "cc", "o0"
|
||||||
|
);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void sparc_v8_flag_cmp_8(flag_struct *flags, uae_u32 src, uae_u32 dst)
|
||||||
|
{
|
||||||
|
__asm__ ("\n"
|
||||||
|
" sll %1, 24, %%o0\n"
|
||||||
|
" sll %2, 24, %%o1\n"
|
||||||
|
" subcc %%o0, %%o1, %%g0\n"
|
||||||
|
" addx %%g0, %%g0, %%o0 ! C flag\n"
|
||||||
|
" bl,a .+8\n"
|
||||||
|
" or %%o0, 0x08, %%o0 ! N flag\n"
|
||||||
|
" bz,a .+8\n"
|
||||||
|
" or %%o0, 0x04, %%o0 ! Z flag\n"
|
||||||
|
" bvs,a .+8\n"
|
||||||
|
" or %%o0, 0x02, %%o0 ! V flag\n"
|
||||||
|
" stb %%o0, [%0]\n"
|
||||||
|
: /* no outputs */
|
||||||
|
: "r" (flags), "r" (dst), "r" (src)
|
||||||
|
: "cc", "o0", "o1"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void sparc_v8_flag_cmp_16(flag_struct *flags, uae_u32 src, uae_u32 dst)
|
||||||
|
{
|
||||||
|
__asm__ ("\n"
|
||||||
|
" sll %1, 16, %%o0\n"
|
||||||
|
" sll %2, 16, %%o1\n"
|
||||||
|
" subcc %%o0, %%o1, %%g0\n"
|
||||||
|
" addx %%g0, %%g0, %%o0 ! C flag\n"
|
||||||
|
" bl,a .+8\n"
|
||||||
|
" or %%o0, 0x08, %%o0 ! N flag\n"
|
||||||
|
" bz,a .+8\n"
|
||||||
|
" or %%o0, 0x04, %%o0 ! Z flag\n"
|
||||||
|
" bvs,a .+8\n"
|
||||||
|
" or %%o0, 0x02, %%o0 ! V flag\n"
|
||||||
|
" stb %%o0, [%0]\n"
|
||||||
|
: /* no outputs */
|
||||||
|
: "r" (flags), "r" (dst), "r" (src)
|
||||||
|
: "cc", "o0", "o1"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void sparc_v8_flag_cmp_32(flag_struct *flags, uae_u32 src, uae_u32 dst)
|
||||||
|
{
|
||||||
|
__asm__ ("\n"
|
||||||
|
" subcc %1, %2, %%o1\n"
|
||||||
|
" srl %%o1, 31, %%o0\n"
|
||||||
|
" sll %%o0, 3, %%o0\n"
|
||||||
|
" addx %%o0, %%g0, %%o0\n"
|
||||||
|
" bvs,a .+8\n"
|
||||||
|
" or %%o0, 0x02, %%o0\n"
|
||||||
|
" subcc %%g0, %%o1, %%g0\n"
|
||||||
|
" addx %%g0, 7, %%o1\n"
|
||||||
|
" and %%o1, 0x04, %%o1\n"
|
||||||
|
" or %%o0, %%o1, %%o0\n"
|
||||||
|
" stb %%o0, [%0]\n"
|
||||||
|
: /* no outputs */
|
||||||
|
: "r" (flags), "r" (dst), "r" (src)
|
||||||
|
: "cc", "o0", "o1"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uae_u32 sparc_v8_flag_addx_8(flag_struct *flags, uae_u32 src, uae_u32 dst)
|
||||||
|
{
|
||||||
|
uae_u32 value;
|
||||||
|
__asm__ ("\n"
|
||||||
|
" ldub [%1 + 1], %%o1 ! Get the X Flag\n"
|
||||||
|
" subcc %%g0, %%o1, %%g0 ! Set the SPARC carry flag, if X set\n"
|
||||||
|
" addxcc %2, %3, %0\n"
|
||||||
|
: "=&r" (value)
|
||||||
|
: "r" (flags), "r" (dst), "r" (src)
|
||||||
|
: "cc", "o0", "o1"
|
||||||
|
);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
VERY SLOW...
|
||||||
|
static inline uae_u32 sparc_v8_flag_addx_8(flag_struct *flags, uae_u32 src, uae_u32 dst)
|
||||||
|
{
|
||||||
|
uae_u32 value;
|
||||||
|
__asm__ ("\n"
|
||||||
|
" sll %2, 24, %%o0\n"
|
||||||
|
" sll %3, 24, %%o1\n"
|
||||||
|
" addcc %%o0, %%o1, %%o0\n"
|
||||||
|
" addx %%g0, %%g0, %%o1 ! X,C flags\n"
|
||||||
|
" bvs,a .+8\n"
|
||||||
|
" or %%o1, 0x02, %%o1 ! V flag\n"
|
||||||
|
" ldub [%1 + 1], %%o2\n"
|
||||||
|
" subcc %%g0, %%o2, %%g0\n"
|
||||||
|
" addx %%g0, %%g0, %%o2\n"
|
||||||
|
" sll %%o2, 24, %%o2\n"
|
||||||
|
" addcc %%o0, %%o2, %%o0\n"
|
||||||
|
" srl %%o0, 24, %0\n"
|
||||||
|
" addx %%g0, %%g0, %%o2\n"
|
||||||
|
" or %%o1, %%o2, %%o1 ! update X,C flags\n"
|
||||||
|
" bl,a .+8\n"
|
||||||
|
" or %%o1, 0x08, %%o1 ! N flag\n"
|
||||||
|
" ldub [%1], %%o0 ! retreive the old NZVC flags (XXX)\n"
|
||||||
|
" bvs,a .+8\n"
|
||||||
|
" or %%o1, 0x02, %%o1 ! update V flag\n"
|
||||||
|
" and %%o0, 0x04, %%o0 ! (XXX) but keep only Z flag\n"
|
||||||
|
" and %%o1, 1, %%o2 ! keep C flag in %%o2\n"
|
||||||
|
" bnz,a .+8\n"
|
||||||
|
" or %%g0, %%g0, %%o0 ! Z flag cleared if non-zero result\n"
|
||||||
|
" stb %%o2, [%1 + 1] ! store the X flag\n"
|
||||||
|
" or %%o1, %%o0, %%o1\n"
|
||||||
|
" stb %%o1, [%1]\n"
|
||||||
|
: "=&r" (value)
|
||||||
|
: "r" (flags), "r" (dst), "r" (src)
|
||||||
|
: "cc", "o0", "o1", "o2"
|
||||||
|
);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static inline uae_u32 sparc_v8_flag_addx_32(flag_struct *flags, uae_u32 src, uae_u32 dst)
|
||||||
|
{
|
||||||
|
uae_u32 value;
|
||||||
|
__asm__ ("\n"
|
||||||
|
" ldub [%1 + 1], %%o0 ! Get the X Flag\n"
|
||||||
|
" subcc %%g0, %%o0, %%g0 ! Set the SPARC carry flag, if X set\n"
|
||||||
|
" addxcc %2, %3, %0\n"
|
||||||
|
" ldub [%1], %%o0 ! retreive the old NZVC flags\n"
|
||||||
|
" and %%o0, 0x04, %%o0 ! but keep only Z flag\n"
|
||||||
|
" addx %%o0, %%g0, %%o0 ! X,C flags\n"
|
||||||
|
" bl,a .+8\n"
|
||||||
|
" or %%o0, 0x08, %%o0 ! N flag\n"
|
||||||
|
" bvs,a .+8\n"
|
||||||
|
" or %%o0, 0x02, %%o0 ! V flag\n"
|
||||||
|
" bnz,a .+8\n"
|
||||||
|
" and %%o0, 0x0B, %%o0 ! Z flag cleared if result is non-zero\n"
|
||||||
|
" stb %%o0, [%1]\n"
|
||||||
|
" stb %%o0, [%1 + 1]\n"
|
||||||
|
: "=&r" (value)
|
||||||
|
: "r" (flags), "r" (dst), "r" (src)
|
||||||
|
: "cc", "o0"
|
||||||
|
);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* SPARC_V8_ASSEMBLY */
|
||||||
|
|
||||||
|
#ifdef SPARC_V9_ASSEMBLY
|
||||||
|
|
||||||
|
static inline uae_u32 sparc_v9_flag_add_8(flag_struct *flags, uae_u32 src, uae_u32 dst)
|
||||||
|
{
|
||||||
|
uae_u32 value;
|
||||||
|
__asm__ ("\n"
|
||||||
|
" sll %2, 24, %%o0\n"
|
||||||
|
" sll %3, 24, %%o1\n"
|
||||||
|
" addcc %%o0, %%o1, %%o0\n"
|
||||||
|
" rd %%ccr, %%o1\n"
|
||||||
|
" srl %%o0, 24, %0\n"
|
||||||
|
" stb %%o1, [%1]\n"
|
||||||
|
" stb %%o1, [%1+1]\n"
|
||||||
|
: "=&r" (value)
|
||||||
|
: "r" (flags), "r" (dst), "r" (src)
|
||||||
|
: "cc", "o0", "o1"
|
||||||
|
);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uae_u32 sparc_v9_flag_add_16(flag_struct *flags, uae_u32 src, uae_u32 dst)
|
||||||
|
{
|
||||||
|
uae_u32 value;
|
||||||
|
__asm__ ("\n"
|
||||||
|
" sll %2, 16, %%o0\n"
|
||||||
|
" sll %3, 16, %%o1\n"
|
||||||
|
" addcc %%o0, %%o1, %%o0\n"
|
||||||
|
" rd %%ccr, %%o1\n"
|
||||||
|
" srl %%o0, 16, %0\n"
|
||||||
|
" stb %%o1, [%1]\n"
|
||||||
|
" stb %%o1, [%1+1]\n"
|
||||||
|
: "=&r" (value)
|
||||||
|
: "r" (flags), "r" (dst), "r" (src)
|
||||||
|
: "cc", "o0", "o1"
|
||||||
|
);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uae_u32 sparc_v9_flag_add_32(flag_struct *flags, uae_u32 src, uae_u32 dst)
|
||||||
|
{
|
||||||
|
uae_u32 value;
|
||||||
|
__asm__ ("\n"
|
||||||
|
" addcc %2, %3, %0\n"
|
||||||
|
" rd %%ccr, %%o0\n"
|
||||||
|
" stb %%o0, [%1]\n"
|
||||||
|
" stb %%o0, [%1+1]\n"
|
||||||
|
: "=&r" (value)
|
||||||
|
: "r" (flags), "r" (dst), "r" (src)
|
||||||
|
: "cc", "o0"
|
||||||
|
);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uae_u32 sparc_v9_flag_sub_8(flag_struct *flags, uae_u32 src, uae_u32 dst)
|
||||||
|
{
|
||||||
|
uae_u32 value;
|
||||||
|
__asm__ ("\n"
|
||||||
|
" sll %2, 24, %%o0\n"
|
||||||
|
" sll %3, 24, %%o1\n"
|
||||||
|
" subcc %%o0, %%o1, %%o0\n"
|
||||||
|
" rd %%ccr, %%o1\n"
|
||||||
|
" srl %%o0, 24, %0\n"
|
||||||
|
" stb %%o1, [%1]\n"
|
||||||
|
" stb %%o1, [%1+1]\n"
|
||||||
|
: "=&r" (value)
|
||||||
|
: "r" (flags), "r" (dst), "r" (src)
|
||||||
|
: "cc", "o0", "o1"
|
||||||
|
);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uae_u32 sparc_v9_flag_sub_16(flag_struct *flags, uae_u32 src, uae_u32 dst)
|
||||||
|
{
|
||||||
|
uae_u32 value;
|
||||||
|
__asm__ ("\n"
|
||||||
|
" sll %2, 16, %%o0\n"
|
||||||
|
" sll %3, 16, %%o1\n"
|
||||||
|
" subcc %%o0, %%o1, %%o0\n"
|
||||||
|
" rd %%ccr, %%o1\n"
|
||||||
|
" srl %%o0, 16, %0\n"
|
||||||
|
" stb %%o1, [%1]\n"
|
||||||
|
" stb %%o1, [%1+1]\n"
|
||||||
|
: "=&r" (value)
|
||||||
|
: "r" (flags), "r" (dst), "r" (src)
|
||||||
|
: "cc", "o0", "o1"
|
||||||
|
);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uae_u32 sparc_v9_flag_sub_32(flag_struct *flags, uae_u32 src, uae_u32 dst)
|
||||||
|
{
|
||||||
|
uae_u32 value;
|
||||||
|
__asm__ ("\n"
|
||||||
|
" subcc %2, %3, %0\n"
|
||||||
|
" rd %%ccr, %%o0\n"
|
||||||
|
" stb %%o0, [%1]\n"
|
||||||
|
" stb %%o0, [%1+1]\n"
|
||||||
|
: "=&r" (value)
|
||||||
|
: "r" (flags), "r" (dst), "r" (src)
|
||||||
|
: "cc", "o0"
|
||||||
|
);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void sparc_v9_flag_cmp_8(flag_struct *flags, uae_u32 src, uae_u32 dst)
|
||||||
|
{
|
||||||
|
__asm__ ("\n"
|
||||||
|
" sll %1, 24, %%o0\n"
|
||||||
|
" sll %2, 24, %%o1\n"
|
||||||
|
" subcc %%o0, %%o1, %%g0\n"
|
||||||
|
" rd %%ccr, %%o0\n"
|
||||||
|
" stb %%o0, [%0]\n"
|
||||||
|
: /* no outputs */
|
||||||
|
: "r" (flags), "r" (dst), "r" (src)
|
||||||
|
: "cc", "o0", "o1"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void sparc_v9_flag_cmp_16(flag_struct *flags, uae_u32 src, uae_u32 dst)
|
||||||
|
{
|
||||||
|
__asm__ ("\n"
|
||||||
|
" sll %1, 16, %%o0\n"
|
||||||
|
" sll %2, 16, %%o1\n"
|
||||||
|
" subcc %%o0, %%o1, %%g0\n"
|
||||||
|
" rd %%ccr, %%o0\n"
|
||||||
|
" stb %%o0, [%0]\n"
|
||||||
|
: /* no outputs */
|
||||||
|
: "r" (flags), "r" (dst), "r" (src)
|
||||||
|
: "cc", "o0", "o1"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void sparc_v9_flag_cmp_32(flag_struct *flags, uae_u32 src, uae_u32 dst)
|
||||||
|
{
|
||||||
|
__asm__ ("\n"
|
||||||
|
" subcc %1, %2, %%g0\n"
|
||||||
|
#if 0
|
||||||
|
" subcc %1, %2, %%o1\n"
|
||||||
|
" srl %%o1, 31, %%o0\n"
|
||||||
|
" sll %%o0, 3, %%o0\n"
|
||||||
|
" addx %%o0, %%g0, %%o0\n"
|
||||||
|
" bvs,a .+8\n"
|
||||||
|
" or %%o0, 0x02, %%o0\n"
|
||||||
|
" subcc %%g0, %%o1, %%g0\n"
|
||||||
|
" addx %%g0, 7, %%o1\n"
|
||||||
|
" and %%o1, 0x04, %%o1\n"
|
||||||
|
" or %%o0, %%o1, %%o0\n"
|
||||||
|
#endif
|
||||||
|
#if 0
|
||||||
|
" subcc %1, %2, %%o1\n"
|
||||||
|
" srl %%o1, 31, %%o0\n"
|
||||||
|
" sll %%o0, 3, %%o0\n"
|
||||||
|
" addx %%o0, %%g0, %%o0\n"
|
||||||
|
" bvs,pt,a .+8\n"
|
||||||
|
" or %%o0, 0x02, %%o0\n"
|
||||||
|
" subcc %%g0, %%o1, %%g0\n"
|
||||||
|
" addx %%g0, 7, %%o1\n"
|
||||||
|
" and %%o1, 0x04, %%o1\n"
|
||||||
|
" or %%o0, %%o1, %%o0\n"
|
||||||
|
" stb %%o0, [%0]\n"
|
||||||
|
#endif
|
||||||
|
" rd %%ccr, %%o0\n"
|
||||||
|
" stb %%o0, [%0]\n"
|
||||||
|
: /* no outputs */
|
||||||
|
: "r" (flags), "r" (dst), "r" (src)
|
||||||
|
: "cc", "o0", "o1"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 1
|
||||||
|
static inline void sparc_v9_flag_test_8(flag_struct *flags, uae_u32 val)
|
||||||
|
{
|
||||||
|
__asm__ ("\n"
|
||||||
|
" sll %1, 24, %%o0\n"
|
||||||
|
" subcc %%o0, %%g0, %%g0\n"
|
||||||
|
" rd %%ccr, %%o0\n"
|
||||||
|
" stb %%o0, [%0]\n"
|
||||||
|
: /* no outputs */
|
||||||
|
: "r" (flags), "r" (val)
|
||||||
|
: "cc", "o0"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void sparc_v9_flag_test_16(flag_struct *flags, uae_u32 val)
|
||||||
|
{
|
||||||
|
__asm__ ("\n"
|
||||||
|
" sll %1, 16, %%o0\n"
|
||||||
|
" subcc %%o0, %%g0, %%g0\n"
|
||||||
|
" rd %%ccr, %%o0\n"
|
||||||
|
" stb %%o0, [%0]\n"
|
||||||
|
: /* no outputs */
|
||||||
|
: "r" (flags), "r" (val)
|
||||||
|
: "cc", "o0"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void sparc_v9_flag_test_32(flag_struct *flags, uae_u32 val)
|
||||||
|
{
|
||||||
|
__asm__ ("\n"
|
||||||
|
" subcc %1, %%g0, %%g0\n"
|
||||||
|
" rd %%ccr, %%o0\n"
|
||||||
|
" stb %%o0, [%0]\n"
|
||||||
|
: /* no outputs */
|
||||||
|
: "r" (flags), "r" (val)
|
||||||
|
: "cc", "o0"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
static inline void sparc_v9_flag_test_8(flag_struct *flags, uae_u32 val)
|
||||||
|
{
|
||||||
|
__asm__ ("\n"
|
||||||
|
" sll %1, 24, %%o0\n"
|
||||||
|
" subcc %%o0, %%g0, %%o1\n"
|
||||||
|
" srl %%o1, 31, %%o0\n"
|
||||||
|
" sll %%o0, 3, %%o0\n"
|
||||||
|
" addx %%o0, %%g0, %%o0\n"
|
||||||
|
" bvs,a .+8\n"
|
||||||
|
" or %%o0, 0x02, %%o0\n"
|
||||||
|
" subcc %%g0, %%o1, %%g0\n"
|
||||||
|
" addx %%g0, 7, %%o1\n"
|
||||||
|
" and %%o1, 0x04, %%o1\n"
|
||||||
|
" or %%o0, %%o1, %%o0\n"
|
||||||
|
" stb %%o0, [%0]\n"
|
||||||
|
: /* no outputs */
|
||||||
|
: "r" (flags), "r" (val)
|
||||||
|
: "cc", "o0", "o1"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void sparc_v9_flag_test_16(flag_struct *flags, uae_u32 val)
|
||||||
|
{
|
||||||
|
__asm__ ("\n"
|
||||||
|
" sll %1, 16, %%o0\n"
|
||||||
|
" subcc %%o0, %%g0, %%o1\n"
|
||||||
|
" srl %%o1, 31, %%o0\n"
|
||||||
|
" sll %%o0, 3, %%o0\n"
|
||||||
|
" addx %%o0, %%g0, %%o0\n"
|
||||||
|
" bvs,a .+8\n"
|
||||||
|
" or %%o0, 0x02, %%o0\n"
|
||||||
|
" subcc %%g0, %%o1, %%g0\n"
|
||||||
|
" addx %%g0, 7, %%o1\n"
|
||||||
|
" and %%o1, 0x04, %%o1\n"
|
||||||
|
" or %%o0, %%o1, %%o0\n"
|
||||||
|
" stb %%o0, [%0]\n"
|
||||||
|
: /* no outputs */
|
||||||
|
: "r" (flags), "r" (val)
|
||||||
|
: "cc", "o0", "o1"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void sparc_v9_flag_test_32(flag_struct *flags, uae_u32 val)
|
||||||
|
{
|
||||||
|
__asm__ ("\n"
|
||||||
|
" subcc %1, %%g0, %%o1\n"
|
||||||
|
" srl %%o1, 31, %%o0\n"
|
||||||
|
" sll %%o0, 3, %%o0\n"
|
||||||
|
" addx %%o0, %%g0, %%o0\n"
|
||||||
|
" bvs,a .+8\n"
|
||||||
|
" or %%o0, 0x02, %%o0\n"
|
||||||
|
" subcc %%g0, %%o1, %%g0\n"
|
||||||
|
" addx %%g0, 7, %%o1\n"
|
||||||
|
" and %%o1, 0x04, %%o1\n"
|
||||||
|
" or %%o0, %%o1, %%o0\n"
|
||||||
|
" stb %%o0, [%0]\n"
|
||||||
|
: /* no outputs */
|
||||||
|
: "r" (flags), "r" (val)
|
||||||
|
: "cc", "o0", "o1"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static inline uae_u32 sparc_v9_flag_addx_8(flag_struct *flags, uae_u32 src, uae_u32 dst)
|
||||||
|
{
|
||||||
|
uae_u32 value;
|
||||||
|
__asm__ ("\n"
|
||||||
|
" ldub [%1 + 1], %%o1 ! Get the X Flag\n"
|
||||||
|
" subcc %%g0, %%o1, %%g0 ! Set the SPARC carry flag, if X set\n"
|
||||||
|
" addxcc %2, %3, %0\n"
|
||||||
|
: "=&r" (value)
|
||||||
|
: "r" (flags), "r" (dst), "r" (src)
|
||||||
|
: "cc", "o0", "o1"
|
||||||
|
);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uae_u32 sparc_v9_flag_addx_32(flag_struct *flags, uae_u32 src, uae_u32 dst)
|
||||||
|
{
|
||||||
|
uae_u32 value;
|
||||||
|
__asm__ ("\n"
|
||||||
|
" ldub [%1 + 1], %%o0 ! Get the X Flag\n"
|
||||||
|
" subcc %%g0, %%o0, %%g0 ! Set the SPARC carry flag, if X set\n"
|
||||||
|
" addxcc %2, %3, %0\n"
|
||||||
|
" ldub [%1], %%o0 ! retreive the old NZVC flags\n"
|
||||||
|
" and %%o0, 0x04, %%o0 ! but keep only Z flag\n"
|
||||||
|
" addx %%o0, %%g0, %%o0 ! X,C flags\n"
|
||||||
|
" bl,a .+8\n"
|
||||||
|
" or %%o0, 0x08, %%o0 ! N flag\n"
|
||||||
|
" bvs,a .+8\n"
|
||||||
|
" or %%o0, 0x02, %%o0 ! V flag\n"
|
||||||
|
" bnz,a .+8\n"
|
||||||
|
" and %%o0, 0x0B, %%o0 ! Z flag cleared if result is non-zero\n"
|
||||||
|
" stb %%o0, [%1]\n"
|
||||||
|
" stb %%o0, [%1 + 1]\n"
|
||||||
|
: "=&r" (value)
|
||||||
|
: "r" (flags), "r" (dst), "r" (src)
|
||||||
|
: "cc", "o0"
|
||||||
|
);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* SPARC_V9_ASSEMBLY */
|
||||||
|
|
||||||
|
#endif /* SPARC_ASSEMBLY__HEADER */
|
117
BasiliskII/src/Unix/Solaris/which_sparc
Executable file
117
BasiliskII/src/Unix/Solaris/which_sparc
Executable file
@ -0,0 +1,117 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# WHICH_SPARC
|
||||||
|
#
|
||||||
|
# This script generates a program that tests for a SPARC processor class
|
||||||
|
# Program returns:
|
||||||
|
# 0 unknown SPARC processor
|
||||||
|
# 8 SPARC V8 `compliant' processor (umul instruction is legal)
|
||||||
|
# 9 SPARC V9 `compliant' processor (popc instruction is legal)
|
||||||
|
#
|
||||||
|
# I hope this works for other machines and OS. Tested machines are:
|
||||||
|
# Sun Ultra 10 (Solaris 7), SPARC Station 5 (Solaris 2.5.1)
|
||||||
|
#
|
||||||
|
# Gwenole Beauchesne
|
||||||
|
# gb@dial.oleane.com
|
||||||
|
|
||||||
|
CC=gcc
|
||||||
|
PROG=./conftest
|
||||||
|
SOURCE=./conftest.c
|
||||||
|
|
||||||
|
if [ ! -x $PROG ]; then
|
||||||
|
echo "Compiling the test program"
|
||||||
|
cat > $SOURCE << EOF
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
|
typedef unsigned int uint32;
|
||||||
|
typedef uint32 (*sparc_code_func)(void);
|
||||||
|
|
||||||
|
#define SPARC_UNKNOWN 0
|
||||||
|
#define SPARC_V8 8
|
||||||
|
#define SPARC_V9 9
|
||||||
|
|
||||||
|
#define MAX_CODE_SIZE 16
|
||||||
|
struct sparc_code_struct {
|
||||||
|
int version;
|
||||||
|
uint32 code[MAX_CODE_SIZE];
|
||||||
|
struct sparc_code_struct * next;
|
||||||
|
};
|
||||||
|
typedef struct sparc_code_struct sparc_code_struct;
|
||||||
|
|
||||||
|
static sparc_code_struct *current_test_code;
|
||||||
|
|
||||||
|
static sparc_code_struct unknown_sparc_code =
|
||||||
|
{
|
||||||
|
SPARC_UNKNOWN,
|
||||||
|
{
|
||||||
|
0x81C3E008, /* retl */
|
||||||
|
0x01000000 /* nop */
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
static sparc_code_struct sparc_v9_code =
|
||||||
|
{
|
||||||
|
SPARC_V9,
|
||||||
|
{
|
||||||
|
0x81C3E008, /* retl */
|
||||||
|
0x81702007 /* popc 7, %g0 */
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
static sparc_code_struct sparc_v8_code =
|
||||||
|
{
|
||||||
|
SPARC_V8,
|
||||||
|
{
|
||||||
|
0x90102002, /* mov 2, %o0 */
|
||||||
|
0x81C3E008, /* retl */
|
||||||
|
0x90520008 /* umul %o0, %o0, %o0 */
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
static void test_sparc_code(int unused_int)
|
||||||
|
{
|
||||||
|
sparc_code_struct *tested_code = current_test_code;
|
||||||
|
|
||||||
|
if (current_test_code == NULL)
|
||||||
|
exit(SPARC_UNKNOWN);
|
||||||
|
|
||||||
|
signal(SIGILL, test_sparc_code);
|
||||||
|
current_test_code = current_test_code->next;
|
||||||
|
(void) ((sparc_code_func)(tested_code->code))();
|
||||||
|
exit(tested_code->version);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
sparc_v9_code.next = &sparc_v8_code;
|
||||||
|
sparc_v8_code.next = &unknown_sparc_code;
|
||||||
|
unknown_sparc_code.next = NULL;
|
||||||
|
|
||||||
|
signal(SIGILL, test_sparc_code);
|
||||||
|
current_test_code = &sparc_v9_code;
|
||||||
|
raise(SIGILL);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
$CC -o $PROG $SOURCE
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Error: could not compile the test program"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
$PROG
|
||||||
|
case $? in
|
||||||
|
0) echo "unknown SPARC architecture";;
|
||||||
|
8) echo "SPARC V8 compliant processor";;
|
||||||
|
9) echo "SPARC V9 compliant processor";;
|
||||||
|
esac
|
||||||
|
|
||||||
|
rm -f $PROG
|
||||||
|
rm -f $SOURCE
|
||||||
|
|
||||||
|
exit 0
|
@ -9,9 +9,6 @@
|
|||||||
/* Define to `long' if <sys/types.h> doesn't define. */
|
/* Define to `long' if <sys/types.h> doesn't define. */
|
||||||
#undef off_t
|
#undef off_t
|
||||||
|
|
||||||
/* Define to `off_t' if <sys/types.h> doesn't define. */
|
|
||||||
#undef loff_t
|
|
||||||
|
|
||||||
/* Define to `unsigned' if <sys/types.h> doesn't define. */
|
/* Define to `unsigned' if <sys/types.h> doesn't define. */
|
||||||
#undef size_t
|
#undef size_t
|
||||||
|
|
||||||
@ -61,9 +58,6 @@
|
|||||||
/* Define if you have the sem_init function. */
|
/* Define if you have the sem_init function. */
|
||||||
#undef HAVE_SEM_INIT
|
#undef HAVE_SEM_INIT
|
||||||
|
|
||||||
/* Define if you have the semget function. */
|
|
||||||
#undef HAVE_SEMGET
|
|
||||||
|
|
||||||
/* Define if you have the strdup function. */
|
/* Define if you have the strdup function. */
|
||||||
#undef HAVE_STRDUP
|
#undef HAVE_STRDUP
|
||||||
|
|
||||||
|
383
BasiliskII/src/Unix/configure
vendored
383
BasiliskII/src/Unix/configure
vendored
File diff suppressed because it is too large
Load Diff
@ -6,9 +6,11 @@ AC_PREREQ(2.12)
|
|||||||
AC_CONFIG_HEADER(config.h)
|
AC_CONFIG_HEADER(config.h)
|
||||||
|
|
||||||
dnl Options.
|
dnl Options.
|
||||||
WANT_DGA=yes
|
WANT_XF86_DGA=yes
|
||||||
|
WANT_FBDEV_DGA=yes
|
||||||
WANT_UI=yes
|
WANT_UI=yes
|
||||||
AC_ARG_ENABLE(dga, [ --enable-dga use the DGA extension (default)], [WANT_DGA=$enableval], [])
|
AC_ARG_ENABLE(xf86-dga, [ --enable-xf86-dga use the XFree86 DGA extension (default)], [WANT_XF86_DGA=$enableval], [])
|
||||||
|
AC_ARG_ENABLE(fbdev-dga, [ --enable-fbdev-dga use direct frame buffer access via /dev/fb (default)], [WANT_FBDEV_DGA=$enableval], [])
|
||||||
AC_ARG_ENABLE(ui, [ --enable-ui use GTK user interface (default)], [WANT_UI=$enableval], [])
|
AC_ARG_ENABLE(ui, [ --enable-ui use GTK user interface (default)], [WANT_UI=$enableval], [])
|
||||||
|
|
||||||
dnl Checks for programs.
|
dnl Checks for programs.
|
||||||
@ -51,14 +53,26 @@ fi
|
|||||||
AC_CHECK_FUNCS(pthread_cancel)
|
AC_CHECK_FUNCS(pthread_cancel)
|
||||||
|
|
||||||
dnl We use DGA if possible.
|
dnl We use DGA if possible.
|
||||||
if [[ "x$WANT_DGA" = "xyes" ]]; then
|
if [[ "x$WANT_XF86_DGA" = "xyes" ]]; then
|
||||||
AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension, HAVE_DGA=yes, HAVE_DGA=no)
|
AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension, HAVE_DGA=yes, HAVE_DGA=no)
|
||||||
if [[ "x$HAVE_DGA" = "xno" ]]; then
|
if [[ "x$HAVE_DGA" = "xno" ]]; then
|
||||||
AC_MSG_WARN([Could not find DGA extension, ignoring --enable-dga.])
|
AC_MSG_WARN([Could not find XFree86 DGA extension, ignoring --enable-xf86-dga.])
|
||||||
|
DEFINES="$DEFINES -DENABLE_XF86_DGA=0"
|
||||||
else
|
else
|
||||||
DEFINES="$DEFINES -DENABLE_DGA=1"
|
DEFINES="$DEFINES -DENABLE_XF86_DGA=1"
|
||||||
LIBS="$LIBS -lXxf86dga"
|
LIBS="$LIBS -lXxf86dga"
|
||||||
|
if [[ "x$WANT_FBDEV_DGA" = "xyes" ]]; then
|
||||||
|
AC_MSG_WARN([Cannot have both --enable-xf86-dga and --enable-fbdev-dga, ignoring --enable-fbdev-dga.])
|
||||||
|
WANT_FBDEV_DGA=no
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
DEFINES="$DEFINES -DENABLE_XF86_DGA=0"
|
||||||
|
fi
|
||||||
|
if [[ "x$WANT_FBDEV_DGA" = "xyes" ]]; then
|
||||||
|
DEFINES="$DEFINES -DENABLE_FBDEV_DGA=1"
|
||||||
|
else
|
||||||
|
DEFINES="$DEFINES -DENABLE_FBDEV_DGA=0"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl We use GTK+ if possible.
|
dnl We use GTK+ if possible.
|
||||||
@ -165,11 +179,11 @@ if MACHINE=`uname -a 2>/dev/null`; then
|
|||||||
LIBS="$LIBS -lm"
|
LIBS="$LIBS -lm"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
if [[ "x$WANT_UI" = "xyes" ]]; then
|
fi
|
||||||
SYSSRCS="$SYSSRCS prefs_editor_gtk.cpp"
|
if [[ "x$WANT_UI" = "xyes" ]]; then
|
||||||
else
|
SYSSRCS="$SYSSRCS prefs_editor_gtk.cpp"
|
||||||
SYSSRCS="$SYSSRCS ../dummy/prefs_editor_dummy.cpp"
|
else
|
||||||
fi
|
SYSSRCS="$SYSSRCS ../dummy/prefs_editor_dummy.cpp"
|
||||||
fi
|
fi
|
||||||
if [[ "x$SEMSRCS" != "x" ]]; then
|
if [[ "x$SEMSRCS" != "x" ]]; then
|
||||||
SYSSRCS="$SYSSRCS $SEMSRCS"
|
SYSSRCS="$SYSSRCS $SEMSRCS"
|
||||||
|
14
BasiliskII/src/Unix/fbdevices
Normal file
14
BasiliskII/src/Unix/fbdevices
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# device depth offset for mmap(2)
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Frame buffers known to work
|
||||||
|
cgsix 8 0x70016000
|
||||||
|
tcx 8 0x00000000
|
||||||
|
|
||||||
|
# Untested frame buffers
|
||||||
|
cgthree 8 0x04000000
|
||||||
|
cgtwo 8 0x00000000
|
||||||
|
cgfour 8 0x00000000
|
||||||
|
cgeight 24 0x00000000
|
||||||
|
tcx 24 0x01000000
|
@ -34,6 +34,9 @@ user_string_def platform_strings[] = {
|
|||||||
{STR_NO_XSERVER_ERR, "Cannot connect to X server '%s'."},
|
{STR_NO_XSERVER_ERR, "Cannot connect to X server '%s'."},
|
||||||
{STR_NO_XVISUAL_ERR, "Cannot obtain appropriate X visual."},
|
{STR_NO_XVISUAL_ERR, "Cannot obtain appropriate X visual."},
|
||||||
{STR_UNSUPP_DEPTH_ERR, "Unsupported color depth of screen."},
|
{STR_UNSUPP_DEPTH_ERR, "Unsupported color depth of screen."},
|
||||||
|
{STR_NO_FBDEVICE_FILE_ERR, "Cannot open frame buffer device specification file %s (%s)."},
|
||||||
|
{STR_FBDEV_NAME_ERR, "The %s frame buffer is not supported in %d bit mode."},
|
||||||
|
{STR_FBDEV_MMAP_ERR, "Cannot mmap() the frame buffer memory (%s)."},
|
||||||
{STR_NO_SHEEP_NET_DRIVER_WARN, "Cannot open %s (%s). Ethernet will not be available."},
|
{STR_NO_SHEEP_NET_DRIVER_WARN, "Cannot open %s (%s). Ethernet will not be available."},
|
||||||
{STR_SHEEP_NET_ATTACH_WARN, "Cannot attach to Ethernet card (%s). Ethernet will not be available."},
|
{STR_SHEEP_NET_ATTACH_WARN, "Cannot attach to Ethernet card (%s). Ethernet will not be available."},
|
||||||
{STR_SCSI_DEVICE_OPEN_WARN, "Cannot open %s (%s). SCSI Manager access to this device will be disabled."},
|
{STR_SCSI_DEVICE_OPEN_WARN, "Cannot open %s (%s). SCSI Manager access to this device will be disabled."},
|
||||||
|
@ -25,6 +25,9 @@ enum {
|
|||||||
STR_NO_XSERVER_ERR = 10000,
|
STR_NO_XSERVER_ERR = 10000,
|
||||||
STR_NO_XVISUAL_ERR,
|
STR_NO_XVISUAL_ERR,
|
||||||
STR_UNSUPP_DEPTH_ERR,
|
STR_UNSUPP_DEPTH_ERR,
|
||||||
|
STR_NO_FBDEVICE_FILE_ERR,
|
||||||
|
STR_FBDEV_NAME_ERR,
|
||||||
|
STR_FBDEV_MMAP_ERR,
|
||||||
|
|
||||||
STR_NO_SHEEP_NET_DRIVER_WARN,
|
STR_NO_SHEEP_NET_DRIVER_WARN,
|
||||||
STR_SHEEP_NET_ATTACH_WARN,
|
STR_SHEEP_NET_ATTACH_WARN,
|
||||||
|
@ -48,10 +48,15 @@
|
|||||||
#define DEBUG 1
|
#define DEBUG 1
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
#if ENABLE_DGA
|
#if ENABLE_XF86_DGA
|
||||||
#include <X11/extensions/xf86dga.h>
|
#include <X11/extensions/xf86dga.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if ENABLE_FBDEV_DGA
|
||||||
|
#include <sys/mman.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Display types
|
// Display types
|
||||||
enum {
|
enum {
|
||||||
@ -62,6 +67,7 @@ enum {
|
|||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
const char KEYCODE_FILE_NAME[] = DATADIR "/keycodes";
|
const char KEYCODE_FILE_NAME[] = DATADIR "/keycodes";
|
||||||
|
const char FBDEVICES_FILE_NAME[] = DATADIR "/fbdevices";
|
||||||
|
|
||||||
|
|
||||||
// Global variables
|
// Global variables
|
||||||
@ -115,13 +121,16 @@ static uint8 *the_buffer_copy = NULL; // Copy of Mac frame buffer
|
|||||||
static uint8 the_cursor[64]; // Cursor image data
|
static uint8 the_cursor[64]; // Cursor image data
|
||||||
static bool have_shm = false; // Flag: SHM extensions available
|
static bool have_shm = false; // Flag: SHM extensions available
|
||||||
|
|
||||||
// Variables for DGA mode
|
// Variables for XF86 DGA mode
|
||||||
static int current_dga_cmap; // Number (0 or 1) of currently installed DGA colormap
|
static int current_dga_cmap; // Number (0 or 1) of currently installed DGA colormap
|
||||||
static Window suspend_win; // "Suspend" window
|
static Window suspend_win; // "Suspend" window
|
||||||
static void *fb_save = NULL; // Saved frame buffer for suspend
|
static void *fb_save = NULL; // Saved frame buffer for suspend
|
||||||
|
|
||||||
static pthread_mutex_t frame_buffer_lock = PTHREAD_MUTEX_INITIALIZER; // Mutex to protect frame buffer
|
static pthread_mutex_t frame_buffer_lock = PTHREAD_MUTEX_INITIALIZER; // Mutex to protect frame buffer
|
||||||
|
|
||||||
|
// Variables for fbdev DGA mode
|
||||||
|
const char FBDEVICE_FILE_NAME[] = "/dev/fb";
|
||||||
|
static int fbdev_fd;
|
||||||
|
|
||||||
|
|
||||||
// Prototypes
|
// Prototypes
|
||||||
static void *redraw_func(void *arg);
|
static void *redraw_func(void *arg);
|
||||||
@ -204,11 +213,13 @@ static bool init_window(int width, int height)
|
|||||||
wattr.event_mask = eventmask = win_eventmask;
|
wattr.event_mask = eventmask = win_eventmask;
|
||||||
wattr.background_pixel = black_pixel;
|
wattr.background_pixel = black_pixel;
|
||||||
wattr.border_pixel = black_pixel;
|
wattr.border_pixel = black_pixel;
|
||||||
wattr.backing_store = NotUseful;
|
wattr.backing_store = Always;
|
||||||
|
wattr.backing_planes = xdepth;
|
||||||
|
|
||||||
XSync(x_display, false);
|
XSync(x_display, false);
|
||||||
the_win = XCreateWindow(x_display, rootwin, 0, 0, width, height, 0, xdepth,
|
the_win = XCreateWindow(x_display, rootwin, 0, 0, width, height, 0, xdepth,
|
||||||
InputOutput, vis, CWEventMask | CWBackPixel | CWBorderPixel | CWBackingStore, &wattr);
|
InputOutput, vis, CWEventMask | CWBackPixel | CWBorderPixel |
|
||||||
|
CWBackingStore | CWBackingPlanes, &wattr);
|
||||||
XSync(x_display, false);
|
XSync(x_display, false);
|
||||||
XStoreName(x_display, the_win, GetString(STR_WINDOW_TITLE));
|
XStoreName(x_display, the_win, GetString(STR_WINDOW_TITLE));
|
||||||
XMapRaised(x_display, the_win);
|
XMapRaised(x_display, the_win);
|
||||||
@ -311,6 +322,7 @@ static bool init_window(int width, int height)
|
|||||||
#else
|
#else
|
||||||
set_video_monitor(width, height, img->bytes_per_line, img->bitmap_bit_order == LSBFirst);
|
set_video_monitor(width, height, img->bytes_per_line, img->bitmap_bit_order == LSBFirst);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if REAL_ADDRESSING
|
#if REAL_ADDRESSING
|
||||||
VideoMonitor.mac_frame_base = (uint32)the_buffer;
|
VideoMonitor.mac_frame_base = (uint32)the_buffer;
|
||||||
MacFrameLayout = FLAYOUT_DIRECT;
|
MacFrameLayout = FLAYOUT_DIRECT;
|
||||||
@ -320,10 +332,152 @@ static bool init_window(int width, int height)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init DGA display
|
// Init fbdev DGA display
|
||||||
static bool init_dga(int width, int height)
|
static bool init_fbdev_dga(char *in_fb_name)
|
||||||
{
|
{
|
||||||
#if ENABLE_DGA
|
#if ENABLE_FBDEV_DGA
|
||||||
|
// Find the maximum depth available
|
||||||
|
int ndepths, max_depth(0);
|
||||||
|
int *depths = XListDepths(x_display, screen, &ndepths);
|
||||||
|
if (depths == NULL) {
|
||||||
|
fprintf(stderr, "Error: could not determine the maximal depth available\n");
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
while (ndepths-- > 0) {
|
||||||
|
if (depths[ndepths] > max_depth)
|
||||||
|
max_depth = depths[ndepths];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get fbdevices file path from preferences
|
||||||
|
const char *fbd_path = PrefsFindString("fbdevices");
|
||||||
|
|
||||||
|
// Open fbdevices file
|
||||||
|
FILE *fp = fopen(fbd_path ? fbd_path : FBDEVICES_FILE_NAME, "r");
|
||||||
|
if (fp == NULL) {
|
||||||
|
char str[256];
|
||||||
|
sprintf(str, GetString(STR_NO_FBDEVICE_FILE_ERR), fbd_path ? fbd_path : FBDEVICES_FILE_NAME, strerror(errno));
|
||||||
|
ErrorAlert(str);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int fb_depth; // supported depth
|
||||||
|
uint32 fb_offset; // offset used for mmap(2)
|
||||||
|
char fb_name[20];
|
||||||
|
char line[256];
|
||||||
|
bool device_found = false;
|
||||||
|
while (fgets(line, 255, fp)) {
|
||||||
|
// Read line
|
||||||
|
int len = strlen(line);
|
||||||
|
if (len == 0)
|
||||||
|
continue;
|
||||||
|
line[len - 1] = '\0';
|
||||||
|
|
||||||
|
// Comments begin with "#" or ";"
|
||||||
|
if ((line[0] == '#') || (line[0] == ';') || (line[0] == '\0'))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if ((sscanf(line, "%s %d %x", &fb_name, &fb_depth, &fb_offset) == 3)
|
||||||
|
&& (strcmp(fb_name, in_fb_name) == 0) && (fb_depth == max_depth)) {
|
||||||
|
device_found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// fbdevices file completely read
|
||||||
|
fclose(fp);
|
||||||
|
|
||||||
|
// Frame buffer name not found ? Then, display warning
|
||||||
|
if (!device_found) {
|
||||||
|
char str[256];
|
||||||
|
sprintf(str, GetString(STR_FBDEV_NAME_ERR), in_fb_name, max_depth);
|
||||||
|
ErrorAlert(str);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int width = DisplayWidth(x_display, screen);
|
||||||
|
int height = DisplayHeight(x_display, screen);
|
||||||
|
depth = fb_depth; // max_depth
|
||||||
|
|
||||||
|
// Set relative mouse mode
|
||||||
|
ADBSetRelMouseMode(false);
|
||||||
|
|
||||||
|
// Create window
|
||||||
|
XSetWindowAttributes wattr;
|
||||||
|
wattr.override_redirect = True;
|
||||||
|
wattr.backing_store = NotUseful;
|
||||||
|
wattr.background_pixel = white_pixel;
|
||||||
|
wattr.border_pixel = black_pixel;
|
||||||
|
wattr.event_mask = eventmask = dga_eventmask;
|
||||||
|
|
||||||
|
XSync(x_display, false);
|
||||||
|
the_win = XCreateWindow(x_display, rootwin,
|
||||||
|
0, 0, width, height,
|
||||||
|
0, xdepth, InputOutput, vis,
|
||||||
|
CWEventMask|CWBackPixel|CWBorderPixel|CWOverrideRedirect|CWBackingStore,
|
||||||
|
&wattr);
|
||||||
|
XSync(x_display, false);
|
||||||
|
XMapRaised(x_display, the_win);
|
||||||
|
XSync(x_display, false);
|
||||||
|
|
||||||
|
// Grab mouse and keyboard
|
||||||
|
XGrabKeyboard(x_display, the_win, True,
|
||||||
|
GrabModeAsync, GrabModeAsync, CurrentTime);
|
||||||
|
XGrabPointer(x_display, the_win, True,
|
||||||
|
PointerMotionMask | ButtonPressMask | ButtonReleaseMask,
|
||||||
|
GrabModeAsync, GrabModeAsync, the_win, None, CurrentTime);
|
||||||
|
|
||||||
|
// Set colormap
|
||||||
|
if (depth == 8) {
|
||||||
|
XSetWindowColormap(x_display, the_win, cmap[current_dga_cmap = 0]);
|
||||||
|
XSetWMColormapWindows(x_display, the_win, &the_win, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set VideoMonitor
|
||||||
|
int bytes_per_row = width;
|
||||||
|
switch (depth) {
|
||||||
|
case 1:
|
||||||
|
bytes_per_row = ((width | 7) & ~7) >> 3;
|
||||||
|
break;
|
||||||
|
case 15:
|
||||||
|
case 16:
|
||||||
|
bytes_per_row *= 2;
|
||||||
|
break;
|
||||||
|
case 24:
|
||||||
|
case 32:
|
||||||
|
bytes_per_row *= 4;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((the_buffer = (uint8 *) mmap(NULL, height * bytes_per_row, PROT_READ | PROT_WRITE, MAP_PRIVATE, fbdev_fd, fb_offset)) == MAP_FAILED) {
|
||||||
|
if ((the_buffer = (uint8 *) mmap(NULL, height * bytes_per_row, PROT_READ | PROT_WRITE, MAP_SHARED, fbdev_fd, fb_offset)) == MAP_FAILED) {
|
||||||
|
char str[256];
|
||||||
|
sprintf(str, GetString(STR_FBDEV_MMAP_ERR), strerror(errno));
|
||||||
|
ErrorAlert(str);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
set_video_monitor(width, height, bytes_per_row, true);
|
||||||
|
#if REAL_ADDRESSING
|
||||||
|
VideoMonitor.mac_frame_base = (uint32)the_buffer;
|
||||||
|
MacFrameLayout = FLAYOUT_DIRECT;
|
||||||
|
#else
|
||||||
|
VideoMonitor.mac_frame_base = MacFrameBaseMac;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
printf("FbDev DGA with %s in %d-bit mode enabled\n", fb_name, fb_depth);
|
||||||
|
return true;
|
||||||
|
#else
|
||||||
|
ErrorAlert("Basilisk II has been compiled with fbdev DGA support disabled.");
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// Init XF86 DGA display
|
||||||
|
static bool init_xf86_dga(int width, int height)
|
||||||
|
{
|
||||||
|
#if ENABLE_XF86_DGA
|
||||||
// Set relative mouse mode
|
// Set relative mouse mode
|
||||||
ADBSetRelMouseMode(true);
|
ADBSetRelMouseMode(true);
|
||||||
|
|
||||||
@ -384,7 +538,7 @@ static bool init_dga(int width, int height)
|
|||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
#else
|
#else
|
||||||
ErrorAlert("Basilisk II has been compiled with DGA support disabled.");
|
ErrorAlert("Basilisk II has been compiled with XF86 DGA support disabled.");
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -466,7 +620,18 @@ bool VideoInit(bool classic)
|
|||||||
// Get screen depth
|
// Get screen depth
|
||||||
xdepth = DefaultDepth(x_display, screen);
|
xdepth = DefaultDepth(x_display, screen);
|
||||||
|
|
||||||
#if ENABLE_DGA
|
#if ENABLE_FBDEV_DGA
|
||||||
|
// Frame buffer name
|
||||||
|
char fb_name[20];
|
||||||
|
|
||||||
|
// Could do fbdev dga ?
|
||||||
|
if ((fbdev_fd = open(FBDEVICE_FILE_NAME, O_RDWR)) != -1)
|
||||||
|
has_dga = true;
|
||||||
|
else
|
||||||
|
has_dga = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if ENABLE_XF86_DGA
|
||||||
// DGA available?
|
// DGA available?
|
||||||
int event_base, error_base;
|
int event_base, error_base;
|
||||||
if (XF86DGAQueryExtension(x_display, &event_base, &error_base)) {
|
if (XF86DGAQueryExtension(x_display, &event_base, &error_base)) {
|
||||||
@ -542,7 +707,11 @@ bool VideoInit(bool classic)
|
|||||||
if (mode_str) {
|
if (mode_str) {
|
||||||
if (sscanf(mode_str, "win/%d/%d", &width, &height) == 2)
|
if (sscanf(mode_str, "win/%d/%d", &width, &height) == 2)
|
||||||
display_type = DISPLAY_WINDOW;
|
display_type = DISPLAY_WINDOW;
|
||||||
|
#if ENABLE_FBDEV_DGA
|
||||||
|
else if (has_dga && sscanf(mode_str, "dga/%s", fb_name) == 1) {
|
||||||
|
#else
|
||||||
else if (has_dga && sscanf(mode_str, "dga/%d/%d", &width, &height) == 2) {
|
else if (has_dga && sscanf(mode_str, "dga/%d/%d", &width, &height) == 2) {
|
||||||
|
#endif
|
||||||
display_type = DISPLAY_DGA;
|
display_type = DISPLAY_DGA;
|
||||||
if (width > DisplayWidth(x_display, screen))
|
if (width > DisplayWidth(x_display, screen))
|
||||||
width = DisplayWidth(x_display, screen);
|
width = DisplayWidth(x_display, screen);
|
||||||
@ -562,7 +731,11 @@ bool VideoInit(bool classic)
|
|||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
case DISPLAY_DGA:
|
case DISPLAY_DGA:
|
||||||
if (!init_dga(width, height))
|
#if ENABLE_FBDEV_DGA
|
||||||
|
if (!init_fbdev_dga(fb_name))
|
||||||
|
#else
|
||||||
|
if (!init_xf86_dga(width, height))
|
||||||
|
#endif
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -612,7 +785,7 @@ void VideoExit(void)
|
|||||||
if (x_display != NULL) {
|
if (x_display != NULL) {
|
||||||
XSync(x_display, false);
|
XSync(x_display, false);
|
||||||
|
|
||||||
#if ENABLE_DGA
|
#if ENABLE_XF86_DGA
|
||||||
if (display_type == DISPLAY_DGA) {
|
if (display_type == DISPLAY_DGA) {
|
||||||
XF86DGADirectVideo(x_display, screen, 0);
|
XF86DGADirectVideo(x_display, screen, 0);
|
||||||
XUngrabPointer(x_display, CurrentTime);
|
XUngrabPointer(x_display, CurrentTime);
|
||||||
@ -620,6 +793,14 @@ void VideoExit(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if ENABLE_FBDEV_DGA
|
||||||
|
if (display_type == DISPLAY_DGA) {
|
||||||
|
XUngrabPointer(x_display, CurrentTime);
|
||||||
|
XUngrabKeyboard(x_display, CurrentTime);
|
||||||
|
close(fbdev_fd);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (the_buffer_copy) {
|
if (the_buffer_copy) {
|
||||||
free(the_buffer_copy);
|
free(the_buffer_copy);
|
||||||
the_buffer_copy = NULL;
|
the_buffer_copy = NULL;
|
||||||
@ -692,7 +873,7 @@ void video_set_palette(uint8 *pal)
|
|||||||
* Suspend/resume emulator
|
* Suspend/resume emulator
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if ENABLE_DGA
|
#if ENABLE_XF86_DGA || ENABLE_FBDEV_DGA
|
||||||
static void suspend_emul(void)
|
static void suspend_emul(void)
|
||||||
{
|
{
|
||||||
if (display_type == DISPLAY_DGA) {
|
if (display_type == DISPLAY_DGA) {
|
||||||
@ -709,7 +890,9 @@ static void suspend_emul(void)
|
|||||||
memcpy(fb_save, the_buffer, VideoMonitor.y * VideoMonitor.bytes_per_row);
|
memcpy(fb_save, the_buffer, VideoMonitor.y * VideoMonitor.bytes_per_row);
|
||||||
|
|
||||||
// Close full screen display
|
// Close full screen display
|
||||||
|
#if ENABLE_XF86_DGA
|
||||||
XF86DGADirectVideo(x_display, screen, 0);
|
XF86DGADirectVideo(x_display, screen, 0);
|
||||||
|
#endif
|
||||||
XUngrabPointer(x_display, CurrentTime);
|
XUngrabPointer(x_display, CurrentTime);
|
||||||
XUngrabKeyboard(x_display, CurrentTime);
|
XUngrabKeyboard(x_display, CurrentTime);
|
||||||
XUnmapWindow(x_display, the_win);
|
XUnmapWindow(x_display, the_win);
|
||||||
@ -723,6 +906,7 @@ static void suspend_emul(void)
|
|||||||
wattr.backing_store = Always;
|
wattr.backing_store = Always;
|
||||||
wattr.backing_planes = xdepth;
|
wattr.backing_planes = xdepth;
|
||||||
wattr.colormap = DefaultColormap(x_display, screen);
|
wattr.colormap = DefaultColormap(x_display, screen);
|
||||||
|
|
||||||
XSync(x_display, false);
|
XSync(x_display, false);
|
||||||
suspend_win = XCreateWindow(x_display, rootwin, 0, 0, 512, 1, 0, xdepth,
|
suspend_win = XCreateWindow(x_display, rootwin, 0, 0, 512, 1, 0, xdepth,
|
||||||
InputOutput, vis, CWEventMask | CWBackPixel | CWBorderPixel |
|
InputOutput, vis, CWEventMask | CWBackPixel | CWBorderPixel |
|
||||||
@ -747,8 +931,10 @@ static void resume_emul(void)
|
|||||||
XSync(x_display, false);
|
XSync(x_display, false);
|
||||||
XGrabKeyboard(x_display, rootwin, 1, GrabModeAsync, GrabModeAsync, CurrentTime);
|
XGrabKeyboard(x_display, rootwin, 1, GrabModeAsync, GrabModeAsync, CurrentTime);
|
||||||
XGrabPointer(x_display, rootwin, 1, PointerMotionMask | ButtonPressMask | ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, None, CurrentTime);
|
XGrabPointer(x_display, rootwin, 1, PointerMotionMask | ButtonPressMask | ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, None, CurrentTime);
|
||||||
|
#if ENABLE_XF86_DGA
|
||||||
XF86DGADirectVideo(x_display, screen, XF86DGADirectGraphics | XF86DGADirectKeyb | XF86DGADirectMouse);
|
XF86DGADirectVideo(x_display, screen, XF86DGADirectGraphics | XF86DGADirectKeyb | XF86DGADirectMouse);
|
||||||
XF86DGASetViewPort(x_display, screen, 0, 0);
|
XF86DGASetViewPort(x_display, screen, 0, 0);
|
||||||
|
#endif
|
||||||
XSync(x_display, false);
|
XSync(x_display, false);
|
||||||
|
|
||||||
// Restore frame buffer
|
// Restore frame buffer
|
||||||
@ -757,8 +943,14 @@ static void resume_emul(void)
|
|||||||
free(fb_save);
|
free(fb_save);
|
||||||
fb_save = NULL;
|
fb_save = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (depth == 8)
|
if (depth == 8)
|
||||||
|
#if ENABLE_XF86_DGA
|
||||||
XF86DGAInstallColormap(x_display, screen, cmap[current_dga_cmap]);
|
XF86DGAInstallColormap(x_display, screen, cmap[current_dga_cmap]);
|
||||||
|
#endif
|
||||||
|
#if ENABLE_FBDEV_DGA
|
||||||
|
XSetWindowColormap(x_display, the_win, cmap[current_dga_cmap]);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Unlock frame buffer (and continue MacOS thread)
|
// Unlock frame buffer (and continue MacOS thread)
|
||||||
pthread_mutex_unlock(&frame_buffer_lock);
|
pthread_mutex_unlock(&frame_buffer_lock);
|
||||||
@ -824,7 +1016,7 @@ static int kc_decode(KeySym ks)
|
|||||||
case XK_period: case XK_greater: return 0x2f;
|
case XK_period: case XK_greater: return 0x2f;
|
||||||
case XK_slash: case XK_question: return 0x2c;
|
case XK_slash: case XK_question: return 0x2c;
|
||||||
|
|
||||||
#if ENABLE_DGA
|
#if ENABLE_XF86_DGA || ENABLE_FBDEV_DGA
|
||||||
case XK_Tab: if (ctrl_down) {suspend_emul(); return -1;} else return 0x30;
|
case XK_Tab: if (ctrl_down) {suspend_emul(); return -1;} else return 0x30;
|
||||||
#else
|
#else
|
||||||
case XK_Tab: return 0x30;
|
case XK_Tab: return 0x30;
|
||||||
@ -990,7 +1182,7 @@ static void handle_events(void)
|
|||||||
if (code == 0x36)
|
if (code == 0x36)
|
||||||
ctrl_down = true;
|
ctrl_down = true;
|
||||||
} else {
|
} else {
|
||||||
#if ENABLE_DGA
|
#if ENABLE_XF86_DGA || ENABLE_FBDEV_DGA
|
||||||
if (code == 0x31)
|
if (code == 0x31)
|
||||||
resume_emul(); // Space wakes us up
|
resume_emul(); // Space wakes us up
|
||||||
#endif
|
#endif
|
||||||
@ -1182,7 +1374,7 @@ static void *redraw_func(void *arg)
|
|||||||
usleep(16667);
|
usleep(16667);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLE_DGA
|
#if ENABLE_XF86_DGA
|
||||||
// Quit DGA mode if requested
|
// Quit DGA mode if requested
|
||||||
if (quit_full_screen) {
|
if (quit_full_screen) {
|
||||||
quit_full_screen = false;
|
quit_full_screen = false;
|
||||||
@ -1196,6 +1388,18 @@ static void *redraw_func(void *arg)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if ENABLE_FBDEV_DGA
|
||||||
|
// Quit DGA mode if requested
|
||||||
|
if (quit_full_screen) {
|
||||||
|
quit_full_screen = false;
|
||||||
|
if (display_type == DISPLAY_DGA) {
|
||||||
|
XUngrabPointer(x_display, CurrentTime);
|
||||||
|
XUngrabKeyboard(x_display, CurrentTime);
|
||||||
|
XUnmapWindow(x_display, the_win);
|
||||||
|
XSync(x_display, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
// Handle X events
|
// Handle X events
|
||||||
handle_events();
|
handle_events();
|
||||||
|
|
||||||
@ -1206,12 +1410,18 @@ static void *redraw_func(void *arg)
|
|||||||
if (depth == 8) {
|
if (depth == 8) {
|
||||||
XStoreColors(x_display, cmap[0], palette, 256);
|
XStoreColors(x_display, cmap[0], palette, 256);
|
||||||
XStoreColors(x_display, cmap[1], palette, 256);
|
XStoreColors(x_display, cmap[1], palette, 256);
|
||||||
#if ENABLE_DGA
|
|
||||||
|
#if ENABLE_XF86_DGA
|
||||||
if (display_type == DISPLAY_DGA) {
|
if (display_type == DISPLAY_DGA) {
|
||||||
current_dga_cmap ^= 1;
|
current_dga_cmap ^= 1;
|
||||||
XF86DGAInstallColormap(x_display, screen, cmap[current_dga_cmap]);
|
XF86DGAInstallColormap(x_display, screen, cmap[current_dga_cmap]);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if ENABLE_FBDEV_DGA
|
||||||
|
if (display_type == DISPLAY_DGA)
|
||||||
|
XSetWindowColormap(x_display, the_win, cmap[current_dga_cmap]);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&palette_lock);
|
pthread_mutex_unlock(&palette_lock);
|
||||||
|
@ -24,6 +24,10 @@
|
|||||||
#include "sysdeps.h"
|
#include "sysdeps.h"
|
||||||
#include "readcpu.h"
|
#include "readcpu.h"
|
||||||
|
|
||||||
|
#if defined(SPARC_V8_ASSEMBLY) || defined(SPARC_V9_ASSEMBLY)
|
||||||
|
#define SPARC_ASSEMBLY 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#define BOOL_TYPE "int"
|
#define BOOL_TYPE "int"
|
||||||
|
|
||||||
static FILE *headerfile;
|
static FILE *headerfile;
|
||||||
@ -710,7 +714,156 @@ static void genflags_normal (flagtypes type, wordsizes size, char *value, char *
|
|||||||
|
|
||||||
static void genflags (flagtypes type, wordsizes size, char *value, char *src, char *dst)
|
static void genflags (flagtypes type, wordsizes size, char *value, char *src, char *dst)
|
||||||
{
|
{
|
||||||
#ifdef X86_ASSEMBLY
|
#ifdef SPARC_V8_ASSEMBLY
|
||||||
|
switch(type)
|
||||||
|
{
|
||||||
|
case flag_add:
|
||||||
|
start_brace();
|
||||||
|
printf("\tuae_u32 %s;\n", value);
|
||||||
|
switch(size)
|
||||||
|
{
|
||||||
|
case sz_byte:
|
||||||
|
printf("\t%s = sparc_v8_flag_add_8(®flags, (uae_u32)(%s), (uae_u32)(%s));\n", value, src, dst);
|
||||||
|
break;
|
||||||
|
case sz_word:
|
||||||
|
printf("\t%s = sparc_v8_flag_add_16(®flags, (uae_u32)(%s), (uae_u32)(%s));\n", value, src, dst);
|
||||||
|
break;
|
||||||
|
case sz_long:
|
||||||
|
printf("\t%s = sparc_v8_flag_add_32(®flags, (uae_u32)(%s), (uae_u32)(%s));\n", value, src, dst);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
|
||||||
|
case flag_sub:
|
||||||
|
start_brace();
|
||||||
|
printf("\tuae_u32 %s;\n", value);
|
||||||
|
switch(size)
|
||||||
|
{
|
||||||
|
case sz_byte:
|
||||||
|
printf("\t%s = sparc_v8_flag_sub_8(®flags, (uae_u32)(%s), (uae_u32)(%s));\n", value, src, dst);
|
||||||
|
break;
|
||||||
|
case sz_word:
|
||||||
|
printf("\t%s = sparc_v8_flag_sub_16(®flags, (uae_u32)(%s), (uae_u32)(%s));\n", value, src, dst);
|
||||||
|
break;
|
||||||
|
case sz_long:
|
||||||
|
printf("\t%s = sparc_v8_flag_sub_32(®flags, (uae_u32)(%s), (uae_u32)(%s));\n", value, src, dst);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
|
||||||
|
case flag_cmp:
|
||||||
|
switch(size)
|
||||||
|
{
|
||||||
|
case sz_byte:
|
||||||
|
// printf("\tsparc_v8_flag_cmp_8(®flags, (uae_u32)(%s), (uae_u32)(%s));\n", src, dst);
|
||||||
|
break;
|
||||||
|
case sz_word:
|
||||||
|
// printf("\tsparc_v8_flag_cmp_16(®flags, (uae_u32)(%s), (uae_u32)(%s));\n", src, dst);
|
||||||
|
break;
|
||||||
|
case sz_long:
|
||||||
|
#if 1
|
||||||
|
printf("\tsparc_v8_flag_cmp_32(®flags, (uae_u32)(%s), (uae_u32)(%s));\n", src, dst);
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// return;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#elif defined(SPARC_V9_ASSEMBLY)
|
||||||
|
switch(type)
|
||||||
|
{
|
||||||
|
case flag_add:
|
||||||
|
start_brace();
|
||||||
|
printf("\tuae_u32 %s;\n", value);
|
||||||
|
switch(size)
|
||||||
|
{
|
||||||
|
case sz_byte:
|
||||||
|
printf("\t%s = sparc_v9_flag_add_8(®flags, (uae_u32)(%s), (uae_u32)(%s));\n", value, src, dst);
|
||||||
|
break;
|
||||||
|
case sz_word:
|
||||||
|
printf("\t%s = sparc_v9_flag_add_16(®flags, (uae_u32)(%s), (uae_u32)(%s));\n", value, src, dst);
|
||||||
|
break;
|
||||||
|
case sz_long:
|
||||||
|
printf("\t%s = sparc_v9_flag_add_32(®flags, (uae_u32)(%s), (uae_u32)(%s));\n", value, src, dst);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
|
||||||
|
case flag_sub:
|
||||||
|
start_brace();
|
||||||
|
printf("\tuae_u32 %s;\n", value);
|
||||||
|
switch(size)
|
||||||
|
{
|
||||||
|
case sz_byte:
|
||||||
|
printf("\t%s = sparc_v9_flag_sub_8(®flags, (uae_u32)(%s), (uae_u32)(%s));\n", value, src, dst);
|
||||||
|
break;
|
||||||
|
case sz_word:
|
||||||
|
printf("\t%s = sparc_v9_flag_sub_16(®flags, (uae_u32)(%s), (uae_u32)(%s));\n", value, src, dst);
|
||||||
|
break;
|
||||||
|
case sz_long:
|
||||||
|
printf("\t%s = sparc_v9_flag_sub_32(®flags, (uae_u32)(%s), (uae_u32)(%s));\n", value, src, dst);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
|
||||||
|
case flag_cmp:
|
||||||
|
switch(size)
|
||||||
|
{
|
||||||
|
case sz_byte:
|
||||||
|
printf("\tsparc_v9_flag_cmp_8(®flags, (uae_u32)(%s), (uae_u32)(%s));\n", src, dst);
|
||||||
|
break;
|
||||||
|
case sz_word:
|
||||||
|
printf("\tsparc_v9_flag_cmp_16(®flags, (uae_u32)(%s), (uae_u32)(%s));\n", src, dst);
|
||||||
|
break;
|
||||||
|
case sz_long:
|
||||||
|
printf("\tsparc_v9_flag_cmp_32(®flags, (uae_u32)(%s), (uae_u32)(%s));\n", src, dst);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
|
||||||
|
case flag_logical:
|
||||||
|
if (strcmp(value, "0") == 0) {
|
||||||
|
printf("\tregflags.nzvc = 0x04;\n");
|
||||||
|
} else {
|
||||||
|
switch(size) {
|
||||||
|
case sz_byte:
|
||||||
|
printf("\tsparc_v9_flag_test_8(®flags, (uae_u32)(%s));\n", value);
|
||||||
|
break;
|
||||||
|
case sz_word:
|
||||||
|
printf("\tsparc_v9_flag_test_16(®flags, (uae_u32)(%s));\n", value);
|
||||||
|
break;
|
||||||
|
case sz_long:
|
||||||
|
printf("\tsparc_v9_flag_test_32(®flags, (uae_u32)(%s));\n", value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
case flag_logical_noclobber:
|
||||||
|
printf("\t{uae_u32 old_flags = regflags.nzvc & ~0x0C;\n");
|
||||||
|
if (strcmp(value, "0") == 0) {
|
||||||
|
printf("\tregflags.nzvc = old_flags | 0x04;\n");
|
||||||
|
} else {
|
||||||
|
switch(size) {
|
||||||
|
case sz_byte:
|
||||||
|
printf("\tsparc_v9_flag_test_8(®flags, (uae_u32)(%s));\n", value);
|
||||||
|
break;
|
||||||
|
case sz_word:
|
||||||
|
printf("\tsparc_v9_flag_test_16(®flags, (uae_u32)(%s));\n", value);
|
||||||
|
break;
|
||||||
|
case sz_long:
|
||||||
|
printf("\tsparc_v9_flag_test_32(®flags, (uae_u32)(%s));\n", value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
printf("\tregflags.nzvc |= old_flags;\n");
|
||||||
|
}
|
||||||
|
printf("\t}\n");
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#elif defined(X86_ASSEMBLY)
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case flag_add:
|
case flag_add:
|
||||||
case flag_sub:
|
case flag_sub:
|
||||||
@ -2341,6 +2494,7 @@ static void generate_one_opcode (int rp)
|
|||||||
}
|
}
|
||||||
fprintf (stblfile, "{ op_%lx_%d, 0, %ld }, /* %s */\n", opcode, postfix, opcode, lookuptab[i].name);
|
fprintf (stblfile, "{ op_%lx_%d, 0, %ld }, /* %s */\n", opcode, postfix, opcode, lookuptab[i].name);
|
||||||
fprintf (headerfile, "extern cpuop_func op_%lx_%d;\n", opcode, postfix);
|
fprintf (headerfile, "extern cpuop_func op_%lx_%d;\n", opcode, postfix);
|
||||||
|
/* fprintf (headerfile, "extern unsigned long REGPARAM2 op_%lx_%d(uae_u32);\n", opcode, postfix); */
|
||||||
printf ("unsigned long REGPARAM2 op_%lx_%d(uae_u32 opcode) /* %s */\n{\n", opcode, postfix, lookuptab[i].name);
|
printf ("unsigned long REGPARAM2 op_%lx_%d(uae_u32 opcode) /* %s */\n{\n", opcode, postfix, lookuptab[i].name);
|
||||||
|
|
||||||
switch (table68k[opcode].stype) {
|
switch (table68k[opcode].stype) {
|
||||||
@ -2507,7 +2661,6 @@ static void generate_func (void)
|
|||||||
|
|
||||||
fprintf (stblfile, "{ 0, 0, 0 }};\n");
|
fprintf (stblfile, "{ 0, 0, 0 }};\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int main (int argc, char **argv)
|
int main (int argc, char **argv)
|
||||||
|
Loading…
Reference in New Issue
Block a user