(1) The major discovery made since the last report is that, calling syscall __NR_BRK_
will cause seg fault AFTER returning from _start1
(jonesforth) to the C caller function ( main() ).
As such, these changes are made in jonesforth9e.S:
i. Disable call set_up_data_segment
( line 583 ).
ii. Replace (i) with C malloc (char *) FDSEG
(Forth Data Segment) to define var_HERE (line 575).
iii. Doing so solved one problem but leave another unsolved:
a. cat jonesforth.f d.f | jonesforth9e
now works. jonesforth.f can be loaded with FDSEG replacing set_up_data_segment.
b. cat jonesforth.f c.f | jonesforth9e
still does not work, giving seg fault.
To compile the above:
gcc -m32 -o sj9e sj.c jonesforth9e.S -g array.s
c.f contains a new Forth word RET that I created -- to return to the C caller function. Otherwise, jonesforth will exit via syscall __NR_exit
. After returning to C caller function (main()) from jonesforth (verified with gdb), seg fault occured when printf is called (line 62 in file sj.c).