Created
March 25, 2023 10:52
-
-
Save chainq/0b1a628916a32ee6d93d9749de2d087c to your computer and use it in GitHub Desktop.
NetBSD Console Debug patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/sys/arch/amiga/stand/bootblock/boot/console.c b/sys/arch/amiga/stand/bootblock/boot/console.c | |
index 08cb523adccd..801be4cc5c95 100644 | |
--- a/sys/arch/amiga/stand/bootblock/boot/console.c | |
+++ b/sys/arch/amiga/stand/bootblock/boot/console.c | |
@@ -43,6 +43,24 @@ | |
#include "amigaio.h" | |
#include "libstubs.h" | |
+int32_t EasyRequestArgs(void *, void *, u_int32_t *, void *); | |
+ | |
+struct EasyStruct { | |
+ u_int32_t es_StructSize; | |
+ u_int32_t es_Flags; | |
+ char *es_Title; | |
+ char *es_TextFormat; | |
+ char *es_GadgetFormat; | |
+}; | |
+ | |
+const u_int32_t dbg[] = { | |
+ sizeof(struct EasyStruct), | |
+ 0L, | |
+ (u_int32_t)"DEBUG", | |
+ (u_int32_t)"cannot open console.device! %ld", | |
+ (u_int32_t)"OK" | |
+}; | |
+ | |
const u_int32_t screentags[] = { | |
SA_Type, CUSTOMSCREEN, | |
SA_DisplayID, 0x8000, | |
@@ -107,6 +125,7 @@ conspreinit(void) | |
int | |
consinit(void *consptr) { | |
struct Console *mc; | |
+ u_int32_t errc; | |
if (consptr != NULL) { | |
/* Check magic? */ | |
@@ -138,8 +157,14 @@ consinit(void *consptr) { | |
goto err; | |
mc->cnior->buf = (void *)mc->w; | |
+ mc->cnior->length = 136; /* sizeof(struct Window) */ | |
if (OpenDevice("console.device", 0, mc->cnior, 0)) | |
+ { | |
+ errc = mc->cnior->err; | |
+ EasyRequestArgs(mc->w,(void *)&dbg,0L,&errc); | |
goto err; | |
+ } | |
+ | |
mc->tmior = (struct TimerIO *)CreateIORequest(mc->cnmp, sizeof(struct TimerIO)); | |
if (!mc->tmior) | |
diff --git a/sys/arch/amiga/stand/bootblock/boot/libstubs.s b/sys/arch/amiga/stand/bootblock/boot/libstubs.s | |
index 6ffdaf896bf0..b815568c1fee 100644 | |
--- a/sys/arch/amiga/stand/bootblock/boot/libstubs.s | |
+++ b/sys/arch/amiga/stand/bootblock/boot/libstubs.s | |
@@ -238,6 +238,22 @@ ENTRY_NOPROFILE(Permit) | |
.comm _C_LABEL(IntuitionBase),4 | |
+ENTRY_NOPROFILE(EasyRequestArgs) | |
+ movl %a6,%sp@- | |
+ movl %a2,%sp@- | |
+ movl %a3,%sp@- | |
+ movl %pc@(_C_LABEL(IntuitionBase):w),%a6 | |
+ movl %sp@(16),%a0 | |
+ movl %sp@(20),%a1 | |
+ movl %sp@(24),%a2 | |
+ movl %sp@(28),%a3 | |
+ jsr %a6@(-0x24c) | |
+ movl %sp@+,%a3 | |
+ movl %sp@+,%a2 | |
+ movl %sp@+,%a6 | |
+ rts | |
+ | |
+ | |
ENTRY_NOPROFILE(OpenScreenTagList) | |
movl %a6,%sp@- | |
movl %pc@(_C_LABEL(IntuitionBase):w),%a6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Because the NetBSD bootblock compiles w/o the AmigaOS NDK/SDK or whatever it's called this week, and they implemented part of the headers that is absolutely needed. Therefore
struct Window
is not available, so you can'tsizeof
it. So the comment just explains what that magic number actually is.I mean, I technically could have declared a 136 byte dummy struct as Window, and
sizeof
it, but ... It's messy either way. Pick your poison.