wisp-cvs Mailing List for Wisp interpreter (Page 10)
Status: Alpha
Brought to you by:
digg
You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(30) |
Sep
(312) |
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(5) |
Feb
(131) |
Mar
(17) |
Apr
(184) |
May
(252) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
From: <di...@us...> - 2003-05-11 06:14:24
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv15324 Modified Files: make-pe-exe.py Log Message: align base_address to page boundary before processing Index: make-pe-exe.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/make-pe-exe.py,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -r1.33 -r1.34 --- make-pe-exe.py 11 May 2003 05:52:56 -0000 1.33 +++ make-pe-exe.py 11 May 2003 06:14:21 -0000 1.34 @@ -315,6 +315,7 @@ # paste sections together e.align(512) base_address = 0x00400000 +base_address = roundup(base_address, 0x1000) # to page boundary memory_boundary = base_address for s in sectnames: # file alignment |
From: <di...@us...> - 2003-05-11 05:52:59
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv10380 Modified Files: make-pe-exe.py Log Message: a few references to %foo converted into references to &foo Index: make-pe-exe.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/make-pe-exe.py,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- make-pe-exe.py 10 May 2003 19:23:31 -0000 1.32 +++ make-pe-exe.py 11 May 2003 05:52:56 -0000 1.33 @@ -292,14 +292,14 @@ # emit thunk structures for dll in imports_by_dlls.keys(): for sym in imports_by_dlls[dll].keys(): - imports.place_symbol('%.imports/thunk/' + sym + '@' + dll) + imports.place_symbol('&.imports/thunk/%s@%s #rva' % (sym, dll)) imports.align(2) imports.emit_wyde(0) # ordinal imports.emit_string(sym) imports.emit_byte(0) # emit DLL names for dll in imports_by_dlls.keys(): - imports.place_symbol('%.imports/' + dll + '/dll-name') + imports.place_symbol('&.imports/%s/dll-name #rva' % dll) imports.emit_string(dll + '.dll') imports.emit_byte(0) |
From: <di...@us...> - 2003-05-10 19:23:34
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv11486 Modified Files: make-pe-exe.py Log Message: a few references to %foo converted into references to &foo Index: make-pe-exe.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/make-pe-exe.py,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- make-pe-exe.py 10 May 2003 19:13:06 -0000 1.31 +++ make-pe-exe.py 10 May 2003 19:23:31 -0000 1.32 @@ -287,7 +287,7 @@ imports.place_symbol('&.imports/%s/first-thunk #rva' % dll) for sym in imports_by_dlls[dll].keys(): imports.place_symbol('&.imports/slot/' + sym + '@' + dll) - imports.emit_tetra_sum(['%.imports/thunk/' + sym + '@' + dll]) + imports.emit_tetra_sum(['&.imports/thunk/%s@%s #rva' % (sym, dll)]) imports.emit_tetra(0) # emit thunk structures for dll in imports_by_dlls.keys(): |
From: <di...@us...> - 2003-05-10 19:19:43
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv7103 Modified Files: make-pe-exe.py Log Message: minor cleanup Index: make-pe-exe.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/make-pe-exe.py,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- make-pe-exe.py 10 May 2003 19:07:08 -0000 1.30 +++ make-pe-exe.py 10 May 2003 19:13:06 -0000 1.31 @@ -112,8 +112,7 @@ def make_section_header (name): t = Linkie('<') t.align(4) - t.emit_string(name[:8]) - t.emit_string('\0' * max(0, 8 - len(name))) + t.emit_string((name + '\0' * 8)[:8]) t.emit_tetra_sum(['#' + name + '/memsz']) t.emit_tetra_sum(['&' + name, '#rva']) t.emit_tetra_sum(['#' + name + '/filesz']) |
From: <di...@us...> - 2003-05-10 19:07:12
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv5144 Modified Files: make-pe-exe.py Log Message: a few references to %foo converted into references to &foo Index: make-pe-exe.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/make-pe-exe.py,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- make-pe-exe.py 10 May 2003 19:05:45 -0000 1.29 +++ make-pe-exe.py 10 May 2003 19:07:08 -0000 1.30 @@ -285,7 +285,7 @@ # emit thunk lists for dll in imports_by_dlls.keys(): imports.align(4) - imports.place_symbol('%.imports/' + dll + '/first-thunk') + imports.place_symbol('&.imports/%s/first-thunk #rva' % dll) for sym in imports_by_dlls[dll].keys(): imports.place_symbol('&.imports/slot/' + sym + '@' + dll) imports.emit_tetra_sum(['%.imports/thunk/' + sym + '@' + dll]) |
From: <di...@us...> - 2003-05-10 19:05:48
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv4786 Modified Files: make-pe-exe.py Log Message: a few references to %foo converted into references to &foo Index: make-pe-exe.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/make-pe-exe.py,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- make-pe-exe.py 10 May 2003 18:57:37 -0000 1.28 +++ make-pe-exe.py 10 May 2003 19:05:45 -0000 1.29 @@ -277,9 +277,9 @@ import_table_start = imports.memsz() for dll in imports_by_dlls.keys(): imports[::4] = 0, 0 # hint-name pointer, timestamp - imports[::4] = '#.imports/' + dll + '/forwarder-chain' - imports[::4] = '%.imports/' + dll + '/dll-name' - imports[::4] = '%.imports/' + dll + '/first-thunk' + imports[::4] = '#.imports/%s/forwarder-chain' % dll + imports[::4] = '&.imports/%s/dll-name #rva' % dll + imports[::4] = '&.imports/%s/first-thunk #rva' % dll imports.place_symbol('#.imports/' + dll + '/forwarder-chain', 0) imports.emit_string('\0' * 20) # emit thunk lists |
From: <di...@us...> - 2003-05-10 19:03:06
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv3849 Modified Files: linkie.py Log Message: made Linkie.emit_single_item treat space-separated strings as sums of symbols Index: linkie.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/linkie.py,v retrieving revision 1.52 retrieving revision 1.53 diff -u -d -r1.52 -r1.53 --- linkie.py 10 May 2003 17:17:35 -0000 1.52 +++ linkie.py 10 May 2003 19:03:03 -0000 1.53 @@ -58,7 +58,7 @@ def emit_single_item (this, step, value): if isinstance(value, str): # emit addend - this._emit_sum(step, [value], delta = 0, relative = 0) + this._emit_sum(step, value.split(), delta = 0, relative = 0) # emit zeroes for length this[::step] = 0 else: Bits.emit_single_item(this, step, value) |
From: <di...@us...> - 2003-05-10 18:57:40
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv1935 Modified Files: make-pe-exe.py Log Message: additional alignment for the first section in file Index: make-pe-exe.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/make-pe-exe.py,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- make-pe-exe.py 10 May 2003 18:41:40 -0000 1.27 +++ make-pe-exe.py 10 May 2003 18:57:37 -0000 1.28 @@ -314,6 +314,7 @@ istubs.emit_tetra_sum(['&.imports/slot/' + sym + '@' + dll]) # paste sections together +e.align(512) base_address = 0x00400000 memory_boundary = base_address for s in sectnames: |
From: <di...@us...> - 2003-05-10 18:41:43
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv29308 Modified Files: make-pe-exe.py Log Message: a few references to %foo converted into references to &foo Index: make-pe-exe.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/make-pe-exe.py,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- make-pe-exe.py 10 May 2003 18:40:51 -0000 1.26 +++ make-pe-exe.py 10 May 2003 18:41:40 -0000 1.27 @@ -203,9 +203,9 @@ h.emit_tetra_sum(['#bound-import-table/size']) h.emit_tetra_sum(['&import-address-table', '#rva']) h.emit_tetra_sum(['#import-address-table/size']) - h.emit_tetra_sum(['%delay-import-descriptor']) + h.emit_tetra_sum(['&delay-import-descriptor', '#rva']) h.emit_tetra_sum(['#delay-import-descriptor/size']) - h.emit_tetra_sum(['%COM+-runtime-header']) + h.emit_tetra_sum(['&COM+-runtime-header', '#rva']) h.emit_tetra_sum(['#COM+-runtime-header/size']) h.emit_tetra(0); h.emit_tetra(0) # reserved return h |
From: <di...@us...> - 2003-05-10 18:40:54
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv29005 Modified Files: make-pe-exe.py Log Message: dropped the obsolete %_start symbol Index: make-pe-exe.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/make-pe-exe.py,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- make-pe-exe.py 10 May 2003 18:34:34 -0000 1.25 +++ make-pe-exe.py 10 May 2003 18:40:51 -0000 1.26 @@ -212,7 +212,6 @@ text = Linkie('<') # ia32 text.place_symbol('&_start') -text.place_symbol('%_start') text.emit_byte(0x68); text.emit_tetra(-11 % 0x100000000) # push -11 text.emit_byte(0xe8); text.emit_tetra_sum(['&GetStdHandle@kernel32'], delta = -4, relative = 1) # call GetStdHandle text.emit_byte(0x68); text.emit_tetra(0) # push 0 |
From: <di...@us...> - 2003-05-10 18:34:39
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv27075 Modified Files: make-pe-exe.py Log Message: a few references to %foo converted into references to &foo Index: make-pe-exe.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/make-pe-exe.py,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- make-pe-exe.py 10 May 2003 17:44:02 -0000 1.24 +++ make-pe-exe.py 10 May 2003 18:34:34 -0000 1.25 @@ -189,19 +189,19 @@ h.emit_tetra_sum(['#certificate-table/size']) h.emit_tetra_sum(['&base-relocation-table', '#rva']) h.emit_tetra_sum(['#base-relocation-table/size']) - h.emit_tetra_sum(['%debug-data']) + h.emit_tetra_sum(['&debug-data', '#rva']) h.emit_tetra_sum(['#debug-data/size']) - h.emit_tetra_sum(['%architecture-specific']) + h.emit_tetra_sum(['&architecture-specific', '#rva']) h.emit_tetra_sum(['#architecture-specific/size']) - h.emit_tetra_sum(['%global-pointer']) + h.emit_tetra_sum(['&global-pointer', '#rva']) h.emit_tetra(0) - h.emit_tetra_sum(['%thread-local-storage']) + h.emit_tetra_sum(['&thread-local-storage', '#rva']) h.emit_tetra_sum(['#thread-local-storage/size']) - h.emit_tetra_sum(['%load-config-table']) + h.emit_tetra_sum(['&load-config-table', '#rva']) h.emit_tetra_sum(['#load-config-table/size']) - h.emit_tetra_sum(['%bound-import-table']) + h.emit_tetra_sum(['&bound-import-table', '#rva']) h.emit_tetra_sum(['#bound-import-table/size']) - h.emit_tetra_sum(['%import-address-table']) + h.emit_tetra_sum(['&import-address-table', '#rva']) h.emit_tetra_sum(['#import-address-table/size']) h.emit_tetra_sum(['%delay-import-descriptor']) h.emit_tetra_sum(['#delay-import-descriptor/size']) |
From: <di...@us...> - 2003-05-10 17:44:05
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv11457 Modified Files: make-pe-exe.py Log Message: a few references to %foo converted into references to &foo Index: make-pe-exe.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/make-pe-exe.py,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- make-pe-exe.py 10 May 2003 17:37:21 -0000 1.23 +++ make-pe-exe.py 10 May 2003 17:44:02 -0000 1.24 @@ -179,15 +179,15 @@ h.emit_tetra_sum(['#aout/dict-entry-count']) h.emit_tetra_sum(['&export-table', '#rva']) h.emit_tetra_sum(['#export-table/size']) - h.emit_tetra_sum(['%.imports']) + h.emit_tetra_sum(['&.imports', '#rva']) h.emit_tetra_sum(['#.imports/memsz']) - h.emit_tetra_sum(['%resource-table']) + h.emit_tetra_sum(['&resource-table', '#rva']) h.emit_tetra_sum(['#resource-table/size']) - h.emit_tetra_sum(['%exception-table']) + h.emit_tetra_sum(['&exception-table', '#rva']) h.emit_tetra_sum(['#exception-table/size']) h.emit_tetra_sum(['!certificate-table']) h.emit_tetra_sum(['#certificate-table/size']) - h.emit_tetra_sum(['%base-relocation-table']) + h.emit_tetra_sum(['&base-relocation-table', '#rva']) h.emit_tetra_sum(['#base-relocation-table/size']) h.emit_tetra_sum(['%debug-data']) h.emit_tetra_sum(['#debug-data/size']) |
From: <di...@us...> - 2003-05-10 17:37:24
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv9035 Modified Files: make-pe-exe.py Log Message: a few references to %foo converted into references to &foo Index: make-pe-exe.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/make-pe-exe.py,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- make-pe-exe.py 10 May 2003 17:33:06 -0000 1.22 +++ make-pe-exe.py 10 May 2003 17:37:21 -0000 1.23 @@ -150,8 +150,8 @@ h.emit_wyde_sum(['#aout/subsys-version-major']) h.emit_wyde_sum(['#aout/subsys-version-minor']) h.emit_tetra(0) - # %aout/image-end must be a multiple of #aout/memory-align - h.emit_tetra_sum(['%aout/image-end']) + # &aout/image-end must be a multiple of #aout/memory-align + h.emit_tetra_sum(['&aout/image-end', '#rva']) # !aout/header-end must be a multiple of #aout/file-align h.emit_tetra_sum(['!aout/header-end']) h.emit_tetra(0) # checksum @@ -177,7 +177,7 @@ h.emit_tetra_sum(['#aout/heap-commit-size']) h.emit_tetra(0) # loader flags - obsolete h.emit_tetra_sum(['#aout/dict-entry-count']) - h.emit_tetra_sum(['%export-table']) + h.emit_tetra_sum(['&export-table', '#rva']) h.emit_tetra_sum(['#export-table/size']) h.emit_tetra_sum(['%.imports']) h.emit_tetra_sum(['#.imports/memsz']) |
From: <di...@us...> - 2003-05-10 17:33:12
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv7789 Modified Files: make-pe-exe.py Log Message: a few references to %foo converted into references to &foo Index: make-pe-exe.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/make-pe-exe.py,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- make-pe-exe.py 10 May 2003 17:29:50 -0000 1.21 +++ make-pe-exe.py 10 May 2003 17:33:06 -0000 1.22 @@ -135,9 +135,9 @@ h.emit_tetra_sum(['#aout/text-size']) h.emit_tetra_sum(['#aout/data-size']) h.emit_tetra_sum(['#aout/bss-size']) - h.emit_tetra_sum(['%_start']) - h.emit_tetra_sum(['%.text']) - h.emit_tetra_sum(['%.data']) # not present in PE32+ (?) + h.emit_tetra_sum(['&_start', '#rva']) + h.emit_tetra_sum(['&.text', '#rva']) + h.emit_tetra_sum(['&.data', '#rva']) # not present in PE32+ (?) # #aout/image-base must be multiple of 64ki h.emit_tetra_sum(['#aout/image-base']) h.emit_tetra_sum(['#aout/memory-align']) |
From: <di...@us...> - 2003-05-10 17:29:53
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv6605 Modified Files: make-pe-exe.py Log Message: introduced the #rva global symbol to get rid of the % prefix Index: make-pe-exe.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/make-pe-exe.py,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- make-pe-exe.py 6 May 2003 16:43:33 -0000 1.20 +++ make-pe-exe.py 10 May 2003 17:29:50 -0000 1.21 @@ -115,7 +115,7 @@ t.emit_string(name[:8]) t.emit_string('\0' * max(0, 8 - len(name))) t.emit_tetra_sum(['#' + name + '/memsz']) - t.emit_tetra_sum(['%' + name]) + t.emit_tetra_sum(['&' + name, '#rva']) t.emit_tetra_sum(['#' + name + '/filesz']) t.emit_tetra_sum(['!' + name]) t.emit_tetra_sum(['!' + name + '/reloc']) @@ -354,6 +354,7 @@ e.place_symbol('#aout/data-size', roundup(data.memsz(), 0x200)) e.place_symbol('#aout/bss-size', roundup(bss.memsz(), 0x200)) e.place_symbol('#aout/image-base', 0x00400000) +e.place_symbol('#rva', -0x00400000) # adding this to an address will yield RVA e.place_symbol('#aout/memory-align', 4096) e.place_symbol('#aout/file-align', 512) # 4.0 = MSW95 |
From: <di...@us...> - 2003-05-10 17:17:40
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv2638 Modified Files: linkie.py Log Message: a new try at Linkie.glue Index: linkie.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/linkie.py,v retrieving revision 1.51 retrieving revision 1.52 diff -u -d -r1.51 -r1.52 --- linkie.py 7 May 2003 06:25:40 -0000 1.51 +++ linkie.py 10 May 2003 17:17:35 -0000 1.52 @@ -241,7 +241,7 @@ this._linker_notes.append((ofs + delta, typ, arg)) return delta def paste (this, offset, that, skip_addr = 0): - # Pastes /that/ into /this/ at specified /offset/ (if negative + # Pastes /that/ into /this/ at specified /offset/ (if negative, # /offset/ is treated as an alignment restriction and the actual # offset is automatically calculated from that). # Note that the specified alignment of /that/ is IGNORED. @@ -279,6 +279,41 @@ # carry over the linker notes for ofs, typ, arg in that._linker_notes: this._linker_notes.append((ofs + thatofs, typ, arg)) + # return nothing + def glue (this, offset, that, origin): + # Pastes /that/ into /this/ at specified /offset/. + # Adds /origin/ to all &symbols in /that/ and converta sll + # relative references to &symbols in /that/ into absolute + # references. + # Note that the specified alignment and origin of /that/ are IGNORED. + + if this._unresolved_locals: raise 'Incomplete linkie', this + if that._unresolved_locals: raise 'Incomplete linkie', that + if this.memsz() > offset: raise 'Invalid overlap', (this, offset) + + # provide sufficient padding + this.skip(offset - this.memsz()) + + # convert any padding to hard zeroes if needed + if that.filesz(): this.deskip() + + # carry over all the bits + this._contents.extend(that._contents) + this._skipped = that._skipped + + # carry over the symbols + for sym, val in that._symbols: + if sym[0] == '!': this._symbols.append((sym, val + offset)) + elif sym[0] in '&': this._symbols.append((sym, val + origin)) + elif sym[0] in '#': this._symbols.append((sym, val)) + else: raise 'unprefixed symbol', sym + + # carry over the linker notes + for ofs, typ, arg in that._linker_notes: + if typ < 0: # relative? + typ = -typ + this[ofs + offset :: typ] -= ofs + origin + this._linker_notes.append((ofs + offset, typ, arg)) # return nothing def __add__ (this, that): this = this.copy() |
From: <di...@us...> - 2003-05-07 06:25:43
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv17710 Modified Files: linkie.py Log Message: dropped Linkie.glue Index: linkie.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/linkie.py,v retrieving revision 1.50 retrieving revision 1.51 diff -u -d -r1.50 -r1.51 --- linkie.py 6 May 2003 17:31:30 -0000 1.50 +++ linkie.py 7 May 2003 06:25:40 -0000 1.51 @@ -280,45 +280,6 @@ for ofs, typ, arg in that._linker_notes: this._linker_notes.append((ofs + thatofs, typ, arg)) # return nothing - def glue (this, offset, that, amp = None, perc = None): - # Glues /that/ into /this/ at specified /offset/ (if negative, - # /offset/ is treated as an alignment restriction and the actual - # offset is automatically calculated from that). Symbols in the - # form of &foo get added /amp/ and symbols in the form of %foo - # get added /perc/ to their values. - # Note that the specified alignment of /that/ is - # IGNORED except when /offset/ is given as None. - - if this._unresolved_locals: raise 'Incomplete linkie', this - if that._unresolved_locals: raise 'Incomplete linkie', that - - # provide sufficient padding - if offset == None: this.align(that.get_alignment()) - elif offset < 0: this.align(- offset) - else: this.skip(offset - this.memsz()) - - # convert any padding to hard zeroes if needed - if that.filesz(): this.deskip() - - # remember the start offset of /that/ - thatofs = this.memsz() - - # carry over all the bits - this._contents.extend(that._contents) - this._skipped = that._skipped - - # carry over and process the symbols - for sym, val in that._symbols: - if sym[0] == '!': this._symbols.append((sym, val + thatofs)) - elif sym[0] == '#': this._symbols.append((sym, val)) - elif sym[0] == '&': this._symbols.append((sym, val + amp)) - elif sym[0] == '%': this._symbols.append((sym, val + perc)) - else: raise 'unprefixed symbol', sym - - # carry over the linker notes - for ofs, typ, arg in that._linker_notes: - this._linker_notes.append((ofs + thatofs, typ, arg)) - # return nothing def __add__ (this, that): this = this.copy() this.extend(that) |
From: <di...@us...> - 2003-05-06 17:31:33
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv25626 Modified Files: linkie.py Log Message: introduced Linkie.glue Index: linkie.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/linkie.py,v retrieving revision 1.49 retrieving revision 1.50 diff -u -d -r1.49 -r1.50 --- linkie.py 27 Apr 2003 17:59:45 -0000 1.49 +++ linkie.py 6 May 2003 17:31:30 -0000 1.50 @@ -280,6 +280,45 @@ for ofs, typ, arg in that._linker_notes: this._linker_notes.append((ofs + thatofs, typ, arg)) # return nothing + def glue (this, offset, that, amp = None, perc = None): + # Glues /that/ into /this/ at specified /offset/ (if negative, + # /offset/ is treated as an alignment restriction and the actual + # offset is automatically calculated from that). Symbols in the + # form of &foo get added /amp/ and symbols in the form of %foo + # get added /perc/ to their values. + # Note that the specified alignment of /that/ is + # IGNORED except when /offset/ is given as None. + + if this._unresolved_locals: raise 'Incomplete linkie', this + if that._unresolved_locals: raise 'Incomplete linkie', that + + # provide sufficient padding + if offset == None: this.align(that.get_alignment()) + elif offset < 0: this.align(- offset) + else: this.skip(offset - this.memsz()) + + # convert any padding to hard zeroes if needed + if that.filesz(): this.deskip() + + # remember the start offset of /that/ + thatofs = this.memsz() + + # carry over all the bits + this._contents.extend(that._contents) + this._skipped = that._skipped + + # carry over and process the symbols + for sym, val in that._symbols: + if sym[0] == '!': this._symbols.append((sym, val + thatofs)) + elif sym[0] == '#': this._symbols.append((sym, val)) + elif sym[0] == '&': this._symbols.append((sym, val + amp)) + elif sym[0] == '%': this._symbols.append((sym, val + perc)) + else: raise 'unprefixed symbol', sym + + # carry over the linker notes + for ofs, typ, arg in that._linker_notes: + this._linker_notes.append((ofs + thatofs, typ, arg)) + # return nothing def __add__ (this, that): this = this.copy() this.extend(that) |
From: <di...@us...> - 2003-05-06 16:43:36
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv2479 Modified Files: make-pe-exe.py Log Message: align %aout/image-end to 512 byte boundary Index: make-pe-exe.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/make-pe-exe.py,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- make-pe-exe.py 6 May 2003 16:35:54 -0000 1.19 +++ make-pe-exe.py 6 May 2003 16:43:33 -0000 1.20 @@ -336,6 +336,8 @@ e.paste(-1, sections[s]) # increase memory_boundary memory_boundary = roundup(memory_boundary + sections[s].memsz(), 4096) + +e.align(512) e.place_symbol('%aout/image-end', memory_boundary) e.place_symbol('#coff/magic', 0x014C) # I386MAGIC |
From: <di...@us...> - 2003-05-06 16:35:57
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv31379 Modified Files: make-pe-exe.py Log Message: use new, clearer syntax Index: make-pe-exe.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/make-pe-exe.py,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- make-pe-exe.py 6 May 2003 16:27:28 -0000 1.18 +++ make-pe-exe.py 6 May 2003 16:35:54 -0000 1.19 @@ -25,13 +25,11 @@ b.set_origin(0x100) b.emit_string('MZ') # 'MZ' b[::2] = '#mz/bytes-in-last-block', '#mz/blocks-in-file' - b.emit_wyde(0) # no relocation - b.emit_wyde(0) # empty MZ header--load it all into memory - b.emit_wyde(0x40) # low memory limit in paragraphs - b.emit_wyde(0x40) # high memory limit in paragraphs - b.emit_wyde(-0x10) # initial SS - b.emit_wyde(0x100) # initial SP in PSP - b.emit_wyde(0) # no checksum + b[::2] = 0 # no relocation + b[::2] = 0 # empty MZ header--load it all into memory + b[::2] = 0x40, 0x40 # low and high memory limits in paragraphs + b[::2] = -0x10, 0x100 # initial SS, SP + b[::2] = 0 # no checksum b.emit_wyde_sum(['&mz/_start']) # initial IP b.emit_wyde(-0x10) # initial CS b.emit_wyde(0) # relocation table offset |
From: <di...@us...> - 2003-05-06 16:27:31
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv26756 Modified Files: make-pe-exe.py Log Message: use new, clearer syntax Index: make-pe-exe.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/make-pe-exe.py,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- make-pe-exe.py 5 May 2003 21:06:40 -0000 1.17 +++ make-pe-exe.py 6 May 2003 16:27:28 -0000 1.18 @@ -24,8 +24,7 @@ b = Linkie('<') b.set_origin(0x100) b.emit_string('MZ') # 'MZ' - b.emit_wyde_sum(['#mz/bytes-in-last-block']) - b.emit_wyde_sum(['#mz/blocks-in-file']) + b[::2] = '#mz/bytes-in-last-block', '#mz/blocks-in-file' b.emit_wyde(0) # no relocation b.emit_wyde(0) # empty MZ header--load it all into memory b.emit_wyde(0x40) # low memory limit in paragraphs |
From: <di...@us...> - 2003-05-06 16:23:01
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv23477 Modified Files: elf.py Log Message: use new, clearer syntax Index: elf.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/elf.py,v retrieving revision 1.52 retrieving revision 1.53 diff -u -d -r1.52 -r1.53 --- elf.py 27 Apr 2003 20:18:06 -0000 1.52 +++ elf.py 6 May 2003 16:22:58 -0000 1.53 @@ -367,7 +367,7 @@ t = Linkie(byte_order) t.align(4) t |= '!elf/secthdr' - t.emit_string('\0' * 40) # the null entry + t[::4] = (0,) * 10 # the null entry for name in names: t[::4] = '#.shstrtab/strings/' + name t[::4] = '#' + name + '/sh_type' @@ -405,7 +405,7 @@ Linkie.__init__(this, byte_order) this._strtab = strtab this.align(4) - this.emit_string('\0' * 16) + this[::4] = 0, 0, 0, 0 this._index = 0 # for pre-increment # Returns index of the entry added. def emit_entry (this, pname, value = None, section = SHN.ABS): @@ -413,7 +413,7 @@ # No explicit alignment. .symtab doesn't bear padding; if # you get it out of align, you're out of luck anyway. this[::4] = ofs - if value == None: this.emit_tetra_sum([pname]) + if value == None: this[::4] = pname else: this[::4] = value this[::4] = 0 # st_size this[::1] = STB.GLOBAL << 4 | STT.NOTYPE |
From: <di...@us...> - 2003-05-05 21:06:44
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv28033 Modified Files: make-pe-exe.py Log Message: minor cleanup: moved initialization of base_address nearer to its actual usage point Index: make-pe-exe.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/make-pe-exe.py,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- make-pe-exe.py 1 May 2003 20:52:30 -0000 1.16 +++ make-pe-exe.py 5 May 2003 21:06:40 -0000 1.17 @@ -250,8 +250,6 @@ e.emit_string('PE\0\0') e.paste(None, make_coff_header()) e.paste(None, make_pe_aout_header()) -base_address = 0x00400000 -memory_boundary = base_address for s in sectnames: e.paste(None, make_section_header(s)) e.place_symbol('!' + s + '/reloc', 0) @@ -320,6 +318,8 @@ istubs.emit_tetra_sum(['&.imports/slot/' + sym + '@' + dll]) # paste sections together +base_address = 0x00400000 +memory_boundary = base_address for s in sectnames: # file alignment e.align(512) |
From: <di...@us...> - 2003-05-01 20:52:40
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv14202 Modified Files: tran-builtins Log Message: use clearer syntax Index: tran-builtins =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/tran-builtins,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- tran-builtins 1 May 2003 20:51:23 -0000 1.3 +++ tran-builtins 1 May 2003 20:52:34 -0000 1.4 @@ -118,15 +118,15 @@ Regstack.append(y); Regstack.append(x) t, int - cursect.emit_tetra(long(Regstack.pop()) % 0x100000000L) + cursect[::4] = long(Regstack.pop()) t, sym - cursect.emit_tetra_sum([str(Regstack.pop())]) + cursect[::4] = str(Regstack.pop()) w, int - cursect.emit_wyde(long(Regstack.pop()) % 0x10000L) + cursect[::2] = long(Regstack.pop()) w, sym - cursect.emit_wyde_sum([str(Regstack.pop())]) + cursect[::2] = str(Regstack.pop()) # vim: ft=python |
From: <di...@us...> - 2003-05-01 20:52:34
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv14169 Modified Files: make-pe-exe.py Log Message: don't force the output Index: make-pe-exe.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/make-pe-exe.py,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- make-pe-exe.py 1 May 2003 20:49:57 -0000 1.15 +++ make-pe-exe.py 1 May 2003 20:52:30 -0000 1.16 @@ -405,4 +405,4 @@ e.link() e.dump() -e.get_file(force = 1).tofile(open('pehello.exe', 'w')) +e.get_file().tofile(open('pehello.exe', 'w')) |