Crash - Launch a new game - ZDoom for Linux
Moderator: GZDoom Developers
Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
-
Blzut3
-

- Posts: 3144
- Joined: Wed Nov 24, 2004 12:59 pm
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
- Contact:
Re: Crash - Launch a new game - ZDoom for Linux
Is there a particular way you want me to do this? I can probably disassemble r_main.
-
Blzut3
-

- Posts: 3144
- Joined: Wed Nov 24, 2004 12:59 pm
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
- Contact:
Re: Crash - Launch a new game - ZDoom for Linux
Here's the output from the disassembler for a version which works (MAKECONSTDivScale(32)) and the broken function. The line numbers may be a little off due to my modifications but you can find DivScale32() in there.
-
Guest
Re: Crash - Launch a new game - ZDoom for Linux
Hi !
Years later, I have the same problem (divide by 0) and I don't understand the fix in "r_main.cpp" or in "gccinlines.h"
Could you give me more precisions ?
Thanx
Years later, I have the same problem (divide by 0) and I don't understand the fix in "r_main.cpp" or in "gccinlines.h"
Could you give me more precisions ?
Thanx
Re: Crash - Launch a new game - ZDoom for Linux
What happens if you change it to this?
Code: Select all
static inline SDWORD DivScale32 (SDWORD a, SDWORD b)
{
SDWORD result, dummy;
asm volatile
("idivl %3"
:"=&a,a" (result),
"=d,d" (dummy)
: "a,a" (0),
"d,d" (a),
"r,m" (b)
: "%cc");
return result;
} -
Blzut3
-

- Posts: 3144
- Joined: Wed Nov 24, 2004 12:59 pm
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
- Contact:
Re: Crash - Launch a new game - ZDoom for Linux
Code: Select all
/home/blzut3/Code/ZDoom/src/gccinlines.h: In member function ‘virtual void AActor::Tick()’:
/home/blzut3/Code/ZDoom/src/gccinlines.h:292:15: error: can't find a register in class ‘AREG’ while reloading ‘asm’
/home/blzut3/Code/ZDoom/src/gccinlines.h:292:15: error: can't find a register in class ‘AREG’ while reloading ‘asm’
/home/blzut3/Code/ZDoom/src/gccinlines.h:292:15: error: can't find a register in class ‘AREG’ while reloading ‘asm’
/home/blzut3/Code/ZDoom/src/gccinlines.h:292:15: error: ‘asm’ operand has impossible constraints
/home/blzut3/Code/ZDoom/src/gccinlines.h:292:15: error: ‘asm’ operand has impossible constraints
/home/blzut3/Code/ZDoom/src/gccinlines.h:292:15: error: ‘asm’ operand has impossible constraints
/home/blzut3/Code/ZDoom/src/gccinlines.h:292:15: error: ‘asm’ operand has impossible constraints
/home/blzut3/Code/ZDoom/src/gccinlines.h:292:15: error: ‘asm’ operand has impossible constraintsRe: Crash - Launch a new game - ZDoom for Linux
Okay, what about this?
Code: Select all
static inline SDWORD DivScale32 (SDWORD a, SDWORD b)
{
SDWORD result, dummy;
int zero = 0;
asm volatile
("idivl %3"
:"=&a,a" (result),
"=d,d" (dummy)
: "a,a" (zero),
"d,d" (a),
"r,m" (b)
: "%cc");
return result;
} -
Blzut3
-

- Posts: 3144
- Joined: Wed Nov 24, 2004 12:59 pm
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
- Contact:
Re: Crash - Launch a new game - ZDoom for Linux
Same, only a line lower.
Edit: changing it to "idivl %4" and dropping the ampersand on the result line works (latter fixes the errors, former to avoid a different division by zero error). You can even use (0) per the first attempt as well this way. I, of course, have no idea what I'm doing, but that's what works.
Edit: changing it to "idivl %4" and dropping the ampersand on the result line works (latter fixes the errors, former to avoid a different division by zero error). You can even use (0) per the first attempt as well this way. I, of course, have no idea what I'm doing, but that's what works.
-
Blzut3
-

- Posts: 3144
- Joined: Wed Nov 24, 2004 12:59 pm
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
- Contact:
Re: Crash - Launch a new game - ZDoom for Linux
Randy, do you want me to go ahead and commit what I have working or do you intend to find a better solution?
Re: Crash - Launch a new game - ZDoom for Linux
Sorry, I forgot about this.
How does this fare:
Actually, I think I like this version better:
How does this fare:
Code: Select all
static inline SDWORD DivScale32 (SDWORD a, SDWORD b)
{
SDWORD result, dummy;
asm volatile
("xor %%eax,%%eax\n\t"
"idivl %3"
:"=&a,&a" (result),
"=d,d" (dummy)
: "d,d" (a),
"r,m" (b)
: "%cc");
return result;
} Code: Select all
int result = 0, dummy;
asm volatile
("idivl %3"
:"+a,a" (result),
"=d,d" (dummy)
: "d,d" (a),
"r,m" (b)
: "%cc");
return result;-
Blzut3
-

- Posts: 3144
- Joined: Wed Nov 24, 2004 12:59 pm
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
- Contact:
Re: Crash - Launch a new game - ZDoom for Linux
Seems to work.
Edit: Still need to check the 2nd version. It will take awhile though since my 32-bit laptop isn't very fast.
Edit 2: Second version works as well.
Edit: Still need to check the 2nd version. It will take awhile though since my 32-bit laptop isn't very fast.
Edit 2: Second version works as well.
Re: Crash - Launch a new game - ZDoom for Linux
Alright. Sounds good.
-
nerotriple6
- Posts: 37
- Joined: Fri May 13, 2011 3:09 pm
Re: Crash - Launch a new game - ZDoom for Linux
Cool, thanks a lot!
Sorry but I just found this thread, relocated. Anywhoo, does it work to compile it normally now or is there some hocus pocus to be done?
Sorry but I just found this thread, relocated. Anywhoo, does it work to compile it normally now or is there some hocus pocus to be done?
-
Edward-san
- Posts: 1774
- Joined: Sat Oct 17, 2009 9:40 am
Re: Crash - Launch a new game - ZDoom for Linux
You should update the svn revision and recompile. This is all 
-
nerotriple6
- Posts: 37
- Joined: Fri May 13, 2011 3:09 pm
Re: Crash - Launch a new game - ZDoom for Linux
Wicked. Thanks for fixing guys!
