amitools icon indicating copy to clipboard operation
amitools copied to clipboard

Problems with using vamos as a shell

Open joonapalaste opened this issue 3 years ago • 7 comments

I bought AmigaOS 3.1.4 from Hyperion Entertainment and installed the latest version of amitools. Typing "vamos -x Shell-Seg" where Shell-Seg is the file I got from AmigaOS 3.1.4 dropped me to an emulated AmigaOS shell. Only, not everything is working correctly.

Running "dir", "list", or "type textfile.txt" where textfile.txt is a file in the current directory is working perfectly. However, "echo foo" crashes vamos with the following error: 03:22:43.003 machine: ERROR: ----- ERROR in CPU Run #2 ----- 03:22:43.004 machine: ERROR: Run: 'RunCommand': Initial PC=00958c, SP=00e6d8 03:22:43.004 machine: ERROR: PC=0000697c SR=----- USP=0000e690 ISP=00000700 MSP=00000780 03:22:43.004 machine: ERROR: D0=68656c6c D1=00000000 D2=0000e6c0 D3=00000000 D4=00000006 D5=00002562 D6=000008ad D7=00000000 03:22:43.004 machine: ERROR: A0=68656c6d A1=00006a40 A2=68656c6c A3=0000e6e4 A4=0000b9b4 A5=00001ae8 A6=00001ae8 A7=0000e690 03:22:43.004 machine: ERROR: SP-32=000000 SP-28=000000 SP-24=000000 SP-20=000000 SP-16=000000 SP-12=000000 SP-08=000000 SP-04=006968 03:22:43.004 machine: ERROR: SP+00=002000 SP+04=00c320 SP+08=000006 SP+12=002562 SP+16=0008ad SP+20=0008a2 SP+24=ff01dd05 SP+28=00b8b8 03:22:43.004 machine: ERROR: InvalidMemoryAccessError: Invalid Memory Access R(1): 656c6c 03:22:43.004 machine: ERROR: ----- ERROR in CPU Run #1 ----- 03:22:43.004 machine: ERROR: Run: 'Shell-Seg': Initial PC=002304, SP=00b754 03:22:43.004 machine: ERROR: PC=00001c04 SR=----- USP=0000b5e4 ISP=00000700 MSP=00000780 03:22:43.004 machine: ERROR: D0=0000c320 D1=00002562 D2=00002000 D3=0000c320 D4=00000006 D5=00002562 D6=000008ad D7=000008a2 03:22:43.004 machine: ERROR: A0=00000006 A1=00002264 A2=0000b7d9 A3=0000b8b8 A4=0000b9b4 A5=0000b64c A6=00001ae8 A7=0000b5e4 03:22:43.004 machine: ERROR: SP-32=000000 SP-28=000000 SP-24=000010 SP-20=002562 SP-16=0008ad SP-12=0008a2 SP-08=00b8b8 SP-04=00b64c 03:22:43.004 machine: ERROR: SP+00=004d1c SP+04=002000 SP+08=002556 SP+12=fffffffe SP+16=000010 SP+20=000000 SP+24=002562 SP+28=000004 03:22:43.005 machine: ERROR: Traceback (most recent call last): 03:22:43.005 machine: ERROR: File "musashi/pytraps.pyx", line 19, in musashi.emu.trap_wrapper 03:22:43.005 machine: ERROR: File "/usr/local/lib64/python3.8/site-packages/amitools/vamos/libcore/stub.py", line 165, in base_func 03:22:43.005 machine: ERROR: res = impl_method(ctx) 03:22:43.005 machine: ERROR: File "/usr/local/lib64/python3.8/site-packages/amitools/vamos/lib/DosLibrary.py", line 1651, in RunCommand 03:22:43.005 machine: ERROR: ret_code = run_command( 03:22:43.005 machine: ERROR: File "/usr/local/lib64/python3.8/site-packages/amitools/vamos/dos/run.py", line 55, in run_command 03:22:43.005 machine: ERROR: scheduler.run_sub_task(task) 03:22:43.005 machine: ERROR: File "/usr/local/lib64/python3.8/site-packages/amitools/vamos/schedule/scheduler.py", line 85, in run_sub_task 03:22:43.005 machine: ERROR: self._execute(sub_task, init_sp) 03:22:43.005 machine: ERROR: File "/usr/local/lib64/python3.8/site-packages/amitools/vamos/schedule/scheduler.py", line 92, in _execute 03:22:43.005 machine: ERROR: run_state = self.machine.run( 03:22:43.006 machine: ERROR: File "/usr/local/lib64/python3.8/site-packages/amitools/vamos/machine/machine.py", line 553, in run 03:22:43.006 machine: ERROR: raise NestedCPURunError(pc, run_state.error) 03:22:43.006 machine: ERROR: amitools.vamos.error.NestedCPURunError: Nested CPU Run Failed: pc=001c04: InvalidMemoryAccessError: Invalid Memory Access R(1): 656c6c 03:22:43.006 main: ERROR: vamos failed! 03:22:43.006 libmgr:WARNING: can't expunge: 'dos.library' with open count 2 03:22:43.006 libmgr:WARNING: can't expunge: 'utility.library' with open count 1 03:22:43.006 libmgr:WARNING: shutdown: can't expunge 2 vamos libs/devs!

Also, I compiled this simple program: #include <stdio.h> int main(void) { printf("Hello world!\n"); } with dcc on the DICE compiler. Typing "hello" on the vamos shell printed out "Hello world!" as expected, but the shell just stuck there, not accepting any further input. I had to press ctrl-C to tell Linux to break the entire vamos process. The same happens when I type "endcli" in the shell. The shell says "Process 0 exiting" but after that, vamos just sticks there.

joonapalaste avatar Nov 27 '20 01:11 joonapalaste

thanks for the bug report. I already fixed the problems with echo and endcli on master.

can you share the compiled dice program so I can have a look?

cnvogelg avatar Nov 30 '20 21:11 cnvogelg

hello.zip Included is a zip package containing two executables, hello and hello_amiga. hello is written in ISO standard C, hello_amiga with native AmigaOS libraries. Both work otherwise all OK both in vamos and in a real Amiga shell emulated in FS-UAE, but in vamos, after the programs have run, the shell just sticks there instead of proceeding.

joonapalaste avatar Nov 30 '20 22:11 joonapalaste

Found this issue as well: console device '*' was not handled correctly... please test current master

cnvogelg avatar Dec 03 '20 20:12 cnvogelg

I have earlier been downloading ZIP packages from the amitools repository. For convenience I cloned the repository directly with git so I can get updates faster. Both programs are working now, after running the program, control returns to the shell.

