Sunday, 15 August 2010

c++ - Write and test sub func -


I am trying to write subfunction for nachOS, but when I add it it does not work.

Cause not know details: Add ../userprog/syscall.h to:

  define # SC_Sub 11 int (int a, int b);  ../ test /  

  .globl sub in  

Sub sub: addiu $ 2, $ 0, SC_Sub syscall j $ 31 .end sub

Then I write a sub-quote:

  # Include "syscall.h" int main () {int results; Result = sub (100,99); Halt (); }  

In exception.cc: I try to catch exception:

  case SC_Sub: op1 = machine-> ReadRegister (4); Op2 = Machine-> ReadRegister (5); Results = op1 - op2; Printf ("OP1:% d \ n", OP1); Printf ("op2:% d \ n", op2); Printf ("result:% d \ n", result); Machine & gt; WriteRegister (2, results); Machine & gt; WriteRegister (PCReg, Machine> ReadRegister (PCReg) 4); break;  

I go to / code / gmake all and I have an error: (

 . /../../gnu-decstation-ultrix/decstation-ultrix/2.95.3/gcc-B../../ gnu-decstation-ultrix / -t script-n sub-oo-sub ../ ./../gnu-decstation-ultrix/decstation-ultrix/2.95.3/ld: crt0.o can not open: [1] by making such a file or directory: *** [sub] error 1 create [1]: excluding directory `/home/nxqd/Desktop/nachos-3.4/code/test 'gmake: *** [All] Error 2  

This dance folder It does not have a "bug" sub-funk included.

  P: //www.mediafire.com/? G3mnjxz4wdc Enter the code here  

hmm Well, I do not know anything from Nachos, but I have developed some OS.

can not open crt0 .o: No such file or directory

Are you sending the right linker command? Let's look at your linker script.

I believe that you have a MISS cross compiler Have you configured it to use a standard library if there is no standard library, have you configured it to use the default CRT0?

Note that crt0 is a "bootstrap" object in it's __ main which is the first thing executed by OS. This bootstrap object then parses command line arguments and other initialized objects and then calls your main function. I'm sure how much stuff is available in NachOS, but you can also create your own CRT0 and link to it as a startup image with the script (can not remember the exact name)


No comments:

Post a Comment