support for stripped PE headers in drivers; declare COFF drivers deprecated

git-svn-id: svn://kolibrios.org@5039 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
CleverMouse 2014-08-18 11:18:15 +00:00
parent 680b783de4
commit 21132138a1
17 changed files with 969 additions and 249 deletions

116
data/common/pestrip.asm Normal file
View File

@ -0,0 +1,116 @@
; If you know macro language of FASM, there is almost nothing to comment here.
; If you don't know macro language of FASM, comments would not help you.
filename equ '%EXENAME%'
SPE_DIR_ORDER fix IMPORT EXPORT BASERELOC EXCEPTION TLS BOUND_IMPORT RESOURCE
count = 0
irps dir,SPE_DIR_ORDER
{
SPE_DIRECTORY_#dir = count
count = count + 1
}
IMAGE_DIRECTORY_ENTRY_EXPORT = 0
IMAGE_DIRECTORY_ENTRY_IMPORT = 1
IMAGE_DIRECTORY_ENTRY_RESOURCE = 2
IMAGE_DIRECTORY_ENTRY_EXCEPTION = 3
IMAGE_DIRECTORY_ENTRY_BASERELOC = 5
IMAGE_DIRECTORY_ENTRY_TLS = 9
IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT = 11
virtual at 0
file filename:3Ch,4
load pehea dword from 0
end virtual
virtual at 0
file filename:pehea,0F8h
load NumberOfSections word from 6
load SizeOfOptionalHeader word from 14h
if SizeOfOptionalHeader<>0E0h
error Nonstandard PE header
end if
load Characteristics word from 16h
load AddressOfEntryPoint dword from 28h
load ImageBase dword from 34h
load SectionAlignment dword from 38h
load FileAlignment dword from 3Ch
load MajorOperatingSystemVersion word from 40h
load MinorOperatingSystemVersion word from 42h
load MajorSubsystemVersion word from 48h
load MinorSubsystemVersion word from 4Ah
load SizeOfImage dword from 50h
load SizeOfHeaders dword from 54h
load Subsystem word from 5Ch
load SizeOfStackReserve dword from 60h
load SizeOfHeapReserve dword from 68h
load SrcNumberOfRvaAndSizes dword from 74h
DstNumberOfRvaAndSizes = 0
irps dir,SPE_DIR_ORDER
{
if IMAGE_DIRECTORY_ENTRY_#dir < SrcNumberOfRvaAndSizes
load DirRVA_#dir dword from 78h + 8*IMAGE_DIRECTORY_ENTRY_#dir
load DirSize_#dir dword from 7Ch + 8*IMAGE_DIRECTORY_ENTRY_#dir
else
DirRVA_#dir = 0
DirSize_#dir = 0
end if
if DirRVA_#dir > 0 & DirSize_#dir > 0
DstNumberOfRvaAndSizes = SPE_DIRECTORY_#dir + 1
end if
}
end virtual
SectionAlignmentLog = 0
while SectionAlignment <> 1 shl SectionAlignmentLog
SectionAlignmentLog = SectionAlignmentLog + 1
end while
FileAlignmentLog = 0
while FileAlignment <> 1 shl FileAlignmentLog
FileAlignmentLog = FileAlignmentLog + 1
end while
; header
dw 'PE' xor 'S' ; Signature
dw Characteristics or 0x100 ; IMAGE_FILE_32BIT_MACHINE
dd AddressOfEntryPoint
dd ImageBase
db SectionAlignmentLog
db FileAlignmentLog
db MajorSubsystemVersion
db MinorSubsystemVersion
dd SizeOfImage
dd SizeOfStackReserve
dd SizeOfHeapReserve
SizeOfHeadersField:
dd 0
db Subsystem
db DstNumberOfRvaAndSizes
dw NumberOfSections
; directories
irps dir,SPE_DIR_ORDER
{
if SPE_DIRECTORY_#dir < DstNumberOfRvaAndSizes
dd DirRVA_#dir, DirSize_#dir
end if
}
NumBytesDeleted = pehea + 0F8h - $ + NumberOfSections*0Ch
DeltaDeleted = NumBytesDeleted and not (FileAlignment - 1)
; Use store instead of declaring SizeOfHeaders - DeltaDeleted directly in dd
; to avoid the second compilation pass.
store dword SizeOfHeaders - DeltaDeleted at SizeOfHeadersField
; sections
repeat NumberOfSections
file filename:pehea+0F8h+(%-1)*28h,18h
load a dword from $-4
store dword a-DeltaDeleted at $-4
file filename:pehea+0F8h+(%-1)*28h+24h,4
end repeat
; padding to keep FileAlignment
times NumBytesDeleted - DeltaDeleted db 0
; data
file filename:pehea+0F8h+NumberOfSections*28h

View File

@ -135,24 +135,10 @@ FASM_PROGRAMS:=\
drivers/usbhid.obj:DRIVERS/USBHID.OBJ:$(KERNEL)/drivers/usbhid/usbhid.asm \ drivers/usbhid.obj:DRIVERS/USBHID.OBJ:$(KERNEL)/drivers/usbhid/usbhid.asm \
drivers/usbstor.obj:DRIVERS/USBSTOR.OBJ:$(KERNEL)/drivers/usbstor.asm \ drivers/usbstor.obj:DRIVERS/USBSTOR.OBJ:$(KERNEL)/drivers/usbstor.asm \
drivers/vt823x.obj:DRIVERS/VT823X.OBJ:$(KERNEL)/drivers/vt823x.asm \ drivers/vt823x.obj:DRIVERS/VT823X.OBJ:$(KERNEL)/drivers/vt823x.asm \
drivers/vidintel.obj:DRIVERS/VIDINTEL.OBJ:$(KERNEL)/drivers/vidintel.asm \
drivers/3c59x.obj:DRIVERS/3C59X.OBJ:$(REPOSITORY)/drivers/ethernet/3c59x.asm \ drivers/3c59x.obj:DRIVERS/3C59X.OBJ:$(REPOSITORY)/drivers/ethernet/3c59x.asm \
drivers/dec21x4x.obj:DRIVERS/DEC21X4X.OBJ:$(REPOSITORY)/drivers/ethernet/dec21x4x.asm \ drivers/dec21x4x.obj:DRIVERS/DEC21X4X.OBJ:$(REPOSITORY)/drivers/ethernet/dec21x4x.asm \
drivers/forcedeth.sys:DRIVERS/FORCEDETH.SYS:$(REPOSITORY)/drivers/ethernet/forcedeth.asm \
drivers/i8254x.sys:DRIVERS/I8254X.SYS:$(REPOSITORY)/drivers/ethernet/i8254x.asm \
drivers/i8255x.sys:DRIVERS/I8255X.SYS:$(REPOSITORY)/drivers/ethernet/i8255x.asm \
drivers/mtd80x.sys:DRIVERS/MTD80X.SYS:$(REPOSITORY)/drivers/ethernet/mtd80x.asm \
drivers/pcnet32.sys:DRIVERS/PCNET32.SYS:$(REPOSITORY)/drivers/ethernet/pcnet32.asm \
drivers/r6040.sys:DRIVERS/R6040.SYS:$(REPOSITORY)/drivers/ethernet/R6040.asm \
drivers/rhine.sys:DRIVERS/RHINE.SYS:$(REPOSITORY)/drivers/ethernet/rhine.asm \
drivers/rtl8029.sys:DRIVERS/RTL8029.SYS:$(REPOSITORY)/drivers/ethernet/RTL8029.asm \
drivers/rtl8139.obj:DRIVERS/RTL8139.OBJ:$(REPOSITORY)/drivers/ethernet/RTL8139.asm \ drivers/rtl8139.obj:DRIVERS/RTL8139.OBJ:$(REPOSITORY)/drivers/ethernet/RTL8139.asm \
drivers/rtl8169.obj:DRIVERS/RTL8169.OBJ:$(REPOSITORY)/drivers/ethernet/RTL8169.asm \ drivers/rtl8169.obj:DRIVERS/RTL8169.OBJ:$(REPOSITORY)/drivers/ethernet/RTL8169.asm \
drivers/sis900.sys:DRIVERS/SIS900.SYS:$(REPOSITORY)/drivers/ethernet/sis900.asm \
drivers/uhci.sys:DRIVERS/UHCI.SYS:$(REPOSITORY)/drivers/usb/uhci.asm \
drivers/ohci.sys:DRIVERS/OHCI.SYS:$(REPOSITORY)/drivers/usb/ohci.asm \
drivers/ehci.sys:DRIVERS/EHCI.SYS:$(REPOSITORY)/drivers/usb/ehci.asm \
drivers/rdc.sys:DRIVERS/RDC.SYS:$(REPOSITORY)/drivers/video/rdc.asm \
File|Managers/kfar:File|Managers/KFAR:$(PROGS)/fs/kfar/trunk/kfar.asm \ File|Managers/kfar:File|Managers/KFAR:$(PROGS)/fs/kfar/trunk/kfar.asm \
File|Managers/kfm:File|Managers/KFM:$(PROGS)/fs/kfm/trunk/kfm.asm \ File|Managers/kfm:File|Managers/KFM:$(PROGS)/fs/kfm/trunk/kfm.asm \
File|Managers/opendial:File|Managers/OPENDIAL:$(PROGS)/fs/opendial/opendial.asm \ File|Managers/opendial:File|Managers/OPENDIAL:$(PROGS)/fs/opendial/opendial.asm \
@ -212,6 +198,23 @@ FASM_PROGRAMS:=\
network/ircc:NETWORK/IRCC:$(PROGS)/network/ircc/ircc.asm \ network/ircc:NETWORK/IRCC:$(PROGS)/network/ircc/ircc.asm \
network/downloader:NETWORK/DOWNLOADER:$(PROGS)/network/downloader/downloader.asm \ network/downloader:NETWORK/DOWNLOADER:$(PROGS)/network/downloader/downloader.asm \
# end of list # end of list
# Same as above with PE stripping as extra step.
FASM_PROGRAMS_PESTRIP:=\
drivers/vidintel.sys:DRIVERS/VIDINTEL.SYS:$(REPOSITORY)/drivers/vidintel.asm \
drivers/forcedeth.sys:DRIVERS/FORCEDETH.SYS:$(REPOSITORY)/drivers/ethernet/forcedeth.asm \
drivers/i8254x.sys:DRIVERS/I8254X.SYS:$(REPOSITORY)/drivers/ethernet/i8254x.asm \
drivers/i8255x.sys:DRIVERS/I8255X.SYS:$(REPOSITORY)/drivers/ethernet/i8255x.asm \
drivers/mtd80x.sys:DRIVERS/MTD80X.SYS:$(REPOSITORY)/drivers/ethernet/mtd80x.asm \
drivers/pcnet32.sys:DRIVERS/PCNET32.SYS:$(REPOSITORY)/drivers/ethernet/pcnet32.asm \
drivers/r6040.sys:DRIVERS/R6040.SYS:$(REPOSITORY)/drivers/ethernet/R6040.asm \
drivers/rhine.sys:DRIVERS/RHINE.SYS:$(REPOSITORY)/drivers/ethernet/rhine.asm \
drivers/rtl8029.sys:DRIVERS/RTL8029.SYS:$(REPOSITORY)/drivers/ethernet/RTL8029.asm \
drivers/sis900.sys:DRIVERS/SIS900.SYS:$(REPOSITORY)/drivers/ethernet/sis900.asm \
drivers/uhci.sys:DRIVERS/UHCI.SYS:$(REPOSITORY)/drivers/usb/uhci.asm \
drivers/ohci.sys:DRIVERS/OHCI.SYS:$(REPOSITORY)/drivers/usb/ohci.asm \
drivers/ehci.sys:DRIVERS/EHCI.SYS:$(REPOSITORY)/drivers/usb/ehci.asm \
drivers/rdc.sys:DRIVERS/RDC.SYS:$(REPOSITORY)/drivers/video/rdc.asm \
# end of list
# The list of all FASM programs with one main FASM file for CD image. # The list of all FASM programs with one main FASM file for CD image.
# Format of an item is exactly the same as in the previous list. # Format of an item is exactly the same as in the previous list.
FASM_PROGRAMS_CD:=\ FASM_PROGRAMS_CD:=\
@ -448,9 +451,15 @@ fimage=$(call respace,$(call imagepart,$(f)))
fsource=$(call respace,$(call sourcepart,$(f))) fsource=$(call respace,$(call sourcepart,$(f)))
fparam=$(call respace,$(call parampart,$(f))) fparam=$(call respace,$(call parampart,$(f)))
# Add stripped PE files produced by fasm to FASM_NOKPACK_PROGRAMS.
include Makefile.pestrip
FASM_NOKPACK_PROGRAMS:=$(FASM_NOKPACK_PROGRAMS) \
$(foreach f,$(FASM_PROGRAMS_PESTRIP),$(fbinary).full:-:$(fsource))
$(foreach f,$(FASM_PROGRAMS_PESTRIP),$(eval $(call pestrip_meta_rule,$(fbinary),$(fbinary).full)))
# Define targets for image file. # Define targets for image file.
# Join all the lists above. # Join all the lists above.
targets_full:=$(COPY_FILES) $(FASM_PROGRAMS) $(NASM_PROGRAMS) $(OTHER_FILES) $(CMM_PROGRAMS) targets_full:=$(COPY_FILES) $(FASM_PROGRAMS) $(FASM_PROGRAMS_PESTRIP) $(NASM_PROGRAMS) $(OTHER_FILES) $(CMM_PROGRAMS)
# For each item in the united list call fbinary. # For each item in the united list call fbinary.
targets:=$(foreach f,$(targets_full),$(fbinary)) targets:=$(foreach f,$(targets_full),$(fbinary))

11
data/eng/Makefile.pestrip Normal file
View File

@ -0,0 +1,11 @@
# This is not a independent Makefile; it is auxiliary file
# included from main Makefile.
# The arguments of macro pestrip_meta_rule:
# $(1) = name of stripped file,
# $(2) = name of input file
define pestrip_meta_rule
$(1): $(2) Makefile.pestrip
EXENAME="$$<" fasm ../common/pestrip.asm "$$@"
kpack --nologo "$$@"
endef

View File

@ -135,24 +135,10 @@ FASM_PROGRAMS:=\
drivers/usbhid.obj:DRIVERS/USBHID.OBJ:$(KERNEL)/drivers/usbhid/usbhid.asm \ drivers/usbhid.obj:DRIVERS/USBHID.OBJ:$(KERNEL)/drivers/usbhid/usbhid.asm \
drivers/usbstor.obj:DRIVERS/USBSTOR.OBJ:$(KERNEL)/drivers/usbstor.asm \ drivers/usbstor.obj:DRIVERS/USBSTOR.OBJ:$(KERNEL)/drivers/usbstor.asm \
drivers/vt823x.obj:DRIVERS/VT823X.OBJ:$(KERNEL)/drivers/vt823x.asm \ drivers/vt823x.obj:DRIVERS/VT823X.OBJ:$(KERNEL)/drivers/vt823x.asm \
drivers/vidintel.obj:DRIVERS/VIDINTEL.OBJ:$(KERNEL)/drivers/vidintel.asm \
drivers/3c59x.obj:DRIVERS/3C59X.OBJ:$(REPOSITORY)/drivers/ethernet/3c59x.asm \ drivers/3c59x.obj:DRIVERS/3C59X.OBJ:$(REPOSITORY)/drivers/ethernet/3c59x.asm \
drivers/dec21x4x.obj:DRIVERS/DEC21X4X.OBJ:$(REPOSITORY)/drivers/ethernet/dec21x4x.asm \ drivers/dec21x4x.obj:DRIVERS/DEC21X4X.OBJ:$(REPOSITORY)/drivers/ethernet/dec21x4x.asm \
drivers/forcedeth.sys:DRIVERS/FORCEDETH.SYS:$(REPOSITORY)/drivers/ethernet/forcedeth.asm \
drivers/i8254x.sys:DRIVERS/I8254X.SYS:$(REPOSITORY)/drivers/ethernet/i8254x.asm \
drivers/i8255x.sys:DRIVERS/I8255X.SYS:$(REPOSITORY)/drivers/ethernet/i8255x.asm \
drivers/mtd80x.sys:DRIVERS/MTD80X.SYS:$(REPOSITORY)/drivers/ethernet/mtd80x.asm \
drivers/pcnet32.sys:DRIVERS/PCNET32.SYS:$(REPOSITORY)/drivers/ethernet/pcnet32.asm \
drivers/r6040.sys:DRIVERS/R6040.SYS:$(REPOSITORY)/drivers/ethernet/R6040.asm \
drivers/rhine.sys:DRIVERS/RHINE.SYS:$(REPOSITORY)/drivers/ethernet/rhine.asm \
drivers/rtl8029.sys:DRIVERS/RTL8029.SYS:$(REPOSITORY)/drivers/ethernet/RTL8029.asm \
drivers/rtl8139.obj:DRIVERS/RTL8139.OBJ:$(REPOSITORY)/drivers/ethernet/RTL8139.asm \ drivers/rtl8139.obj:DRIVERS/RTL8139.OBJ:$(REPOSITORY)/drivers/ethernet/RTL8139.asm \
drivers/rtl8169.obj:DRIVERS/RTL8169.OBJ:$(REPOSITORY)/drivers/ethernet/RTL8169.asm \ drivers/rtl8169.obj:DRIVERS/RTL8169.OBJ:$(REPOSITORY)/drivers/ethernet/RTL8169.asm \
drivers/sis900.sys:DRIVERS/SIS900.SYS:$(REPOSITORY)/drivers/ethernet/sis900.asm \
drivers/uhci.sys:DRIVERS/UHCI.SYS:$(REPOSITORY)/drivers/usb/uhci.asm \
drivers/ohci.sys:DRIVERS/OHCI.SYS:$(REPOSITORY)/drivers/usb/ohci.asm \
drivers/ehci.sys:DRIVERS/EHCI.SYS:$(REPOSITORY)/drivers/usb/ehci.asm \
drivers/rdc.sys:DRIVERS/RDC.SYS:$(REPOSITORY)/drivers/video/rdc.asm \
File|Managers/kfar:File|Managers/KFAR:$(PROGS)/fs/kfar/trunk/kfar.asm \ File|Managers/kfar:File|Managers/KFAR:$(PROGS)/fs/kfar/trunk/kfar.asm \
File|Managers/kfm:File|Managers/KFM:$(PROGS)/fs/kfm/trunk/kfm.asm \ File|Managers/kfm:File|Managers/KFM:$(PROGS)/fs/kfm/trunk/kfm.asm \
File|Managers/opendial:File|Managers/OPENDIAL:$(PROGS)/fs/opendial/opendial.asm \ File|Managers/opendial:File|Managers/OPENDIAL:$(PROGS)/fs/opendial/opendial.asm \
@ -212,6 +198,23 @@ FASM_PROGRAMS:=\
network/ircc:NETWORK/IRCC:$(PROGS)/network/ircc/ircc.asm \ network/ircc:NETWORK/IRCC:$(PROGS)/network/ircc/ircc.asm \
network/downloader:NETWORK/DOWNLOADER:$(PROGS)/network/downloader/downloader.asm \ network/downloader:NETWORK/DOWNLOADER:$(PROGS)/network/downloader/downloader.asm \
# end of list # end of list
# Same as above with PE stripping as extra step.
FASM_PROGRAMS_PESTRIP:=\
drivers/vidintel.sys:DRIVERS/VIDINTEL.SYS:$(REPOSITORY)/drivers/vidintel.asm \
drivers/forcedeth.sys:DRIVERS/FORCEDETH.SYS:$(REPOSITORY)/drivers/ethernet/forcedeth.asm \
drivers/i8254x.sys:DRIVERS/I8254X.SYS:$(REPOSITORY)/drivers/ethernet/i8254x.asm \
drivers/i8255x.sys:DRIVERS/I8255X.SYS:$(REPOSITORY)/drivers/ethernet/i8255x.asm \
drivers/mtd80x.sys:DRIVERS/MTD80X.SYS:$(REPOSITORY)/drivers/ethernet/mtd80x.asm \
drivers/pcnet32.sys:DRIVERS/PCNET32.SYS:$(REPOSITORY)/drivers/ethernet/pcnet32.asm \
drivers/r6040.sys:DRIVERS/R6040.SYS:$(REPOSITORY)/drivers/ethernet/R6040.asm \
drivers/rhine.sys:DRIVERS/RHINE.SYS:$(REPOSITORY)/drivers/ethernet/rhine.asm \
drivers/rtl8029.sys:DRIVERS/RTL8029.SYS:$(REPOSITORY)/drivers/ethernet/RTL8029.asm \
drivers/sis900.sys:DRIVERS/SIS900.SYS:$(REPOSITORY)/drivers/ethernet/sis900.asm \
drivers/uhci.sys:DRIVERS/UHCI.SYS:$(REPOSITORY)/drivers/usb/uhci.asm \
drivers/ohci.sys:DRIVERS/OHCI.SYS:$(REPOSITORY)/drivers/usb/ohci.asm \
drivers/ehci.sys:DRIVERS/EHCI.SYS:$(REPOSITORY)/drivers/usb/ehci.asm \
drivers/rdc.sys:DRIVERS/RDC.SYS:$(REPOSITORY)/drivers/video/rdc.asm \
# end of list
# The list of all FASM programs with one main FASM file for CD image. # The list of all FASM programs with one main FASM file for CD image.
# Format of an item is exactly the same as in the previous list. # Format of an item is exactly the same as in the previous list.
FASM_PROGRAMS_CD:=\ FASM_PROGRAMS_CD:=\
@ -446,9 +449,15 @@ fimage=$(call respace,$(call imagepart,$(f)))
fsource=$(call respace,$(call sourcepart,$(f))) fsource=$(call respace,$(call sourcepart,$(f)))
fparam=$(call respace,$(call parampart,$(f))) fparam=$(call respace,$(call parampart,$(f)))
# Add stripped PE files produced by fasm to FASM_NOKPACK_PROGRAMS.
include Makefile.pestrip
FASM_NOKPACK_PROGRAMS:=$(FASM_NOKPACK_PROGRAMS) \
$(foreach f,$(FASM_PROGRAMS_PESTRIP),$(fbinary).full:-:$(fsource))
$(foreach f,$(FASM_PROGRAMS_PESTRIP),$(eval $(call pestrip_meta_rule,$(fbinary),$(fbinary).full)))
# Define targets for image file. # Define targets for image file.
# Join all the lists above. # Join all the lists above.
targets_full:=$(COPY_FILES) $(FASM_PROGRAMS) $(NASM_PROGRAMS) $(OTHER_FILES) $(CMM_PROGRAMS) targets_full:=$(COPY_FILES) $(FASM_PROGRAMS) $(FASM_PROGRAMS_PESTRIP) $(NASM_PROGRAMS) $(OTHER_FILES) $(CMM_PROGRAMS)
# For each item in the united list call fbinary. # For each item in the united list call fbinary.
targets:=$(foreach f,$(targets_full),$(fbinary)) targets:=$(foreach f,$(targets_full),$(fbinary))

11
data/et/Makefile.pestrip Normal file
View File

@ -0,0 +1,11 @@
# This is not a independent Makefile; it is auxiliary file
# included from main Makefile.
# The arguments of macro pestrip_meta_rule:
# $(1) = name of stripped file,
# $(2) = name of input file
define pestrip_meta_rule
$(1): $(2) Makefile.pestrip
EXENAME="$$<" fasm ../common/pestrip.asm "$$@"
kpack --nologo "$$@"
endef

View File

@ -135,24 +135,10 @@ FASM_PROGRAMS:=\
drivers/usbhid.obj:DRIVERS/USBHID.OBJ:$(KERNEL)/drivers/usbhid/usbhid.asm \ drivers/usbhid.obj:DRIVERS/USBHID.OBJ:$(KERNEL)/drivers/usbhid/usbhid.asm \
drivers/usbstor.obj:DRIVERS/USBSTOR.OBJ:$(KERNEL)/drivers/usbstor.asm \ drivers/usbstor.obj:DRIVERS/USBSTOR.OBJ:$(KERNEL)/drivers/usbstor.asm \
drivers/vt823x.obj:DRIVERS/VT823X.OBJ:$(KERNEL)/drivers/vt823x.asm \ drivers/vt823x.obj:DRIVERS/VT823X.OBJ:$(KERNEL)/drivers/vt823x.asm \
drivers/vidintel.obj:DRIVERS/VIDINTEL.OBJ:$(KERNEL)/drivers/vidintel.asm \
drivers/3c59x.obj:DRIVERS/3C59X.OBJ:$(REPOSITORY)/drivers/ethernet/3c59x.asm \ drivers/3c59x.obj:DRIVERS/3C59X.OBJ:$(REPOSITORY)/drivers/ethernet/3c59x.asm \
drivers/dec21x4x.obj:DRIVERS/DEC21X4X.OBJ:$(REPOSITORY)/drivers/ethernet/dec21x4x.asm \ drivers/dec21x4x.obj:DRIVERS/DEC21X4X.OBJ:$(REPOSITORY)/drivers/ethernet/dec21x4x.asm \
drivers/forcedeth.sys:DRIVERS/FORCEDETH.SYS:$(REPOSITORY)/drivers/ethernet/forcedeth.asm \
drivers/i8254x.sys:DRIVERS/I8254X.SYS:$(REPOSITORY)/drivers/ethernet/i8254x.asm \
drivers/i8255x.sys:DRIVERS/I8255X.SYS:$(REPOSITORY)/drivers/ethernet/i8255x.asm \
drivers/mtd80x.sys:DRIVERS/MTD80X.SYS:$(REPOSITORY)/drivers/ethernet/mtd80x.asm \
drivers/pcnet32.sys:DRIVERS/PCNET32.SYS:$(REPOSITORY)/drivers/ethernet/pcnet32.asm \
drivers/r6040.sys:DRIVERS/R6040.SYS:$(REPOSITORY)/drivers/ethernet/R6040.asm \
drivers/rhine.sys:DRIVERS/RHINE.SYS:$(REPOSITORY)/drivers/ethernet/rhine.asm \
drivers/rtl8029.sys:DRIVERS/RTL8029.SYS:$(REPOSITORY)/drivers/ethernet/RTL8029.asm \
drivers/rtl8139.obj:DRIVERS/RTL8139.OBJ:$(REPOSITORY)/drivers/ethernet/RTL8139.asm \ drivers/rtl8139.obj:DRIVERS/RTL8139.OBJ:$(REPOSITORY)/drivers/ethernet/RTL8139.asm \
drivers/rtl8169.obj:DRIVERS/RTL8169.OBJ:$(REPOSITORY)/drivers/ethernet/RTL8169.asm \ drivers/rtl8169.obj:DRIVERS/RTL8169.OBJ:$(REPOSITORY)/drivers/ethernet/RTL8169.asm \
drivers/sis900.sys:DRIVERS/SIS900.SYS:$(REPOSITORY)/drivers/ethernet/sis900.asm \
drivers/uhci.sys:DRIVERS/UHCI.SYS:$(REPOSITORY)/drivers/usb/uhci.asm \
drivers/ohci.sys:DRIVERS/OHCI.SYS:$(REPOSITORY)/drivers/usb/ohci.asm \
drivers/ehci.sys:DRIVERS/EHCI.SYS:$(REPOSITORY)/drivers/usb/ehci.asm \
drivers/rdc.sys:DRIVERS/RDC.SYS:$(REPOSITORY)/drivers/video/rdc.asm \
File|Managers/kfar:File|Managers/KFAR:$(PROGS)/fs/kfar/trunk/kfar.asm \ File|Managers/kfar:File|Managers/KFAR:$(PROGS)/fs/kfar/trunk/kfar.asm \
File|Managers/kfm:File|Managers/KFM:$(PROGS)/fs/kfm/trunk/kfm.asm \ File|Managers/kfm:File|Managers/KFM:$(PROGS)/fs/kfm/trunk/kfm.asm \
File|Managers/opendial:File|Managers/OPENDIAL:$(PROGS)/fs/opendial/opendial.asm \ File|Managers/opendial:File|Managers/OPENDIAL:$(PROGS)/fs/opendial/opendial.asm \
@ -212,6 +198,23 @@ FASM_PROGRAMS:=\
network/ircc:NETWORK/IRCC:$(PROGS)/network/ircc/ircc.asm \ network/ircc:NETWORK/IRCC:$(PROGS)/network/ircc/ircc.asm \
network/downloader:NETWORK/DOWNLOADER:$(PROGS)/network/downloader/downloader.asm \ network/downloader:NETWORK/DOWNLOADER:$(PROGS)/network/downloader/downloader.asm \
# end of list # end of list
# Same as above with PE stripping as extra step.
FASM_PROGRAMS_PESTRIP:=\
drivers/vidintel.sys:DRIVERS/VIDINTEL.SYS:$(REPOSITORY)/drivers/vidintel.asm \
drivers/forcedeth.sys:DRIVERS/FORCEDETH.SYS:$(REPOSITORY)/drivers/ethernet/forcedeth.asm \
drivers/i8254x.sys:DRIVERS/I8254X.SYS:$(REPOSITORY)/drivers/ethernet/i8254x.asm \
drivers/i8255x.sys:DRIVERS/I8255X.SYS:$(REPOSITORY)/drivers/ethernet/i8255x.asm \
drivers/mtd80x.sys:DRIVERS/MTD80X.SYS:$(REPOSITORY)/drivers/ethernet/mtd80x.asm \
drivers/pcnet32.sys:DRIVERS/PCNET32.SYS:$(REPOSITORY)/drivers/ethernet/pcnet32.asm \
drivers/r6040.sys:DRIVERS/R6040.SYS:$(REPOSITORY)/drivers/ethernet/R6040.asm \
drivers/rhine.sys:DRIVERS/RHINE.SYS:$(REPOSITORY)/drivers/ethernet/rhine.asm \
drivers/rtl8029.sys:DRIVERS/RTL8029.SYS:$(REPOSITORY)/drivers/ethernet/RTL8029.asm \
drivers/sis900.sys:DRIVERS/SIS900.SYS:$(REPOSITORY)/drivers/ethernet/sis900.asm \
drivers/uhci.sys:DRIVERS/UHCI.SYS:$(REPOSITORY)/drivers/usb/uhci.asm \
drivers/ohci.sys:DRIVERS/OHCI.SYS:$(REPOSITORY)/drivers/usb/ohci.asm \
drivers/ehci.sys:DRIVERS/EHCI.SYS:$(REPOSITORY)/drivers/usb/ehci.asm \
drivers/rdc.sys:DRIVERS/RDC.SYS:$(REPOSITORY)/drivers/video/rdc.asm \
# end of list
# The list of all FASM programs with one main FASM file for CD image. # The list of all FASM programs with one main FASM file for CD image.
# Format of an item is exactly the same as in the previous list. # Format of an item is exactly the same as in the previous list.
FASM_PROGRAMS_CD:=\ FASM_PROGRAMS_CD:=\
@ -439,9 +442,16 @@ fimage=$(call respace,$(call imagepart,$(f)))
fsource=$(call respace,$(call sourcepart,$(f))) fsource=$(call respace,$(call sourcepart,$(f)))
fparam=$(call respace,$(call parampart,$(f))) fparam=$(call respace,$(call parampart,$(f)))
# Add stripped PE files produced by fasm to FASM_NOKPACK_PROGRAMS.
include Makefile.pestrip
FASM_NOKPACK_PROGRAMS:=$(FASM_NOKPACK_PROGRAMS) \
$(foreach f,$(FASM_PROGRAMS_PESTRIP),$(fbinary).full:-:$(fsource))
$(foreach f,$(FASM_PROGRAMS_PESTRIP),$(eval $(call pestrip_meta_rule,$(fbinary),$(fbinary).full)))
# Define targets for image file. # Define targets for image file.
# Join all the lists above. # Join all the lists above.
targets_full:=$(COPY_FILES) $(FASM_PROGRAMS) $(NASM_PROGRAMS) $(OTHER_FILES) $(CMM_PROGRAMS) targets_full:=$(COPY_FILES) $(FASM_PROGRAMS) $(FASM_PROGRAMS_PESTRIP) $(NASM_PROGRAMS) $(OTHER_FILES) $(CMM_PROGRAMS)
# For each item in the united list call fbinary. # For each item in the united list call fbinary.
targets:=$(foreach f,$(targets_full),$(fbinary)) targets:=$(foreach f,$(targets_full),$(fbinary))

11
data/it/Makefile.pestrip Normal file
View File

@ -0,0 +1,11 @@
# This is not a independent Makefile; it is auxiliary file
# included from main Makefile.
# The arguments of macro pestrip_meta_rule:
# $(1) = name of stripped file,
# $(2) = name of input file
define pestrip_meta_rule
$(1): $(2) Makefile.pestrip
EXENAME="$$<" fasm ../common/pestrip.asm "$$@"
kpack --nologo "$$@"
endef

View File

@ -136,24 +136,10 @@ FASM_PROGRAMS:=\
drivers/usbhid.obj:DRIVERS/USBHID.OBJ:$(KERNEL)/drivers/usbhid/usbhid.asm \ drivers/usbhid.obj:DRIVERS/USBHID.OBJ:$(KERNEL)/drivers/usbhid/usbhid.asm \
drivers/usbstor.obj:DRIVERS/USBSTOR.OBJ:$(KERNEL)/drivers/usbstor.asm \ drivers/usbstor.obj:DRIVERS/USBSTOR.OBJ:$(KERNEL)/drivers/usbstor.asm \
drivers/vt823x.obj:DRIVERS/VT823X.OBJ:$(KERNEL)/drivers/vt823x.asm \ drivers/vt823x.obj:DRIVERS/VT823X.OBJ:$(KERNEL)/drivers/vt823x.asm \
drivers/vidintel.obj:DRIVERS/VIDINTEL.OBJ:$(KERNEL)/drivers/vidintel.asm \
drivers/3c59x.obj:DRIVERS/3C59X.OBJ:$(REPOSITORY)/drivers/ethernet/3c59x.asm \ drivers/3c59x.obj:DRIVERS/3C59X.OBJ:$(REPOSITORY)/drivers/ethernet/3c59x.asm \
drivers/dec21x4x.obj:DRIVERS/DEC21X4X.OBJ:$(REPOSITORY)/drivers/ethernet/dec21x4x.asm \ drivers/dec21x4x.obj:DRIVERS/DEC21X4X.OBJ:$(REPOSITORY)/drivers/ethernet/dec21x4x.asm \
drivers/forcedeth.sys:DRIVERS/FORCEDETH.SYS:$(REPOSITORY)/drivers/ethernet/forcedeth.asm \
drivers/i8254x.sys:DRIVERS/I8254X.SYS:$(REPOSITORY)/drivers/ethernet/i8254x.asm \
drivers/i8255x.sys:DRIVERS/I8255X.SYS:$(REPOSITORY)/drivers/ethernet/i8255x.asm \
drivers/mtd80x.sys:DRIVERS/MTD80X.SYS:$(REPOSITORY)/drivers/ethernet/mtd80x.asm \
drivers/pcnet32.sys:DRIVERS/PCNET32.SYS:$(REPOSITORY)/drivers/ethernet/pcnet32.asm \
drivers/r6040.sys:DRIVERS/R6040.SYS:$(REPOSITORY)/drivers/ethernet/R6040.asm \
drivers/rhine.sys:DRIVERS/RHINE.SYS:$(REPOSITORY)/drivers/ethernet/rhine.asm \
drivers/rtl8029.sys:DRIVERS/RTL8029.SYS:$(REPOSITORY)/drivers/ethernet/RTL8029.asm \
drivers/rtl8139.obj:DRIVERS/RTL8139.OBJ:$(REPOSITORY)/drivers/ethernet/RTL8139.asm \ drivers/rtl8139.obj:DRIVERS/RTL8139.OBJ:$(REPOSITORY)/drivers/ethernet/RTL8139.asm \
drivers/rtl8169.obj:DRIVERS/RTL8169.OBJ:$(REPOSITORY)/drivers/ethernet/RTL8169.asm \ drivers/rtl8169.obj:DRIVERS/RTL8169.OBJ:$(REPOSITORY)/drivers/ethernet/RTL8169.asm \
drivers/sis900.sys:DRIVERS/SIS900.SYS:$(REPOSITORY)/drivers/ethernet/sis900.asm \
drivers/uhci.sys:DRIVERS/UHCI.SYS:$(REPOSITORY)/drivers/usb/uhci.asm \
drivers/ohci.sys:DRIVERS/OHCI.SYS:$(REPOSITORY)/drivers/usb/ohci.asm \
drivers/ehci.sys:DRIVERS/EHCI.SYS:$(REPOSITORY)/drivers/usb/ehci.asm \
drivers/rdc.sys:DRIVERS/RDC.SYS:$(REPOSITORY)/drivers/video/rdc.asm \
File|Managers/kfar:File|Managers/KFAR:$(PROGS)/fs/kfar/trunk/kfar.asm \ File|Managers/kfar:File|Managers/KFAR:$(PROGS)/fs/kfar/trunk/kfar.asm \
File|Managers/kfm:File|Managers/KFM:$(PROGS)/fs/kfm/trunk/kfm.asm \ File|Managers/kfm:File|Managers/KFM:$(PROGS)/fs/kfm/trunk/kfm.asm \
File|Managers/opendial:File|Managers/OPENDIAL:$(PROGS)/fs/opendial/opendial.asm \ File|Managers/opendial:File|Managers/OPENDIAL:$(PROGS)/fs/opendial/opendial.asm \
@ -212,6 +198,23 @@ FASM_PROGRAMS:=\
network/ircc:NETWORK/IRCC:$(PROGS)/network/ircc/ircc.asm \ network/ircc:NETWORK/IRCC:$(PROGS)/network/ircc/ircc.asm \
network/downloader:NETWORK/DOWNLOADER:$(PROGS)/network/downloader/downloader.asm \ network/downloader:NETWORK/DOWNLOADER:$(PROGS)/network/downloader/downloader.asm \
# end of list # end of list
# Same as above with PE stripping as extra step.
FASM_PROGRAMS_PESTRIP:=\
drivers/vidintel.sys:DRIVERS/VIDINTEL.SYS:$(REPOSITORY)/drivers/video/vidintel.asm \
drivers/forcedeth.sys:DRIVERS/FORCEDETH.SYS:$(REPOSITORY)/drivers/ethernet/forcedeth.asm \
drivers/i8254x.sys:DRIVERS/I8254X.SYS:$(REPOSITORY)/drivers/ethernet/i8254x.asm \
drivers/i8255x.sys:DRIVERS/I8255X.SYS:$(REPOSITORY)/drivers/ethernet/i8255x.asm \
drivers/mtd80x.sys:DRIVERS/MTD80X.SYS:$(REPOSITORY)/drivers/ethernet/mtd80x.asm \
drivers/pcnet32.sys:DRIVERS/PCNET32.SYS:$(REPOSITORY)/drivers/ethernet/pcnet32.asm \
drivers/r6040.sys:DRIVERS/R6040.SYS:$(REPOSITORY)/drivers/ethernet/R6040.asm \
drivers/rhine.sys:DRIVERS/RHINE.SYS:$(REPOSITORY)/drivers/ethernet/rhine.asm \
drivers/rtl8029.sys:DRIVERS/RTL8029.SYS:$(REPOSITORY)/drivers/ethernet/RTL8029.asm \
drivers/sis900.sys:DRIVERS/SIS900.SYS:$(REPOSITORY)/drivers/ethernet/sis900.asm \
drivers/uhci.sys:DRIVERS/UHCI.SYS:$(REPOSITORY)/drivers/usb/uhci.asm \
drivers/ohci.sys:DRIVERS/OHCI.SYS:$(REPOSITORY)/drivers/usb/ohci.asm \
drivers/ehci.sys:DRIVERS/EHCI.SYS:$(REPOSITORY)/drivers/usb/ehci.asm \
drivers/rdc.sys:DRIVERS/RDC.SYS:$(REPOSITORY)/drivers/video/rdc.asm \
# end of list
# The list of all FASM programs with one main FASM file for CD image. # The list of all FASM programs with one main FASM file for CD image.
# Format of an item is exactly the same as in the previous list. # Format of an item is exactly the same as in the previous list.
FASM_PROGRAMS_CD:=\ FASM_PROGRAMS_CD:=\
@ -467,9 +470,15 @@ fimage=$(call respace,$(call imagepart,$(f)))
fsource=$(call respace,$(call sourcepart,$(f))) fsource=$(call respace,$(call sourcepart,$(f)))
fparam=$(call respace,$(call parampart,$(f))) fparam=$(call respace,$(call parampart,$(f)))
# Add stripped PE files produced by fasm to FASM_NOKPACK_PROGRAMS.
include Makefile.pestrip
FASM_NOKPACK_PROGRAMS:=$(FASM_NOKPACK_PROGRAMS) \
$(foreach f,$(FASM_PROGRAMS_PESTRIP),$(fbinary).full:-:$(fsource))
$(foreach f,$(FASM_PROGRAMS_PESTRIP),$(eval $(call pestrip_meta_rule,$(fbinary),$(fbinary).full)))
# Define targets for image file. # Define targets for image file.
# Join all the lists above. # Join all the lists above.
targets_full:=$(COPY_FILES) $(FASM_PROGRAMS) $(NASM_PROGRAMS) $(OTHER_FILES) $(CMM_PROGRAMS) targets_full:=$(COPY_FILES) $(FASM_PROGRAMS) $(FASM_PROGRAMS_PESTRIP) $(NASM_PROGRAMS) $(OTHER_FILES) $(CMM_PROGRAMS)
# For each item in the united list call fbinary. # For each item in the united list call fbinary.
targets:=$(foreach f,$(targets_full),$(fbinary)) targets:=$(foreach f,$(targets_full),$(fbinary))

11
data/rus/Makefile.pestrip Normal file
View File

@ -0,0 +1,11 @@
# This is not a independent Makefile; it is auxiliary file
# included from main Makefile.
# The arguments of macro pestrip_meta_rule:
# $(1) = name of stripped file,
# $(2) = name of input file
define pestrip_meta_rule
$(1): $(2) Makefile.pestrip
EXENAME="$$<" fasm ../common/pestrip.asm "$$@"
kpack --nologo "$$@"
endef

View File

@ -135,24 +135,10 @@ FASM_PROGRAMS:=\
drivers/usbhid.obj:DRIVERS/USBHID.OBJ:$(KERNEL)/drivers/usbhid/usbhid.asm \ drivers/usbhid.obj:DRIVERS/USBHID.OBJ:$(KERNEL)/drivers/usbhid/usbhid.asm \
drivers/usbstor.obj:DRIVERS/USBSTOR.OBJ:$(KERNEL)/drivers/usbstor.asm \ drivers/usbstor.obj:DRIVERS/USBSTOR.OBJ:$(KERNEL)/drivers/usbstor.asm \
drivers/vt823x.obj:DRIVERS/VT823X.OBJ:$(KERNEL)/drivers/vt823x.asm \ drivers/vt823x.obj:DRIVERS/VT823X.OBJ:$(KERNEL)/drivers/vt823x.asm \
drivers/vidintel.obj:DRIVERS/VIDINTEL.OBJ:$(KERNEL)/drivers/vidintel.asm \
drivers/3c59x.obj:DRIVERS/3C59X.OBJ:$(REPOSITORY)/drivers/ethernet/3c59x.asm \ drivers/3c59x.obj:DRIVERS/3C59X.OBJ:$(REPOSITORY)/drivers/ethernet/3c59x.asm \
drivers/dec21x4x.obj:DRIVERS/DEC21X4X.OBJ:$(REPOSITORY)/drivers/ethernet/dec21x4x.asm \ drivers/dec21x4x.obj:DRIVERS/DEC21X4X.OBJ:$(REPOSITORY)/drivers/ethernet/dec21x4x.asm \
drivers/forcedeth.sys:DRIVERS/FORCEDETH.SYS:$(REPOSITORY)/drivers/ethernet/forcedeth.asm \
drivers/i8254x.sys:DRIVERS/I8254X.SYS:$(REPOSITORY)/drivers/ethernet/i8254x.asm \
drivers/i8255x.sys:DRIVERS/I8255X.SYS:$(REPOSITORY)/drivers/ethernet/i8255x.asm \
drivers/mtd80x.sys:DRIVERS/MTD80X.SYS:$(REPOSITORY)/drivers/ethernet/mtd80x.asm \
drivers/pcnet32.sys:DRIVERS/PCNET32.SYS:$(REPOSITORY)/drivers/ethernet/pcnet32.asm \
drivers/r6040.sys:DRIVERS/R6040.SYS:$(REPOSITORY)/drivers/ethernet/R6040.asm \
drivers/rhine.sys:DRIVERS/RHINE.SYS:$(REPOSITORY)/drivers/ethernet/rhine.asm \
drivers/rtl8029.sys:DRIVERS/RTL8029.SYS:$(REPOSITORY)/drivers/ethernet/RTL8029.asm \
drivers/rtl8139.obj:DRIVERS/RTL8139.OBJ:$(REPOSITORY)/drivers/ethernet/RTL8139.asm \ drivers/rtl8139.obj:DRIVERS/RTL8139.OBJ:$(REPOSITORY)/drivers/ethernet/RTL8139.asm \
drivers/rtl8169.obj:DRIVERS/RTL8169.OBJ:$(REPOSITORY)/drivers/ethernet/RTL8169.asm \ drivers/rtl8169.obj:DRIVERS/RTL8169.OBJ:$(REPOSITORY)/drivers/ethernet/RTL8169.asm \
drivers/sis900.sys:DRIVERS/SIS900.SYS:$(REPOSITORY)/drivers/ethernet/sis900.asm \
drivers/uhci.sys:DRIVERS/UHCI.SYS:$(REPOSITORY)/drivers/usb/uhci.asm \
drivers/ohci.sys:DRIVERS/OHCI.SYS:$(REPOSITORY)/drivers/usb/ohci.asm \
drivers/ehci.sys:DRIVERS/EHCI.SYS:$(REPOSITORY)/drivers/usb/ehci.asm \
drivers/rdc.sys:DRIVERS/RDC.SYS:$(REPOSITORY)/drivers/video/rdc.asm \
File|Managers/kfar:File|Managers/KFAR:$(PROGS)/fs/kfar/trunk/kfar.asm \ File|Managers/kfar:File|Managers/KFAR:$(PROGS)/fs/kfar/trunk/kfar.asm \
File|Managers/kfm:File|Managers/KFM:$(PROGS)/fs/kfm/trunk/kfm.asm \ File|Managers/kfm:File|Managers/KFM:$(PROGS)/fs/kfm/trunk/kfm.asm \
File|Managers/opendial:File|Managers/OPENDIAL:$(PROGS)/fs/opendial/opendial.asm \ File|Managers/opendial:File|Managers/OPENDIAL:$(PROGS)/fs/opendial/opendial.asm \
@ -212,6 +198,23 @@ FASM_PROGRAMS:=\
network/ircc:NETWORK/IRCC:$(PROGS)/network/ircc/ircc.asm \ network/ircc:NETWORK/IRCC:$(PROGS)/network/ircc/ircc.asm \
network/downloader:NETWORK/DOWNLOADER:$(PROGS)/network/downloader/downloader.asm \ network/downloader:NETWORK/DOWNLOADER:$(PROGS)/network/downloader/downloader.asm \
# end of list # end of list
# Same as above with PE stripping as extra step.
FASM_PROGRAMS_PESTRIP:=\
drivers/vidintel.sys:DRIVERS/VIDINTEL.SYS:$(REPOSITORY)/drivers/vidintel.asm \
drivers/forcedeth.sys:DRIVERS/FORCEDETH.SYS:$(REPOSITORY)/drivers/ethernet/forcedeth.asm \
drivers/i8254x.sys:DRIVERS/I8254X.SYS:$(REPOSITORY)/drivers/ethernet/i8254x.asm \
drivers/i8255x.sys:DRIVERS/I8255X.SYS:$(REPOSITORY)/drivers/ethernet/i8255x.asm \
drivers/mtd80x.sys:DRIVERS/MTD80X.SYS:$(REPOSITORY)/drivers/ethernet/mtd80x.asm \
drivers/pcnet32.sys:DRIVERS/PCNET32.SYS:$(REPOSITORY)/drivers/ethernet/pcnet32.asm \
drivers/r6040.sys:DRIVERS/R6040.SYS:$(REPOSITORY)/drivers/ethernet/R6040.asm \
drivers/rhine.sys:DRIVERS/RHINE.SYS:$(REPOSITORY)/drivers/ethernet/rhine.asm \
drivers/rtl8029.sys:DRIVERS/RTL8029.SYS:$(REPOSITORY)/drivers/ethernet/RTL8029.asm \
drivers/sis900.sys:DRIVERS/SIS900.SYS:$(REPOSITORY)/drivers/ethernet/sis900.asm \
drivers/uhci.sys:DRIVERS/UHCI.SYS:$(REPOSITORY)/drivers/usb/uhci.asm \
drivers/ohci.sys:DRIVERS/OHCI.SYS:$(REPOSITORY)/drivers/usb/ohci.asm \
drivers/ehci.sys:DRIVERS/EHCI.SYS:$(REPOSITORY)/drivers/usb/ehci.asm \
drivers/rdc.sys:DRIVERS/RDC.SYS:$(REPOSITORY)/drivers/video/rdc.asm \
# end of list
# The list of all FASM programs with one main FASM file for CD image. # The list of all FASM programs with one main FASM file for CD image.
# Format of an item is exactly the same as in the previous list. # Format of an item is exactly the same as in the previous list.
FASM_PROGRAMS_CD:=\ FASM_PROGRAMS_CD:=\
@ -445,9 +448,15 @@ fimage=$(call respace,$(call imagepart,$(f)))
fsource=$(call respace,$(call sourcepart,$(f))) fsource=$(call respace,$(call sourcepart,$(f)))
fparam=$(call respace,$(call parampart,$(f))) fparam=$(call respace,$(call parampart,$(f)))
# Add stripped PE files produced by fasm to FASM_NOKPACK_PROGRAMS.
include Makefile.pestrip
FASM_NOKPACK_PROGRAMS:=$(FASM_NOKPACK_PROGRAMS) \
$(foreach f,$(FASM_PROGRAMS_PESTRIP),$(fbinary).full:-:$(fsource))
$(foreach f,$(FASM_PROGRAMS_PESTRIP),$(eval $(call pestrip_meta_rule,$(fbinary),$(fbinary).full)))
# Define targets for image file. # Define targets for image file.
# Join all the lists above. # Join all the lists above.
targets_full:=$(COPY_FILES) $(FASM_PROGRAMS) $(NASM_PROGRAMS) $(OTHER_FILES) $(CMM_PROGRAMS) targets_full:=$(COPY_FILES) $(FASM_PROGRAMS) $(FASM_PROGRAMS_PESTRIP) $(NASM_PROGRAMS) $(OTHER_FILES) $(CMM_PROGRAMS)
# For each item in the united list call fbinary. # For each item in the united list call fbinary.
targets:=$(foreach f,$(targets_full),$(fbinary)) targets:=$(foreach f,$(targets_full),$(fbinary))

11
data/sp/Makefile.pestrip Normal file
View File

@ -0,0 +1,11 @@
# This is not a independent Makefile; it is auxiliary file
# included from main Makefile.
# The arguments of macro pestrip_meta_rule:
# $(1) = name of stripped file,
# $(2) = name of input file
define pestrip_meta_rule
$(1): $(2) Makefile.pestrip
EXENAME="$$<" fasm ../common/pestrip.asm "$$@"
kpack --nologo "$$@"
endef

467
drivers/video/vidintel.asm Normal file
View File

@ -0,0 +1,467 @@
; Stub of videodriver for Intel videocards.
; (c) CleverMouse
; When the start procedure gots control,
; it tries to detect preferred resolution,
; sets the detected resolution assuming 32-bpp VESA mode and exits
; (without registering a service).
; Detection can be overloaded with compile-time settings
; use_predefined_mode/predefined_width/predefined_height.
; set predefined resolution here
use_predefined_mode = 0;1
predefined_width = 0;1366
predefined_height = 0;768
; standard driver stuff; target OS version = 0.80
format PE DLL native 0.80
entry START
__DEBUG__ equ 1
__DEBUG_LEVEL__ equ 1
section '.flat' readable writable executable
include '../proc32.inc'
include '../struct.inc'
include '../macros.inc'
;include 'fdo.inc'
DEBUG = 1
; the start procedure (see the description above)
START:
; 1. Detect device. Abort if not found.
push esi
call DetectDevice
test esi, esi
jz .return0
; 2. Detect optimal mode unless the mode is given explicitly. Abort if failed.
if use_predefined_mode = 0
call DetectMode
end if
cmp [width], 0
jz .return0_cleanup
; 3. Set the detected mode.
call SetMode
; 4. Cleanup and return.
.return0_cleanup:
invoke FreeKernelSpace, esi
.return0:
pop esi
xor eax, eax
ret
; check that there is Intel videocard
; if so, map MMIO registers and set internal variables
; esi points to MMIO block; NULL means no device
DetectDevice:
; 1. Sanity check: check that we are dealing with Intel videocard.
; Integrated video device for Intel is always at PCI:0:2:0.
xor esi, esi ; initialize return value to NULL
; 1a. Get PCI VendorID and DeviceID.
push esi
push 10h
push esi
invoke PciRead32
; 1b. loword(eax) = ax = VendorID, hiword(eax) = DeviceID.
; Test whether we have Intel chipset.
cmp ax, 8086h
jnz .return
; 1c. Say hi including DeviceID.
shr eax, 10h
push edi
pusha
mov edi, pciid_text
call WriteWord
mov esi, hellomsg
invoke SysMsgBoardStr
popa
; 1d. Test whether we know this DeviceID.
; If this is the case, remember the position of the device in line of Intel cards;
; this knowledge will be useful later.
; Tested on devices with id: 8086:0046, partially 8086:2A02.
mov ecx, pciids_num
mov edi, pciids
repnz scasw
pop edi
jnz .return_unknown_pciid
sub ecx, pciids_num - 1
neg ecx
mov [deviceType], ecx
; 1e. Continue saying hi with positive intonation.
pusha
mov esi, knownmsg
invoke SysMsgBoardStr
popa
; 2. Prepare MMIO region to control the card.
; 2a. Read MMIO physical address from PCI config space.
push 10h
cmp ecx, i9xx_start
jae @f
mov byte [esp], 14h
@@:
push 10h
push esi
invoke PciRead32
; 2b. Mask out PCI region type, lower 4 bits.
and al, not 0xF
; 2c. Create virtual mapping of the physical memory.
push 1Bh
push 100000h
push eax
invoke MapIoMem
; 3. Return.
xchg esi, eax
.return:
ret
; 1f. If we do not know DeviceID, continue saying hi with negative intonation.
.return_unknown_pciid:
pusha
mov esi, unknownmsg
invoke SysMsgBoardStr
popa
ret
; Convert word in ax to hexadecimal text in edi, advance edi.
WriteWord:
; 1. Convert high byte.
push eax
mov al, ah
call WriteByte
pop eax
; 2. Convert low byte.
; Fall through to WriteByte; ret from WriteByte is ret from WriteWord too.
; Convert byte in al to hexadecimal text in edi, advance edi.
WriteByte:
; 1. Convert high nibble.
push eax
shr al, 4
call WriteNibble
pop eax
; 2. Convert low nibble.
and al, 0xF
; Fall through to WriteNibble; ret from WriteNibble is ret from WriteByte too.
; Convert nibble in al to hexadecimal text in edi, advance edi.
WriteNibble:
; Obvious, isn't it?
cmp al, 10
sbb al, 69h
das
stosb
ret
if use_predefined_mode = 0
; detect resolution of the flat panel
DetectMode:
push esi edi
; 1. Get the location of block of GMBUS* registers.
; Starting with Ironlake, GMBUS* registers were moved.
add esi, 5100h
cmp [deviceType], ironlake_start
jb @f
add esi, 0xC0000
@@:
; 2. Initialize GMBUS engine.
mov edi, edid
mov ecx, 0x10000
@@:
test byte [esi+8+1], 80h
loopnz @b
jnz .fail
mov dword [esi], 3
test byte [esi+8+1], 4
jz .noreset
call ResetGMBus
jnz .fail
.noreset:
; 3. Send read command.
and dword [esi+20h], 0
mov dword [esi+4], 4E8000A1h
; 4. Wait for data, writing to the buffer as data arrive.
.getdata:
mov ecx, 0x10000
@@:
test byte [esi+8+1], 8
loopz @b
test byte [esi+8+1], 4
jz .dataok
call ResetGMBus
jmp .fail
.dataok:
mov eax, [esi+0Ch]
stosd
cmp edi, edid+80h
jb .getdata
; 5. Wait for bus idle.
mov ecx, 0x10000
@@:
test byte [esi+8+1], 2
loopnz @b
; 6. We got EDID; dump it if DEBUG.
if DEBUG
pusha
xor ecx, ecx
mov esi, edid
mov edi, edid_text
.dumploop:
lodsb
call WriteByte
mov al, ' '
stosb
inc cl
test cl, 15
jnz @f
mov byte [edi-1], 13
mov al, 10
stosb
@@:
test cl, cl
jns .dumploop
mov esi, edidmsg
invoke SysMsgBoardStr
popa
end if
; 7. Test whether EDID is good.
; 7a. Signature: 00 FF FF FF FF FF FF 00.
mov esi, edid
cmp dword [esi], 0xFFFFFF00
jnz .fail
cmp dword [esi+4], 0x00FFFFFF
jnz .fail
; 7b. Checksum must be zero.
xor edx, edx
mov ecx, 80h
@@:
lodsb
add dl, al
loop @b
jnz .fail
; 8. Get width and height from EDID.
xor eax, eax
mov ah, [esi-80h+3Ah]
shr ah, 4
mov al, [esi-80h+38h]
mov [width], eax
mov ah, [esi-80h+3Dh]
shr ah, 4
mov al, [esi-80h+3Bh]
mov [height], eax
; 9. Return.
.fail:
pop edi esi
ret
; reset bus, clear all errors
ResetGMBus:
; look into the PRM
mov dword [esi+4], 80000000h
mov dword [esi+4], 0
mov ecx, 0x10000
@@:
test byte [esi+8+1], 2
loopnz @b
ret
end if
; set resolution [width]*[height]
SetMode:
; 1. Program the registers of videocard.
; look into the PRM
cli
; or byte [esi+7000Ah], 0Ch ; PIPEACONF: disable Display+Cursor Planes
; or byte [esi+7100Ah], 0Ch ; PIPEBCONF: disable Display+Cursor Planes
xor eax, eax
xor edx, edx
cmp [deviceType], i965_start
jb @f
mov dl, 9Ch - 84h
@@:
; or byte [esi+71403h], 80h ; VGACNTRL: VGA Display Disable
and byte [esi+70080h], not 27h ; CURACNTR: disable cursor A
mov dword [esi+70084h], eax ; CURABASE: force write to CURA* regs
and byte [esi+700C0h], not 27h ; CURBCNTR: disable cursor B
mov dword [esi+700C4h], eax ; CURBBASE: force write to CURB* regs
and byte [esi+70183h], not 80h ; DSPACNTR: disable Primary A Plane
mov dword [esi+edx+70184h], eax ; DSPALINOFF/DSPASURF: force write to DSPA* regs
and byte [esi+71183h], not 80h ; DSPBCNTR: disable Primary B Plane
mov dword [esi+edx+71184h], eax ; DSPBLINOFF/DSPBSURF: force write to DSPB* regs
if 1
cmp [deviceType], ironlake_start
jae .disable_pipes
mov edx, 10000h
or byte [esi+70024h], 2 ; PIPEASTAT: clear VBLANK status
or byte [esi+71024h], 2 ; PIPEBSTAT: clear VBLANK status
.wait_vblank_preironlake1:
mov ecx, 1000h
loop $
test byte [esi+7000Bh], 80h ; PIPEACONF: pipe A active?
jz @f
test byte [esi+70024h], 2 ; PIPEASTAT: got VBLANK?
jz .wait_vblank_preironlake2
@@:
test byte [esi+7100Bh], 80h ; PIPEBCONF: pipe B active?
jz .disable_pipes
test byte [esi+71024h], 2 ; PIPEBSTAT: got VBLANK?
jnz .disable_pipes
.wait_vblank_preironlake2:
dec edx
jnz .wait_vblank_preironlake1
jmp .not_disabled
.disable_pipes:
end if
and byte [esi+7000Bh], not 80h ; PIPEACONF: disable pipe
and byte [esi+7100Bh], not 80h ; PIPEBCONF: disable pipe
cmp [deviceType], gen4_start
jb .wait_watching_scanline
; g45 and later: use special flag from PIPE*CONF
mov edx, 10000h
@@:
mov ecx, 1000h
loop $
test byte [esi+7000Bh], 40h ; PIPEACONF: wait until pipe disabled
jz @f
dec edx
jnz @b
jmp .not_disabled
@@:
test byte [esi+7100Bh], 40h ; PIPEBCONF: wait until pipe disabled
jz .disabled
mov ecx, 1000h
loop $
dec edx
jnz @b
jmp .not_disabled
; pineview and before: wait while scanline still changes
.wait_watching_scanline:
mov edx, 1000h
.dis1:
push dword [esi+71000h]
push dword [esi+70000h]
mov ecx, 10000h
loop $
pop eax
xor eax, [esi+70000h]
and eax, 1FFFh
pop eax
jnz .notdis1
xor eax, [esi+71000h]
and eax, 1FFFh
jz .disabled
.notdis1:
dec edx
jnz .dis1
.not_disabled:
sti
jmp .return
.disabled:
lea eax, [esi+61183h]
cmp [deviceType], ironlake_start
jb @f
add eax, 0xE0000 - 0x60000
@@:
lea edx, [esi+60000h]
test byte [eax], 40h
jz @f
add edx, 1000h
@@:
mov eax, [width]
dec eax
shl eax, 16
mov ax, word [height]
dec eax
mov dword [edx+1Ch], eax ; PIPEASRC: set source image size
ror eax, 16
mov dword [edx+10190h], eax ; for old cards
mov ecx, [width]
add ecx, 15
and ecx, not 15
shl ecx, 2
mov dword [edx+10188h], ecx ; DSPASTRIDE: set scanline length
mov dword [edx+10184h], 0 ; DSPALINOFF: force write to DSPA* registers
and byte [esi+61233h], not 80h ; PFIT_CONTROL: disable panel fitting
or byte [edx+1000Bh], 80h ; PIPEACONF: enable pipe
; and byte [edx+1000Ah], not 0Ch ; PIPEACONF: enable Display+Cursor Planes
or byte [edx+10183h], 80h ; DSPACNTR: enable Display Plane A
sti
; 2. Notify the kernel that resolution has changed.
invoke GetDisplay
mov edx, [width]
mov dword [eax+8], edx
mov edx, [height]
mov dword [eax+0Ch], edx
mov [eax+18h], ecx
mov eax, [width]
dec eax
dec edx
invoke SetScreen
.return:
ret
include '../peimport.inc'
data fixups
end data
align 4
hellomsg db 'Intel videocard detected, PciId=8086:'
pciid_text db '0000'
db ', which is ', 0
knownmsg db 'known',13,10,0
unknownmsg db 'unknown',13,10,0
if DEBUG
edidmsg db 'EDID successfully read:',13,10
edid_text rb 8*(16*3+1)
db 0
end if
width dd predefined_width
height dd predefined_height
pciids:
dw 0x3577 ; i830m
dw 0x2562 ; 845g
dw 0x3582 ; i855gm
i865_start = ($ - pciids) / 2
dw 0x2572 ; i865g
i9xx_start = ($ - pciids) / 2
dw 0x2582 ; i915g
dw 0x258a ; e7221g (i915g)
dw 0x2592 ; i915gm
dw 0x2772 ; i945g
dw 0x27a2 ; i945gm
dw 0x27ae ; i945gme
i965_start = ($ - pciids) / 2
dw 0x2972 ; i946qz (i965g)
dw 0x2982 ; g35g (i965g)
dw 0x2992 ; i965q (i965g)
dw 0x29a2 ; i965g
dw 0x29b2 ; q35g
dw 0x29c2 ; g33g
dw 0x29d2 ; q33g
dw 0xa001 ; pineview
dw 0xa011 ; pineview
gen4_start = ($ - pciids) / 2
dw 0x2a02 ; i965gm
dw 0x2a12 ; i965gm
dw 0x2a42 ; gm45
dw 0x2e02 ; g45
dw 0x2e12 ; g45
dw 0x2e22 ; g45
dw 0x2e32 ; g45
dw 0x2e42 ; g45
dw 0x2e92 ; g45
ironlake_start = ($ - pciids) / 2
dw 0x0042 ; ironlake_d
dw 0x0046 ; ironlake_m
dw 0x0102 ; sandybridge_d
dw 0x0112 ; sandybridge_d
dw 0x0122 ; sandybridge_d
dw 0x0106 ; sandybridge_m
dw 0x0116 ; sandybridge_m
dw 0x0126 ; sandybridge_m
dw 0x010A ; sandybridge_d
pciids_num = ($ - pciids) / 2
align 4
deviceType dd ?
edid rb 0x80