I tried to run "assign", which should list all the assigns in the system, but once again, vamos crashed. Here is the output: 00:16:25.549 machine: ERROR: ----- ERROR in CPU Run #2 ----- 00:16:25.549 machine: ERROR: Run: 'RunCommand': Initial PC=00c730, SP=00f3c0 00:16:25.549 machine: ERROR: PC=00001c96 SR=----- USP=0000ed0c ISP=00000700 MSP=00000780 00:16:25.549 machine: ERROR: D0=00000064 D1=0000ed74 D2=00000064 D3=00000000 D4=00000000 D5=00000000 D6=00000008 D7=00000071 00:16:25.549 machine: ERROR: A0=00001ae8 A1=0000f354 A2=0000ed74 A3=0000f354 A4=0000b9fc A5=0000ed30 A6=00001ae8 A7=0000ed0c 00:16:25.549 machine: ERROR: SP-32=000000 SP-28=000000 SP-24=000000 SP-20=000000 SP-16=000000 SP-12=000000 SP-08=000000 SP-04=000000 00:16:25.549 machine: ERROR: SP+00=00d200 SP+04=000008 SP+08=000006 SP+12=000000 SP+16=001ae8 SP+20=001ae8 SP+24=001ae8 SP+28=000000 00:16:25.550 machine: ERROR: Traceback (most recent call last): 00:16:25.550 machine: ERROR: File "musashi/pytraps.pyx", line 19, in musashi.emu.trap_wrapper 00:16:25.550 machine: ERROR: File "/usr/local/lib64/python3.8/site-packages/amitools-0.5.0-py3.8-linux-x86_64.egg/amitools/vamos/libcore/stub.py", line 165, in base_func 00:16:25.550 machine: ERROR: res = impl_method(ctx) 00:16:25.550 machine: ERROR: File "/usr/local/lib64/python3.8/site-packages/amitools-0.5.0-py3.8-linux-x86_64.egg/amitools/vamos/lib/DosLibrary.py", line 757, in WriteChars 00:16:25.550 machine: ERROR: fh.write(buf) 00:16:25.550 machine: ERROR: File "/usr/local/lib64/python3.8/site-packages/amitools-0.5.0-py3.8-linux-x86_64.egg/amitools/vamos/lib/dos/FileHandle.py", line 54, in write 00:16:25.550 machine: ERROR: assert isinstance(data, (bytes, bytearray)) 00:16:25.550 machine: ERROR: AssertionError 00:16:25.550 machine: ERROR: ----- ERROR in CPU Run #1 ----- 00:16:25.550 machine: ERROR: Run: 'Shell-Seg': Initial PC=00234c, SP=00b79c 00:16:25.550 machine: ERROR: PC=00001c04 SR=----- USP=0000b62c ISP=00000700 MSP=00000780 00:16:25.550 machine: ERROR: D0=0000c368 D1=000031cb D2=00002000 D3=0000c368 D4=00000001 D5=000031cb D6=000008bf D7=000008b4 00:16:25.550 machine: ERROR: A0=00000001 A1=0000c378 A2=0000b821 A3=0000b900 A4=0000b9fc A5=0000b694 A6=00001ae8 A7=0000b62c 00:16:25.550 machine: ERROR: SP-32=000000 SP-28=0052bc SP-24=000010 SP-20=0031cb SP-16=0008bf SP-12=0008b4 SP-08=00b900 SP-04=00b694 00:16:25.550 machine: ERROR: SP+00=004d64 SP+04=002000 SP+08=002568 SP+12=fffffffe SP+16=000010 SP+20=000000 SP+24=0031cb SP+28=000000 00:16:25.551 machine: ERROR: Traceback (most recent call last): 00:16:25.551 machine: ERROR: File "musashi/pytraps.pyx", line 19, in musashi.emu.trap_wrapper 00:16:25.551 machine: ERROR: File "/usr/local/lib64/python3.8/site-packages/amitools-0.5.0-py3.8-linux-x86_64.egg/amitools/vamos/libcore/stub.py", line 165, in base_func 00:16:25.551 machine: ERROR: res = impl_method(ctx) 00:16:25.551 machine: ERROR: File "/usr/local/lib64/python3.8/site-packages/amitools-0.5.0-py3.8-linux-x86_64.egg/amitools/vamos/lib/DosLibrary.py", line 1658, in RunCommand 00:16:25.551 machine: ERROR: ret_code = run_command( 00:16:25.551 machine: ERROR: File "/usr/local/lib64/python3.8/site-packages/amitools-0.5.0-py3.8-linux-x86_64.egg/amitools/vamos/dos/run.py", line 55, in run_command 00:16:25.551 machine: ERROR: scheduler.run_sub_task(task) 00:16:25.551 machine: ERROR: File "/usr/local/lib64/python3.8/site-packages/amitools-0.5.0-py3.8-linux-x86_64.egg/amitools/vamos/schedule/scheduler.py", line 85, in run_sub_task 00:16:25.551 machine: ERROR: self._execute(sub_task, init_sp) 00:16:25.551 machine: ERROR: File "/usr/local/lib64/python3.8/site-packages/amitools-0.5.0-py3.8-linux-x86_64.egg/amitools/vamos/schedule/scheduler.py", line 92, in _execute 00:16:25.551 machine: ERROR: run_state = self.machine.run( 00:16:25.551 machine: ERROR: File "/usr/local/lib64/python3.8/site-packages/amitools-0.5.0-py3.8-linux-x86_64.egg/amitools/vamos/machine/machine.py", line 553, in run 00:16:25.551 machine: ERROR: raise NestedCPURunError(pc, run_state.error) 00:16:25.551 machine: ERROR: amitools.vamos.error.NestedCPURunError: Nested CPU Run Failed: pc=001c04: AssertionError: 00:16:25.551 main: ERROR: vamos failed! 00:16:25.551 libmgr:WARNING: can't expunge: 'dos.library' with open count 2 00:16:25.551 libmgr:WARNING: can't expunge: 'utility.library' with open count 1 00:16:25.552 libmgr:WARNING: shutdown: can't expunge 2 vamos libs/devs! Volumes:

The last line looks like it's trying to print out the assigns (typing "assign" without any parameters to a real AmigaOS shell lists all the assigns, starting with the volumes) but it fails to actually print them out.

joonapalaste avatar Dec 03 '20 22:12 joonapalaste

Assign output should now be fixed on master

cnvogelg avatar Dec 08 '20 20:12 cnvogelg

Assign works fine. Another thing I tried: The AmigaOS shell includes this nice feature where I can type "?" (a question mark) after a command, and the shell then prompts me with an argument list and asks me for the arguments. This works in vamos too, but it does it in the opposite order: in vamos, the shell first asks me for the arguments and only then displays the argument list. I can't really be expected to type the arguments correctly when I haven't seen what arguments the command wants. Otherwise the "?" convention works OK.

joonapalaste avatar Dec 09 '20 00:12 joonapalaste

vamos is unable to run shell scripts. If I type the name of the shell script directly (requires the S (=script) protection bit on a real AmigaOS), vamos prints out: ERROR_FILE_NOT_OBJECT If I use the AmigaOS "execute" command, vamos just sticks there. Nothing happens until I press Ctrl-C, which kills the entire vamos process.

joonapalaste avatar Dec 09 '20 21:12 joonapalaste