Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(942)

Delta Between Two Patch Sets: src/pkg/runtime/softfloat_arm.c

Issue 109050043: code review 109050043: all: remove 'extern register M *m' from runtime (Closed)
Left Patch Set: Created 10 years, 9 months ago
Right Patch Set: diff -r 2699961d1143 https://code.google.com/p/go/ Created 10 years, 9 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/runtime/signal_unix.c ('k') | src/pkg/runtime/stack.c » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // Software floating point interpretaton of ARM 7500 FP instructions. 5 // Software floating point interpretaton of ARM 7500 FP instructions.
6 // The interpretation is not bit compatible with the 7500. 6 // The interpretation is not bit compatible with the 7500.
7 // It uses true little-endian doubles, while the 7500 used mixed-endian. 7 // It uses true little-endian doubles, while the 7500 used mixed-endian.
8 8
9 #include "runtime.h" 9 #include "runtime.h"
10 #include "../../cmd/ld/textflag.h" 10 #include "../../cmd/ld/textflag.h"
(...skipping 14 matching lines...) Expand all
25 { 25 {
26 if (1) { 26 if (1) {
27 runtime·printf("Unsupported floating point instruction\n"); 27 runtime·printf("Unsupported floating point instruction\n");
28 runtime·abort(); 28 runtime·abort();
29 } 29 }
30 } 30 }
31 31
32 static void 32 static void
33 putf(uint32 reg, uint32 val) 33 putf(uint32 reg, uint32 val)
34 { 34 {
35 » m->freglo[reg] = val; 35 » g->m->freglo[reg] = val;
36 } 36 }
37 37
38 static void 38 static void
39 putd(uint32 reg, uint64 val) 39 putd(uint32 reg, uint64 val)
40 { 40 {
41 » m->freglo[reg] = (uint32)val; 41 » g->m->freglo[reg] = (uint32)val;
42 » m->freghi[reg] = (uint32)(val>>32); 42 » g->m->freghi[reg] = (uint32)(val>>32);
43 } 43 }
44 44
45 static uint64 45 static uint64
46 getd(uint32 reg) 46 getd(uint32 reg)
47 { 47 {
48 » return (uint64)m->freglo[reg] | ((uint64)m->freghi[reg]<<32); 48 » return (uint64)g->m->freglo[reg] | ((uint64)g->m->freghi[reg]<<32);
49 } 49 }
50 50
51 static void 51 static void
52 fprint(void) 52 fprint(void)
53 { 53 {
54 uint32 i; 54 uint32 i;
55 for (i = 0; i < 16; i++) { 55 for (i = 0; i < 16; i++) {
56 » » runtime·printf("\tf%d:\t%X %X\n", i, m->freghi[i], m->freglo[i]) ; 56 » » runtime·printf("\tf%d:\t%X %X\n", i, g->m->freghi[i], g->m->freg lo[i]);
57 } 57 }
58 } 58 }
59 59
60 static uint32 60 static uint32
61 d2f(uint64 d) 61 d2f(uint64 d)
62 { 62 {
63 uint32 x; 63 uint32 x;
64 64
65 runtime·f64to32c(d, &x); 65 runtime·f64to32c(d, &x);
66 return x; 66 return x;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 static uint32 104 static uint32
105 stepflt(uint32 *pc, uint32 *regs) 105 stepflt(uint32 *pc, uint32 *regs)
106 { 106 {
107 uint32 i, opc, regd, regm, regn, cpsr; 107 uint32 i, opc, regd, regm, regn, cpsr;
108 int32 delta; 108 int32 delta;
109 uint32 *addr; 109 uint32 *addr;
110 uint64 uval; 110 uint64 uval;
111 int64 sval; 111 int64 sval;
112 bool nan, ok; 112 bool nan, ok;
113 int32 cmp; 113 int32 cmp;
114 114 » M *m;
115
116 » // m is locked in vlop_arm.s, so g->m cannot change during this function call,
117 » // so caching it in a local variable is safe.
118 » m = g->m;
115 i = *pc; 119 i = *pc;
116 120
117 if(trace) 121 if(trace)
118 runtime·printf("stepflt %p %x (cpsr %x)\n", pc, i, regs[CPSR] >> 28); 122 runtime·printf("stepflt %p %x (cpsr %x)\n", pc, i, regs[CPSR] >> 28);
119 123
120 opc = i >> 28; 124 opc = i >> 28;
121 if(opc == 14) // common case first 125 if(opc == 14) // common case first
122 goto execute; 126 goto execute;
123 cpsr = regs[CPSR] >> 28; 127 cpsr = regs[CPSR] >> 28;
124 switch(opc) { 128 switch(opc) {
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 if(skip == 0) { 615 if(skip == 0) {
612 runtime·printf("sfloat2 %p %x\n", lr, *lr); 616 runtime·printf("sfloat2 %p %x\n", lr, *lr);
613 fabort(); // not ok to fail first instruction 617 fabort(); // not ok to fail first instruction
614 } 618 }
615 619
616 lr += skip; 620 lr += skip;
617 while(skip = stepflt(lr, (uint32*)&regs.r0)) 621 while(skip = stepflt(lr, (uint32*)&regs.r0))
618 lr += skip; 622 lr += skip;
619 return lr; 623 return lr;
620 } 624 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b