Author Topic: TI-Nspire emulator  (Read 333113 times)

0 Members and 3 Guests are viewing this topic.

Offline antoniovazquezblanco

  • LV3 Member (Next: 100)
  • ***
  • Posts: 46
  • Rating: +0/-0
    • View Profile
Re: TI-Nspire emulator
« Reply #255 on: June 22, 2014, 04:45:26 pm »
I've never worked with ndless so you may have to guide me or point me to some documentation.

Offline Vogtinator

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1193
  • Rating: +108/-5
  • Instruction counter
    • View Profile
Re: TI-Nspire emulator
« Reply #256 on: June 22, 2014, 04:57:34 pm »

Offline antoniovazquezblanco

  • LV3 Member (Next: 100)
  • ***
  • Posts: 46
  • Rating: +0/-0
    • View Profile
Re: TI-Nspire emulator
« Reply #257 on: June 22, 2014, 05:42:46 pm »
Sorry for the delay....  :)

Update: My latest commit (standard integer types) broke something. Use previous commit code...
 
« Last Edit: June 22, 2014, 06:12:47 pm by antoniovazquezblanco »

Offline Vogtinator

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1193
  • Rating: +108/-5
  • Instruction counter
    • View Profile
Re: TI-Nspire emulator
« Reply #258 on: June 23, 2014, 11:20:28 am »
Compiles fine for me, but it's "nspire emulator v0.61", the latest is "nspire emulator v0.70[+Ndless-SDK patches]".
Also, why GTK for GUI? I'd use Qt for both platforms.
And could you include an option to do a windows build on linux, as it's impossible for me to test it?

Offline antoniovazquezblanco

  • LV3 Member (Next: 100)
  • ***
  • Posts: 46
  • Rating: +0/-0
    • View Profile
Re: TI-Nspire emulator
« Reply #259 on: June 23, 2014, 11:39:46 am »
Yes it is v0.61 because I mirrored the old repo. As for the new repo I don't really know how to get a diff or a patch between 0.61 and 0.7 because I have changed a lot of files (although very little changes) and if I diff with the mirror version I don't know why it diffs the whole file. I have to look at it again (probably today).

I wanted to start with GTK because I use cinnamon and qt apps don't look that well... I also thought of leaving the windows gui as is for the windows platform...

About the windows build in linux I don't know how to do it... You will have to point me again in the right direction.

Thank you very much.

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: TI-Nspire emulator
« Reply #260 on: June 23, 2014, 05:37:52 pm »
Hmm qt apps can use the gtk theme. It just needs a couple seconds of googling and configuring but afterwards they look exactly the same.

Offline antoniovazquezblanco

  • LV3 Member (Next: 100)
  • ***
  • Posts: 46
  • Rating: +0/-0
    • View Profile
Re: TI-Nspire emulator
« Reply #261 on: June 24, 2014, 04:23:30 am »
As it seems there's more people interested in a Qt gui I will think about it but a lot of work must be done before that.

When you talk about windows build in linux do you mean using mingw compiler in linux?

Thanks.

Offline antoniovazquezblanco

  • LV3 Member (Next: 100)
  • ***
  • Posts: 46
  • Rating: +0/-0
    • View Profile
Re: TI-Nspire emulator
« Reply #262 on: June 24, 2014, 05:52:27 am »
Vogtinator, can you test the windows build trick?

Code: [Select]
cd src
OPTS=mingw make

I know this is not clean but I think it is better than the "prefix" solution there's in your makefile because prefix is tipically used for other things in a makefile.

Update: As I'm not able to get a clean diff (git and diff commands just diff the full code instead of the changed bits) of the changes between v0.61 and current version of the emulator, could anyone help me achieving this?

Update: It seems it is a file codification problem. Already working on it.

Thanks
« Last Edit: June 24, 2014, 07:11:50 am by antoniovazquezblanco »

Offline Vogtinator

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1193
  • Rating: +108/-5
  • Instruction counter
    • View Profile
Re: TI-Nspire emulator
« Reply #263 on: June 24, 2014, 08:13:00 am »
Quote
I know this is not clean but I think it is better than the "prefix" solution there's in your makefile because prefix is tipically used for other things in a makefile.
You did it almost like I'd have done it, I'd just have a common section for not linux-native Makefile lines and a section for both MinGW and windows native builds.
And I'm getting a message, that "_WIN32_WINNT" would be redefined in gui-windows.c, so you may want to surround it with #ifndef.

