Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
soc:2008:stefanha:journal:start [2008/05/27 05:24] stefanha |
soc:2008:stefanha:journal:start [2008/08/08 05:25] (current) stefanha |
||
---|---|---|---|
Line 3: | Line 3: | ||
===== Journal ===== | ===== Journal ===== | ||
- | ==== Week 1 ==== | + | * [[.:week11#fri_8_aug|Latest entry]] |
- | **Milestone:** Set up IDT and write an interrupt handler. | + | * [[.:week11|Week 11]] |
- | + | * [[.:week10|Week 10]] | |
- | === Fri May 23 === | + | * [[.:week9|Week 9]] |
- | Some notes after chatting with mdc and mcb30: | + | * [[.:week8|Week 8]] |
- | * Place IDT code in ''arch/i386/transitions/librm.S'' - in similar places to ''lgdt'' and ''sgdt''. | + | * [[.:week7|Week 7]] |
- | * GDB stub should be written with portability in mind, separate out arch-specific parts. | + | * [[.:week6|Week 6]] |
- | * GDB stub should be a build option. | + | * [[.:week5|Week 5]] |
- | * Source-level debugging and symbols should work (mostly) out-of-the-box due to ELF build. | + | * [[.:week4|Week 4]] |
- | + | * [[.:week3|Week 3]] | |
- | === Sat May 24 === | + | * [[.:week2|Week 2]] |
- | Git commit: [[http://git.etherboot.org/?p=people/stefanha/gpxe.git;a=commit;h=ac29ad53aff6e89f12bd5a163861d1afb1846049|ac29ad53aff6e89f12bd5a163861d1afb1846049]] | + | * [[.:week1|Week 1]] |
- | + | ||
- | Implemented an interrupt handler in ''arch/i386/transitions/librm.S''. It currently sets ''eax'' to ''0xcafebabe'' and spins in an infinite loop. Have tested that it is working using QEMU. | + | |
- | + | ||
- | === Sun May 25 === | + | |
- | Git commits: [[http://git.etherboot.org/?p=people/stefanha/gpxe.git;a=commit;h=12144ffbfadef9c6597f9ac754685223bb736368|12144ffbfadef9c6597f9ac754685223bb736368]], [[http://git.etherboot.org/?p=people/stefanha/gpxe.git;a=commit;h=1ff72edaa0c68966e1bc102ae5167d714eeb03e6|1ff72edaa0c68966e1bc102ae5167d714eeb03e6]], [[http://git.etherboot.org/?p=people/stefanha/gpxe.git;a=commit;h=c15542a614961acc1051296fc2367d1539db57ff|c15542a614961acc1051296fc2367d1539db57ff]] | + | |
- | + | ||
- | When GDB reads or writes registers on x86, it wants a snapshot like this: ''EAX'', ''ECX'', ''EDX'', ''EBX'', ''ESP'', ''EBP'', ''ESI'', ''EDI'', ''EIP'', ''EFLAGS'', ''CS'', ''SS'', ''DS'', ''ES'', ''FS'', ''GS''. This snapshot is a blob that gets sent between the GDB stub and GDB. | + | |
- | + | ||
- | The interrupt handler now takes this register snapshot and passes it to the GDB stub. It also applies the register snapshot to the actual CPU state when the GDB stub returns. So if the GDB stub changes ''EAX'' in the register snapshot, then the ''EAX'' register will be changed when the interrupt handler returns. | + | |
- | + | ||
- | Each interrupt is mapped onto a POSIX signal number (e.g. ''SIGSEGV''). The GDB protocol communicates these numbers when reporting that execution was interrupted. | + | |
- | + | ||
- | === Mon May 26 === | + | |
- | Git commit: [[http://git.etherboot.org/?p=people/stefanha/gpxe.git;a=commit;h=f6c6b14468fffff0cf55df77ee7bb796113bcb4a|f6c6b14468fffff0cf55df77ee7bb796113bcb4a]], [[http://git.etherboot.org/?p=people/stefanha/gpxe.git;a=commit;h=6f8c3b03af1fa4733958a0ad66496a0acc8ce882|6f8c3b03af1fa4733958a0ad66496a0acc8ce882]] | + | |
- | + | ||
- | Asked mcb30 for feedback on the code so far. The latest git commit includes his suggested clean ups and simplifications. | + | |
- | + | ||
- | The interrupt handler calls ''gdbstub_handler(regs)'', where ''regs'' is a pointer to the register snapshot. The GDB stub may change the values in the register snapshot. When the interrupt handler exits, it applies the snapshot to the CPU state. **Changing ''ESP'' is currently not supported**, since it is more difficult to implement and we do not anticipate it ever being changed. | + | |
- | + | ||
- | === Tue May 27 === | + | |
- | Did some serious hacking this morning. The GDB stub now gets far enough for read-only operation to work! See for yourself: | + | |
- | + | ||
- | {{:soc:2008:stefanha:journal:gdbstub.png|Early version of the GDB stub in action.}} | + | |
- | + | ||
- | Symbol resolution seems to work already. I did a manual ''make bin/gpxe.hd.tmp'' and loaded it into GDB with ''file bin/gpxe.hd.tmp''. | + | |
- | + | ||
- | The stub currently uses the serial driver directly. I need to design a clean GDB transport interface. | + | |
- | + | ||
- | No git commit just yet because I want to clean up the code first. | + | |
- | + | ||
- | Next steps: | + | |
- | * Isolate the interrupt handling code from the rest of ''librm.S'' to avoid code size penalty in non-GDB builds. | + | |
- | * Design a GDB protocol transport interface that serial and UDP can implement. Discuss with mentors. | + |