This is my test program: #define NUM 32 int i; int main() { int j; int aaNUM/4; aa0 = i; for (j=0; j<NUM/4-1; ++j) aaj+1 = aaj%10; j = aaNUM/4-1; return j; }
I compile it using "or32-elf-gcc.exe -O2 -o try.s -S try.c". The problem is: 00000000 <main>: 0: 18 60 00 00 l.movhi r3,0x0 4: d7 e1 17 f4 l.sw 0xfffffff4(r1),r2 8: d7 e1 77 f8 l.sw 0xfffffff8(r1),r14 c: d7 e1 4f fc l.sw 0xfffffffc(r1),r9 10: a8 63 21 b0 l.ori r3,r3,0x21b0 14: 9c 21 ff d4 l.addi r1,r1,0xffffffd4 <== r2, r14, r9's values stored in stack will be modified, if an interrupt occurs before this instruction. 18: 84 63 00 00 l.lwz r3,0x0(r3) 1c: 9c 41 00 04 l.addi r2,r1,0x4 20: 9d c1 00 20 l.addi r14,r1,0x20 24: 04 00 00 0d l.jal 58 <__modsi3> 28: 9c 80 00 0a l.addi r4,r0,0xa 2c: d4 02 58 00 l.sw 0x0(r2),r11 30: 9c 42 00 04 l.addi r2,r2,0x4 34: e4 22 70 00 l.sfne r2,r14 38: 13 ff ff fb l.bf 24 <main+0x24> 3c: a8 6b 00 00 l.ori r3,r11,0x0 40: 85 61 00 1c l.lwz r11,0x1c(r1) 44: 9c 21 00 2c l.addi r1,r1,0x2c <== The values will be modified too, if an interrupt occurs after this instruction. 48: 85 21 ff fc l.lwz r9,0xfffffffc(r1) 4c: 84 41 ff f4 l.lwz r2,0xfffffff4(r1) 50: 44 00 48 00 l.jr r9 54: 85 c1 ff f8 l.lwz r14,0xfffffff8(r1)
And I compile it using "or32-elf-gcc.exe -O2 -mno-logue -o try.s -S try.c". Then it has another problem: 00000000 <main>: 0: 9c 21 ff d4 l.addi r1,r1,0xffffffd4 4: d4 01 48 00 l.sw 0x0(r1),r9 \ 8: d4 01 10 04 l.sw 0x4(r1),r2 |==> r9?r2?r14 are saved with the offsets of 0, 4, and 8 c: d4 01 70 08 l.sw 0x8(r1),r14 / 10: 18 60 00 00 l.movhi r3,0x0 14: 9c 41 00 04 l.addi r2,r1,0x4 <== Array aa uses offset 0 too. (And 4 is the offset of aa1) 18: a8 63 21 b0 l.ori r3,r3,0x21b0 1c: 9d c1 00 20 l.addi r14,r1,0x20 20: 84 63 00 00 l.lwz r3,0x0(r3) 24: 04 00 00 0d l.jal 58 <__modsi3> 28: 9c 80 00 0a l.addi r4,r0,0xa 2c: d4 02 58 00 l.sw 0x0(r2),r11 <== This instruction will modify values of r2 and r14 30: 9c 42 00 04 l.addi r2,r2,0x4 34: e4 22 70 00 l.sfne r2,r14 38: 13 ff ff fb l.bf 24 <main+0x24> 3c: a8 6b 00 00 l.ori r3,r11,0x0 40: 85 61 00 1c l.lwz r11,0x1c(r1) 44: 85 21 00 00 l.lwz r9,0x0(r1) 48: 84 41 00 04 l.lwz r2,0x4(r1) 4c: 85 c1 00 08 l.lwz r14,0x8(r1) 50: 44 00 48 00 l.jr r9 54: 9c 21 00 2c l.addi r1,r1,0x2c
So, we can't use the option -mno-logue. We can't use -mlogue too, when interrupt system is necessary.
What happen to newline? Try one more time:
This is my test program: #define NUM 32 int i; int main() { int j; int aaNUM/4; aa0 = i; for (j=0; j<NUM/4-1; ++j) aaj+1 = aaj%10; j = aaNUM/4-1; return j; }
I compile it using "or32-elf-gcc.exe -O2 -o try.s -S try.c". The problem is: 00000000 <main>: 0: 18 60 00 00 l.movhi r3,0x0 4: d7 e1 17 f4 l.sw 0xfffffff4(r1),r2 8: d7 e1 77 f8 l.sw 0xfffffff8(r1),r14 c: d7 e1 4f fc l.sw 0xfffffffc(r1),r9 10: a8 63 21 b0 l.ori r3,r3,0x21b0 14: 9c 21 ff d4 l.addi r1,r1,0xffffffd4 <== r2, r14, r9's values stored in stack will be modified, if an interrupt occurs before this instruction. 18: 84 63 00 00 l.lwz r3,0x0(r3) 1c: 9c 41 00 04 l.addi r2,r1,0x4 20: 9d c1 00 20 l.addi r14,r1,0x20 24: 04 00 00 0d l.jal 58 <__modsi3> 28: 9c 80 00 0a l.addi r4,r0,0xa 2c: d4 02 58 00 l.sw 0x0(r2),r11 30: 9c 42 00 04 l.addi r2,r2,0x4 34: e4 22 70 00 l.sfne r2,r14 38: 13 ff ff fb l.bf 24 <main+0x24> 3c: a8 6b 00 00 l.ori r3,r11,0x0 40: 85 61 00 1c l.lwz r11,0x1c(r1) 44: 9c 21 00 2c l.addi r1,r1,0x2c <== The values will be modified too, if an interrupt occurs after this instruction. 48: 85 21 ff fc l.lwz r9,0xfffffffc(r1) 4c: 84 41 ff f4 l.lwz r2,0xfffffff4(r1) 50: 44 00 48 00 l.jr r9 54: 85 c1 ff f8 l.lwz r14,0xfffffff8(r1)
And I compile it using "or32-elf-gcc.exe -O2 -mno-logue -o try.s -S try.c". Then it has another problem: 00000000 <main>: 0: 9c 21 ff d4 l.addi r1,r1,0xffffffd4 4: d4 01 48 00 l.sw 0x0(r1),r9 \ 8: d4 01 10 04 l.sw 0x4(r1),r2 |==> r9?r2?r14 are saved with the offsets of 0, 4, and 8 c: d4 01 70 08 l.sw 0x8(r1),r14 / 10: 18 60 00 00 l.movhi r3,0x0 14: 9c 41 00 04 l.addi r2,r1,0x4 <== Array aa uses offset 0 too. (And 4 is the offset of aa1) 18: a8 63 21 b0 l.ori r3,r3,0x21b0 1c: 9d c1 00 20 l.addi r14,r1,0x20 20: 84 63 00 00 l.lwz r3,0x0(r3) 24: 04 00 00 0d l.jal 58 <__modsi3> 28: 9c 80 00 0a l.addi r4,r0,0xa 2c: d4 02 58 00 l.sw 0x0(r2),r11 <== This instruction will modify values of r2 and r14 30: 9c 42 00 04 l.addi r2,r2,0x4 34: e4 22 70 00 l.sfne r2,r14 38: 13 ff ff fb l.bf 24 <main+0x24> 3c: a8 6b 00 00 l.ori r3,r11,0x0 40: 85 61 00 1c l.lwz r11,0x1c(r1) 44: 85 21 00 00 l.lwz r9,0x0(r1) 48: 84 41 00 04 l.lwz r2,0x4(r1) 4c: 85 c1 00 08 l.lwz r14,0x8(r1) 50: 44 00 48 00 l.jr r9 54: 9c 21 00 2c l.addi r1,r1,0x2c
So, we can't use the option -mno-logue. We can't use -mlogue too, when interrupt system is necessary.
I'm sorry for the dos newline.
This is my test program: #define NUM 32 int i; int main() { int j; int aaNUM/4; aa0 = i; for (j=0; j<NUM/4-1; ++j) aaj+1 = aaj%10; j = aaNUM/4-1; return j; }
I compile it using "or32-elf-gcc.exe -O2 -o try.s -S try.c". The problem is: 00000000 <main>: 0: 18 60 00 00 l.movhi r3,0x0 4: d7 e1 17 f4 l.sw 0xfffffff4(r1),r2 8: d7 e1 77 f8 l.sw 0xfffffff8(r1),r14 c: d7 e1 4f fc l.sw 0xfffffffc(r1),r9 10: a8 63 21 b0 l.ori r3,r3,0x21b0 14: 9c 21 ff d4 l.addi r1,r1,0xffffffd4 <== r2, r14, r9's values stored in stack will be modified, if an interrupt occurs before this instruction. 18: 84 63 00 00 l.lwz r3,0x0(r3) 1c: 9c 41 00 04 l.addi r2,r1,0x4 20: 9d c1 00 20 l.addi r14,r1,0x20 24: 04 00 00 0d l.jal 58 <__modsi3> 28: 9c 80 00 0a l.addi r4,r0,0xa 2c: d4 02 58 00 l.sw 0x0(r2),r11 30: 9c 42 00 04 l.addi r2,r2,0x4 34: e4 22 70 00 l.sfne r2,r14 38: 13 ff ff fb l.bf 24 <main+0x24> 3c: a8 6b 00 00 l.ori r3,r11,0x0 40: 85 61 00 1c l.lwz r11,0x1c(r1) 44: 9c 21 00 2c l.addi r1,r1,0x2c <== The values will be modified too, if an interrupt occurs after this instruction. 48: 85 21 ff fc l.lwz r9,0xfffffffc(r1) 4c: 84 41 ff f4 l.lwz r2,0xfffffff4(r1) 50: 44 00 48 00 l.jr r9 54: 85 c1 ff f8 l.lwz r14,0xfffffff8(r1)
And I compile it using "or32-elf-gcc.exe -O2 -mno-logue -o try.s -S try.c". Then it has another problem: 00000000 <main>: 0: 9c 21 ff d4 l.addi r1,r1,0xffffffd4 4: d4 01 48 00 l.sw 0x0(r1),r9 \ 8: d4 01 10 04 l.sw 0x4(r1),r2 |==> r9, r2, r14 are saved with the offsets of 0, 4, and 8 c: d4 01 70 08 l.sw 0x8(r1),r14 / 10: 18 60 00 00 l.movhi r3,0x0 14: 9c 41 00 04 l.addi r2,r1,0x4 <== Array aa uses offset 0 too. (And 4 is the offset of aa1) 18: a8 63 21 b0 l.ori r3,r3,0x21b0 1c: 9d c1 00 20 l.addi r14,r1,0x20 20: 84 63 00 00 l.lwz r3,0x0(r3) 24: 04 00 00 0d l.jal 58 <__modsi3> 28: 9c 80 00 0a l.addi r4,r0,0xa 2c: d4 02 58 00 l.sw 0x0(r2),r11 <== This instruction will modify values of r2 and r14 30: 9c 42 00 04 l.addi r2,r2,0x4 34: e4 22 70 00 l.sfne r2,r14 38: 13 ff ff fb l.bf 24 <main+0x24> 3c: a8 6b 00 00 l.ori r3,r11,0x0 40: 85 61 00 1c l.lwz r11,0x1c(r1) 44: 85 21 00 00 l.lwz r9,0x0(r1) 48: 84 41 00 04 l.lwz r2,0x4(r1) 4c: 85 c1 00 08 l.lwz r14,0x8(r1) 50: 44 00 48 00 l.jr r9 54: 9c 21 00 2c l.addi r1,r1,0x2c
So, we can't use the option -mno-logue. We can't use -mlogue too, when interrupt system is necessary.
I'm sorry for the dos newline.
This is my test program: #define NUM 32 int i; int main() { int j; int aaNUM/4; aa0 = i; for (j=0; j<NUM/4-1; ++j) aaj+1 = aaj%10; j = aaNUM/4-1; return j; }
I compile it using "or32-elf-gcc.exe -O2 -o try.s -S try.c". The problem is: 00000000 <main>: 0: 18 60 00 00 l.movhi r3,0x0 4: d7 e1 17 f4 l.sw 0xfffffff4(r1),r2 8: d7 e1 77 f8 l.sw 0xfffffff8(r1),r14 c: d7 e1 4f fc l.sw 0xfffffffc(r1),r9 10: a8 63 21 b0 l.ori r3,r3,0x21b0 14: 9c 21 ff d4 l.addi r1,r1,0xffffffd4 <== r2, r14, r9's values stored in stack will be modified, if an interrupt occurs before this instruction. 18: 84 63 00 00 l.lwz r3,0x0(r3) 1c: 9c 41 00 04 l.addi r2,r1,0x4 20: 9d c1 00 20 l.addi r14,r1,0x20 24: 04 00 00 0d l.jal 58 <__modsi3> 28: 9c 80 00 0a l.addi r4,r0,0xa 2c: d4 02 58 00 l.sw 0x0(r2),r11 30: 9c 42 00 04 l.addi r2,r2,0x4 34: e4 22 70 00 l.sfne r2,r14 38: 13 ff ff fb l.bf 24 <main+0x24> 3c: a8 6b 00 00 l.ori r3,r11,0x0 40: 85 61 00 1c l.lwz r11,0x1c(r1) 44: 9c 21 00 2c l.addi r1,r1,0x2c <== The values will be modified too, if an interrupt occurs after this instruction. 48: 85 21 ff fc l.lwz r9,0xfffffffc(r1) 4c: 84 41 ff f4 l.lwz r2,0xfffffff4(r1) 50: 44 00 48 00 l.jr r9 54: 85 c1 ff f8 l.lwz r14,0xfffffff8(r1)
And I compile it using "or32-elf-gcc.exe -O2 -mno-logue -o try.s -S try.c". Then it has another problem: 00000000 <main>: 0: 9c 21 ff d4 l.addi r1,r1,0xffffffd4 4: d4 01 48 00 l.sw 0x0(r1),r9 \ 8: d4 01 10 04 l.sw 0x4(r1),r2 |==> r9, r2, r14 are saved with the offsets of 0, 4, and 8 c: d4 01 70 08 l.sw 0x8(r1),r14 / 10: 18 60 00 00 l.movhi r3,0x0 14: 9c 41 00 04 l.addi r2,r1,0x4 <== Array aa uses offset 0 too. (And 4 is the offset of aa1) 18: a8 63 21 b0 l.ori r3,r3,0x21b0 1c: 9d c1 00 20 l.addi r14,r1,0x20 20: 84 63 00 00 l.lwz r3,0x0(r3) 24: 04 00 00 0d l.jal 58 <__modsi3> 28: 9c 80 00 0a l.addi r4,r0,0xa 2c: d4 02 58 00 l.sw 0x0(r2),r11 <== This instruction will modify values of r2 and r14 30: 9c 42 00 04 l.addi r2,r2,0x4 34: e4 22 70 00 l.sfne r2,r14 38: 13 ff ff fb l.bf 24 <main+0x24> 3c: a8 6b 00 00 l.ori r3,r11,0x0 40: 85 61 00 1c l.lwz r11,0x1c(r1) 44: 85 21 00 00 l.lwz r9,0x0(r1) 48: 84 41 00 04 l.lwz r2,0x4(r1) 4c: 85 c1 00 08 l.lwz r14,0x8(r1) 50: 44 00 48 00 l.jr r9 54: 9c 21 00 2c l.addi r1,r1,0x2c
So, we can't use the option -mno-logue. We can't use -mlogue too, when interrupt system is necessary.