powerpc

How can dereferencing a NULL pointer in C not crash a program?

这一生的挚爱 提交于 2019-12-21 03:37:10
问题 I need help of a real C guru to analyze a crash in my code. Not for fixing the crash; I can easily fix it, but before doing so I'd like to understand how this crash is even possible, as it seems totally impossible to me. This crash only happens on a customer machine and I cannot reproduce it locally (so I cannot step through the code using a debugger), as I cannot obtain a copy of this user's database. My company also won't allow me to just change a few lines in the code and make a custom

How to have GCC combine “move r10, r3; store r10” into a “store r3”?

我是研究僧i 提交于 2019-12-20 07:56:56
问题 I'm working Power9 and utilizing the hardware random number generator instruction called DARN. I have the following inline assembly: uint64_t val; __asm__ __volatile__ ( "xor 3,3,3 \n" // r3 = 0 "addi 4,3,-1 \n" // r4 = -1, failure "1: \n" ".byte 0xe6, 0x05, 0x61, 0x7c \n" // r3 = darn 3, 1 "cmpd 3,4 \n" // r3 == -1? "beq 1b \n" // retry on failure "mr %0,3 \n" // val = r3 : "=g" (val) : : "r3", "r4", "cc" ); I had to add a mr %0,3 with "=g" (val) because I could not get GCC to produce

Understanding PowerPC rlwinm instruction

徘徊边缘 提交于 2019-12-19 03:25:16
问题 So I finally convinced myself to try and learn/use PowerPC (PPC). Everything is going well and most information was found online. However, when looking at some examples I came across this: rlwinm r3, r3, 0,1,1 How would I do this in C? I tried doing some research, but couldn't find anything that helped me out. Thanks in advance! 回答1: rlwinm stands for "Rotate Left Word Immediate then aNd with Mask, and it's correct usage is rlwinm RA, RS, SH, MB, ME As per the description page: RA Specifies

Installing PIL on OS X Snow Leopard w/Xcode4 (no PPC support)

醉酒当歌 提交于 2019-12-18 10:14:19
问题 Xcode4 dropped PPC support, so when I try building PIL, it throws hate: Bens-MacBook-Air:Imaging-1.1.7 bkeating$ python setup.py build running buildrunning build_pyrunning build_ext --- using frameworks at /System/Library/Frameworks building '_imaging' extension /usr/bin/gcc-4.0 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch ppc -arch x86_64 -pipe -DHAVE_LIBJPEG -DHAVE_LIBZ -I/System/Library/Frameworks/Tcl.framework

Emulating variable bit-shift using only constant shifts?

喜欢而已 提交于 2019-12-17 18:54:34
问题 I'm trying to find a way to perform an indirect shift-left/right operation without actually using the variable shift op or any branches. The particular PowerPC processor I'm working on has the quirk that a shift-by-constant-immediate, like int ShiftByConstant( int x ) { return x << 3 ; } is fast, single-op, and superscalar, whereas a shift-by-variable, like int ShiftByVar( int x, int y ) { return x << y ; } is a microcoded operation that takes 7-11 cycles to execute while the entire rest of

Do I really have to worry about alignment when using placement new operator?

六眼飞鱼酱① 提交于 2019-12-17 15:39:27
问题 I read this When should I worry about alignment? but I am still do not know if I have to worry about not aligned pointer returned by placement new operator - like in this example: class A { public: long double a; long long b; A() : a(1.3), b(1234) {} }; char buffer[64]; int main() { // (buffer + 1) used intentionally to have wrong alignment A* a = new (buffer + 1) A(); a->~A(); } __alignof(A) == 4 , (buffer + 1) is not aligned to 4 . But everything works fine - full example here: http:/

How can we restore ppc/ppc64 as well as full 10.4/10.5 SDK support to Xcode 4?

时间秒杀一切 提交于 2019-12-17 01:34:11
问题 Since Apple only ships SDK 10.6 with Xcode4, developing PPC applications with Xcode4 became impossible. While it is possible to develop applications with Xcode4 that can also run on 10.5 and maybe even on 10.4 systems (by selecting SDK 10.6, but deployment target 10.5 or 10.4), they will only run on Intel Macs because you need at least SDK 10.5 for building PPC applications. Further there are some rare cases, where you really need to build against an SDK prior to 10.6 for full platform

installation of package ‘devtools’ had non-zero exit status in a powerpc

时光总嘲笑我的痴心妄想 提交于 2019-12-14 00:18:57
问题 I'm trying to install devtools in a PowerPC with a R version 3.1.1 but failed at the end because the curl library: ... ** testing if installed package can be loaded Error in dyn.load(file, DLLpath = DLLpath, ...) : unable to load shared object '/path to/R/powerpc-unknown-linux-gnu-library/3.1/curl/libs/curl.so': /path to/R/powerpc-unknown-linux-gnu-library/3.1/curl/libs/curl.so: undefined symbol: BSWAP_32 Error: loading failed Execution halted ERROR: loading failed * removing ‘/path to/R

Is there something like x86 cpuid() available for PowerPC?

被刻印的时光 ゝ 提交于 2019-12-13 18:30:55
问题 I'd like to write some C code be able to query processor attributes on PowerPC, much like one can do with cpuid on x86. I'm after things like brand, model, stepping, SIMD width, available operations, so that there can be run-time confirmation that the code is being used on a compatible platform before something blows up. Is there a general mechanism for doing this on PowerPC? If so, where can one read about it? 回答1: Note that PowerPC has not dozens of extensions / features like x86. It is

1252-142 Syntax error from AIX assembler due to local label

核能气质少年 提交于 2019-12-13 17:04:30
问题 I'm catching an assembler error when using inline assembly and a local label. The compiler is GCC, and the machine is PowerPC running AIX. The code reads the timestamp (it is roughly equivalent to rdtsc ): static unsigned long long cpucycles( void ) { unsigned long long int result=0; unsigned long int upper, lower,tmp; __asm__ __volatile__ ( "0: \n\t" "mftbu %0 \n\t" "mftb %1 \n\t" "mftbu %2 \n\t" "cmpw %2,%0 \n\t" "bne- 0b \n\t" : "=r"(upper),"=r"(lower),"=r"(tmp) : : ); result = upper;