Also you could help me finding the bug that prevents me from installing ndles 3.6 on a mingw compiled nspire_emu.
Could you add
Code: [Select]
printf("Data abort: address=%08x status=%02x pc=%08x\n", mva, status, arm.reg[15]);at the top of data_abort in emu.c and launch ndless_installer?
For me it outputs
Code: [Select]
Data abort: address=0101010d status=01 pc=102fd8e4 before "Segmentation fault".

Quote
As it seems there's more people interested in a Qt gui I will think about it but a lot of work must be done before that.
The Qt GUI for linux could then be used as-is for windows as well, so not more work than removing gui-windows.c :P

Offline antoniovazquezblanco

  • LV3 Member (Next: 100)
  • ***
  • Posts: 46
  • Rating: +0/-0
    • View Profile
Re: TI-Nspire emulator
« Reply #264 on: June 24, 2014, 09:09:26 am »
I've merged master changes so I'm now on version v0.7+Ndless patches and I could succesfully install ndless v3.6 in the emulator under windows.

I will have a look on the linux compiled version to help you with your bug.

Thanks
« Last Edit: June 24, 2014, 09:23:43 am by antoniovazquezblanco »

Offline antoniovazquezblanco

  • LV3 Member (Next: 100)
  • ***
  • Posts: 46
  • Rating: +0/-0
    • View Profile
Re: TI-Nspire emulator
« Reply #265 on: June 24, 2014, 09:36:10 am »
Here's what gdb says:

Code: [Select]
Program received signal SIGSEGV, Segmentation fault.
0x004018e5 in write_word ()
(gdb)
Continuing.

Program received signal SIGSEGV, Segmentation fault.
main (argc=0, argv=0x0) at emu.c:551
551                     sched_process_pending_events();
(gdb) bt
#0  main (argc=0, argv=0x0) at emu.c:551
(gdb) s

Program received signal SIGSEGV, Segmentation fault.
main (argc=0, argv=0x0) at emu.c:551
551                     sched_process_pending_events();
(gdb) bt
#0  main (argc=0, argv=0x0) at emu.c:551
(gdb) s
[Inferior 1 (process 1516) exited with code 030000000005]

Offline antoniovazquezblanco

  • LV3 Member (Next: 100)
  • ***
  • Posts: 46
  • Rating: +0/-0
    • View Profile
Re: TI-Nspire emulator
« Reply #266 on: June 24, 2014, 10:36:37 am »
Some things that I found:
-  This does not only happen in v0.7+Ndless patches, this also happens in previous versions (v0.61).
- It only happens if it was compiled with mingw under linux.
- I get no line with data abort information.

Offline Vogtinator

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1193
  • Rating: +108/-5
  • Instruction counter
    • View Profile
Re: TI-Nspire emulator
« Reply #267 on: June 24, 2014, 11:43:28 am »
Then it may just be my self-compiled ndless_installer which does something different then.
Could you try it on the not-mingw version with data abort printf()?

And I don't really know how to use GDB, but if I read it correctly the call to sched_process_pending_events() segfaults once before crashing the second time?

Offline antoniovazquezblanco

  • LV3 Member (Next: 100)
  • ***
  • Posts: 46
  • Rating: +0/-0
    • View Profile
Re: TI-Nspire emulator
« Reply #268 on: June 24, 2014, 12:15:06 pm »
On linux:
- Your tns generates the same sigfault than the precompiled version.

On windows:
- Neither the original tns or your tns show that line of debug.
- Both install correctly.

And I don't really know how to use GDB, but if I read it correctly the call to sched_process_pending_events() segfaults once before crashing the second time?
It seems that it is true but the position of argv?? Argv is null?? I have to take a deeper look it must be in another point.

Offline Vogtinator

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1193
  • Rating: +108/-5
  • Instruction counter
    • View Profile
Re: TI-Nspire emulator
« Reply #269 on: June 24, 2014, 01:08:48 pm »
I found it: It's the call to longjmp that doesn't reach setjmp again.
But how can "restart_after_exception" get corrupted?

I found that some (older) MinGW versions have a bug that setjmp puts garbage into ebp, but the workaround -fno-omit-frame-pointer doesn't help so it's probably another bug.
Can you make a write breakpoint in gdb on restart_after_exception and longjmp in data_abort? The contents of restart_after_exceptions have to be the same as after the initial call to setjmp.

Edit: Set up a Win7 VM and compiled it. With gdb it outputs the same emu.c:551, argc = 65535, argv=something weird, and it indeed segfaults at main + 2088: call sched_process_pending_events(). As call pushes eip onto the stack ($esp), but $esp is somehow 0x10, it segfaults. That also explains why argc and argv are weird, they're stored on the stack.
« Last Edit: June 24, 2014, 02:16:17 pm by Vogtinator »