pgubook-readers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pgubook-readers] A strange problem in Chapter 6


From: Alexander Kapshuk
Subject: [Pgubook-readers] A strange problem in Chapter 6
Date: Mon, 30 Dec 2013 14:55:22 +0200

Nor sure is this is still relevant, but I saw your post that was dated
August 2013, and as I saw that it'd got no responses, I thought I'd
try and help.

The only thing I did notice that was different between the code for
the function in question as shown in the book and your version, shown
below, is this line:  .byte 0x0A. The book uses, .ascii "\n"
[http://savannah-nongnu-org.ip-connect.vn.ua//pgubook/ProgrammingGroundUp-1-0-booksize.pdf],
page 107. Hope this helps.

 .section data
newline:
 .byte 0x0A

 .section .text
 .globl _start
#.type  write_newline, @function

_start:

#       pushl   %ebp                            # Back-up old base pointer
#       movl    %esp, %ebp                      # Copy stack pointer to %ebp

        movl    $4, %eax                        # Set syscall to write
        movl    $1, %ebx                        # Set FD according to arg1
                                                # (Not. For testing purpuses, 1
                                                # is hardcoded in.)
        movl    $newline, %ecx                  # Set buffer to NEWLINE
        movl    $1, %edx                        # Set length to 1
        int     $0x80                           # Do write

#       movl    %ebp, %esp                      # Restore stack pointer
#       popl    %ebp                            # Restore base pointer
#       ret                                     # Return control to caller

        movl    $1, %eax
        movl    $0, %ebx
        int     $0x80



reply via email to

[Prev in Thread] Current Thread [Next in Thread]