Compare commits
No commits in common. "21565a97268a1ee8cc50c0e858203c83b5fffd39" and "8a58251ef6653fd4349d576671a84712ca60f99d" have entirely different histories.
21565a9726
...
8a58251ef6
|
@ -57,16 +57,19 @@ pub fn parse(self: *Self, allocator: Allocator, emu: Emulator) !String {
|
||||||
return .{ .alloc = try std.fmt.allocPrint(allocator, "T{x:0>2}thread:1;", .{@enumToInt(ret)}) };
|
return .{ .alloc = try std.fmt.allocPrint(allocator, "T{x:0>2}thread:1;", .{@enumToInt(ret)}) };
|
||||||
},
|
},
|
||||||
'g' => {
|
'g' => {
|
||||||
|
// TODO: Actually reference GBA Registers
|
||||||
const r = emu.registers();
|
const r = emu.registers();
|
||||||
const cpsr = emu.cpsr();
|
const cpsr = emu.cpsr();
|
||||||
|
|
||||||
const reg_len = @sizeOf(u32) * 2; // Every byte is represented by 2 characters
|
const char_len = 2;
|
||||||
|
const reg_len = @sizeOf(u32) * char_len; // Every byte is represented by 2 characters
|
||||||
|
|
||||||
const ret = try allocator.alloc(u8, r.len * reg_len + reg_len); // r0 -> r15 + CPSR
|
const ret = try allocator.alloc(u8, r.len * reg_len + reg_len); // r0 -> r15 + CPSR
|
||||||
|
|
||||||
{
|
{
|
||||||
var i: u32 = 0;
|
var i: u32 = 0;
|
||||||
while (i < r.len + 1) : (i += 1) {
|
while (i < r.len + 1) : (i += 1) {
|
||||||
const reg: u32 = @byteSwap(if (i < r.len) r[i] else cpsr); // Seems like GDB expects this
|
const reg: u32 = if (i < r.len) r[i] else cpsr;
|
||||||
|
|
||||||
// bufPrintIntToSlice writes to the provided slice, which is all we want from this
|
// bufPrintIntToSlice writes to the provided slice, which is all we want from this
|
||||||
// consequentially, we ignore the slice it returns since it just references the slice
|
// consequentially, we ignore the slice it returns since it just references the slice
|
||||||
|
@ -107,10 +110,6 @@ pub fn parse(self: *Self, allocator: Allocator, emu: Emulator) !String {
|
||||||
's' => @panic("TODO: Step"),
|
's' => @panic("TODO: Step"),
|
||||||
|
|
||||||
// Optional
|
// Optional
|
||||||
'D' => {
|
|
||||||
log.info("Disconneccting...", .{});
|
|
||||||
return .{ .static = "OK" };
|
|
||||||
},
|
|
||||||
'H' => {
|
'H' => {
|
||||||
log.warn("{s}", .{self.contents});
|
log.warn("{s}", .{self.contents});
|
||||||
|
|
||||||
|
@ -185,8 +184,6 @@ pub fn parse(self: *Self, allocator: Allocator, emu: Emulator) !String {
|
||||||
const offset_str = tokens.next() orelse return .{ .static = "E9999" };
|
const offset_str = tokens.next() orelse return .{ .static = "E9999" };
|
||||||
const length_str = tokens.next() orelse return .{ .static = "E9999" };
|
const length_str = tokens.next() orelse return .{ .static = "E9999" };
|
||||||
|
|
||||||
log.info("Providing GBA memory map", .{});
|
|
||||||
|
|
||||||
const offset = try std.fmt.parseInt(usize, offset_str, 16);
|
const offset = try std.fmt.parseInt(usize, offset_str, 16);
|
||||||
const length = try std.fmt.parseInt(usize, length_str, 16);
|
const length = try std.fmt.parseInt(usize, length_str, 16);
|
||||||
|
|
||||||
|
|
|
@ -39,18 +39,23 @@ pub const target: []const u8 =
|
||||||
// Game Pak SRAM isn't included
|
// Game Pak SRAM isn't included
|
||||||
// TODO: Can i be more specific here?
|
// TODO: Can i be more specific here?
|
||||||
pub const memory_map: []const u8 =
|
pub const memory_map: []const u8 =
|
||||||
\\ <memory-map version="1.0">
|
\\ <?xml version="1.0"?>
|
||||||
\\ <memory type="rom" start="0x00000000" length="0x00004000"/>
|
\\ <!DOCTYPE memory-map
|
||||||
\\ <memory type="ram" start="0x02000000" length="0x00040000"/>
|
\\ PUBLIC "+//IDN gnu.org//DTD GDB Memory Map V1.0//EN"
|
||||||
\\ <memory type="ram" start="0x03000000" length="0x00008000"/>
|
\\ "http://sourceware.org/gdb/gdb-memory-map.dtd">
|
||||||
\\ <memory type="ram" start="0x04000000" length="0x00000400"/>
|
\\
|
||||||
\\ <memory type="ram" start="0x05000000" length="0x00000400"/>
|
\\ <memory-map>
|
||||||
\\ <memory type="ram" start="0x06000000" length="0x00018000"/>
|
\\ <memory type="rom" start="0" length="4000">
|
||||||
\\ <memory type="ram" start="0x07000000" length="0x00000400"/>
|
\\ <memory type="ram" start="2000000" length="40000">
|
||||||
\\ <memory type="rom" start="0x08000000" length="0x02000000"/>
|
\\ <memory type="ram" start="3000000" length="8000">
|
||||||
\\ <memory type="rom" start="0x0A000000" length="0x02000000"/>
|
\\ <memory type="ram" start="4000000" length="400">
|
||||||
\\ <memory type="rom" start="0x0C000000" length="0x02000000"/>
|
\\ <memory type="ram" start="5000000" length="400">
|
||||||
\\ </memory-map>
|
\\ <memory type="ram" start="6000000" length="18000">
|
||||||
|
\\ <memory type="ram" start="7000000" length="400">
|
||||||
|
\\ <memory type="rom" start="8000000" length="20000000">
|
||||||
|
\\ <memory type="rom" start="A000000" length="20000000">
|
||||||
|
\\ <memory type="rom" start="C000000" length="20000000">
|
||||||
|
\\ </memory-map>;
|
||||||
;
|
;
|
||||||
|
|
||||||
// FIXME: Shouldn't this be a Packet Struct?
|
// FIXME: Shouldn't this be a Packet Struct?
|
||||||
|
|
Loading…
Reference in New Issue