LEFT | RIGHT |
1 // Derived from Inferno utils/6l/obj.c and utils/6l/span.c | 1 // Derived from Inferno utils/6l/obj.c and utils/6l/span.c |
2 // http://code.google.com/p/inferno-os/source/browse/utils/6l/obj.c | 2 // http://code.google.com/p/inferno-os/source/browse/utils/6l/obj.c |
3 // http://code.google.com/p/inferno-os/source/browse/utils/6l/span.c | 3 // http://code.google.com/p/inferno-os/source/browse/utils/6l/span.c |
4 // | 4 // |
5 // Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved. | 5 // Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved. |
6 // Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net) | 6 // Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net) |
7 // Portions Copyright © 1997-1999 Vita Nuova Limited | 7 // Portions Copyright © 1997-1999 Vita Nuova Limited |
8 // Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuov
a.com) | 8 // Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuov
a.com) |
9 // Portions Copyright © 2004,2006 Bruce Ellis | 9 // Portions Copyright © 2004,2006 Bruce Ellis |
10 // Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net) | 10 // Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net) |
(...skipping 1900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1911 | 1911 |
1912 put(s, s->name, 'T', s->value, s->size, s->version, s->gotype); | 1912 put(s, s->name, 'T', s->value, s->size, s->version, s->gotype); |
1913 | 1913 |
1914 /* frame, locals, args, auto, param and pointers after */ | 1914 /* frame, locals, args, auto, param and pointers after */ |
1915 put(nil, ".frame", 'm', (uint32)s->text->to.offset+PtrSize, 0, 0
, 0); | 1915 put(nil, ".frame", 'm', (uint32)s->text->to.offset+PtrSize, 0, 0
, 0); |
1916 put(nil, ".locals", 'm', s->locals, 0, 0, 0); | 1916 put(nil, ".locals", 'm', s->locals, 0, 0, 0); |
1917 if(s->text->textflag & NOSPLIT) | 1917 if(s->text->textflag & NOSPLIT) |
1918 put(nil, ".args", 'm', ArgsSizeUnknown, 0, 0, 0); | 1918 put(nil, ".args", 'm', ArgsSizeUnknown, 0, 0, 0); |
1919 else | 1919 else |
1920 put(nil, ".args", 'm', s->args, 0, 0, 0); | 1920 put(nil, ".args", 'm', s->args, 0, 0, 0); |
1921 » » if(s->nptrs != 0) | 1921 » » if(s->nptrs >= 0) { |
1922 put(nil, ".nptrs", 'm', s->nptrs, 0, 0, 0); | 1922 put(nil, ".nptrs", 'm', s->nptrs, 0, 0, 0); |
1923 » » for(i = 0; i < s->nptrs; ++i) | 1923 » » » for(i = 0; i < s->nptrs; i += 32) |
1924 » » » put(nil, ".ptrs", 'm', s->ptrs[i], 0, 0, 0); | 1924 » » » » put(nil, ".ptrs", 'm', s->ptrs[i / 32], 0, 0, 0)
; |
| 1925 » » } |
1925 | 1926 |
1926 for(a=s->autom; a; a=a->link) { | 1927 for(a=s->autom; a; a=a->link) { |
1927 // Emit a or p according to actual offset, even if label
is wrong. | 1928 // Emit a or p according to actual offset, even if label
is wrong. |
1928 // This avoids negative offsets, which cannot be encoded
. | 1929 // This avoids negative offsets, which cannot be encoded
. |
1929 if(a->type != D_AUTO && a->type != D_PARAM) | 1930 if(a->type != D_AUTO && a->type != D_PARAM) |
1930 continue; | 1931 continue; |
1931 ························ | 1932 ························ |
1932 // compute offset relative to FP | 1933 // compute offset relative to FP |
1933 if(a->type == D_PARAM) | 1934 if(a->type == D_PARAM) |
1934 off = a->aoffset; | 1935 off = a->aoffset; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1972 erealloc(void *p, long n) | 1973 erealloc(void *p, long n) |
1973 { | 1974 { |
1974 p = realloc(p, n); | 1975 p = realloc(p, n); |
1975 if(p == nil) { | 1976 if(p == nil) { |
1976 cursym = S; | 1977 cursym = S; |
1977 diag("out of memory"); | 1978 diag("out of memory"); |
1978 errorexit(); | 1979 errorexit(); |
1979 } | 1980 } |
1980 return p; | 1981 return p; |
1981 } | 1982 } |
LEFT | RIGHT |