├── disass.dll
├── images
├── Thumbs.db
├── find_small.png
├── save_small.png
├── folder_small.png
├── iodide16x16.png
├── iodide_doc1.png
├── iodide_doc10.png
├── iodide_doc11.png
├── iodide_doc12.png
├── iodide_doc13.png
├── iodide_doc14.png
├── iodide_doc15.png
├── iodide_doc16.png
├── iodide_doc17.png
├── iodide_doc18.png
├── iodide_doc2.png
├── iodide_doc3.png
├── iodide_doc4.png
├── iodide_doc5.png
├── iodide_doc6.png
├── iodide_doc7.png
├── iodide_doc8.png
├── iodide_doc9.png
├── upload_small.png
├── av_back_small.png
├── av_play_small.png
├── av_rewind_small.png
├── bookmark_small.png
├── comment_small.png
├── connect_small.png
├── customize_small.png
├── download_small.png
├── forward_small.png
├── reconnect_small.png
├── document_new_small.png
├── iodide_splash_screen.png
├── av_fast_forward_small.png
└── document_delete_small.png
├── disass_ppc
└── disass
│ ├── disass
│ ├── Debug
│ │ ├── mt.dep
│ │ ├── disass.obj
│ │ ├── disass.pch
│ │ ├── stdafx.obj
│ │ ├── vc80.idb
│ │ ├── vc80.pdb
│ │ ├── BuildLog.htm
│ │ ├── disass.dll.embed.manifest.res
│ │ ├── disass.exe.embed.manifest.res
│ │ ├── disass.dll.intermediate.manifest
│ │ ├── disass.exe.intermediate.manifest
│ │ ├── disass.dll.embed.manifest
│ │ └── disass.exe.embed.manifest
│ ├── stdafx.h
│ ├── disass.vcxproj.filters
│ ├── ReadMe.txt
│ ├── mon.h
│ ├── disass.vcxproj
│ ├── disass.vcproj
│ └── disass.cpp
│ ├── disass.ncb
│ ├── disass.sdf
│ ├── disass.suo
│ ├── UpgradeLog.htm
│ ├── disass.v12.suo
│ ├── debug
│ ├── disass.dll
│ ├── disass.exe
│ ├── disass.exp
│ ├── disass.ilk
│ ├── disass.lib
│ └── disass.pdb
│ ├── Backup
│ ├── disass.v12.suo
│ └── disass.sln
│ ├── ipch
│ └── disass-db224703
│ │ └── disass-803e4bd3.ipch
│ └── disass.sln
├── README.md
├── iodide.py
├── serialconfig.py
├── iodideGUI.py
└── LICENSE.txt
/disass.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/disass.dll
--------------------------------------------------------------------------------
/images/Thumbs.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/images/Thumbs.db
--------------------------------------------------------------------------------
/images/find_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/images/find_small.png
--------------------------------------------------------------------------------
/images/save_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/images/save_small.png
--------------------------------------------------------------------------------
/images/folder_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/images/folder_small.png
--------------------------------------------------------------------------------
/images/iodide16x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/images/iodide16x16.png
--------------------------------------------------------------------------------
/images/iodide_doc1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/images/iodide_doc1.png
--------------------------------------------------------------------------------
/images/iodide_doc10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/images/iodide_doc10.png
--------------------------------------------------------------------------------
/images/iodide_doc11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/images/iodide_doc11.png
--------------------------------------------------------------------------------
/images/iodide_doc12.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/images/iodide_doc12.png
--------------------------------------------------------------------------------
/images/iodide_doc13.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/images/iodide_doc13.png
--------------------------------------------------------------------------------
/images/iodide_doc14.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/images/iodide_doc14.png
--------------------------------------------------------------------------------
/images/iodide_doc15.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/images/iodide_doc15.png
--------------------------------------------------------------------------------
/images/iodide_doc16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/images/iodide_doc16.png
--------------------------------------------------------------------------------
/images/iodide_doc17.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/images/iodide_doc17.png
--------------------------------------------------------------------------------
/images/iodide_doc18.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/images/iodide_doc18.png
--------------------------------------------------------------------------------
/images/iodide_doc2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/images/iodide_doc2.png
--------------------------------------------------------------------------------
/images/iodide_doc3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/images/iodide_doc3.png
--------------------------------------------------------------------------------
/images/iodide_doc4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/images/iodide_doc4.png
--------------------------------------------------------------------------------
/images/iodide_doc5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/images/iodide_doc5.png
--------------------------------------------------------------------------------
/images/iodide_doc6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/images/iodide_doc6.png
--------------------------------------------------------------------------------
/images/iodide_doc7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/images/iodide_doc7.png
--------------------------------------------------------------------------------
/images/iodide_doc8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/images/iodide_doc8.png
--------------------------------------------------------------------------------
/images/iodide_doc9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/images/iodide_doc9.png
--------------------------------------------------------------------------------
/images/upload_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/images/upload_small.png
--------------------------------------------------------------------------------
/disass_ppc/disass/disass/Debug/mt.dep:
--------------------------------------------------------------------------------
1 | Manifest resource last updated at 14:56:50.17 on 27/04/2009
2 |
--------------------------------------------------------------------------------
/images/av_back_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/images/av_back_small.png
--------------------------------------------------------------------------------
/images/av_play_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/images/av_play_small.png
--------------------------------------------------------------------------------
/images/av_rewind_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/images/av_rewind_small.png
--------------------------------------------------------------------------------
/images/bookmark_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/images/bookmark_small.png
--------------------------------------------------------------------------------
/images/comment_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/images/comment_small.png
--------------------------------------------------------------------------------
/images/connect_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/images/connect_small.png
--------------------------------------------------------------------------------
/images/customize_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/images/customize_small.png
--------------------------------------------------------------------------------
/images/download_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/images/download_small.png
--------------------------------------------------------------------------------
/images/forward_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/images/forward_small.png
--------------------------------------------------------------------------------
/images/reconnect_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/images/reconnect_small.png
--------------------------------------------------------------------------------
/disass_ppc/disass/disass.ncb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/disass_ppc/disass/disass.ncb
--------------------------------------------------------------------------------
/disass_ppc/disass/disass.sdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/disass_ppc/disass/disass.sdf
--------------------------------------------------------------------------------
/disass_ppc/disass/disass.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/disass_ppc/disass/disass.suo
--------------------------------------------------------------------------------
/images/document_new_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/images/document_new_small.png
--------------------------------------------------------------------------------
/images/iodide_splash_screen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/images/iodide_splash_screen.png
--------------------------------------------------------------------------------
/disass_ppc/disass/UpgradeLog.htm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/disass_ppc/disass/UpgradeLog.htm
--------------------------------------------------------------------------------
/disass_ppc/disass/disass.v12.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/disass_ppc/disass/disass.v12.suo
--------------------------------------------------------------------------------
/images/av_fast_forward_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/images/av_fast_forward_small.png
--------------------------------------------------------------------------------
/images/document_delete_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/images/document_delete_small.png
--------------------------------------------------------------------------------
/disass_ppc/disass/debug/disass.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/disass_ppc/disass/debug/disass.dll
--------------------------------------------------------------------------------
/disass_ppc/disass/debug/disass.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/disass_ppc/disass/debug/disass.exe
--------------------------------------------------------------------------------
/disass_ppc/disass/debug/disass.exp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/disass_ppc/disass/debug/disass.exp
--------------------------------------------------------------------------------
/disass_ppc/disass/debug/disass.ilk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/disass_ppc/disass/debug/disass.ilk
--------------------------------------------------------------------------------
/disass_ppc/disass/debug/disass.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/disass_ppc/disass/debug/disass.lib
--------------------------------------------------------------------------------
/disass_ppc/disass/debug/disass.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/disass_ppc/disass/debug/disass.pdb
--------------------------------------------------------------------------------
/disass_ppc/disass/Backup/disass.v12.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/disass_ppc/disass/Backup/disass.v12.suo
--------------------------------------------------------------------------------
/disass_ppc/disass/disass/Debug/disass.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/disass_ppc/disass/disass/Debug/disass.obj
--------------------------------------------------------------------------------
/disass_ppc/disass/disass/Debug/disass.pch:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/disass_ppc/disass/disass/Debug/disass.pch
--------------------------------------------------------------------------------
/disass_ppc/disass/disass/Debug/stdafx.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/disass_ppc/disass/disass/Debug/stdafx.obj
--------------------------------------------------------------------------------
/disass_ppc/disass/disass/Debug/vc80.idb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/disass_ppc/disass/disass/Debug/vc80.idb
--------------------------------------------------------------------------------
/disass_ppc/disass/disass/Debug/vc80.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/disass_ppc/disass/disass/Debug/vc80.pdb
--------------------------------------------------------------------------------
/disass_ppc/disass/disass/Debug/BuildLog.htm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/disass_ppc/disass/disass/Debug/BuildLog.htm
--------------------------------------------------------------------------------
/disass_ppc/disass/disass/Debug/disass.dll.embed.manifest.res:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/disass_ppc/disass/disass/Debug/disass.dll.embed.manifest.res
--------------------------------------------------------------------------------
/disass_ppc/disass/disass/Debug/disass.exe.embed.manifest.res:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/disass_ppc/disass/disass/Debug/disass.exe.embed.manifest.res
--------------------------------------------------------------------------------
/disass_ppc/disass/ipch/disass-db224703/disass-803e4bd3.ipch:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nccgroup/IODIDE/HEAD/disass_ppc/disass/ipch/disass-db224703/disass-803e4bd3.ipch
--------------------------------------------------------------------------------
/disass_ppc/disass/disass/Debug/disass.dll.intermediate.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/disass_ppc/disass/disass/Debug/disass.exe.intermediate.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/disass_ppc/disass/disass/Debug/disass.dll.embed.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/disass_ppc/disass/disass/Debug/disass.exe.embed.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/disass_ppc/disass/disass/stdafx.h:
--------------------------------------------------------------------------------
1 | // stdafx.h : include file for standard system include files,
2 | // or project specific include files that are used frequently, but
3 | // are changed infrequently
4 | //
5 |
6 | #pragma once
7 |
8 | #ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
9 | #define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
10 | #endif
11 |
12 | #include
13 | #include
14 |
15 |
16 |
17 | // TODO: reference additional headers your program requires here
18 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | IODIDE - The IOS Debugger and Integrated Disassembler Environment
2 |
3 | Released as open source by NCC Group Plc - http://www.nccgroup.com/
4 |
5 | Developed by Andy Davis, andy dot davis at nccgroup dot com
6 |
7 | https://github.com/nccgroup/IODIDE
8 |
9 | Released under AGPL see LICENSE for more information
10 |
11 | Includes the PowerPC disassembler from cxmon by Christian Bauer, Marc Hellwig (http://cxmon.cebix.net)
12 |
13 | ## Documentation
14 |
15 | https://github.com/nccgroup/IODIDE/wiki
16 |
17 | ## Pre-requisites
18 |
19 | * Python
20 |
21 | * wxPython
22 |
23 | * pyserial
24 |
25 | ## Platforms
26 |
27 | Tested on Windows 7
--------------------------------------------------------------------------------
/iodide.py:
--------------------------------------------------------------------------------
1 | import wx
2 | import wx.aui
3 | import sys
4 | import os
5 | from gdb import gdbproto
6 | from iodideGUI import PyAUIFrame
7 |
8 | if __name__ == '__main__':
9 |
10 | ID_Connect = wx.NewId()
11 |
12 | class MyApp(wx.App):
13 | def OnInit(self):
14 |
15 | gdb = gdbproto()
16 | wx.InitAllImageHandlers()
17 | win = PyAUIFrame(None, gdb, wx.ID_ANY, "IODIDE - The IOS Debugger and Integrated Disassembler Environment v1.0", size=(890, 705))
18 | gdb.window(win)
19 | gdb.disableObjects()
20 | win.Show()
21 | win.Center()
22 | return True
23 |
24 | app = MyApp(False)
25 | app.MainLoop()
26 |
27 |
--------------------------------------------------------------------------------
/disass_ppc/disass/Backup/disass.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 9.00
3 | # Visual Studio 2005
4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "disass", "disass\disass.vcproj", "{0EFAD09B-472F-4309-865E-E026D04B7966}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Win32 = Debug|Win32
9 | Release|Win32 = Release|Win32
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {0EFAD09B-472F-4309-865E-E026D04B7966}.Debug|Win32.ActiveCfg = Debug|Win32
13 | {0EFAD09B-472F-4309-865E-E026D04B7966}.Debug|Win32.Build.0 = Debug|Win32
14 | {0EFAD09B-472F-4309-865E-E026D04B7966}.Release|Win32.ActiveCfg = Release|Win32
15 | {0EFAD09B-472F-4309-865E-E026D04B7966}.Release|Win32.Build.0 = Release|Win32
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | EndGlobal
21 |
--------------------------------------------------------------------------------
/disass_ppc/disass/disass.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Express 2013 for Windows Desktop
4 | VisualStudioVersion = 12.0.21005.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "disass", "disass\disass.vcxproj", "{0EFAD09B-472F-4309-865E-E026D04B7966}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Win32 = Debug|Win32
11 | Release|Win32 = Release|Win32
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {0EFAD09B-472F-4309-865E-E026D04B7966}.Debug|Win32.ActiveCfg = Debug|Win32
15 | {0EFAD09B-472F-4309-865E-E026D04B7966}.Debug|Win32.Build.0 = Debug|Win32
16 | {0EFAD09B-472F-4309-865E-E026D04B7966}.Release|Win32.ActiveCfg = Release|Win32
17 | {0EFAD09B-472F-4309-865E-E026D04B7966}.Release|Win32.Build.0 = Release|Win32
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/disass_ppc/disass/disass/disass.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav
15 |
16 |
17 |
18 |
19 | Source Files
20 |
21 |
22 |
23 |
24 | Header Files
25 |
26 |
27 | Header Files
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/disass_ppc/disass/disass/ReadMe.txt:
--------------------------------------------------------------------------------
1 | ========================================================================
2 | CONSOLE APPLICATION : disass Project Overview
3 | ========================================================================
4 |
5 | AppWizard has created this disass application for you.
6 |
7 | This file contains a summary of what you will find in each of the files that
8 | make up your disass application.
9 |
10 |
11 | disass.vcproj
12 | This is the main project file for VC++ projects generated using an Application Wizard.
13 | It contains information about the version of Visual C++ that generated the file, and
14 | information about the platforms, configurations, and project features selected with the
15 | Application Wizard.
16 |
17 | disass.cpp
18 | This is the main application source file.
19 |
20 | /////////////////////////////////////////////////////////////////////////////
21 | Other standard files:
22 |
23 | StdAfx.h, StdAfx.cpp
24 | These files are used to build a precompiled header (PCH) file
25 | named disass.pch and a precompiled types file named StdAfx.obj.
26 |
27 | /////////////////////////////////////////////////////////////////////////////
28 | Other notes:
29 |
30 | AppWizard uses "TODO:" comments to indicate parts of the source code you
31 | should add to or customize.
32 |
33 | /////////////////////////////////////////////////////////////////////////////
34 |
--------------------------------------------------------------------------------
/disass_ppc/disass/disass/mon.h:
--------------------------------------------------------------------------------
1 | /*
2 | * mon.h - cxmon main program
3 | *
4 | * cxmon (C) 1997-2004 Christian Bauer, Marc Hellwig
5 | *
6 | * This program is free software; you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation; either version 2 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program; if not, write to the Free Software
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 | */
20 |
21 | #ifndef MON_H
22 | #define MON_H
23 |
24 | #include
25 |
26 |
27 | /*
28 | * Initialization, deinitialization and invocation
29 | */
30 |
31 | void mon_init();
32 | void mon_exit();
33 | void mon(int argc, char **argv);
34 |
35 |
36 | /*
37 | * Definitions for adding commands to mon
38 | */
39 |
40 | // Input tokens
41 | enum Token {
42 | T_NULL, // Invalid token
43 | T_END, // End of line
44 | T_NUMBER, // Hexadecimal/decimal number (uint32)
45 | T_STRING, // String enclosed in ""
46 | T_NAME, // Variable name
47 | T_DOT, // '.'
48 | T_COLON, // ':'
49 | T_COMMA, // ','
50 | T_LPAREN, // '('
51 | T_RPAREN, // ')'
52 | T_PLUS, // '+'
53 | T_MINUS, // '-'
54 | T_MUL, // '*'
55 | T_DIV, // '/'
56 | T_MOD, // '%'
57 | T_AND, // '&'
58 | T_OR, // '|'
59 | T_EOR, // '^'
60 | T_SHIFTL, // '<<'
61 | T_SHIFTR, // '>>'
62 | T_NOT, // '~'
63 | T_ASSIGN // '='
64 | };
65 |
66 | // Scanner variables
67 | extern enum Token mon_token; // Last token read
68 | extern unsigned int mon_number; // Contains the number if mon_token==T_NUMBER
69 | extern char *mon_string; // Contains the string if mon_token==T_STRING
70 | extern char *mon_name; // Contains the variable name if mon_token==T_NAME
71 |
72 | // Streams for input, output and error messages
73 | extern FILE *monin, *monout, *monerr;
74 |
75 | // Current address, value of '.' in expressions
76 | extern unsigned int mon_dot_address;
77 |
78 | extern bool mon_use_real_mem; // Flag: mon is using real memory
79 | extern unsigned int mon_mem_size; // Size of mon buffer (if mon_use_real_mem = false)
80 |
81 | extern bool mon_macos_mode; // Flag: enable features in the disassembler for working with MacOS code
82 |
83 | // Add command to mon
84 | extern void mon_add_command(const char *name, void (*func)(), const char *help_text);
85 |
86 | // Functions for commands
87 | extern void mon_error(const char *s); // Print error message
88 | extern enum Token mon_get_token(); // Get next token
89 | extern bool mon_expression(unsigned int *number); // Parse expression
90 | extern bool mon_aborted(); // Check if Ctrl-C was pressed
91 |
92 | // Memory access
93 | extern unsigned int (*mon_read_byte)(unsigned int adr);
94 | extern void (*mon_write_byte)(unsigned int adr, unsigned int b);
95 | extern unsigned int mon_read_half(unsigned int adr);
96 | extern void mon_write_half(unsigned int adr, unsigned int w);
97 | extern unsigned int mon_read_word(unsigned int adr);
98 | extern void mon_write_word(unsigned int adr, unsigned int l);
99 |
100 | #endif
101 |
--------------------------------------------------------------------------------
/disass_ppc/disass/disass/disass.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 |
14 | {0EFAD09B-472F-4309-865E-E026D04B7966}
15 | disass
16 | Win32Proj
17 |
18 |
19 |
20 | Application
21 | v120
22 | Unicode
23 | true
24 |
25 |
26 | DynamicLibrary
27 | v120
28 | Unicode
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 | <_ProjectFileVersion>12.0.21005.1
42 |
43 |
44 | $(SolutionDir)$(Configuration)\
45 | $(Configuration)\
46 | true
47 |
48 |
49 | $(SolutionDir)$(Configuration)\
50 | $(Configuration)\
51 | false
52 |
53 |
54 |
55 | Disabled
56 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
57 | true
58 | EnableFastChecks
59 | MultiThreadedDebugDLL
60 | Use
61 | Level3
62 | EditAndContinue
63 |
64 |
65 | true
66 | Console
67 | MachineX86
68 |
69 |
70 |
71 |
72 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
73 | MultiThreadedDLL
74 | Use
75 | Level3
76 | ProgramDatabase
77 |
78 |
79 | true
80 | Console
81 | true
82 | true
83 | MachineX86
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
--------------------------------------------------------------------------------
/disass_ppc/disass/disass/disass.vcproj:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
14 |
15 |
16 |
17 |
18 |
25 |
28 |
31 |
34 |
37 |
40 |
52 |
55 |
58 |
61 |
68 |
71 |
74 |
77 |
80 |
83 |
86 |
89 |
92 |
93 |
101 |
104 |
107 |
110 |
113 |
116 |
125 |
128 |
131 |
134 |
143 |
146 |
149 |
152 |
155 |
158 |
161 |
164 |
167 |
168 |
169 |
170 |
171 |
172 |
177 |
180 |
181 |
182 |
187 |
190 |
191 |
194 |
195 |
196 |
201 |
202 |
205 |
206 |
207 |
208 |
209 |
210 |
--------------------------------------------------------------------------------
/serialconfig.py:
--------------------------------------------------------------------------------
1 | import serial
2 | import wx
3 |
4 | class SerialConfigDialog(wx.Dialog):
5 | """Serial Port confiuration dialog, to be used with pyserial 2.0+
6 | When instantiating a class of this dialog, then the "serial" keyword
7 | argument is mandatory. It is a reference to a serial.Serial instance.
8 | the optional "show" keyword argument can be used to show/hide different
9 | settings. The default is SHOW_ALL which coresponds to
10 | SHOW_BAUDRATE|SHOW_FORMAT|SHOW_FLOW|SHOW_TIMEOUT. All constants can be
11 | found in ths module (not the class)."""
12 |
13 | def __init__(self, *args, **kwds):
14 | #grab the serial keyword and remove it from the dict
15 | self.serial = kwds['serial']
16 | del kwds['serial']
17 | self.show = SHOW_ALL
18 | if kwds.has_key('show'):
19 | self.show = kwds['show']
20 | del kwds['show']
21 | # begin wxGlade: SerialConfigDialog.__init__
22 | # end wxGlade
23 | kwds["style"] = wx.DEFAULT_DIALOG_STYLE
24 | wx.Dialog.__init__(self, *args, **kwds)
25 | self.label_2 = wx.StaticText(self, -1, "Port")
26 | self.combo_box_port = wx.ComboBox(self, -1, choices=["dummy1", "dummy2", "dummy3", "dummy4", "dummy5"], style=wx.CB_DROPDOWN)
27 | if self.show & SHOW_BAUDRATE:
28 | self.label_1 = wx.StaticText(self, -1, "Baudrate")
29 | self.choice_baudrate = wx.Choice(self, -1, choices=["choice 1"])
30 | if self.show & SHOW_FORMAT:
31 | self.label_3 = wx.StaticText(self, -1, "Data Bits")
32 | self.choice_databits = wx.Choice(self, -1, choices=["choice 1"])
33 | self.label_4 = wx.StaticText(self, -1, "Stop Bits")
34 | self.choice_stopbits = wx.Choice(self, -1, choices=["choice 1"])
35 | self.label_5 = wx.StaticText(self, -1, "Parity")
36 | self.choice_parity = wx.Choice(self, -1, choices=["choice 1"])
37 | if self.show & SHOW_TIMEOUT:
38 | self.checkbox_timeout = wx.CheckBox(self, -1, "Use Timeout")
39 | self.text_ctrl_timeout = wx.TextCtrl(self, -1, "")
40 | self.label_6 = wx.StaticText(self, -1, "seconds")
41 | if self.show & SHOW_FLOW:
42 | self.checkbox_rtscts = wx.CheckBox(self, -1, "RTS/CTS")
43 | self.checkbox_xonxoff = wx.CheckBox(self, -1, "Xon/Xoff")
44 | self.button_ok = wx.Button(self, -1, "OK")
45 | self.button_cancel = wx.Button(self, -1, "Cancel")
46 |
47 | self.__set_properties()
48 | self.__do_layout()
49 | #fill in ports and select current setting
50 | index = 0
51 | self.combo_box_port.Clear()
52 | for n in range(4):
53 | portname = serial.device(n)
54 | self.combo_box_port.Append(portname)
55 | if self.serial.portstr == portname:
56 | index = n
57 | if self.serial.portstr is not None:
58 | self.combo_box_port.SetValue(str(self.serial.portstr))
59 | else:
60 | self.combo_box_port.SetSelection(index)
61 | if self.show & SHOW_BAUDRATE:
62 | #fill in badrates and select current setting
63 | self.choice_baudrate.Clear()
64 | for n, baudrate in enumerate(self.serial.BAUDRATES):
65 | self.choice_baudrate.Append(str(baudrate))
66 | if self.serial.baudrate == baudrate:
67 | index = n
68 | self.choice_baudrate.SetSelection(index)
69 | if self.show & SHOW_FORMAT:
70 | #fill in databits and select current setting
71 | self.choice_databits.Clear()
72 | for n, bytesize in enumerate(self.serial.BYTESIZES):
73 | self.choice_databits.Append(str(bytesize))
74 | if self.serial.bytesize == bytesize:
75 | index = n
76 | self.choice_databits.SetSelection(index)
77 | #fill in stopbits and select current setting
78 | self.choice_stopbits.Clear()
79 | for n, stopbits in enumerate(self.serial.STOPBITS):
80 | self.choice_stopbits.Append(str(stopbits))
81 | if self.serial.stopbits == stopbits:
82 | index = n
83 | self.choice_stopbits.SetSelection(index)
84 | #fill in parities and select current setting
85 | self.choice_parity.Clear()
86 | for n, parity in enumerate(self.serial.PARITIES):
87 | self.choice_parity.Append(str(serial.PARITY_NAMES[parity]))
88 | if self.serial.parity == parity:
89 | index = n
90 | self.choice_parity.SetSelection(index)
91 | if self.show & SHOW_TIMEOUT:
92 | #set the timeout mode and value
93 | if self.serial.timeout is None:
94 | self.checkbox_timeout.SetValue(False)
95 | self.text_ctrl_timeout.Enable(False)
96 | else:
97 | self.checkbox_timeout.SetValue(True)
98 | self.text_ctrl_timeout.Enable(True)
99 | self.text_ctrl_timeout.SetValue(str(self.serial.timeout))
100 | if self.show & SHOW_FLOW:
101 | #set the rtscts mode
102 | self.checkbox_rtscts.SetValue(self.serial.rtscts)
103 | #set the rtscts mode
104 | self.checkbox_xonxoff.SetValue(self.serial.xonxoff)
105 | #attach the event handlers
106 | self.__attach_events()
107 |
108 | def __set_properties(self):
109 | # begin wxGlade: SerialConfigDialog.__set_properties
110 | # end wxGlade
111 | self.SetTitle("Serial Port Config")
112 | if self.show & SHOW_TIMEOUT:
113 | self.text_ctrl_timeout.Enable(0)
114 | self.button_ok.SetDefault()
115 |
116 | def __do_layout(self):
117 | # begin wxGlade: SerialConfigDialog.__do_layout
118 | # end wxGlade
119 | sizer_2 = wx.BoxSizer(wx.VERTICAL)
120 | sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
121 | sizer_basics = wx.StaticBoxSizer(wx.StaticBox(self, -1, "Basics"), wx.VERTICAL)
122 | sizer_5 = wx.BoxSizer(wx.HORIZONTAL)
123 | sizer_5.Add(self.label_2, 1, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 4)
124 | sizer_5.Add(self.combo_box_port, 1, 0, 0)
125 | sizer_basics.Add(sizer_5, 0, wx.RIGHT|wx.EXPAND, 0)
126 | if self.show & SHOW_BAUDRATE:
127 | sizer_baudrate = wx.BoxSizer(wx.HORIZONTAL)
128 | sizer_baudrate.Add(self.label_1, 1, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 4)
129 | sizer_baudrate.Add(self.choice_baudrate, 1, wx.ALIGN_RIGHT, 0)
130 | sizer_basics.Add(sizer_baudrate, 0, wx.EXPAND, 0)
131 | sizer_2.Add(sizer_basics, 0, wx.EXPAND, 0)
132 | if self.show & SHOW_FORMAT:
133 | sizer_8 = wx.BoxSizer(wx.HORIZONTAL)
134 | sizer_7 = wx.BoxSizer(wx.HORIZONTAL)
135 | sizer_6 = wx.BoxSizer(wx.HORIZONTAL)
136 | sizer_format = wx.StaticBoxSizer(wx.StaticBox(self, -1, "Data Format"), wx.VERTICAL)
137 | sizer_6.Add(self.label_3, 1, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 4)
138 | sizer_6.Add(self.choice_databits, 1, wx.ALIGN_RIGHT, 0)
139 | sizer_format.Add(sizer_6, 0, wx.EXPAND, 0)
140 | sizer_7.Add(self.label_4, 1, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 4)
141 | sizer_7.Add(self.choice_stopbits, 1, wx.ALIGN_RIGHT, 0)
142 | sizer_format.Add(sizer_7, 0, wx.EXPAND, 0)
143 | sizer_8.Add(self.label_5, 1, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 4)
144 | sizer_8.Add(self.choice_parity, 1, wx.ALIGN_RIGHT, 0)
145 | sizer_format.Add(sizer_8, 0, wx.EXPAND, 0)
146 | sizer_2.Add(sizer_format, 0, wx.EXPAND, 0)
147 | if self.show & SHOW_TIMEOUT:
148 | sizer_timeout = wx.StaticBoxSizer(wx.StaticBox(self, -1, "Timeout"), wx.HORIZONTAL)
149 | sizer_timeout.Add(self.checkbox_timeout, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 4)
150 | sizer_timeout.Add(self.text_ctrl_timeout, 0, 0, 0)
151 | sizer_timeout.Add(self.label_6, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 4)
152 | sizer_2.Add(sizer_timeout, 0, 0, 0)
153 | if self.show & SHOW_FLOW:
154 | sizer_flow = wx.StaticBoxSizer(wx.StaticBox(self, -1, "Flow Control"), wx.HORIZONTAL)
155 | sizer_flow.Add(self.checkbox_rtscts, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 4)
156 | sizer_flow.Add(self.checkbox_xonxoff, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 4)
157 | sizer_flow.Add((10,10), 1, wx.EXPAND, 0)
158 | sizer_2.Add(sizer_flow, 0, wx.EXPAND, 0)
159 | sizer_3.Add(self.button_ok, 0, 0, 0)
160 | sizer_3.Add(self.button_cancel, 0, 0, 0)
161 | sizer_2.Add(sizer_3, 0, wx.ALL|wx.ALIGN_RIGHT, 4)
162 | self.SetAutoLayout(1)
163 | self.SetSizer(sizer_2)
164 | sizer_2.Fit(self)
165 | sizer_2.SetSizeHints(self)
166 | self.Layout()
167 |
168 | def __attach_events(self):
169 | wx.EVT_BUTTON(self, self.button_ok.GetId(), self.OnOK)
170 | wx.EVT_BUTTON(self, self.button_cancel.GetId(), self.OnCancel)
171 | if self.show & SHOW_TIMEOUT:
172 | wx.EVT_CHECKBOX(self, self.checkbox_timeout.GetId(), self.OnTimeout)
173 |
174 | def OnOK(self, events):
175 | success = True
176 | self.serial.port = str(self.combo_box_port.GetValue())
177 | if self.show & SHOW_BAUDRATE:
178 | self.serial.baudrate = self.serial.BAUDRATES[self.choice_baudrate.GetSelection()]
179 | if self.show & SHOW_FORMAT:
180 | self.serial.bytesize = self.serial.BYTESIZES[self.choice_databits.GetSelection()]
181 | self.serial.stopbits = self.serial.STOPBITS[self.choice_stopbits.GetSelection()]
182 | self.serial.parity = self.serial.PARITIES[self.choice_parity.GetSelection()]
183 | if self.show & SHOW_FLOW:
184 | self.serial.rtscts = self.checkbox_rtscts.GetValue()
185 | self.serial.xonxoff = self.checkbox_xonxoff.GetValue()
186 | if self.show & SHOW_TIMEOUT:
187 | if self.checkbox_timeout.GetValue():
188 | try:
189 | self.serial.timeout = float(self.text_ctrl_timeout.GetValue())
190 | except ValueError:
191 | dlg = wx.MessageDialog(self, 'Timeout must be a numeric value',
192 | 'Value Error', wx.OK | wx.ICON_ERROR)
193 | dlg.ShowModal()
194 | dlg.Destroy()
195 | success = False
196 | else:
197 | self.serial.timeout = None
198 | if success:
199 | self.EndModal(wx.ID_OK)
200 |
201 |
202 |
203 | def OnCancel(self, events):
204 | self.EndModal(wx.ID_CANCEL)
205 |
206 | def OnTimeout(self, events):
207 | if self.checkbox_timeout.GetValue():
208 | self.text_ctrl_timeout.Enable(True)
209 | else:
210 | self.text_ctrl_timeout.Enable(False)
211 |
212 | # end of class SerialConfigDialog
--------------------------------------------------------------------------------
/iodideGUI.py:
--------------------------------------------------------------------------------
1 | import sys
2 | import os
3 | import wx
4 | import wx.html
5 | import wx.aui
6 | import string
7 | from wx.lib.wordwrap import wordwrap
8 | import wx.lib.agw.advancedsplash as AS
9 |
10 | #------------------------------------------------------------------------------------------
11 |
12 |
13 | class TestSearchCtrl(wx.SearchCtrl):
14 | maxSearches = 5
15 |
16 | def __init__(self, parent, id=-1, value="",
17 | pos=wx.DefaultPosition, size=wx.DefaultSize, style=0,
18 | doSearch=None):
19 | style |= wx.TE_PROCESS_ENTER
20 | wx.SearchCtrl.__init__(self, parent, id, value, pos, size, style)
21 | self.Bind(wx.EVT_TEXT_ENTER, self.OnTextEntered)
22 | self.Bind(wx.EVT_MENU_RANGE, self.OnMenuItem, id=1, id2=self.maxSearches)
23 | self.doSearch = doSearch
24 | self.searches = []
25 |
26 | def OnTextEntered(self, evt):
27 | text = self.GetValue()
28 | if self.doSearch(text):
29 | self.searches.append(text)
30 | if len(self.searches) > self.maxSearches:
31 | del self.searches[0]
32 | self.SetMenu(self.MakeMenu())
33 | self.SetValue("")
34 |
35 | def OnMenuItem(self, evt):
36 | text = self.searches[evt.GetId()-1]
37 | self.doSearch(text)
38 |
39 | def MakeMenu(self):
40 | menu = wx.Menu()
41 | item = menu.Append(-1, "Recent Searches")
42 | item.Enable(False)
43 | for idx, txt in enumerate(self.searches):
44 | menu.Append(1+idx, txt)
45 | return menu
46 |
47 | #-----------------------------------------------------------------------------
48 |
49 | class DisassembleHTML(wx.html.HtmlWindow):
50 |
51 |
52 | def OnPopupAddBookmark(self, event):
53 | self.win.gdb.dispDialog = 0
54 | self.win.gdb.OnAddBookmarks(1)
55 | self.win.gdb.dispDialog = 1
56 |
57 | def OnPopupAddComment(self, event):
58 | self.win.gdb.dispDialog = 0
59 | self.win.gdb.OnComment(1)
60 | self.win.gdb.dispDialog = 1
61 |
62 | def OnPopupAddBreakpoint(self, event):
63 | self.win.gdb.dispDialog = 0
64 | self.win.gdb.OnSetBreakpoints(1)
65 | self.win.gdb.dispDialog = 1
66 |
67 | def OnPopupDelBreakpoint(self, event):
68 | self.win.gdb.dispDialog = 0
69 | self.win.gdb.OnDelBreakpoints(1)
70 | self.win.gdb.dispDialog = 1
71 |
72 | def OnPopupDownload(self, event):
73 | self.win.gdb.dispDialog = 0
74 | self.win.gdb.OnDownload(1)
75 | self.win.gdb.dispDialog = 1
76 |
77 | def OnPopupUpload(self, event):
78 | self.win.gdb.dispDialog = 0
79 | self.win.gdb.OnUpload(1)
80 | self.win.gdb.disassusepc = 0
81 | self.win.gdb.OnDisassemble(1)
82 | self.win.gdb.dispDialog = 1
83 | self.win.gdb.disassusepc = 1
84 |
85 | def OnPopupWritemem(self, event):
86 | self.win.gdb.dispDialog = 0
87 | self.win.gdb.OnWriteMem(1)
88 | self.win.gdb.disassusepc = 0
89 | self.win.gdb.OnDisassemble(1)
90 | self.win.gdb.dispDialog = 1
91 | self.win.gdb.disassusepc = 1
92 |
93 | def OnCellClicked (self, cell, x, y, event):
94 | self.win = self.GetParent()
95 |
96 | sel = wx.html.HtmlSelection()
97 |
98 |
99 |
100 | address = cell.ConvertToText(sel)
101 | address = string.replace(address, " ", "")
102 |
103 | if len(address) != 8:
104 | return 1
105 |
106 | try:
107 | dummy = int(address,16)
108 | except:
109 | return 1
110 |
111 | self.win.gdb.currentclickaddress = address
112 |
113 | if not hasattr(self.win, "self.win.popupID1"):
114 | self.win.popupID1 = wx.NewId()
115 | self.win.popupID2 = wx.NewId()
116 | self.win.popupID3 = wx.NewId()
117 | self.win.popupID4 = wx.NewId()
118 | self.win.popupID5 = wx.NewId()
119 | self.win.popupID6 = wx.NewId()
120 | self.win.popupID7 = wx.NewId()
121 | self.win.Bind(wx.EVT_MENU, self.OnPopupAddBookmark, id=self.win.popupID1)
122 | self.win.Bind(wx.EVT_MENU, self.OnPopupAddComment, id=self.win.popupID2)
123 | self.win.Bind(wx.EVT_MENU, self.OnPopupAddBreakpoint, id=self.win.popupID3)
124 | self.win.Bind(wx.EVT_MENU, self.OnPopupDelBreakpoint, id=self.win.popupID4)
125 | self.win.Bind(wx.EVT_MENU, self.OnPopupDownload, id=self.win.popupID5)
126 | self.win.Bind(wx.EVT_MENU, self.OnPopupUpload, id=self.win.popupID6)
127 | self.win.Bind(wx.EVT_MENU, self.OnPopupWritemem, id=self.win.popupID7)
128 | menu = wx.Menu()
129 |
130 | item = wx.MenuItem(menu, self.win.popupID1, "Add bookmark")
131 | menu.AppendItem(item)
132 |
133 | menu.Append(self.win.popupID2, "Add comment")
134 | menu.Append(self.win.popupID3, "Add breakpoint")
135 | menu.Append(self.win.popupID4, "Remove breakpoint")
136 | menu.Append(self.win.popupID5, "Download memory from here")
137 | menu.Append(self.win.popupID6, "Upload data to here")
138 | menu.Append(self.win.popupID7, "Modify memory")
139 | self.win.PopupMenu(menu)
140 | menu.Destroy()
141 |
142 |
143 | #-----------------------------------------------------------------------------
144 |
145 |
146 | class RegistersHTML(wx.html.HtmlWindow):
147 |
148 | def OnPopupDisassemble(self, event):
149 |
150 | self.win.gdb.disassusepc = 0
151 | self.win.gdb.currentdisass = self.win.gdb.currentclickaddress
152 | self.win.gdb.dispDialog = 0
153 | self.win.gdb.OnDisassemble(1)
154 | self.win.gdb.dispDialog = 1
155 | self.win.gdb.disassusepc = 1
156 |
157 | def OnPopupReadmem(self, event):
158 | self.win.gdb.readmemusepc = 0
159 | self.win.gdb.currentmem = self.win.gdb.currentclickaddress
160 | self.win.gdb.dispDialog = 0
161 | self.win.gdb.OnReadMem(1)
162 | self.win.gdb.dispDialog = 1
163 | self.win.gdb.readmemusepc = 1
164 |
165 | def OnCellClicked (self, cell, x, y, event):
166 | self.win = self.GetParent()
167 | sel = wx.html.HtmlSelection()
168 |
169 | address = cell.ConvertToText(sel)
170 | address = string.replace(address, " ", "" )
171 |
172 | if len(address) != 8:
173 | return 1
174 |
175 | try:
176 | dummy = int(address,16)
177 | except:
178 | return 1
179 |
180 | self.win.gdb.currentclickaddress = address
181 |
182 | if not hasattr(self.win, "self.win.popupID1"):
183 | self.win.popupID1 = wx.NewId()
184 | self.win.popupID2 = wx.NewId()
185 | self.win.Bind(wx.EVT_MENU, self.OnPopupDisassemble, id=self.win.popupID1)
186 | self.win.Bind(wx.EVT_MENU, self.OnPopupReadmem, id=self.win.popupID2)
187 | menu = wx.Menu()
188 | item = wx.MenuItem(menu, self.win.popupID1, "Disassemble")
189 | menu.AppendItem(item)
190 | menu.Append(self.win.popupID2, "Read memory")
191 | self.win.PopupMenu(menu)
192 | menu.Destroy()
193 |
194 |
195 | #-----------------------------------------------------------------------------
196 |
197 |
198 | class StackHTML(wx.html.HtmlWindow):
199 |
200 | def OnPopupDisassemble(self, event):
201 |
202 | self.win.gdb.disassusepc = 0
203 | self.win.gdb.currentdisass = self.win.gdb.currentclickaddress
204 | self.win.gdb.dispDialog = 0
205 | self.win.gdb.OnDisassemble(1)
206 | self.win.gdb.dispDialog = 1
207 | self.win.gdb.disassusepc = 1
208 |
209 | def OnPopupReadmem(self, event):
210 | self.win.gdb.readmemusepc = 0
211 | self.win.gdb.currentmem = self.win.gdb.currentclickaddress
212 | self.win.gdb.dispDialog = 0
213 | self.win.gdb.OnReadMem(1)
214 | self.win.gdb.dispDialog = 1
215 | self.win.gdb.readmemusepc = 1
216 |
217 | def OnCellClicked (self, cell, x, y, event):
218 | self.win = self.GetParent()
219 | sel = wx.html.HtmlSelection()
220 |
221 | address = cell.ConvertToText(sel)
222 |
223 | if len(address) != 8:
224 | return 1
225 |
226 | try:
227 | dummy = int(address,16)
228 | except:
229 | return 1
230 |
231 | self.win.gdb.currentclickaddress = address
232 |
233 | if not hasattr(self.win, "self.win.popupID1"):
234 | self.win.popupID1 = wx.NewId()
235 | self.win.popupID2 = wx.NewId()
236 | self.win.Bind(wx.EVT_MENU, self.OnPopupDisassemble, id=self.win.popupID1)
237 | self.win.Bind(wx.EVT_MENU, self.OnPopupReadmem, id=self.win.popupID2)
238 | menu = wx.Menu()
239 | item = wx.MenuItem(menu, self.win.popupID1, "Disassemble")
240 | menu.AppendItem(item)
241 | menu.Append(self.win.popupID2, "Read memory")
242 | self.win.PopupMenu(menu)
243 | menu.Destroy()
244 |
245 | #-----------------------------------------------------------------------------
246 |
247 |
248 | class SigvalHTML(wx.html.HtmlWindow):
249 |
250 | def OnPopupDisassemble(self, event):
251 |
252 | self.win.gdb.disassusepc = 0
253 | self.win.gdb.currentdisass = self.win.gdb.currentclickaddress
254 | self.win.gdb.dispDialog = 0
255 | self.win.gdb.OnDisassemble(1)
256 | self.win.gdb.dispDialog = 1
257 | self.win.gdb.disassusepc = 1
258 |
259 | def OnCellClicked (self, cell, x, y, event):
260 | self.win = self.GetParent()
261 | sel = wx.html.HtmlSelection()
262 |
263 | address = cell.ConvertToText(sel)
264 |
265 | if len(address) != 8:
266 | return 1
267 |
268 | try:
269 | dummy = int(address,16)
270 | except:
271 | return 1
272 |
273 | self.win.gdb.currentclickaddress = address
274 |
275 | if not hasattr(self.win, "self.win.popupID1"):
276 | self.win.popupID1 = wx.NewId()
277 | self.win.popupID2 = wx.NewId()
278 | self.win.Bind(wx.EVT_MENU, self.OnPopupDisassemble, id=self.win.popupID1)
279 | menu = wx.Menu()
280 | item = wx.MenuItem(menu, self.win.popupID1, "Disassemble")
281 | menu.AppendItem(item)
282 | self.win.PopupMenu(menu)
283 | menu.Destroy()
284 |
285 |
286 | #-------Create frame----------------------------------------------------------
287 |
288 |
289 | class PyAUIFrame(wx.Frame):
290 |
291 | def __init__(self, parent, gdb, id=-1, title="", pos=wx.DefaultPosition,
292 | size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE |
293 | wx.SUNKEN_BORDER |
294 | wx.CLIP_CHILDREN):
295 |
296 | wx.Frame.__init__(self, parent, id, title, pos, size, style)
297 |
298 |
299 | self.ID_Serial = wx.NewId()
300 | self.ID_ConfigureConnection = wx.NewId()
301 | self.ID_Connect = wx.NewId()
302 | self.ID_Reconnect = wx.NewId()
303 | self.ID_Open = wx.NewId()
304 | self.ID_Save = wx.NewId()
305 | self.ID_Download = wx.NewId()
306 | self.ID_Upload = wx.NewId()
307 | self.ID_SaveRunningConfig = wx.NewId()
308 |
309 | self.ID_ReadReg = wx.NewId()
310 | self.ID_ReadMem = wx.NewId()
311 | self.ID_ReadHeap = wx.NewId()
312 | self.ID_MemMap = wx.NewId()
313 | self.ID_Processes = wx.NewId()
314 | self.ID_RunningConfig = wx.NewId()
315 | self.ID_Registry = wx.NewId()
316 | self.ID_Disassemble = wx.NewId()
317 | self.ID_ListBookmarks = wx.NewId()
318 | self.ID_Search = wx.NewId()
319 |
320 | self.ID_WriteReg = wx.NewId()
321 | self.ID_WriteMem = wx.NewId()
322 | self.ID_SetBreakpoints = wx.NewId()
323 | self.ID_DelBreakpoints = wx.NewId()
324 | self.ID_Comment = wx.NewId()
325 |
326 | self.ID_StepInto = wx.NewId()
327 | self.ID_StepOver = wx.NewId()
328 | self.ID_Jump = wx.NewId()
329 | self.ID_Continue = wx.NewId()
330 |
331 | self.ID_About = wx.NewId()
332 |
333 | self.ID_toolConnect = wx.NewId()
334 | self.ID_toolReconnect = wx.NewId()
335 | self.ID_toolConfigureConnection = wx.NewId()
336 |
337 | self.ID_toolOpen = wx.NewId()
338 | self.ID_toolSave = wx.NewId()
339 | self.ID_toolUpload = wx.NewId()
340 | self.ID_toolDownload = wx.NewId()
341 |
342 | self.ID_toolDisLabel = wx.NewId()
343 | self.ID_toolDisback = wx.NewId()
344 | self.ID_toolDisforward = wx.NewId()
345 |
346 | self.ID_toolDebugLabel = wx.NewId()
347 | self.ID_toolStep = wx.NewId()
348 | self.ID_toolStepover = wx.NewId()
349 | self.ID_toolContinue = wx.NewId()
350 |
351 | self.ID_toolBreakLabel = wx.NewId()
352 | self.ID_toolAddBreak = wx.NewId()
353 | self.ID_toolDelBreak = wx.NewId()
354 |
355 | self.ID_toolListBookmarks = wx.NewId()
356 |
357 | self.ID_toolComment = wx.NewId()
358 |
359 | self.ID_toolFindNext = wx.NewId()
360 |
361 | #-----------------------------------------------------------------------------
362 |
363 |
364 | # tell FrameManager to manage this frame
365 |
366 | self._mgr = wx.aui.AuiManager()
367 | self._mgr.SetManagedWindow(self)
368 | self.gdb = gdb
369 | self._perspectives = []
370 |
371 |
372 | #-------Splash screen---------------------------------------------------------
373 |
374 |
375 | pn = os.path.normpath(os.path.join(".", "images/iodide_splash_screen.png"))
376 | bitmap = wx.Bitmap(pn, wx.BITMAP_TYPE_PNG)
377 | shadow = wx.WHITE
378 | frame = AS.AdvancedSplash(self, bitmap=bitmap, timeout=3000)
379 |
380 | #-------Set windows icon------------------------------------------------------
381 |
382 |
383 | image = wx.Image('images/iodide16x16.png', wx.BITMAP_TYPE_PNG).ConvertToBitmap()
384 | icon = wx.EmptyIcon()
385 | icon.CopyFromBitmap(image)
386 | self.SetIcon(icon)
387 |
388 |
389 | #-------Create menu-----------------------------------------------------------
390 |
391 |
392 | self.mb = wx.MenuBar()
393 |
394 | file_menu = wx.Menu()
395 | file_menu.Append(self.ID_Open, "&Open session")
396 | file_menu.Append(self.ID_ConfigureConnection, "&Configure connection")
397 | file_menu.Append(self.ID_Save, "&Save session")
398 | file_menu.Append(self.ID_Connect, "&Connect to device")
399 | file_menu.Append(self.ID_Reconnect, "&Reconnect to device")
400 | file_menu.Append(self.ID_Download, "&Download from memory")
401 | file_menu.Append(self.ID_Upload, "&Upload to memory")
402 | file_menu.Append(self.ID_SaveRunningConfig, "&Save running config")
403 | file_menu.AppendSeparator()
404 | file_menu.Append(wx.ID_EXIT, "Exit")
405 |
406 | file_menu.Enable(self.ID_Upload, False)
407 |
408 | view_menu = wx.Menu()
409 | #view_menu.Append(self.ID_ReadReg, "&Display registers")
410 | view_menu.Append(self.ID_ReadMem, "&Display memory")
411 | view_menu.Append(self.ID_Disassemble, "&Disassemble memory")
412 | view_menu.Append(self.ID_Search, "&Search memory address range")
413 | view_menu.Append(self.ID_ReadHeap, "&Display heap blocks")
414 | view_menu.Append(self.ID_MemMap, "&Display memory map")
415 | view_menu.Append(self.ID_Processes, "&Display processes")
416 | view_menu.Append(self.ID_RunningConfig, "&Display running config")
417 | view_menu.Append(self.ID_Registry, "&Display registry information")
418 | view_menu.Append(self.ID_ListBookmarks, "&Bookmarks")
419 |
420 | edit_menu = wx.Menu()
421 | edit_menu.Append(self.ID_WriteReg, "&Modify registers")
422 | edit_menu.Append(self.ID_WriteMem, "&Modify memory")
423 | edit_menu.Append(self.ID_SetBreakpoints, "&Set breakpoint")
424 | edit_menu.Append(self.ID_DelBreakpoints, "&Delete breakpoint")
425 | edit_menu.Append(self.ID_Comment, "&Insert comment")
426 |
427 | debug_menu = wx.Menu()
428 | debug_menu.Append(self.ID_StepInto, "&Step into")
429 | debug_menu.Append(self.ID_StepOver, "&Step over")
430 | debug_menu.Append(self.ID_Jump, "&Jump to address")
431 | debug_menu.Append(self.ID_Continue, "&Continue")
432 |
433 | debug_menu.Enable(self.ID_StepOver, False)
434 |
435 | help_menu = wx.Menu()
436 | help_menu.Append(self.ID_About, "&About")
437 |
438 |
439 |
440 | self.mb.Append(file_menu, "File")
441 | self.mb.Append(view_menu, "View")
442 | self.mb.Append(edit_menu, "Edit")
443 | self.mb.Append(debug_menu, "Debug")
444 | self.mb.Append(help_menu, "Help")
445 |
446 |
447 | self.SetMenuBar(self.mb)
448 |
449 | self.statusbar = self.CreateStatusBar(3, wx.ST_SIZEGRIP)
450 | self.statusbar.SetStatusWidths([-1,-2, -2])
451 | self.statusbar.SetStatusText("", 0)
452 | self.statusbar.SetStatusText("Connection Status: Disconnected from device", 1)
453 | self.statusbar.SetStatusText("Debugging Status: Not debugging", 2)
454 |
455 |
456 | #-------Create toolbar--------------------------------------------------------
457 |
458 |
459 | self.tb = self.CreateToolBar()
460 |
461 | self.tb.AddSimpleTool(self.ID_toolConnect,
462 | wx.Image('images/connect_small.png',
463 | wx.BITMAP_TYPE_PNG).ConvertToBitmap(),
464 | 'Connect to device',
465 | 'Connect to device')
466 |
467 | self.tb.AddSimpleTool(self.ID_toolReconnect,
468 | wx.Image('images/reconnect_small.png',
469 | wx.BITMAP_TYPE_PNG).ConvertToBitmap(),
470 | 'Reconnect to device',
471 | 'Reconnect to device')
472 |
473 | self.tb.AddSimpleTool(self.ID_toolConfigureConnection,
474 | wx.Image('images/customize_small.png',
475 | wx.BITMAP_TYPE_PNG).ConvertToBitmap(),
476 | 'Configure connection',
477 | 'Configure connection')
478 |
479 | self.tb.AddSeparator()
480 |
481 | self.tb.AddSimpleTool(self.ID_toolOpen,
482 | wx.Image('images/folder_small.png',
483 | wx.BITMAP_TYPE_PNG).ConvertToBitmap(),
484 | 'Open session',
485 | 'Open session')
486 |
487 | self.tb.AddSimpleTool(self.ID_toolSave,
488 | wx.Image('images/save_small.png',
489 | wx.BITMAP_TYPE_PNG).ConvertToBitmap(),
490 | 'Save session',
491 | 'Save session')
492 |
493 | self.tb.AddSimpleTool(self.ID_toolDownload,
494 | wx.Image('images/download_small.png',
495 | wx.BITMAP_TYPE_PNG).ConvertToBitmap(),
496 | 'Download data from memory',
497 | 'Download data from memory')
498 |
499 | self.tb.AddSimpleTool(self.ID_toolUpload,
500 | wx.Image('images/upload_small.png',
501 | wx.BITMAP_TYPE_PNG).ConvertToBitmap(),
502 | 'Upload data to memory',
503 | 'Upload data to memory')
504 |
505 | self.tb.AddSeparator()
506 |
507 | self.tb.AddControl(wx.StaticText(self.tb,
508 | self.ID_toolDisLabel,
509 | label ='Disassembler:',
510 | name = 'lblDisass',
511 | size = (70,-1),
512 | style = 0))
513 |
514 | self.tb.AddSimpleTool(self.ID_toolDisback,
515 | wx.Image('images/av_back_small.png',
516 | wx.BITMAP_TYPE_PNG).ConvertToBitmap(),
517 | 'View previous disassembled memory',
518 | 'View previous disassembled memory')
519 |
520 | self.tb.AddSimpleTool(self.ID_toolDisforward,
521 | wx.Image('images/av_play_small.png',
522 | wx.BITMAP_TYPE_PNG).ConvertToBitmap(),
523 | 'View next disassembled memory',
524 | 'View next disassembled memory')
525 |
526 | self.tb.AddSeparator()
527 |
528 | self.tb.AddControl(wx.StaticText(self.tb,
529 | self.ID_toolDebugLabel,
530 | label ='PC:',
531 | name = 'lblDebug',
532 | size = (20,-1),
533 | style = 0))
534 |
535 | self.tb.AddSimpleTool(self.ID_toolStep,
536 | wx.Image('images/av_play_small.png',
537 | wx.BITMAP_TYPE_PNG).ConvertToBitmap(),
538 | 'Step into',
539 | 'Step into')
540 |
541 | self.tb.AddSimpleTool(self.ID_toolStepover,
542 | wx.Image('images/av_fast_forward_small.png',
543 | wx.BITMAP_TYPE_PNG).ConvertToBitmap(),
544 | 'Step over',
545 | 'Step over')
546 |
547 | self.tb.AddSimpleTool(self.ID_toolContinue,
548 | wx.Image('images/forward_small.png',
549 | wx.BITMAP_TYPE_PNG).ConvertToBitmap(),
550 | 'Continue execution',
551 | 'Continue execution')
552 |
553 | self.tb.AddSeparator()
554 |
555 |
556 | self.tb.AddSimpleTool(self.ID_toolAddBreak,
557 | wx.Image('images/document_new_small.png',
558 | wx.BITMAP_TYPE_PNG).ConvertToBitmap(),
559 | 'Add breakpoint',
560 | 'Add breakpoint')
561 |
562 | self.tb.AddSimpleTool(self.ID_toolDelBreak,
563 | wx.Image('images/document_delete_small.png',
564 | wx.BITMAP_TYPE_PNG).ConvertToBitmap(),
565 | 'Delete breakpoint',
566 | 'Delete breakpoint')
567 |
568 | self.tb.AddSeparator()
569 |
570 | self.tb.AddSimpleTool(self.ID_toolListBookmarks,
571 | wx.Image('images/bookmark_small.png',
572 | wx.BITMAP_TYPE_PNG).ConvertToBitmap(),
573 | 'List bookmarks',
574 | 'List bookmarks')
575 |
576 | self.tb.AddSimpleTool(self.ID_toolComment,
577 | wx.Image('images/comment_small.png',
578 | wx.BITMAP_TYPE_PNG).ConvertToBitmap(),
579 | 'Insert comment',
580 | 'Insert comment')
581 |
582 | self.tb.AddSeparator()
583 |
584 | search = TestSearchCtrl(self.tb, size=(150,-1), doSearch=self.gdb.DoDisSearch)
585 | self.tb.AddControl(search)
586 |
587 | self.tb.AddSimpleTool(self.ID_toolFindNext,
588 | wx.Image('images/forward_small.png',
589 | wx.BITMAP_TYPE_PNG).ConvertToBitmap(),
590 | 'Find next',
591 | 'Find next')
592 |
593 | self.tb.Realize()
594 |
595 |
596 | #-------Create panes----------------------------------------------------------
597 |
598 |
599 | self.RegistersHTMLCtrl = RegistersHTML(self, -1, wx.DefaultPosition, wx.Size(650, 195))
600 | self._mgr.AddPane(self.RegistersHTMLCtrl, wx.aui.AuiPaneInfo().Name("Registers").
601 | CenterPane().
602 | Caption("Registers").
603 | CaptionVisible(True).
604 | Fixed())
605 |
606 | self.LastSigvalHTMLCtrl = SigvalHTML(self, -1, wx.DefaultPosition, wx.Size(115, 195))
607 | self._mgr.AddPane(self.LastSigvalHTMLCtrl, wx.aui.AuiPaneInfo().Name("LastException").
608 | CenterPane().
609 | Caption("Last Exception").
610 | CaptionVisible(True).
611 | Fixed())
612 |
613 | self.BreakpointsHTMLCtrl = wx.html.HtmlWindow(self, -1, wx.DefaultPosition, wx.Size(115, 195))
614 | self._mgr.AddPane(self.BreakpointsHTMLCtrl, wx.aui.AuiPaneInfo().Name("Breakpoints").
615 | CenterPane().
616 | Caption("Breakpoints").
617 | CaptionVisible(True).
618 | Fixed())
619 |
620 | self.DisassembleHTMLCtrl = DisassembleHTML(self, -1, wx.DefaultPosition, wx.Size(767, 370))
621 | self._mgr.AddPane(self.DisassembleHTMLCtrl, wx.aui.AuiPaneInfo().Name("Disassembler").
622 | CenterPane().
623 | Caption("Disassembler").
624 | CaptionVisible(True).
625 | Fixed())
626 |
627 | self.StackHTMLCtrl = StackHTML(self, -1, wx.DefaultPosition, wx.Size(111, 370))
628 | self._mgr.AddPane(self.StackHTMLCtrl, wx.aui.AuiPaneInfo().Name("Stack").
629 | CenterPane().
630 | Caption("Stack").
631 | CaptionVisible(True).
632 | Fixed())
633 |
634 |
635 | #-------Create perspectives---------------------------------------------------
636 |
637 |
638 | all_panes = self._mgr.GetAllPanes()
639 | perspective_default = self._mgr.SavePerspective()
640 |
641 | for ii in xrange(len(all_panes)):
642 | if not all_panes[ii].IsToolbar():
643 | all_panes[ii].Hide()
644 |
645 | self._mgr.GetPane("Registers").Show().Top().Layer(0).Row(0).Position(0)
646 | self._mgr.GetPane("LastException").Show().Top().Layer(0).Row(0).Position(0)
647 | self._mgr.GetPane("Breakpoints").Show().Top().Layer(0).Row(0).Position(0)
648 | self._mgr.GetPane("Disassembler").Show().Bottom().Layer(0).Row(0).Position(0)
649 | self._mgr.GetPane("Stack").Show().Bottom().Layer(0).Row(0).Position(0)
650 |
651 | self._perspectives.append(perspective_default)
652 | self._mgr.Update()
653 |
654 |
655 | #-------Bind events-----------------------------------------------------------
656 |
657 |
658 | self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
659 | self.Bind(wx.EVT_SIZE, self.OnSize)
660 | self.Bind(wx.EVT_CLOSE, self.OnClose)
661 |
662 | self.Bind(wx.EVT_MENU, self.gdb.OnOpen, id=self.ID_Open)
663 | self.Bind(wx.EVT_MENU, self.gdb.OnOpen, id=self.ID_toolOpen)
664 | self.Bind(wx.EVT_MENU, self.gdb.OnSave, id=self.ID_Save)
665 | self.Bind(wx.EVT_MENU, self.gdb.OnSave, id=self.ID_toolSave)
666 | self.Bind(wx.EVT_MENU, self.gdb.OnSerial, id=self.ID_Serial)
667 |
668 | self.Bind(wx.EVT_MENU, self.gdb.OnConfigureConnection, id=self.ID_ConfigureConnection)
669 | self.Bind(wx.EVT_MENU, self.gdb.OnConfigureConnection, id=self.ID_toolConfigureConnection)
670 | self.Bind(wx.EVT_MENU, self.gdb.OnConnect, id=self.ID_Connect)
671 | self.Bind(wx.EVT_MENU, self.gdb.OnConnect, id=self.ID_toolConnect)
672 | self.Bind(wx.EVT_MENU, self.gdb.OnReconnect, id=self.ID_Reconnect)
673 | self.Bind(wx.EVT_MENU, self.gdb.OnReconnect, id=self.ID_toolReconnect)
674 | self.Bind(wx.EVT_MENU, self.gdb.OnUpload, id=self.ID_Upload)
675 | self.Bind(wx.EVT_MENU, self.gdb.OnUpload, id=self.ID_toolUpload)
676 | self.Bind(wx.EVT_MENU, self.gdb.OnDownload, id=self.ID_Download)
677 | self.Bind(wx.EVT_MENU, self.gdb.OnDownload, id=self.ID_toolDownload)
678 | self.Bind(wx.EVT_MENU, self.gdb.OnSaveRunningConfig, id=self.ID_SaveRunningConfig)
679 | self.Bind(wx.EVT_MENU, self.gdb.OnExit, id=wx.ID_EXIT)
680 |
681 | self.Bind(wx.EVT_MENU, self.gdb.OnReadReg, id=self.ID_ReadReg)
682 | self.Bind(wx.EVT_MENU, self.gdb.OnReadMem, id=self.ID_ReadMem)
683 | self.Bind(wx.EVT_MENU, self.gdb.OnReadHeap, id=self.ID_ReadHeap)
684 | self.Bind(wx.EVT_MENU, self.gdb.OnMemMap, id=self.ID_MemMap)
685 | self.Bind(wx.EVT_MENU, self.gdb.OnProcesses, id=self.ID_Processes)
686 | self.Bind(wx.EVT_MENU, self.gdb.OnRunningConfig, id=self.ID_RunningConfig)
687 | self.Bind(wx.EVT_MENU, self.gdb.OnDisplayRegistry, id=self.ID_Registry)
688 | self.Bind(wx.EVT_MENU, self.gdb.OnDisassemble, id=self.ID_Disassemble)
689 | self.Bind(wx.EVT_MENU, self.gdb.OnDisassBackClick, id=self.ID_toolDisback)
690 | self.Bind(wx.EVT_MENU, self.gdb.OnDisassForwardClick, id=self.ID_toolDisforward)
691 | self.Bind(wx.EVT_MENU, self.gdb.OnListBookmarks, id=self.ID_ListBookmarks)
692 | self.Bind(wx.EVT_MENU, self.gdb.OnListBookmarks, id=self.ID_toolListBookmarks)
693 | self.Bind(wx.EVT_MENU, self.gdb.OnSearch, id=self.ID_Search)
694 |
695 | self.Bind(wx.EVT_MENU, self.gdb.OnWriteReg, id=self.ID_WriteReg)
696 | self.Bind(wx.EVT_MENU, self.gdb.OnWriteMem, id=self.ID_WriteMem)
697 | self.Bind(wx.EVT_MENU, self.gdb.OnSetBreakpoints, id=self.ID_SetBreakpoints)
698 | self.Bind(wx.EVT_MENU, self.gdb.OnSetBreakpoints, id=self.ID_toolAddBreak)
699 | self.Bind(wx.EVT_MENU, self.gdb.OnDelBreakpoints, id=self.ID_DelBreakpoints)
700 | self.Bind(wx.EVT_MENU, self.gdb.OnDelBreakpoints, id=self.ID_toolDelBreak)
701 | self.Bind(wx.EVT_MENU, self.gdb.OnComment, id=self.ID_Comment)
702 | self.Bind(wx.EVT_MENU, self.gdb.OnComment, id=self.ID_toolComment)
703 |
704 | self.Bind(wx.EVT_MENU, self.gdb.OnStepInto, id=self.ID_StepInto)
705 | self.Bind(wx.EVT_MENU, self.gdb.OnStepInto, id=self.ID_toolStep)
706 | self.Bind(wx.EVT_MENU, self.gdb.OnStepOver, id=self.ID_StepOver)
707 | self.Bind(wx.EVT_MENU, self.gdb.OnStepOver, id=self.ID_toolStepover)
708 |
709 | self.Bind(wx.EVT_MENU, self.gdb.OnContinue, id=self.ID_Continue)
710 | self.Bind(wx.EVT_MENU, self.gdb.OnContinue, id=self.ID_toolContinue)
711 | self.Bind(wx.EVT_MENU, self.gdb.OnJump, id=self.ID_Jump)
712 |
713 | self.Bind(wx.EVT_MENU, self.gdb.OnSearchNextDis, id=self.ID_toolFindNext)
714 |
715 | self.Bind(wx.EVT_MENU, self.OnAbout, id=self.ID_About)
716 |
717 | #-------Methods---------------------------------------------------------------
718 |
719 |
720 | def OnEraseBackground(self, event):
721 | event.Skip()
722 |
723 | def OnSize(self, event):
724 | event.Skip()
725 |
726 | def OnClose(self, event):
727 | self._mgr.UnInit()
728 | del self._mgr
729 | self.Destroy()
730 |
731 | def OnAbout(self, evt):
732 | info = wx.AboutDialogInfo()
733 | info.Name = "IODIDE"
734 | info.Version = "1.0"
735 | info.Copyright = "(C) 2014 Andy Davis"
736 | info.Description = wordwrap(
737 | "IODIDE is the IOS Debugger and Integrated Disassembler Environment."
738 | "It connects to a Cisco device running IOS using the Cisco version "
739 | "of the gdb serial protocol to enable the IOS kernel to be debugged."
740 |
741 | "\n\nAlthough, some of the basic features are also available in the "
742 | "gdb client, IODIDE also offers more advanced functionality, such as "
743 | "the ability to upload binaries into memory.\n\n "
744 | "Developed by Andy Davis (andy.davis@nccgroup.com)",350, wx.ClientDC(self))
745 |
746 | wx.AboutBox(info)
747 |
748 | def CreateHTMLCtrl(self):
749 | ctrl = wx.html.HtmlWindow(self, -1, wx.DefaultPosition, wx.Size(300, 300))
750 | if "gtk2" in wx.PlatformInfo:
751 | ctrl.SetStandardFonts()
752 | return ctrl
753 |
754 | def RegisterWinWrite(self,regtext):
755 | self.RegistersHTMLCtrl.SetPage(regtext)
756 |
757 | def MemoryWinWrite(self,memtext):
758 | self.MemoryHTMLCtrl.SetPage(memtext)
759 |
760 | def DisassWinWrite(self,distext):
761 | self.DisassembleHTMLCtrl.SetPage(distext)
762 |
763 | def MemoryMapWinWrite(self,memmaptext):
764 | self.MemoryMapHTMLCtrl.SetPage(memmaptext)
765 |
766 |
767 |
768 |
769 |
770 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | GNU AFFERO GENERAL PUBLIC LICENSE
2 | Version 3, 19 November 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU Affero General Public License is a free, copyleft license for
11 | software and other kinds of works, specifically designed to ensure
12 | cooperation with the community in the case of network server software.
13 |
14 | The licenses for most software and other practical works are designed
15 | to take away your freedom to share and change the works. By contrast,
16 | our General Public Licenses are intended to guarantee your freedom to
17 | share and change all versions of a program--to make sure it remains free
18 | software for all its users.
19 |
20 | When we speak of free software, we are referring to freedom, not
21 | price. Our General Public Licenses are designed to make sure that you
22 | have the freedom to distribute copies of free software (and charge for
23 | them if you wish), that you receive source code or can get it if you
24 | want it, that you can change the software or use pieces of it in new
25 | free programs, and that you know you can do these things.
26 |
27 | Developers that use our General Public Licenses protect your rights
28 | with two steps: (1) assert copyright on the software, and (2) offer
29 | you this License which gives you legal permission to copy, distribute
30 | and/or modify the software.
31 |
32 | A secondary benefit of defending all users' freedom is that
33 | improvements made in alternate versions of the program, if they
34 | receive widespread use, become available for other developers to
35 | incorporate. Many developers of free software are heartened and
36 | encouraged by the resulting cooperation. However, in the case of
37 | software used on network servers, this result may fail to come about.
38 | The GNU General Public License permits making a modified version and
39 | letting the public access it on a server without ever releasing its
40 | source code to the public.
41 |
42 | The GNU Affero General Public License is designed specifically to
43 | ensure that, in such cases, the modified source code becomes available
44 | to the community. It requires the operator of a network server to
45 | provide the source code of the modified version running there to the
46 | users of that server. Therefore, public use of a modified version, on
47 | a publicly accessible server, gives the public access to the source
48 | code of the modified version.
49 |
50 | An older license, called the Affero General Public License and
51 | published by Affero, was designed to accomplish similar goals. This is
52 | a different license, not a version of the Affero GPL, but Affero has
53 | released a new version of the Affero GPL which permits relicensing under
54 | this license.
55 |
56 | The precise terms and conditions for copying, distribution and
57 | modification follow.
58 |
59 | TERMS AND CONDITIONS
60 |
61 | 0. Definitions.
62 |
63 | "This License" refers to version 3 of the GNU Affero General Public License.
64 |
65 | "Copyright" also means copyright-like laws that apply to other kinds of
66 | works, such as semiconductor masks.
67 |
68 | "The Program" refers to any copyrightable work licensed under this
69 | License. Each licensee is addressed as "you". "Licensees" and
70 | "recipients" may be individuals or organizations.
71 |
72 | To "modify" a work means to copy from or adapt all or part of the work
73 | in a fashion requiring copyright permission, other than the making of an
74 | exact copy. The resulting work is called a "modified version" of the
75 | earlier work or a work "based on" the earlier work.
76 |
77 | A "covered work" means either the unmodified Program or a work based
78 | on the Program.
79 |
80 | To "propagate" a work means to do anything with it that, without
81 | permission, would make you directly or secondarily liable for
82 | infringement under applicable copyright law, except executing it on a
83 | computer or modifying a private copy. Propagation includes copying,
84 | distribution (with or without modification), making available to the
85 | public, and in some countries other activities as well.
86 |
87 | To "convey" a work means any kind of propagation that enables other
88 | parties to make or receive copies. Mere interaction with a user through
89 | a computer network, with no transfer of a copy, is not conveying.
90 |
91 | An interactive user interface displays "Appropriate Legal Notices"
92 | to the extent that it includes a convenient and prominently visible
93 | feature that (1) displays an appropriate copyright notice, and (2)
94 | tells the user that there is no warranty for the work (except to the
95 | extent that warranties are provided), that licensees may convey the
96 | work under this License, and how to view a copy of this License. If
97 | the interface presents a list of user commands or options, such as a
98 | menu, a prominent item in the list meets this criterion.
99 |
100 | 1. Source Code.
101 |
102 | The "source code" for a work means the preferred form of the work
103 | for making modifications to it. "Object code" means any non-source
104 | form of a work.
105 |
106 | A "Standard Interface" means an interface that either is an official
107 | standard defined by a recognized standards body, or, in the case of
108 | interfaces specified for a particular programming language, one that
109 | is widely used among developers working in that language.
110 |
111 | The "System Libraries" of an executable work include anything, other
112 | than the work as a whole, that (a) is included in the normal form of
113 | packaging a Major Component, but which is not part of that Major
114 | Component, and (b) serves only to enable use of the work with that
115 | Major Component, or to implement a Standard Interface for which an
116 | implementation is available to the public in source code form. A
117 | "Major Component", in this context, means a major essential component
118 | (kernel, window system, and so on) of the specific operating system
119 | (if any) on which the executable work runs, or a compiler used to
120 | produce the work, or an object code interpreter used to run it.
121 |
122 | The "Corresponding Source" for a work in object code form means all
123 | the source code needed to generate, install, and (for an executable
124 | work) run the object code and to modify the work, including scripts to
125 | control those activities. However, it does not include the work's
126 | System Libraries, or general-purpose tools or generally available free
127 | programs which are used unmodified in performing those activities but
128 | which are not part of the work. For example, Corresponding Source
129 | includes interface definition files associated with source files for
130 | the work, and the source code for shared libraries and dynamically
131 | linked subprograms that the work is specifically designed to require,
132 | such as by intimate data communication or control flow between those
133 | subprograms and other parts of the work.
134 |
135 | The Corresponding Source need not include anything that users
136 | can regenerate automatically from other parts of the Corresponding
137 | Source.
138 |
139 | The Corresponding Source for a work in source code form is that
140 | same work.
141 |
142 | 2. Basic Permissions.
143 |
144 | All rights granted under this License are granted for the term of
145 | copyright on the Program, and are irrevocable provided the stated
146 | conditions are met. This License explicitly affirms your unlimited
147 | permission to run the unmodified Program. The output from running a
148 | covered work is covered by this License only if the output, given its
149 | content, constitutes a covered work. This License acknowledges your
150 | rights of fair use or other equivalent, as provided by copyright law.
151 |
152 | You may make, run and propagate covered works that you do not
153 | convey, without conditions so long as your license otherwise remains
154 | in force. You may convey covered works to others for the sole purpose
155 | of having them make modifications exclusively for you, or provide you
156 | with facilities for running those works, provided that you comply with
157 | the terms of this License in conveying all material for which you do
158 | not control copyright. Those thus making or running the covered works
159 | for you must do so exclusively on your behalf, under your direction
160 | and control, on terms that prohibit them from making any copies of
161 | your copyrighted material outside their relationship with you.
162 |
163 | Conveying under any other circumstances is permitted solely under
164 | the conditions stated below. Sublicensing is not allowed; section 10
165 | makes it unnecessary.
166 |
167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
168 |
169 | No covered work shall be deemed part of an effective technological
170 | measure under any applicable law fulfilling obligations under article
171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
172 | similar laws prohibiting or restricting circumvention of such
173 | measures.
174 |
175 | When you convey a covered work, you waive any legal power to forbid
176 | circumvention of technological measures to the extent such circumvention
177 | is effected by exercising rights under this License with respect to
178 | the covered work, and you disclaim any intention to limit operation or
179 | modification of the work as a means of enforcing, against the work's
180 | users, your or third parties' legal rights to forbid circumvention of
181 | technological measures.
182 |
183 | 4. Conveying Verbatim Copies.
184 |
185 | You may convey verbatim copies of the Program's source code as you
186 | receive it, in any medium, provided that you conspicuously and
187 | appropriately publish on each copy an appropriate copyright notice;
188 | keep intact all notices stating that this License and any
189 | non-permissive terms added in accord with section 7 apply to the code;
190 | keep intact all notices of the absence of any warranty; and give all
191 | recipients a copy of this License along with the Program.
192 |
193 | You may charge any price or no price for each copy that you convey,
194 | and you may offer support or warranty protection for a fee.
195 |
196 | 5. Conveying Modified Source Versions.
197 |
198 | You may convey a work based on the Program, or the modifications to
199 | produce it from the Program, in the form of source code under the
200 | terms of section 4, provided that you also meet all of these conditions:
201 |
202 | a) The work must carry prominent notices stating that you modified
203 | it, and giving a relevant date.
204 |
205 | b) The work must carry prominent notices stating that it is
206 | released under this License and any conditions added under section
207 | 7. This requirement modifies the requirement in section 4 to
208 | "keep intact all notices".
209 |
210 | c) You must license the entire work, as a whole, under this
211 | License to anyone who comes into possession of a copy. This
212 | License will therefore apply, along with any applicable section 7
213 | additional terms, to the whole of the work, and all its parts,
214 | regardless of how they are packaged. This License gives no
215 | permission to license the work in any other way, but it does not
216 | invalidate such permission if you have separately received it.
217 |
218 | d) If the work has interactive user interfaces, each must display
219 | Appropriate Legal Notices; however, if the Program has interactive
220 | interfaces that do not display Appropriate Legal Notices, your
221 | work need not make them do so.
222 |
223 | A compilation of a covered work with other separate and independent
224 | works, which are not by their nature extensions of the covered work,
225 | and which are not combined with it such as to form a larger program,
226 | in or on a volume of a storage or distribution medium, is called an
227 | "aggregate" if the compilation and its resulting copyright are not
228 | used to limit the access or legal rights of the compilation's users
229 | beyond what the individual works permit. Inclusion of a covered work
230 | in an aggregate does not cause this License to apply to the other
231 | parts of the aggregate.
232 |
233 | 6. Conveying Non-Source Forms.
234 |
235 | You may convey a covered work in object code form under the terms
236 | of sections 4 and 5, provided that you also convey the
237 | machine-readable Corresponding Source under the terms of this License,
238 | in one of these ways:
239 |
240 | a) Convey the object code in, or embodied in, a physical product
241 | (including a physical distribution medium), accompanied by the
242 | Corresponding Source fixed on a durable physical medium
243 | customarily used for software interchange.
244 |
245 | b) Convey the object code in, or embodied in, a physical product
246 | (including a physical distribution medium), accompanied by a
247 | written offer, valid for at least three years and valid for as
248 | long as you offer spare parts or customer support for that product
249 | model, to give anyone who possesses the object code either (1) a
250 | copy of the Corresponding Source for all the software in the
251 | product that is covered by this License, on a durable physical
252 | medium customarily used for software interchange, for a price no
253 | more than your reasonable cost of physically performing this
254 | conveying of source, or (2) access to copy the
255 | Corresponding Source from a network server at no charge.
256 |
257 | c) Convey individual copies of the object code with a copy of the
258 | written offer to provide the Corresponding Source. This
259 | alternative is allowed only occasionally and noncommercially, and
260 | only if you received the object code with such an offer, in accord
261 | with subsection 6b.
262 |
263 | d) Convey the object code by offering access from a designated
264 | place (gratis or for a charge), and offer equivalent access to the
265 | Corresponding Source in the same way through the same place at no
266 | further charge. You need not require recipients to copy the
267 | Corresponding Source along with the object code. If the place to
268 | copy the object code is a network server, the Corresponding Source
269 | may be on a different server (operated by you or a third party)
270 | that supports equivalent copying facilities, provided you maintain
271 | clear directions next to the object code saying where to find the
272 | Corresponding Source. Regardless of what server hosts the
273 | Corresponding Source, you remain obligated to ensure that it is
274 | available for as long as needed to satisfy these requirements.
275 |
276 | e) Convey the object code using peer-to-peer transmission, provided
277 | you inform other peers where the object code and Corresponding
278 | Source of the work are being offered to the general public at no
279 | charge under subsection 6d.
280 |
281 | A separable portion of the object code, whose source code is excluded
282 | from the Corresponding Source as a System Library, need not be
283 | included in conveying the object code work.
284 |
285 | A "User Product" is either (1) a "consumer product", which means any
286 | tangible personal property which is normally used for personal, family,
287 | or household purposes, or (2) anything designed or sold for incorporation
288 | into a dwelling. In determining whether a product is a consumer product,
289 | doubtful cases shall be resolved in favor of coverage. For a particular
290 | product received by a particular user, "normally used" refers to a
291 | typical or common use of that class of product, regardless of the status
292 | of the particular user or of the way in which the particular user
293 | actually uses, or expects or is expected to use, the product. A product
294 | is a consumer product regardless of whether the product has substantial
295 | commercial, industrial or non-consumer uses, unless such uses represent
296 | the only significant mode of use of the product.
297 |
298 | "Installation Information" for a User Product means any methods,
299 | procedures, authorization keys, or other information required to install
300 | and execute modified versions of a covered work in that User Product from
301 | a modified version of its Corresponding Source. The information must
302 | suffice to ensure that the continued functioning of the modified object
303 | code is in no case prevented or interfered with solely because
304 | modification has been made.
305 |
306 | If you convey an object code work under this section in, or with, or
307 | specifically for use in, a User Product, and the conveying occurs as
308 | part of a transaction in which the right of possession and use of the
309 | User Product is transferred to the recipient in perpetuity or for a
310 | fixed term (regardless of how the transaction is characterized), the
311 | Corresponding Source conveyed under this section must be accompanied
312 | by the Installation Information. But this requirement does not apply
313 | if neither you nor any third party retains the ability to install
314 | modified object code on the User Product (for example, the work has
315 | been installed in ROM).
316 |
317 | The requirement to provide Installation Information does not include a
318 | requirement to continue to provide support service, warranty, or updates
319 | for a work that has been modified or installed by the recipient, or for
320 | the User Product in which it has been modified or installed. Access to a
321 | network may be denied when the modification itself materially and
322 | adversely affects the operation of the network or violates the rules and
323 | protocols for communication across the network.
324 |
325 | Corresponding Source conveyed, and Installation Information provided,
326 | in accord with this section must be in a format that is publicly
327 | documented (and with an implementation available to the public in
328 | source code form), and must require no special password or key for
329 | unpacking, reading or copying.
330 |
331 | 7. Additional Terms.
332 |
333 | "Additional permissions" are terms that supplement the terms of this
334 | License by making exceptions from one or more of its conditions.
335 | Additional permissions that are applicable to the entire Program shall
336 | be treated as though they were included in this License, to the extent
337 | that they are valid under applicable law. If additional permissions
338 | apply only to part of the Program, that part may be used separately
339 | under those permissions, but the entire Program remains governed by
340 | this License without regard to the additional permissions.
341 |
342 | When you convey a copy of a covered work, you may at your option
343 | remove any additional permissions from that copy, or from any part of
344 | it. (Additional permissions may be written to require their own
345 | removal in certain cases when you modify the work.) You may place
346 | additional permissions on material, added by you to a covered work,
347 | for which you have or can give appropriate copyright permission.
348 |
349 | Notwithstanding any other provision of this License, for material you
350 | add to a covered work, you may (if authorized by the copyright holders of
351 | that material) supplement the terms of this License with terms:
352 |
353 | a) Disclaiming warranty or limiting liability differently from the
354 | terms of sections 15 and 16 of this License; or
355 |
356 | b) Requiring preservation of specified reasonable legal notices or
357 | author attributions in that material or in the Appropriate Legal
358 | Notices displayed by works containing it; or
359 |
360 | c) Prohibiting misrepresentation of the origin of that material, or
361 | requiring that modified versions of such material be marked in
362 | reasonable ways as different from the original version; or
363 |
364 | d) Limiting the use for publicity purposes of names of licensors or
365 | authors of the material; or
366 |
367 | e) Declining to grant rights under trademark law for use of some
368 | trade names, trademarks, or service marks; or
369 |
370 | f) Requiring indemnification of licensors and authors of that
371 | material by anyone who conveys the material (or modified versions of
372 | it) with contractual assumptions of liability to the recipient, for
373 | any liability that these contractual assumptions directly impose on
374 | those licensors and authors.
375 |
376 | All other non-permissive additional terms are considered "further
377 | restrictions" within the meaning of section 10. If the Program as you
378 | received it, or any part of it, contains a notice stating that it is
379 | governed by this License along with a term that is a further
380 | restriction, you may remove that term. If a license document contains
381 | a further restriction but permits relicensing or conveying under this
382 | License, you may add to a covered work material governed by the terms
383 | of that license document, provided that the further restriction does
384 | not survive such relicensing or conveying.
385 |
386 | If you add terms to a covered work in accord with this section, you
387 | must place, in the relevant source files, a statement of the
388 | additional terms that apply to those files, or a notice indicating
389 | where to find the applicable terms.
390 |
391 | Additional terms, permissive or non-permissive, may be stated in the
392 | form of a separately written license, or stated as exceptions;
393 | the above requirements apply either way.
394 |
395 | 8. Termination.
396 |
397 | You may not propagate or modify a covered work except as expressly
398 | provided under this License. Any attempt otherwise to propagate or
399 | modify it is void, and will automatically terminate your rights under
400 | this License (including any patent licenses granted under the third
401 | paragraph of section 11).
402 |
403 | However, if you cease all violation of this License, then your
404 | license from a particular copyright holder is reinstated (a)
405 | provisionally, unless and until the copyright holder explicitly and
406 | finally terminates your license, and (b) permanently, if the copyright
407 | holder fails to notify you of the violation by some reasonable means
408 | prior to 60 days after the cessation.
409 |
410 | Moreover, your license from a particular copyright holder is
411 | reinstated permanently if the copyright holder notifies you of the
412 | violation by some reasonable means, this is the first time you have
413 | received notice of violation of this License (for any work) from that
414 | copyright holder, and you cure the violation prior to 30 days after
415 | your receipt of the notice.
416 |
417 | Termination of your rights under this section does not terminate the
418 | licenses of parties who have received copies or rights from you under
419 | this License. If your rights have been terminated and not permanently
420 | reinstated, you do not qualify to receive new licenses for the same
421 | material under section 10.
422 |
423 | 9. Acceptance Not Required for Having Copies.
424 |
425 | You are not required to accept this License in order to receive or
426 | run a copy of the Program. Ancillary propagation of a covered work
427 | occurring solely as a consequence of using peer-to-peer transmission
428 | to receive a copy likewise does not require acceptance. However,
429 | nothing other than this License grants you permission to propagate or
430 | modify any covered work. These actions infringe copyright if you do
431 | not accept this License. Therefore, by modifying or propagating a
432 | covered work, you indicate your acceptance of this License to do so.
433 |
434 | 10. Automatic Licensing of Downstream Recipients.
435 |
436 | Each time you convey a covered work, the recipient automatically
437 | receives a license from the original licensors, to run, modify and
438 | propagate that work, subject to this License. You are not responsible
439 | for enforcing compliance by third parties with this License.
440 |
441 | An "entity transaction" is a transaction transferring control of an
442 | organization, or substantially all assets of one, or subdividing an
443 | organization, or merging organizations. If propagation of a covered
444 | work results from an entity transaction, each party to that
445 | transaction who receives a copy of the work also receives whatever
446 | licenses to the work the party's predecessor in interest had or could
447 | give under the previous paragraph, plus a right to possession of the
448 | Corresponding Source of the work from the predecessor in interest, if
449 | the predecessor has it or can get it with reasonable efforts.
450 |
451 | You may not impose any further restrictions on the exercise of the
452 | rights granted or affirmed under this License. For example, you may
453 | not impose a license fee, royalty, or other charge for exercise of
454 | rights granted under this License, and you may not initiate litigation
455 | (including a cross-claim or counterclaim in a lawsuit) alleging that
456 | any patent claim is infringed by making, using, selling, offering for
457 | sale, or importing the Program or any portion of it.
458 |
459 | 11. Patents.
460 |
461 | A "contributor" is a copyright holder who authorizes use under this
462 | License of the Program or a work on which the Program is based. The
463 | work thus licensed is called the contributor's "contributor version".
464 |
465 | A contributor's "essential patent claims" are all patent claims
466 | owned or controlled by the contributor, whether already acquired or
467 | hereafter acquired, that would be infringed by some manner, permitted
468 | by this License, of making, using, or selling its contributor version,
469 | but do not include claims that would be infringed only as a
470 | consequence of further modification of the contributor version. For
471 | purposes of this definition, "control" includes the right to grant
472 | patent sublicenses in a manner consistent with the requirements of
473 | this License.
474 |
475 | Each contributor grants you a non-exclusive, worldwide, royalty-free
476 | patent license under the contributor's essential patent claims, to
477 | make, use, sell, offer for sale, import and otherwise run, modify and
478 | propagate the contents of its contributor version.
479 |
480 | In the following three paragraphs, a "patent license" is any express
481 | agreement or commitment, however denominated, not to enforce a patent
482 | (such as an express permission to practice a patent or covenant not to
483 | sue for patent infringement). To "grant" such a patent license to a
484 | party means to make such an agreement or commitment not to enforce a
485 | patent against the party.
486 |
487 | If you convey a covered work, knowingly relying on a patent license,
488 | and the Corresponding Source of the work is not available for anyone
489 | to copy, free of charge and under the terms of this License, through a
490 | publicly available network server or other readily accessible means,
491 | then you must either (1) cause the Corresponding Source to be so
492 | available, or (2) arrange to deprive yourself of the benefit of the
493 | patent license for this particular work, or (3) arrange, in a manner
494 | consistent with the requirements of this License, to extend the patent
495 | license to downstream recipients. "Knowingly relying" means you have
496 | actual knowledge that, but for the patent license, your conveying the
497 | covered work in a country, or your recipient's use of the covered work
498 | in a country, would infringe one or more identifiable patents in that
499 | country that you have reason to believe are valid.
500 |
501 | If, pursuant to or in connection with a single transaction or
502 | arrangement, you convey, or propagate by procuring conveyance of, a
503 | covered work, and grant a patent license to some of the parties
504 | receiving the covered work authorizing them to use, propagate, modify
505 | or convey a specific copy of the covered work, then the patent license
506 | you grant is automatically extended to all recipients of the covered
507 | work and works based on it.
508 |
509 | A patent license is "discriminatory" if it does not include within
510 | the scope of its coverage, prohibits the exercise of, or is
511 | conditioned on the non-exercise of one or more of the rights that are
512 | specifically granted under this License. You may not convey a covered
513 | work if you are a party to an arrangement with a third party that is
514 | in the business of distributing software, under which you make payment
515 | to the third party based on the extent of your activity of conveying
516 | the work, and under which the third party grants, to any of the
517 | parties who would receive the covered work from you, a discriminatory
518 | patent license (a) in connection with copies of the covered work
519 | conveyed by you (or copies made from those copies), or (b) primarily
520 | for and in connection with specific products or compilations that
521 | contain the covered work, unless you entered into that arrangement,
522 | or that patent license was granted, prior to 28 March 2007.
523 |
524 | Nothing in this License shall be construed as excluding or limiting
525 | any implied license or other defenses to infringement that may
526 | otherwise be available to you under applicable patent law.
527 |
528 | 12. No Surrender of Others' Freedom.
529 |
530 | If conditions are imposed on you (whether by court order, agreement or
531 | otherwise) that contradict the conditions of this License, they do not
532 | excuse you from the conditions of this License. If you cannot convey a
533 | covered work so as to satisfy simultaneously your obligations under this
534 | License and any other pertinent obligations, then as a consequence you may
535 | not convey it at all. For example, if you agree to terms that obligate you
536 | to collect a royalty for further conveying from those to whom you convey
537 | the Program, the only way you could satisfy both those terms and this
538 | License would be to refrain entirely from conveying the Program.
539 |
540 | 13. Remote Network Interaction; Use with the GNU General Public License.
541 |
542 | Notwithstanding any other provision of this License, if you modify the
543 | Program, your modified version must prominently offer all users
544 | interacting with it remotely through a computer network (if your version
545 | supports such interaction) an opportunity to receive the Corresponding
546 | Source of your version by providing access to the Corresponding Source
547 | from a network server at no charge, through some standard or customary
548 | means of facilitating copying of software. This Corresponding Source
549 | shall include the Corresponding Source for any work covered by version 3
550 | of the GNU General Public License that is incorporated pursuant to the
551 | following paragraph.
552 |
553 | Notwithstanding any other provision of this License, you have
554 | permission to link or combine any covered work with a work licensed
555 | under version 3 of the GNU General Public License into a single
556 | combined work, and to convey the resulting work. The terms of this
557 | License will continue to apply to the part which is the covered work,
558 | but the work with which it is combined will remain governed by version
559 | 3 of the GNU General Public License.
560 |
561 | 14. Revised Versions of this License.
562 |
563 | The Free Software Foundation may publish revised and/or new versions of
564 | the GNU Affero General Public License from time to time. Such new versions
565 | will be similar in spirit to the present version, but may differ in detail to
566 | address new problems or concerns.
567 |
568 | Each version is given a distinguishing version number. If the
569 | Program specifies that a certain numbered version of the GNU Affero General
570 | Public License "or any later version" applies to it, you have the
571 | option of following the terms and conditions either of that numbered
572 | version or of any later version published by the Free Software
573 | Foundation. If the Program does not specify a version number of the
574 | GNU Affero General Public License, you may choose any version ever published
575 | by the Free Software Foundation.
576 |
577 | If the Program specifies that a proxy can decide which future
578 | versions of the GNU Affero General Public License can be used, that proxy's
579 | public statement of acceptance of a version permanently authorizes you
580 | to choose that version for the Program.
581 |
582 | Later license versions may give you additional or different
583 | permissions. However, no additional obligations are imposed on any
584 | author or copyright holder as a result of your choosing to follow a
585 | later version.
586 |
587 | 15. Disclaimer of Warranty.
588 |
589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
597 |
598 | 16. Limitation of Liability.
599 |
600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
608 | SUCH DAMAGES.
609 |
610 | 17. Interpretation of Sections 15 and 16.
611 |
612 | If the disclaimer of warranty and limitation of liability provided
613 | above cannot be given local legal effect according to their terms,
614 | reviewing courts shall apply local law that most closely approximates
615 | an absolute waiver of all civil liability in connection with the
616 | Program, unless a warranty or assumption of liability accompanies a
617 | copy of the Program in return for a fee.
618 |
619 | END OF TERMS AND CONDITIONS
620 |
621 | How to Apply These Terms to Your New Programs
622 |
623 | If you develop a new program, and you want it to be of the greatest
624 | possible use to the public, the best way to achieve this is to make it
625 | free software which everyone can redistribute and change under these terms.
626 |
627 | To do so, attach the following notices to the program. It is safest
628 | to attach them to the start of each source file to most effectively
629 | state the exclusion of warranty; and each file should have at least
630 | the "copyright" line and a pointer to where the full notice is found.
631 |
632 |
633 | Copyright (C)
634 |
635 | This program is free software: you can redistribute it and/or modify
636 | it under the terms of the GNU Affero General Public License as published by
637 | the Free Software Foundation, either version 3 of the License, or
638 | (at your option) any later version.
639 |
640 | This program is distributed in the hope that it will be useful,
641 | but WITHOUT ANY WARRANTY; without even the implied warranty of
642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
643 | GNU Affero General Public License for more details.
644 |
645 | You should have received a copy of the GNU Affero General Public License
646 | along with this program. If not, see .
647 |
648 | Also add information on how to contact you by electronic and paper mail.
649 |
650 | If your software can interact with users remotely through a computer
651 | network, you should also make sure that it provides a way for users to
652 | get its source. For example, if your program is a web application, its
653 | interface could display a "Source" link that leads users to an archive
654 | of the code. There are many ways you could offer source, and different
655 | solutions will be better for different programs; see section 13 for the
656 | specific requirements.
657 |
658 | You should also get your employer (if you work as a programmer) or school,
659 | if any, to sign a "copyright disclaimer" for the program, if necessary.
660 | For more information on this, and how to apply and follow the GNU AGPL, see
661 | .
662 |
--------------------------------------------------------------------------------
/disass_ppc/disass/disass/disass.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * mon_ppc.cpp - PowerPC disassembler
3 | *
4 | * cxmon (C) 1997-2004 Christian Bauer, Marc Hellwig
5 | *
6 | * This program is free software; you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation; either version 2 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program; if not, write to the Free Software
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 | */
20 |
21 | #include "stdafx.h"
22 | #include "mon.h"
23 |
24 |
25 | // Instruction fields
26 | static int primop, exop, vxop, ra, rb, rc, rd;
27 | static unsigned short imm;
28 |
29 |
30 | // Codes for trap instructions
31 | static char *to_code[32] = {
32 | NULL, "lgt", "llt", NULL, "eq", "lge", "lle", NULL,
33 | "gt", NULL, NULL, NULL, "ge", NULL, NULL, NULL,
34 | "lt", NULL, NULL, NULL, "le", NULL, NULL, NULL,
35 | "ne", NULL, NULL, NULL, NULL, NULL, NULL, ""
36 | };
37 |
38 |
39 | // Macros for instruction forms
40 | #define iform(s, t) sprintf(f, "%s\t$%08x\n", s, t)
41 |
42 | #define bform(s, t) \
43 | if (rd == 0) \
44 | sprintf(f, "bdnzf%s\t%d,$%08x\n", s, ra, t); \
45 | else if (rd == 2) \
46 | sprintf(f, "bdzf%s\t%d,$%08x\n", s, ra, t); \
47 | else if (rd == 4) { \
48 | if (ra == 0) \
49 | sprintf(f, "bge%s\t$%08x\n", s, t); \
50 | else if (ra == 1) \
51 | sprintf(f, "ble%s\t$%08x\n", s, t); \
52 | else if (ra == 2) \
53 | sprintf(f, "bne%s\t$%08x\n", s, t); \
54 | else \
55 | sprintf(f, "bf%s\t%d,$%08x\n", s, ra, t); \
56 | } else if (rd == 8) \
57 | sprintf(f, "bdnzt%s\t%d,$%08x\n", s, ra, t); \
58 | else if (rd == 10) \
59 | sprintf(f, "bdzt%s\t%d,$%08x\n", s, ra, t); \
60 | else if (rd == 12) { \
61 | if (ra == 0) \
62 | sprintf(f, "blt%s\t$%08x\n", s, t); \
63 | else if (ra == 1) \
64 | sprintf(f, "bgt%s\t$%08x\n", s, t); \
65 | else if (ra == 2) \
66 | sprintf(f, "beq%s\t$%08x\n", s, t); \
67 | else \
68 | sprintf(f, "bt%s\t%d,$%08x\n", s, ra, t); \
69 | } else if (rd == 16) \
70 | sprintf(f, "bdnz%s\t$%08x\n", s, t); \
71 | else if (rd == 18) \
72 | sprintf(f, "bdz%s\t$%08x\n", s, t); \
73 | else \
74 | sprintf(f, "bc%s\t%d,%d,$%08x\n", s, rd, ra, t)
75 |
76 | #define scform(s) sprintf(f, s "\n")
77 |
78 | #define dform_ls(s) \
79 | if (ra == 0) \
80 | sprintf(f, "%s\tr%d,$%08x\n", s, rd, short(imm)); \
81 | else \
82 | sprintf(f, "%s\tr%d,$%04x(r%d)\n", s, rd, short(imm), ra)
83 | #define dform_fls(s) \
84 | if (ra == 0) \
85 | sprintf(f, "%s\tfr%d,$%08x\n", s, rd, short(imm)); \
86 | else \
87 | sprintf(f, "%s\tfr%d,$%04x(r%d)\n", s, rd, short(imm), ra)
88 | #define dform_simm(s) sprintf(f, "%s\tr%d,r%d,$%04x\n", s, rd, ra, short(imm))
89 | #define dform_simmn(s) sprintf(f, "%s\tr%d,r%d,$%04x\n", s, rd, ra, (-imm) & 0xffff)
90 | #define dform_uimm(s) sprintf(f, "%s\tr%d,r%d,$%04x\n", s, ra, rd, imm)
91 | #define dform_crs(s) sprintf(f, "%s\tcrf%d,r%d,$%04x\n", s, rd >> 2, ra, short(imm))
92 | #define dform_cru(s) sprintf(f, "%s\tcrf%d,r%d,$%04x\n", s, rd >> 2, ra, imm)
93 | #define dform_to(s) sprintf(f, "%s\t%d,r%d,$%04x\n", s, rd, ra, short(imm))
94 |
95 | #define dsform(s) sprintf(f, "%s\tr%d,$%04x(r%d)\n", s, rd, short(imm & 0xfffc), ra)
96 |
97 | #define xform_vls(s) \
98 | if (ra == 0) \
99 | sprintf(f, "%s\tv%d,r%d\n", s, rd, rb); \
100 | else \
101 | sprintf(f, "%s\tv%d,r%d,r%d\n", s, rd, ra, rb)
102 | #define xform_ls(s) \
103 | if (ra == 0) \
104 | sprintf(f, "%s\tr%d,r%d\n", s, rd, rb); \
105 | else \
106 | sprintf(f, "%s\tr%d,r%d,r%d\n", s, rd, ra, rb)
107 | #define xform_fls(s) \
108 | if (ra == 0) \
109 | sprintf(f, "%s\tfr%d,r%d\n", s, rd, rb); \
110 | else \
111 | sprintf(f, "%s\tfr%d,r%d,r%d\n", s, rd, ra, rb)
112 | #define xform_lsswi(s) \
113 | if (ra == 0) \
114 | sprintf(f, "%s\tr%d,%d\n", s, rd, rb ? rb : 32); \
115 | else \
116 | sprintf(f, "%s\tr%d,r%d,%d\n", s, rd, ra, rb ? rb : 32)
117 | #define xform_db(s) sprintf(f, "%s\tr%d,r%d\n", s, rd, rb)
118 | #define xform_d(s) sprintf(f, "%s\tr%d\n", s, rd)
119 | #define xform_fsr(s) sprintf(f, s "\tr%d,%d\n", rd, ra & 0xf)
120 | #define xform_sabc(s) sprintf(f, "%s%s\tr%d,r%d,r%d\n", s, w & 1 ? "." : "", ra, rd, rb)
121 | #define xform_sac(s) sprintf(f, "%s%s\tr%d,r%d\n", s, w & 1 ? "." : "", ra, rd)
122 | #define xform_tsr(s) sprintf(f, s "\t%d,r%d\n", ra & 0xf, rd)
123 | #define xform_sash(s) sprintf(f, s "%s\tr%d,r%d,%d\n", w & 1 ? "." : "", ra, rd, rb)
124 | #define xform_crlab(s) sprintf(f, "%s\tcrf%d,r%d,r%d\n", s, rd >> 2, ra, rb)
125 | #define xform_fcrab(s) sprintf(f, "%s\tcrf%d,fr%d,fr%d\n", s, rd >> 2, ra, rb)
126 | #define xform_crcr(s) sprintf(f, "%s\tcrf%d,crf%d\n", s, rd >> 2, ra >> 2)
127 | #define xform_cr(s) sprintf(f, "%s\tcrf%d\n", s, rd >> 2)
128 | #define xform_cri(s) sprintf(f, s "%s\tcrf%d,%d\n", w & 1 ? "." : "", rd >> 2, rb >> 1)
129 | #define xform_to(s) sprintf(f, "%s\t%d,r%d,r%d\n", s, rd, ra, rb)
130 | #define xform_fdb(s) sprintf(f, "%s%s\tfr%d,fr%d\n", s, w & 1 ? "." : "", rd, rb)
131 | #define xform_fd(s) sprintf(f, "%s%s\tfr%d\n", s, w & 1 ? "." : "", rd)
132 | #define xform_crb(s) sprintf(f, "%s%s\tcrb%d\n", s, w & 1 ? "." : "", rd)
133 | #define xform_ab(s) sprintf(f, "%s\tr%d,r%d\n", s, ra, rb)
134 | #define xform_b(s) sprintf(f, "%s\tr%d\n", s, rb)
135 | #define xform(s) sprintf(f, s "\n")
136 |
137 | #define xlform_b(s) sprintf(f, "%s\t%d,%d\n", s, rd, ra)
138 | #define xlform_cr(s) sprintf(f, "%s\tcrb%d,crb%d,crb%d\n", s, rd, ra, rb)
139 | #define xlform_crcr(s) sprintf(f, "%s\tcrf%d,crf%d\n", s, rd >> 2, ra >> 2)
140 | #define xlform(s) sprintf(f, s "\n")
141 |
142 | #define xfxform_fspr(s) sprintf(f, "%s\tr%d,SPR%d\n", s, rd, ra | (rb << 5))
143 | #define xfxform_crm(s) sprintf(f, s "\t$%02x,r%d\n", w >> 12 & 0xff, rd)
144 | #define xfxform_tspr(s) sprintf(f, "%s\tSPR%d,r%d\n", s, ra | (rb << 5), rd)
145 | #define xfxform_tb(s) sprintf(f, "%s\tr%d\n", s, rd)
146 |
147 | #define xflform(s) sprintf(f, s "%s\t$%02x,fr%d\n", w & 1 ? "." : "", w >> 17 & 0xff, rb)
148 |
149 | #define xsform(s) sprintf(f, s "%s\tr%d,r%d,%d\n", w & 1 ? "." : "", ra, rd, rb | (w & 2 ? 32 : 0))
150 |
151 | #define xoform_dab(s) sprintf(f, "%s%s\tr%d,r%d,r%d\n", s, w & 1 ? "." : "", rd, ra, rb)
152 | #define xoform_da(s) sprintf(f, "%s%s\tr%d,r%d\n", s, w & 1 ? "." : "", rd, ra)
153 |
154 | #define aform_dab(s) sprintf(f, "%s%s\tfr%d,fr%d,fr%d\n", s, w & 1 ? "." : "", rd, ra, rb)
155 | #define aform_db(s) sprintf(f, "%s%s\tfr%d,fr%d\n", s, w & 1 ? "." : "", rd, rb)
156 | #define aform_dac(s) sprintf(f, "%s%s\tfr%d,fr%d,fr%d\n", s, w & 1 ? "." : "", rd, ra, rc)
157 | #define aform_dacb(s) sprintf(f, "%s%s\tfr%d,fr%d,fr%d,fr%d\n", s, w & 1 ? "." : "", rd, ra, rc, rb)
158 |
159 | #define mform(s) sprintf(f, "%s%s\tr%d,r%d,r%d,$%08x\n", s, w & 1 ? "." : "", ra, rd, rb, mbme2mask(w >> 6 & 31, w >>1 & 31))
160 | #define mform_i(s) sprintf(f, "%s%s\tr%d,r%d,%d,$%08x\n", s, w & 1 ? "." : "", ra, rd, rb, mbme2mask(w >> 6 & 31, w >>1 & 31))
161 |
162 | #define mdform(s) sprintf(f, "%s%s\tr%d,r%d,%d,%d\n", s, w & 1 ? "." : "", ra, rd, rb | (w & 2 ? 32 : 0), rc | (w & 32 ? 32 : 0))
163 |
164 | #define mdsform(s) sprintf(f, "%s%s\tr%d,r%d,r%d,%d\n", s, w & 1 ? "." : "", ra, rd, rb, rc | (w & 32 ? 32 : 0))
165 |
166 | #define va_form(s) sprintf(f, "%s\tv%d,v%d,v%d,v%d\n", s, rd, ra, rb, rc)
167 | #define vx_form(s) sprintf(f, "%s\tv%d,v%d,v%d\n", s, rd, ra, rb)
168 | #define vxr_form(s) sprintf(f, "%s%s\tv%d,v%d,v%d\n", s, w & (1 << 10) ? "." : "", rd, ra, rb)
169 | #define vxi_ra_form(s) sprintf(f, "%s\tv%d,v%d,%d\n", s, rd, rb, ra)
170 | #define vx_raz_form(s) \
171 | if (ra == 0) \
172 | sprintf(f, "%s\tv%d,v%d\n", s, rd, rb); \
173 | else \
174 | sprintf(f, "?\n")
175 | #define vxi_ras_rbz_form(s) \
176 | if (rb == 0) \
177 | sprintf(f, "%s\tv%d,%d\n", s, rd, ra - (ra & 0x10 ? 0x20 : 0)); \
178 | else \
179 | sprintf(f, "?\n")
180 |
181 | // Prototypes
182 | static void disass4(char* f, unsigned int adr, unsigned int w);
183 | static void disass19(char* f, unsigned int adr, unsigned int w);
184 | static void disass31(char* f, unsigned int adr, unsigned int w);
185 | static void disass59(char* f, unsigned int adr, unsigned int w);
186 | static void disass63(char* f, unsigned int adr, unsigned int w);
187 |
188 | extern "C" __declspec(dllexport) void disass_ppc(char* f, unsigned int adr, unsigned int w);
189 |
190 | static unsigned int mbme2mask(int mb, int me);
191 | static char *get_spr(int reg);
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 | /*
200 | * Disassemble one instruction
201 | */
202 |
203 | extern "C" __declspec(dllexport) void disass_ppc(char* f, unsigned int adr, unsigned int w)
204 | {
205 | // Divide instruction into fields
206 | primop = w >> 26;
207 | rd = w >> 21 & 0x1f;
208 | ra = w >> 16 & 0x1f;
209 | rb = w >> 11 & 0x1f;
210 | rc = w >> 6 & 0x1f;
211 | exop = w >> 1 & 0x3ff;
212 | vxop = w & 0x7ff;
213 | imm = w & 0xffff;
214 |
215 | // Decode primary opcode
216 | switch (primop) {
217 | case 2: // 64 bit
218 | if (to_code[rd] != NULL)
219 | sprintf(f, "td%si\tr%d,$%04x\n", to_code[rd], ra, short(imm));
220 | else
221 | dform_to("tdi");
222 | break;
223 |
224 | case 3:
225 | if (to_code[rd] != NULL)
226 | sprintf(f, "tw%si\tr%d,$%04x\n", to_code[rd], ra, short(imm));
227 | else
228 | dform_to("twi");
229 | break;
230 |
231 | case 4: // AltiVec
232 | disass4(f, adr, w);
233 | break;
234 |
235 | case 7: dform_simm("mulli"); break;
236 | case 8: dform_simm("subfic"); break;
237 |
238 | case 10:
239 | if (rd & 1)
240 | dform_cru("cmpldi"); // 64 bit
241 | else
242 | dform_cru("cmplwi");
243 | break;
244 |
245 | case 11:
246 | if (rd & 1)
247 | dform_crs("cmpdi"); // 64 bit
248 | else
249 | dform_crs("cmpwi");
250 | break;
251 |
252 | case 12:
253 | if (imm < 0x8000)
254 | dform_simm("addic");
255 | else
256 | dform_simmn("subic");
257 | break;
258 |
259 | case 13:
260 | if (imm < 0x8000)
261 | dform_simm("addic.");
262 | else
263 | dform_simmn("subic.");
264 | break;
265 |
266 | case 14:
267 | if (ra == 0)
268 | sprintf(f, "li\tr%d,$%04x\n", rd, short(imm));
269 | else
270 | if (imm < 0x8000)
271 | dform_simm("addi");
272 | else
273 | dform_simmn("subi");
274 | break;
275 |
276 | case 15:
277 | if (ra == 0)
278 | sprintf(f, "lis\tr%d,$%04x\n", rd, imm);
279 | else
280 | if (imm < 0x8000)
281 | dform_simm("addis");
282 | else
283 | dform_simmn("subis");
284 | break;
285 |
286 | case 16: {
287 | int target = short(imm & 0xfffc);
288 | char *form;
289 | if (w & 1)
290 | if (w & 2)
291 | form = "la";
292 | else {
293 | form = "l";
294 | target += adr;
295 | }
296 | else
297 | if (w & 2)
298 | form = "a";
299 | else {
300 | form = "";
301 | target += adr;
302 | }
303 | bform(form, target);
304 | break;
305 | }
306 |
307 | case 17:
308 | if (w & 2)
309 | scform("sc");
310 | else
311 | sprintf(f, "?\n");
312 | break;
313 |
314 | case 18: {
315 | int target = w & 0x03fffffc;
316 | if (target & 0x02000000)
317 | target |= 0xfc000000;
318 | if (w & 1)
319 | if (w & 2)
320 | iform("bla", target);
321 | else
322 | iform("bl", adr + target);
323 | else
324 | if (w & 2)
325 | iform("ba", target);
326 | else
327 | iform("b", adr + target);
328 | break;
329 | }
330 |
331 | case 19: disass19(f, adr, w); break;
332 | case 20: mform_i("rlwimi"); break;
333 | case 21: mform_i("rlwinm"); break;
334 | case 23: mform("rlwnm"); break;
335 |
336 | case 24:
337 | if (rd == 0 && ra == 0 && imm == 0)
338 | sprintf(f, "nop\n");
339 | else
340 | dform_uimm("ori");
341 | break;
342 |
343 | case 25: dform_uimm("oris"); break;
344 | case 26: dform_uimm("xori"); break;
345 | case 27: dform_uimm("xoris"); break;
346 | case 28: dform_uimm("andi."); break;
347 | case 29: dform_uimm("andis."); break;
348 |
349 | case 30: // 64 bit
350 | switch (w >> 1 & 0xf) {
351 | case 0: case 1: mdform("rldicl"); break;
352 | case 2: case 3: mdform("rldicr"); break;
353 | case 4: case 5: mdform("rldic"); break;
354 | case 6: case 7: mdform("rldimi"); break;
355 | case 8: mdsform("rldcl"); break;
356 | case 9: mdsform("rldcr"); break;
357 | default:
358 | sprintf(f, "?\n");
359 | break;
360 | };
361 | break;
362 |
363 | case 31: disass31(f, adr, w); break;
364 | case 32: dform_ls("lwz"); break;
365 | case 33: dform_ls("lwzu"); break;
366 | case 34: dform_ls("lbz"); break;
367 | case 35: dform_ls("lbzu"); break;
368 | case 36: dform_ls("stw"); break;
369 | case 37: dform_ls("stwu"); break;
370 | case 38: dform_ls("stb"); break;
371 | case 39: dform_ls("stbu"); break;
372 | case 40: dform_ls("lhz"); break;
373 | case 41: dform_ls("lhzu"); break;
374 | case 42: dform_ls("lha"); break;
375 | case 43: dform_ls("lhau"); break;
376 | case 44: dform_ls("sth"); break;
377 | case 45: dform_ls("sthu"); break;
378 | case 46: dform_ls("lmw"); break;
379 | case 47: dform_ls("stmw"); break;
380 | case 48: dform_fls("lfs"); break;
381 | case 49: dform_fls("lfsu"); break;
382 | case 50: dform_fls("lfd"); break;
383 | case 51: dform_fls("lfdu"); break;
384 | case 52: dform_fls("stfs"); break;
385 | case 53: dform_fls("stfsu"); break;
386 | case 54: dform_fls("stfd"); break;
387 | case 55: dform_fls("stfdu"); break;
388 |
389 | case 58: // 64 bit
390 | switch (w & 3) {
391 | case 0: dsform("ld"); break;
392 | case 1: dsform("ldu"); break;
393 | case 2: dsform("lwa"); break;
394 | default:
395 | sprintf(f, "?\n");
396 | break;
397 | }
398 | break;
399 |
400 | case 59: disass59(f, adr, w); break;
401 |
402 | case 62: // 64 bit
403 | switch (w & 3) {
404 | case 0: dsform("std"); break;
405 | case 1: dsform("stdu"); break;
406 | default:
407 | sprintf(f, "?\n");
408 | break;
409 | }
410 | break;
411 |
412 | case 63: disass63(f, adr, w); break;
413 |
414 | default:
415 | if (!w)
416 | sprintf(f, "illegal\n");
417 | else
418 | sprintf(f, "?\n");
419 | break;
420 | }
421 | }
422 |
423 |
424 | /*
425 | * Disassemble instruction with primary opcode = 4 (VX-Form)
426 | */
427 |
428 | static void disass4(char* f, unsigned int adr, unsigned int w)
429 | {
430 | switch (vxop) {
431 | case 1540:
432 | if (ra == 0 && rb == 0)
433 | sprintf(f, "mfvscr\tv%d\n", rd);
434 | else
435 | sprintf(f, "?\n");
436 | break;
437 | case 1604:
438 | if (rd == 0 && ra == 0)
439 | sprintf(f, "mtvscr\tv%d\n", rb);
440 | else
441 | sprintf(f, "?\n");
442 | break;
443 | case 384: vx_form("vaddcuw"); break;
444 | case 10: vx_form("vaddfp"); break;
445 | case 768: vx_form("vaddsbs"); break;
446 | case 832: vx_form("vaddshs"); break;
447 | case 896: vx_form("vaddsws"); break;
448 | case 0: vx_form("vaddubm"); break;
449 | case 512: vx_form("vaddubs"); break;
450 | case 64: vx_form("vadduhm"); break;
451 | case 576: vx_form("vadduhs"); break;
452 | case 128: vx_form("vadduwm"); break;
453 | case 640: vx_form("vadduws"); break;
454 | case 1028: vx_form("vand"); break;
455 | case 1092: vx_form("vandc"); break;
456 | case 1282: vx_form("vavgsb"); break;
457 | case 1346: vx_form("vavgsh"); break;
458 | case 1410: vx_form("vavgsw"); break;
459 | case 1026: vx_form("vavgub"); break;
460 | case 1090: vx_form("vavguh"); break;
461 | case 1154: vx_form("vavguw"); break;
462 | case 842: vxi_ra_form("vcfsx"); break;
463 | case 778: vxi_ra_form("vcfux"); break;
464 | case 966: case 966+1024: vxr_form("vcmpbfp"); break;
465 | case 198: case 198+1024: vxr_form("vcmpeqfp"); break;
466 | case 6: case 6+1024: vxr_form("vcmpequb"); break;
467 | case 70: case 70+1024: vxr_form("vcmpequh"); break;
468 | case 134: case 134+1024: vxr_form("vcmpequw"); break;
469 | case 454: case 454+1024: vxr_form("vcmpgefp"); break;
470 | case 710: case 710+1024: vxr_form("vcmpgtfp"); break;
471 | case 774: case 774+1024: vxr_form("vcmpgtsb"); break;
472 | case 838: case 838+1024: vxr_form("vcmpgtsh"); break;
473 | case 902: case 902+1024: vxr_form("vcmpgtsw"); break;
474 | case 518: case 518+1024: vxr_form("vcmpgtub"); break;
475 | case 582: case 582+1024: vxr_form("vcmpgtuh"); break;
476 | case 646: case 646+1024: vxr_form("vcmpgtuw"); break;
477 | case 970: vxi_ra_form("vctsxs"); break;
478 | case 906: vxi_ra_form("vctuxs"); break;
479 | case 394: vx_raz_form("vexptefp"); break;
480 | case 458: vx_raz_form("vlogefp"); break;
481 | case 1034: vx_form("vmaxfp"); break;
482 | case 258: vx_form("vmaxsb"); break;
483 | case 322: vx_form("vmaxsh"); break;
484 | case 386: vx_form("vmaxsw"); break;
485 | case 2: vx_form("vmaxub"); break;
486 | case 66: vx_form("vmaxuh"); break;
487 | case 130: vx_form("vmaxuw"); break;
488 | case 1098: vx_form("vminfp"); break;
489 | case 770: vx_form("vminsb"); break;
490 | case 834: vx_form("vminsh"); break;
491 | case 898: vx_form("vminsw"); break;
492 | case 514: vx_form("vminub"); break;
493 | case 578: vx_form("vminuh"); break;
494 | case 642: vx_form("vminuw"); break;
495 | case 12: vx_form("vmrghb"); break;
496 | case 76: vx_form("vmrghh"); break;
497 | case 140: vx_form("vmrghw"); break;
498 | case 268: vx_form("vmrglb"); break;
499 | case 332: vx_form("vmrglh"); break;
500 | case 396: vx_form("vmrglw"); break;
501 | case 776: vx_form("vmulesb"); break;
502 | case 840: vx_form("vmulesh"); break;
503 | case 520: vx_form("vmuleub"); break;
504 | case 584: vx_form("vmuleuh"); break;
505 | case 264: vx_form("vmulosb"); break;
506 | case 328: vx_form("vmulosh"); break;
507 | case 8: vx_form("vmuloub"); break;
508 | case 72: vx_form("vmulouh"); break;
509 | case 1284: vx_form("vnor"); break;
510 | case 1156: vx_form("vor"); break;
511 | case 782: vx_form("vpkpx"); break;
512 | case 398: vx_form("vpkshss"); break;
513 | case 270: vx_form("vpkshus"); break;
514 | case 462: vx_form("vpkswss"); break;
515 | case 334: vx_form("vpkswus"); break;
516 | case 14: vx_form("vpkuhum"); break;
517 | case 142: vx_form("vpkuhus"); break;
518 | case 78: vx_form("vpkuwum"); break;
519 | case 206: vx_form("vpkuwus"); break;
520 | case 266: vx_raz_form("vrefp"); break;
521 | case 714: vx_raz_form("vrfim"); break;
522 | case 522: vx_raz_form("vrfin"); break;
523 | case 650: vx_raz_form("vrfip"); break;
524 | case 586: vx_raz_form("vrfiz"); break;
525 | case 4: vx_form("vrlb"); break;
526 | case 68: vx_form("vrlh"); break;
527 | case 132: vx_form("vrlw"); break;
528 | case 330: vx_raz_form("vrsqrtefp"); break;
529 | case 452: vx_form("vsl"); break;
530 | case 260: vx_form("vslb"); break;
531 | case 324: vx_form("vslh"); break;
532 | case 1036: vx_form("vslo"); break;
533 | case 388: vx_form("vslw"); break;
534 | case 524: vxi_ra_form("vspltb"); break;
535 | case 588: vxi_ra_form("vsplth"); break;
536 | case 780: vxi_ras_rbz_form("vspltisb"); break;
537 | case 844: vxi_ras_rbz_form("vspltish"); break;
538 | case 908: vxi_ras_rbz_form("vspltisw"); break;
539 | case 652: vxi_ra_form("vspltw"); break;
540 | case 708: vx_form("vsr"); break;
541 | case 772: vx_form("vsrab"); break;
542 | case 836: vx_form("vsrah"); break;
543 | case 900: vx_form("vsraw"); break;
544 | case 516: vx_form("vsrb"); break;
545 | case 580: vx_form("vsrh"); break;
546 | case 1100: vx_form("vsro"); break;
547 | case 644: vx_form("vsrw"); break;
548 | case 1408: vx_form("vsubcuw"); break;
549 | case 74: vx_form("vsubfp"); break;
550 | case 1792: vx_form("vsubsbs"); break;
551 | case 1856: vx_form("vsubshs"); break;
552 | case 1920: vx_form("vsubsws"); break;
553 | case 1024: vx_form("vsububm"); break;
554 | case 1536: vx_form("vsububs"); break;
555 | case 1088: vx_form("vsubuhm"); break;
556 | case 1600: vx_form("vsubuhs"); break;
557 | case 1152: vx_form("vsubuwm"); break;
558 | case 1664: vx_form("vsubuws"); break;
559 | case 1928: vx_form("vsumsws"); break;
560 | case 1672: vx_form("vsum2sws"); break;
561 | case 1800: vx_form("vsum4sbs"); break;
562 | case 1608: vx_form("vsum4shs"); break;
563 | case 1544: vx_form("vsum4ubs"); break;
564 | case 846: vx_raz_form("vupkhpx"); break;
565 | case 526: vx_raz_form("vupkhsb"); break;
566 | case 590: vx_raz_form("vupkhsh"); break;
567 | case 974: vx_raz_form("vupklpx"); break;
568 | case 654: vx_raz_form("vupklsb"); break;
569 | case 718: vx_raz_form("vupklsh"); break;
570 | case 1220: vx_form("vxor"); break;
571 | default:
572 | if ((vxop & 0x43f) == 44) { // vsldoi vD,vA,vB,SHB
573 | sprintf(f, "vsldoi\tv%d,v%d,v%d,%d\n", rd, ra, rb, rc & 15);
574 | break;
575 | }
576 | switch (vxop & 0x3f) { // VA-form, must come last
577 | case 46: va_form("vmaddfp"); break;
578 | case 32: va_form("vmhaddshs"); break;
579 | case 33: va_form("vmhraddshs"); break;
580 | case 34: va_form("vmladduhm"); break;
581 | case 37: va_form("vmsummbm"); break;
582 | case 40: va_form("vmsumshm"); break;
583 | case 41: va_form("vmsumshs"); break;
584 | case 36: va_form("vmsumubm"); break;
585 | case 38: va_form("vmsumuhm"); break;
586 | case 39: va_form("vmsumuhs"); break;
587 | case 47: va_form("vnmsubfp"); break;
588 | case 43: va_form("vperm"); break;
589 | case 42: va_form("vsel"); break;
590 | default: sprintf(f, "?\n"); break;
591 | }
592 | break;
593 | }
594 | }
595 |
596 |
597 | /*
598 | * Disassemble instruction with primary opcode = 19 (XL-Form)
599 | */
600 |
601 | static void disass19(char* f, unsigned int adr, unsigned int w)
602 | {
603 | switch (exop) {
604 | case 0: xlform_crcr("mcrf"); break;
605 |
606 | case 16:
607 | if (w & 1)
608 | if (rd == 20)
609 | sprintf(f, "blrl\n");
610 | else
611 | xlform_b("bclrl");
612 | else
613 | if (rd == 20)
614 | sprintf(f, "blr\n");
615 | else
616 | xlform_b("bclr");
617 | break;
618 |
619 | case 33:
620 | if (ra == rb)
621 | sprintf(f, "crnot\tcrb%d,crb%d\n", rd, ra);
622 | else
623 | xlform_cr("crnor");
624 | break;
625 |
626 | case 50: xlform("rfi"); break;
627 | case 129: xlform_cr("crandc"); break;
628 | case 150: xlform("isync"); break;
629 |
630 | case 193:
631 | if (ra == rd && rb == rd)
632 | sprintf(f, "crclr\tcrb%d\n", rd);
633 | else
634 | xlform_cr("crxor");
635 | break;
636 |
637 | case 225: xlform_cr("crnand"); break;
638 | case 257: xlform_cr("crand"); break;
639 |
640 | case 289:
641 | if (ra == rd && rb == rd)
642 | sprintf(f, "crset\tcrb%d\n", rd);
643 | else
644 | xlform_cr("creqv");
645 | break;
646 |
647 | case 417: xlform_cr("crorc"); break;
648 |
649 | case 449:
650 | if (ra == rb)
651 | sprintf(f, "crmove\tcrb%d,crb%d\n", rd, ra);
652 | else
653 | xlform_cr("cror");
654 | break;
655 |
656 | case 528:
657 | if (w & 1)
658 | if (rd == 20)
659 | sprintf(f, "bctrl\n");
660 | else
661 | xlform_b("bcctrl");
662 | else
663 | if (rd == 20)
664 | sprintf(f, "bctr\n");
665 | else
666 | xlform_b("bcctr");
667 | break;
668 |
669 | default:
670 | sprintf(f, "?\n");
671 | break;
672 | }
673 | }
674 |
675 |
676 | /*
677 | * Disassemble instruction with primary opcode = 31 (X-Form/XO-Form/XFX-Form/XS-Form)
678 | */
679 |
680 | static void disass31(char* f, unsigned int adr, unsigned int w)
681 | {
682 | switch (exop) {
683 | case 0:
684 | if (rd & 1)
685 | xform_crlab("cmpd"); // 64 bit
686 | else
687 | xform_crlab("cmpw");
688 | break;
689 |
690 | case 4:
691 | if (rd == 31 && ra == 0 && rb == 0)
692 | xform("trap");
693 | else if (to_code[rd] != NULL)
694 | sprintf(f, "tw%s\tr%d,r%d\n", to_code[rd], ra, rb);
695 | else
696 | xform_to("tw");
697 | break;
698 |
699 | case 6: xform_vls("lvsl"); break;
700 | case 7: xform_vls("lvebx"); break;
701 | case 8: xoform_dab("subfc"); break;
702 | case 8+512: xoform_dab("subfco"); break;
703 | case 9: case 9+512: xoform_dab("mulhdu"); break; // 64 bit
704 | case 10: xoform_dab("addc"); break;
705 | case 10+512: xoform_dab("addco"); break;
706 | case 11: case 11+512: xoform_dab("mulhwu"); break;
707 | case 19: xform_d("mfcr"); break;
708 | case 20: xform_ls("lwarx"); break;
709 | case 21: xform_ls("ldx"); break; // 64 bit
710 | case 23: xform_ls("lwzx"); break;
711 | case 24: xform_sabc("slw"); break;
712 | case 26: xform_sac("cntlzw"); break;
713 | case 27: xform_sabc("sld"); break; // 64 bit
714 | case 28: xform_sabc("and"); break;
715 |
716 | case 32:
717 | if (rd & 1)
718 | xform_crlab("cmpld"); // 64 bit
719 | else
720 | xform_crlab("cmplw");
721 | break;
722 |
723 | case 38: xform_vls("lvsr"); break;
724 | case 39: xform_vls("lvehx"); break;
725 | case 40: xoform_dab("subf"); break;
726 | case 40+512: xoform_dab("subfo"); break;
727 | case 53: xform_ls("ldux"); break; // 64 bit
728 | case 54: xform_ab("dcbst"); break;
729 | case 55: xform_ls("lwzux"); break;
730 | case 58: xform_sac("cntlzd"); break; // 64 bit
731 | case 60: xform_sabc("andc"); break;
732 |
733 | case 68: // 64 bit
734 | if (to_code[rd] != NULL)
735 | sprintf(f, "td%s\tr%d,r%d\n", to_code[rd], ra, rb);
736 | else
737 | xform_to("td");
738 | break;
739 |
740 | case 71: xform_vls("lvewx"); break;
741 | case 73: case 73+512: xoform_dab("mulhd"); break; // 64 bit
742 | case 75: case 75+512: xoform_dab("mulhw"); break;
743 | case 83: xform_d("mfmsr"); break;
744 | case 84: xform_ls("ldarx"); break; // 64 bit
745 | case 86: xform_ab("dcbf"); break;
746 | case 87: xform_ls("lbzx"); break;
747 | case 103: xform_vls("lvx"); break;
748 | case 104: xoform_da("neg"); break;
749 | case 104+512: xoform_da("nego"); break;
750 | case 119: xform_ls("lbzux"); break;
751 |
752 | case 124:
753 | if (rd == rb)
754 | sprintf(f, "not%s\tr%d,r%d\n", w & 1 ? "." : "", ra, rd);
755 | else
756 | xform_sabc("nor");
757 | break;
758 |
759 | case 135: xform_vls("stvebx"); break;
760 | case 136: xoform_dab("subfe"); break;
761 | case 136+512: xoform_dab("subfeo"); break;
762 | case 138: xoform_dab("adde"); break;
763 | case 138+512: xoform_dab("addeo"); break;
764 | case 144: xfxform_crm("mtcrf"); break;
765 | case 146: xform_d("mtmsr"); break;
766 | case 149: xform_ls("stdx"); break; // 64 bit
767 |
768 | case 150:
769 | if (w & 1)
770 | xform_ls("stwcx.");
771 | else
772 | sprintf(f, "?\n");
773 | break;
774 |
775 | case 151: xform_ls("stwx"); break;
776 | case 167: xform_vls("stvehx"); break;
777 | case 181: xform_ls("stdux"); break; // 64 bit
778 | case 183: xform_ls("stwux"); break;
779 | case 199: xform_vls("stvewx"); break;
780 | case 200: xoform_da("subfze"); break;
781 | case 200+512: xoform_da("subfzeo"); break;
782 | case 202: xoform_da("addze"); break;
783 | case 202+512: xoform_da("addzeo"); break;
784 | case 210: xform_tsr("mtsr"); break;
785 |
786 | case 214: // 64 bit
787 | if (w & 1)
788 | xform_ls("stdcx");
789 | else
790 | sprintf(f, "?\n");
791 | break;
792 |
793 | case 215: xform_ls("stbx"); break;
794 | case 231: xform_vls("stvx"); break;
795 | case 232: xoform_da("subfme"); break;
796 | case 232+512: xoform_da("subfmeo"); break;
797 | case 233: xoform_dab("mulld"); break; // 64 bit
798 | case 233+512: xoform_dab("mulldo"); break; // 64 bit
799 | case 234: xoform_da("addme"); break;
800 | case 234+512: xoform_da("addmeo"); break;
801 | case 235: xoform_dab("mullw"); break;
802 | case 235+512: xoform_dab("mullwo"); break;
803 | case 242: xform_db("mtsrin"); break;
804 | case 246: xform_ab("dcbtst"); break;
805 | case 247: xform_ls("stbux"); break;
806 | case 266: xoform_dab("add"); break;
807 | case 266+512: xoform_dab("addo"); break;
808 | case 278: xform_ab("dcbt"); break;
809 | case 279: xform_ls("lhzx"); break;
810 | case 284: xform_sabc("eqv"); break;
811 | case 306: xform_b("tlbie"); break;
812 | case 310: xform_ls("eciwx"); break;
813 | case 311: xform_ls("lhzux"); break;
814 | case 316: xform_sabc("xor"); break;
815 |
816 | case 339:
817 | if ((ra | (rb << 5)) == 1)
818 | sprintf(f, "mfxer\tr%d\n", rd);
819 | else if ((ra | (rb << 5)) == 8)
820 | sprintf(f, "mflr\tr%d\n", rd);
821 | else if ((ra | (rb << 5)) == 9)
822 | sprintf(f, "mfctr\tr%d\n", rd);
823 | else if ((ra | (rb << 5)) == 256)
824 | sprintf(f, "mfvrsave\tr%d\n", rd);
825 | else {
826 | char *spr = get_spr(ra | (rb << 5));
827 | if (spr)
828 | sprintf(f, "mfspr\tr%d,%s\n", rd, spr);
829 | else
830 | xfxform_fspr("mfspr");
831 | }
832 | break;
833 |
834 | case 341: xform_ls("lwax"); break; // 64 bit
835 | case 343: xform_ls("lhax"); break;
836 | case 359: xform_vls("lvxl"); break;
837 | case 370: xform("tlbia"); break;
838 |
839 | case 822: // AltiVec
840 | if ((rd & 0xc) == 0 && ra == 0 && rb == 0 && (w & 1) == 0) {
841 | if (rd & 0x10)
842 | sprintf(f, "dssall\n");
843 | else
844 | sprintf(f, "dss\t%d\n", rd & 3);
845 | }
846 | else
847 | sprintf(f, "?\n");
848 | break;
849 |
850 | case 342: // AltiVec
851 | if ((rd & 0xc) == 0 && (w & 1) == 0)
852 | sprintf(f, "dst%s\tr%d,r%d,%d\n", rd & 0x10 ? "t" : "", ra, rb, rd & 3);
853 | else
854 | sprintf(f, "?\n");
855 | break;
856 |
857 | case 374: // AltiVec
858 | if ((rd & 0xc) == 0 && (w & 1) == 0)
859 | sprintf(f, "dstst%s\tr%d,r%d,%d\n", rd & 0x10 ? "t" : "", ra, rb, rd & 3);
860 | else
861 | sprintf(f, "?\n");
862 | break;
863 |
864 | case 371:
865 | if ((ra | (rb << 5)) == 268)
866 | xfxform_tb("mftb");
867 | else if ((ra | (rb << 5)) == 269)
868 | xfxform_tb("mftbu");
869 | else
870 | sprintf(f, "?\n");
871 | break;
872 |
873 | case 373: xform_ls("lwaux"); break; // 64 bit
874 | case 375: xform_ls("lhaux"); break;
875 | case 407: xform_ls("sthx"); break;
876 | case 412: xform_sabc("orc"); break;
877 | case 434: xform_b("slbie"); break; // 64 bit
878 | case 438: xform_ls("ecowx"); break;
879 | case 439: xform_ls("sthux"); break;
880 |
881 | case 444:
882 | if (rd == rb)
883 | sprintf(f, "mr%s\tr%d,r%d\n", w & 1 ? "." : "", ra, rd);
884 | else
885 | xform_sabc("or");
886 | break;
887 |
888 | case 457: xoform_dab("divdu"); break; // 64 bit
889 | case 457+512: xoform_dab("divduo"); break; // 64 bit
890 | case 459: xoform_dab("divwu"); break;
891 | case 459+512: xoform_dab("divwuo"); break;
892 |
893 | case 467:
894 | if ((ra | (rb << 5)) == 1)
895 | sprintf(f, "mtxer\tr%d\n", rd);
896 | else if ((ra | (rb << 5)) == 8)
897 | sprintf(f, "mtlr\tr%d\n", rd);
898 | else if ((ra | (rb << 5)) == 9)
899 | sprintf(f, "mtctr\tr%d\n", rd);
900 | else if ((ra | (rb << 5)) == 256)
901 | sprintf(f, "mtvrsave\tr%d\n", rd);
902 | else {
903 | char *spr = get_spr(ra | (rb << 5));
904 | if (spr)
905 | sprintf(f, "mtspr\t%s,r%d\n", spr, rd);
906 | else
907 | xfxform_tspr("mtspr");
908 | }
909 | break;
910 |
911 | case 470: xform_ab("dcbi"); break;
912 | case 476: xform_sabc("nand"); break;
913 | case 487: xform_vls("stvxl"); break;
914 | case 489: xoform_dab("divd"); break; // 64 bit
915 | case 489+512: xoform_dab("divdo"); break; // 64 bit
916 | case 491: xoform_dab("divw"); break;
917 | case 491+512: xoform_dab("divwo"); break;
918 | case 498: xform("slbia"); break; // 64 bit
919 | case 512: xform_cr("mcrxr"); break;
920 | case 533: xform_ls("lswx"); break;
921 | case 534: xform_ls("lwbrx"); break;
922 | case 535: xform_fls("lfsx"); break;
923 | case 536: xform_sabc("srw"); break;
924 | case 539: xform_sabc("srd"); break; // 64 bit
925 | case 566: xform("tlbsync"); break;
926 | case 567: xform_fls("lfsux"); break;
927 | case 595: xform_fsr("mfsr"); break;
928 | case 597: xform_lsswi("lswi"); break;
929 | case 598: xform("sync"); break;
930 | case 599: xform_fls("lfdx"); break;
931 | case 631: xform_fls("lfdux"); break;
932 | case 659: xform_db("mfsrin"); break;
933 | case 661: xform_ls("stswx"); break;
934 | case 662: xform_ls("stwbrx"); break;
935 | case 663: xform_fls("stfsx"); break;
936 | case 695: xform_fls("stfsux"); break;
937 | case 725: xform_lsswi("stswi"); break;
938 | case 727: xform_fls("stfdx"); break;
939 | case 758: xform_ab("dcba"); break;
940 | case 759: xform_fls("stfdux"); break;
941 | case 790: xform_ls("lhbrx"); break;
942 | case 792: xform_sabc("sraw"); break;
943 | case 794: xform_sabc("srad"); break; // 64 bit
944 | case 824: xform_sash("srawi"); break;
945 | case 826: case 827: xsform("sradi"); break; // 64 bit
946 | case 854: xform("eieio"); break;
947 | case 918: xform_ls("sthbrx"); break;
948 | case 922: xform_sac("extsh"); break;
949 | case 954: xform_sac("extsb"); break;
950 | case 978: sprintf(f, "tlbld\tr%d\n", rb); break; // 603
951 | case 982: xform_ab("icbi"); break;
952 | case 983: xform_fls("stfiwx"); break;
953 | case 986: xform_sac("extsw"); break; // 64 bit
954 | case 1010: sprintf(f, "tlbli\tr%d\n", rb); break; // 603
955 | case 1014: xform_ab("dcbz"); break;
956 |
957 | default:
958 | sprintf(f, "?\n");
959 | break;
960 | }
961 | }
962 |
963 |
964 | /*
965 | * Disassemble instruction with primary opcode = 59 (A-Form)
966 | */
967 |
968 | static void disass59(char* f, unsigned int adr, unsigned int w)
969 | {
970 | switch (exop & 0x1f) {
971 | case 18: aform_dab("fdivs"); break;
972 | case 20: aform_dab("fsubs"); break;
973 | case 21: aform_dab("fadds"); break;
974 | case 22: aform_db("fsqrts"); break;
975 | case 24: aform_db("fres"); break;
976 | case 25: aform_dac("fmuls"); break;
977 | case 28: aform_dacb("fmsubs"); break;
978 | case 29: aform_dacb("fmadds"); break;
979 | case 30: aform_dacb("fnmsubs"); break;
980 | case 31: aform_dacb("fnmadds"); break;
981 |
982 | default:
983 | sprintf(f, "?\n");
984 | break;
985 | }
986 | }
987 |
988 |
989 | /*
990 | * Disassemble instruction with primary opcode = 63 (A-Form/X-Form/XFL-Form)
991 | */
992 |
993 | static void disass63(char* f, unsigned int adr, unsigned int w)
994 | {
995 | if (exop & 0x10)
996 | switch (exop & 0x1f) {
997 | case 18: aform_dab("fdiv"); break;
998 | case 20: aform_dab("fsub"); break;
999 | case 21: aform_dab("fadd"); break;
1000 | case 22: aform_db("fsqrt"); break;
1001 | case 23: aform_dacb("fsel"); break;
1002 | case 25: aform_dac("fmul"); break;
1003 | case 26: aform_db("frsqrte"); break;
1004 | case 28: aform_dacb("fmsub"); break;
1005 | case 29: aform_dacb("fmadd"); break;
1006 | case 30: aform_dacb("fnmsub"); break;
1007 | case 31: aform_dacb("fnmadd"); break;
1008 |
1009 | default:
1010 | sprintf(f, "?\n");
1011 | break;
1012 | }
1013 | else
1014 | switch (exop) {
1015 | case 0: xform_fcrab("fcmpu"); break;
1016 | case 12: xform_fdb("frsp"); break;
1017 | case 14: xform_fdb("fctiw"); break;
1018 | case 15: xform_fdb("fctiwz"); break;
1019 | case 32: xform_fcrab("fcmpo"); break;
1020 | case 38: xform_crb("mtfsb1"); break;
1021 | case 40: xform_fdb("fneg"); break;
1022 | case 64: xform_crcr("mcrfs"); break;
1023 | case 70: xform_crb("mtfsb0"); break;
1024 | case 72: xform_fdb("fmr"); break;
1025 | case 134: xform_cri("mtfsfi"); break;
1026 | case 136: xform_fdb("fnabs"); break;
1027 | case 264: xform_fdb("fabs"); break;
1028 | case 583: xform_fd("mffs"); break;
1029 | case 711: xflform("mtfsf"); break;
1030 | case 814: xform_fdb("fctid"); break; // 64 bit
1031 | case 815: xform_fdb("fctidz"); break; // 64 bit
1032 | case 846: xform_fdb("fcfid"); break; // 64 bit
1033 |
1034 | default:
1035 | sprintf(f, "?\n");
1036 | break;
1037 | }
1038 | }
1039 |
1040 |
1041 | /*
1042 | * Convert mask begin/end to mask
1043 | */
1044 |
1045 | static unsigned int mbme2mask(int mb, int me)
1046 | {
1047 | unsigned int m = 0;
1048 | int i;
1049 |
1050 | if (mb <= me)
1051 | for (i=mb; i<=me; i++)
1052 | m |= 1 << (31-i);
1053 | else {
1054 | for (i=0; i<=me; i++)
1055 | m |= 1 << (31-i);
1056 | for (i=mb; i<=31; i++)
1057 | m |= 1 << (31-i);
1058 | }
1059 | return m;
1060 | }
1061 |
1062 |
1063 | /*
1064 | * Convert SPR number to register name
1065 | */
1066 |
1067 | char *get_spr(int reg)
1068 | {
1069 | switch (reg) {
1070 | case 1: return "xer";
1071 | case 8: return "lr";
1072 | case 9: return "ctr";
1073 | case 18: return "dsisr";
1074 | case 19: return "dar";
1075 | case 22: return "dec";
1076 | case 25: return "sdr1";
1077 | case 26: return "srr0";
1078 | case 27: return "srr1";
1079 | case 272: return "sprg0";
1080 | case 273: return "sprg1";
1081 | case 274: return "sprg2";
1082 | case 275: return "sprg3";
1083 | case 280: return "asr"; // 64 bit
1084 | case 282: return "ear";
1085 | case 284: return "tbl";
1086 | case 285: return "tbu";
1087 | case 287: return "pvr";
1088 | case 528: return "ibat0u";
1089 | case 529: return "ibat0l";
1090 | case 530: return "ibat1u";
1091 | case 531: return "ibat1l";
1092 | case 532: return "ibat2u";
1093 | case 533: return "ibat2l";
1094 | case 534: return "ibat3u";
1095 | case 535: return "ibat3l";
1096 | case 536: return "dbat0u";
1097 | case 537: return "dbat0l";
1098 | case 538: return "dbat1u";
1099 | case 539: return "dbat1l";
1100 | case 540: return "dbat2u";
1101 | case 541: return "dbat2l";
1102 | case 542: return "dbat3u";
1103 | case 543: return "dbat3l";
1104 | case 1013: return "dabr";
1105 |
1106 | case 0: return "mq"; // 601
1107 | case 4: return "rtcu"; // 601
1108 | case 5: return "rtcl"; // 601
1109 | case 20: return "rtcu"; // 601
1110 | case 21: return "rtcl"; // 601
1111 | case 952: return "mmcr0"; // 604
1112 | case 953: return "pmc1"; // 604
1113 | case 954: return "pmc2"; // 604
1114 | case 955: return "sia"; // 604
1115 | case 956: return "mmcr1"; // 604e
1116 | case 957: return "pmc3"; // 604e
1117 | case 958: return "pmc4"; // 604e
1118 | case 959: return "sda"; // 604
1119 | case 976: return "dmiss"; // 603
1120 | case 977: return "dcmp"; // 603
1121 | case 978: return "hash1"; // 603
1122 | case 979: return "hash2"; // 603
1123 | case 980: return "imiss"; // 603
1124 | case 981: return "icmp"; // 603
1125 | case 982: return "rpa"; // 603
1126 | case 1008: return "hid0"; // 601/603/604
1127 | case 1009: return "hid1"; // 601/603/604e
1128 | case 1010: return "iabr"; // 601/603
1129 | case 1023: return "pir"; // 601/604
1130 |
1131 | case 256: return "vrsave"; // AltiVec
1132 |
1133 | default: return NULL;
1134 | }
1135 | }
1136 |
1137 |
--------------------------------------------------------------------------------