ObjFW  Check-in [7ef650a6ec]

Overview
Comment:OFSystemInfo: AltiVec detection for AmigaOS 4
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 7ef650a6ec946127a576f6007e9c26b83c80b1d46e86a114cf660b8dab5feb19
User & Date: js on 2019-04-22 09:17:41
Other Links: manifest | tags
Context
2019-04-22
16:53
OFString_UTF8: Improved range checks check-in: 0b962df002 user: js tags: trunk
09:17
OFSystemInfo: AltiVec detection for AmigaOS 4 check-in: 7ef650a6ec user: js tags: trunk
2019-04-21
21:41
.travis.yml: Disable Amiga till amiga-gcc is fixed check-in: 09382029f6 user: js tags: trunk
Changes

Modified src/OFSystemInfo.m from [a2974f4317] to [10db3a92d5].

28
29
30
31
32
33
34






35
36
37
38
39
40
41
42
#ifdef HAVE_SYS_UTSNAME_H
# include <sys/utsname.h>
#endif
#ifdef OF_MACOS
# include <sys/sysctl.h>
#endif







#ifdef OF_MORPHOS
# include <exec/system.h>
# include <proto/exec.h>
#endif

#import "OFSystemInfo.h"
#import "OFApplication.h"
#import "OFArray.h"







>
>
>
>
>
>
|







28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifdef HAVE_SYS_UTSNAME_H
# include <sys/utsname.h>
#endif
#ifdef OF_MACOS
# include <sys/sysctl.h>
#endif

#if defined(OF_AMIGAOS4)
# define __USE_INLINE__
# define __NOLIBBASE__
# define __NOGLOBALIFACE__
# include <exec/exectags.h>
# include <proto/exec.h>
#elif defined(OF_MORPHOS)
# include <exec/system.h>
# include <proto/exec.h>
#endif

#import "OFSystemInfo.h"
#import "OFApplication.h"
#import "OFArray.h"
92
93
94
95
96
97
98




99
100
101
102
103
104
105
#endif

#if defined(OF_X86_64) || defined(OF_X86)
struct x86_regs {
	uint32_t eax, ebx, ecx, edx;
};
#endif





static size_t pageSize = 4096;
static size_t numberOfCPUs = 1;
static OFString *operatingSystemName = nil;
static OFString *operatingSystemVersion = nil;

static void







>
>
>
>







98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#endif

#if defined(OF_X86_64) || defined(OF_X86)
struct x86_regs {
	uint32_t eax, ebx, ecx, edx;
};
#endif

#ifdef OF_AMIGAOS4
extern struct ExecIFace *IExec;
#endif

static size_t pageSize = 4096;
static size_t numberOfCPUs = 1;
static OFString *operatingSystemName = nil;
static OFString *operatingSystemVersion = nil;

static void
616
617
618
619
620
621
622






623
624
625
626
627
628
629
{
# if defined(OF_MACOS)
	int name[2] = { CTL_HW, HW_VECTORUNIT }, value = 0;
	size_t length = sizeof(value);

	if (sysctl(name, 2, &value, &length, NULL, 0) == 0)
		return value;






# elif defined(OF_MORPHOS)
	uint32_t supportsAltiVec;

	if (NewGetSystemAttrs(&supportsAltiVec, sizeof(supportsAltiVec),
	    SYSTEMINFOTYPE_PPC_ALTIVEC, TAG_DONE) > 0)
		return supportsAltiVec;








>
>
>
>
>
>







626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
{
# if defined(OF_MACOS)
	int name[2] = { CTL_HW, HW_VECTORUNIT }, value = 0;
	size_t length = sizeof(value);

	if (sysctl(name, 2, &value, &length, NULL, 0) == 0)
		return value;
# elif defined(OF_AMIGAOS4)
	uint32_t vectorUnit;

	GetCPUInfoTags(GCIT_VectorUnit, &vectorUnit, TAG_END);

	return (vectorUnit == VECTORTYPE_ALTIVEC);
# elif defined(OF_MORPHOS)
	uint32_t supportsAltiVec;

	if (NewGetSystemAttrs(&supportsAltiVec, sizeof(supportsAltiVec),
	    SYSTEMINFOTYPE_PPC_ALTIVEC, TAG_DONE) > 0)
		return supportsAltiVec;