[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Pgubook-readers] Pgubook-readers Digest, Vol 51, Issue 1
From: |
Mike Eichler |
Subject: |
Re: [Pgubook-readers] Pgubook-readers Digest, Vol 51, Issue 1 |
Date: |
Sat, 7 Nov 2015 23:10:54 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
That's very strange, I copied and pasted your program, assembled it
and linked it and when i did 'echo $?' the result was 62.
On 07/11/15 17:00, address@hidden wrote:
> Send Pgubook-readers mailing list submissions to
> address@hidden
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://lists.nongnu.org/mailman/listinfo/pgubook-readers or, via
> email, send a message with subject or body 'help' to
> address@hidden
>
> You can reach the person managing the list at
> address@hidden
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Pgubook-readers digest..."
>
>
> Today's Topics:
>
> 1. ending-address using base pointer addressing mode (William
> Rodrigues) 2. Re: ending-address using base pointer addressing
> mode (Roger)
>
>
> ----------------------------------------------------------------------
>
>
>
Message: 1 Date: Fri, 6 Nov 2015 21:36:56 -0200 From: William
> Rodrigues <address@hidden> To: address@hidden
> Subject: [Pgubook-readers] ending-address using base pointer
> addressing mode Message-ID:
> <address@hidden>
>
>
>
Content-Type: text/plain; charset="utf-8"
>
> Hi everyone, I'm William from Brazil; this is my first
> participation on here. I am reading the 4th chapter from pgubook,
> but at one exercise of the third I'm at some difficulty. The text
> says to modify the maximum.s code and use an ending address rather
> than the number 0 to know when to stop.
>
> I tried this,
>
> .section .data
>
> data_items: .long 3,62,14,20,35,49,74,55,0
>
> .section .text .globl _start _start: movl $data_items, %ecx #
> initialize %ecx with the address of data_items movl 4(%ecx), %ebx #
> go to base pointer addressing mode, trying to get the value 62.
> movl $1, %eax int $0x80
>
> If %ecx has the (pointer) address of data_items. So, why the
> return value was 0 instead of 62 or 35?
>
> Thanks. -------------- next part -------------- An HTML attachment
> was scrubbed... URL:
> <http://lists.nongnu.org/archive/html/pgubook-readers/attachments/20151106/3ff1ff36/attachment.html>
>
>
>
------------------------------
>
> Message: 2 Date: Fri, 6 Nov 2015 21:53:07 -0500 From: Roger
> <address@hidden> To: address@hidden Subject:
> Re: [Pgubook-readers] ending-address using base pointer addressing
> mode Message-ID: <address@hidden>
> Content-Type: text/plain; charset=us-ascii
>
>> On Fri, Nov 06, 2015 at 09:36:56PM -0200, William Rodrigues
>> wrote: Hi everyone, I'm William from Brazil; this is my first
>> participation on here. I am reading the 4th chapter from
>> pgubook, but at one exercise of the third I'm at some difficulty.
>> The text says to modify the maximum.s code and use an ending
>> address rather than the number 0 to know when to stop.
>>
>> I tried this, **.section .data
>>
>> data_items: ** .long 3,62,14,20,35,49,74,55,0
>>
>> **.section .text **.globl _start _start: ** movl $data_items,
>> %ecx******** # initialize %ecx with the address of data_items **
>> movl 4(%ecx), %ebx******************** # go to base pointer
>> addressing mode, trying to get the value 62. ** movl $1, %eax **
>> int $0x80
>>
>> If %ecx has the (pointer) address of data_items. So, why the
>> return value was 0 instead of 62 or 35? Thanks.
>
> If I'm not mistaken, there are some minor mistakes within the
> book, or code sections. Typos I think. You can either trace the
> code to find the error (as I did when I first read the book a
> decade ago), or search using Google to find the specific errors
> mentioned by others.
>
> It is possible somebody has already compiled an errata listing by
> now for this book!
>
> Still, it is a great book, or great read, and you will not regret
> reading, nor doing/performing each of the exercises as I have. Most
> programmers take little time to understand how using their C/C++
> routines use or effect the CPU. On the flip, these programmers
> publish code by the handful on a daily basis.
>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Pgubook-readers] Pgubook-readers Digest, Vol 51, Issue 1,
Mike Eichler <=