English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. C/C++

 
 
Thread Tools
Old 19 January 2018, 14:58   #621
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 42
Posts: 20,177
Reason for above mentioned crash is another stack/register parameter conflict. Following memset() expects stack parameters but gets them in registers, causing it to overwrite part of code.

disk.c:

static void fillbuffer(UBYTE *buffer, UBYTE data, globaldata *g)
{
memset (buffer, data + 1, BLOCKSIZE);
}

EDIT: There is also 4 bytes of BSS, where does it come from?. Also is it possible to merge code and data hunks? All data should be read-only anyway. It should also help with absolute addresses.

Last edited by Toni Wilen; 19 January 2018 at 15:39.
Toni Wilen is online now  
AdSense AdSense  
Old Yesterday, 23:53   #622
bebbo
Registered User

 
Join Date: Jun 2016
Location: Hamburg/Germany
Posts: 180
Quote:
Originally Posted by Toni Wilen View Post
Reason for above mentioned crash is another stack/register parameter conflict. Following memset() expects stack parameters but gets them in registers, causing it to overwrite part of code.

disk.c:

static void fillbuffer(UBYTE *buffer, UBYTE data, globaldata *g)
{
memset (buffer, data + 1, BLOCKSIZE);
}
there are plenty headers where you should add __stdargs. I'm working to add it to the libnix headers atm.

Quote:
Originally Posted by Toni Wilen View Post
EDIT: There is also 4 bytes of BSS, where does it come from?. Also is it possible to merge code and data hunks? All data should be read-only anyway. It should also help with absolute addresses.
It's SysBase. (If you don't strip you can read the symbol names)

I am using your files from 20180114 and there is no BSS my linked executable, since I am using -fbaserel :-) (and -msmall-code)

Code:
2 sections, 0 - 1
sizes: 54664, 2284
hunk 000003e9,        HUNK_CODE,      54664
hunk 000003ec,     HUNK_RELOC32,        312
hunk 000003f0,      HUNK_SYMBOL,          8
HUNK_END
hunk 000003ea,        HUNK_DATA,       2280
hunk 000003ec,     HUNK_RELOC32,        328
hunk 000003f0,      HUNK_SYMBOL,         32
HUNK_END
If you qualify data as const it should already end up in the .text section.
messages.c: UBYTE -> const UBYTE

The functiontables do not end up there, I think it's the function pointers.

So you can reach
Code:
hunk 000003ea,        HUNK_DATA,        656
hunk 000003ec,     HUNK_RELOC32,        332
hunk 000003f0,      HUNK_SYMBOL,         20
wait for fautomat's next push then the __stdargs are live and after building the toolchain again, you are a step further.
bebbo is offline  
Old Yesterday, 23:57   #623
Marlon_
Amiga Programmer

Marlon_'s Avatar
 
Join Date: Mar 2016
Location: Sundsvall, Sweden
Age: 29
Posts: 268
Send a message via Skype™ to Marlon_
Exclamation

Using const whenever possible (read-only data) is something everyone should have in mind.

This presentation from CppCon 2016 describes this pretty well:
[ Show youtube player ]
Marlon_ is offline  
Old Today, 08:13   #624
pipper
Registered User

 
Join Date: Jul 2017
Location: San Jose
Posts: 35
This is exactly the presentation that kindled my appetite to come back to the Amiga...
I was thinking "Nowadays there should be really good cross-compilers. Combined with a modern IDE it would make developing for the Amiga a breeze". And then I found beobbo's GCC6 port :-D
pipper is online now  
Old Today, 08:15   #625
alpine9000
Registered User

 
Join Date: Mar 2016
Location: Australia
Posts: 397
Quote:
Originally Posted by Marlon_ View Post
Using const whenever possible (read-only data) is something everyone should have in mind.

This presentation from CppCon 2016 describes this pretty well:
[ Show youtube player ]
I tried making some of my big data tables const and strangely it made the game run (very slightly) slower. I haven’t checked the generated asm yet yo work out why.
alpine9000 is offline  
AdSense AdSense  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
New GCC based dev toolchain for AmigaOS 3.x cla Coders. Releases 8 24 December 2017 11:18
Issue with photon/xxxx WinUAE Toolchain arpz Coders. Asm / Hardware 2 26 September 2015 23:33
New 68k gcc toolchain arti Coders. C/C++ 17 31 July 2015 04:59
Hannibal's WinUAE Demo Toolchain 5 Bobic Amiga scene 1 23 July 2015 22:04
From gcc to vbcc. Cowcat Coders. General 9 06 June 2014 15:45

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:59.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Page generated in 0.17194 seconds with 14 queries