`
DavidL
  • 浏览: 8012 次
  • 性别: Icon_minigender_1
  • 来自: 广州
最近访客 更多访客>>
文章分类
社区版块
存档分类
最新评论

Cleanups Done

阅读更多
Clean up two old blogs, which was edited in opera (the edit box was so small). In firefox, I can review these blogs easily, and some clean up done.

NASM 0.99.01 was buggy for the 32bit/16bit codegen. When an instruction which access register and mem, it would be generated with 0x67 prefix for a 16bit segment. This blocks the elf2 bootsect, which has size limitation, extra 0x67 makes the code bloated, so the compilation breaks.
I did a quick hack, and posted the new compiled binary to the ReactOS Build Environment maintainer. Also I filed it as a bug, though the nasm64developer told me that this couldn't be reproduced in 0.99.02 CVS snapshot. O_O , after a try , yes, it's already fixed. ;) so my hacking over nasm is useless.

Though another thing interesting is spotted about GDB. GDB itself is a nice debugger. But...

c 代码
 
  1. #include "stdio.h"  
  2. void __stdcall call()  
  3. {  
  4.     printf("hello!");  
  5. }  
  6. void main()  
  7. {  
  8.     call();  
  9. }  

when you try to
gdb下调试
  1. b call  
gdb fails.

This is the reason why gdb couldn't get all symbols work in Kernel Debugging.

Remarks:
__stdcall __fastcall are calling convention in Windows, they both add @ to the mangled name, seems like gdb fail to deal with mangle name with '@'

mangle name(link time symbol):
c mangle convention: underscore prefix, so every C symbols in asm would be prefixed with an underscore.
so a typical link with ASM files would be
test.c
c 代码
 
  1. extern int myasmSymbol;    
  2. int main()    
  3. {    
  4.       return myasmSymbol;    
  5. }    
myasm.S
asm 代码
 
  1. .text  
  2. .global _myasmSymbol  
  3. _myasmSymbol: .int 0   


gcc -c myasm.S
gcc -c test.c

gcc test.o myasm.o -o test.exe






分享到:
评论

相关推荐

    mutex-debug.rar_floating

    Fixed the detection of infinite floating point values on IRIX (and possibly other systems) and applied another few minor cleanups.

    H.264 参考软件JM16.1 VC++7.0/8.0/9.0

    - encoder/decoder: Various cleanups/bugfixes (AT) - encoder/decoder: Deblocking speedups (AT) - encoder/decoder: add version information command line switches (KS) - encoder: NAL unit priority bug ...

    PIC32Lua:用于 Microchip PIC32 处理器的 Lua

    - FIX: some cleanups in asIO.c (stdio, stderr, io.write, ...) V0.1b - NEW: binary number representation with, e.g.: '0b001110' - NEW: timer tick-time variable (100ns, by default) in "pic.TIMERTICK" ...

    ak2新版内核AKAIO1.5

    ak2新版内核 AceKard All-In-One (AK-AIO) v1.5 ---------------------------------- Credits ------- AKAIO: ...Based off of AKBBS' source contributions from the above and following authors: ...

    Sakemail

    ).- Added the property FileStream to the class TAtachedFile and the procedure SaveToStream, this was done by Brian Sheperd- The address separator (in the TO: field) is ‘,‘ and ‘;‘ now (before it ...

    测试库

    3. 假设(Assumptions)和设置/清理(Setups/Cleanups):测试前的准备工作和测试后的清理工作,确保测试环境的一致性。 4. 断言(Assertions):检查预期结果与实际结果是否相符,用于确定测试是否通过。 5. 固定的...

    opensc-0.12.0.tar.gz

    NEWS for OpenSC -- History of user visible changes Complete change history is available online: ... New in 0.12.0; 2010-12-22 * OpenSC uses a single reader driver, specified at compile time. ...

    DebuggingWithGDB 6.8-2008

    Table of Contents Summary of gdb . . . . . . . . ....Free Software ....Free Software Needs Free Documentation ....Contributors to gdb....1 A Sample gdb Session ....2 Getting In and Out of gdb ....2.1 Invoking gdb ....

    python3.6.5参考手册 chm

    Code Cleanups Porting to Python 3.4 Changes in ‘python’ Command Behavior Changes in the Python API Changes in the C API Changed in 3.4.3 PEP 476: Enabling certificate verification by default for...

    C++标准库(第二版)英文版.pdf

    3.1.1 Important MinorSyntax Cleanups . . . . . . . . . . . . . . . . . . . . . 13 3.1.2 AutomaticType Deductionwith auto . . . . . . . . . . . . . . . . . . . 14 3.1.3 UniformInitialization and ...

Global site tag (gtag.js) - Google Analytics