LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-06-2010, 11:32 AM   #76
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443

Original Poster
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723

That worked, now it is at the formattion stage and it is stuck at 33% with no progress for a long time, the hard drive is very active, and the CPU usage is very low. Also Debian did not let me make the partition scheme the way I want it.

I am worried that there is something wrong.

EDIT: added screenshot
Attached Thumbnails
Click image for larger version

Name:	qemu-formatting.jpg
Views:	12
Size:	67.4 KB
ID:	2924  

Last edited by MTK358; 03-06-2010 at 11:38 AM.
 
Old 03-06-2010, 11:47 AM   #77
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
I saw the same effect. Patience.
--- rod.
 
Old 03-06-2010, 12:22 PM   #78
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443

Original Poster
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
It finally started working.

It's installing packages now.
 
Old 03-06-2010, 12:58 PM   #79
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by MTK358 View Post
Same error.

Please explain to me why I can't just use the ARM install CD?
Because nobody has prepared it for you.

Have you tried to choose 'Cancel' ?
 
Old 03-06-2010, 01:14 PM   #80
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443

Original Poster
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
What do you mean?

Also, in the article, I saw this:

"Debian currently does not support the ARM Versatile platform; the support will be added post-Etch"

But it already is post-Etch!
 
Old 03-06-2010, 02:05 PM   #81
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443

Original Poster
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
Another error!!!

While installing software part of installation, it came up with an error that it failed to install something. The only choice was to hit Continue, this is what happened: (See attachment)

P.S. If there only was an ARM port of Arch Linux...
Attached Thumbnails
Click image for larger version

Name:	qemu-debian-arm-error.jpg
Views:	12
Size:	147.1 KB
ID:	2926  

Last edited by MTK358; 03-06-2010 at 02:07 PM.
 
Old 03-06-2010, 04:15 PM   #82
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339

Rep: Reputation: 231Reputation: 231Reputation: 231
I found ubuntu for ARM:http://www.ubuntu.com/products/whatisubuntu/arm
 
Old 03-06-2010, 04:36 PM   #83
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by MTK358 View Post
Another error!!!

While installing software part of installation, it came up with an error that it failed to install something. The only choice was to hit Continue, this is what happened: (See attachment)

P.S. If there only was an ARM port of Arch Linux...
That might be a QEMU (I/O) problem. I think I used pretty ancient QEMU - like 0.9.8.

...

Maybe it's a true error of your host disk I/O ? Do you see anything related to disk I/O in /var/log/messages ?

And, by the way, you do not need QEMU in a separate window, for your tasks QEMU in a console might be more convenient.
 
Old 03-06-2010, 05:06 PM   #84
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443

Original Poster
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
Quote:
Originally Posted by smeezekitty View Post
That seems nice. So can I just download the cd and add the option "-cdrom *ubuntu*.iso" to qemu?
 
Old 03-06-2010, 05:14 PM   #85
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by MTK358 View Post
That seems nice. So can I just download the cd and add the option "-cdrom *ubuntu*.iso" to qemu?
Can you positively confirm that QEMU provides you with

Quote:
For Ubuntu 9.10 , the two platforms we support are:

* Freescale i.MX51 Babbage boards (2.x boards are supported and 3.0 boards are untested but expected to mostly work)
* Marvell Dove boards (Y0 and Y1 boards)
?
 
Old 03-06-2010, 05:21 PM   #86
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443

Original Poster
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
So it will only run on those?
 
Old 03-06-2010, 07:21 PM   #87
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by MTK358 View Post
So it will only run on those?
I first give documentation benefit of the doubt. I.e. why try unless you can confirm ?
 
Old 03-06-2010, 08:08 PM   #88
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Quote:
Originally Posted by MTK358 View Post
Another error!!!

While installing software part of installation, it came up with an error that it failed to install something. The only choice was to hit Continue, this is what happened: (See attachment)
I just installed the QEMU-ARM system, and it took me a three tries before it worked. My feeling is that there are network errors that don't normally happen outside the emulator, as I had a few packages that it couldn't download. I said 'Continue', hoping it wouldn't matter, but evidently, it did matter. Perhaps persistence is the solution.

--- rod.
 
Old 03-06-2010, 08:38 PM   #89
ghostdog74
Senior Member
 
Registered: Aug 2006
Posts: 2,697
Blog Entries: 5

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally Posted by MTK358 View Post
I wanted to try learning Assembler
I have just one question for you. what is your goal in the end?
 
Old 03-07-2010, 11:02 AM   #90
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
In case the OP, or anyone reading this thread later, wants to see the same function (raise an integer to an integer power) as an example in the way I suggest learning asm (64 bit and mixing C and asm) here is that code:

You can compile the C and asm together with
gcc test.c foo.s
then run the result with
./a.out

The C function test.c just calls the asm function:
Code:
void foo(unsigned int a, unsigned int b);
int main(int argc, char**argv)
{
   foo(3, 30);
   return 0;
}
The asm function foo.s computes the 64 bit unsigned long of a to the power b, where a and b are 32 bit unsigned values. Then it calls printf to display the result.
Code:
        .section .rodata
message:
        .string "%d ** %d = %ld\n"
        .text
.globl foo
# on entry
#    rdi = base
#    rsi = exponent
foo:
        pushq   %rbp
        movq    %rsp, %rbp
        movl    $1, %ecx       # Same behavior as movq $1,%rcx
        movl    %esi, %edx     # Save Exponent for printf
        testl   %esi, %esi
        jz      2f             # Skip the loop if exponent is zero
1:      imulq   %rdi, %rcx     # rcx *= rdi
        decl    %esi
        jne     1b
2:                             # rcx already has fourth parameter for printf
                               # rdx already has third parameter for printf
        movl    %edi, %esi     # Second parameter for printf
        movq    $message, %rdi # First parameter for printf
        xorl    %eax, %eax     # rax = 0 # Number of SSE registers in parameter list
        call    printf
        leave
        ret
A few details that a beginner would need explained:

1) No parameters nor locals were on the stack. So the conventional pushq %rbp and movq %rsp, %rbp at the beginning balanced by leave at the end, serve little purpose. But we can't simply omit them with no other changes, because the ABI requires the stack to be 16 byte aligned before each call. The stack was 16 byte aligned when main called foo() but then is 8 bytes off of aligned because of the return address pushed. So we need to push an odd number of 8 byte objects before calling printf. The push of rbp at the beginning of each function is usually used as that odd item, so later pushes or stack allocations if any would be an even number of 8 byte items.

But a good asm programmer might notice the opportunity for a "function tail merge". When the last thing you do before returning is call a function, if the stack and register usage are compatible you can jump to the function instead of calling it and then returning. In 32 bit x86, function tail merge is rarely possible unless the signatures of the two functions are nearly identical. But the 64 bit ABI is more powerful, so the function tail merge is easy here even though only two parameters were passed to foo() while four are passed to printf(). So the easier version of foo.s is
Code:
        .section .rodata
message:
        .string "%d ** %d = %ld\n"
        .text
.globl foo
# on entry
#    rdi = base
#    rsi = exponent
foo:
        movl    $1, %ecx       # Same behavior as movq $1,%rcx
        movl    %esi, %edx     # Save Exponent for printf
        testl   %esi, %esi
        jz      2f             # Skip the loop if exponent is zero
1:      imulq   %rdi, %rcx     # rcx *= rdi
        decl    %esi
        jne     1b
2:                             # rcx already has fourth parameter for printf
                               # rdx already has third parameter for printf
        movl    %edi, %esi     # Second parameter for printf
        movl    $message, %edi # First parameter for printf
        xorl    %eax, %eax     # rax = 0 # Number of SSE registers in parameter list
        jmp     printf
2) Any time the destination of an instruction is one of the 32 bit general registers, the CPU will clear the high half of the 64 bit register. So in several places where I wanted a 32 bit unsigned value in a 64 bit register, I just moved or computed the 32 bit value into the 32 bit register (which is a shorter and sometimes faster instruction than moving or computing the 64 bit value) and relied on the upper half being cleared.

3) A good asm programmer plans ahead for register use. The ABI specifies the first six integer or pointer parameters go in registers rdi, rsi, rdx, rcx, r8, and r9. I needed to select a place to save the exponent (because the loop destroys the original exponent) and select a place to compute the result. Since those would be the third and fourth parameters in the call, I selected rdx and rcx.

4) The instruction movl $message, %edi treats the address message as a 32 bit unsigned quantity. But in x86_64, addresses are 64 bit. So this instruction only works right if the program is linked so that all its pre initialized read only data is in first 4GB of the address space. That is a safe assumption for ordinary user mode programs in Linux.

5) When calling any function, such as printf, that takes a variable parameter list, the ABI requires that the caller put in the AL register the number of parameters which have been passed in SSE registers. My function is not passing (nor even using) any SSE registers. So I need to put 0 in al before calling printf. The instruction xorl %eax, %eax clears all of rax and is generally the fastest way to clear part or all of rax. (al is the lowest byte of rax).

6) You should read the as documentation for the use of jump targets such as the 2f and 1b I used in this example. In this example they connect to the 2: and 1: labels.

Last edited by johnsfine; 03-07-2010 at 11:37 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ASM or C++? Hb_Kai Programming 16 01-20-2010 09:12 AM
Is ASM dangerous? MrCode Programming 37 11-18-2009 08:29 AM
ASM x32 vs ASM x64 Tegramon Programming 3 02-27-2008 02:26 PM
I/O in ASM Mercurius Programming 10 11-16-2006 07:02 PM
ASM question zWaR Programming 2 06-26-2004 11:42 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration