debug(desktop,uhci): malloc 判空失败处打印实际返回值,定位 mm.malloc 返回值与调用方接收不一致
This commit is contained in:
1 parent
cdee5e0e87
commit
4c25e0e35c
2 files changed
+13
No files matched your search
@@ -7,6 +7,7 @@ import platform.pch.timer as timer
|
||||
import intr.idt as idt
|
||||
import platform.pch.pic as pic
|
||||
import drivers.usb.pci as pci
|
||||
import viperlib
|
||||
|
||||
UHCI_USBCMD: t.CDefine = 0x00
|
||||
UHCI_USBSTS: t.CDefine = 0x02
|
||||
@@ -253,6 +254,9 @@ def init(io_base: t.CUInt16T) -> t.CInt:
|
||||
|
||||
serial.puts("[uhci] allocating frame list...\n")
|
||||
_frame_list = mm.malloc(UHCI_NUM_FRAMES * 4)
|
||||
_dbg_fl: t.CArray[t.CChar, 96]
|
||||
viperlib.snprintf(c.Addr(_dbg_fl), 96, "[dbg] frame_list ret=0x%lx\n", t.CUInt64T(_frame_list))
|
||||
serial.puts(c.Addr(_dbg_fl))
|
||||
if _frame_list is None:
|
||||
serial.puts("[uhci] frame list alloc failed\n")
|
||||
return -2
|
||||
|
||||
@@ -1856,6 +1856,9 @@ def start(fb_ptr: t.CVoid | t.CPtr, w: t.CInt, h: t.CInt, pitch: t.CInt = 0) ->
|
||||
return None
|
||||
|
||||
_back_fb = mm.malloc(w * h * 4)
|
||||
_dbg_bf: t.CArray[t.CChar, 96]
|
||||
viperlib.snprintf(c.Addr(_dbg_bf), 96, "[dbg] back_fb ret=0x%lx w=%d h=%d\n", t.CUInt64T(_back_fb), w, h)
|
||||
serial.puts(c.Addr(_dbg_bf))
|
||||
if _back_fb:
|
||||
string.memset(_back_fb, 0, w * h * 4)
|
||||
else:
|
||||
@@ -1863,12 +1866,18 @@ def start(fb_ptr: t.CVoid | t.CPtr, w: t.CInt, h: t.CInt, pitch: t.CInt = 0) ->
|
||||
return None
|
||||
|
||||
_row_buf = mm.malloc(w * 4)
|
||||
_dbg_rb: t.CArray[t.CChar, 96]
|
||||
viperlib.snprintf(c.Addr(_dbg_rb), 96, "[dbg] row_buf ret=0x%lx\n", t.CUInt64T(_row_buf))
|
||||
serial.puts(c.Addr(_dbg_rb))
|
||||
if _row_buf:
|
||||
string.memset(_row_buf, 0, w * 4)
|
||||
else:
|
||||
serial.puts("[desktop] row_buf malloc FAILED!\n")
|
||||
|
||||
_bg_row_buf = mm.malloc(w * 4)
|
||||
_dbg_br: t.CArray[t.CChar, 96]
|
||||
viperlib.snprintf(c.Addr(_dbg_br), 96, "[dbg] bg_row_buf ret=0x%lx\n", t.CUInt64T(_bg_row_buf))
|
||||
serial.puts(c.Addr(_dbg_br))
|
||||
if _bg_row_buf:
|
||||
desktop_init_col: t.CUInt32T = gfx.COLOR_RGB(25, 25, 35)
|
||||
for ri in range(w):
|
||||
|
||||
Reference in new issue
Block a user