Skip to content

Latest commit

 

History

History
25 lines (12 loc) · 1.31 KB

Progress_20181202.md

File metadata and controls

25 lines (12 loc) · 1.31 KB

5CSM Progress Report 2018-12-02

(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

Forth script files: c.f d.f

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).