Hello,
Damien Zammit, le dim. 18 janv. 2026 03:47:01 +0000, a ecrit:
> Because GS segment does not work this early and breaks CPU_NUMBER.
?
kdopen/close/get/setkbent/kdstart are normally all only called by
userland, so gs should be initialized since long. In which context do
you see them called early?
Samuel
> ---
> i386/i386at/kd.c | 45 +++++++++++++++++++++++++++++----------------
> 1 file changed, 29 insertions(+), 16 deletions(-)
>
> diff --git a/i386/i386at/kd.c b/i386/i386at/kd.c
> index ea2e4ef5..52bba24e 100644
> --- a/i386/i386at/kd.c
> +++ b/i386/i386at/kd.c
> @@ -439,15 +439,18 @@ kdopen(
> io_req_t ior)
> {
> struct tty *tp;
> - spl_t o_pri;
> + spl_t o_pri = -1;
>
> tp = &kd_tty;
> - o_pri = simple_lock_irq(&tp->t_lock);
> + if (spl_init)
> + o_pri = simple_lock_irq(&tp->t_lock);
> if (!(tp->t_state & (TS_ISOPEN|TS_WOPEN))) {
> /* XXX ttychars allocates memory */
> - simple_unlock_nocheck(&tp->t_lock.slock);
> + if (spl_init)
> + simple_unlock_nocheck(&tp->t_lock.slock);
> ttychars(tp);
> - simple_lock_nocheck(&tp->t_lock.slock);
> + if (spl_init)
> + simple_lock_nocheck(&tp->t_lock.slock);
> /*
> * Special support for boot-time rc scripts, which don't
> * stty the console.
> @@ -459,7 +462,8 @@ kdopen(
> kdinit();
> }
> tp->t_state |= TS_CARR_ON;
> - simple_unlock_irq(o_pri, &tp->t_lock);
> + if (spl_init)
> + simple_unlock_irq(o_pri, &tp->t_lock);
> return (char_open(dev, tp, flag, ior));
> }
>
> @@ -483,10 +487,12 @@ kdclose(dev_t dev, int flag)
>
> tp = &kd_tty;
> {
> - spl_t s;
> - s = simple_lock_irq(&tp->t_lock);
> + spl_t s = -1;
> + if (spl_init)
> + s = simple_lock_irq(&tp->t_lock);
> ttyclose(tp);
> - simple_unlock_irq(s, &tp->t_lock);
> + if (spl_init)
> + simple_unlock_irq(s, &tp->t_lock);
> }
>
> return;
> @@ -650,13 +656,16 @@ int
> kdgetkbent(struct kbentry *kbent)
> {
> u_char *cp;
> - spl_t o_pri = SPLKD(); /* probably superfluous */
> + spl_t o_pri = -1;
>
> + if (spl_init)
> + o_pri = SPLKD(); /* probably superfluous */
> cp = &key_map[kbent->kb_index][CHARIDX(kbent->kb_state)];
> kbent->kb_value[0] = *cp++;
> kbent->kb_value[1] = *cp++;
> kbent->kb_value[2] = *cp;
> - (void)splx(o_pri);
> + if (spl_init)
> + (void)splx(o_pri);
> return(0);
> }
>
> @@ -672,14 +681,16 @@ kdsetkbent(
> int flags) /* flags set for
> console */
> {
> u_char *cp;
> - spl_t o_pri;
> + spl_t o_pri = -1;
>
> - o_pri = SPLKD();
> + if (spl_init)
> + o_pri = SPLKD();
> cp = &key_map[kbent->kb_index][CHARIDX(kbent->kb_state)];
> *cp++ = kbent->kb_value[0];
> *cp++ = kbent->kb_value[1];
> *cp = kbent->kb_value[2];
> - (void)splx(o_pri);
> + if (spl_init)
> + (void)splx(o_pri);
> return(0);
> }
>
> @@ -1047,7 +1058,7 @@ kdstate2idx(unsigned int state,
> /* bit vector, not a state index */
> void
> kdstart(struct tty *tp)
> {
> - spl_t o_pri;
> + spl_t o_pri = -1;
> int ch;
>
> if (tp->t_state & TS_TTSTOP)
> @@ -1062,9 +1073,11 @@ kdstart(struct tty *tp)
> * Drop priority for long screen updates. ttstart() calls us at
> * spltty.
> */
> - o_pri = splsoftclock(); /* block timeout */
> + if (spl_init)
> + o_pri = splsoftclock(); /* block timeout */
> kd_putc_esc(ch);
> - splx(o_pri);
> + if (spl_init)
> + splx(o_pri);
> }
> if (tp->t_outq.c_cc <= TTLOWAT(tp)) {
> tt_write_wakeup(tp);
> --
> 2.51.0
>
>
>
--
Samuel
> Quelqu'un aurait-il une solution pour réinitialiser un MBR
Si tu veux qu'il soit complètement blanc (pas souhaitable, à mon avis) :
dd if=/dev/zero of=/dev/hda bs=512 count=1 (sous Linux)
-+- OT in Guide du linuxien (très) pervers - "Pour les K difficiles" -+-