Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Gforth strange bug with SAVECROSS
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
David Kuehling  
View profile  
 More options Feb 8, 6:36 pm
Newsgroups: comp.lang.forth
From: David Kuehling <dvdkh...@gmx.de>
Date: Thu, 09 Feb 2012 00:36:54 +0100
Local: Wed, Feb 8 2012 6:36 pm
Subject: Gforth strange bug with SAVECROSS
Hi,

I'm still tinkering around with Gforth-EC, and think I've hit a bug with
Gforth's cross-compiler, in SAVECROSS.

Specifically this code causes crashes for me and the bug is easily spotted:

  >rom dictionary >rmem @ there
  s" rom" X $has? IF  dictionary >rstart @ -  THEN
  r@ ~~ write-file throw \ write image

For romless gforth-ec builds, it writes 'THERE' number of bytes into the
image file.  However, it doesn't start at target address 0, but at
the dictionary region's start addres (corresponding to whatever was
configured via SETVALUE KERNEL-START resp. REGION DICTIONARY) .

Even the 8086 gforth-ec build has the problem (but luckily doesn't
crash):

DP is $37FE at the end of compilation, so it writes $37FE bytes to the
.com kernel.  But the first 256 bytes are not part of the dictionary
region, so it writes addresses 256...256+$37FE to the image, resulting
in 256 zeros being written at the end (easily verified via hexdump -C
gf8086.com).

Now, for my LM32/milkymist GForth-EC build, KERNEL-START is $40000000,
now it really attempts to write $40006380 bytes to the image, suffering
a segfault (because the dictionary only has 256KB).

The fix /looks/ easy, just remove the If-statement:

  >rom dictionary >rmem @ there
  dictionary >rstart @ -
  r@ ~~ write-file throw \ write image

now the 8086 and lm32 gforth-ec images build correctly.  However, as a
side effect the normal non-ec gforth kernel build fails :

 ./BUILD-FROM-SCRATCH
 [..]
 GFORTH="./preforth -p ".:~+:."" ./gfgen -fast
 gforth: ./main.c:364: branch_targets: Assertion `i*sizeof(Cell) < size' failed.
./preforth: line 31: 19127 Aborted                 $ENGINE --die-on-signal -i kernl64l.fi $path1 $path2 exboot.fs startup.fs "$@"

I'm scratching my head.  Any ideas what's the right way to fix that?  

cheers,

David
--
GnuPG public key: http://dvdkhlng.users.sourceforge.net/dk.gpg
Fingerprint: B17A DC95 D293 657B 4205  D016 7DEF 5323 C174 7D40


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »