Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LFN/FAT+ search will read invalid plus size from SFN-only redirector #63

Open
ecm-pushbx opened this issue Jul 2, 2024 · 5 comments
Open
Labels
bug Something isn't working

Comments

@ecm-pushbx
Copy link

Details in the bugfix changeset message at https://hg.pushbx.org/ecm/edrdos/rev/7616ed590558

@boeckmann
Copy link
Collaborator

You defined lfn_search_redir in the PCMODE_CODE segment, but in redir.a86 you defined the external to be in the PCMODE_DATA segment. This kind of segment mismatch might impose a problem with the frame of the .OBJ fixup records while linking when using JWasm as an assembler, at least if they are not both part of the same group. I recommend putting the external inside the PCMODE_CODE segment, so that it matches the data definition.

@boeckmann
Copy link
Collaborator

And if you do that do not forget to extend the group definition inside redir.a86 to include the PCMODE_CODE segment.

@boeckmann
Copy link
Collaborator

imported via 4132acc

@boeckmann
Copy link
Collaborator

WJasm extern definition outside of segment

	extrn 	nonSegVar:byte

code	segment
	mov	nonSegVar,42
code	ends

	end
   FIXUP  segment-relative, type 1 (16-bit offset)
          record offset 0002
          frame method F5 (TARGET index)
          target method T6 (EXTDEF) index 0001 'nonSegVar'

WJasm extern definition inside of segment

data	segment
	extrn 	segVar:byte
data	ends

code	segment
	assume	ds:data
	mov	segVar,42
code	ends

	end

Note the different frame method:

   FIXUP  segment-relative, type 1 (16-bit offset)
          record offset 0002
          frame method F0 (SEGDEF) index 0001 'DATA'
          target method T6 (EXTDEF) index 0002 'segVar'

RASM86

Always seems to use frame method F5 (target index). So as long as one sticks with RASM86 it should be fine, but for MASM compatible conversion you will likely run into trouble.

data dseg
        extrn   aVar:byte

code cseg
        mov     aVar,42

end
   FIXUP  segment-relative, type 1 (16-bit offset)
          record offset 0002
          frame method F5 (TARGET index)
          target method T6 (EXTDEF) index 0001 'AVAR'

@ecm-pushbx
Copy link
Author

You defined lfn_search_redir in the PCMODE_CODE segment, but in redir.a86 you defined the external to be in the PCMODE_DATA segment. This kind of segment mismatch might impose a problem with the frame of the .OBJ fixup records while linking when using JWasm as an assembler, at least if they are not both part of the same group. I recommend putting the external inside the PCMODE_CODE segment, so that it matches the data definition.

Fixed in https://hg.pushbx.org/ecm/edrdos/rev/877d3129bbed

Some of the data already was mismatched like this before yesterday's changeset. Although the same group (PCMDATA) was used in any case, some of the segments did not match across files.

I opted to put everything into BDOS_DATA rather than the confusingly named PCMODE_CODE (which actually belongs to PCMDATA group as well).

@boeckmann boeckmann added the bug Something isn't working label Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants