Click Here
home features news forums classifieds faqs links search
6071 members 
Amiga Q&A /  Free for All /  Emulation /  Gaming / (Latest Posts)
Login

Nickname

Password

Lost Password?

Don't have an account yet?
Register now!

Support Amigaworld.net
Your support is needed and is appreciated as Amigaworld.net is primarily dependent upon the support of its users.
Donate

Menu
Main sections
» Home
» Features
» News
» Forums
» Classifieds
» Links
» Downloads
Extras
» OS4 Zone
» IRC Network
» AmigaWorld Radio
» Newsfeed
» Top Members
» Amiga Dealers
Information
» About Us
» FAQs
» Advertise
» Polls
» Terms of Service
» Search

IRC Channel
Server: irc.amigaworld.net
Ports: 1024,5555, 6665-6669
SSL port: 6697
Channel: #Amigaworld
Channel Policy and Guidelines

Who's Online
23 crawler(s) on-line.
 165 guest(s) on-line.
 1 member(s) on-line.


 Gunnar

You are an anonymous user.
Register Now!
 Gunnar:  2 mins ago
 pixie:  1 hr 23 mins ago
 DiscreetFX:  2 hrs 2 mins ago
 DWolfman:  2 hrs 11 mins ago
 cncparts:  3 hrs 44 mins ago
 saipaman4366:  4 hrs 31 mins ago
 Beajar:  4 hrs 50 mins ago
 Rob:  4 hrs 52 mins ago
 agami:  5 hrs 56 mins ago
 RobertB:  6 hrs 15 mins ago

/  Forum Index
   /  Amiga General Chat
      /  Amiga Inc. Loses U.S. Trademarks
Register To Post

Goto page ( Previous Page 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 Next Page )
PosterThread
A1200 
Re: Cloanto acquire Amiga Inc Trademark
Posted on 20-Apr-2021 20:41:57
#1261 ]
Elite Member
Joined: 5-May-2003
Posts: 3087
From: Westhall, UK

@AP

Thing is he's a business leader in the market surrounding this website. He would do well not posting on here, loved or hated, it's just not worth it. I would post news items if I were Hyperion and leave the chit chat to us mere mortals.

_________________
Amiga A1200, 3.1 ROMs, Blizzard 1230 MKIV 64MB & FPU, 4GB DoM SSD, Workbench 3.1

 Status: Offline
Profile     Report this post  
Lou 
Re: Cloanto acquire Amiga Inc Trademark
Posted on 21-Apr-2021 3:49:21
#1262 ]
Elite Member
Joined: 2-Nov-2004
Posts: 4169
From: Rhode Island

ADA?

Isn't that just a fancy object-based Pascal?

Give me VB.net or give me death!!!

 Status: Offline
Profile     Report this post  
simplex 
Re: Cloanto acquire Amiga Inc Trademark
Posted on 21-Apr-2021 4:00:49
#1263 ]
Cult Member
Joined: 5-Oct-2003
Posts: 896
From: Hattiesburg, MS

@Lou

Quote:
ADA?

Isn't that just a fancy object-based Pascal?

No.

In fact, the 1983 Ada standard had no object-oriented features per se. On the other hand, Ada 95 was the first ISO standardized language with object-oriented features. They're called tagged records.

(Perhaps you're thinking of Oberon? That was designed by Niklaus Wirth, who also designed Pascal (and Modula and Modula-2!) and is indeed object-oriented. Wirth designed it to be as simple as possible, but no simpler. IMHO he failed. But it is a nice language, and Wirth is a much, much smarter guy than I.)

(I wonder if the guy who asked for a language war regrets it yet.)

_________________
I've decided to follow an awful lot of people I respect and leave AmigaWorld. If for some reason you want to talk to me, it shouldn't take much effort to find me.

 Status: Offline
Profile     Report this post  
ppcamiga1 
Re: Cloanto acquire Amiga Inc Trademark
Posted on 21-Apr-2021 7:55:24
#1264 ]
Cult Member
Joined: 23-Aug-2015
Posts: 762
From: Unknown

@michalsc

Quote:

movz w1, #0xbeef
movk w1, #0xdead, lsl #16


This is hand made assembler code not what produce gcc for example on rpi.
Old C/C++ Amiga code should work after just recompilation.
It works on ppc because on ppc like m68k data AND code are 32 bit big endian.
It is not possible on ARM because on ARM code is little endian.


 Status: Offline
Profile     Report this post  
michalsc 
Re: Cloanto acquire Amiga Inc Trademark
Posted on 21-Apr-2021 8:52:24
#1265 ]
AROS Core Developer
Joined: 14-Jun-2005
Posts: 377
From: Germany

@ppcamiga1

Quote:
This is hand made assembler code not what produce gcc for example on rpi.


Are you trying to be smart? Have you ever worked with aarch32/aarch64? Have you ever programmed them? HAve you ever used/programmed ARM in big endian mode? Have you ever read ARM manuals? Hand made assembler? Hmm, here you go:

Quote:

➜ ~ cat foo.c

unsigned int foo()
{
return 0xdeadbeef;
}

➜ ~ /opt/cross/bin/aarch64-linux-gcc -Os -S -mbig-endian foo.c
➜ ~ cat foo.s
.arch armv8-a
.file "foo.c"
.text
.align 2
.global foo
.type foo, %function
foo:
.LFB0:
.cfi_startproc
mov w0, 48879
movk w0, 0xdead, lsl 16
ret
.cfi_endproc
.LFE0:
.size foo, .-foo
.ident "GCC: (GNU) 8.2.0"
.section .note.GNU-stack,"",@progbits
➜ ~ /opt/cross/bin/aarch64-linux-gcc -Os -c -mbig-endian foo.c
➜ ~ /opt/cross/bin/aarch64-linux-objdump -S foo.o

foo.o: file format elf64-bigaarch64


Disassembly of section .text:

0000000000000000 :
0: 5297dde0 mov w0, #0xbeef // #48879
4: 72bbd5a0 movk w0, #0xdead, lsl #16
8: d65f03c0 ret


Do you prefer 32-bit arm? Here you go, this time with dump of binary files:

Quote:

➜ ~ /opt/cross/bin/arm-linux-gnueabihf-gcc -nostartfiles -nostdlib -Os -o foo foo.c
/opt/cross/lib/gcc/arm-linux-gnueabihf/8.2.0/../../../../arm-linux-gnueabihf/bin/ld: warning: cannot find entry symbol _start; defaulting to 0000000000010074
➜ ~ /opt/cross/bin/arm-linux-gnueabihf-objcopy -O binary foo foo.bin
➜ ~ hexdump -C foo.bin
00000000 00 00 9f e5 1e ff 2f e1 ef be ad de |....../.....|
0000000c
➜ ~ /opt/cross/bin/arm-linux-gnueabihf-gcc -mbe8 -mbig-endian -Wl,--be8 -Wl,--format=elf32-bigarm -nostartfiles -nostdlib -Os -o foo foo.c
/opt/cross/lib/gcc/arm-linux-gnueabihf/8.2.0/../../../../arm-linux-gnueabihf/bin/ld: warning: cannot find entry symbol _start; defaulting to 0000000000010074
➜ ~ /opt/cross/bin/arm-linux-gnueabihf-objcopy -O binary foo foo.bin
➜ ~ hexdump -C foo.bin
00000000 00 00 9f e5 1e ff 2f e1 de ad be ef |....../.....|
0000000c


There you can clearly see that loading constant from the code section does not change instruction stream (first 8 bytes), but definitely changes the last 4 bytes from little endian byte order to big endian byte order. From programmer point of view the CPU behaves in this case as any regular big-endian cpu. Even if byte order of CPU instructions remained LE.

Quote:

Old C/C++ Amiga code should work after just recompilation.
It works on ppc because on ppc like m68k data AND code are 32 bit big endian.


This is exactly the case. If AmigaOS was using 32bit ARM cpu operated in big endian mode, re-using old C/C++ Amiga code would be just a matter of recompilation.

Quote:
It is not possible on ARM because on ARM code is little endian.


Again. It does not matter what byte order the instruction stream is using. And, yet again, feel free to prove me wrong with something more than words.

Last edited by michalsc on 21-Apr-2021 at 09:04 AM.
Last edited by michalsc on 21-Apr-2021 at 09:02 AM.

 Status: Offline
Profile     Report this post  
Lou 
Re: Cloanto acquire Amiga Inc Trademark
Posted on 21-Apr-2021 12:06:49
#1266 ]
Elite Member
Joined: 2-Nov-2004
Posts: 4169
From: Rhode Island

@simplex

Quote:

simplex wrote:
@Lou

Quote:
ADA?

Isn't that just a fancy object-based Pascal?

No.

In fact, the 1983 Ada standard had no object-oriented features per se. On the other hand, Ada 95 was the first ISO standardized language with object-oriented features. They're called tagged records.

(Perhaps you're thinking of Oberon? That was designed by Niklaus Wirth, who also designed Pascal (and Modula and Modula-2!) and is indeed object-oriented. Wirth designed it to be as simple as possible, but no simpler. IMHO he failed. But it is a nice language, and Wirth is a much, much smarter guy than I.)

(I wonder if the guy who asked for a language war regrets it yet.)

I took an ADA class in college around 91-92.... It seemed exactly as I described...and it was object-based, not fully object oriented. Was also favored by the US military from what I was told at the time.

 Status: Offline
Profile     Report this post  
tygre 
Re: Cloanto acquire Amiga Inc Trademark
Posted on 21-Apr-2021 12:48:35
#1267 ]
Regular Member
Joined: 23-Mar-2011
Posts: 279
From: Montreal, QC, Canada

@simplex

Quote:

By contrast, Ada is almost certainly the programming language used in the last airplane you flew, the last train you rode, etc.


By experience, I must unfortunately report that trains, cars, etc. use a mixture of assembly, C, C++, Java, C#... all the way to JavaScript

Of course, there are some safety measures: design and code reviews, extensive testing, etc. but they don't prevent, from times to times, horrible things to happen! See this...

As for the ARM discussion, it's illuminating, bring it on!

And my contribution to the language war: Java before they introduced all these bloating features, like generics, lambdas, etc. (So, that would be Java 1.6 or 1.7)

Cheers!

_________________
Tygre
Scientific Progress Goes Boing!

 Status: Offline
Profile     Report this post  
michalsc 
Re: Cloanto acquire Amiga Inc Trademark
Posted on 21-Apr-2021 13:58:20
#1268 ]
AROS Core Developer
Joined: 14-Jun-2005
Posts: 377
From: Germany

@tygre

Quote:
As for the ARM discussion, it's illuminating, bring it on!


Here you go. Side-by-side comparison of M68k code and its JIT translation for the AArch64 operated in big endian mode. A lot of FPU since it is a part of path tracer code. Result of my Emu68, by the way :)

Last edited by michalsc on 21-Apr-2021 at 02:03 PM.

 Status: Offline
Profile     Report this post  
simplex 
Re: Cloanto acquire Amiga Inc Trademark
Posted on 21-Apr-2021 14:33:28
#1269 ]
Cult Member
Joined: 5-Oct-2003
Posts: 896
From: Hattiesburg, MS

@Lou

Quote:
I took an ADA class in college around 91-92.... It seemed exactly as I described...and it was object-based, not fully object oriented.

What do you mean by "object-based"? Ada 83 had something called derived types, but that's a method to build subtypes, not to facilitate object-oriented program with inheritance and the like.

Quote:
Was also favored by the US military from what I was told at the time.

That's correct. The name was trademarked IIRC, and every Ada compiler had to pass a comprehensive series of tests (ACATS). (They still do.) The DoD required Ada to be used in all new contracts.

This being America, companies were pretty resistant to do what someone else required, regardless of how sensible it was (see for instance the paper "Ada outperforms assembly") and waivers were routinely issued (the paper mentions this) to the point that DoD eventually gave up on that requirement in the mid-90s when they shifted to COTS. It didn't help that the first Ada compilers weren't all that great, so that by the 90s Ada was seen as "too complicated." The first C++ compilers had a pretty bad reputation, too, but C++ has long been more complicated & IMHO only recently caught up to some of Ada's biggest features, such as a standard for tasking / threading in C++11, a machine model for said standard in the same, and only in C++20 did they add true modularity (I think; I haven't actually read up on that yet but I know it was planned).

_________________
I've decided to follow an awful lot of people I respect and leave AmigaWorld. If for some reason you want to talk to me, it shouldn't take much effort to find me.

 Status: Offline
Profile     Report this post  
simplex 
Re: Cloanto acquire Amiga Inc Trademark
Posted on 21-Apr-2021 14:50:57
#1270 ]
Cult Member
Joined: 5-Oct-2003
Posts: 896
From: Hattiesburg, MS

@tygre

Quote:
By experience, I must unfortunately report that trains, cars, etc. use a mixture of assembly, C, C++, Java, C#... all the way to JavaScript

I didn't say "cars", though I am familiar with MISRA C. Ironically, there's evidence that MISRA C actually does the opposite of what it intends. Here's a golden quote from that article:
Quote:
this makes it possible that adherence to the MISRA standard as a whole would have made the software less reliable.

After all, the problem is that they're starting from C, a language where "unsafety" is a feature, not a bug.

For trains I would hazard a guess that it depends very much on what system on the train you're talking about, and possibly the train corporation; see here for instance. I could easily see JavaScript being used for certain things.

That said, rail is such a big part of AdaCore's business that they dedicate an entire page to it. But, yeah, I remember seeing a job ad a couple of decades ago for Norfolk Southern where they wanted Java programmers, and I considered applying.

Having said so much on Ada's behalf, I'll add that the general impression in the CS community that Ada is "dead", "dying", and/or "too complicated" has an effect. "The unwisdom of crowds" and all that.

Quote:
And my contribution to the language war: Java before they introduced all these bloating features, like generics, lambdas, etc. (So, that would be Java 1.6 or 1.7)

I agree, to an extent! The designers of later Java looked at what worked in other languages (*cough* Ada *cough*, C++, and of course LISP where many of these features originate) and decided to implement in the worst way possible. Kotlin improves on it by defining "in" and "out" parameters for the generics. Of course, the Kotlin designers also implemented a language with very strong null safety mechanisms, whereas Java's designers thought C's profligate use of null was a great idea, despite billions of dollars' worth of mistakes.

Quote:
As for the ARM discussion, it's illuminating, bring it on!

I agree; I've been enjoying that. I've always wondered about the big-/little-endian implementation on ARM.

_________________
I've decided to follow an awful lot of people I respect and leave AmigaWorld. If for some reason you want to talk to me, it shouldn't take much effort to find me.

 Status: Offline
Profile     Report this post  
Rose 
Re: Cloanto acquire Amiga Inc Trademark
Posted on 21-Apr-2021 16:28:07
#1271 ]
Cult Member
Joined: 5-Nov-2009
Posts: 982
From: Unknown

@simplex

Quote:
Having said so much on Ada's behalf, I'll add that the general impression in the CS community that Ada is "dead", "dying", and/or "too complicated" has an effect.


Must be same guys who have been telling 30 years that Cobol is dead...

 Status: Offline
Profile     Report this post  
bison 
Re: Cloanto acquire Amiga Inc Trademark
Posted on 21-Apr-2021 16:31:09
#1272 ]
Elite Member
Joined: 18-Dec-2007
Posts: 2112
From: N-Space

@simplex

Quote:
(I wonder if the guy who asked for a language war regrets it yet.)




Quote:
whereas Java's designers thought C's profligate use of null was a great idea

It's hard to get rid of null, since it's just an abstraction for a number, usually zero. The fact that indirection on zero causes a segfault is a feature, not a bug.

Last edited by bison on 21-Apr-2021 at 04:41 PM.

_________________
"Unix is supposed to fix that." -- Jay Miner

 Status: Offline
Profile     Report this post  
Lou 
Re: Cloanto acquire Amiga Inc Trademark
Posted on 21-Apr-2021 16:48:38
#1273 ]
Elite Member
Joined: 2-Nov-2004
Posts: 4169
From: Rhode Island

@simplex

Quote:

simplex wrote:
@Lou

Quote:
I took an ADA class in college around 91-92.... It seemed exactly as I described...and it was object-based, not fully object oriented.

What do you mean by "object-based"? Ada 83 had something called derived types, but that's a method to build subtypes, not to facilitate object-oriented program with inheritance and the like.

Exactly. Objects are just fancy 'types' with properties and methods. So that's why it is labelled object-base and not object-oriented.
Old-school Visual Basic was also considered object-based and not fully object-oriented...though it does support interfaces.

Now - VB.net - is god's gift to programmers and curse Microsoft for abandoning it!

 Status: Offline
Profile     Report this post  
tygre 
Re: Cloanto acquire Amiga Inc Trademark
Posted on 21-Apr-2021 16:54:22
#1274 ]
Regular Member
Joined: 23-Mar-2011
Posts: 279
From: Montreal, QC, Canada

@simplex

Quote:

Quote:
Was also favored by the US military from what I was told at the time.

That's correct. The name was trademarked IIRC, and every Ada compiler had to pass a comprehensive series of tests (ACATS). (They still do.) The DoD required Ada to be used in all new contracts.


I worked for a while with the JCK, the Java compliance tests... every Java compilers must pass them to be called "Java"...

Of course, these tests do not prevent the use of null references and such

(And, actually, they (used to?) include plenty of "special cases" because the "baseline implementation" is wrong (either the Sun/Oracle Java compiler or JVM) but it becomes the "standard" to be compatible...)

Last edited by tygre on 21-Apr-2021 at 04:54 PM.

_________________
Tygre
Scientific Progress Goes Boing!

 Status: Offline
Profile     Report this post  
tygre 
Re: Cloanto acquire Amiga Inc Trademark
Posted on 21-Apr-2021 17:00:13
#1275 ]
Regular Member
Joined: 23-Mar-2011
Posts: 279
From: Montreal, QC, Canada

@michalsc

More! Yes, I'm a bit of a masochist

More seriously, I really like the discussion, I (think that I) finally understand some of the problems with endianness... Some questions though...

1) How often would C code do something like that:

typedef union
{
unsigned int data;
struct {
unsigned short high;
unsigned short low;
}
} smart_t;

2) What are other "typical" C code that is not "endianness-safe"?

I assume that, as written above, recompiling would solve the problems at the assembly level... so it's rather at the C level that efforts are needed?

_________________
Tygre
Scientific Progress Goes Boing!

 Status: Offline
Profile     Report this post  
simplex 
Re: Cloanto acquire Amiga Inc Trademark
Posted on 21-Apr-2021 17:05:59
#1276 ]
Cult Member
Joined: 5-Oct-2003
Posts: 896
From: Hattiesburg, MS

@tygre

Quote:
I worked for a while with the JCK, the Java compliance tests... every Java compilers must pass them to be called "Java"...

SO... if a Java compiler fails JCK, does that mean it can't do "jack"?

Quote:
Of course, these tests do not prevent the use of null references and such

Neither do Ada's FWIW, because Ada still has the "nil" pointer. However, Ada is designed in such a way that the ordinary programmer rarely has to use pointers. -- Well, in my very limited experience. Also, that's more true of Ada 12 than of Ada 83 I think. When s/he does use pointers, there are many safeguards to prevent dangling pointers, and even then you can create them. (I've done it.)

As I understand it, only Eiffel and Kotlin make a big deal about their null safety. (Well, also Rust and SPARK but we've already talked about that.) Eiffel calls it Void safety and their version is supposedly more robust than Kotlin's. I don't remember the details; it was a conversation on comp.lang.eiffel a couple of years ago. It's too bad Bertrand Meyer decided to invent Yet Another Programming Language and trying to wage war on Ada instead of going to, say, the Ada Rapporteur Group and suggesting that they implement his idea of Design by Contract (which they eventually did anyway, and in the SPARK dialect it's A Really Big Deal).

Quote:
And, actually, they (used to?) include plenty of "special cases" because the "baseline implementation" is wrong (either the Sun/Oracle Java compiler or JVM) but it becomes the "standard" to be compatible...

Rust aficionados take note: that's what happens when a company controls the standard.

_________________
I've decided to follow an awful lot of people I respect and leave AmigaWorld. If for some reason you want to talk to me, it shouldn't take much effort to find me.

 Status: Offline
Profile     Report this post  
ppcamiga1 
Re: Cloanto acquire Amiga Inc Trademark
Posted on 22-Apr-2021 8:40:39
#1277 ]
Cult Member
Joined: 23-Aug-2015
Posts: 762
From: Unknown

@michalsc

Something simple like that

int a=0xdeadbeef;

int main()
{
return a;
}

and it is compiled by gcc on ARM in wrog little endian format

0001000 98 0f 02 00 00 00 00 00 00 00 00 00 ef be ad de

and after setenv bi it will stay in wrog little endian format

and has wrong value

ARM is not real big endian cpu. It is useless for Amiga Os.

Old C/C++ Amiga code should work after just recompilation. Like on ppc.

 Status: Offline
Profile     Report this post  
ppcamiga1 
Re: Cloanto acquire Amiga Inc Trademark
Posted on 22-Apr-2021 8:53:18
#1278 ]
Cult Member
Joined: 23-Aug-2015
Posts: 762
From: Unknown

@tygre

Quote:
1) How often would C code do something like that:

Quote:
2) What are other "typical" C code that is not "endianness-safe"?


It is no important how often thing like that are used.
It is important they exist.
Which results in additional work on ARM, like code analysis, tests.
Where on ppc it is just recompilation.

 Status: Offline
Profile     Report this post  
michalsc 
Re: Cloanto acquire Amiga Inc Trademark
Posted on 22-Apr-2021 9:01:47
#1279 ]
AROS Core Developer
Joined: 14-Jun-2005
Posts: 377
From: Germany

@ppcamiga1

Quote:
and it is compiled by gcc on ARM in wrog little endian format


because you have not told gcc that it should generate code for ARM in big endian mode. Have you done that on purpose? I have shown how binaries of ARM look like depending on the compile options used. Have you ignored that post because it proves you wrong? Have you expected that after opcode "setend be" the binary will flip itself to big endian??

I believe that your compiler produces little endian by default, because almost everyone uses arm in little endian mode. But you can switch the compiler to produce big endian binary any time with proper command line options. Alternatively you can make entire toolchain with big endian as default und little endian as option.

With proper compiler flags the binary is correct:

Quote:

➜ grpc /opt/cross/bin/arm-linux-gnueabihf-gcc -mbe8 -mbig-endian -Wl,--be8 -Wl,--format=elf32-bigarm -nostartfiles -nostdlib -Os -o test test.c
/opt/cross/lib/gcc/arm-linux-gnueabihf/8.2.0/../../../../arm-linux-gnueabihf/bin/ld: warning: cannot find entry symbol _start; defaulting to 0000000000010094
➜ grpc /opt/cross/bin/aarch64-linux-objcopy -O binary test test.bin
➜ grpc hexdump -C test.bin
00000000 04 30 9f e5 00 00 93 e5 1e ff 2f e1 00 02 00 a4 |.0......../.....|
00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00010010 de ad be ef |....|
00010014


Quote:
ARM is not real big endian cpu.


No, of course not. ARM is bi-endian CPU.

Quote:
It is useless for Amiga Os.


It is useful for AmigaOS when running in big endian mode.

Quote:
Old C/C++ Amiga code should work after just recompilation. Like on ppc.


With properly configured toolchain or with proper command line switches old C/C++ amiga code would work just after recompilation, like on ppc.

 Status: Offline
Profile     Report this post  
michalsc 
Re: Cloanto acquire Amiga Inc Trademark
Posted on 22-Apr-2021 9:22:05
#1280 ]
AROS Core Developer
Joined: 14-Jun-2005
Posts: 377
From: Germany

@tygre

Quote:
1) How often would C code do something like that


More often then I would like to. Last example is the Capstone project which I use to disassemble aarch64 and m68k instructions in my Emu68 project. Capstone is written with endianess in mind, but still it failed for me. Since I am using AArch64 in big endian mode, capstone was showing float numbers incorrectly. Surprisingly enough, all integers and double numbers were displayed properly. Why?

After checking the source code I have noticed that the immediate operands of instructions are stored in a union like this one:

typedef union {
uint64_t i_num;
double d_num;
float f_num;
} immediate;

When analysing the opcodes, capstone was promoting all integer immediates to 64bit form and stored in i_num field. For floating point numbers it was reading the number as integer (either uint32_t or uint64_t) and storing into i_num directly without any further processing of the number.
On little endian CPUs all went just ok. Fetching any value was correct, because the data begins from the lowest address for every type. In big endian mode on AArch64 it failed, because the 32bit float number was in wrong half of the 64-bit wide field.

So you see, even if you try to be endian aware, issues can just pop out in unexpected moments :)


Quote:
2) What are other "typical" C code that is not "endianness-safe"?


More then you think. The most common case is working with binary data of any form. Imagine some simple check of a header of some binary file:

if (data8[0] == 'E' && data8[1] == 'L' && data8[2] == 'F')

Compiler may optimize it to a 32bit number check (with ignoring data[3] through a mask) instead of testing one byte after another. For big endian machine such optimization could look like this:

if ((data32[0] & 0xffffff00) == 'ELF\0')

where on little endian machine it would be rather something like

if ((data32[0] & 0x00ffffff) == '\0FLE')

Thereby you have no control over it what the compiler will "optimize" for you and what not. Alone for this reason coexistence of big- and little-endian binaries and programms in a fully open OS environment as it is in case of AmigaOS and derivates is not possible. It does not work since after compilation the information about structure of the data is lost.

 Status: Offline
Profile     Report this post  
Goto page ( Previous Page 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 Next Page )

[ home ][ about us ][ privacy ] [ forums ][ classifieds ] [ links ][ news archive ] [ link to us ][ user account ]
Copyright (C) 2000 - 2019 Amigaworld.net.
Amigaworld.net was originally founded by David Doyle