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

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

Issue 10271047: code review 10271047: cmd/5l,runtime: External linking support on linux-arm (Closed)
Left Patch Set: diff -r af0c031528c3076cb822774cf07376e1c0498009 https://go.googlecode.com/hg/ Created 11 years, 9 months ago
Right Patch Set: diff -r cc6d9589262e8f88e8e1a8a424f143dde76d68e0 https://go.googlecode.com/hg/ Created 11 years, 8 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
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 #include "runtime.h" 5 #include "runtime.h"
6 #include "defs_GOOS_GOARCH.h" 6 #include "defs_GOOS_GOARCH.h"
7 #include "os_GOOS.h" 7 #include "os_GOOS.h"
8 #include "../../cmd/ld/textflag.h"
8 9
9 #define AT_NULL 0 10 #define AT_NULL 0
10 #define AT_PLATFORM 15 // introduced in at least 2.6.11 11 #define AT_PLATFORM 15 // introduced in at least 2.6.11
11 #define AT_HWCAP 16 // introduced in at least 2.6.11 12 #define AT_HWCAP 16 // introduced in at least 2.6.11
12 #define AT_RANDOM 25 // introduced in 2.6.29 13 #define AT_RANDOM 25 // introduced in 2.6.29
13 #define HWCAP_VFP (1 << 6) // introduced in at least 2.6.11 14 #define HWCAP_VFP (1 << 6) // introduced in at least 2.6.11
14 #define HWCAP_VFPv3 (1 << 13) // introduced in 2.6.30 15 #define HWCAP_VFPv3 (1 << 13) // introduced in 2.6.30
15 static uint32 runtime·randomNumber; 16 static uint32 runtime·randomNumber;
16 uint8 runtime·armArch = 6; // we default to ARMv6 17 uint8 runtime·armArch = 6; // we default to ARMv6
17 uint32 runtime·hwcap; // set by setup_auxv 18 uint32 runtime·hwcap; // set by setup_auxv
18 uint8 runtime·goarm; // set by 5l 19 uint8 runtime·goarm; // set by 5l
19 20
20 void 21 void
21 runtime·checkgoarm(void) 22 runtime·checkgoarm(void)
22 { 23 {
23 if(runtime·goarm > 5 && !(runtime·hwcap & HWCAP_VFP)) { 24 if(runtime·goarm > 5 && !(runtime·hwcap & HWCAP_VFP)) {
24 runtime·printf("runtime: this CPU has no floating point hardware , so it cannot run\n"); 25 runtime·printf("runtime: this CPU has no floating point hardware , so it cannot run\n");
25 runtime·printf("this GOARM=%d binary. Recompile using GOARM=5.\n ", runtime·goarm); 26 runtime·printf("this GOARM=%d binary. Recompile using GOARM=5.\n ", runtime·goarm);
26 runtime·exit(1); 27 runtime·exit(1);
27 } 28 }
28 if(runtime·goarm > 6 && !(runtime·hwcap & HWCAP_VFPv3)) { 29 if(runtime·goarm > 6 && !(runtime·hwcap & HWCAP_VFPv3)) {
29 runtime·printf("runtime: this CPU has no VFPv3 floating point ha rdware, so it cannot run\n"); 30 runtime·printf("runtime: this CPU has no VFPv3 floating point ha rdware, so it cannot run\n");
30 runtime·printf("this GOARM=%d binary. Recompile using GOARM=6.\n ", runtime·goarm); 31 runtime·printf("this GOARM=%d binary. Recompile using GOARM=6.\n ", runtime·goarm);
31 runtime·exit(1); 32 runtime·exit(1);
32 } 33 }
33 } 34 }
34 35
35 #pragma textflag 7 36 #pragma textflag NOSPLIT
36 void 37 void
37 runtime·setup_auxv(int32 argc, byte **argv) 38 runtime·setup_auxv(int32 argc, byte **argv)
38 { 39 {
39 byte **envp; 40 byte **envp;
40 byte *rnd; 41 byte *rnd;
41 uint32 *auxv; 42 uint32 *auxv;
42 uint32 t; 43 uint32 t;
43 44
44 // skip envp to get to ELF auxiliary vector. 45 // skip envp to get to ELF auxiliary vector.
45 for(envp = &argv[argc+1]; *envp != nil; envp++) 46 for(envp = &argv[argc+1]; *envp != nil; envp++)
(...skipping 15 matching lines...) Expand all
61 runtime·armArch = t - '0'; 62 runtime·armArch = t - '0';
62 } 63 }
63 break; 64 break;
64 case AT_HWCAP: // CPU capability bit flags 65 case AT_HWCAP: // CPU capability bit flags
65 runtime·hwcap = auxv[1]; 66 runtime·hwcap = auxv[1];
66 break; 67 break;
67 } 68 }
68 } 69 }
69 } 70 }
70 71
71 #pragma textflag 7 72 #pragma textflag NOSPLIT
72 int64 73 int64
73 runtime·cputicks(void) 74 runtime·cputicks(void)
74 { 75 {
75 // Currently cputicks() is used in blocking profiler and to seed runtime ·fastrand1(). 76 // Currently cputicks() is used in blocking profiler and to seed runtime ·fastrand1().
76 // runtime·nanotime() is a poor approximation of CPU ticks that is enoug h for the profiler. 77 // runtime·nanotime() is a poor approximation of CPU ticks that is enoug h for the profiler.
77 // runtime·randomNumber provides better seeding of fastrand1. 78 // runtime·randomNumber provides better seeding of fastrand1.
78 return runtime·nanotime() + runtime·randomNumber; 79 return runtime·nanotime() + runtime·randomNumber;
79 } 80 }
LEFTRIGHT

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