View File

@ -619,6 +619,28 @@ struct COFF_SYM
NumAuxSymbols db ? NumAuxSymbols db ?
ends ends
struct STRIPPED_PE_HEADER
Signature dw ?
Characteristics dw ?
AddressOfEntryPoint dd ?
ImageBase dd ?
SectionAlignmentLog db ?
FileAlignmentLog db ?
MajorOSVersion db ?
MinorOSVersion db ?
SizeOfImage dd ?
SizeOfStackReserve dd ?
SizeOfHeapReserve dd ?
SizeOfHeaders dd ?
Subsystem db ?
NumberOfRvaAndSizes db ?
NumberOfSections dw ?
ends
STRIPPED_PE_SIGNATURE = 0x4503 ; 'PE' xor 'S'
SPE_DIRECTORY_IMPORT = 0
SPE_DIRECTORY_EXPORT = 1
SPE_DIRECTORY_BASERELOC = 2
struct IOCTL struct IOCTL
handle dd ? handle dd ?
io_code dd ? io_code dd ?

View File

@ -917,6 +917,8 @@ proc load_driver stdcall, driver_name:dword
test eax, eax test eax, eax
jz .exit jz .exit
lea edx, [file_name]
DEBUGF 1,'K : driver %s is COFF, deprecated\n',edx
mov [coff], eax mov [coff], eax
movzx ecx, [eax+COFF_HEADER.nSections] movzx ecx, [eax+COFF_HEADER.nSections]

View File

@ -24,15 +24,30 @@ proc load_PE stdcall, file_name:dword
mov [image], eax mov [image], eax
mov edx, [eax+60] mov edx, [eax+STRIPPED_PE_HEADER.SizeOfImage]
; mov cl, [eax+STRIPPED_PE_HEADER.Subsystem]
cmp word [eax], STRIPPED_PE_SIGNATURE
jz @f
stdcall kernel_alloc, [eax+80+edx] mov edx, [eax+60]
; mov cl, [eax+5Ch+edx]
mov edx, [eax+80+edx]
@@:
mov [entry], 0
; cmp cl, 1
; jnz .cleanup
stdcall kernel_alloc, edx
test eax, eax test eax, eax
jz .cleanup jz .cleanup
mov [base], eax mov [base], eax
stdcall map_PE, eax, [image] push ebx ebp
mov ebx, [image]
mov ebp, eax
call map_PE
pop ebp ebx
mov [entry], eax mov [entry], eax
test eax, eax test eax, eax
@ -48,199 +63,200 @@ proc load_PE stdcall, file_name:dword
ret ret
endp endp
DWORD equ dword map_PE: ;ebp=base:dword, ebx=image:dword
PTR equ
align 4
map_PE: ;stdcall base:dword, image:dword
cld
push ebp
push edi push edi
push esi push esi
push ebx sub esp, .locals_size
sub esp, 60 virtual at esp
mov ebx, DWORD PTR [esp+84] .numsections dd ?
mov ebp, DWORD PTR [esp+80] .import_names dd ?
mov edx, ebx .import_targets dd ?
mov esi, ebx .peheader dd ?
add edx, DWORD PTR [ebx+60] .bad_import dd ?
mov edi, ebp .import_idx dd ?
mov DWORD PTR [esp+32], edx .import_descr dd ?
mov ecx, DWORD PTR [edx+84] .relocs_rva dd ?
.relocs_size dd ?
.section_header_size dd ?
.AddressOfEntryPoint dd ?
.ImageBase dd ?
.locals_size = $ - esp
end virtual
cmp word [ebx], STRIPPED_PE_SIGNATURE
jz .stripped
mov edx, ebx
add edx, [ebx+60]
movzx eax, word [edx+6]
mov [.numsections], eax
mov eax, [edx+40]
mov [.AddressOfEntryPoint], eax
mov eax, [edx+52]
mov [.ImageBase], eax
mov ecx, [edx+84]
mov [.section_header_size], 40
mov eax, [edx+128]
mov [.import_descr], eax
mov eax, [edx+160]
mov [.relocs_rva], eax
mov eax, [edx+164]
mov [.relocs_size], eax
add edx, 256
jmp .common
.stripped:
mov eax, [ebx+STRIPPED_PE_HEADER.AddressOfEntryPoint]
mov [.AddressOfEntryPoint], eax
mov eax, [ebx+STRIPPED_PE_HEADER.ImageBase]
mov [.ImageBase], eax
movzx eax, [ebx+STRIPPED_PE_HEADER.NumberOfSections]
mov [.numsections], eax
movzx ecx, [ebx+STRIPPED_PE_HEADER.NumberOfRvaAndSizes]
xor eax, eax
mov [.relocs_rva], eax
mov [.relocs_size], eax
test ecx, ecx
jz @f
mov eax, [ebx+sizeof.STRIPPED_PE_HEADER+SPE_DIRECTORY_IMPORT*8]
@@:
mov [.import_descr], eax
cmp ecx, SPE_DIRECTORY_BASERELOC
jbe @f
mov eax, [ebx+sizeof.STRIPPED_PE_HEADER+SPE_DIRECTORY_BASERELOC*8]
mov [.relocs_rva], eax
mov eax, [ebx+sizeof.STRIPPED_PE_HEADER+SPE_DIRECTORY_BASERELOC*8+4]
mov [.relocs_size], eax
@@:
mov [.section_header_size], 28
lea edx, [ebx+ecx*8+sizeof.STRIPPED_PE_HEADER+8]
mov ecx, [ebx+STRIPPED_PE_HEADER.SizeOfHeaders]
.common:
mov esi, ebx
mov edi, ebp
shr ecx, 2 shr ecx, 2
rep movsd rep movsd
movzx eax, WORD PTR [edx+6] cmp [.numsections], 0
mov DWORD PTR [esp+36], 0 jz .nosections
mov DWORD PTR [esp+16], eax .copy_sections:
jmp L2 mov eax, [edx+8]
L3:
mov eax, DWORD PTR [edx+264]
test eax, eax test eax, eax
je L4 je .no_section_data
mov esi, ebx mov esi, ebx
mov edi, ebp mov edi, ebp
add esi, DWORD PTR [edx+268] add esi, [edx+12]
mov ecx, eax mov ecx, eax
add edi, DWORD PTR [edx+260] add edi, [edx+4]
add ecx, 3 add ecx, 3
shr ecx, 2 shr ecx, 2
rep movsd rep movsd
L4: .no_section_data:
mov ecx, DWORD PTR [edx+256] mov ecx, [edx]
cmp ecx, eax cmp ecx, eax
jbe L6 jbe .no_section_fill
sub ecx, eax sub ecx, eax
add eax, DWORD PTR [edx+260] add eax, [edx+4]
lea edi, [eax+ebp] lea edi, [eax+ebp]
xor eax, eax xor eax, eax
rep stosb rep stosb
L6: .no_section_fill:
inc DWORD PTR [esp+36] add edx, [.section_header_size]
add edx, 40 dec [.numsections]
L2: jnz .copy_sections
mov esi, DWORD PTR [esp+16] .nosections:
cmp DWORD PTR [esp+36], esi cmp [.relocs_size], 0
jne L3 je .no_relocations
mov edi, DWORD PTR [esp+32]
cmp DWORD PTR [edi+164], 0
je L9
pushd [edi+164]
mov esi, ebp mov esi, ebp
mov ecx, ebp mov ecx, ebp
sub esi, DWORD PTR [edi+52] sub esi, [.ImageBase]
add ecx, DWORD PTR [edi+160] add ecx, [.relocs_rva]
mov eax, esi .relocs_block:
shr eax, 16 mov edi, [ecx]
mov DWORD PTR [esp+16], eax add edi, ebp
L12: mov ebx, [ecx+4]
mov eax, [ecx+4] add ecx, 8
sub [esp], eax sub [.relocs_size], ebx
lea ebx, [eax-8] sub ebx, 8
xor edi, edi
shr ebx, 1 shr ebx, 1
jmp L13 jz .relocs_next_block
L14: .one_reloc:
movzx eax, WORD PTR [ecx+8+edi*2] movzx eax, word [ecx]
add ecx, 2
mov edx, eax mov edx, eax
shr eax, 12 shr eax, 12
and edx, 4095 and edx, 4095
add edx, DWORD PTR [ecx] cmp eax, 3
cmp ax, 2 jne @f
je L17 add [edx+edi], esi
cmp ax, 3 @@:
je L18 dec ebx
dec ax jnz .one_reloc
jne L15 .relocs_next_block:
mov eax, DWORD PTR [esp+16] cmp [.relocs_size], 0
add WORD PTR [edx+ebp], ax jg .relocs_block
L17: .no_relocations:
add WORD PTR [edx+ebp], si cmp [.import_descr], 0
L18: je .no_imports
add DWORD PTR [edx+ebp], esi add [.import_descr], ebp
L15: mov [.bad_import], 0
inc edi .import_block:
L13: mov ecx, [.import_descr]
cmp edi, ebx cmp dword [ecx+4], 0
jne L14 jne @f
add ecx, DWORD PTR [ecx+4] cmp dword [ecx+12], 0
L11: je .done_imports
cmp dword [esp], 0 @@:
jg L12 mov edx, dword [ecx]
pop eax mov ecx, dword [ecx+16]
L9:
mov edx, DWORD PTR [esp+32]
cmp DWORD PTR [edx+132], 0
je L20
mov eax, ebp
add eax, DWORD PTR [edx+128]
mov DWORD PTR [esp+40], 0
add eax, 20
mov DWORD PTR [esp+56], eax
L22:
mov ecx, DWORD PTR [esp+56]
cmp DWORD PTR [ecx-16], 0
jne L23
cmp DWORD PTR [ecx-8], 0
je L25
L23:
mov edi, DWORD PTR [__exports+32]
mov esi, DWORD PTR [__exports+28]
mov eax, DWORD PTR [esp+56]
mov DWORD PTR [esp+20], edi
add edi, OS_BASE
add esi, OS_BASE
mov DWORD PTR [esp+44], esi
mov ecx, DWORD PTR [eax-4]
mov DWORD PTR [esp+48], edi
mov edx, DWORD PTR [eax-20]
test edx, edx test edx, edx
jnz @f jnz @f
mov edx, ecx mov edx, ecx
@@: @@:
mov DWORD PTR [esp+52], 0 mov [.import_idx], 0
add ecx, ebp add ecx, ebp
add edx, ebp add edx, ebp
mov DWORD PTR [esp+24], edx mov [.import_names], edx
mov DWORD PTR [esp+28], ecx mov [.import_targets], ecx
L26: .import_func:
mov esi, DWORD PTR [esp+52] mov esi, [.import_idx]
mov edi, DWORD PTR [esp+24] mov edi, [.import_names]
mov eax, DWORD PTR [edi+esi*4] mov eax, [edi+esi*4]
test eax, eax test eax, eax
je L27 je .next_import_block
test eax, eax js .next_import_block
js L27
lea edi, [ebp+eax] lea edi, [ebp+eax]
mov eax, DWORD PTR [esp+28] mov eax, [.import_targets]
mov DWORD PTR [eax+esi*4], 0 mov dword [eax+esi*4], 0
lea esi, [edi+2] lea esi, [edi+2]
push eax movzx ebx, word [edi]
push 32 push 32
movzx eax, WORD PTR [edi] mov ecx, [__exports+32]
mov edx, DWORD PTR [esp+56] mov eax, [ecx+OS_BASE+ebx*4]
mov eax, DWORD PTR [edx+eax*4]
add eax, OS_BASE add eax, OS_BASE
push eax push eax
push esi push esi
call strncmp call strncmp
pop ebx test eax, eax
jz .import_func_found
xor ebx, ebx xor ebx, ebx
test eax, eax .import_func_candidate:
jne L32
jmp L30
L33:
push ecx
push 32 push 32
mov ecx, DWORD PTR [esp+28] mov ecx, [__exports+32]
mov eax, DWORD PTR [ecx+OS_BASE+ebx*4] mov eax, [ecx+OS_BASE+ebx*4]
add eax, OS_BASE add eax, OS_BASE
push eax push eax
push esi push esi
call strncmp call strncmp
pop edx
test eax, eax test eax, eax
jne L34 je .import_func_found
mov esi, DWORD PTR [esp+44]
mov edx, DWORD PTR [esp+52]
mov ecx, DWORD PTR [esp+28]
mov eax, DWORD PTR [esi+ebx*4]
add eax, OS_BASE
mov DWORD PTR [ecx+edx*4], eax
jmp L36
L34:
inc ebx inc ebx
L32: cmp ebx, [__exports+24]
cmp ebx, DWORD PTR [__exports+24] jb .import_func_candidate
jb L33
L36:
cmp ebx, DWORD PTR [__exports+24]
jne L37
mov esi, msg_unresolved mov esi, msg_unresolved
call sys_msg_board_str call sys_msg_board_str
@ -249,34 +265,30 @@ L36:
mov esi, msg_CR mov esi, msg_CR
call sys_msg_board_str call sys_msg_board_str
mov DWORD PTR [esp+40], 1 mov [.bad_import], 1
jmp L37 jmp .next_import_func
L30: .import_func_found:
movzx eax, WORD PTR [edi] mov esi, [__exports+28]
mov esi, DWORD PTR [esp+44] mov edx, [.import_idx]
mov edi, DWORD PTR [esp+52] mov ecx, [.import_targets]
mov edx, DWORD PTR [esp+28] mov eax, [esi+OS_BASE+ebx*4]
mov eax, DWORD PTR [esi+eax*4]
add eax, OS_BASE add eax, OS_BASE
mov DWORD PTR [edx+edi*4], eax mov [ecx+edx*4], eax
L37: .next_import_func:
inc DWORD PTR [esp+52] inc [.import_idx]
jmp L26 jmp .import_func
L27: .next_import_block:
add DWORD PTR [esp+56], 20 add [.import_descr], 20
jmp L22 jmp .import_block
L25: .done_imports:
xor eax, eax xor eax, eax
cmp DWORD PTR [esp+40], 0 cmp [.bad_import], 0
jne L40 jne @f
L20: .no_imports:
mov ecx, DWORD PTR [esp+32]
mov eax, ebp mov eax, ebp
add eax, DWORD PTR [ecx+40] add eax, [.AddressOfEntryPoint]
L40: @@:
add esp, 60 add esp, .locals_size
pop ebx
pop esi pop esi
pop edi pop edi
pop ebp ret
ret 8

View File

@ -150,7 +150,7 @@ msg_CR db 13,10,0
szHwMouse db 'ATI2D',0 szHwMouse db 'ATI2D',0
szPS2MDriver db 'PS2MOUSE',0 szPS2MDriver db 'PS2MOUSE',0
;szCOM_MDriver db 'COM_MOUSE',0 ;szCOM_MDriver db 'COM_MOUSE',0
szVidintel db 'vidintel',0 szVidintel db '/rd/1/drivers/vidintel.sys',0
szUSB db 'USB',0 szUSB db 'USB',0
szAtiHW db '/rd/1/drivers/ati2d.drv',0 szAtiHW db '/rd/1/drivers/ati2d.drv',0

View File

@ -918,7 +918,7 @@ end if
include "detect/vortex86.inc" ; Vortex86 SoC detection code include "detect/vortex86.inc" ; Vortex86 SoC detection code
stdcall load_driver, szVidintel stdcall load_pe_driver, szVidintel, 0
call usb_init call usb_init