Commit be3942ed authored by PoroCYon's avatar PoroCYon Committed by PoroCYon
Browse files

fix dnload version

parent 3eea42e2
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
%include "rtld.inc" %include "rtld.inc"
; TODO %define R10_BIAS (0x178)
%define R10_BIAS (0)
%ifdef ELF_TYPE %ifdef ELF_TYPE
[section .text.startup.smol] [section .text.startup.smol]
...@@ -43,7 +42,7 @@ _smol_start: ...@@ -43,7 +42,7 @@ _smol_start:
%endif %endif
%ifdef USE_DNLOAD_LOADER %ifdef USE_DNLOAD_LOADER
; TODO: borked! push eax
pop ebp pop ebp
pop edi pop edi
...@@ -165,7 +164,6 @@ _smol_start: ...@@ -165,7 +164,6 @@ _smol_start:
; if USE_DNLOAD_LOADER ; if USE_DNLOAD_LOADER
%else %else
;.loopme: jmp short .loopme
mov [_smol_linkmap], eax mov [_smol_linkmap], eax
...@@ -176,7 +174,8 @@ _smol_start: ...@@ -176,7 +174,8 @@ _smol_start:
mov eax, _smol_start mov eax, _smol_start
repne scasd repne scasd
sub edi, ebx sub edi, ebx
sub edi, LM_ENTRY_OFFSET_BASE+4 ;sub edi, LM_ENTRY_OFFSET_BASE+4-R10_BIAS
add edi, R10_BIAS-LM_ENTRY_OFFSET_BASE-4
mov [_smol_linkoff], edi mov [_smol_linkoff], edi
pop edi ; _symbols pop edi ; _symbols
...@@ -204,19 +203,19 @@ repne scasd ...@@ -204,19 +203,19 @@ repne scasd
push ecx push ecx
push ecx push ecx
pop eax pop eax
mov ecx, [esi + LF_NBUCKETS_OFF] mov ecx, [esi + LF_NBUCKETS_OFF - R10_BIAS]
xor edx, edx xor edx, edx
div ecx div ecx
pop ecx pop ecx
shr ecx, 1 shr ecx, 1
; ebx: bucket ; ebx: bucket
mov ebx, [esi + LF_GNU_BUCKETS_OFF] mov ebx, [esi + LF_GNU_BUCKETS_OFF - R10_BIAS]
mov ebx, [ebx + edx * 4] mov ebx, [ebx + edx * 4]
.next_chain: .next_chain:
; edx: luhash ; edx: luhash
mov edx, [esi + LF_GNU_CHAIN_ZERO_OFF] mov edx, [esi + LF_GNU_CHAIN_ZERO_OFF - R10_BIAS]
mov edx, [edx + ebx * 4] mov edx, [edx + ebx * 4]
; ecx: hash ; ecx: hash
...@@ -250,6 +249,8 @@ repne scasd ...@@ -250,6 +249,8 @@ repne scasd
cmp word [edi], 0 cmp word [edi], 0
jne short .next_hash jne short .next_hash
pop eax ; get rid of leftover ecx on stack
; if USE_DNLOAD_LOADER ... else ... ; if USE_DNLOAD_LOADER ... else ...
%endif %endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment