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

Wrong sem_id in semtest #5

Open
eternalNight opened this issue Sep 8, 2012 · 3 comments
Open

Wrong sem_id in semtest #5

eternalNight opened this issue Sep 8, 2012 · 3 comments

Comments

@eternalNight
Copy link
Collaborator

Description

In the unit test semtest, the sem_id doesn't meet the constraint in the test spec file.

Commit

7e99100 unittest: Adapt tests on sfs to the current sfsimg.

Reproduce Steps

cd ucore
make ARCH=i386 menuconfig
UCORE_TEST=/testbin/semtest make kernel
UCORE_TEST=/testbin/semtest make sfsimg
make swapimg
./uCore_test -sf src/user-ucore/testspecs/semtest.testspec

Current Result

The unit test fail with

!! error: missing 'sem_id = 0x07......'

In serial.log, the sem_id is

sem_id = 0x000000011fe625e0

Expected Result

The unit test doesn't fail with the line mentioned above.
Either provide a fix for the kernel or update the test spec with reasonable analysis.

@chyh1990
Copy link
Collaborator

chyh1990 commented Sep 9, 2012

I change the sem_id base to a large integer.
Originally, sem_id started from 0 is a problem

@eternalNight
Copy link
Collaborator Author

If so, this may not be an issue on arm as it's sem_id is the 64-bit representation of the required in pattern "0x07......". But the sem_id on i386 still looks strange to me.

BTW, what's the problem caused by sem_id starting from 0?

@chyh1990
Copy link
Collaborator

chyh1990 commented Sep 9, 2012

#define VALID_SEMID(sem_id)
((uintptr_t)(sem_id) < (uintptr_t)(sem_id) + PBASE)

#define semid2sem(sem_id)
((semaphore_t *)((uintptr_t)(sem_id) + PBASE))

#define sem2semid(sem)
((sem_t)((uintptr_t)(sem) - PBASE))

/* This must NOT be 0 */
#define PBASE (KERNBASE+0x100)

on some platforms, KERNBASE may be 0, so i add 0x100 to it

On Sun, Sep 9, 2012 at 12:21 PM, Mao Junjie notifications@github.comwrote:

If so, this may not be an issue on arm as it's sem_id is the 64-bit
representation of the required in pattern "0x07......". But the sem_id on
i386 still looks strange to me.

BTW, what's the problem caused by sem_id starting from 0?


Reply to this email directly or view it on GitHubhttps://github.com//issues/5#issuecomment-8400567.

Chen Yuheng
Computer Science
Tsinghua University

wangrunji0408 added a commit that referenced this issue Dec 13, 2018
Create multi-arch user SFS image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants