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

[BUG]: Kernel UART prints twice on debug terminal #9797

Closed
israpps opened this issue Aug 14, 2023 · 1 comment
Closed

[BUG]: Kernel UART prints twice on debug terminal #9797

israpps opened this issue Aug 14, 2023 · 1 comment
Labels

Comments

@israpps
Copy link
Contributor

israpps commented Aug 14, 2023

Describe the Bug

Printing to EE UART via the kernel syscall for that makes PCSX2 write everything twice

i've made the following screenshots to display what I mean

but before, some reference links on the software involved on the test:

EE UART via vsnprintf
uart_homebrew

EE UART via Kernel printf
kernel_uart

Reproduction Steps

just run these and read terminal
UART_ISSUE_SAMPLE.zip

Expected Behavior

Only print kernel uart printf once on terminal

PCSX2 Revision

https://github.com/PCSX2/pcsx2/releases/download/v1.7.4919/pcsx2-v1.7.4919-windows-x64-Qt.7z

Operating System

Windows 10 (64bit)

If Linux - Specify Distro

No response

Logs & Dumps

PCSX2 Nightly - v1.7.4546 Compiled on May 31 2023
Savestate version: 0x9a360000

Host Machine Init:
	Operating System =  Microsoft Windows 10+
	Physical RAM     =  7981 MB
	CPU name         =  Intel(R) Core(TM) i5-1035G1 CPU @ 1.00GHz
	Vendor/Model     =  GenuineIntel (stepping 05)
	CPU speed        =  1.190 ghz (8 logical threads)
	x86PType         =  Standard OEM
	x86Flags         =  bfebfbff fedaf387
	x86EFlags        =  2c100800

x86 Features Detected:
	AVX AVX2

Reserving memory for recompilers...
	Fastmem area: 00000221FFF80000 - 00000222FFF7FFFF
Scanning C:\Users\Usuario\Documents\GitHub\KELFBinder\bin (recursively)
Current version: v1.7.4546
Latest SHA: v1.7.4919
Last Checked SHA: v1.7.4799
Update needed.
HLE Host: Set 'host:' root path to: C:\Users\Usuario\Documents\GitHub\PlayStation2-Basic-Bootloader\bin

Opening CDVD...
Opening GS...
D3D Adapter: Intel(R) UHD Graphics
Creating a 1920x948 flip-discard windowed swap chain
D3D11 Graphics Driver Info:
	D3D_FEATURE_LEVEL_11_0
	VID: 0x8086 PID: 0x8A56
	Intel(R) UHD Graphics
	Driver Version: 27.20.100.9079
Opening SPU2...
Initializing SndBuffer at sample rate of 48000...
(Cubeb) Using normal 2 speaker stereo output.
(Cubeb) Minimum latency: 10.00 ms (480 audio frames)
Opening PAD...
Opening DEV9...
Opening USB...
Opening FW...
McdSlot 0 [File]: C:\Users\Usuario\Desktop\pcsx2-v1.7.4546-windows-64bit-Qt\memcards\Mcd001.ps2
McdSlot 1 [File]: C:\Users\Usuario\Desktop\pcsx2-v1.7.4546-windows-64bit-Qt\memcards\Mcd002.ps2
EE/iR5900-32 Recompiler Reset
Vsync is OFF
	Bios Found: Japan   v01.00(17/01/2000)  Console 20000117-050310
	BIOS rom1 module not found, skipping...
	BIOS rom2 module not found, skipping...
VM subsystems initialized in 1158.27 ms
Game Changed:
  Name: Booting PS2 BIOS...
  Serial: 20000117-050310
  CRC: 00000000
[GameDB] Has not been initialized yet, initializing...
[GameDB] 11468 games on record (loaded in 62.75ms)
[GameDB] Searching for '20000117-050310' in GameDB
[GameDB] Could not find '20000117-050310' in GameDB
Applying settings...
Processor count: 4 cores, 8 processors
Cluster count: 1
Ordered processor list: 0, 2, 4, 6, 1[SMT 1], 3[SMT 1], 5[SMT 1], 7[SMT 1]
# Initialize memory (rev:3.17, ctm:393Mhz, cpuclk:295Mhz )

PlayStation 2 ======== Hard reset boot
 ROMGEN=2000-0117, IOP info (CPUID=1f, CACH_CONFIG=ffffffff, 2MB, IOP mode)
 <20000117-050310,ROMconf,:11232>
# Total accessable memory size: 32 MB (B:2:8:0)
# TLB spad=0 kernel=1:12 default=13:30 extended=31:38
# Initialize Start.
# Initialize GS ...
# Initialize INTC ...
# Initialize TIMER ...
# Initialize DMAC ...
# Initialize VU1 ...
# Initialize VIF1 ...
# Initialize GIF ...
# Initialize VU0 ...
# Initialize VIF0 ...
# Initialize IPU ...
# Initialize FPU ...
# Initialize User Memory ...
# Initialize Scratch Pad ...
# Initialize Done.

EE DECI2 Manager version 0.06 Dec 10 1999 17:48:37
  CPUID=2e20, BoardID=0, ROMGEN=2000-0117, 32M

ELF (host:C:\Users\Usuario\Documents\GitHub\PlayStation2-Basic-Bootloader\bin\PS2BBL.ELF) Game CRC = 0xEAE22EC0, EntryPoint = 0x00100A78


IOP Realtime Kernel Ver.0.9.1

    Copyright 1999 (C) Sony Computer Entertainment Inc. 

Reboot service module.(99/11/10)
cdvd driver module version 0.1.1 (C)SCEI
Load File service.(99/11/05)
Multi Threaded Fileio module.(99/11/15) 
iop heap service (99/11/03)
loadelf: fname host:C:¥Users¥Usuario¥Documents¥GitHub¥PlayStation2-Basic-Bootloader¥bin¥PS2BBL.ELF secname all
loadelf version 3.30
Input ELF format filename = host:C:¥Users¥Usuario¥Documents¥GitHub¥PlayStation2-Basic-Bootloader¥bin¥PS2BBL.ELF
1 00100000 00032514 ....
Loaded, host:C:¥Users¥Usuario¥Documents¥GitHub¥PlayStation2-Basic-Bootloader¥bin¥PS2BBL.ELF
start address 0x100a78
gp address 00000000
# Loader 'host:C:¥Users¥Usuario¥Documents¥GitHub¥PlayStation2-Basic-Bootloader¥bin¥PS2BBL.ELF':pc=00100a78
Elf entry point @ 0x00100a78 about to get recompiled. Load patches first.
[GameDB] Searching for 'eae22ec0' in GameDB
[GameDB] Could not find 'eae22ec0' in GameDB
[GameDB] Searching for 'eae22ec0' in GameDB
[GameDB] Could not find 'eae22ec0' in GameDB
Game Changed:
  Name: 
  Serial: eae22ec0
  CRC: EAE22EC0
Applying settings...
[GameDB] Searching for 'eae22ec0' in GameDB
[GameDB] Could not find 'eae22ec0' in GameDB
Get Reboot Request From EE

PlayStation 2 ======== Soft reboot


IOP Realtime Kernel Ver.0.9.1

    Copyright 1999 (C) Sony Computer Entertainment Inc. 

Reboot service module.(99/11/10)
cdvd driver module version 0.1.1 (C)SCEI
Load File service.(99/11/05)
Multi Threaded Fileio module.(99/11/15) 
iop heap service (99/11/03)
read/write allocate memory 4000
open name rom0:ROMVER flag 1 data 41278
open fd = 2
(UpdateVSyncRate) Mode Changed to NTSC.
(UpdateVSyncRate) Mode Changed to NTSC.
hooking std streams...
	stdout...
	replacing stderr with stdout...
	replacing EE_SIO with stdout...
PS2BBL: starting with 1 argumments:

PS2BBL: starting with 1 argumments:
	argv[0] = [host:C:\Users\Usuario\Documents\GitHub\PlayStation2-Basic-Bootloader\bin\PS2BBL.ELF]

	argv[0] = [host:C:¥Users¥Usuario¥Documents¥GitHub¥PlayStation2-Basic-Bootloader¥bin¥PS2BBL.ELF]
enabling LoadModuleBuffer

enabling LoadModuleBuffer
disabling MODLOAD device blacklist/whitelist

disabling MODLOAD device blacklist/whitelist
loadmodule: fname rom0:SIO2MAN args 0 arg 
loadmodule: id 25, ret 0
 [SIO2MAN]: 25

 [SIO2MAN]: 25
loadmodule: fname rom0:MCMAN args 0 arg 
loadmodule: id 26, ret 0
 [MCMAN]: 26

 [MCMAN]: 26
loadmodule: fname rom0:MCSERV args 0 arg 
loadmodule: id 27, ret 0
 [MCSERV]: 27

 [MCSERV]: 27
loadmodule: fname rom0:PADMAN args 0 arg 
Pad driver. (99/11/22)
loadmodule: id 28, ret 0
 [PADMAN]: 28

 [PADMAN]: 28
Block Device Manager (BDM) v1.1
BDM: connecting fs MBR
BDM: connecting fs GPT
BDM: BDM event thread running
 [BDM]: ret=0, ID=29

 [BDM]: ret=0, ID=29
BDM FatFs driver (FAT/exFAT) v1.4
BDM: connecting fs fatfs
 [BDMFS_FATFS]: ret=0, ID=30

 [BDMFS_FATFS]: ret=0, ID=30
FreeUsbd v.0.1.2
 [USBD]: ret=0, ID=31

 [USBD]: ret=0, ID=31
USBMASS: USB MASS Driver v1.1
 [USBMASS_BD]: ret=0, ID=32

 [USBMASS_BD]: ret=0, ID=32
open name rom0:ROMVER flag 1 data 41278
open fd = 2
loadmodule: fname rom0:ADDDRV args 0 arg 
loadmodule: id -203, ret 0
 [ADDDRV]: -203

 [ADDDRV]: -203
init OSD system paths

init OSD system paths
open name rom0:ROMVER flag 1 data 41278
open fd = 2
open name rom0:OSDVER flag 1 data 41278
open fd = -2
Certifying CDVD Boot

Certifying CDVD Boot
init OSD

init OSD
init ROMVER, model name ps1dvr and dvdplayer ver

init ROMVER, model name ps1dvr and dvdplayer ver
open name rom0:ROMVER flag 1 data 41278
open fd = 2
open name rom0:PS1ID flag 1 data 41278
open fd = -2
open name rom0:OSDVER flag 1 data 41278
open fd = -2
open name rom1:DVDID flag 1 data 41278
open fd = -6
Saving OSD configuration

Saving OSD configuration
open name rom0:OSDVER flag 1 data 41278
open fd = -2
open name rom0:OSDVER flag 1 data 41278
open fd = -2
open name rom0:OSDVER flag 1 data 41278
open fd = -2
open name rom0:OSDVER flag 1 data 41278
open fd = -2
trying to enable remote control

trying to enable remote control
Setting vmode

Setting vmode
Init pads

Init pads
PadInitPads: start

PadInitPads: start
PadInitPads: padPortOpen(0, 0, padArea[0])

PadInitPads: padPortOpen(0, 0, padArea[0])
PadInitPads: padPortOpen(1, 0, padArea[1])

PadInitPads: padPortOpen(1, 0, padArea[1])
Init timer and wait for rescue mode key

Init timer and wait for rescue mode key
load default settings

load default settings
Reading settings...

Reading settings...
open name mass:/PS2BBL/CONFIG.INI flag 1 data 41278
open fd = -12
Cant load config from mass

Cant load config from mass
open name mc0:/PS2BBL/CONFIG.INI flag 1 data 41278
open fd = -4
Cant load config from mc0

Cant load config from mc0
open name mc1:/PS2BBL/CONFIG.INI flag 1 data 41278
open fd = -4
Cant load config from mc1

Cant load config from mc1
open name mc0:/BOOT/ULE.ELF flag 1 data 41278
open fd = -4
open name mc1:/BOOT/ULE.ELF flag 1 data 41278
open fd = -4
open name mc0:/APPS/ULE/ELF flag 1 data 41278
open fd = -4
open name mc1:/APPS/ULE/ELF flag 1 data 41278
open fd = -4
open name mc0:/OPL/OPNPS2LD.ELF flag 1 data 41278
open fd = -4
open name mc1:/OPL/OPNPS2LD.ELF flag 1 data 41278
open fd = -4
open name mc0:/APPS/OPNPS2LD/ELF flag 1 data 41278
open fd = -4
open name mc1:/APPS/OPNPS2LD/ELF flag 1 data 41278
open fd = -4
open name mc0:/BOOT/BOOT2.ELF flag 1 data 41278
open fd = -4
open name mc1:/BOOT/BOOT2.ELF flag 1 data 41278
open fd = -4
open name mc0:/APPS/ULE.ELF flag 1 data 41278
open fd = -4
open name mc1:/APPS/ULE.ELF flag 1 data 41278
open fd = -4
(VMManager) Pausing...
Add 9 seconds play time to eae22ec0 -> now 9
Scanning C:\Users\Usuario\Documents\GitHub\KELFBinder\bin (recursively)
Releasing host memory for virtual systems...
@israpps israpps added the Bug label Aug 14, 2023
@F0bes
Copy link
Member

F0bes commented Aug 14, 2023

So what is expected from us if the SDK is going to use the same syscall as we do? That syscall index was purposely chosen years ago because it wasn't used by anything (that we knew of). This is an oversight from the SDK.
I recommend updating the InitDebug() function to allow you to opt out of setting the syscall, if that makes sense for your workflow.

@F0bes F0bes closed this as not planned Won't fix, can't repro, duplicate, stale Aug 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants