Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22055

Problem with method call, especially calling Assembly From C

$
0
0

I'm trying to write a small OS, but am having a problem when I call my assembly function from C.

[BITS 16]extern initcall   initmov    SI, msgcall   printstrcall   printstrjmp    $global printstrprintstr: mov    AL, [SI] inc    SI cmp    AL, 0 je     end call   printchar jmp    printstrprintchar: mov    BL, 10 mov    AH, 0x0E;Opcode ein Zeichen auszugeben mov    BH, 0x00;Seite int    0x10 retend: retmsg     db 'bla', 0

void init is definitely called because when I create an endless while loop into my void init, my "bla" message won't be send.

If I call printstr method twice in my assembly code, the output changes and it does not depend on the cursor.

The problem is now, when I try to call printstr from my C method, nothing happens, not even the message I send with my assembly code after init is called.

extern printstr();void init() {  printstr();}

As soon as I try to call the printstr function from C nothing works.

The assembly program was compiled with NASM on Linux and the C part with GCC and the output format is elf32-i386.

I hope anybody can help me.


Viewing all articles
Browse latest Browse all 22055

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>