Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

Fixing the Memtest EXE loader (Developers)

posted by roytam(R), 12.03.2015, 08:24

> Hi, I tried to compile modified memtest
> https://github.com/CMU-SAFARI/rowhammer
> it contains your EXE loader by eric auer
> https://github.com/CMU-SAFARI/rowhammer/blob/master/src/mt86%2B_loader.asm
> I have a problem that produced exe throw error:
>
> nopatch db "jmp far dword not found at setup.S offset 37h,",13,10
> db "(file offset 237h is not 66h, 0eah)",13,10
> db "please adjust and recompile memtestl...",13,10,"$"
>
> I found that it is little bit shifted and when I change
> mov ax,[buffer+251h] ; should be jmp far dword (ofs, seg)
> cmp ax,0ea66h
> to
> mov ax,[buffer+251h+13] ; should be jmp far dword (ofs, seg)
> it finds it and I got another error:
> lgdt [...] not found at setup.S offset 0ch
>
> so I did some further patching by adding 13 but it ended with immediate
> reset of PC after I run it. What is the right place to correct the offset?
> fullsize matches right the size of memtest.bin

I tried to do same thing, it starts but once it detected RAM modal names and tries to start testing, it reboots.


@@ -133,11 +133,11 @@
        ; should be 4 ...
        inc al                  ; the boot sector itself
        movzx eax,al
        shl eax,9               ; log 2 of sector size
        add [cs:buflinear],eax  ; linear address of head.S now
-       mov ax,[buffer+251h]    ; should be jmp far dword (ofs, seg)
+       mov ax,[buffer+25eh]    ; should be jmp far dword (ofs, seg)
        cmp ax,0ea66h
        jz foundpatch
 patchbug:                      ; could not patch the jump
        mov dx,nopatch
        jmp generror
@@ -146,20 +146,20 @@
        mov dx,nogdt
        jmp generror
 
 foundpatch:
        mov eax,[cs:buflinear]
-       mov [buffer+253h],eax   ; patch the protected mode entry jump
+       mov [buffer+260h],eax   ; patch the protected mode entry jump
        ; (offset only - segment selector unchanged: flat linear CS)
 
 findgdt:
-       mov eax,[cs:buffer+20ch]        ; should be lgdt offset
+       mov eax,[cs:buffer+219h]        ; should be lgdt offset
        and eax,00ffffffh
        cmp eax,0016010fh       ; lgdt ...
        jnz gdtbug
 
-       mov ax,[cs:buffer+20fh]         ; GDTR contents pointer
+       mov ax,[cs:buffer+21ch]         ; GDTR contents pointer
        mov bx,ax
        mov eax,[cs:buffer+200h+bx+2]   ; GDT linear offset
        and eax,1ffh    ; assume GDT in first sector of setup.S
        ; *** WARNING: this is needed because setup.S contains
        ; *** HARDCODED offset of setup.S on linear 90200h, which

 

Complete thread:

Back to the forum
Board view  Mix view
15195 Postings in 1365 Threads, 250 registered users, 14 users online (0 registered, 14 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum