2016-12-24 bug with (rd) #132

Closed
steve6375 opened this Issue Jan 19, 2017 · 17 comments

Comments

Projects
None yet
2 participants
@steve6375

I have had reports from people that the latest version does not work when using Easy2Boot.
The problem seems to be around this line in the grub4dos batch file:

map (md)0x300+200 (rd) > nul ;; read 0x82d0 > nul ;; call Fn.24 %@retval% 0x20 102400 > nul

2016-09-20 is OK
2016-11-09 is OK
2016-12-24 is not

The problem seems to be that instead of filling the memory area with 0x20, it is left with junk data.
This only happens on some systems, but not on others.
I am guessing this is because of the different memory map used by different systems.

@steve6375

This comment has been minimized.

Show comment
Hide comment
@steve6375

steve6375 Jan 19, 2017

I can repro using an Lenovo IdeaPad 300.
read 0x82d0 returns 0x7276A000
call Fn.24 0x7276A000 0x20 102400 does not seem to fill (rd) with x20 - it is left as it was before.

Works as expected on VBOX (1gb mem). So it is machine specific.

cat --hex --length=0x100 (rd)0+1 shows this on IdeaPad 300.

displaymem on IdeaPad 300 shows:
Usable RAM: Base: 0x0, Length: 0x9E800
Reserved: Base: 0x9E800, Length: 0x1800
Reserved: Base: 0xE0000, Length: 0x20000
Usable RAM: Base: 0x100000, Length: 0x73B9E000
Reserved: Base: 0x73C9E000, Length: 0x1000
Reserved: Base: 0x73C9F000, Length: 0x2A000
Usable RAM: Base: 0x73CC9000, Length: 0xB0000
Reserved: Base: 0x73D79000, Length: 0x900000
Usable RAM: Base: 0x74679000, Length: 0x10F15000
Reserved: Base: 0x8558E000, Length: 0x9F0000
Reserved: Base: 0x85F7E000, Length: 0x2000000
Reserved: Base: 0x87F7E000, Length: 0x80000
Usable RAM: Base: 0x87FFE000, Length: 0x1000
Reserved: Base: 0x87FFF000, Length: 0x101000
Reserved: Base: 0x89000000, Length: 0x3800000
Reserved: Base: 0xE0000000, Length: 0x10000000
Reserved: Base: 0xFD000000, Length: 0x1800000
Reserved: Base: 0xFEB00000, Length: 0x4000
Reserved: Base: 0xFEC00000, Length: 0x1000
Reserved: Base: 0xFED00000, Length: 0x1000
Reserved: Base: 0xFED10000, Length: 0xA000
Reserved: Base: 0xFED84000, Length: 0x1000
Reserved: Base: 0xFEE00000, Length: 0x1000
Reserved: Base: 0xFFA10000, Length: 0x5F0000
Usable RAM: Base: 0x100000000, Length: 0x172800000

steve6375 commented Jan 19, 2017

I can repro using an Lenovo IdeaPad 300.
read 0x82d0 returns 0x7276A000
call Fn.24 0x7276A000 0x20 102400 does not seem to fill (rd) with x20 - it is left as it was before.

Works as expected on VBOX (1gb mem). So it is machine specific.

cat --hex --length=0x100 (rd)0+1 shows this on IdeaPad 300.

displaymem on IdeaPad 300 shows:
Usable RAM: Base: 0x0, Length: 0x9E800
Reserved: Base: 0x9E800, Length: 0x1800
Reserved: Base: 0xE0000, Length: 0x20000
Usable RAM: Base: 0x100000, Length: 0x73B9E000
Reserved: Base: 0x73C9E000, Length: 0x1000
Reserved: Base: 0x73C9F000, Length: 0x2A000
Usable RAM: Base: 0x73CC9000, Length: 0xB0000
Reserved: Base: 0x73D79000, Length: 0x900000
Usable RAM: Base: 0x74679000, Length: 0x10F15000
Reserved: Base: 0x8558E000, Length: 0x9F0000
Reserved: Base: 0x85F7E000, Length: 0x2000000
Reserved: Base: 0x87F7E000, Length: 0x80000
Usable RAM: Base: 0x87FFE000, Length: 0x1000
Reserved: Base: 0x87FFF000, Length: 0x101000
Reserved: Base: 0x89000000, Length: 0x3800000
Reserved: Base: 0xE0000000, Length: 0x10000000
Reserved: Base: 0xFD000000, Length: 0x1800000
Reserved: Base: 0xFEB00000, Length: 0x4000
Reserved: Base: 0xFEC00000, Length: 0x1000
Reserved: Base: 0xFED00000, Length: 0x1000
Reserved: Base: 0xFED10000, Length: 0xA000
Reserved: Base: 0xFED84000, Length: 0x1000
Reserved: Base: 0xFEE00000, Length: 0x1000
Reserved: Base: 0xFFA10000, Length: 0x5F0000
Usable RAM: Base: 0x100000000, Length: 0x172800000

@steve6375

This comment has been minimized.

Show comment
Hide comment
@steve6375

steve6375 Jan 19, 2017

2016-12-23 version is OK and does not show the problem.
So bug was introduced in 2016-12-24 version.

2016-12-23 version is OK and does not show the problem.
So bug was introduced in 2016-12-24 version.

@steve6375

This comment has been minimized.

Show comment
Hide comment
@steve6375

steve6375 Jan 19, 2017

I have tried with different System Memory Size in VBOX with 2016-12-24

4096MB - FAIL rd address = 0x23F6A000 (2016-12-23 grldr gives FFFFFFFFDBF5A000 and OK)
3840MB - FAIL rd address = 0x13F6A000 (2016-12-23 grldr gives FFFFFFFFDBF5A000 and OK)
3072MB - OK rd address = -107442176 decimal (FFFFFFFFBFF5A000)
2048MB - OK rd address = 0x7FF5A000

steve6375 commented Jan 19, 2017

I have tried with different System Memory Size in VBOX with 2016-12-24

4096MB - FAIL rd address = 0x23F6A000 (2016-12-23 grldr gives FFFFFFFFDBF5A000 and OK)
3840MB - FAIL rd address = 0x13F6A000 (2016-12-23 grldr gives FFFFFFFFDBF5A000 and OK)
3072MB - OK rd address = -107442176 decimal (FFFFFFFFBFF5A000)
2048MB - OK rd address = 0x7FF5A000

@steve6375

This comment has been minimized.

Show comment
Hide comment
@steve6375

steve6375 Jan 19, 2017

# fill (rd) with 0's , 0x82d0 is rd-base mem address, Fn24 is memset - fill memory  <addr> <string> <size>
map (md)0x300+200 (rd) > nul ;; read 0x82d0 > nul ;; set /A mymem=%@retval%
echo rd=%mymem%
cat --hex --length=0x20 (rd)0+1
call Fn.24  %mymem% 0x20  102400 > nul  
cat --hex --length=0x20 (rd)0+1
cat --hex --length=0x20 --skip=0x3820 (rd)0+1
cat --locate=\x20\x20\x20 --number=1 --skip=50000 (rd)+1 || echo ***** FAILED TO CLEAR MEMORY ******
pause
# fill (rd) with 0's , 0x82d0 is rd-base mem address, Fn24 is memset - fill memory  <addr> <string> <size>
map (md)0x300+200 (rd) > nul ;; read 0x82d0 > nul ;; set /A mymem=%@retval%
echo rd=%mymem%
cat --hex --length=0x20 (rd)0+1
call Fn.24  %mymem% 0x20  102400 > nul  
cat --hex --length=0x20 (rd)0+1
cat --hex --length=0x20 --skip=0x3820 (rd)0+1
cat --locate=\x20\x20\x20 --number=1 --skip=50000 (rd)+1 || echo ***** FAILED TO CLEAR MEMORY ******
pause
@yaya2007

This comment has been minimized.

Show comment
Hide comment
@yaya2007

yaya2007 Jan 20, 2017

Collaborator

2016-12-23 : Low memory block priority
2016-12-24: High memory block priority

"read 0x82d0 returns 0x7276A000" Actual should be 0x17276A000
read 0x82d4 returns 1
memset does not seem to support the 64 bit

Collaborator

yaya2007 commented Jan 20, 2017

2016-12-23 : Low memory block priority
2016-12-24: High memory block priority

"read 0x82d0 returns 0x7276A000" Actual should be 0x17276A000
read 0x82d4 returns 1
memset does not seem to support the 64 bit

@steve6375

This comment has been minimized.

Show comment
Hide comment
@steve6375

steve6375 Jan 20, 2017

Why was topmem change made?
Is there a way to make the topmem behaviour depend on a topmem_flag=1 so it does not break compatibility or only use it in certain special circumstances? e.g. only use topmem if filespec is used and not (md)?

steve6375 commented Jan 20, 2017

Why was topmem change made?
Is there a way to make the topmem behaviour depend on a topmem_flag=1 so it does not break compatibility or only use it in certain special circumstances? e.g. only use topmem if filespec is used and not (md)?

@steve6375

This comment has been minimized.

Show comment
Hide comment
@steve6375

steve6375 Jan 20, 2017

P.S. in the code I am using, I just need to fill a block of memory with 0x20 (or maybe 0x00s) - is there a way to do this without using (rd) and Fn.24?

Would this be a better way?
echo -n > (md)0x300+200
cat --locate=\x00 --replace=\x20 (md)0x300+200

steve6375 commented Jan 20, 2017

P.S. in the code I am using, I just need to fill a block of memory with 0x20 (or maybe 0x00s) - is there a way to do this without using (rd) and Fn.24?

Would this be a better way?
echo -n > (md)0x300+200
cat --locate=\x00 --replace=\x20 (md)0x300+200

@yaya2007

This comment has been minimized.

Show comment
Hide comment
@yaya2007

yaya2007 Jan 20, 2017

Collaborator

Have a try
grldr.txt

Collaborator

yaya2007 commented Jan 20, 2017

Have a try
grldr.txt

@steve6375

This comment has been minimized.

Show comment
Hide comment
@steve6375

steve6375 Jan 20, 2017

Seems OK. Always returns 32-bit address??
e.g. 5928MB IdeaPad 300 system, rd = read 0x82d0 = 0x73bd6000 = 1.9GB ???
3518MB VBOX VM system 0xdbf41000 = 3.69GB

steve6375 commented Jan 20, 2017

Seems OK. Always returns 32-bit address??
e.g. 5928MB IdeaPad 300 system, rd = read 0x82d0 = 0x73bd6000 = 1.9GB ???
3518MB VBOX VM system 0xdbf41000 = 3.69GB

@steve6375

This comment has been minimized.

Show comment
Hide comment
@steve6375

steve6375 Jan 20, 2017

P.S. displaymem command output seems to have changed ???

6GB IdeaPad 300

Usable RAM (HEX): 0+4F0 800+39D778 39E648+580 3A33C8+878A8 43FFF0+8 800000+B9400

VBOX 4864MB

Usable RAM (HEX): 0+4F8 800+6DF2D0 800000+2A0000

steve6375 commented Jan 20, 2017

P.S. displaymem command output seems to have changed ???

6GB IdeaPad 300

Usable RAM (HEX): 0+4F0 800+39D778 39E648+580 3A33C8+878A8 43FFF0+8 800000+B9400

VBOX 4864MB

Usable RAM (HEX): 0+4F8 800+6DF2D0 800000+2A0000

@yaya2007

This comment has been minimized.

Show comment
Hide comment
@yaya2007

yaya2007 Jan 20, 2017

Collaborator

"P.S. displaymem command output seems to have changed ???"
Yes
base address + size

Collaborator

yaya2007 commented Jan 20, 2017

"P.S. displaymem command output seems to have changed ???"
Yes
base address + size

@steve6375

This comment has been minimized.

Show comment
Hide comment
@steve6375

steve6375 Jan 20, 2017

Can displaymem be same as old command but with new base address+size at end of list?
What about 6GB system and rd=0x73bd6000 - is this correct?

Can displaymem be same as old command but with new base address+size at end of list?
What about 6GB system and rd=0x73bd6000 - is this correct?

@yaya2007

This comment has been minimized.

Show comment
Hide comment
@yaya2007

yaya2007 Jan 20, 2017

Collaborator

RD is 8 bytes,But "read" returns only 4 bytes .
rd address =(read 0x82d4 )*0x100000000+(read 0x82d0)

memset does not seem to support the 64 bit
Available to fill "(md)0x300+200 ",And then on the map .

Collaborator

yaya2007 commented Jan 20, 2017

RD is 8 bytes,But "read" returns only 4 bytes .
rd address =(read 0x82d4 )*0x100000000+(read 0x82d0)

memset does not seem to support the 64 bit
Available to fill "(md)0x300+200 ",And then on the map .

@steve6375

This comment has been minimized.

Show comment
Hide comment
@steve6375

steve6375 Jan 20, 2017

calc *0x82d0 | set mem=
works better, but cannot use with Fn.24.

calc *0x82d0 | set mem=
works better, but cannot use with Fn.24.

@yaya2007

This comment has been minimized.

Show comment
Hide comment
@yaya2007

yaya2007 Jan 21, 2017

Collaborator

Have a try
grldr.rar.txt

#define grub_memset64 ((unsigned long long ()(unsigned long long, unsigned int, unsigned long long))(((int **)0x8300)[25]))

call Fn.25 0x60000 0 0x20 102400 0

Collaborator

yaya2007 commented Jan 21, 2017

Have a try
grldr.rar.txt

#define grub_memset64 ((unsigned long long ()(unsigned long long, unsigned int, unsigned long long))(((int **)0x8300)[25]))

call Fn.25 0x60000 0 0x20 102400 0

@steve6375

This comment has been minimized.

Show comment
Hide comment
@steve6375

steve6375 Jan 21, 2017

OK, so it is
0x60000 = Lower 32-bit address LSW
0 = Upper 32-bit address MSW
0x20 = pattern WORD
102400 = LSW length
0 = MSW length

OK, so it is
0x60000 = Lower 32-bit address LSW
0 = Upper 32-bit address MSW
0x20 = pattern WORD
102400 = LSW length
0 = MSW length

@steve6375

This comment has been minimized.

Show comment
Hide comment
@steve6375

steve6375 Jan 23, 2017

P.S. I now use

:: fill memory at 0x60000 == (md)0x300 with spaces
call Fn.24 0x60000 0x20 102400
:: copy memory to (rd)
map (md)0x300+200 (rd)

which is much cleaner and (rd)+1 can be used with dd, etc. to clear files.

P.S. I now use

:: fill memory at 0x60000 == (md)0x300 with spaces
call Fn.24 0x60000 0x20 102400
:: copy memory to (rd)
map (md)0x300+200 (rd)

which is much cleaner and (rd)+1 can be used with dd, etc. to clear files.

@steve6375 steve6375 closed this Mar 1, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment