Project

General

Profile

Bug #2080

cpr doesn't even nearly work if built with gcc

Added by Rich Lowe almost 9 years ago. Updated over 8 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
kernel
Start date:
2012-02-05
Due date:
% Done:

100%

Estimated time:
Difficulty:
Hard
Tags:
Gerrit CR:

Description

the CPR code contains code in cpr_wakecode.s which is much like the CPU boot code in general. Unfortunately, because of brokenness in the Sun assembler, a lot of this code is written backwards and/or inside out, as far as data size prefixes.

Even more unfortunately, the GCC code was not written (though it is during actual boot, of course).

Even more unfortunately, the condition used to identify GNU as is incorrect, so we assembler the Studio code, which then doesn't work.

Using the real MP boot as an inspiration, someone should write a version of cpr_wakecode that is no longer inside out, and which thus may work with GCC.

To do this, they should also correct the macro used to spot GNU as, which they can also crib from the real mp boot.

searching the source base for "Vulcan" (the version of studio which broke the assembler), will find all relevant code.

#1

Updated by Rich Lowe over 8 years ago

  • Assignee set to Rich Lowe

Sod it, should be fun

#2

Updated by Rich Lowe over 8 years ago

This is fun.

On x64 we always use gas, via the assembler wrapper, 'aw'. Because of Randy's typo, this means that the current cpr_wakecode.s, when built 64bit, must work with gas (it's all that's ever built it!). However, he's written while attempting to avoid a bug in an assembler he isn't using. Confusion abounds and continues.

On x86 we normally use studio as, directly, and only use gas when using gcc. Thus the 32bit cpr_wakecode.s needs work, presumably, and fails because of the as-mismatch and brouhaha.

This also means that in general, including in the matching mpcore.s files, the "studio and 64bit" side of the condition is never used, and the "gcc and 32bit" condition rarely used.

#3

Updated by Rich Lowe over 8 years ago

  • % Done changed from 0 to 60

The problem on the 32bit side is that by sheer bad luck the Sun as negation syntax is such that GNU as parses it as constant "-1", this causes us to botch %cr4 on resume and fault pretty much infinitely.

The fix is to use the asm_linkage macros _CONST() and _BITNOT() in the cpr sources, as they should have done from the start.

#4

Updated by Rich Lowe over 8 years ago

  • Status changed from New to Resolved
  • % Done changed from 60 to 100
  • Tags deleted (needs-triage)

Resolved in r13646 commit:8f5bd7d387bc

Also available in: Atom PDF